Search in sources :

Example 1 with ContinuousMappingCellRendererFactory

use of org.cytoscape.view.vizmap.gui.editor.ContinuousMappingCellRendererFactory in project cytoscape-impl by cytoscape.

the class CyActivator method start.

@Override
public void start(BundleContext context) throws Exception {
    ContinuousMappingCellRendererFactory factory = new ContinuousMappingCellRendererFactoryImpl();
    registerService(context, factory, ContinuousMappingCellRendererFactory.class);
}
Also used : ContinuousMappingCellRendererFactoryImpl(org.cytoscape.view.vizmap.gui.core.internal.cellrenderer.ContinuousMappingCellRendererFactoryImpl) ContinuousMappingCellRendererFactory(org.cytoscape.view.vizmap.gui.editor.ContinuousMappingCellRendererFactory)

Example 2 with ContinuousMappingCellRendererFactory

use of org.cytoscape.view.vizmap.gui.editor.ContinuousMappingCellRendererFactory in project cytoscape-impl by cytoscape.

the class EditorManagerImpl method buildDiscreteEditors.

@SuppressWarnings({ "unchecked", "rawtypes" })
private <V> void buildDiscreteEditors(final VisualLexicon lexicon) {
    final Set<VisualProperty> vps = (Set) lexicon.getAllVisualProperties();
    for (final VisualProperty<V> vp : vps) {
        final Range<?> range = vp.getRange();
        // If data type is basic (String, Boolean, etc.), custom editor is not necessary.
        final Class<?> targetDataType = range.getType();
        synchronized (mutex) {
            if (REGISTRY.getEditor(targetDataType) != null)
                continue;
            if (this.getVisualPropertyEditor(vp) != null)
                continue;
            if (range instanceof DiscreteRange<?>) {
                DiscreteValueEditor<?> valEditor = (DiscreteValueEditor) getVisualPropertyValueEditor(vp);
                if (valEditor == null) {
                    valEditor = new DiscreteValueEditor(range.getType(), ((DiscreteRange) range).values(), servicesUtil);
                    this.addVisualPropertyValueEditor(valEditor, null);
                }
                final CyDiscreteValuePropertyEditor<?> discretePropEditor = new CyDiscreteValuePropertyEditor(valEditor);
                final Set values = ((DiscreteRange) range).values();
                // FIXME how can we manage the custom icon size based on value type?
                Integer width = ICON_WIDTH_MAP.get(range.getType());
                if (width == null)
                    width = ICON_W;
                final ContinuousMappingCellRendererFactory cellRendererFactory = servicesUtil.get(ContinuousMappingCellRendererFactory.class);
                final VisualPropertyEditor<?> vpEditor = new DiscreteValueVisualPropertyEditor(range.getType(), discretePropEditor, cellRendererFactory, values, width, ICON_H);
                this.addVisualPropertyEditor(vpEditor, null);
                servicesUtil.registerService(vpEditor, SetCurrentRenderingEngineListener.class, new Properties());
            }
        }
    }
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) Properties(java.util.Properties) ContinuousMappingCellRendererFactory(org.cytoscape.view.vizmap.gui.editor.ContinuousMappingCellRendererFactory) DiscreteValueEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.valueeditor.DiscreteValueEditor) CyDiscreteValuePropertyEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.propertyeditor.CyDiscreteValuePropertyEditor) VisualProperty(org.cytoscape.view.model.VisualProperty) DiscreteRange(org.cytoscape.view.model.DiscreteRange)

Example 3 with ContinuousMappingCellRendererFactory

use of org.cytoscape.view.vizmap.gui.editor.ContinuousMappingCellRendererFactory in project cytoscape-impl by cytoscape.

the class CyActivator method startPresentationImpl.

