/** * Adjust the width of the specified column in the table */ public void adjustColumn(final int column) { TableColumn tableColumn = this.tableAdjust.getColumnModel().getColumn(column); if (! tableColumn.getResizable()) { return; } int columnHeaderWidth = this.getColumnHeaderWidth( column ); int columnDataWidth = this.getColumnDataWidth( column ); int preferredWidth = Math.max(columnHeaderWidth, columnDataWidth); this.updateTableColumn(column, preferredWidth); }
/** * Update the TableColumn with the newly calculated width */ private void updateTableColumn(int column, int width) { final TableColumn tableColumn = this.tableAdjust.getColumnModel().getColumn(column); if (! tableColumn.getResizable()) { return; } int calculatedWidth = width; calculatedWidth += this.spacing; // Don't shrink the column width if (this.isOnlyAdjustLarger) { calculatedWidth = Math.max(calculatedWidth, tableColumn.getPreferredWidth()); } this.columnSizes.put(tableColumn, Integer.valueOf(tableColumn.getWidth())); this.tableAdjust.getTableHeader().setResizingColumn(tableColumn); tableColumn.setWidth(calculatedWidth); }
/** * Implement the TableModelListener */ @Override public void tableChanged(TableModelEvent e) { if (! this.isColumnDataIncluded) { return; } // A cell has been updated if (e.getType() == TableModelEvent.UPDATE) { int column = this.tableAdjust.convertColumnIndexToView(e.getColumn()); // Only need to worry about an increase in width for this cell if (this.isOnlyAdjustLarger) { int row = e.getFirstRow(); TableColumn tableColumn = this.tableAdjust.getColumnModel().getColumn(column); if (tableColumn.getResizable()) { int width = this.getCellDataWidth(row, column); this.updateTableColumn(column, width); } // Could be an increase of decrease so check all rows } else { this.adjustColumn( column ); } // The update affected more than one column so adjust all columns } else { this.adjustColumns(); } }
public boolean getResizable() { return tableColumn.getResizable(); }
public void setResizeable(boolean aValue) { if (super.getResizable() != aValue) { boolean oldValue = super.getResizable(); super.isResizable = aValue; changeSupport.firePropertyChange("resizable", oldValue, aValue); } }
private boolean canResize(TableColumn column) { return (column!=null) && header.getResizingAllowed() && column.getResizable(); }
private boolean canResize(final TableColumn _column){ return _column != null && table_.getTableHeader().getResizingAllowed() && _column.getResizable(); }
/** * Returns true, if resizing for the tableheader is allowed and * if the column is resizable. * @param column The column to check * @return True, if the column is resizeable, otherwise false. */ private boolean canResize(TableColumn column) { return (column!=null) && getResizingAllowed() && column.getResizable(); }
public void adjustColumn(final int column) { TableColumn tableColumn = table.getColumnModel().getColumn(column); if (!tableColumn.getResizable()) return; int columnHeaderWidth = getColumnHeaderWidth(column); int columnDataWidth = getColumnDataWidth(column); int preferredWidth = Math.max(columnHeaderWidth, columnDataWidth); updateTableColumn(column, preferredWidth); }
public void adjustColumn(final int column) { TableColumn tableColumn = table.getColumnModel().getColumn(column); if (!tableColumn.getResizable()) { return; } int columnHeaderWidth = getColumnHeaderWidth(column); int columnDataWidth = getColumnDataWidth(column); int preferredWidth = Math.max(columnHeaderWidth, columnDataWidth); updateTableColumn(column, preferredWidth); }
private void updateTableColumn(int column, int width) { final TableColumn tableColumn = table.getColumnModel().getColumn(column); if (!tableColumn.getResizable()) return; width += spacing; // Don't shrink the column width if (isOnlyAdjustLarger) { width = Math.max(width, tableColumn.getPreferredWidth()); } columnSizes.put(tableColumn, tableColumn.getWidth()); table.getTableHeader().setResizingColumn(tableColumn); tableColumn.setWidth(width); }
private void updateTableColumn(int column, int width) { final TableColumn tableColumn = table.getColumnModel().getColumn(column); if (!tableColumn.getResizable()) { return; } width += spacing; // Don't shrink the column width if (isOnlyAdjustLarger) { width = Math.max(width, tableColumn.getPreferredWidth()); } columnSizes.put(tableColumn, Integer.valueOf(tableColumn.getWidth())); table.getTableHeader().setResizingColumn(tableColumn); tableColumn.setWidth(width); }
public void adjustColumn(final int column) { TableColumn tableColumn = table.getColumnModel().getColumn(column); if (!tableColumn.getResizable()) return; int columnHeaderWidth = getColumnHeaderWidth(column); int columnDataWidth = getColumnDataWidth(column); int preferredWidth = Math.max(columnHeaderWidth, columnDataWidth); updateTableColumn(column, preferredWidth); }
public void adjustColumn(final int column) { final TableColumn tableColumn = table.getColumnModel().getColumn(column); if (!tableColumn.getResizable()) return; final int columnHeaderWidth = getColumnHeaderWidth(column); final int columnDataWidth = getColumnDataWidth(column); final int preferredWidth = Math.max(columnHeaderWidth, columnDataWidth); updateTableColumn(column, preferredWidth); }
private void updateTableColumn(final int column, int width) { final TableColumn tableColumn = table.getColumnModel().getColumn(column); if (!tableColumn.getResizable()) return; width += spacing; // Don't shrink the column width if (isOnlyAdjustLarger) { width = Math.max(width, tableColumn.getPreferredWidth()); } columnSizes.put(tableColumn, new Integer(tableColumn.getWidth())); table.getTableHeader().setResizingColumn(tableColumn); tableColumn.setWidth(width); } }
private void updateTableColumn(int column, int width) { final TableColumn tableColumn = table.getColumnModel().getColumn(column); if (!tableColumn.getResizable()) return; width += spacing; // Don't shrink the column width if (isOnlyAdjustLarger) { width = Math.max(width, tableColumn.getPreferredWidth()); } columnSizes.put(tableColumn, new Integer(tableColumn.getWidth())); table.getTableHeader().setResizingColumn(tableColumn); tableColumn.setWidth(width); }
/** * Returns true if the user <i>can</i> resize the TableColumn's width, * false otherwise. This is a usability override: it takes into account * the case where it's principally <i>allowed</i> to resize the column * but not possible because the column has fixed size. * * @return a boolean indicating whether the user can resize this column. */ @Override public boolean getResizable() { // TODO JW: resizable is a bound property, so to be strict // we'll need to override setMin/MaxWidth to fire resizable // property change. return super.getResizable() && (getMinWidth() < getMaxWidth()); }
/** * Returns true if the user <i>can</i> resize the TableColumn's width, * false otherwise. This is a usability override: it takes into account * the case where it's principally <i>allowed</i> to resize the column * but not possible because the column has fixed size. * * @return a boolean indicating whether the user can resize this column. */ @Override public boolean getResizable() { // TODO JW: resizable is a bound property, so to be strict // we'll need to override setMin/MaxWidth to fire resizable // property change. return super.getResizable() && (getMinWidth() < getMaxWidth()); }
private void hideColumn() { tempWidth = super.getWidth(); tempMinWidth = super.getMinWidth(); tempMaxWidth = super.getMaxWidth(); tempResizable = super.getResizable(); tempMoveable = moveable; setResizeable(false); setMoveable(false); setMinWidth(0); setWidth(0); setMaxWidth(0); }
public void copyValues(TableColumn base) { modelIndex = base.getModelIndex(); identifier = base.getIdentifier(); width = base.getWidth(); minWidth = base.getMinWidth(); setPreferredWidth(base.getPreferredWidth()); maxWidth = base.getMaxWidth(); headerRenderer = base.getHeaderRenderer(); headerValue = base.getHeaderValue(); cellRenderer = base.getCellRenderer(); cellEditor = base.getCellEditor(); isResizable = base.getResizable(); } }