changeset 123:8313bad3000a

Bug 2735: Whether the exclude filter is applied or not. reviewed-by: ykubota
author Yasumasa Suenaga <yasuenag@gmail.com>
date Wed, 09 Dec 2015 14:40:54 +0900
parents 6b4a0676babd
children dea22a8f1da6
files ChangeLog analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/BindingFilter.java analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/HistogramController.java
diffstat 3 files changed, 36 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Dec 09 14:28:18 2015 +0900
+++ b/ChangeLog	Wed Dec 09 14:40:54 2015 +0900
@@ -12,6 +12,7 @@
 	* Bug 2698: Charts are not cleared when another file is opened.
 	* Bug 2699: Class Search is not work properly.
 	* Bug 2715: TextBox which shows opened file should be read-only.
+	* Bug 2735: Whether the exclude filter is applied or not.
 
 2015-11-05  Yasumasa Suenaga  <yasuenag@gmail.com>
 
--- a/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/BindingFilter.java	Wed Dec 09 14:28:18 2015 +0900
+++ b/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/BindingFilter.java	Wed Dec 09 14:40:54 2015 +0900
@@ -31,16 +31,23 @@
     
     private final BooleanProperty hideProp;
     
+    private final BooleanProperty applied;
+    
     public BindingFilter(Filter f){
         setName(f.getName());
         setClasses(f.getClasses());
         hideProp = new SimpleBooleanProperty(f.isHide());
+        applied = new SimpleBooleanProperty(false);
     }
     
     public BooleanProperty hideProperty(){
         return hideProp;
     }
 
+    public BooleanProperty appliedProperty(){
+        return applied;
+    }
+
     @Override
     public void setHide(boolean visible) {
         super.setHide(visible);
--- a/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/HistogramController.java	Wed Dec 09 14:28:18 2015 +0900
+++ b/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/HistogramController.java	Wed Dec 09 14:40:54 2015 +0900
@@ -85,13 +85,13 @@
 public class HistogramController implements Initializable {
 
     @FXML
-    private TableView<Filter> excludeTable;
+    private TableView<BindingFilter> excludeTable;
 
     @FXML
-    private TableColumn<Filter, Boolean> hideColumn;
+    private TableColumn<BindingFilter, Boolean> hideColumn;
 
     @FXML
-    private TableColumn<Filter, String> excludeNameColumn;
+    private TableColumn<BindingFilter, String> excludeNameColumn;
 
     @FXML
     private TextField searchText;
@@ -165,7 +165,20 @@
 
         hideColumn.setCellValueFactory(new PropertyValueFactory<>("hide"));
         hideColumn.setCellFactory(CheckBoxTableCell.forTableColumn(hideColumn));
-        excludeNameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
+
+        excludeNameColumn.setCellFactory(p -> new TableCell<BindingFilter, String>(){
+            @Override
+            protected void updateItem(String item, boolean empty) {
+                super.updateItem(item, empty);
+                BindingFilter filter = (BindingFilter)getTableRow().getItem();
+                
+                if(!empty){
+                    styleProperty().bind(Bindings.createStringBinding(() -> filter.appliedProperty().get() ? "-fx-text-fill: blue;" : "-fx-text-fill: black;", filter.appliedProperty()));
+                    setText(filter.getName());
+                }
+
+            }
+        });
 
         colorColumn.setCellFactory(p -> new TableCell<DiffData, String>() {
             @Override
@@ -274,10 +287,20 @@
         topNYAxis.setLabel(instanceGraph.get() ? "instances" : "MB");
 
         snapshotSelectionModel.get().selectLast();
+        
+        if(excludeFilterEnable){
+            excludeTable.getItems().stream()
+                    .forEach(f -> f.appliedProperty().set(f.isHide()));
+    }
+        else{
+            excludeTable.getItems().stream()
+                    .forEach(f -> f.appliedProperty().set(false));
+        }
+
     }
 
     private void putIfAbsentToExcludeFilter(Filter filter){
-        Optional<Filter> exists = excludeTable.getItems().stream()
+        Optional<BindingFilter> exists = excludeTable.getItems().stream()
                                                          .filter(f -> f.getName().equals(filter.getName()))
                                                          .findAny();