private void startPresentationImpl(final BundleContext bc, final CyServiceRegistrar serviceRegistrar) {
    DVisualLexicon dVisualLexicon = new DVisualLexicon(cgManager);
    NVLTFActionSupport nvltfActionSupport = new NVLTFActionSupport(serviceRegistrar);
    ViewTaskFactoryListener vtfListener = new ViewTaskFactoryListener(nvltfActionSupport);
    AnnotationFactoryManager annotationFactoryManager = new AnnotationFactoryManager();
    AnnotationManager annotationManager = new AnnotationManagerImpl(serviceRegistrar);
    DingGraphLOD dingGraphLOD = new DingGraphLOD(serviceRegistrar);
    registerService(bc, dingGraphLOD, PropertyUpdatedListener.class, new Properties());
    DingGraphLODAll dingGraphLODAll = new DingGraphLODAll();
    HandleFactory handleFactory = new HandleFactoryImpl();
    registerService(bc, handleFactory, HandleFactory.class, new Properties());
    DingRenderingEngineFactory dingRenderingEngineFactory = new DingRenderingEngineFactory(dVisualLexicon, vtfListener, annotationFactoryManager, dingGraphLOD, handleFactory, serviceRegistrar);
    DingNavigationRenderingEngineFactory dingNavigationRenderingEngineFactory = new DingNavigationRenderingEngineFactory(serviceRegistrar, dVisualLexicon);
    DingRenderingEngineFactory dingVisualStyleRenderingEngineFactory = new DingVisualStyleRenderingEngineFactory(dVisualLexicon, vtfListener, annotationFactoryManager, dingGraphLOD, handleFactory, serviceRegistrar);
    DingThumbnailRenderingEngineFactory dingThumbnailRenderingEngineFactory = new DingThumbnailRenderingEngineFactory(dVisualLexicon, serviceRegistrar);
    AddEdgeNodeViewTaskFactoryImpl addEdgeNodeViewTaskFactory = new AddEdgeNodeViewTaskFactoryImpl(serviceRegistrar);
    ContinuousMappingCellRendererFactory continuousMappingCellRendererFactory = getService(bc, ContinuousMappingCellRendererFactory.class);
    // Object Position Editor
    ObjectPositionValueEditor objectPositionValueEditor = new ObjectPositionValueEditor();
    ObjectPositionEditor objectPositionEditor = new ObjectPositionEditor(objectPositionValueEditor, continuousMappingCellRendererFactory, serviceRegistrar);
    DingViewModelFactory dingNetworkViewFactory = new DingViewModelFactory(dVisualLexicon, vtfListener, annotationFactoryManager, dingGraphLOD, handleFactory, serviceRegistrar);
    DingRenderer renderer = DingRenderer.getInstance();
    renderer.registerNetworkViewFactory(dingNetworkViewFactory);
    renderer.registerRenderingEngineFactory(NetworkViewRenderer.DEFAULT_CONTEXT, dingRenderingEngineFactory);
    renderer.registerRenderingEngineFactory(NetworkViewRenderer.BIRDS_EYE_CONTEXT, dingNavigationRenderingEngineFactory);
    renderer.registerRenderingEngineFactory(NetworkViewRenderer.VISUAL_STYLE_PREVIEW_CONTEXT, dingVisualStyleRenderingEngineFactory);
    renderer.registerRenderingEngineFactory(NetworkViewRenderer.THUMBNAIL_CONTEXT, dingThumbnailRenderingEngineFactory);
    registerService(bc, renderer, NetworkViewRenderer.class, new Properties());
    // Edge Bend editor
    EdgeBendValueEditor edgeBendValueEditor = new EdgeBendValueEditor(dingNetworkViewFactory, dingRenderingEngineFactory, serviceRegistrar);
    EdgeBendEditor edgeBendEditor = new EdgeBendEditor(edgeBendValueEditor, continuousMappingCellRendererFactory, serviceRegistrar);
    Properties dingRenderingEngineFactoryProps = new Properties();
    dingRenderingEngineFactoryProps.setProperty(ID, "ding");
    registerAllServices(bc, dingRenderingEngineFactory, dingRenderingEngineFactoryProps);
    Properties dingNavigationRenderingEngineFactoryProps = new Properties();
    dingNavigationRenderingEngineFactoryProps.setProperty(ID, "dingNavigation");
    registerAllServices(bc, dingNavigationRenderingEngineFactory, dingNavigationRenderingEngineFactoryProps);
    Properties addEdgeNodeViewTaskFactoryProps = new Properties();
    addEdgeNodeViewTaskFactoryProps.setProperty(PREFERRED_ACTION, "Edge");
    addEdgeNodeViewTaskFactoryProps.setProperty(PREFERRED_MENU, NODE_ADD_MENU);
    addEdgeNodeViewTaskFactoryProps.setProperty(TITLE, "Edge");
    addEdgeNodeViewTaskFactoryProps.setProperty(MENU_GRAVITY, "0.1");
    registerService(bc, addEdgeNodeViewTaskFactory, NodeViewTaskFactory.class, addEdgeNodeViewTaskFactoryProps);
    Properties dVisualLexiconProps = new Properties();
    dVisualLexiconProps.setProperty(ID, "ding");
    registerService(bc, dVisualLexicon, VisualLexicon.class, dVisualLexiconProps);
    final Properties positionEditorProp = new Properties();
    positionEditorProp.setProperty(ID, "objectPositionValueEditor");
    registerService(bc, objectPositionValueEditor, ValueEditor.class, positionEditorProp);
    final Properties objectPositionEditorProp = new Properties();
    objectPositionEditorProp.setProperty(ID, "objectPositionEditor");
    registerService(bc, objectPositionEditor, VisualPropertyEditor.class, objectPositionEditorProp);
    registerAllServices(bc, edgeBendValueEditor, new Properties());
    registerService(bc, edgeBendEditor, VisualPropertyEditor.class, new Properties());
    Properties dingNetworkViewFactoryServiceProps = new Properties();
    registerService(bc, dingNetworkViewFactory, CyNetworkViewFactory.class, dingNetworkViewFactoryServiceProps);
    // Annotations
    registerServiceListener(bc, annotationFactoryManager::addAnnotationFactory, annotationFactoryManager::removeAnnotationFactory, AnnotationFactory.class);
    registerService(bc, annotationManager, AnnotationManager.class, new Properties());
    // Arrow
    AnnotationFactory<?> arrowAnnotationFactory = new ArrowAnnotationFactory(serviceRegistrar);
    Properties arrowFactory = new Properties();
    arrowFactory.setProperty("type", "ArrowAnnotation.class");
    registerService(bc, arrowAnnotationFactory, AnnotationFactory.class, arrowFactory);
    AddArrowTaskFactory addArrowTaskFactory = new AddArrowTaskFactory(arrowAnnotationFactory);
    Properties addArrowTaskFactoryProps = new Properties();
    addArrowTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    addArrowTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_ADD_MENU);
    addArrowTaskFactoryProps.setProperty(MENU_GRAVITY, "1.2");
    addArrowTaskFactoryProps.setProperty(TITLE, "Arrow Annotation");
    registerService(bc, addArrowTaskFactory, NetworkViewLocationTaskFactory.class, addArrowTaskFactoryProps);
    // Image annotation
    AnnotationFactory<?> imageAnnotationFactory = new ImageAnnotationFactory(serviceRegistrar);
    Properties imageFactory = new Properties();
    imageFactory.setProperty("type", "ImageAnnotation.class");
    registerService(bc, imageAnnotationFactory, AnnotationFactory.class, imageFactory);
    AddAnnotationTaskFactory addImageTaskFactory = new AddAnnotationTaskFactory(imageAnnotationFactory);
    Properties addImageTaskFactoryProps = new Properties();
    addImageTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    addImageTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_ADD_MENU);
    addImageTaskFactoryProps.setProperty(MENU_GRAVITY, "1.3");
    addImageTaskFactoryProps.setProperty(TITLE, "Image Annotation");
    registerService(bc, addImageTaskFactory, NetworkViewLocationTaskFactory.class, addImageTaskFactoryProps);
    // Shape annotation
    AnnotationFactory<?> shapeAnnotationFactory = new ShapeAnnotationFactory(serviceRegistrar);
    Properties shapeFactory = new Properties();
    shapeFactory.setProperty("type", "ShapeAnnotation.class");
    registerService(bc, shapeAnnotationFactory, AnnotationFactory.class, shapeFactory);
    AddAnnotationTaskFactory addShapeTaskFactory = new AddAnnotationTaskFactory(shapeAnnotationFactory);
    Properties addShapeTaskFactoryProps = new Properties();
    addShapeTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    addShapeTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_ADD_MENU);
    addShapeTaskFactoryProps.setProperty(MENU_GRAVITY, "1.4");
    addShapeTaskFactoryProps.setProperty(TITLE, "Shape Annotation");
    registerService(bc, addShapeTaskFactory, NetworkViewLocationTaskFactory.class, addShapeTaskFactoryProps);
    // Text annotation
    AnnotationFactory<?> textAnnotationFactory = new TextAnnotationFactory(serviceRegistrar);
    Properties textFactory = new Properties();
    textFactory.setProperty("type", "TextAnnotation.class");
    registerService(bc, textAnnotationFactory, AnnotationFactory.class, textFactory);
    AddAnnotationTaskFactory addTextTaskFactory = new AddAnnotationTaskFactory(textAnnotationFactory);
    Properties addTextTaskFactoryProps = new Properties();
    addTextTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    addTextTaskFactoryProps.setProperty(MENU_GRAVITY, "1.5");
    addTextTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_ADD_MENU);
    addTextTaskFactoryProps.setProperty(TITLE, "Text Annotation");
    registerService(bc, addTextTaskFactory, NetworkViewLocationTaskFactory.class, addTextTaskFactoryProps);
    // Bounded Text annotation
    AnnotationFactory<?> boundedAnnotationFactory = new BoundedTextAnnotationFactory(serviceRegistrar);
    Properties boundedFactory = new Properties();
    boundedFactory.setProperty("type", "BoundedTextAnnotation.class");
    registerService(bc, boundedAnnotationFactory, AnnotationFactory.class, boundedFactory);
    AddAnnotationTaskFactory addBoundedTextTaskFactory = new AddAnnotationTaskFactory(boundedAnnotationFactory);
    Properties addBoundedTextTaskFactoryProps = new Properties();
    addBoundedTextTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    addBoundedTextTaskFactoryProps.setProperty(MENU_GRAVITY, "1.6");
    addBoundedTextTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_ADD_MENU);
    addBoundedTextTaskFactoryProps.setProperty(TITLE, "Bounded Text Annotation");
    registerService(bc, addBoundedTextTaskFactory, NetworkViewLocationTaskFactory.class, addBoundedTextTaskFactoryProps);
    AnnotationFactory<?> groupAnnotationFactory = new GroupAnnotationFactory(serviceRegistrar);
    Properties groupFactory = new Properties();
    groupFactory.setProperty("type", "GroupAnnotation.class");
    registerService(bc, groupAnnotationFactory, AnnotationFactory.class, groupFactory);
    // Annotation edit
    EditAnnotationTaskFactory editAnnotationTaskFactory = new EditAnnotationTaskFactory();
    Properties editAnnotationTaskFactoryProps = new Properties();
    editAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    editAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "2.0");
    editAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_EDIT_MENU);
    editAnnotationTaskFactoryProps.setProperty(TITLE, "Modify Annotation");
    registerService(bc, editAnnotationTaskFactory, NetworkViewLocationTaskFactory.class, editAnnotationTaskFactoryProps);
    MoveAnnotationTaskFactory moveAnnotationTaskFactory = new MoveAnnotationTaskFactory();
    Properties moveAnnotationTaskFactoryProps = new Properties();
    moveAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    moveAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "2.1");
    moveAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_EDIT_MENU);
    moveAnnotationTaskFactoryProps.setProperty(TITLE, "Move Annotation");
    registerService(bc, moveAnnotationTaskFactory, NetworkViewLocationTaskFactory.class, moveAnnotationTaskFactoryProps);
    LayerAnnotationTaskFactory moveTFAnnotationTaskFactory = new LayerAnnotationTaskFactory(-10000);
    Properties moveTFAnnotationTaskFactoryProps = new Properties();
    moveTFAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    moveTFAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "3.1");
    moveTFAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_EDIT_MENU + ".Reorder Annotations[2.2]");
    moveTFAnnotationTaskFactoryProps.setProperty(TITLE, "Move Annotation To Front");
    registerService(bc, moveTFAnnotationTaskFactory, NetworkViewLocationTaskFactory.class, moveTFAnnotationTaskFactoryProps);
    LayerAnnotationTaskFactory moveFAnnotationTaskFactory = new LayerAnnotationTaskFactory(-1);
    Properties moveFAnnotationTaskFactoryProps = new Properties();
    moveFAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    moveFAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "3.2");
    moveFAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_EDIT_MENU + ".Reorder Annotations[2.2]");
    moveFAnnotationTaskFactoryProps.setProperty(TITLE, "Move Annotation Forwards");
    registerService(bc, moveFAnnotationTaskFactory, NetworkViewLocationTaskFactory.class, moveFAnnotationTaskFactoryProps);
    LayerAnnotationTaskFactory moveBAnnotationTaskFactory = new LayerAnnotationTaskFactory(1);
    Properties moveBAnnotationTaskFactoryProps = new Properties();
    moveBAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    moveBAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "3.3");
    moveBAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_EDIT_MENU + ".Reorder Annotations[2.2]");
    moveBAnnotationTaskFactoryProps.setProperty(TITLE, "Move Annotation Backwards");
    registerService(bc, moveBAnnotationTaskFactory, NetworkViewLocationTaskFactory.class, moveBAnnotationTaskFactoryProps);
    LayerAnnotationTaskFactory moveTBAnnotationTaskFactory = new LayerAnnotationTaskFactory(10000);
    Properties moveTBAnnotationTaskFactoryProps = new Properties();
    moveTBAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    moveTBAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "3.4");
    moveTBAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_EDIT_MENU + ".Reorder Annotations[2.2]");
    moveTBAnnotationTaskFactoryProps.setProperty(TITLE, "Move Annotation To Back");
    moveTBAnnotationTaskFactoryProps.setProperty(INSERT_SEPARATOR_AFTER, "true");
    registerService(bc, moveTBAnnotationTaskFactory, NetworkViewLocationTaskFactory.class, moveTBAnnotationTaskFactoryProps);
    ChangeAnnotationCanvasTaskFactory pullAnnotationTaskFactory = new ChangeAnnotationCanvasTaskFactory(Annotation.FOREGROUND);
    Properties pullAnnotationTaskFactoryProps = new Properties();
    pullAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    pullAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "3.5");
    pullAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_EDIT_MENU + ".Reorder Annotations[2.2]");
    pullAnnotationTaskFactoryProps.setProperty(TITLE, "Pull Annotation to Foreground Canvas");
    registerService(bc, pullAnnotationTaskFactory, NetworkViewLocationTaskFactory.class, pullAnnotationTaskFactoryProps);
    ChangeAnnotationCanvasTaskFactory pushAnnotationTaskFactory = new ChangeAnnotationCanvasTaskFactory(Annotation.BACKGROUND);
    Properties pushAnnotationTaskFactoryProps = new Properties();
    pushAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    pushAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "3.6");
    pushAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_EDIT_MENU + ".Reorder Annotations[2.2]");
    pushAnnotationTaskFactoryProps.setProperty(TITLE, "Push Annotation to Background Canvas");
    registerService(bc, pushAnnotationTaskFactory, NetworkViewLocationTaskFactory.class, pushAnnotationTaskFactoryProps);
    ResizeAnnotationTaskFactory resizeAnnotationTaskFactory = new ResizeAnnotationTaskFactory();
    Properties resizeAnnotationTaskFactoryProps = new Properties();
    resizeAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    resizeAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "2.3");
    resizeAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_EDIT_MENU);
    resizeAnnotationTaskFactoryProps.setProperty(TITLE, "Resize Annotation");
    registerService(bc, resizeAnnotationTaskFactory, NetworkViewLocationTaskFactory.class, resizeAnnotationTaskFactoryProps);
    // Annotation delete
    RemoveAnnotationTaskFactory removeAnnotationTaskFactory = new RemoveAnnotationTaskFactory();
    Properties removeAnnotationTaskFactoryProps = new Properties();
    removeAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    removeAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "1.1");
    removeAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_DELETE_MENU);
    removeAnnotationTaskFactoryProps.setProperty(TITLE, "Annotation");
    registerService(bc, removeAnnotationTaskFactory, NetworkViewLocationTaskFactory.class, removeAnnotationTaskFactoryProps);
    // Annotation select
    SelectAnnotationTaskFactory selectAnnotationTaskFactory = new SelectAnnotationTaskFactory();
    Properties selectAnnotationTaskFactoryProps = new Properties();
    selectAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    selectAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "1.1");
    selectAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_SELECT_MENU);
    selectAnnotationTaskFactoryProps.setProperty(TITLE, "Select/Unselect Annotation");
    registerService(bc, selectAnnotationTaskFactory, NetworkViewLocationTaskFactory.class, selectAnnotationTaskFactoryProps);
    // Annotation group
    GroupAnnotationsTaskFactory groupAnnotationTaskFactory = new GroupAnnotationsTaskFactory();
    Properties groupAnnotationTaskFactoryProps = new Properties();
    groupAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    groupAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "100");
    groupAnnotationTaskFactoryProps.setProperty(INSERT_SEPARATOR_BEFORE, "true");
    groupAnnotationTaskFactoryProps.setProperty(IN_MENU_BAR, "false");
    groupAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_GROUP_MENU);
    groupAnnotationTaskFactoryProps.setProperty(TITLE, "Group Annotations");
    registerService(bc, groupAnnotationTaskFactory, NetworkViewTaskFactory.class, groupAnnotationTaskFactoryProps);
    // Annotation ungroup
    UngroupAnnotationsTaskFactory ungroupAnnotationTaskFactory = new UngroupAnnotationsTaskFactory();
    Properties ungroupAnnotationTaskFactoryProps = new Properties();
    ungroupAnnotationTaskFactoryProps.setProperty(PREFERRED_ACTION, "NEW");
    ungroupAnnotationTaskFactoryProps.setProperty(MENU_GRAVITY, "100");
    ungroupAnnotationTaskFactoryProps.setProperty(INSERT_SEPARATOR_BEFORE, "true");
    ungroupAnnotationTaskFactoryProps.setProperty(PREFERRED_MENU, NETWORK_GROUP_MENU);
    ungroupAnnotationTaskFactoryProps.setProperty(TITLE, "Ungroup Annotations");
    registerService(bc, ungroupAnnotationTaskFactory, NetworkViewLocationTaskFactory.class, ungroupAnnotationTaskFactoryProps);
    // Set mouse drag selection modes
    SelectModeAction selectNodesOnlyAction = new SelectModeAction(SelectModeAction.NODES, 0.5f, serviceRegistrar);
    registerAllServices(bc, selectNodesOnlyAction, new Properties());
    SelectModeAction selectEdgesOnlyAction = new SelectModeAction(SelectModeAction.EDGES, 0.6f, serviceRegistrar);
    registerAllServices(bc, selectEdgesOnlyAction, new Properties());
    SelectModeAction selectNodesAndEdgesAction = new SelectModeAction(SelectModeAction.ALL, 0.7f, serviceRegistrar);
    registerAllServices(bc, selectNodesAndEdgesAction, new Properties());
    {
        // Toggle Graphics Details
        ShowGraphicsDetailsTaskFactory factory = new ShowGraphicsDetailsTaskFactory(dingGraphLOD, dingGraphLODAll);
        Properties props = new Properties();
        props.setProperty(ID, "showGraphicsDetailsTaskFactory");
        // Used at least by cyREST
        registerService(bc, factory, NetworkViewTaskFactory.class, props);
        // Main menu
        GraphicsDetailAction mainMenuAction = new GraphicsDetailAction(5.0f, "View", factory, serviceRegistrar);
        registerAllServices(bc, mainMenuAction);
        // Network tab's context menu
        GraphicsDetailAction networkMenuAction = new GraphicsDetailAction(11.0f, null, factory, serviceRegistrar);
        props = new Properties();
        props.setProperty(IN_NETWORK_PANEL_CONTEXT_MENU, "true");
        registerAllServices(bc, networkMenuAction, props);
    }
    // if IN_CONTEXT_MENU is not specified, default to true
    final String vtfFilter = String.format("(| (!(%s=*)) (%s=true))", IN_CONTEXT_MENU, IN_CONTEXT_MENU);
    registerServiceListener(bc, vtfListener::addNodeViewTaskFactory, vtfListener::removeNodeViewTaskFactory, NodeViewTaskFactory.class, vtfFilter);
    registerServiceListener(bc, vtfListener::addEdgeViewTaskFactory, vtfListener::removeEdgeViewTaskFactory, EdgeViewTaskFactory.class, vtfFilter);
    registerServiceListener(bc, vtfListener::addNetworkViewTaskFactory, vtfListener::removeNetworkViewTaskFactory, NetworkViewTaskFactory.class, vtfFilter);
    registerServiceListener(bc, vtfListener::addNetworkViewLocationTaskFactory, vtfListener::removeNetworkViewLocationTaskFactory, NetworkViewLocationTaskFactory.class);
    registerServiceListener(bc, vtfListener::addCyEdgeViewContextMenuFactory, vtfListener::removeCyEdgeViewContextMenuFactory, CyEdgeViewContextMenuFactory.class);
    registerServiceListener(bc, vtfListener::addCyNodeViewContextMenuFactory, vtfListener::removeCyNodeViewContextMenuFactory, CyNodeViewContextMenuFactory.class);
    registerServiceListener(bc, vtfListener::addCyNetworkViewContextMenuFactory, vtfListener::removeCyNetworkViewContextMenuFactory, CyNetworkViewContextMenuFactory.class);
    registerServiceListener(bc, annotationFactoryManager::addAnnotationFactory, annotationFactoryManager::removeAnnotationFactory, AnnotationFactory.class);
    BendFactory bendFactory = new BendFactoryImpl();
    registerService(bc, bendFactory, BendFactory.class, new Properties());
    // Register the factory
    dVisualLexicon.addBendFactory(bendFactory, new HashMap<Object, Object>());
    // Translators for Passthrough
    final CustomGraphicsTranslator cgTranslator = new CustomGraphicsTranslator(cgManager, cg2Manager);
    registerService(bc, cgTranslator, ValueTranslator.class, new Properties());
    // Factories for Visual Property Dependency
    final NodeSizeDependencyFactory nodeSizeDependencyFactory = new NodeSizeDependencyFactory(dVisualLexicon);
    registerService(bc, nodeSizeDependencyFactory, VisualPropertyDependencyFactory.class, new Properties());
    final EdgeColorDependencyFactory edgeColorDependencyFactory = new EdgeColorDependencyFactory(dVisualLexicon);
    registerService(bc, edgeColorDependencyFactory, VisualPropertyDependencyFactory.class, new Properties());
    final CustomGraphicsSizeDependencyFactory cgSizeDependencyFactory = new CustomGraphicsSizeDependencyFactory(dVisualLexicon);
    registerService(bc, cgSizeDependencyFactory, VisualPropertyDependencyFactory.class, new Properties());
    // Custom Graphics Editors
    final CyCustomGraphicsValueEditor cgValueEditor = new CyCustomGraphicsValueEditor(cgManager, cg2Manager, cgBrowser, serviceRegistrar);
    registerAllServices(bc, cgValueEditor, new Properties());
    final CustomGraphicsVisualPropertyEditor cgVisualPropertyEditor = new CustomGraphicsVisualPropertyEditor(CyCustomGraphics.class, cgValueEditor, continuousMappingCellRendererFactory, serviceRegistrar);
    registerService(bc, cgVisualPropertyEditor, VisualPropertyEditor.class, new Properties());
}
Also used : EditAnnotationTaskFactory(org.cytoscape.ding.impl.cyannotator.tasks.EditAnnotationTaskFactory) DingVisualStyleRenderingEngineFactory(org.cytoscape.ding.impl.DingVisualStyleRenderingEngineFactory) BendFactory(org.cytoscape.view.presentation.property.values.BendFactory) ChangeAnnotationCanvasTaskFactory(org.cytoscape.ding.impl.cyannotator.tasks.ChangeAnnotationCanvasTaskFactory) CustomGraphicsSizeDependencyFactory(org.cytoscape.ding.dependency.CustomGraphicsSizeDependencyFactory) ImageAnnotationFactory(org.cytoscape.ding.impl.cyannotator.create.ImageAnnotationFactory) ViewTaskFactoryListener(org.cytoscape.ding.impl.ViewTaskFactoryListener) EdgeColorDependencyFactory(org.cytoscape.ding.dependency.EdgeColorDependencyFactory) CyCustomGraphicsValueEditor(org.cytoscape.ding.impl.editor.CyCustomGraphicsValueEditor) SelectAnnotationTaskFactory(org.cytoscape.ding.impl.cyannotator.tasks.SelectAnnotationTaskFactory) DingViewModelFactory(org.cytoscape.ding.impl.DingViewModelFactory) NVLTFActionSupport(org.cytoscape.ding.impl.NVLTFActionSupport) GroupAnnotationsTaskFactory(org.cytoscape.ding.impl.cyannotator.tasks.GroupAnnotationsTaskFactory) HandleFactoryImpl(org.cytoscape.ding.impl.HandleFactoryImpl) NetworkViewTaskFactory(org.cytoscape.task.NetworkViewTaskFactory) AddEdgeNodeViewTaskFactoryImpl(org.cytoscape.ding.impl.AddEdgeNodeViewTaskFactoryImpl) DingGraphLOD(org.cytoscape.ding.impl.DingGraphLOD) AnnotationManager(org.cytoscape.view.presentation.annotations.AnnotationManager) AddArrowTaskFactory(org.cytoscape.ding.impl.cyannotator.tasks.AddArrowTaskFactory) AnnotationManagerImpl(org.cytoscape.ding.impl.cyannotator.AnnotationManagerImpl) ObjectPositionEditor(org.cytoscape.ding.impl.editor.ObjectPositionEditor) Properties(java.util.Properties) DingThumbnailRenderingEngineFactory(org.cytoscape.ding.impl.DingThumbnailRenderingEngineFactory) TextAnnotationFactory(org.cytoscape.ding.impl.cyannotator.create.TextAnnotationFactory) BoundedTextAnnotationFactory(org.cytoscape.ding.impl.cyannotator.create.BoundedTextAnnotationFactory) LayerAnnotationTaskFactory(org.cytoscape.ding.impl.cyannotator.tasks.LayerAnnotationTaskFactory) ContinuousMappingCellRendererFactory(org.cytoscape.view.vizmap.gui.editor.ContinuousMappingCellRendererFactory) ResizeAnnotationTaskFactory(org.cytoscape.ding.impl.cyannotator.tasks.ResizeAnnotationTaskFactory) DingNavigationRenderingEngineFactory(org.cytoscape.ding.impl.DingNavigationRenderingEngineFactory) NodeSizeDependencyFactory(org.cytoscape.ding.dependency.NodeSizeDependencyFactory) HandleFactory(org.cytoscape.view.presentation.property.values.HandleFactory) GraphicsDetailAction(org.cytoscape.ding.action.GraphicsDetailAction) DingGraphLODAll(org.cytoscape.ding.impl.DingGraphLODAll) DingRenderingEngineFactory(org.cytoscape.ding.impl.DingRenderingEngineFactory) RemoveAnnotationTaskFactory(org.cytoscape.ding.impl.cyannotator.tasks.RemoveAnnotationTaskFactory) ArrowAnnotationFactory(org.cytoscape.ding.impl.cyannotator.create.ArrowAnnotationFactory) UngroupAnnotationsTaskFactory(org.cytoscape.ding.impl.cyannotator.tasks.UngroupAnnotationsTaskFactory) AddAnnotationTaskFactory(org.cytoscape.ding.impl.cyannotator.tasks.AddAnnotationTaskFactory) MoveAnnotationTaskFactory(org.cytoscape.ding.impl.cyannotator.tasks.MoveAnnotationTaskFactory) GroupAnnotationFactory(org.cytoscape.ding.impl.cyannotator.create.GroupAnnotationFactory) EdgeBendValueEditor(org.cytoscape.ding.impl.editor.EdgeBendValueEditor) DingRenderer(org.cytoscape.ding.impl.DingRenderer) ShapeAnnotationFactory(org.cytoscape.ding.impl.cyannotator.create.ShapeAnnotationFactory) BendFactoryImpl(org.cytoscape.ding.impl.BendFactoryImpl) CustomGraphicsTranslator(org.cytoscape.ding.customgraphics.CustomGraphicsTranslator) EdgeBendEditor(org.cytoscape.ding.impl.editor.EdgeBendEditor) BoundedTextAnnotationFactory(org.cytoscape.ding.impl.cyannotator.create.BoundedTextAnnotationFactory) AnnotationFactoryManager(org.cytoscape.ding.impl.cyannotator.AnnotationFactoryManager) CustomGraphicsVisualPropertyEditor(org.cytoscape.ding.impl.editor.CustomGraphicsVisualPropertyEditor)

