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


Java RowSorterEvent类代码示例

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

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

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

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

示例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);
    	}
    }
 
开发者ID:BrunoEberhard,项目名称:minimal-j,代码行数:20,代码来源:SwingTable.java

示例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!
		}		
	}
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:25,代码来源:MyDBTable.java

示例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);
		}
	}
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:17,代码来源:TableInputPanel.java

示例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));
}
 
开发者ID:wandora-team,项目名称:wandora,代码行数:18,代码来源:SimpleTable.java

示例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);
            }
        }
    } 
}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-StockList-client-java,代码行数:18,代码来源:StockView.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:KeymapPanel.java

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

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

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

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

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


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