Merge "Issue #1432 - Fix case sensative and exclude check boxes." into development
Former-commit-id:942140cca5
[formerlycffe035019
] [formerly942140cca5
[formerlycffe035019
] [formerlye91b5bd035
[formerly 8da35969c383bb7d22e5f629859311d8783069dc]]] Former-commit-id:e91b5bd035
Former-commit-id:c4c2ae3256
[formerly6857211fc6
] Former-commit-id:9492e77036
This commit is contained in:
commit
9312478e41
1 changed files with 35 additions and 24 deletions
|
@ -53,6 +53,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Feb 21, 2012 mpduff Initial creation
|
* Feb 21, 2012 mpduff Initial creation
|
||||||
* Aug 08, 2012 863 jpiatt Added new interface method.
|
* Aug 08, 2012 863 jpiatt Added new interface method.
|
||||||
|
* Jan 07, 2013 1432 mpduff Fix case sensitive and exclude checkboxes.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -106,7 +107,8 @@ public class FilterComp extends AbstractFilterComp implements IUpdate {
|
||||||
* @param idx
|
* @param idx
|
||||||
* Control index
|
* 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);
|
super(parent, callback, idx);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.dualConfig = config.getDualConfig();
|
this.dualConfig = config.getDualConfig();
|
||||||
|
@ -180,11 +182,25 @@ public class FilterComp extends AbstractFilterComp implements IUpdate {
|
||||||
|
|
||||||
caseBtn = new Button(controlComp, SWT.CHECK);
|
caseBtn = new Button(controlComp, SWT.CHECK);
|
||||||
caseBtn.setText("Case Sensitive");
|
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 = new Button(controlComp, SWT.CHECK);
|
||||||
exclusionBtn.setText("Exclude");
|
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
|
* Composite that gets the separator
|
||||||
*/
|
*/
|
||||||
private void addSeparator(Composite parentComp) {
|
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);
|
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
gd.horizontalSpan = gl.numColumns;
|
gd.horizontalSpan = gl.numColumns;
|
||||||
|
@ -275,7 +291,8 @@ public class FilterComp extends AbstractFilterComp implements IUpdate {
|
||||||
String[] parts;
|
String[] parts;
|
||||||
|
|
||||||
/* Iterate over the filtered list of items */
|
/* 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 *
|
// Search contains 1 or more *
|
||||||
if (search.contains("*")) {
|
if (search.contains("*")) {
|
||||||
|
@ -288,9 +305,9 @@ public class FilterComp extends AbstractFilterComp implements IUpdate {
|
||||||
if (item.contains(part) == excludeSearch) {
|
if (item.contains(part) == excludeSearch) {
|
||||||
continue ITEM;
|
continue ITEM;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
if (!item.toLowerCase().contains(
|
||||||
if (!item.toLowerCase().contains(part.toLowerCase()) == excludeSearch) {
|
part.toLowerCase()) == excludeSearch) {
|
||||||
continue ITEM;
|
continue ITEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,15 +321,14 @@ public class FilterComp extends AbstractFilterComp implements IUpdate {
|
||||||
int curIdx = 0;
|
int curIdx = 0;
|
||||||
if (caseBtn.getSelection()) {
|
if (caseBtn.getSelection()) {
|
||||||
curIdx = item.indexOf(parts[i]);
|
curIdx = item.indexOf(parts[i]);
|
||||||
}
|
} else {
|
||||||
else {
|
curIdx = item.toLowerCase().indexOf(
|
||||||
curIdx = item.toLowerCase().indexOf(parts[i].toLowerCase());
|
parts[i].toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curIdx > idx) {
|
if (curIdx > idx) {
|
||||||
idx = curIdx;
|
idx = curIdx;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
break ITEM;
|
break ITEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,16 +340,14 @@ public class FilterComp extends AbstractFilterComp implements IUpdate {
|
||||||
dualList.setAvailableItems(tmpFilterList);
|
dualList.setAvailableItems(tmpFilterList);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// No * in search
|
// No * in search
|
||||||
for (String item : filteredList) {
|
for (String item : filteredList) {
|
||||||
if (caseBtn.getSelection()) {
|
if (caseBtn.getSelection()) {
|
||||||
if (item.contains(search) == excludeSearch) {
|
if (item.contains(search) == excludeSearch) {
|
||||||
tmpFilterList.add(item);
|
tmpFilterList.add(item);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (item.toLowerCase().contains(search.toLowerCase()) == excludeSearch) {
|
if (item.toLowerCase().contains(search.toLowerCase()) == excludeSearch) {
|
||||||
tmpFilterList.add(item);
|
tmpFilterList.add(item);
|
||||||
}
|
}
|
||||||
|
@ -374,8 +388,7 @@ public class FilterComp extends AbstractFilterComp implements IUpdate {
|
||||||
/**
|
/**
|
||||||
* Get the rows in the Selected List.
|
* Get the rows in the Selected List.
|
||||||
*
|
*
|
||||||
* @return
|
* @return array list of selected items
|
||||||
* array list of selected items
|
|
||||||
*/
|
*/
|
||||||
public String[] getSelectedListItems() {
|
public String[] getSelectedListItems() {
|
||||||
return dualList.getSelectedListItems();
|
return dualList.getSelectedListItems();
|
||||||
|
@ -384,8 +397,7 @@ public class FilterComp extends AbstractFilterComp implements IUpdate {
|
||||||
/**
|
/**
|
||||||
* Get the Filter Configuration.
|
* Get the Filter Configuration.
|
||||||
*
|
*
|
||||||
* @return
|
* @return FilterConfig object
|
||||||
* FilterConfig object
|
|
||||||
*/
|
*/
|
||||||
public FilterConfig getConfig() {
|
public FilterConfig getConfig() {
|
||||||
return config;
|
return config;
|
||||||
|
@ -410,8 +422,7 @@ public class FilterComp extends AbstractFilterComp implements IUpdate {
|
||||||
public void hasEntries(boolean entries) {
|
public void hasEntries(boolean entries) {
|
||||||
if (entries) {
|
if (entries) {
|
||||||
setCurrentState(ExpandItemState.Entries);
|
setCurrentState(ExpandItemState.Entries);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setCurrentState(ExpandItemState.NoEntries);
|
setCurrentState(ExpandItemState.NoEntries);
|
||||||
}
|
}
|
||||||
this.dirty = true;
|
this.dirty = true;
|
||||||
|
@ -439,6 +450,6 @@ public class FilterComp extends AbstractFilterComp implements IUpdate {
|
||||||
@Override
|
@Override
|
||||||
public void selectionChanged() {
|
public void selectionChanged() {
|
||||||
// unused
|
// unused
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue