示例#1
0
  public boolean hasAttributes() {

    Enumeration e = _attrTbl.getNames();

    if (e.hasMoreElements()) return (true);

    return (false);
  }
示例#2
0
  /** @see org.w3c.dom.Document#createAttribute */
  public org.w3c.dom.Attr createAttribute(String name) throws DOMException {
    AttVal av = new AttVal(null, null, '"', name, null);
    if (av != null) {
      av.dict = AttributeTable.getDefaultAttributeTable().findAttribute(av);
      return av.getAdapter();
    }

    return null;
  }
示例#3
0
  /**
   * Draws all features that match the given attribute stored in the given column of the attribute
   * table. If no features are found or the given column is out of bounds, nothing is drawn
   *
   * @param attribute Attribute identifying features to draw.
   * @param col Column in the attribute table (where ID is column 0) to search.
   */
  public void draw(String attribute, int col) {
    Set<Integer> ids = attributes.match(attribute, col);

    for (Integer id : ids) {
      Feature feature = features.get(id);
      if (feature != null) {
        feature.draw(this);
      }
    }
  }
 private void selectTable(Component component, Point point) throws AssertionError {
   int componentCount = getComponentCount();
   for (int i = componentCount; i > 0; ) {
     remove(--i);
   }
   if (component instanceof AttributeTable) {
     table = (AttributeTable) component;
     row = table.rowAtPoint(point);
     if (table.getValueAt(row, 0).equals("")) {
       row--;
     }
     int selectedRow = table.getSelectedRow();
   } else if (component instanceof JTableHeader) {
     JTableHeader header = (JTableHeader) component;
     table = (AttributeTable) header.getTable();
     row = -1;
   } else {
     throw new AssertionError();
   }
   table.requestFocus();
 }
 private void make() {
   String attributeViewType = table.getAttributeView().getViewType();
   AttributeTableModel model = table.getAttributeTableModel();
   int rowCount = model.getRowCount();
   if (attributeViewType.equals(AttributeTableLayoutModel.SHOW_ALL)) {
     if (rowCount != 0) {
       add(getOptimalWidth());
     }
     add(getInsert());
     if (row != -1) {
       add(getDelete());
       if (row != 0) {
         add(getUp());
       }
       if (row != rowCount - 1) {
         add(getDown());
       }
     }
   } else {
     if (rowCount != 0) {
       add(getOptimalWidth());
     }
   }
 }
示例#6
0
文件: dap_test.java 项目: visad/visad
  private static void test_das() {
    System.out.println("DAS test:");

    DAS table = new DAS();
    AttributeTable at = new AttributeTable();
    try {
      at.appendAttribute("Authors", Attribute.STRING, "jehamby");
      at.appendAttribute("Authors", Attribute.STRING, "jimg");
      at.addAlias("Creators", "Authors");
      AttributeTable cont = at.appendContainer("Container");
      cont.appendAttribute("Numbers", Attribute.INT32, "123");
      cont.appendAttribute("Floats", Attribute.FLOAT64, "456.0");
      table.addAttributeTable("table1", at);
      at = new AttributeTable();
      at.appendAttribute("another", Attribute.BYTE, "12");
      table.addAttributeTable("table2", at);
    } catch (DASException e) {
      System.out.println("Error constructing DAS: " + e);
    }

    // print the table
    table.print(System.out);

    // get a name from the table
    String author2 = table.getAttributeTable("table1").getAttribute("Creators").getValueAt(1);
    System.out.println("author2 = " + author2);

    // test Cloneable interface
    DAS table2 = (DAS) table.clone();
    System.out.println("\nCloned table:");
    table2.print(System.out);

    // add an attribute to table1 and verify it's not in table 2
    at = new AttributeTable();
    table.addAttributeTable("empty", at);
    if (table2.getAttributeTable("empty") != null) System.out.println("DAS clone failed");
    else System.out.println("DAS clone passed");
  }
 protected void firePopupMenuWillBecomeInvisible() {
   if (row != -1) {
     table.removeRowSelectionInterval(row, row);
   }
   EventQueue.invokeLater(
       new Runnable() {
         public void run() {
           final KeyboardFocusManager focusManager =
               java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager();
           final Component focusOwner =
               SwingUtilities.getAncestorOfClass(
                   AttributeTable.class, focusManager.getFocusOwner());
           if (table != focusOwner && focusOwner instanceof JComponent) {
             table.requestFocus(true);
             ((JComponent) focusOwner).requestFocus();
           }
           table = null;
         }
       });
 }
示例#8
0
 public void addAttributeContainer(AttributeTable at) throws AttributeExistsException {
   _attrTbl.addContainer(at.getClearName(), at);
 }
示例#9
0
 public void printAttributes(PrintWriter pw, String pad) {
   _attrTbl.print(pw, pad);
 }
示例#10
0
 public void printAttributes(PrintWriter pw) {
   _attrTbl.print(pw);
 }
示例#11
0
 public void printAttributes(OutputStream os, String pad) {
   _attrTbl.print(os, pad);
 }
示例#12
0
 public void printAttributes(OutputStream os) {
   _attrTbl.print(os);
 }
示例#13
0
 public Enumeration getAttributeNames() {
   return (_attrTbl.getNames());
 }
示例#14
0
 public Attribute getAttribute(String name) {
   return (_attrTbl.getAttribute(name));
 }
示例#15
0
 public void delAttribute(String name, int i) throws DASException {
   _attrTbl.delAttribute(name, i);
 }
示例#16
0
 public void delAttribute(String name) {
   _attrTbl.delAttribute(name);
 }
示例#17
0
 public AttributeTable appendAttributeContainer(String name) {
   return (_attrTbl.appendContainer(name));
 }
示例#18
0
 public void appendAttribute(String name, int type, String value) throws DASException {
   _attrTbl.appendAttribute(name, type, value);
 }
示例#19
0
 public void addAttributeAlias(String alias, String attributeName) throws DASException {
   _attrTbl.addAlias(alias, attributeName);
 }
 protected void firePopupMenuWillBecomeVisible() {
   if (row != -1) {
     table.addRowSelectionInterval(row, row);
   }
 }
示例#21
0
 /**
  * Sets the unencoded name of the class instance.
  *
  * @param n the unencoded name of the class instance.
  */
 @Override
 public void setClearName(String n) {
   super.setClearName(n);
   if (_attr != null) _attr.setClearName(n);
   if (_attrTbl != null) _attrTbl.setClearName(n);
 }