home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2001 October / PCpro_2001_10.ISO / xml / xmlpro / data1.cab / Program_Executable_FILES / xmlpro.jar / AttribPanel.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-09-15  |  2.8 KB  |  96 lines

  1. import COM.objectspace.jgl.Array;
  2. import java.awt.Component;
  3. import java.awt.Container;
  4. import java.awt.Dimension;
  5. import java.awt.event.TextEvent;
  6. import java.awt.event.TextListener;
  7. import java.util.Enumeration;
  8. import javax.swing.JLabel;
  9. import javax.swing.JPanel;
  10. import javax.swing.JScrollPane;
  11. import jclass.bwt.JCAlignerLayout;
  12. import org.w3c.dom.Element;
  13. import org.w3c.dom.NamedNodeMap;
  14. import org.w3c.dom.Node;
  15.  
  16. public class AttribPanel extends JScrollPane implements TextListener {
  17.    JPanel curr;
  18.    XMLPro theApp;
  19.    Element currElem = null;
  20.  
  21.    AttribPanel(JPanel var1, XMLPro var2) {
  22.       super(var1);
  23.       this.theApp = var2;
  24.       this.curr = var1;
  25.       ((Container)var1).setLayout(new JCAlignerLayout());
  26.    }
  27.  
  28.    void clear() {
  29.       this.curr.removeAll();
  30.       ((Component)this).getParent().getParent().repaint();
  31.    }
  32.  
  33.    public void editElement(Node var1) {
  34.       this.curr.removeAll();
  35.       boolean var2 = false;
  36.       NamedNodeMap var3 = var1.getAttributes();
  37.       if (var1 instanceof Element) {
  38.          this.currElem = (Element)var1;
  39.          String var5 = this.currElem.getTagName().toString();
  40.          ElementVector var6 = (ElementVector)this.theApp.xmlDocument.dtdElemVals.get(var5);
  41.          ElementVector var7 = (ElementVector)this.theApp.xmlDocument.elemVals.get(var5);
  42.          if (var6 != null) {
  43.             Enumeration var8 = ((Array)var6).elements();
  44.  
  45.             while(var8.hasMoreElements()) {
  46.                AttDefn var9 = (AttDefn)var8.nextElement();
  47.                String var10 = var9.id.toString();
  48.                Object var11 = null;
  49.                String var12 = this.currElem.getAttribute(var10);
  50.                String var18 = var12;
  51.                AttribEditor var4;
  52.                if (var9.enum) {
  53.                   if (var18 == null) {
  54.                      var18 = var9.def;
  55.                   }
  56.  
  57.                   var4 = new AttribEditor(var18, var9.values, var10, this.currElem, var9.fixed, this.theApp);
  58.                } else {
  59.                   if (var18 == null) {
  60.                      var18 = var9.def;
  61.                   }
  62.  
  63.                   var4 = new AttribEditor(var18, var10, this.currElem, var9.fixed, this.theApp);
  64.                }
  65.  
  66.                JLabel var13 = new JLabel(var9.id.toString());
  67.                this.curr.add(var13);
  68.                this.curr.add(var4.control);
  69.             }
  70.          } else if (var7 != null) {
  71.             Enumeration var15 = ((Array)var7).elements();
  72.  
  73.             while(var15.hasMoreElements()) {
  74.                String var16 = (String)var15.nextElement();
  75.                String var17 = this.currElem.getAttribute(var16);
  76.                String var19 = var17;
  77.                AttribEditor var14 = new AttribEditor(var19, var16, this.currElem, false, this.theApp);
  78.                JLabel var20 = new JLabel(var16);
  79.                this.curr.add(var20);
  80.                this.curr.add(var14.control);
  81.             }
  82.          }
  83.  
  84.          ((Component)this).getParent().getParent().validate();
  85.          ((Component)this).getParent().getParent().repaint();
  86.       }
  87.    }
  88.  
  89.    public Dimension getPreferredSize() {
  90.       return new Dimension(400, 200);
  91.    }
  92.  
  93.    public void textValueChanged(TextEvent var1) {
  94.    }
  95. }
  96.