Added in JList to the builder. Use type attribute as "jlist".

This commit is contained in:
grail%cafebabe.org 1999-02-19 02:39:00 +00:00
Родитель 518ec6a46e
Коммит d9e844d9df
1 изменённых файлов: 22 добавлений и 5 удалений

Просмотреть файл

@ -35,6 +35,7 @@ import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JFrame;
import javax.swing.JDialog;
import javax.swing.ButtonGroup;
@ -82,6 +83,7 @@ public class XMLPageBuilder extends XMLWidgetBuilder {
String id;
String attr;
PageModel model;
Class ref;
/**
* Build a menu builder which operates on XML formatted data
@ -96,6 +98,10 @@ public class XMLPageBuilder extends XMLWidgetBuilder {
this.model = model;
}
public void setReference(Class reference) {
ref = reference;
}
/**
* Read the input stream and build a menubar from it
*
@ -139,9 +145,15 @@ public class XMLPageBuilder extends XMLWidgetBuilder {
if (config.getAttribute("href") != null
&& config.getAttribute("role").equals("stringprops")
&& config.getTagName().equals("link")) {
linkURL = getClass().getResource(config.getAttribute("href"));
if (ref == null) {
linkURL = getClass().getResource(config.getAttribute("href"));
} else {
linkURL = ref.getResource(config.getAttribute("href"));
}
properties = new Properties();
if (linkURL != null) properties.load(linkURL.openStream());
if (linkURL != null) {
properties.load(linkURL.openStream());
}
}
} catch (IOException io) {
io.printStackTrace();
@ -323,6 +335,8 @@ public class XMLPageBuilder extends XMLWidgetBuilder {
item = buildTextField(current);
} else if (type.equals("button")) { // buttons
item = new JButton(getReferencedLabel(current, "command"));
} else if (type.equals("jlist")) {
item = buildList(current);
} else if (type.equals("custom")) {
item = new JButton("Custom");
}
@ -334,10 +348,15 @@ public class XMLPageBuilder extends XMLWidgetBuilder {
return item;
}
protected JList buildList(Element current) {
JList list = new JList();
return list;
}
protected JLabel buildLabel(Element current) {
JLabel label = new JLabel(getReferencedLabel(current, "title"));
label.setHorizontalAlignment(SwingConstants.RIGHT);
return label;
}
@ -361,8 +380,6 @@ public class XMLPageBuilder extends XMLWidgetBuilder {
} else {
parent.add(item, cons);
}
} else {
parent.add(item);
}
return item;