/** * Adds the default renderers and editors for all known data types * * @param table */ private void initAttributeTable(final EnhancedTable table) { ar = new AttributeRenderer(this); ae = new AttributeEditor(this); ae.setEditClickCount(2); TableCellRenderer r = table.getTableHeader().getDefaultRenderer(); table.getTableHeader().setDefaultRenderer(new ProxyTableCellRenderer(r)); table.setDefaultRenderer(Descriptor.class, ar); table.setDefaultRenderer(Attribute.class, ar); table.setDefaultEditor(Attribute.class, ae); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.addTableListener( new TableListener() { public void contextClick(TableEvent e) { // TODO: Should display context menu offering: sort ascending/descending; show/hide/lock } public void actionClick(TableEvent e) {} public void click(TableEvent e) { if (e.getRow() == -1) { ViperTableModel m = getCurrentModel(); int modelIndex = table.convertColumnIndexToModel(e.getColumn()); AttrConfig ac = m.getAttributeForColumn(modelIndex); NodeVisibilityManager H = mediator.getHiders(); if (ac != null) { int oldV = H.getAttrConfigVisibility(ac); H.setVisibilityByAttrConfig(ac, NodeVisibilityManager.ROTATE_VISIBILITY[oldV]); } else if (m.getInternalColumn(modelIndex) == ViperTableModel.BY_VALID) { Config config = m.getConfig(); int oldV = H.getConfigVisibility(config); H.setVisibilityByConfig( config, NodeVisibilityManager.ROTATE_RANGE_VISIBILITY[oldV]); } } } public void altClick(TableEvent e) {} }); }