本文整理汇总了Java中javax.swing.event.RowSorterListener类的典型用法代码示例。如果您正苦于以下问题:Java RowSorterListener类的具体用法?Java RowSorterListener怎么用?Java RowSorterListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RowSorterListener类属于javax.swing.event包,在下文中一共展示了RowSorterListener类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRowSorterListener
import javax.swing.event.RowSorterListener; //导入依赖的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: fireRowSorterChanged
import javax.swing.event.RowSorterListener; //导入依赖的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);
}
}
}
示例3: AbstractInstrumentsDbTable
import javax.swing.event.RowSorterListener; //导入依赖的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);
}
}
示例4: createRowSorterListener
import javax.swing.event.RowSorterListener; //导入依赖的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;
}
示例5: fireSortOrderChanged
import javax.swing.event.RowSorterListener; //导入依赖的package包/类
protected void fireSortOrderChanged() {
RowSorterEvent event = new RowSorterEvent(this);
RowSorterListener[] listenerArray = (RowSorterListener[]) listeners.toArray();
for (int i=0; i<listenerArray.length; i++) {
listenerArray[i].sorterChanged(event);
}
}
示例6: fireRowSorterChanged
import javax.swing.event.RowSorterListener; //导入依赖的package包/类
protected void fireRowSorterChanged(int[] lastRowIndexToModel) {
RowSorterEvent event = new RowSorterEvent(this, RowSorterEvent.Type.SORTED, lastRowIndexToModel);
RowSorterListener[] listenerArray = (RowSorterListener[]) listeners.toArray();
for (int i=0; i<listenerArray.length; i++) {
listenerArray[i].sorterChanged(event);
}
}
示例7: addRowSorterListener
import javax.swing.event.RowSorterListener; //导入依赖的package包/类
public void addRowSorterListener(RowSorterListener l) {
listenerList.add(RowSorterListener.class, l);
}
示例8: removeRowSorterListener
import javax.swing.event.RowSorterListener; //导入依赖的package包/类
public void removeRowSorterListener(RowSorterListener l) {
listenerList.remove(RowSorterListener.class, l);
}
示例9: createTablePanel
import javax.swing.event.RowSorterListener; //导入依赖的package包/类
private void createTablePanel(JPanel tablePanel) {
tablePanel.setLayout(new GridBagLayout());
keyTable = new JTable(keyDefTableModel);
JScrollPane scrollPane = new JScrollPane(keyTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
enableSorting(keyTable);
keyTable.getTableHeader().setReorderingAllowed(false);
keyTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
keyTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
keyTable.getColumnModel().getColumn(0).setPreferredWidth(25);
keyTable.getColumnModel().getColumn(0).setMaxWidth(30);
keyTable.getColumnModel().getColumn(0).setResizable(false);
keyTable.getColumnModel().getColumn(1).setPreferredWidth(150);
keyTable.getColumnModel().getColumn(2).setPreferredWidth(150);
keyTable.getColumnModel().getColumn(3).setPreferredWidth(150);
keyTable.getColumnModel().getColumn(4).setPreferredWidth(150);
GridBagConstraints localConstr = new GridBagConstraints();
localConstr.insets = new Insets(2, 2, 2, 2);
localConstr.anchor = GridBagConstraints.WEST;
localConstr.fill = GridBagConstraints.BOTH;
localConstr.gridx = 0;
localConstr.gridy = 0;
localConstr.weightx = 1;
localConstr.weighty = 1;
DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
centerRenderer.setHorizontalAlignment(JLabel.CENTER);
keyTable.getColumnModel().getColumn(0).setCellRenderer(centerRenderer);
tablePanel.add(scrollPane, localConstr);
sorter = new TableRowSorter<>(keyDefTableModel);
sorter.toggleSortOrder(0);
sorter.toggleSortOrder(0); // initial sorting be priority descending
sorter.addRowSorterListener(new RowSorterListener() {
@Override
public void sorterChanged (RowSorterEvent e) {
if (e.getType () == RowSorterEvent.Type.SORTED) {
int selection = keyTable.getSelectedRow();
if (selection >= 0) {
boxAction = false;
reloadBoxItems();
updateComboBoxes();
boxAction = true;
keyTable.setRowSelectionInterval(selection, selection);
Rectangle selectRect = keyTable.getCellRect(selection, 0, true);
selectRect.height = (keyTable.getParent().getHeight() / 2);
keyTable.scrollRectToVisible(selectRect);
} else {
if (keyTable.getRowCount() > 0) {
keyTable.changeSelection(0, 0, false, false);
boxAction = false;
reloadBoxItems();
updateComboBoxes();
boxAction = true;
}
}
}
}
});
keyTable.setRowSorter(sorter);
}
示例10: addRowSorterListener
import javax.swing.event.RowSorterListener; //导入依赖的package包/类
public void addRowSorterListener(RowSorterListener l) {
if (l == null) return;
listeners.add(l);
}
示例11: removeRowSorterListener
import javax.swing.event.RowSorterListener; //导入依赖的package包/类
public void removeRowSorterListener(RowSorterListener l) {
if (l == null) return;
listeners.remove(l);
}
示例12: addRowSorterListener
import javax.swing.event.RowSorterListener; //导入依赖的package包/类
@Override
public void addRowSorterListener(RowSorterListener l) {
if(!ignoreAddRowSorterListener) {
super.addRowSorterListener(l);
}
}
示例13: addRowSorterListener
import javax.swing.event.RowSorterListener; //导入依赖的package包/类
@Override
public void addRowSorterListener(RowSorterListener l) {}
示例14: removeRowSorterListener
import javax.swing.event.RowSorterListener; //导入依赖的package包/类
@Override
public void removeRowSorterListener(RowSorterListener l) {}