Example 4 with ContinuousMappingCellRendererFactory

use of org.cytoscape.view.vizmap.gui.editor.ContinuousMappingCellRendererFactory in project cytoscape-impl by cytoscape.

the class CyActivator method start.

@Override
public void start(final BundleContext bc) {
    final CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
    final ServicesUtil servicesUtil = new ServicesUtil(serviceRegistrar, ApplicationFacade.NAME);
    final AttributeSetProxy attributeSetProxy = new AttributeSetProxy(servicesUtil);
    final MappingFunctionFactoryProxy mappingFactoryProxy = new MappingFunctionFactoryProxy(servicesUtil);
    final EditorManagerImpl editorManager = new EditorManagerImpl(attributeSetProxy, mappingFactoryProxy, servicesUtil);
    // These listeners must be registered before the ValueEditors and VisualPropertyEditors:
    registerServiceListener(bc, editorManager::addValueEditor, editorManager::removeValueEditor, ValueEditor.class);
    registerServiceListener(bc, editorManager::addVisualPropertyValueEditor, editorManager::removeVisualPropertyValueEditor, VisualPropertyValueEditor.class);
    registerServiceListener(bc, editorManager::addVisualPropertyEditor, editorManager::removeVisualPropertyEditor, VisualPropertyEditor.class);
    registerServiceListener(bc, editorManager::addRenderingEngineFactory, editorManager::removeRenderingEngineFactory, RenderingEngineFactory.class);
    registerAllServices(bc, editorManager);
    final MappingFunctionFactoryManagerImpl mappingFunctionFactoryManager = new MappingFunctionFactoryManagerImpl();
    registerServiceListener(bc, mappingFunctionFactoryManager::addFactory, mappingFunctionFactoryManager::removeFactory, VisualMappingFunctionFactory.class);
    registerAllServices(bc, mappingFunctionFactoryManager);
    final NumericValueEditor<Double> doubleValueEditor = new NumericValueEditor<>(Double.class);
    final NumericValueEditor<Integer> integerValueEditor = new NumericValueEditor<>(Integer.class);
    final NumericValueEditor<Float> floatValueEditor = new NumericValueEditor<>(Float.class);
    final StringValueEditor stringValueEditor = new StringValueEditor();
    final BooleanValueEditor booleanValueEditor = new BooleanValueEditor();
    final FontValueEditor fontValueEditor = new FontValueEditor(servicesUtil);
    final CyColorChooser colorChooser = new CyColorChooser();
    final CyColorPropertyEditor cyColorPropertyEditor = new CyColorPropertyEditor(colorChooser, servicesUtil);
    final CyFontPropertyEditor cyFontPropertyEditor = new CyFontPropertyEditor();
    final ContinuousMappingCellRendererFactory cmCellRendererFactory = getService(bc, ContinuousMappingCellRendererFactory.class);
    final ColorVisualPropertyEditor colorPropertyEditor = new ColorVisualPropertyEditor(Paint.class, editorManager, cyColorPropertyEditor, cmCellRendererFactory);
    final NumberVisualPropertyEditor<Double> doublePropertyEditor = new NumberVisualPropertyEditor<>(Double.class, cmCellRendererFactory);
    final NumberVisualPropertyEditor<Integer> integerPropertyEditor = new NumberVisualPropertyEditor<>(Integer.class, cmCellRendererFactory);
    final NumberVisualPropertyEditor<Float> floatPropertyEditor = new NumberVisualPropertyEditor<>(Float.class, cmCellRendererFactory);
    final FontVisualPropertyEditor fontVisualPropertyEditor = new FontVisualPropertyEditor(Font.class, cyFontPropertyEditor, cmCellRendererFactory);
    final StringVisualPropertyEditor stringPropertyEditor = new StringVisualPropertyEditor(cmCellRendererFactory);
    final CyComboBoxPropertyEditor booleanEditor = new CyComboBoxPropertyEditor();
    booleanEditor.setAvailableValues(new Boolean[] { true, false });
    final BooleanVisualPropertyEditor booleanVisualPropertyEditor = new BooleanVisualPropertyEditor(booleanEditor, cmCellRendererFactory);
    // Context menu for edge bend
    final Properties clearAllBendsForThisEdgeProps = new Properties();
    clearAllBendsForThisEdgeProps.put(ServiceProperties.PREFERRED_MENU, ServiceProperties.EDGE_EDIT_MENU);
    clearAllBendsForThisEdgeProps.put(ServiceProperties.TITLE, "Clear All Bends For This Edge");
    clearAllBendsForThisEdgeProps.put(ServiceProperties.MENU_GRAVITY, "5.0");
    clearAllBendsForThisEdgeProps.put(ServiceProperties.INSERT_SEPARATOR_BEFORE, "true");
    final ClearAllBendsForThisEdgeTaskFactory clearAllBendsForThisEdgeTaskFactory = new ClearAllBendsForThisEdgeTaskFactory(servicesUtil);
    registerService(bc, clearAllBendsForThisEdgeTaskFactory, EdgeViewTaskFactory.class, clearAllBendsForThisEdgeProps);
    // Register ValueEditors and VisualPropertyEditors
    // -------------------------------------------------------------------------------------------------------------
    registerAllServices(bc, attributeSetProxy);
    registerAllServices(bc, editorManager.getNodeEditor());
    registerAllServices(bc, editorManager.getEdgeEditor());
    registerAllServices(bc, editorManager.getNetworkEditor());
    registerAllServices(bc, colorChooser);
    registerAllServices(bc, doubleValueEditor);
    registerAllServices(bc, integerValueEditor);
    registerAllServices(bc, floatValueEditor);
    registerAllServices(bc, stringValueEditor);
    registerAllServices(bc, booleanValueEditor);
    registerAllServices(bc, fontValueEditor);
    registerAllServices(bc, colorPropertyEditor);
    registerAllServices(bc, doublePropertyEditor);
    registerAllServices(bc, floatPropertyEditor);
    registerAllServices(bc, integerPropertyEditor);
    registerAllServices(bc, fontVisualPropertyEditor);
    registerAllServices(bc, stringPropertyEditor);
    registerAllServices(bc, booleanVisualPropertyEditor);
    // Tasks
    // -------------------------------------------------------------------------------------------------------------
    final CreateNewVisualStyleTaskFactory createNewVisualStyleTaskFactory = new CreateNewVisualStyleTaskFactory(servicesUtil);
    final Properties createNewVisualStyleTaskFactoryProps = new Properties();
    createNewVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI");
    createNewVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.TITLE, CreateNewVisualStyleTask.TITLE + "...");
    createNewVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.MENU_ID, ServicePropertiesUtil.MAIN_MENU);
    createNewVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.GRAVITY, "1.0");
    registerAllServices(bc, createNewVisualStyleTaskFactory, createNewVisualStyleTaskFactoryProps);
    final CopyVisualStyleTaskFactory copyVisualStyleTaskFactory = new CopyVisualStyleTaskFactory(servicesUtil);
    final Properties copyVisualStyleTaskFactoryProps = new Properties();
    copyVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI");
    copyVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.TITLE, CopyVisualStyleTask.TITLE + "...");
    copyVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.MENU_ID, ServicePropertiesUtil.MAIN_MENU);
    copyVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.GRAVITY, "2.0");
    registerAllServices(bc, copyVisualStyleTaskFactory, copyVisualStyleTaskFactoryProps);
    final RenameVisualStyleTaskFactory renameVisualStyleTaskFactory = new RenameVisualStyleTaskFactory(servicesUtil);
    final Properties renameVisualStyleTaskFactoryProps = new Properties();
    renameVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI");
    renameVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.TITLE, RenameVisualStyleTask.TITLE + "...");
    renameVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.MENU_ID, ServicePropertiesUtil.MAIN_MENU);
    renameVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.GRAVITY, "3.0");
    registerAllServices(bc, renameVisualStyleTaskFactory, renameVisualStyleTaskFactoryProps);
    final RemoveVisualStyleTaskFactory removeVisualStyleTaskFactory = new RemoveVisualStyleTaskFactory(servicesUtil);
    final Properties removeVisualStyleTaskFactoryProps = new Properties();
    removeVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI");
    removeVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.TITLE, RemoveVisualStyleTask.TITLE);
    removeVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.MENU_ID, ServicePropertiesUtil.MAIN_MENU);
    removeVisualStyleTaskFactoryProps.setProperty(ServicePropertiesUtil.GRAVITY, "4.0");
    registerAllServices(bc, removeVisualStyleTaskFactory, removeVisualStyleTaskFactoryProps);
    final MakeVisualStylesDefaultTaskFactory makeVisualStylesDefaultTaskFactory = new MakeVisualStylesDefaultTaskFactory(servicesUtil);
    final Properties makeVisualStylesDefaultTaskFactoryProps = new Properties();
    makeVisualStylesDefaultTaskFactoryProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI");
    makeVisualStylesDefaultTaskFactoryProps.setProperty(ServicePropertiesUtil.TITLE, MakeVisualStylesDefaultTask.TITLE);
    makeVisualStylesDefaultTaskFactoryProps.setProperty(ServicePropertiesUtil.MENU_ID, ServicePropertiesUtil.MAIN_MENU);
    makeVisualStylesDefaultTaskFactoryProps.setProperty(ServicePropertiesUtil.GRAVITY, "5.0");
    makeVisualStylesDefaultTaskFactoryProps.setProperty(ServicePropertiesUtil.INSERT_SEPARATOR_BEFORE, "true");
    registerAllServices(bc, makeVisualStylesDefaultTaskFactory, makeVisualStylesDefaultTaskFactoryProps);
    final CreateLegendTaskFactory createLegendTaskFactory = new CreateLegendTaskFactory(servicesUtil);
    final Properties createLegendTaskFactoryProps = new Properties();
    createLegendTaskFactoryProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI");
    createLegendTaskFactoryProps.setProperty(ServicePropertiesUtil.TITLE, CreateLegendTask.TITLE + "...");
    createLegendTaskFactoryProps.setProperty(ServicePropertiesUtil.MENU_ID, ServicePropertiesUtil.MAIN_MENU);
    createLegendTaskFactoryProps.setProperty(ServicePropertiesUtil.GRAVITY, "6.0");
    createLegendTaskFactoryProps.setProperty(ServicePropertiesUtil.INSERT_SEPARATOR_BEFORE, "true");
    registerAllServices(bc, createLegendTaskFactory, createLegendTaskFactoryProps);
    // Visual Styles Panel Context Menu
    // -------------------------------------------------------------------------------------------------------------
    // Edit sub-menu
    final EditSelectedDiscreteValuesAction editAction = new EditSelectedDiscreteValuesAction(servicesUtil, editorManager);
    final Properties editSelectedProps = new Properties();
    editSelectedProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI");
    editSelectedProps.setProperty(ServicePropertiesUtil.TITLE, EditSelectedDiscreteValuesAction.NAME);
    editSelectedProps.setProperty(ServicePropertiesUtil.MENU_ID, "context");
    editSelectedProps.setProperty(ServicePropertiesUtil.GRAVITY, "1.0");
    registerService(bc, editAction, CyAction.class, editSelectedProps);
    final RemoveSelectedDiscreteValuesAction removeAction = new RemoveSelectedDiscreteValuesAction(servicesUtil);
    final Properties removeSelectedProps = new Properties();
    removeSelectedProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI");
    removeSelectedProps.setProperty(ServicePropertiesUtil.TITLE, RemoveSelectedDiscreteValuesAction.NAME);
    removeSelectedProps.setProperty(ServicePropertiesUtil.MENU_ID, "context");
    removeSelectedProps.setProperty(ServicePropertiesUtil.GRAVITY, "2.0");
    registerService(bc, removeAction, CyAction.class, removeSelectedProps);
    final RemoveVisualMappingsTaskFactory removeVisualMappingsTaskFactory = new RemoveVisualMappingsTaskFactory(servicesUtil);
    final Properties removeVisualMappingTaskFactoryProps = new Properties();
    removeVisualMappingTaskFactoryProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI");
    removeVisualMappingTaskFactoryProps.setProperty(ServicePropertiesUtil.TITLE, "Remove Mappings from Selected Visual Properties");
    removeVisualMappingTaskFactoryProps.setProperty(ServicePropertiesUtil.MENU_ID, "context");
    removeVisualMappingTaskFactoryProps.setProperty(ServicePropertiesUtil.GRAVITY, "3.0");
    removeVisualMappingTaskFactoryProps.setProperty(ServicePropertiesUtil.INSERT_SEPARATOR_BEFORE, "true");
    registerAllServices(bc, removeVisualMappingsTaskFactory, removeVisualMappingTaskFactoryProps);
    // Discrete value generators:
    final RainbowColorMappingGenerator rainbowGenerator = new RainbowColorMappingGenerator(Color.class);
    final Properties rainbowGeneratorProps = new Properties();
    rainbowGeneratorProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI");
    rainbowGeneratorProps.setProperty(ServicePropertiesUtil.TITLE, "Rainbow");
    rainbowGeneratorProps.setProperty(ServicePropertiesUtil.MENU_ID, "context");
    registerService(bc, rainbowGenerator, DiscreteMappingGenerator.class, rainbowGeneratorProps);
    final RainbowOscColorMappingGenerator rainbowOscGenerator = new RainbowOscColorMappingGenerator(Color.class);
    final Properties rainbowOscGeneratorProps = new Properties();
    rainbowOscGeneratorProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI.contextMenu");
    rainbowOscGeneratorProps.setProperty(ServicePropertiesUtil.TITLE, "Rainbow OSC");
    rainbowOscGeneratorProps.setProperty(ServicePropertiesUtil.MENU_ID, "context");
    registerService(bc, rainbowOscGenerator, DiscreteMappingGenerator.class, rainbowOscGeneratorProps);
    final RandomColorMappingGenerator randomColorGenerator = new RandomColorMappingGenerator(Color.class);
    final Properties randomColorGeneratorProps = new Properties();
    randomColorGeneratorProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI.contextMenu");
    randomColorGeneratorProps.setProperty(ServicePropertiesUtil.TITLE, "Random Color");
    randomColorGeneratorProps.setProperty(ServicePropertiesUtil.MENU_ID, "context");
    registerService(bc, randomColorGenerator, DiscreteMappingGenerator.class, randomColorGeneratorProps);
    final NumberSeriesMappingGenerator<Number> seriesGenerator = new NumberSeriesMappingGenerator<Number>(Number.class);
    final Properties numberSeriesGeneratorProps = new Properties();
    numberSeriesGeneratorProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI.contextMenu");
    numberSeriesGeneratorProps.setProperty(ServicePropertiesUtil.TITLE, "Number Series");
    numberSeriesGeneratorProps.setProperty(ServicePropertiesUtil.MENU_ID, "context");
    registerService(bc, seriesGenerator, DiscreteMappingGenerator.class, numberSeriesGeneratorProps);
    final RandomNumberMappingGenerator randomNumberGenerator = new RandomNumberMappingGenerator();
    final Properties randomNumberGeneratorProps = new Properties();
    randomNumberGeneratorProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI.contextMenu");
    randomNumberGeneratorProps.setProperty(ServicePropertiesUtil.TITLE, "Random Numbers");
    randomNumberGeneratorProps.setProperty(ServicePropertiesUtil.MENU_ID, "context");
    registerService(bc, randomNumberGenerator, DiscreteMappingGenerator.class, randomNumberGeneratorProps);
    final FitLabelMappingGenerator<Double> fitLabelMappingGenerator = new FitLabelMappingGenerator<Double>(Double.class, servicesUtil);
    final Properties fitLabelGeneratorProps = new Properties();
    fitLabelGeneratorProps.setProperty(ServicePropertiesUtil.SERVICE_TYPE, "vizmapUI.contextMenu");
    fitLabelGeneratorProps.setProperty(ServicePropertiesUtil.TITLE, "Fit label width (only works with 'name' column to node size or width)");
    fitLabelGeneratorProps.setProperty(ServicePropertiesUtil.MENU_ID, "context");
    registerService(bc, fitLabelMappingGenerator, DiscreteMappingGenerator.class, fitLabelGeneratorProps);
    // Create the main GUI component
    // -------------------------------------------------------------------------------------------------------------
    final VizMapperMainPanel vizMapperMainPanel = new VizMapperMainPanel(servicesUtil);
    // Start the PureMVC components
    // -------------------------------------------------------------------------------------------------------------
    final VizMapperProxy vizMapperProxy = new VizMapperProxy(servicesUtil);
    final PropsProxy propsProxy = new PropsProxy(servicesUtil);
    final VizMapPropertyBuilder vizMapPropertyBuilder = new VizMapPropertyBuilder(editorManager, mappingFunctionFactoryManager, servicesUtil);
    final VizMapperMediator vizMapperMediator = new VizMapperMediator(vizMapperMainPanel, servicesUtil, vizMapPropertyBuilder);
    final VizMapperMenuMediator vizMapperMenuMediator = new VizMapperMenuMediator(vizMapperMainPanel, servicesUtil);
    final StartupCommand startupCommand = new StartupCommand(vizMapperProxy, attributeSetProxy, mappingFactoryProxy, propsProxy, vizMapperMediator, vizMapperMenuMediator, servicesUtil);
    registerAllServices(bc, vizMapperProxy);
    registerAllServices(bc, mappingFactoryProxy);
    registerAllServices(bc, propsProxy);
    registerAllServices(bc, vizMapperMediator);
    registerServiceListener(bc, vizMapperMediator::onCyActionRegistered, vizMapperMediator::onCyActionUnregistered, CyAction.class);
    registerServiceListener(bc, vizMapperMediator::onTaskFactoryRegistered, vizMapperMediator::onTaskFactoryUnregistered, TaskFactory.class);
    registerServiceListener(bc, vizMapperMediator::onMappingGeneratorRegistered, vizMapperMediator::onMappingGeneratorUnregistered, DiscreteMappingGenerator.class);
    registerServiceListener(bc, vizMapperMenuMediator::onRenderingEngineFactoryRegistered, vizMapperMenuMediator::onRenderingEngineFactoryUnregistered, RenderingEngineFactory.class);
    final VizMapEventHandlerManagerImpl vizMapEventHandlerManager = new VizMapEventHandlerManagerImpl(editorManager, attributeSetProxy, servicesUtil, vizMapPropertyBuilder, vizMapperMediator);
    registerServiceListener(bc, vizMapEventHandlerManager::registerPCL, vizMapEventHandlerManager::unregisterPCL, RenderingEngineFactory.class);
    // Startup the framework
    new ApplicationFacade(startupCommand).startup();
}
Also used : CyFontPropertyEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.propertyeditor.CyFontPropertyEditor) NumberVisualPropertyEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.NumberVisualPropertyEditor) VizMapperMediator(org.cytoscape.view.vizmap.gui.internal.view.VizMapperMediator) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) NumberSeriesMappingGenerator(org.cytoscape.view.vizmap.gui.internal.util.mapgenerator.NumberSeriesMappingGenerator) AttributeSetProxy(org.cytoscape.view.vizmap.gui.internal.model.AttributeSetProxy) CyColorChooser(org.cytoscape.view.vizmap.gui.internal.view.editor.valueeditor.CyColorChooser) CyColorPropertyEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.propertyeditor.CyColorPropertyEditor) StringValueEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.valueeditor.StringValueEditor) RandomNumberMappingGenerator(org.cytoscape.view.vizmap.gui.internal.util.mapgenerator.RandomNumberMappingGenerator) ClearAllBendsForThisEdgeTaskFactory(org.cytoscape.view.vizmap.gui.internal.task.ClearAllBendsForThisEdgeTaskFactory) MappingFunctionFactoryProxy(org.cytoscape.view.vizmap.gui.internal.model.MappingFunctionFactoryProxy) RemoveSelectedDiscreteValuesAction(org.cytoscape.view.vizmap.gui.internal.action.RemoveSelectedDiscreteValuesAction) MakeVisualStylesDefaultTaskFactory(org.cytoscape.view.vizmap.gui.internal.task.MakeVisualStylesDefaultTaskFactory) RandomColorMappingGenerator(org.cytoscape.view.vizmap.gui.internal.util.mapgenerator.RandomColorMappingGenerator) RemoveVisualMappingsTaskFactory(org.cytoscape.view.vizmap.gui.internal.task.RemoveVisualMappingsTaskFactory) NumericValueEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.valueeditor.NumericValueEditor) VizMapperMenuMediator(org.cytoscape.view.vizmap.gui.internal.view.VizMapperMenuMediator) BooleanVisualPropertyEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.BooleanVisualPropertyEditor) RainbowOscColorMappingGenerator(org.cytoscape.view.vizmap.gui.internal.util.mapgenerator.RainbowOscColorMappingGenerator) EditorManagerImpl(org.cytoscape.view.vizmap.gui.internal.view.editor.EditorManagerImpl) StringVisualPropertyEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.StringVisualPropertyEditor) ServiceProperties(org.cytoscape.work.ServiceProperties) Properties(java.util.Properties) CopyVisualStyleTaskFactory(org.cytoscape.view.vizmap.gui.internal.task.CopyVisualStyleTaskFactory) ContinuousMappingCellRendererFactory(org.cytoscape.view.vizmap.gui.editor.ContinuousMappingCellRendererFactory) VizMapPropertyBuilder(org.cytoscape.view.vizmap.gui.internal.view.VizMapPropertyBuilder) VizMapperProxy(org.cytoscape.view.vizmap.gui.internal.model.VizMapperProxy) BooleanValueEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.valueeditor.BooleanValueEditor) VizMapperMainPanel(org.cytoscape.view.vizmap.gui.internal.view.VizMapperMainPanel) RainbowColorMappingGenerator(org.cytoscape.view.vizmap.gui.internal.util.mapgenerator.RainbowColorMappingGenerator) RemoveVisualStyleTaskFactory(org.cytoscape.view.vizmap.gui.internal.task.RemoveVisualStyleTaskFactory) PropsProxy(org.cytoscape.view.vizmap.gui.internal.model.PropsProxy) EditSelectedDiscreteValuesAction(org.cytoscape.view.vizmap.gui.internal.action.EditSelectedDiscreteValuesAction) CreateNewVisualStyleTaskFactory(org.cytoscape.view.vizmap.gui.internal.task.CreateNewVisualStyleTaskFactory) FontVisualPropertyEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.FontVisualPropertyEditor) VizMapEventHandlerManagerImpl(org.cytoscape.view.vizmap.gui.internal.event.VizMapEventHandlerManagerImpl) FontValueEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.valueeditor.FontValueEditor) FitLabelMappingGenerator(org.cytoscape.view.vizmap.gui.internal.util.mapgenerator.FitLabelMappingGenerator) ServicesUtil(org.cytoscape.view.vizmap.gui.internal.util.ServicesUtil) StartupCommand(org.cytoscape.view.vizmap.gui.internal.controller.StartupCommand) ColorVisualPropertyEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.ColorVisualPropertyEditor) CyComboBoxPropertyEditor(org.cytoscape.view.vizmap.gui.internal.view.editor.propertyeditor.CyComboBoxPropertyEditor) CreateLegendTaskFactory(org.cytoscape.view.vizmap.gui.internal.task.CreateLegendTaskFactory) RenameVisualStyleTaskFactory(org.cytoscape.view.vizmap.gui.internal.task.RenameVisualStyleTaskFactory)

