From 220f100def4c67ca59bd2de989f18298b79bf260 Mon Sep 17 00:00:00 2001 From: Mike Duff Date: Thu, 10 Jan 2013 15:35:33 -0600 Subject: [PATCH] Issue #1432 - Fix case sensative and exclude check boxes. Former-commit-id: 7ba0d71d7c17adbd4c472e71f9be5e7293894bb3 [formerly d2981a827553fe0da30e08c417bba36e34383f9a] [formerly 9526199a9ccb0c50b3ac1275509f720ae26ef092] [formerly 7ba0d71d7c17adbd4c472e71f9be5e7293894bb3 [formerly d2981a827553fe0da30e08c417bba36e34383f9a] [formerly 9526199a9ccb0c50b3ac1275509f720ae26ef092] [formerly 78440f2b5af5cc55bde8667040661b4e4fe28cbc [formerly 9526199a9ccb0c50b3ac1275509f720ae26ef092 [formerly 29d620050a3b2aefd2b9eda664e3139e146558be]]]] Former-commit-id: 78440f2b5af5cc55bde8667040661b4e4fe28cbc Former-commit-id: c21d02d8fbdd27e7278a07006860008b9f7523d8 [formerly f2da1df6e6e60774485cccceded69937f42fb443] [formerly c2ca6a0936930afda3caca73c5ca608bee2b795a [formerly bde6be532ed14345a49169a08655dac93985cba2]] Former-commit-id: 63b6642e27b9e9154a9263d35b4fa3db440b7d2b [formerly ae8eecc95bcd9bd420f6f34b58bd522bde6821fb] Former-commit-id: d23c9266d893ee11f6efac8d3eb510315dd205d8 --- .../viz/datadelivery/browser/FilterComp.java | 59 +++++++++++-------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/browser/FilterComp.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/browser/FilterComp.java index 8c24db3c4f..c714784b5a 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/browser/FilterComp.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/browser/FilterComp.java @@ -53,6 +53,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate; * ------------ ---------- ----------- -------------------------- * Feb 21, 2012 mpduff Initial creation * Aug 08, 2012 863 jpiatt Added new interface method. + * Jan 07, 2013 1432 mpduff Fix case sensitive and exclude checkboxes. * * * @@ -106,7 +107,8 @@ public class FilterComp extends AbstractFilterComp implements IUpdate { * @param idx * Control index */ - public FilterComp(Composite parent, int style, IFilterUpdate callback, FilterConfig config, int idx) { + public FilterComp(Composite parent, int style, IFilterUpdate callback, + FilterConfig config, int idx) { super(parent, callback, idx); this.config = config; this.dualConfig = config.getDualConfig(); @@ -180,11 +182,25 @@ public class FilterComp extends AbstractFilterComp implements IUpdate { caseBtn = new Button(controlComp, SWT.CHECK); caseBtn.setText("Case Sensitive"); - caseBtn.setToolTipText("Match upper and lower case"); + caseBtn.setToolTipText("Match upper and lower case"); + caseBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + dualConfig.setCaseFlag(caseBtn.getSelection()); + handleSearch(); + } + }); exclusionBtn = new Button(controlComp, SWT.CHECK); exclusionBtn.setText("Exclude"); - exclusionBtn.setToolTipText("Does not contain search text"); + exclusionBtn.setToolTipText("Does not contain search text"); + exclusionBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + dualConfig.setExcludeFlag(exclusionBtn.getSelection()); + handleSearch(); + } + }); } @@ -239,7 +255,7 @@ public class FilterComp extends AbstractFilterComp implements IUpdate { * Composite that gets the separator */ private void addSeparator(Composite parentComp) { - GridLayout gl = (GridLayout)parentComp.getLayout(); + GridLayout gl = (GridLayout) parentComp.getLayout(); GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); gd.horizontalSpan = gl.numColumns; @@ -275,7 +291,8 @@ public class FilterComp extends AbstractFilterComp implements IUpdate { String[] parts; /* Iterate over the filtered list of items */ - String[] filteredList = dualConfig.getFullList().toArray(new String[dualConfig.getFullList().size()]); + String[] filteredList = dualConfig.getFullList().toArray( + new String[dualConfig.getFullList().size()]); // Search contains 1 or more * if (search.contains("*")) { @@ -288,9 +305,9 @@ public class FilterComp extends AbstractFilterComp implements IUpdate { if (item.contains(part) == excludeSearch) { continue ITEM; } - } - else { - if (!item.toLowerCase().contains(part.toLowerCase()) == excludeSearch) { + } else { + if (!item.toLowerCase().contains( + part.toLowerCase()) == excludeSearch) { continue ITEM; } } @@ -304,15 +321,14 @@ public class FilterComp extends AbstractFilterComp implements IUpdate { int curIdx = 0; if (caseBtn.getSelection()) { curIdx = item.indexOf(parts[i]); - } - else { - curIdx = item.toLowerCase().indexOf(parts[i].toLowerCase()); + } else { + curIdx = item.toLowerCase().indexOf( + parts[i].toLowerCase()); } if (curIdx > idx) { idx = curIdx; - } - else { + } else { break ITEM; } } @@ -324,16 +340,14 @@ public class FilterComp extends AbstractFilterComp implements IUpdate { dualList.setAvailableItems(tmpFilterList); } return; - } - else { + } else { // No * in search for (String item : filteredList) { if (caseBtn.getSelection()) { if (item.contains(search) == excludeSearch) { tmpFilterList.add(item); } - } - else { + } else { if (item.toLowerCase().contains(search.toLowerCase()) == excludeSearch) { tmpFilterList.add(item); } @@ -374,8 +388,7 @@ public class FilterComp extends AbstractFilterComp implements IUpdate { /** * Get the rows in the Selected List. * - * @return - * array list of selected items + * @return array list of selected items */ public String[] getSelectedListItems() { return dualList.getSelectedListItems(); @@ -384,8 +397,7 @@ public class FilterComp extends AbstractFilterComp implements IUpdate { /** * Get the Filter Configuration. * - * @return - * FilterConfig object + * @return FilterConfig object */ public FilterConfig getConfig() { return config; @@ -410,8 +422,7 @@ public class FilterComp extends AbstractFilterComp implements IUpdate { public void hasEntries(boolean entries) { if (entries) { setCurrentState(ExpandItemState.Entries); - } - else { + } else { setCurrentState(ExpandItemState.NoEntries); } this.dirty = true; @@ -439,6 +450,6 @@ public class FilterComp extends AbstractFilterComp implements IUpdate { @Override public void selectionChanged() { // unused - + } }