/** Updates the line heights, if needed. */ private void updateLineHeights() { // We only want to update if the document has been changed since // the last time the line heights were updated. if (updatedLine < 0) { return; } // If multiple lines were changed then update all the line heights. if (multipleLinesChanged) { // Recreate the line sizes info for the whole document. int lineCount = getAdjustedLineCount(); lineHeights = new SizeSequence(lineCount); for (int i = 0; i < lineCount; i++) { lineHeights.setSize(i, getLineHeight(i)); } multipleLinesChanged = false; } else { lineHeights.setSize(updatedLine, getLineHeight(updatedLine)); } updatedLine = -1; }
/** Update the line heights as needed. */ private void updateSizes() { if ( startLine < 0 ) { return; } if ( structureChanged ) { adjustedLineCount = getAdjustedLineCount(); //System.out.println( "lines: " + adjustedLineCount ); sizes = new SizeSequence( adjustedLineCount ); for ( int i = 0; i < adjustedLineCount; i++ ) { sizes.setSize( i, getLineHeight( i ) ); } structureChanged = false; } else { sizes.setSize( startLine, getLineHeight( startLine ) ); } startLine = -1; }
/** Update the line heights as needed. */ private void updateSizes() { if (startLine < 0) { return; } if (structureChanged) { int count = getAdjustedLineCount(); sizes = new SizeSequence(count); for (int i = 0; i < count; i++) { sizes.setSize(i, getLineHeight(i)); } structureChanged = false; } else { sizes.setSize(startLine, getLineHeight(startLine)); } startLine = -1; }
/** * additionally updates filtered state. {@inheritDoc} */ @Override public void tableChanged(TableModelEvent e) { if (getSelectionModel().getValueIsAdjusting()) { // this may happen if the uidelegate/editor changed selection // and adjusting state // before firing a editingStopped // need to enforce update of model selection getSelectionModel().setValueIsAdjusting(false); } // JW: make SelectionMapper deaf ... super doesn't know about row // mapping and sets rowSelection in model coordinates // causing complete confusion. boolean wasEnabled = getSelectionMapper().isEnabled(); getSelectionMapper().setEnabled(false); try { SizeSequence rowModel = nullSuperRowModel(e); super.tableChanged(e); if (rowModel != null) { retoreSuperRowModel(rowModel); } updateSelectionAndRowModel(e); } finally { getSelectionMapper().setEnabled(wasEnabled); } if (shouldSortOnChange(e)) { use(filters); } if (isStructureChanged(e) && getAutoCreateColumnsFromModel()) { initializeColumnWidths(); resetCalculatedScrollableSize(true); } }
/** * 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 void setViewSizeSequence(SizeSequence selection, int height) { SizeSequence old = this.viewSizes; if (old != null) { clearModelSizes(); } this.viewSizes = selection; this.defaultHeight = height; mapTowardsModel(); }
private void mapTowardsModel() { if (viewSizes == null) return; modelSizes = new SizeSequence(getInputSize(), defaultHeight); int[] selected = viewSizes.getSizes(); for (int i = 0; i < selected.length; i++) { int modelIndex = convertToModel(i); modelSizes.setSize(modelIndex, selected[i]); } }
/** * * @param pipeline * @param selection */ public SizeSequenceMapper(FilterPipeline pipeline, SizeSequence selection, int defaultHeight) { this(); setViewSizeSequence(selection, defaultHeight); setFilters(pipeline); }
public SizeSequence getViewSizeSequence() { return viewSizes; }
public DefaultHeaderModel(int numEntries, int defaultSize, int orientation) { delegate = new SizeSequence(numEntries, defaultSize); count = numEntries; this.defaultSize = defaultSize; this.orientation = orientation; }
/** * Nulls super's rowModel and returns the old one if rowHeightEnabled and * the event is either a remove or a insert. Does nothing and returns null * otherwise. * * Hack around #924-swingx. * * @param e the TableModelEvent used to decide whether a nulling is needed. * @return super's old SizeSequence or null */ private SizeSequence nullSuperRowModel(TableModelEvent e) { if (!isRowHeightEnabled()) return null; if (!isInsertRemove(e)) return null; SizeSequence result = getSuperRowModel(); setSuperRowModel(null); return result; }
/** * Sets super's rowModel to the given SizeSequence if not null, * does nothing if null. * * Hack around #924-swingx. * @param rowModel the SizeSequence to set super's rowModel to. */ private void retoreSuperRowModel(SizeSequence rowModel) { if (rowModel == null) return; setSuperRowModel(rowModel); }