提交 7346d12b 编写于 作者: E Eduardo Ramos

Update swingx dependency and fix problem with table filters.

上级 16541c85
......@@ -499,13 +499,13 @@ public class DataTableTopComponent extends TopComponent implements AWTEventListe
return;
}
if (isShowingNodesTable()) {
if (nodeTable.setPattern(filterTextField.getText(), index)) {
if (nodeTable.setFilterPattern(filterTextField.getText(), index)) {
filterTextField.setBackground(Color.WHITE);
} else {
filterTextField.setBackground(invalidFilterColor);
}
} else if (isShowingEdgesTable()) {
if (edgeTable.setPattern(filterTextField.getText(), index)) {
if (edgeTable.setFilterPattern(filterTextField.getText(), index)) {
filterTextField.setBackground(Color.WHITE);
} else {
filterTextField.setBackground(invalidFilterColor);
......
......@@ -49,6 +49,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.regex.PatternSyntaxException;
import javax.swing.RowFilter;
import javax.swing.table.TableCellRenderer;
......@@ -81,7 +82,7 @@ import org.openide.util.Lookup;
public abstract class AbstractElementsDataTable<T extends Element> {
protected final JXTable table;
protected RowFilter rowFilter;
protected String filterPattern;
protected List<T> selectedElements;
protected final AttributeColumnsController attributeColumnsController;
protected boolean refreshingTable = false;
......@@ -102,7 +103,6 @@ public abstract class AbstractElementsDataTable<T extends Element> {
table.setColumnControlVisible(false);
table.setSortable(true);
table.setAutoCreateRowSorter(true);
table.setRowFilter(rowFilter);
sparkLinesRenderers = new ArrayList<SparkLinesRenderer>();
intervalSetRenderer = new IntervalSetRenderer();
intervalMapRenderer = new IntervalMapRenderer();
......@@ -165,18 +165,32 @@ public abstract class AbstractElementsDataTable<T extends Element> {
return table;
}
public boolean setPattern(String regularExpr, int column) {
public boolean setFilterPattern(String regularExpr, int column) {
try {
if (!regularExpr.startsWith("(?i)")) { //CASE_INSENSITIVE
regularExpr = "(?i)" + regularExpr;
if(Objects.equals(filterPattern, regularExpr)){
return true;
}
filterPattern = regularExpr;
if(regularExpr == null || regularExpr.trim().isEmpty()){
table.setRowFilter(null);
}else{
if (!regularExpr.startsWith("(?i)")) { //CASE_INSENSITIVE
regularExpr = "(?i)" + regularExpr;
}
RowFilter rowFilter = RowFilter.regexFilter(regularExpr, column);
table.setRowFilter(rowFilter);
}
rowFilter = RowFilter.regexFilter(regularExpr, column);
table.setRowFilter(rowFilter);
} catch (PatternSyntaxException e) {
return false;
}
return true;
}
public String getPattern(){
return filterPattern;
}
public void refreshModel(T[] elements, Column[] cols, GraphModel graphModel, DataTablesModel dataTablesModel) {
showingColumns = cols;
......
......@@ -40,9 +40,9 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swingx</artifactId>
<version>1.6.1</version>
<groupId>org.swinglabs.swingx</groupId>
<artifactId>swingx-all</artifactId>
<version>1.6.5-1</version>
</dependency>
<dependency>
<groupId>org.jdesktop</groupId>
......@@ -62,7 +62,7 @@
<dependency>
<groupId>com.miglayout</groupId>
<artifactId>miglayout</artifactId>
<version>3.7.1</version>
<version>3.7.4</version>
</dependency>
<dependency>
<groupId>net.java.dev</groupId>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册