1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.xmlhammer.gui.xslt;
23
24 import java.awt.BorderLayout;
25 import java.net.URI;
26 import java.util.ArrayList;
27 import java.util.List;
28
29 import javax.swing.Icon;
30 import javax.swing.ImageIcon;
31 import javax.swing.JPanel;
32 import javax.swing.border.EmptyBorder;
33
34 import org.bounce.image.ImageLoader;
35 import org.xmlhammer.gui.history.HistoryUtilities;
36 import org.xmlhammer.gui.overview.OverviewNode;
37 import org.xmlhammer.gui.util.URIsPanel;
38 import org.xmlhammer.model.project.Document;
39
40 /***
41 * Input Panel.
42 *
43 * Allows to select either one URI, multiple URIs or
44 * a range of files.
45 *
46 * @version $Revision$, $Date$
47 * @author Edwin Dankert <edankert@gmail.com>
48 */
49
50 public class StylesheetURIsPanel extends JPanel implements OverviewNode {
51 private static final long serialVersionUID = 3689910673756729653L;
52 private static final String NO_LANGUAGE = "<No Language Specified>";
53
54 private static final ImageIcon COMBO_ICON = ImageLoader.get().getImage( "/org/xmlhammer/gui/icons/elcl16/view_menu.gif");
55
56 private StylesheetsPage parent = null;
57 private URIsPanel urisPanel = null;
58
59 /***
60 * Constructs a new Input Panel.
61 */
62 public StylesheetURIsPanel(StylesheetsPage parent) {
63 super( new BorderLayout());
64
65 this.parent = parent;
66
67 setBorder( new EmptyBorder( 10, 10, 0, 10));
68
69 urisPanel = new URIsPanel(parent, HistoryUtilities.getInstance().getStylesheets(), false, true);
70
71 JPanel mainPanel = new JPanel( new BorderLayout( 0, 5));
72 mainPanel.add(urisPanel, BorderLayout.CENTER);
73
74 add(mainPanel, BorderLayout.NORTH);
75 }
76
77 public void setURIs(URI base, List uris) {
78 urisPanel.reset();
79 urisPanel.setURIs(base, uris);
80 }
81
82 public List<Document> getURIs(URI base) {
83 return urisPanel.getURIs(base);
84 }
85
86 public void setEnabled(boolean enabled) {
87 urisPanel.setEnabled(enabled);
88 }
89
90 public boolean isEnabled() {
91 return urisPanel.isEnabled();
92 }
93
94 public String getError() {
95 return null;
96 }
97
98 public String getNodeName() {
99
100
101
102
103
104 return "test";
105 }
106
107 public ArrayList<OverviewNode> getChildNodes() {
108 if ( NO_LANGUAGE.equals( getNodeName())) {
109 return new ArrayList<OverviewNode>();
110 }
111
112 return urisPanel.getNodes();
113 }
114
115 public OverviewNode getParentNode() {
116 return parent;
117 }
118
119 public Icon getNodeIcon() {
120 return COMBO_ICON;
121 }
122
123 public void dispose() {
124 urisPanel.dispose();
125 }
126 }