/** * Called if individual row height mapping need to be updated. This * implementation guards against unnessary access of super's private * rowModel field. */ protected void updateViewSizeSequence() { SizeSequence sizeSequence = null; if (isRowHeightEnabled()) { sizeSequence = getSuperRowModel(); } getRowModelMapper().setViewSizeSequence(sizeSequence, getRowHeight()); }
public static int dividerChanged(JXTable jTable, JSplitPane jSplitPane) { if (jTable == null) { return 0; } if (jSplitPane.getBottomComponent() == null || !jSplitPane.getBottomComponent().isVisible()) { return jTable.getVisibleRowCount(); } if (jTable.getRowCount() == 0) { return 0; } int rc = jTable.getRowCount(); int pref = Util.getPref(jSplitPane); int vrc = jTable.getVisibleRowCount(); int hh = pref - vrc * jTable.getRowHeight(); int current = jSplitPane.getDividerLocation(); // System.out.println("hh:" + hh + " current:" + current); // int rc = (current - jScrollPaneTop.getInsets().top - hh + jTable.getRowHeight() / 3) / jTable.getRowHeight(); int cvrc = Math.min(rc, (current - hh + jTable.getRowHeight() / 3) / jTable.getRowHeight()); if (cvrc == 0) { cvrc = 1; } // System.out.println("current: " + current + " row count: " + rc + " current visible row count: " + vrc + " computed visible row count: " + cvrc + " preferred: " + pref); if (cvrc != vrc) { Util.setVisibleRowCount(jTable, cvrc, jSplitPane); } else { Util.setDividerLocation(jSplitPane, jTable); } return cvrc; }
/** * Sets enablement of individual rowHeight support. Enabling the support * involves reflective access to super's private field rowModel which may * fail due to security issues. If failing the support is not enabled. * <p> * The default value is <code>false</code>. * * @param enabled a boolean to indicate whether per-row heights should be * enabled. * @see #isRowHeightEnabled() * @see #setRowHeight(int, int) */ public void setRowHeightEnabled(boolean enabled) { // PENDING: should we throw an Exception if the enabled fails? // Or silently fail - depends on runtime context, // can't do anything about it. boolean old = isRowHeightEnabled(); if (old == enabled) return; if (enabled && !canEnableRowHeight()) return; rowHeightEnabled = enabled; if (!enabled) { adminSetRowHeight(getRowHeight()); } firePropertyChange("rowHeightEnabled", old, rowHeightEnabled); }
@Override protected void format(CellContext context) { //Set image or text int witdth = table.getColumnModel().getColumn(context.getColumn()).getWidth(); int height = table.getRowHeight(context.getRow()); String text = getTextFromValue(context.getValue()); rendererLabel.setSize(witdth, height); rendererLabel.setToolTipText(text); rendererLabel.setBorder(null); setImagePainter(context.getValue(), context.isSelected()); }
@Override protected void format(CellContext context) { //Set image or text int witdth = table.getColumnModel().getColumn(context.getColumn()).getWidth(); int height = table.getRowHeight(context.getRow()); String text = getTextFromValue(context.getValue()); rendererLabel.setSize(witdth, height); rendererLabel.setToolTipText(text); rendererLabel.setBorder(null); setImagePainter((TimeSet) context.getValue(), context.isSelected()); }
getSelectionMapper().insertIndexInterval(start, length, true); getRowModelMapper().insertIndexInterval(start, length, getRowHeight());