private ColumnInfo[] createTreeColumns(DualViewColumnInfo[] columns) { Collection<ColumnInfo> result = new ArrayList<ColumnInfo>(); final ColumnInfo firstColumn = columns[0]; ColumnInfo firstTreeColumn = new ColumnInfo(firstColumn.getName()) { public Object valueOf(Object object) { return firstColumn.valueOf(object); } public Class getColumnClass() { return TreeTableModel.class; } public boolean isCellEditable(Object o) { return true; } }; result.add(firstTreeColumn); for (int i = 1; i < columns.length; i++) { DualViewColumnInfo column = columns[i]; if (column.shouldBeShownIsTheTree()) result.add(column); } return result.toArray(new ColumnInfo[result.size()]); }
public Class getColumnClass(int column) { if (column == 0) { return TreeTableModel.class; } else { return Object.class; } }
@Override public Class getColumnClass(final int column) { switch (column) { case TREE_COLUMN: return TreeTableModel.class; case SEVERITIES_COLUMN: return Icon.class; case IS_ENABLED_COLUMN: return Boolean.class; } throw new IllegalArgumentException(); }
@Override public TreeTableCellRenderer createTableRenderer(TreeTableModel treeTableModel) { TreeTableCellRenderer tableRenderer = super.createTableRenderer(treeTableModel); UIUtil.setLineStyleAngled(tableRenderer); tableRenderer.setRootVisible(false); tableRenderer.setShowsRootHandles(true); return tableRenderer; }
@Override public Class getColumnClass(final int column) { switch (column) { case 0: return TreeTableModel.class; case 1: return myValueClass; default: throw new RuntimeException("invalid column " + column); } }
public TreeTableCellRenderer createTableRenderer(final TreeTableModel treeTableModel) { return new TreeTableCellRenderer(this, getTree()) { public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { return super.getTableCellRendererComponent(table, value, showSelection && isSelected, showCellFocus && hasFocus, row, column); } }; }
private static <T> TreeTableModel createModel(final Collection<? extends TreeTableColumn<T>> columns, final ContentProvider<T> contentProvider) { final Collection<ColumnInfo> columnsInfos = new ArrayList<ColumnInfo>(columns.size()); boolean first = true; for (final TreeTableColumn<T> column : columns) { if (first) { columnsInfos.add(new TreeColumnInfo(column.getCaption())); } else { columnsInfos.add(new ColumnInfo(column.getCaption()) { public Object valueOf(final Object o) { return o; } public Class getColumnClass() { return TableColumnMarker.class; } }); } first = false; } final DefaultMutableTreeNode root; final Collection<? extends T> rootObjects = contentProvider.getRoots(); if (!rootObjects.isEmpty()) { if (rootObjects.size() == 1) { root = new DefaultMutableTreeNode(rootObjects.iterator().next()); addChildren(root, contentProvider); } else { root = new DefaultMutableTreeNode(HIDDEN_ROOT); for (final T rootObject : rootObjects) { final DefaultMutableTreeNode subRoot = new DefaultMutableTreeNode(rootObject); addChildren(subRoot, contentProvider); root.add(subRoot); } } } else { root = null; } return new ListTreeTableModelOnColumns(root, columnsInfos.toArray(new ColumnInfo[columnsInfos.size()])); }
@Override public Class getColumnClass(int column) { if (NotificationsTreeTable.DISPLAY_TYPE_COLUMN == column) { return NotificationDisplayType.class; } if (NotificationsTreeTable.LOG_COLUMN == column) { return Boolean.class; } if (NotificationsTreeTable.READ_ALOUD_COLUMN == column) { return Boolean.class; } return TreeTableModel.class; }
@Override public Class getColumnClass() { return TreeTableModel.class; }
@Override public Class getColumnClass(int column) { return column == 0 ? TreeTableModel.class : String.class; }
public Class getColumnClass() { return TreeTableModel.class; }
public MyTreeTable(TreeTableModel treeTableModel) { super(treeTableModel); }
@Override public Class<?> getColumnClass() { // Such column class indicates that this column will be used as tree - indentations, icons, etc. will be displayed in this column return TreeTableModel.class; }