1 package org.xmlhammer.gui.util;
2
3 import java.net.URI;
4
5 import org.bounce.util.URIUtils;
6 import org.xmlhammer.gui.Page;
7 import org.xmlhammer.gui.history.HistoryComboBox;
8 import org.xmlhammer.gui.history.HistoryComboBoxModel;
9
10 public class URIHistoryComboBox extends HistoryComboBox {
11 private static final long serialVersionUID = 3609575909833268238L;
12
13 public URIHistoryComboBox(Page page, HistoryComboBoxModel model) {
14 super(page, model);
15 }
16
17 public void setURI(URI uri) {
18 if ( uri != null && uri.toString().length() > 0) {
19 setValue(URIUtils.toString(uri));
20 } else {
21 setValue(null);
22 }
23 }
24
25 public URI getURI() {
26 if (!isEmpty()) {
27 return URIUtils.createURI(getEditor().getItem().toString());
28 }
29
30 return null;
31 }
32 }