Aggregations

ContinuousMappingCellRendererFactory (org.cytoscape.view.vizmap.gui.editor.ContinuousMappingCellRendererFactory)4 Properties (java.util.Properties)3 HashSet (java.util.HashSet)1 Set (java.util.Set)1 GraphicsDetailAction (org.cytoscape.ding.action.GraphicsDetailAction)1 CustomGraphicsTranslator (org.cytoscape.ding.customgraphics.CustomGraphicsTranslator)1 CustomGraphicsSizeDependencyFactory (org.cytoscape.ding.dependency.CustomGraphicsSizeDependencyFactory)1 EdgeColorDependencyFactory (org.cytoscape.ding.dependency.EdgeColorDependencyFactory)1 NodeSizeDependencyFactory (org.cytoscape.ding.dependency.NodeSizeDependencyFactory)1 AddEdgeNodeViewTaskFactoryImpl (org.cytoscape.ding.impl.AddEdgeNodeViewTaskFactoryImpl)1 BendFactoryImpl (org.cytoscape.ding.impl.BendFactoryImpl)1 DingGraphLOD (org.cytoscape.ding.impl.DingGraphLOD)1 DingGraphLODAll (org.cytoscape.ding.impl.DingGraphLODAll)1 DingNavigationRenderingEngineFactory (org.cytoscape.ding.impl.DingNavigationRenderingEngineFactory)1 DingRenderer (org.cytoscape.ding.impl.DingRenderer)1 DingRenderingEngineFactory (org.cytoscape.ding.impl.DingRenderingEngineFactory)1 DingThumbnailRenderingEngineFactory (org.cytoscape.ding.impl.DingThumbnailRenderingEngineFactory)1 DingViewModelFactory (org.cytoscape.ding.impl.DingViewModelFactory)1 DingVisualStyleRenderingEngineFactory (org.cytoscape.ding.impl.DingVisualStyleRenderingEngineFactory)1 HandleFactoryImpl (org.cytoscape.ding.impl.HandleFactoryImpl)1