本文整理汇总了Java中javax.swing.RowFilter.Entry类的典型用法代码示例。如果您正苦于以下问题:Java Entry类的具体用法?Java Entry怎么用?Java Entry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Entry类属于javax.swing.RowFilter包,在下文中一共展示了Entry类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSelectionWithFilterXListRemove
import javax.swing.RowFilter.Entry; //导入依赖的package包/类
/**
* Issue #1536-swingx: AIOOB on restoring selection with filter
* Reopened: overfixed - the removeIndexInterval _does_ take
* the endIndex instead of length.
*
*/
@Test
public void testSelectionWithFilterXListRemove() {
JXList table = new JXList(ascendingListModel, true);
// set selection somewhere below the filtered (which is 0)
int selected = 1;
table.setSelectionInterval(selected, selected);
// exclude rows based on identifier (here: first item
final RowFilter filter = new RowFilters.GeneralFilter() {
List excludes = Arrays.asList(0);
@Override
protected boolean include(
Entry<? extends Object, ? extends Object> entry,
int index) {
return !excludes.contains(entry.getIdentifier());
}
};
table.setRowFilter(filter);
assertEquals("sanity: filtered selection", selected - 1, table.getSelectedIndex());
// remove last row
ascendingListModel.remove(ascendingListModel.getSize() - 1);
assertEquals("filtered selection unchanged", selected - 1, table.getSelectedIndex());
assertFalse(table.isSelectionEmpty());
}
示例2: setDependantRowFilter
import javax.swing.RowFilter.Entry; //导入依赖的package包/类
private RowFilter setDependantRowFilter(final FilterType type) {
RowFilter<DossierTableModel, Integer> filter = new RowFilter<DossierTableModel, Integer>() {
@Override
public boolean include(Entry<? extends DossierTableModel, ? extends Integer> entry) {
Dossier dos = entry.getModel().getDossier(entry.getIdentifier());
switch (type) {
case SALES_CLOSED:
return !dos.isLegacy() && dos.getCrucialDirective() == Document.Directive.NONE;
case SALES_OPEN:
return !dos.isLegacy() && dos.getId() > 0 && dos.getCrucialDirective() != Document.Directive.NONE;
case ACCOUNTANCY_CLOSED:
return !dos.isLegacy() && dos.getId() > 0 && dos.isClosed();
case ACCOUNTANCY_OPEN:
return !dos.isLegacy() && dos.getId() > 0 && !dos.isClosed();
case ALL:
return true;
case LEGACY:
return dos.isLegacy();
default:
return true;
}
}
};
return filter;
}
示例3: EDACCFilter
import javax.swing.RowFilter.Entry; //导入依赖的package包/类
/**
* Creates new form EDACCFilter. If the table has no instance of TableRowSorter a IllegalArgumentException is thrown.
* @param parent The parent for this dialog
* @param modal
* @param table the table to be used for this filter
* @param autoUpdateFilterTypes if this is set to true, the filter will updated the classes of the columns on each setVisible(true)
*/
public EDACCFilter(java.awt.Frame parent, boolean modal, JTable table, boolean autoUpdateFilterTypes) {
this(parent, modal);
if (!(table.getRowSorter() instanceof TableRowSorter)) {
throw new IllegalArgumentException("Expected TableRowSorter.");
}
this.table = table;
rowSorter = (TableRowSorter<? extends TableModel>) table.getRowSorter();
final RowFilter oldRowFilter = rowSorter.getRowFilter();
rowFilter = new RowFilter<Object, Object>() {
@Override
public boolean include(Entry<? extends Object, ? extends Object> entry) {
return (oldRowFilter == null || oldRowFilter.include(entry)) && EDACCFilter.this.include(entry);
}
};
rowSorter.setRowFilter(rowFilter);
this.updateFilterTypes = autoUpdateFilterTypes;
}
示例4: EDACCGenerateJobsFilter
import javax.swing.RowFilter.Entry; //导入依赖的package包/类
/** Creates new form EDACCGenerateJobsFilter */
public EDACCGenerateJobsFilter(java.awt.Frame parent, boolean modal, JTable table, GenerateJobsTableModel model) {
super(parent, modal);
initComponents();
this.table = table;
this.model = model;
TableRowSorter<? extends TableModel> rowSorter = (TableRowSorter<? extends TableModel>) table.getRowSorter();
final RowFilter oldRowFilter = rowSorter.getRowFilter();
RowFilter rowFilter = new RowFilter<Object, Object>() {
@Override
public boolean include(Entry<? extends Object, ? extends Object> entry) {
return (oldRowFilter == null || oldRowFilter.include(entry)) && EDACCGenerateJobsFilter.this.include(entry);
}
};
rowSorter.setRowFilter(rowFilter);
instanceRegex = ".*";
solverConfigRegex = ".*";
}
示例5: testSelectionWithFilterXListInsert
import javax.swing.RowFilter.Entry; //导入依赖的package包/类
/**
* Issue #1536-swingx: AIOOB on restoring selection with filter
* This is a core issue, sneaked into ListSortUI by c&p
*
*/
@Test
public void testSelectionWithFilterXListInsert() {
DefaultListModel model = new DefaultListModel();
// a model with 3 elements is the minimum size to demonstrate
// the bug
int last = 2;
for (int i = 0; i <= last; i++) {
model.addElement(i);
}
JXList table = new JXList(model, true);
// set selection to the end
table.setSelectionInterval(last, last);
// exclude rows based on identifier
final RowFilter filter = new RowFilters.GeneralFilter() {
List excludes = Arrays.asList(0);
@Override
protected boolean include(
Entry<? extends Object, ? extends Object> entry,
int index) {
return !excludes.contains(entry.getIdentifier());
}
};
table.setRowFilter(filter);
// insertRow _before or at_ selected model index, such that
// endIndex (in event) > 1
model.add(2, "x");
}
示例6: annotate
import javax.swing.RowFilter.Entry; //导入依赖的package包/类
@Override
public RowFilter<M, I> annotate(Entry<? extends M, ? extends I> entry) {
int resultCount = 0;
for (RowFilter<M, I> filter : filters) {
if (filter.include(entry)) {
return filter;
}
}
return null;
}
示例7: include
import javax.swing.RowFilter.Entry; //导入依赖的package包/类
@Override
public boolean include(Entry<? extends Object, ? extends Object> entry) {
LinkedList<Integer> classIds = model.getInstanceClassIdsForRow((Integer) entry.getIdentifier());
if (filterInstanceClasses) {
boolean res = false;
for (Integer id : classIds) {
if (instanceClassIds.contains(id)) {
res = true;
}
}
if (!res) return false;
}
return super.include(entry);
}
示例8: include
import javax.swing.RowFilter.Entry; //导入依赖的package包/类
/**
* Returns true iff the given entry matches the filter parameters.
* @param entry
* @return boolean
*/
public synchronized boolean include(Entry<? extends Object, ? extends Object> entry) {
HashMap<Integer, Boolean> arguments = new HashMap<Integer, Boolean>();
for (ArgumentPanel panel : filterArguments) {
arguments.put(panel.getArgNum(), panel.getFilterInterface().include(getValueAt(entry.getIdentifier(), panel.getColumn())));
}
try {
return parser.eval(expression, arguments);
} catch (Exception ex) {
return false;
}
}
示例9: include
import javax.swing.RowFilter.Entry; //导入依赖的package包/类
public boolean include(Entry<? extends Object, ? extends Object> entry) {
Object value = entry.getValue(0);
String val;
if (value instanceof String) {
val = (String) value;
} else {
val = value.toString();
}
try {
return val.matches(instanceRegex);
} catch (Exception e) {
return false;
}
}
示例10: include
import javax.swing.RowFilter.Entry; //导入依赖的package包/类
@Override
public boolean include(Entry<? extends InstanceDupErrorTableModel, ? extends Integer> entry) {
ArrayList<Instance> instances = model.getRelatedErrorInstance((Integer) entry.getIdentifier());
if (instances == null) {
return false;
}
if (instances.contains(selectedInstance)) {
return true;
}
return false;
}
示例11: include
import javax.swing.RowFilter.Entry; //导入依赖的package包/类
@Override
public boolean include(Entry<? extends HistoryTableModel, ? extends Integer> entry) {
return ((String) entry.getModel().getValueAt(entry.getIdentifier(), referenzColumn)).equals(referenz);
}
示例12: include
import javax.swing.RowFilter.Entry; //导入依赖的package包/类
@Override
public boolean include(Entry<? extends SolverConfigurationTableModel, ? extends Integer> entry) {
SolverConfiguration sc = entry.getModel().getSolverConfigurationAt(entry.getIdentifier());
return includeExperiments.contains(sc.getExperiment_id()) || (!excludeExperiments.contains(sc.getExperiment_id()) && solverBinaryIds.contains(sc.getSolverBinary().getId()));
}