/** Creates ListTableView with provided NodeTableModel. * @param ntm node table model */ public ListTableView(NodeTableModel ntm) { // do not use scroll bars, this scroll pane is dummy, only for border painting setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); // remove list from viewportview setViewportView(null); // insert list into new scrollpane JScrollPane listView = new JScrollPane(list); listView.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); listView.setBorder(null); // create table view controlled by new scrollpane controlledTableView = ntm == null ? new TableSheet.ControlledTableView(listView) : new TableSheet.ControlledTableView(listView, ntm); setViewportView(controlledTableView.compoundScrollPane()); listener = new Listener(); delayedFireTableDataChanged(); setPreferredSize(new Dimension(400, 400)); table = controlledTableView.getTable(); }
/** Is used to synchronize table row height with left view. */ void setRowHeight(int h) { table.setRowHeight(h); getVerticalScrollBar().setUnitIncrement(h); }
/** initialize view */ private void initializeView() { // adjustment of controlling view Component comp = controllingView.getViewport().getView(); controllingView.setViewportView(comp); if (UIManager.getColor ("Table.background") != null) { // NOI18N getViewport().setBackground(UIManager.getColor("Table.background")); // NOI18N } // both views share one vertical scrollbar setVerticalScrollBar(controllingView.getVerticalScrollBar()); ScrollPaneLayout spl = new EnablingScrollPaneLayout(controllingView); setLayout(spl); spl.syncWithScrollPane(this); spl = new EnablingScrollPaneLayout(this); controllingView.setLayout(spl); spl.syncWithScrollPane(controllingView); table.setBorder(null); // table like header header = new JTable().getTableHeader().getDefaultRenderer() .getTableCellRendererComponent(null, " ", false, false, 0, 0); // NOI18N MouseInputListener mouseHandler = new MouseDragHandler(); header.addMouseListener(mouseHandler); header.addMouseMotionListener(mouseHandler); }
/** initialize view */ private void initializeView() { // adjustment of controlling view Component comp = controllingView.getViewport().getView(); controllingView.setViewportView(comp); if (UIManager.getColor ("Table.background") != null) { // NOI18N getViewport().setBackground(UIManager.getColor("Table.background")); // NOI18N } // both views share one vertical scrollbar setVerticalScrollBar(controllingView.getVerticalScrollBar()); ScrollPaneLayout spl = new EnablingScrollPaneLayout(controllingView); setLayout(spl); spl.syncWithScrollPane(this); spl = new EnablingScrollPaneLayout(this); controllingView.setLayout(spl); spl.syncWithScrollPane(controllingView); table.setBorder(null); // table like header header = new JTable().getTableHeader().getDefaultRenderer() .getTableCellRendererComponent(null, " ", false, false, 0, 0); // NOI18N MouseInputListener mouseHandler = new MouseDragHandler(); header.addMouseListener(mouseHandler); header.addMouseMotionListener(mouseHandler); }
/** initialize view */ private void initializeView() { // adjustment of controlling view Component comp = controllingView.getViewport().getView(); controllingView.setViewportView(comp); if (UIManager.getColor("Table.background") != null) { // NOI18N getViewport().setBackground(UIManager.getColor("Table.background")); // NOI18N } // both views share one vertical scrollbar setVerticalScrollBar(controllingView.getVerticalScrollBar()); ScrollPaneLayout spl = new EnablingScrollPaneLayout(controllingView); setLayout(spl); spl.syncWithScrollPane(this); spl = new EnablingScrollPaneLayout(this); controllingView.setLayout(spl); spl.syncWithScrollPane(controllingView); table.setBorder(null); // table like header header = new JTable().getTableHeader().getDefaultRenderer().getTableCellRendererComponent( null, " ", false, false, 0, 0 ); // NOI18N MouseInputListener mouseHandler = new MouseDragHandler(); header.addMouseListener(mouseHandler); header.addMouseMotionListener(mouseHandler); }
/** Creates ListTableView with provided NodeTableModel. * @param ntm node table model */ public ListTableView(NodeTableModel ntm) { // do not use scroll bars, this scroll pane is dummy, only for border painting setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); // remove list from viewportview setViewportView(null); // insert list into new scrollpane JScrollPane listView = new JScrollPane(list); listView.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); listView.setBorder(null); // create table view controlled by new scrollpane controlledTableView = ntm == null ? new TableSheet.ControlledTableView(listView) : new TableSheet.ControlledTableView(listView, ntm); setViewportView(controlledTableView.compoundScrollPane()); listener = new Listener(); delayedFireTableDataChanged(); setPreferredSize(new Dimension(400, 400)); table = controlledTableView.getTable(); }
/** Creates ListTableView with provided NodeTableModel. * @param ntm node table model */ public ListTableView(NodeTableModel ntm) { // do not use scroll bars, this scroll pane is dummy, only for border painting setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); // remove list from viewportview setViewportView(null); // insert list into new scrollpane JScrollPane listView = new JScrollPane(list); listView.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); listView.setBorder(null); // create table view controlled by new scrollpane controlledTableView = (ntm == null) ? new TableSheet.ControlledTableView(listView) : new TableSheet.ControlledTableView(listView, ntm); setViewportView(controlledTableView.compoundScrollPane()); listener = new Listener(); delayedFireTableDataChanged(); setPreferredSize(new Dimension(400, 400)); table = controlledTableView.getTable(); }
/** Creates controlled scroll pane with <code>contView</code> on the left, table view * on the right */ ControlledTableView(JScrollPane contrView) { super(); this.controllingView = contrView; initializeView(); }
/** Creates controlled scroll pane with <code>contView</code> on the left, table view * on the right */ ControlledTableView(JScrollPane contrView) { super(); this.controllingView = contrView; initializeView(); }
/** Sets resize mode of table. * * @param mode - One of 5 legal values: <pre>JTable.AUTO_RESIZE_OFF, * JTable.AUTO_RESIZE_NEXT_COLUMN, * JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS, * JTable.AUTO_RESIZE_LAST_COLUMN, * JTable.AUTO_RESIZE_ALL_COLUMNS</pre> */ public final void setTableAutoResizeMode(int mode) { controlledTableView.setAutoResizeMode(mode); }
/** Get preferred size of list view * @return preferred width of list view */ public final int getListPreferredWidth() { return controlledTableView.getControllingViewWidth(); }
/** Sets resize mode of table. * * @param mode - One of 5 legal values: <pre>JTable.AUTO_RESIZE_OFF, * JTable.AUTO_RESIZE_NEXT_COLUMN, * JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS, * JTable.AUTO_RESIZE_LAST_COLUMN, * JTable.AUTO_RESIZE_ALL_COLUMNS</pre> */ public final void setTableAutoResizeMode(int mode) { controlledTableView.setAutoResizeMode(mode); }
/** Gets preferred width of table column * @param index column index * @return preferred column width */ public final int getTableColumnPreferredWidth(int index) { return controlledTableView.getColumnPreferredWidth(index); }
/** Gets resize mode of table. * * @return mode - One of 5 legal values: <pre>JTable.AUTO_RESIZE_OFF, * JTable.AUTO_RESIZE_NEXT_COLUMN, * JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS, * JTable.AUTO_RESIZE_LAST_COLUMN, * JTable.AUTO_RESIZE_ALL_COLUMNS</pre> */ public final int getTableAutoResizeMode() { return controlledTableView.getAutoResizeMode(); }
/** Creates controlled scroll pane with <code>contView</code> on the left, table view * on the right. */ ControlledTableView(JScrollPane contrView, NodeTableModel ntm) { super(ntm); this.controllingView = contrView; initializeView(); }
/** Is used to synchronize table row height with left view. */ void setRowHeight(int h) { table.setRowHeight(h); getVerticalScrollBar().setUnitIncrement(h); }
/** Creates controlled scroll pane with <code>contView</code> on the left, table view * on the right. */ ControlledTableView(JScrollPane contrView, NodeTableModel ntm) { super(ntm); this.controllingView = contrView; initializeView(); }
/** Get preferred size of list view * @return preferred width of list view */ public final int getListPreferredWidth() { return controlledTableView.getControllingViewWidth(); }
/** Gets resize mode of table. * * @return mode - One of 5 legal values: <pre>JTable.AUTO_RESIZE_OFF, * JTable.AUTO_RESIZE_NEXT_COLUMN, * JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS, * JTable.AUTO_RESIZE_LAST_COLUMN, * JTable.AUTO_RESIZE_ALL_COLUMNS</pre> */ public final int getTableAutoResizeMode() { return controlledTableView.getAutoResizeMode(); }
/** Gets preferred width of table column * @param index column index * @return preferred column width */ public final int getTableColumnPreferredWidth(int index) { return controlledTableView.getColumnPreferredWidth(index); }