Search in sources :

Example 1 with EditorManager

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);
    }
}
Also used : LockedValuesVO(org.cytoscape.view.vizmap.gui.internal.model.LockedValuesVO) DefaultVisualizableVisualProperty(org.cytoscape.view.presentation.property.DefaultVisualizableVisualProperty) VisualProperty(org.cytoscape.view.model.VisualProperty) EditorManager(org.cytoscape.view.vizmap.gui.editor.EditorManager)

Example 2 with EditorManager

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);
            }
        });
    }
}
Also used : DefaultVisualizableVisualProperty(org.cytoscape.view.presentation.property.DefaultVisualizableVisualProperty) VisualProperty(org.cytoscape.view.model.VisualProperty) VisualStyle(org.cytoscape.view.vizmap.VisualStyle) EditorManager(org.cytoscape.view.vizmap.gui.editor.EditorManager) UndoSupport(org.cytoscape.work.undo.UndoSupport) AbstractCyEdit(org.cytoscape.work.undo.AbstractCyEdit)

Aggregations

VisualProperty (org.cytoscape.view.model.VisualProperty)2 DefaultVisualizableVisualProperty (org.cytoscape.view.presentation.property.DefaultVisualizableVisualProperty)2 EditorManager (org.cytoscape.view.vizmap.gui.editor.EditorManager)2 VisualStyle (org.cytoscape.view.vizmap.VisualStyle)1 LockedValuesVO (org.cytoscape.view.vizmap.gui.internal.model.LockedValuesVO)1 AbstractCyEdit (org.cytoscape.work.undo.AbstractCyEdit)1 UndoSupport (org.cytoscape.work.undo.UndoSupport)1