Combo variableCombo = new Combo(parent, SWT.READ_ONLY);
variableCombo.setItems(arrowContributions.keySet().toArray(new String[arrowContributions.size()]));
- addSelectionListener(variableCombo);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(variableCombo);
Button defaultButton = new Button(parent, SWT.CHECK);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(defaultButton);
- addSelectionListener(defaultButton);
defaultButton.addSelectionListener(new SelectionAdapter() {
@Override
}
}
});
+ addSelectionListener(defaultButton);
variableCombo.addSelectionListener(new SelectionAdapter() {
defaultButton.setSelection(true);
}
});
+ addSelectionListener(variableCombo);
arrowRows.put(object.getArrowObject().getName(), new ArrowObjectRow(label, usedButton, variableCombo, gainText, biasText, defaultButton));
Combo variableCombo = new Combo(parent, SWT.READ_ONLY);
variableCombo.setItems(colorContributions.keySet().toArray(new String[colorContributions.size()]));
- addSelectionListener(variableCombo);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(variableCombo);
Button defaultButton = new Button(parent, SWT.CHECK);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(defaultButton);
- addSelectionListener(defaultButton);
defaultButton.addSelectionListener(new SelectionAdapter() {
@Override
}
}
});
+ addSelectionListener(defaultButton);
variableCombo.addSelectionListener(new SelectionAdapter() {
}
}
});
+ addSelectionListener(variableCombo);
coloringRows.put(object.getColoringObject().getName(), new ColoringObjectRow(label, usedButton, variableCombo, minText, maxText, unit, colorMapCombo, defaultButton));
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;
Combo variableCombo = new Combo(parent, SWT.READ_ONLY);
variableCombo.setItems(sizeContributions.keySet().toArray(new String[sizeContributions.size()]));
- addSelectionListener(variableCombo);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(variableCombo);
Button defaultButton = new Button(parent, SWT.CHECK);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(defaultButton);
- addSelectionListener(defaultButton);
defaultButton.addSelectionListener(new SelectionAdapter() {
@Override
}
}
});
+ addSelectionListener(defaultButton);
variableCombo.addSelectionListener(new SelectionAdapter() {
defaultButton.setSelection(true);
}
});
+ addSelectionListener(variableCombo);
sizingRows.put(object.getSizingObject().getName(), new SizingObjectRow(label, usedButton, variableCombo, minText, maxText, unit, sizeMapCombo, defaultButton));
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;