/** * Creates a {@link AbstractFilterList} that includes a subset of the specified * source {@link EventList}. * * <p>Extending classes must call handleFilterChanged(). */ protected AbstractFilterList(EventList source) { super(new FilterList(source)); // listen for changes to the source list this.source.addListEventListener(this); }
/** * Creates a {@link AbstractFilterList} that includes a subset of the specified * source {@link EventList}. * * <p>Extending classes must call handleFilterChanged(). */ protected AbstractFilterList(EventList source) { super(new FilterList(source)); // listen for changes to the source list this.source.addListEventListener(this); }
/** * Creates a {@link AbstractFilterList} that includes a subset of the specified * source {@link EventList}. * * <p>Extending classes must call handleFilterChanged(). */ protected AbstractFilterList(EventList source) { super(new FilterList(source)); // listen for changes to the source list this.source.addListEventListener(this); }
/** * A hidden constructor that allows us to store a reference to the source of * the FilterList, which we may have created and must dispose later. * * @param table the checkable table * @param tableFormat the format of the checkable table * @param filterListSource the source of the FilterList that backs this TableCheckFilterList */ private TableCheckFilterList(Table table, TableFormat tableFormat, EventList<S> filterListSource) { this(new FilterList<S>(filterListSource, Matchers.trueMatcher()), table, tableFormat); // if a CheckableWrapperList was created, store a reference so it can be disposed later if (filterListSource instanceof CheckableWrapperList) checkableWrapperList = (CheckableWrapperList) filterListSource; }
/** * A hidden constructor that allows us to store a reference to the source of * the FilterList, which we may have created and must dispose later. * * @param table the checkable table * @param tableFormat the format of the checkable table * @param filterListSource the source of the FilterList that backs this TableCheckFilterList */ private TableCheckFilterList(Table table, TableFormat tableFormat, EventList<S> filterListSource) { this(new FilterList<S>(filterListSource, Matchers.trueMatcher()), table, tableFormat); // if a CheckableWrapperList was created, store a reference so it can be disposed later if (filterListSource instanceof CheckableWrapperList) checkableWrapperList = (CheckableWrapperList) filterListSource; }
/** * A hidden constructor that allows us to store a reference to the source of * the FilterList, which we may have created and must dispose later. * * @param table the checkable table * @param tableFormat the format of the checkable table * @param filterListSource the source of the FilterList that backs this TableCheckFilterList */ private TableCheckFilterList(Table table, TableFormat tableFormat, EventList<S> filterListSource) { this(new FilterList<S>(filterListSource, Matchers.trueMatcher()), table, tableFormat); // if a CheckableWrapperList was created, store a reference so it can be disposed later if (filterListSource instanceof CheckableWrapperList) checkableWrapperList = (CheckableWrapperList) filterListSource; }
@Setup(Level.Invocation) public void setUp() { matcherEditor = new AtLeastMatcherEditor(); base = new BasicEventList<>(); for (int i = 0; i < baseSize; i++) { base.add(new Integer(dice.nextInt(1000))); } filtered = new FilterList<>(base, matcherEditor); }
/** * Creates a new filter list that uses a TextFilterator. A TextFilterator is something * that I made up. It is basically a class that knows how to take an arbitrary * object and get an array of strings for that object. * * @param filterEdit a text field for typing in the filter text. */ public TextFilterList(EventList source, Text filterEdit, TextFilterator filterator) { super(new FilterList(source)); this.filterEdit = filterEdit; matcherEditor = new TextWidgetMatcherEditor(filterEdit, filterator, false); ((FilterList)this.source).setMatcherEditor(matcherEditor); // handle changes this.source.addListEventListener(this); }
/** * Creates a new filter list that uses a TextFilterator. A TextFilterator is something * that I made up. It is basically a class that knows how to take an arbitrary * object and get an array of strings for that object. * * @param filterEdit a text field for typing in the filter text. */ public TextFilterList(EventList source, Text filterEdit, TextFilterator filterator) { super(new FilterList(source)); this.filterEdit = filterEdit; matcherEditor = new TextWidgetMatcherEditor(filterEdit, filterator, false); ((FilterList)this.source).setMatcherEditor(matcherEditor); // handle changes this.source.addListEventListener(this); }
/** * Creates a {@link TextFilterList} that filters the specified {@link EventList} * of elements using the specified {@link TextFilterator} to get the * {@link String}s to search. * * @param filterEdit a text field for typing in the filter text. */ public TextFilterList(EventList source, TextFilterator filterator, JTextField filterEdit) { super(new FilterList(source)); this.matcherEditor = new TextComponentMatcherEditor(filterEdit, filterator); this.filterEdit = filterEdit; ((FilterList)this.source).setMatcherEditor(matcherEditor); // handle changes this.source.addListEventListener(this); }
/** * Creates a {@link TextFilterList} that filters the specified {@link EventList} * of elements using the specified {@link TextFilterator} to get the * {@link String}s to search. * * @param filterEdit a text field for typing in the filter text. */ public TextFilterList(EventList source, TextFilterator filterator, JTextField filterEdit) { super(new FilterList(source)); this.matcherEditor = new TextComponentMatcherEditor(filterEdit, filterator); this.filterEdit = filterEdit; ((FilterList)this.source).setMatcherEditor(matcherEditor); // handle changes this.source.addListEventListener(this); }
/** * Creates a {@link TextFilterList} that filters the specified {@link EventList} * of elements using the specified {@link TextFilterator} to get the * {@link String}s to search. * * @param filterEdit a text field for typing in the filter text. */ public TextFilterList(EventList source, TextFilterator filterator, JTextField filterEdit) { super(new FilterList(source)); this.matcherEditor = new TextComponentMatcherEditor(filterEdit, filterator); this.filterEdit = filterEdit; ((FilterList)this.source).setMatcherEditor(matcherEditor); // handle changes this.source.addListEventListener(this); }
/** * Creates a new filter list that uses a TextFilterator. A TextFilterator is something * that I made up. It is basically a class that knows how to take an arbitrary * object and get an array of strings for that object. * * @param filterEdit a text field for typing in the filter text. */ public TextFilterList(EventList source, Text filterEdit, TextFilterator filterator) { super(new FilterList(source)); this.filterEdit = filterEdit; matcherEditor = new TextWidgetMatcherEditor(filterEdit, filterator, false); ((FilterList)this.source).setMatcherEditor(matcherEditor); // handle changes this.source.addListEventListener(this); }
/** * @param source the raw elements that will be tested by the given * <code>matcher</code> * @param matcher the logic which determines whether an element is counted * in the value reported by this Calculation */ public ConditionalCount(EventList<E> source, Matcher<E> matcher) { super(new Integer(0)); // the user should ideally know nothing about this FilterList, so we // lock the pipeline during its construction so the calling code need // not consider concurrency, which is really an implementation detail source.getReadWriteLock().readLock().lock(); try { filtered = new FilterList<E>(source, matcher); filtered.addListEventListener(this); setValue(new Integer(filtered.size())); } finally { source.getReadWriteLock().readLock().unlock(); } }
/** * @param source the raw elements that will be tested by the given * <code>matcher</code> * @param matcher the logic which determines whether an element is counted * in the value reported by this Calculation */ public ConditionalCount(EventList<E> source, Matcher<E> matcher) { super(new Integer(0)); // the user should ideally know nothing about this FilterList, so we // lock the pipeline during its construction so the calling code need // not consider concurrency, which is really an implementation detail source.getReadWriteLock().readLock().lock(); try { filtered = new FilterList<E>(source, matcher); filtered.addListEventListener(this); setValue(new Integer(filtered.size())); } finally { source.getReadWriteLock().readLock().unlock(); } }
/** * @param source the raw elements that will be tested by the given * <code>matcher</code> * @param matcher the logic which determines whether an element is counted * in the value reported by this Calculation */ public ConditionalCount(EventList<E> source, Matcher<E> matcher) { super(new Integer(0)); // the user should ideally know nothing about this FilterList, so we // lock the pipeline during its construction so the calling code need // not consider concurrency, which is really an implementation detail source.getReadWriteLock().readLock().lock(); try { filtered = new FilterList<E>(source, matcher); filtered.addListEventListener(this); setValue(new Integer(filtered.size())); } finally { source.getReadWriteLock().readLock().unlock(); } }
@Benchmark @Warmup(iterations = 5) @Measurement(iterations = 10) @Fork(1) public EventList<Element> testSeparatorListFilterNew() { EventList<Element> baseCopy = GlazedLists.eventList(base); FilterList<Element> filterList = new FilterList<>(baseCopy); EventList<Element> sepBase = new SeparatorList<>(filterList, elementComparator(), 0, Integer.MAX_VALUE); for (int i = 0; i < 10; i++) { filterList.setMatcher(Matchers.falseMatcher()); filterList.setMatcher(Matchers.trueMatcher()); } return sepBase; }
@Benchmark @Warmup(iterations = 5) @Measurement(iterations = 10) @Fork(1) public EventList<Element> testSeparatorListFilterOld() { EventList<Element> baseCopy = GlazedLists.eventList(base); FilterList<Element> filterList = new FilterList<>(baseCopy); EventList<Element> sepBase = new SeparatorListOld<>(filterList, elementComparator(), 0, Integer.MAX_VALUE); for (int i = 0; i < 10; i++) { filterList.setMatcher(Matchers.falseMatcher()); filterList.setMatcher(Matchers.trueMatcher()); } return sepBase; }
/** * Set up GUI components. */ private void initialize() { // Init search field and a list filtered list for the quick search final JSearchField searchField = new JSearchField(); final MatcherEditor<HoursByMonth> textMatcherEditor = new TextComponentMatcherEditor<>(searchField, new HoursByMonthTextFilterator()); final FilterList<HoursByMonth> textFilteredIssues = new FilterList<>(this.report.getHoursByMonth(), textMatcherEditor); tableModel = new EventTableModel<>(textFilteredIssues, new HoursByMonthTableFormat()); final JTable table = new JHighligthedTable(tableModel); TableComparatorChooser.install( table, this.report.getHoursByMonth(), TableComparatorChooser.MULTIPLE_COLUMN_MOUSE ); table.getColumn(table.getColumnName(0)).setCellRenderer(new DefaultTableRenderer(new FormatStringValue(MONTH_FORMAT))); table.getColumn(table.getColumnName(1)).setCellRenderer(new DefaultTableRenderer(new FormatStringValue(YEAR_FORMAT))); table.getColumn(table.getColumnName(2)).setCellRenderer(new DefaultTableRenderer(new FormatStringValue(new DurationFormat()))); JScrollPane tableScrollPane = new JScrollPane(table); int border = 5; final double[][] size = { { border, TableLayout.FILL, border}, // Columns { border, TableLayout.PREFERRED, border, TableLayout.FILL } }; // Rows this.setLayout(new TableLayout(size)); this.add(searchField, "1, 1"); this.add(tableScrollPane, "1, 3"); }
/** * Set up GUI components. */ private void initialize() { // Init search field and a list filtered list for the quick search final JSearchField searchField = new JSearchField(); final MatcherEditor<AccumulatedProjectActivity> textMatcherEditor = new TextComponentMatcherEditor<>(searchField, new AccumulatedProjectActivityTextFilterator()); final FilterList<AccumulatedProjectActivity> textFilteredIssues = new FilterList<>(this.report.getAccumulatedActivitiesByDay(), textMatcherEditor); tableModel = new EventTableModel<>(textFilteredIssues, new AccumulatedActivitiesTableFormat()); final JTable table = new JHighligthedTable(tableModel); TableComparatorChooser.install( table, this.report.getAccumulatedActivitiesByDay(), TableComparatorChooser.MULTIPLE_COLUMN_MOUSE ); table.getColumn(table.getColumnName(0)).setCellRenderer(new DefaultTableRenderer(new FormatStringValue(FormatUtils.DAY_FORMAT))); table.getColumn(table.getColumnName(2)).setCellRenderer(new DefaultTableRenderer(new FormatStringValue(new DurationFormat()))); JScrollPane tableScrollPane = new JScrollPane(table); int border = 5; final double[][] size = { { border, TableLayout.FILL, border}, // Columns { border, TableLayout.PREFERRED, border, TableLayout.FILL } }; // Rows this.setLayout(new TableLayout(size)); this.add(searchField, "1, 1"); this.add(tableScrollPane, "1, 3"); }