本文整理汇总了Java中javax.swing.event.RowSorterEvent类的典型用法代码示例。如果您正苦于以下问题:Java RowSorterEvent类的具体用法?Java RowSorterEvent怎么用?Java RowSorterEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RowSorterEvent类属于javax.swing.event包,在下文中一共展示了RowSorterEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRowSorterListener
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
/**
* Creates and returns a RowSorterListener which re-fires received
* events.
*
* @return
*/
protected RowSorterListener getRowSorterListener() {
if (rowSorterListener == null) {
RowSorterListener listener = new RowSorterListener() {
@Override
public void sorterChanged(RowSorterEvent e) {
if (RowSorterEvent.Type.SORT_ORDER_CHANGED == e.getType()) {
fireSortOrderChanged();
} else if (RowSorterEvent.Type.SORTED == e.getType()) {
fireRowSorterChanged(null); }
}
};
rowSorterListener = listener;
}
return rowSorterListener;
}
示例2: sortedChanged
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
/**
* Called after notification from RowSorter.
*
* @param e RowSorter event of type SORTED.
*/
protected void sortedChanged(RowSorterEvent e) {
sorterChanged = true;
if (!ignoreSortChange) {
prepareForChange(e);
processChange(null);
// PENDING Jw: this is fix of 1161-swingx - not updated after setting
// rowFilter
// potentially costly? but how to distinguish a mere sort from a
// filterchanged? (only the latter requires a revalidate)
// first fix had only revalidate/repaint but was not
// good enough, see #1261-swingx - no items visible
// after setting rowFilter
// need to invalidate the cell size cache which might be needed
// even after plain sorting as the indi-sizes are now at different
// positions
list.invalidateCellSizeCache();
}
}
示例3: convertRowIndexToModel
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
private int convertRowIndexToModel(RowSorterEvent e, int viewIndex) {
// JW: the event is null if the selection is cached in prepareChange
// after model notification. Then the conversion from the
// sorter is still valid as the prepare is called before
// notifying the sorter.
if (e != null) {
if (e.getPreviousRowCount() == 0) {
return viewIndex;
}
// range checking handled by RowSorterEvent
return e.convertPreviousRowIndexToModel(viewIndex);
}
// Make sure the viewIndex is valid
if (viewIndex < 0 || viewIndex >= sorter.getViewRowCount()) {
return -1;
}
return sorter.convertRowIndexToModel(viewIndex);
}
示例4: maybeRepaintOnSorterChanged
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
/**
*
*/
private void maybeRepaintOnSorterChanged(RowSorterEvent e) {
if (beforeSort == null) return;
if ((e == null) || (e.getType() != RowSorterEvent.Type.SORTED)) return;
UpdateHandler afterSort = new UpdateHandler(beforeSort);
if (afterSort.allHidden(beforeSort)) {
return;
} else if (afterSort.complex(beforeSort)) {
repaint();
return;
}
int firstRow = afterSort.getFirstCombined(beforeSort);
int lastRow = afterSort.getLastCombined(beforeSort);
Rectangle first = getCellRect(firstRow, 0, false);
first.width = getWidth();
Rectangle last = getCellRect(lastRow, 0, false);
repaint(first.union(last));
}
示例5: sorterChanged
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
@Override
public void sorterChanged(RowSorterEvent e) {
if (e.getType() == Type.SORT_ORDER_CHANGED) {
@SuppressWarnings("unchecked")
List<? extends SortKey> sortKeys = e.getSource().getSortKeys();
Object[] keys = new Object[sortKeys.size()];
boolean[] directions = new boolean[sortKeys.size()];
int index = 0;
for (SortKey s : sortKeys) {
keys[index] = SwingTable.this.keys[s.getColumn()];
directions[index] = s.getSortOrder() == SortOrder.ASCENDING;
index++;
}
if (list instanceof Sortable) {
((Sortable) list).sort(keys, directions);
}
setOffset(0);
}
}
示例6: sorterChanged
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
@Override
public void sorterChanged(final RowSorterEvent e) {
if (e == null || e.getType() == RowSorterEvent.Type.SORT_ORDER_CHANGED) {
if (this.getTable().getCellEditor() != null) {
this.getTable().getCellEditor().stopCellEditing();
}
}
if (e == null || e.getType() == RowSorterEvent.Type.SORTED) {
//System.out.println("SORTED");
/*
if (this.getSelectedRow() >= 0) {
System.out.println(this.getTable().convertRowIndexToModel(this.getSelectedRow()) + "\t" +
this.getTable().convertRowIndexToView(this.getSelectedRow()) + "\t" + this.getSelectedRow());
}
*/
if (myDBPanel1 != null) {
//myDBPanel1.handleSuchfeldChange(null, false); // handleSuchfeldChange hier oben stehen lassen??? Oder lieber runter?? doFilter = false, weil sonst StackOverflow!
syncTableRowHeights();
int selID = this.getSelectedID();
this.setSelectedID(selID, true);
myDBPanel1.handleSuchfeldChange(null, false); // doFilter = false, weil sonst StackOverflow!
}
}
}
示例7: sorterChanged
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
@Override
public void sorterChanged(RowSorterEvent e) {
if (inputTable.isEditing()) {
inputTable.getCellEditor().stopCellEditing();
}
if (e.getSource() == table.getRowSorter()) {
int idColumn = UI.findColumn(table, TracingColumns.ID);
for (int row = 0; row < table.getRowCount(); row++) {
String id = (String) table.getValueAt(row, idColumn);
inputTable.setValueAt(values.get(id), row, 0);
}
}
}
示例8: maybeRepaintOnSorterChanged
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
private void maybeRepaintOnSorterChanged(RowSorterEvent e) {
if (beforeSort == null) return;
if ((e == null) || (e.getType() != RowSorterEvent.Type.SORTED)) return;
UpdateHandler afterSort = new UpdateHandler(beforeSort);
if (afterSort.allHidden(beforeSort)) {
return;
} else if (afterSort.complex(beforeSort)) {
repaint();
return;
}
int firstRow = afterSort.getFirstCombined(beforeSort);
int lastRow = afterSort.getLastCombined(beforeSort);
Rectangle first = getCellRect(firstRow, 0, false);
first.width = getWidth();
Rectangle last = getCellRect(lastRow, 0, false);
repaint(first.union(last));
}
示例9: sorterChanged
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
@Override
public synchronized void sorterChanged(RowSorterEvent e) {
//the sort listener waits for changes on the sorted columns
//if the first sort key is the stock_name or the open_price column
//(that are fields that never change) it disable the dynamic sort
if (e.getType().equals(RowSorterEvent.Type.SORT_ORDER_CHANGED)) {
List<RowSorter.SortKey> keys = e.getSource().getSortKeys();
if(!keys.isEmpty()) {
int y = keys.get(0).getColumn();
if (y != 0 && y != 11) {
enableDynamicSort(true);
} else {
enableDynamicSort(false);
}
}
}
}
示例10: sorterChanged
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
@Override
public void sorterChanged(RowSorterEvent e) {
String aid = selectedActionId;
int colIndex = getSelectedColumn();
super.sorterChanged(e);
restoreSelection(aid, colIndex);
}
示例11: fireRowSorterChanged
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
void fireRowSorterChanged(RowSorterEvent event) {
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == RowSorterListener.class) {
((RowSorterListener) listeners[i + 1]).sorterChanged(event);
}
}
}
示例12: AbstractInstrumentsDbTable
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
/**
* Creates a new instance of <code>AbstractInstrumentsDbTable</code>
*/
public AbstractInstrumentsDbTable(InstrumentsDbTableModel model, String tablePrefix) {
super(model);
setView(CC.getViewConfig().getInstrumentsDbTableView());
this.tablePrefix = tablePrefix;
loadColumnsVisibleState();
loadColumnWidths();
setAutoResizeMode(AUTO_RESIZE_OFF);
rowSorter = new InstrumentsDbTableRowSorter(getModel());
setRowSorter(rowSorter);
loadSortOrder();
RowSorterListener l = new RowSorterListener() {
public void
sorterChanged(RowSorterEvent e) {
if(e.getType() != SORT_ORDER_CHANGED) return;
rowSorterChanged();
}
};
getRowSorter().addRowSorterListener(l);
putClientProperty("JTable.autoStartsEdit", false);
nameEditor = new DefaultCellEditor(tfEditor);
nameEditor.setClickCountToStart(5);
if( getModel().getShowDummyColumn()) {
TableColumn dummy;
dummy = getColumnModel().getColumn(getModel().getDummyColumnIndex());
dummy.setPreferredWidth(10);
}
}
示例13: postprocessSorterChanged
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
/**
* Hack around core issue 6791934: sets the sorter changed flag if appropriate.
* Called after processing the event.
* @param e the sorter event received from the sorter
*/
protected void postprocessSorterChanged(RowSorterEvent e) {
filteredRowCountChanged = false;
if (forceRevalidate && e.getType() == RowSorterEvent.Type.SORTED) {
filteredRowCountChanged = e.getPreviousRowCount() != getRowCount();
}
}
示例14: convertSelectionToModel
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
/**
* Converts the selection to model coordinates. This is used when
* the model changes or the sorter changes.
*/
private int[] convertSelectionToModel(RowSorterEvent e) {
int[] selection = list.getSelectedIndices();
for (int i = selection.length - 1; i >= 0; i--) {
selection[i] = convertRowIndexToModel(e, selection[i]);
}
return selection;
}
示例15: createRowSorterListener
import javax.swing.event.RowSorterEvent; //导入依赖的package包/类
/**
* Creates and returns a RowSorterListener. This implementation
* calls sortedChanged if the event is of type SORTED.
*
* @return rowSorterListener to install on sorter.
*/
protected RowSorterListener createRowSorterListener() {
RowSorterListener l = new RowSorterListener() {
@Override
public void sorterChanged(RowSorterEvent e) {
if (e.getType() == RowSorterEvent.Type.SORTED) {
sortedChanged(e);
}
}
};
return l;
}