home *** CD-ROM | disk | FTP | other *** search
- import COM.objectspace.jgl.Array;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.event.TextEvent;
- import java.awt.event.TextListener;
- import java.util.Enumeration;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- import javax.swing.JScrollPane;
- import jclass.bwt.JCAlignerLayout;
- import org.w3c.dom.Element;
- import org.w3c.dom.NamedNodeMap;
- import org.w3c.dom.Node;
-
- public class AttribPanel extends JScrollPane implements TextListener {
- JPanel curr;
- XMLPro theApp;
- Element currElem = null;
-
- AttribPanel(JPanel var1, XMLPro var2) {
- super(var1);
- this.theApp = var2;
- this.curr = var1;
- ((Container)var1).setLayout(new JCAlignerLayout());
- }
-
- void clear() {
- this.curr.removeAll();
- ((Component)this).getParent().getParent().repaint();
- }
-
- public void editElement(Node var1) {
- this.curr.removeAll();
- boolean var2 = false;
- NamedNodeMap var3 = var1.getAttributes();
- if (var1 instanceof Element) {
- this.currElem = (Element)var1;
- String var5 = this.currElem.getTagName().toString();
- ElementVector var6 = (ElementVector)this.theApp.xmlDocument.dtdElemVals.get(var5);
- ElementVector var7 = (ElementVector)this.theApp.xmlDocument.elemVals.get(var5);
- if (var6 != null) {
- Enumeration var8 = ((Array)var6).elements();
-
- while(var8.hasMoreElements()) {
- AttDefn var9 = (AttDefn)var8.nextElement();
- String var10 = var9.id.toString();
- Object var11 = null;
- String var12 = this.currElem.getAttribute(var10);
- String var18 = var12;
- AttribEditor var4;
- if (var9.enum) {
- if (var18 == null) {
- var18 = var9.def;
- }
-
- var4 = new AttribEditor(var18, var9.values, var10, this.currElem, var9.fixed, this.theApp);
- } else {
- if (var18 == null) {
- var18 = var9.def;
- }
-
- var4 = new AttribEditor(var18, var10, this.currElem, var9.fixed, this.theApp);
- }
-
- JLabel var13 = new JLabel(var9.id.toString());
- this.curr.add(var13);
- this.curr.add(var4.control);
- }
- } else if (var7 != null) {
- Enumeration var15 = ((Array)var7).elements();
-
- while(var15.hasMoreElements()) {
- String var16 = (String)var15.nextElement();
- String var17 = this.currElem.getAttribute(var16);
- String var19 = var17;
- AttribEditor var14 = new AttribEditor(var19, var16, this.currElem, false, this.theApp);
- JLabel var20 = new JLabel(var16);
- this.curr.add(var20);
- this.curr.add(var14.control);
- }
- }
-
- ((Component)this).getParent().getParent().validate();
- ((Component)this).getParent().getParent().repaint();
- }
- }
-
- public Dimension getPreferredSize() {
- return new Dimension(400, 200);
- }
-
- public void textValueChanged(TextEvent var1) {
- }
- }
-