String key = variableCombo.getItem(selectionIndex);
DynamicColorContribution cont = colorContributions.get(key);
if (cont != null) {
- String colorMap = colorMapCombo.getItem(colorMapCombo.getSelectionIndex());
- try {
- Map<String, DynamicColorMap> colorMaps = Simantics.getSession().syncRequest(new UniqueRead<Map<String, DynamicColorMap>>() {
-
- @Override
- public Map<String, DynamicColorMap> perform(ReadGraph graph) throws DatabaseException {
- return DynamicVisualisationsContributions.dynamicColorMaps(graph);
- }
- });
+
+ String label = variableCombo.getItem(variableCombo.getSelectionIndex());
+ DynamicColorContribution dcc;
+ if (colorMapCombo.getSelectionIndex() > -1) {
+ String colorMap = colorMapCombo.getItem(colorMapCombo.getSelectionIndex());
DynamicColorMap dColorMap = colorMaps.get(colorMap);
- String label = variableCombo.getItem(variableCombo.getSelectionIndex());
-
- DynamicColorContribution dcc = new DynamicColorContribution(label, cont.getModuleName(), cont.getAttributeName(), unit.getText(), cont.getVariableGain(), cont.getVariableBias(), dColorMap, Double.parseDouble(minText.getText()), Double.parseDouble(maxText.getText()));
- dcc.setUsed(usedButton.getSelection());
- dcc.setUseDefault(defaultButton.getSelection());
-
- return Pair.make(object.getColoringObject().getName(), dcc);
- } catch (DatabaseException e) {
- LOGGER.error("Could not get DynamicColorContribution", e);
+ dcc = new DynamicColorContribution(label, cont.getModuleName(), cont.getAttributeName(), unit.getText(), cont.getVariableGain(), cont.getVariableBias(), dColorMap, Double.parseDouble(minText.getText()), Double.parseDouble(maxText.getText()));
+ } else {
+ dcc = colorContributions.get(label);
}
+ dcc.setUsed(usedButton.getSelection());
+ dcc.setUseDefault(defaultButton.getSelection());
+
+ return Pair.make(object.getColoringObject().getName(), dcc);
}
}
return null;
String key = variableCombo.getItem(selectionIndex);
DynamicSizeContribution cont = sizeContributions.get(key);
if (cont != null) {
- String sizeMap = sizeMapCombo.getItem(sizeMapCombo.getSelectionIndex());
- try {
- Map<String, DynamicSizeMap> sizeMaps = Simantics.getSession().syncRequest(new UniqueRead<Map<String, DynamicSizeMap>>() {
-
- @Override
- public Map<String, DynamicSizeMap> perform(ReadGraph graph) throws DatabaseException {
- return DynamicVisualisationsContributions.dynamicSizeMaps(graph);
- }
- });
- DynamicSizeMap dColorMap = sizeMaps.get(sizeMap);
- String label = variableCombo.getItem(variableCombo.getSelectionIndex());
-
- DynamicSizeContribution dsc = new DynamicSizeContribution(label, cont.getModuleName(), cont.getAttributeName(), unit.getText(), cont.getVariableGain(), cont.getVariableBias(), dColorMap, Double.parseDouble(minText.getText()), Double.parseDouble(maxText.getText()));
- dsc.setUsed(usedButton.getSelection());
- dsc.setUseDefault(defaultButton.getSelection());
-
- return Pair.make(object.getSizingObject().getName(), dsc);
- } catch (DatabaseException e) {
- LOGGER.error("Could not get DynamicColorContribution", e);
+
+ String label = variableCombo.getItem(variableCombo.getSelectionIndex());
+ DynamicSizeContribution dsc;
+ if (sizeMapCombo.getSelectionIndex() > -1) {
+ String sizeMap = sizeMapCombo.getItem(sizeMapCombo.getSelectionIndex());
+ DynamicSizeMap dSizeMap = sizeMaps.get(sizeMap);
+ dsc = new DynamicSizeContribution(label, cont.getModuleName(), cont.getAttributeName(), unit.getText(), cont.getVariableGain(), cont.getVariableBias(), dSizeMap, Double.parseDouble(minText.getText()), Double.parseDouble(maxText.getText()));
+ } else {
+ dsc = sizeContributions.get(label);
}
+ dsc.setUsed(usedButton.getSelection());
+ dsc.setUseDefault(defaultButton.getSelection());
+
+ return Pair.make(object.getSizingObject().getName(), dsc);
}
}
return null;