use of org.cytoscape.view.vizmap.gui.editor.EditorManager in project cytoscape-impl by cytoscape.
the class VizMapperMediator method openLockedValueEditor.
@SuppressWarnings("rawtypes")
private void openLockedValueEditor(final ActionEvent evt, final VisualPropertySheetItem vpSheetItem) {
final VisualPropertySheetItemModel model = vpSheetItem.getModel();
final VisualProperty vp = model.getVisualProperty();
final Object curValue = model.getLockedValue();
Object newValue = null;
try {
final EditorManager editorMgr = servicesUtil.get(EditorManager.class);
newValue = editorMgr.showVisualPropertyValueEditor(vizMapperMainPanel, vp, curValue);
} catch (Exception ex) {
// logger.error("Error opening Visual Property values editor for: " + vp, ex);
}
if (newValue != null && !newValue.equals(curValue)) {
final LockedValuesVO vo = new LockedValuesVO((Map) Collections.singletonMap(vp, newValue));
sendNotification(NotificationNames.SET_LOCKED_VALUES, vo);
}
}
use of org.cytoscape.view.vizmap.gui.editor.EditorManager in project cytoscape-impl by cytoscape.
the class VizMapperMediator method openDefaultValueEditor.
@SuppressWarnings("rawtypes")
private void openDefaultValueEditor(final ActionEvent evt, final VisualPropertySheetItem vpSheetItem) {
final VisualPropertySheetItemModel model = vpSheetItem.getModel();
final VisualProperty vp = model.getVisualProperty();
final VisualStyle style = vmProxy.getCurrentVisualStyle();
final Object oldValue = style.getDefaultValue(vp);
Object val = null;
try {
final EditorManager editorMgr = servicesUtil.get(EditorManager.class);
val = editorMgr.showVisualPropertyValueEditor(vizMapperMainPanel, vp, oldValue);
} catch (final Exception ex) {
logger.error("Error opening Visual Property values editor for: " + vp, ex);
}
final Object newValue = val;
if (newValue != null && !newValue.equals(oldValue)) {
style.setDefaultValue(vp, newValue);
// Undo support
final UndoSupport undo = servicesUtil.get(UndoSupport.class);
undo.postEdit(new AbstractCyEdit("Set Default Value") {
@Override
public void undo() {
style.setDefaultValue(vp, oldValue);
}
@Override
public void redo() {
style.setDefaultValue(vp, newValue);
}
});
}
}
Aggregations