GT-3515 - Column constraint docs review fixes

This commit is contained in:
dragonmacher
2020-01-31 16:25:00 -05:00
parent 491c4e466a
commit 7a01b8b3e0
13 changed files with 40 additions and 48 deletions
@@ -314,7 +314,7 @@ public class SampleGraphProvider extends ComponentProviderAdapter {
return mainPanel;
}
private void showFitlerPanel(boolean selected) {
private void showFilterPanel(boolean selected) {
if (selected) {
mainPanel.add(filterPanel, BorderLayout.SOUTH);
}
@@ -331,7 +331,7 @@ public class SampleGraphProvider extends ComponentProviderAdapter {
@Override
public void actionPerformed(ActionContext context) {
showFitlerPanel(isSelected());
showFilterPanel(isSelected());
}
};
@@ -537,7 +537,7 @@ class GhidraScriptTableModel extends GDynamicColumnTableModel<ResourceFile, Obje
public ColumnConstraintFilterMode getColumnConstraintFilterMode() {
// not sure about this: it could be USE_COLUMN_CONSTRAINTS_ONLY, but then the text
// filter would not match the formatted date. This allows for both.
return ColumnConstraintFilterMode.USE_BOTH_COLUMN_RENDERER_FITLER_STRING_AND_CONSTRAINTS;
return ColumnConstraintFilterMode.ALLOW_ALL_FILTERS;
}
@Override
@@ -328,7 +328,7 @@ class VTFunctionAssociationTableModel extends AddressBasedTableModel<VTFunctionR
}
private boolean hasNoFilter() {
return filterSettings == FilterSettings.SHOW_ALL && !hasFitler();
return filterSettings == FilterSettings.SHOW_ALL && !hasFilter();
}
private boolean passesUnmatchedFunctionFilter(FunctionAssociationInfo info) {
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +15,8 @@
*/
package ghidra.feature.vt.gui.provider.matchtable;
import javax.swing.*;
import ghidra.feature.vt.api.main.VTMatch;
import ghidra.feature.vt.gui.filters.*;
import ghidra.feature.vt.gui.plugin.VTController;
@@ -23,8 +24,6 @@ import ghidra.util.HelpLocation;
import ghidra.util.layout.VariableRowHeightGridLayout;
import ghidra.util.layout.VerticalLayout;
import javax.swing.*;
public class MatchesFilterDialogComponentProvider extends
AncillaryFilterDialogComponentProvider<VTMatch> {
@@ -58,9 +57,9 @@ public class MatchesFilterDialogComponentProvider extends
// Row 1 - Right Component
// association status filter
AssociationStatusFilter associationStatusFitler = new AssociationStatusFilter();
addFilter(associationStatusFitler);
rowOnePanel.add(associationStatusFitler.getComponent());
AssociationStatusFilter associationStatusFilter = new AssociationStatusFilter();
addFilter(associationStatusFilter);
rowOnePanel.add(associationStatusFilter.getComponent());
// Row 2 - Left Component
// symbol type filter
@@ -116,7 +116,7 @@ public class DefaultRowFilterTransformer<ROW_OBJECT> implements RowFilterTransfo
}
ColumnConstraintFilterMode mode = renderer.getColumnConstraintFilterMode();
return mode == ColumnConstraintFilterMode.USE_COLUMN_CONSTRAINTS_ONLY;
return mode == ColumnConstraintFilterMode.ALLOW_CONSTRAINTS_FILTER_ONLY;
}
private String getRenderedColumnValue(Object columnValue, int columnIndex) {
@@ -91,7 +91,7 @@ public class ColumnFilterData<T> implements Comparable<ColumnFilterData<T>> {
// and does not support the traditional text based filtering.
//
ColumnConstraintFilterMode mode = columnRenderer.getColumnConstraintFilterMode();
if (mode == ColumnConstraintFilterMode.USE_COLUMN_CONSTRAINTS_ONLY) {
if (mode == ColumnConstraintFilterMode.ALLOW_CONSTRAINTS_FILTER_ONLY) {
return new ArrayList<>(defaultConstraints);
}
@@ -106,16 +106,16 @@ public class ColumnFilterData<T> implements Comparable<ColumnFilterData<T>> {
ColumnRendererMapper mapper = new ColumnRendererMapper(asT, columnBasedModel, modelIndex);
Collection<ColumnConstraint<T>> rendererStringConstraints =
DiscoverableTableUtils.getColumnConstraints(mapper);
if (mode == ColumnConstraintFilterMode.ALLOW_RENDERER_STRING_FILTER_ONLY) {
return new ArrayList<>(rendererStringConstraints);
}
//
// Case 5: the renderer supports both text filtering and column constraint filtering.
//
// assume: mode == ColumnConstraintFilterMode.ALLOW_ALL_FILTERS
List<ColumnConstraint<T>> results = new ArrayList<>(rendererStringConstraints);
if (mode == ColumnConstraintFilterMode.USE_BOTH_COLUMN_RENDERER_FITLER_STRING_AND_CONSTRAINTS) {
// also use the normal constraints with the renderer constraints
results.addAll(defaultConstraints);
}
results.addAll(defaultConstraints);
return results;
}
@@ -102,7 +102,7 @@ public class ColumnFilterDialogModel<R> {
}
/**
* Creates a new filter for (a new major row in the dialog filter panel)
* Creates a new filter row (a new major row in the dialog filter panel)
* @param logicOperation the logical operation for how this row interacts with preceding rows
* @return the new filter row that represents a major row in the dialog filter panel
*/
@@ -15,12 +15,13 @@
*/
package docking.widgets.table.sort;
import static ghidra.util.table.column.GColumnRenderer.ColumnConstraintFilterMode.*;
import java.util.Comparator;
import docking.widgets.table.*;
import ghidra.docking.settings.Settings;
import ghidra.util.table.column.GColumnRenderer;
import ghidra.util.table.column.GColumnRenderer.ColumnConstraintFilterMode;
/**
* A special version of the backup comparator that uses the column's rendered value for
@@ -47,7 +48,7 @@ public class ColumnRenderedValueBackupComparator<T> implements Comparator<Object
@SuppressWarnings("unchecked")
GColumnRenderer<Object> renderer = (GColumnRenderer<Object>) column.getColumnRenderer();
if (renderer != null) {
if (renderer.getColumnConstraintFilterMode() == ColumnConstraintFilterMode.USE_COLUMN_CONSTRAINTS_ONLY) {
if (renderer.getColumnConstraintFilterMode() == ALLOW_CONSTRAINTS_FILTER_ONLY) {
// this implies that the column has signaled that it does not support
// filtering/sorting using its rendered value
supportsColumnSorting = false;
@@ -74,9 +74,9 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
* This variable can be in one of three states:
* <ul>
* <li>null - signals that there is no filter change taking place</li>
* <li>An instance of <code>NullTableFitler</code> - the client has removed the current
* <li>An instance of <code>NullTableFilter</code> - the client has removed the current
* filter by calling {@link #setTableFilter(TableFilter)} with a null value</li>
* <li>An instance of a custom <code>TableFitler</code> - the client has changed the
* <li>An instance of a custom <code>TableFilter</code> - the client has changed the
* filter to a non-null value by calling {@link #setTableFilter(TableFilter)}</li>
* </ul>
*/
@@ -399,7 +399,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
*
* @return true if there is a table filter set.
*/
public boolean hasFitler() {
public boolean hasFilter() {
TableFilter<ROW_OBJECT> currentFilter = getTableFilter();
return !currentFilter.isEmpty();
}
@@ -429,7 +429,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
return data;
}
if (!hasFitler()) {
if (!hasFilter()) {
return data;
}
@@ -463,14 +463,14 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
}
/**
* Sets the given <code>TableFitler</code> on this model. This table filter will then be used
* Sets the given <code>TableFilter</code> on this model. This table filter will then be used
* by this model in the default {@link #doFilter(List, TableSortingContext, TaskMonitor)}
* method.
* @param tableFitler The filter to use for table filtering.
* @param tableFilter The filter to use for table filtering.
*/
@Override
public void setTableFilter(TableFilter<ROW_OBJECT> tableFitler) {
this.pendingTableFilter = tableFitler;
public void setTableFilter(TableFilter<ROW_OBJECT> tableFilter) {
this.pendingTableFilter = tableFilter;
if (pendingTableFilter == null) {
// Don't allow the pending filter to be null in this case. The client has changed
// the filter. If we use null, then we don't know the difference between a client
@@ -480,8 +480,8 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
reFilter();
}
private void setAppliedTableFitler(TableFilter<ROW_OBJECT> tableFitler) {
if (tableFitler == null) {
private void setAppliedTableFilter(TableFilter<ROW_OBJECT> tableFilter) {
if (tableFilter == null) {
// null means there was no change to the text filter--so don't set it (see the
// javadoc for the filter variables)
return;
@@ -532,7 +532,7 @@ public abstract class ThreadedTableModel<ROW_OBJECT, DATA_SOURCE>
this.allData = allData;
this.filteredData = filteredData;
setAppliedTableFitler(pendingTableFilter);
setAppliedTableFilter(pendingTableFilter);
pendingSortContext = null;
TableSortingContext<ROW_OBJECT> newSortingContext = filteredData.getSortContext();
@@ -36,7 +36,7 @@ public interface AbstractWrapperTypeColumnRenderer<T> extends GColumnRenderer<T>
// Overridden to only allow the constraint filtering mechanism.
@Override
public default ColumnConstraintFilterMode getColumnConstraintFilterMode() {
return ColumnConstraintFilterMode.USE_COLUMN_CONSTRAINTS_ONLY;
return ColumnConstraintFilterMode.ALLOW_CONSTRAINTS_FILTER_ONLY;
}
@Override
@@ -83,21 +83,14 @@ public interface GColumnRenderer<T> extends TableCellRenderer {
public enum ColumnConstraintFilterMode {
//@formatter:off
/**
* Signals that the programmer didn't make a decision about how filtering for this
* column should work. This currently will treat all filtering as if
* {@link #USE_COLUMN_RENDERER_FITLER_STRING_ONLY} was chosen.
*/
DEFAULT,
/** Use only {@link GColumnRenderer#getFilterString(Object, Settings)} value; no constraints */
USE_COLUMN_RENDERER_FITLER_STRING_ONLY,
ALLOW_RENDERER_STRING_FILTER_ONLY,
/** Use only column constraints when filtering */
USE_COLUMN_CONSTRAINTS_ONLY,
ALLOW_CONSTRAINTS_FILTER_ONLY,
/** Use both the rendered filter String and any found column constraints */
USE_BOTH_COLUMN_RENDERER_FITLER_STRING_AND_CONSTRAINTS,
ALLOW_ALL_FILTERS,
//@formatter:on
}
@@ -111,7 +104,7 @@ public interface GColumnRenderer<T> extends TableCellRenderer {
* @return the mode
*/
public default ColumnConstraintFilterMode getColumnConstraintFilterMode() {
return ColumnConstraintFilterMode.DEFAULT;
return ColumnConstraintFilterMode.ALLOW_RENDERER_STRING_FILTER_ONLY;
}
/**
@@ -165,7 +165,7 @@ public abstract class VisualGraphComponentProvider<V extends VisualVertex,
Undo/redo for graph operations (delete; group/ungroup; move)
-rapid pressing will shortcut items
-undo/redo allows us to prune nodes
--how to maintain old nodes/edges? (FitleringVisualGraph)
--how to maintain old nodes/edges? (FilteringVisualGraph)
*/
@@ -15,8 +15,7 @@
*/
package ghidra.graph.job;
import static util.CollectionUtils.asSet;
import static util.CollectionUtils.asStream;
import static util.CollectionUtils.*;
import java.util.Iterator;
import java.util.Set;
@@ -108,7 +107,7 @@ public class FilterVerticesJob<V extends VisualVertex, E extends VisualEdge<V>>
passedVertices = matching;
// 2)
failedVertices = findCurrentVerticesFailingTheFitler(matching);
failedVertices = findCurrentVerticesFailingTheFilter(matching);
failedEdges = filterGraph.getAllEdges(failedVertices);
Set<E> allRelatedEdges = filterGraph.getAllEdges(passedVertices);
@@ -119,7 +118,7 @@ public class FilterVerticesJob<V extends VisualVertex, E extends VisualEdge<V>>
filterGraph.unfilterVertices(passedVertices);
}
private Set<V> findCurrentVerticesFailingTheFitler(Set<V> validVertices) {
private Set<V> findCurrentVerticesFailingTheFilter(Set<V> validVertices) {
UnmodifiableIterator<V> nonMatchingIterator =
Iterators.filter(filterGraph.getUnfilteredVertices(), v -> !validVertices.contains(v));