Merge "Issue #2892 - Fix problems loading saved configs for data browser dialog." into development

Former-commit-id: 1a3738c8fd [formerly f6601d6bcc] [formerly d4a6ce546d [formerly 96361fa3cd86627ef633c5421a2434c930c3b85c]]
Former-commit-id: d4a6ce546d
Former-commit-id: caf31402d7
This commit is contained in:
Lee Venable 2014-04-14 14:09:03 -05:00 committed by Gerrit Code Review
commit bf4f3c75ef
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 2413 mpduff Added isDirty check to New Configuration menu selection.
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Apr 10, 2014 2892 mpduff Fix problems with loading of saved configs.
*
* </pre>
*
@ -371,7 +372,6 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
@Override
public void widgetSelected(SelectionEvent event) {
displayLoadSaveConfigDlg(DialogType.OPEN);
setClean();
}
});
@ -970,7 +970,6 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
"Selection Required",
"Must make a selection before saving.");
}
} else if (type == DialogType.OPEN) {
setText(WINDOW_TITLE + " - ("
+ locFile.getFile().getName() + ")");
@ -978,7 +977,7 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
xml = fm.getXml();
updateFilters();
selectedFile = locFile.getFile().getName();
setClean();
} else if (type == DialogType.DELETE) {
try {
if (locFile != null) {
@ -1070,9 +1069,9 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
int i = 0;
for (String s : dataTypes) {
if (s.equals(valueList.get(0))) {
i++;
break;
}
i++;
}
datatypeList.select(i);
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 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.
*
* Apr 10, 2014 2892 mpduff Clear selected items when changing data types.
*
* </pre>
*
* @author lvenable
@ -93,6 +94,13 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
*/
public class FilterExpandBar extends Composite implements IFilterUpdate,
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.
@ -290,10 +298,6 @@ public class FilterExpandBar extends Composite implements IFilterUpdate,
* TODO : this needs to be reworked as this only has 4 display
* (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)) {
Set<String> providerSet = dataManager
.getAvailableDataProvidersByType(dataType);
@ -596,6 +600,13 @@ public class FilterExpandBar extends Composite implements IFilterUpdate,
this.dataType = dataType;
setEnvelope(envelope);
disposeExpandItemsAndControls();
// Clear previously selected items
if (filterSettingsXml != null) {
for (FilterTypeXML xml : this.filterSettingsXml.getFilterTypeList()) {
xml.clearValues();
}
}
if (!dataType.isEmpty()) {
createExpandItems();
}

View file

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