Search in sources :

Example 1 with LockedValuesVO

use of org.cytoscape.view.vizmap.gui.internal.model.LockedValuesVO 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 LockedValuesVO

use of org.cytoscape.view.vizmap.gui.internal.model.LockedValuesVO in project cytoscape-impl by cytoscape.

the class VizMapperMediator method removeLockedValue.

@SuppressWarnings("rawtypes")
private void removeLockedValue(final ActionEvent e, final VisualPropertySheetItem<?> vpSheetItem) {
    final VisualProperty<?> visualProperty = vpSheetItem.getModel().getVisualProperty();
    final LockedValuesVO vo = new LockedValuesVO((Set) Collections.singleton(visualProperty));
    sendNotification(NotificationNames.REMOVE_LOCKED_VALUES, vo);
}
Also used : LockedValuesVO(org.cytoscape.view.vizmap.gui.internal.model.LockedValuesVO)

Example 3 with LockedValuesVO

use of org.cytoscape.view.vizmap.gui.internal.model.LockedValuesVO in project cytoscape-impl by cytoscape.

the class RemoveLockedValuesCommand method execute.

@Override
public void execute(final INotification notification) {
    final LockedValuesVO vo = (LockedValuesVO) notification.getBody();
    final Set<VisualProperty<?>> visualProperties = vo.getVisualProperties();
    if (visualProperties == null)
        return;
    CyNetworkView netView = vo.getNetworkView();
    Set<View<? extends CyIdentifiable>> views = vo.getViews();
    final VizMapperProxy vmProxy = (VizMapperProxy) getFacade().retrieveProxy(VizMapperProxy.NAME);
    if (netView == null)
        netView = vmProxy.getCurrentNetworkView();
    if (netView != null && views == null) {
        // Get the selected views
        final Set<Class<? extends CyIdentifiable>> targetDataTypes = new HashSet<Class<? extends CyIdentifiable>>();
        for (final VisualProperty<?> vp : visualProperties) targetDataTypes.add(vp.getTargetDataType());
        views = new HashSet<View<? extends CyIdentifiable>>();
        if (targetDataTypes.contains(CyNode.class))
            views.addAll(vmProxy.getSelectedNodeViews(netView));
        if (targetDataTypes.contains(CyEdge.class))
            views.addAll(vmProxy.getSelectedEdgeViews(netView));
        if (targetDataTypes.contains(CyNetwork.class))
            views.add(netView);
    }
    if (views != null) {
        final TaskIterator iterator = new TaskIterator(new RemoveLockedValuesTask(visualProperties, views, netView, servicesUtil));
        final DialogTaskManager taskManager = servicesUtil.get(DialogTaskManager.class);
        taskManager.execute(iterator);
    }
}
Also used : DialogTaskManager(org.cytoscape.work.swing.DialogTaskManager) View(org.cytoscape.view.model.View) CyNetworkView(org.cytoscape.view.model.CyNetworkView) VizMapperProxy(org.cytoscape.view.vizmap.gui.internal.model.VizMapperProxy) RemoveLockedValuesTask(org.cytoscape.view.vizmap.gui.internal.task.RemoveLockedValuesTask) TaskIterator(org.cytoscape.work.TaskIterator) LockedValuesVO(org.cytoscape.view.vizmap.gui.internal.model.LockedValuesVO) VisualProperty(org.cytoscape.view.model.VisualProperty) CyNetworkView(org.cytoscape.view.model.CyNetworkView) CyIdentifiable(org.cytoscape.model.CyIdentifiable) HashSet(java.util.HashSet)

Example 4 with LockedValuesVO

use of org.cytoscape.view.vizmap.gui.internal.model.LockedValuesVO in project cytoscape-impl by cytoscape.

the class SetLockedValuesCommand method execute.

@Override
public void execute(final INotification notification) {
    final LockedValuesVO vo = (LockedValuesVO) notification.getBody();
    final Map<VisualProperty<?>, Object> values = vo.getValues();
    if (values == null)
        return;
    CyNetworkView netView = vo.getNetworkView();
    Set<View<? extends CyIdentifiable>> views = vo.getViews();
    final VizMapperProxy vmProxy = (VizMapperProxy) getFacade().retrieveProxy(VizMapperProxy.NAME);
    if (netView == null)
        netView = vmProxy.getCurrentNetworkView();
    if (netView != null && views == null) {
        // Get the selected views
        final Set<Class<? extends CyIdentifiable>> targetDataTypes = new HashSet<Class<? extends CyIdentifiable>>();
        for (final VisualProperty<?> vp : values.keySet()) targetDataTypes.add(vp.getTargetDataType());
        views = new HashSet<View<? extends CyIdentifiable>>();
        if (targetDataTypes.contains(CyNode.class))
            views.addAll(vmProxy.getSelectedNodeViews(netView));
        if (targetDataTypes.contains(CyEdge.class))
            views.addAll(vmProxy.getSelectedEdgeViews(netView));
        if (targetDataTypes.contains(CyNetwork.class))
            views.add(netView);
    }
    if (views != null) {
        final TaskIterator iterator = new TaskIterator(new SetLockedValuesTask(values, views, netView, servicesUtil));
        final DialogTaskManager taskManager = servicesUtil.get(DialogTaskManager.class);
        taskManager.execute(iterator);
    }
}
Also used : SetLockedValuesTask(org.cytoscape.view.vizmap.gui.internal.task.SetLockedValuesTask) DialogTaskManager(org.cytoscape.work.swing.DialogTaskManager) View(org.cytoscape.view.model.View) CyNetworkView(org.cytoscape.view.model.CyNetworkView) VizMapperProxy(org.cytoscape.view.vizmap.gui.internal.model.VizMapperProxy) TaskIterator(org.cytoscape.work.TaskIterator) LockedValuesVO(org.cytoscape.view.vizmap.gui.internal.model.LockedValuesVO) VisualProperty(org.cytoscape.view.model.VisualProperty) CyNetworkView(org.cytoscape.view.model.CyNetworkView) CyIdentifiable(org.cytoscape.model.CyIdentifiable) HashSet(java.util.HashSet)

Aggregations

LockedValuesVO (org.cytoscape.view.vizmap.gui.internal.model.LockedValuesVO)4 VisualProperty (org.cytoscape.view.model.VisualProperty)3 HashSet (java.util.HashSet)2 CyIdentifiable (org.cytoscape.model.CyIdentifiable)2 CyNetworkView (org.cytoscape.view.model.CyNetworkView)2 View (org.cytoscape.view.model.View)2 VizMapperProxy (org.cytoscape.view.vizmap.gui.internal.model.VizMapperProxy)2 TaskIterator (org.cytoscape.work.TaskIterator)2 DialogTaskManager (org.cytoscape.work.swing.DialogTaskManager)2 DefaultVisualizableVisualProperty (org.cytoscape.view.presentation.property.DefaultVisualizableVisualProperty)1 EditorManager (org.cytoscape.view.vizmap.gui.editor.EditorManager)1 RemoveLockedValuesTask (org.cytoscape.view.vizmap.gui.internal.task.RemoveLockedValuesTask)1 SetLockedValuesTask (org.cytoscape.view.vizmap.gui.internal.task.SetLockedValuesTask)1