Issue #2892 - Fix problems loading saved configs for data browser dialog.

Change-Id: I73b98714642f5852f7209fd8533d49aa473412f9

Former-commit-id: 578aa18528 [formerly 635684bb4e] [formerly 33a2259cf4] [formerly 578aa18528 [formerly 635684bb4e] [formerly 33a2259cf4] [formerly da65756e3b [formerly 33a2259cf4 [formerly 323badf58cf12a35b3a4d93ff0188b638e60969b]]]]
Former-commit-id: da65756e3b
Former-commit-id: 29b9ea212f [formerly a23608ec59] [formerly b538cf660c9cfb4fa877799b800a871c591269c0 [formerly 67ff4371b3]]
Former-commit-id: 71f32d74c2777424ba3bb3443dc8759186877477 [formerly bc82bf8f86]
Former-commit-id: b432d6a4f6
This commit is contained in:
Mike Duff 2014-04-10 13:31:42 -05:00
parent 5fe9724c63
commit 408059b7e3
3 changed files with 42 additions and 10 deletions

View file

@ -124,6 +124,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Sep 26, 2013 2412 mpduff Handle auto selecting data type. * Sep 26, 2013 2412 mpduff Handle auto selecting data type.
* Sep 26, 2013 2413 mpduff Added isDirty check to New Configuration menu selection. * Sep 26, 2013 2413 mpduff Added isDirty check to New Configuration menu selection.
* Oct 11, 2013 2386 mpduff Refactor DD Front end. * Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Apr 10, 2014 2892 mpduff Fix problems with loading of saved configs.
* *
* </pre> * </pre>
* *
@ -371,7 +372,6 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
displayLoadSaveConfigDlg(DialogType.OPEN); displayLoadSaveConfigDlg(DialogType.OPEN);
setClean();
} }
}); });
@ -970,7 +970,6 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
"Selection Required", "Selection Required",
"Must make a selection before saving."); "Must make a selection before saving.");
} }
} else if (type == DialogType.OPEN) { } else if (type == DialogType.OPEN) {
setText(WINDOW_TITLE + " - (" setText(WINDOW_TITLE + " - ("
+ locFile.getFile().getName() + ")"); + locFile.getFile().getName() + ")");
@ -978,7 +977,7 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
xml = fm.getXml(); xml = fm.getXml();
updateFilters(); updateFilters();
selectedFile = locFile.getFile().getName(); selectedFile = locFile.getFile().getName();
setClean();
} else if (type == DialogType.DELETE) { } else if (type == DialogType.DELETE) {
try { try {
if (locFile != null) { if (locFile != null) {
@ -1070,9 +1069,9 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
int i = 0; int i = 0;
for (String s : dataTypes) { for (String s : dataTypes) {
if (s.equals(valueList.get(0))) { if (s.equals(valueList.get(0))) {
i++;
break; break;
} }
i++;
} }
datatypeList.select(i); datatypeList.select(i);
handleDataTypeSelection(); handleDataTypeSelection();

View file

@ -85,7 +85,8 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
* Jul 05, 2013 2137 mpduff Only a single data type can be selected. * Jul 05, 2013 2137 mpduff Only a single data type can be selected.
* Jul 05, 2013 2138 mpduff Fixed to not use filter if filter is disabled. * Jul 05, 2013 2138 mpduff Fixed to not use filter if filter is disabled.
* Sep 26, 2013 2412 mpduff Don't create expand items if no data type is selected. * Sep 26, 2013 2412 mpduff Don't create expand items if no data type is selected.
* * Apr 10, 2014 2892 mpduff Clear selected items when changing data types.
*
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -93,6 +94,13 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
*/ */
public class FilterExpandBar extends Composite implements IFilterUpdate, public class FilterExpandBar extends Composite implements IFilterUpdate,
IExpandControlAction { IExpandControlAction {
private final String DATA_PROVIDER = "Data Provider";
private final String DATA_SET = "Data Set";
private final String PARAMETER = "Parameter";
private final String LEVEL = "Level";
/** /**
* Filter expand bar. * Filter expand bar.
@ -290,10 +298,6 @@ public class FilterExpandBar extends Composite implements IFilterUpdate,
* TODO : this needs to be reworked as this only has 4 display * TODO : this needs to be reworked as this only has 4 display
* (filters). This should be configurable. * (filters). This should be configurable.
*/ */
final String DATA_PROVIDER = "Data Provider";
final String DATA_SET = "Data Set";
final String PARAMETER = "Parameter";
final String LEVEL = "Level";
if (displayName.equals(DATA_PROVIDER)) { if (displayName.equals(DATA_PROVIDER)) {
Set<String> providerSet = dataManager Set<String> providerSet = dataManager
.getAvailableDataProvidersByType(dataType); .getAvailableDataProvidersByType(dataType);
@ -596,6 +600,13 @@ public class FilterExpandBar extends Composite implements IFilterUpdate,
this.dataType = dataType; this.dataType = dataType;
setEnvelope(envelope); setEnvelope(envelope);
disposeExpandItemsAndControls(); disposeExpandItemsAndControls();
// Clear previously selected items
if (filterSettingsXml != null) {
for (FilterTypeXML xml : this.filterSettingsXml.getFilterTypeList()) {
xml.clearValues();
}
}
if (!dataType.isEmpty()) { if (!dataType.isEmpty()) {
createExpandItems(); createExpandItems();
} }

View file

@ -30,7 +30,7 @@ import javax.xml.bind.annotation.XmlElements;
import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml; import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
/** /**
* Filter Type Definition object. * Filter Type Definition object. Stores the filter type and values.
* *
* <pre> * <pre>
* *
@ -40,6 +40,7 @@ import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 30, 2012 mpduff Initial creation. * Jan 30, 2012 mpduff Initial creation.
* Jun 04, 2013 mpduff Changed method name. * Jun 04, 2013 mpduff Changed method name.
* Apr 10, 2014 2892 mpduff Added javadoc comments and toString
* *
* </pre> * </pre>
* *
@ -49,9 +50,11 @@ import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
public class FilterTypeXML implements IDisplayXml { public class FilterTypeXML implements IDisplayXml {
/** Type of filter */
@XmlAttribute(name = "type") @XmlAttribute(name = "type")
protected String filterType; protected String filterType;
/** Selected filter values */
@XmlElements({ @XmlElement(name = "Value", type = String.class) }) @XmlElements({ @XmlElement(name = "Value", type = String.class) })
protected ArrayList<String> values = new ArrayList<String>(); protected ArrayList<String> values = new ArrayList<String>();
@ -89,6 +92,9 @@ public class FilterTypeXML implements IDisplayXml {
this.values.add(value); this.values.add(value);
} }
/**
* Clear the selected values.
*/
public void clearValues() { public void clearValues() {
this.values.clear(); this.values.clear();
} }
@ -113,4 +119,20 @@ public class FilterTypeXML implements IDisplayXml {
return sb.toString(); return sb.toString();
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.filterType).append("||");
for (String s : values) {
sb.append(s).append(" ");
}
return sb.toString();
}
} }