当前位置: 首页>>代码示例>>Java>>正文


Java RowSorterListener类代码示例

本文整理汇总了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;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:23,代码来源:RowSorterWrapper.java

示例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);
		}
	}
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:9,代码来源:RowSorter.java

示例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);
	}
}
 
开发者ID:lxlxlo,项目名称:LS-jsampler,代码行数:40,代码来源:AbstractInstrumentsDbTable.java

示例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;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:20,代码来源:ListSortUI.java

示例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);
    }        
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:RowSorter.java

示例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);
    }   
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:RowSorter.java

示例7: addRowSorterListener

import javax.swing.event.RowSorterListener; //导入依赖的package包/类
public void addRowSorterListener(RowSorterListener l) {
	listenerList.add(RowSorterListener.class, l);
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:4,代码来源:RowSorter.java

示例8: removeRowSorterListener

import javax.swing.event.RowSorterListener; //导入依赖的package包/类
public void removeRowSorterListener(RowSorterListener l) {
	listenerList.remove(RowSorterListener.class, l);
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:4,代码来源:RowSorter.java

示例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);
	
	
}
 
开发者ID:dita-semia,项目名称:dita-semia-resolver,代码行数:70,代码来源:AdvancedKeyrefDialog.java

示例10: addRowSorterListener

import javax.swing.event.RowSorterListener; //导入依赖的package包/类
public void addRowSorterListener(RowSorterListener l) {
    if (l == null) return;
    listeners.add(l);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:RowSorter.java

示例11: removeRowSorterListener

import javax.swing.event.RowSorterListener; //导入依赖的package包/类
public void removeRowSorterListener(RowSorterListener l) {
    if (l == null) return;
    listeners.remove(l);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:RowSorter.java

示例12: addRowSorterListener

import javax.swing.event.RowSorterListener; //导入依赖的package包/类
@Override
public void addRowSorterListener(RowSorterListener l) {
    if(!ignoreAddRowSorterListener) {
        super.addRowSorterListener(l);
    }
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:7,代码来源:MultipleItemsDialog.java

示例13: addRowSorterListener

import javax.swing.event.RowSorterListener; //导入依赖的package包/类
@Override
public void addRowSorterListener(RowSorterListener l) {}
 
开发者ID:Sciss,项目名称:TreeTable,代码行数:3,代码来源:BasicTreeTableUI.java

示例14: removeRowSorterListener

import javax.swing.event.RowSorterListener; //导入依赖的package包/类
@Override
public void removeRowSorterListener(RowSorterListener l) {}
 
开发者ID:Sciss,项目名称:TreeTable,代码行数:3,代码来源:BasicTreeTableUI.java


注:本文中的javax.swing.event.RowSorterListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。