Package org.gephi.preview.api

Examples of org.gephi.preview.api.PreviewModel


    @Override
    protected Sheet createSheet() {
        Sheet sheet = Sheet.createDefault();
        PreviewController controller = Lookup.getDefault().lookup(PreviewController.class);
        PreviewModel model = controller.getModel();
        if (model != null) {
            NodeSupervisor ns = model.getNodeSupervisor();
            GlobalEdgeSupervisor ges = model.getGlobalEdgeSupervisor();
            SelfLoopSupervisor sls = model.getSelfLoopSupervisor();
            EdgeSupervisor unes = model.getUndirectedEdgeSupervisor();
            EdgeSupervisor ues = model.getUniEdgeSupervisor();
            EdgeSupervisor bes = model.getBiEdgeSupervisor();

            Sheet.Set nodeSet = Sheet.createPropertiesSet();
            nodeSet.setDisplayName(NbBundle.getMessage(PreviewNode.class, "PreviewNode.Node.displayName"));
            nodeSet.setName("nodes");
View Full Code Here


        FileImporter fileImporter = importController.getFileImporter(".gexf");
        Container container = importController.importFile(stream, fileImporter);

        importController.process(container, new DefaultProcessor(), workspace);

        PreviewModel model = Lookup.getDefault().lookup(PreviewController.class).getModel();
        model.getNodeSupervisor().setShowNodeLabels(Boolean.TRUE);

        SVGExporter sVGExporter = new SVGExporter();

        sVGExporter.setWorkspace(workspace);
        try {
View Full Code Here

        GraphModel graphModel = gc.getModel(workspace);
        for (Node n : graphModel.getGraph().getNodes()) {
            n.getNodeData().setLabel("Node " + n.getNodeData().getId());
        }

        PreviewModel model = Lookup.getDefault().lookup(PreviewController.class).getModel();
        Font font = new Font("Broadway", Font.PLAIN, 15);
        model.getNodeSupervisor().setBaseNodeLabelFont(font);
        model.getNodeSupervisor().setShowNodeLabels(Boolean.TRUE);
        Lookup.getDefault().lookup(PreviewController.class).setBackgroundColor(Color.GRAY);

        PDFExporter pDFExporter = new PDFExporter();

        pDFExporter.setWorkspace(workspace);
View Full Code Here

        //Presets
        presetComboBox.addItemListener(new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                PreviewController pc = Lookup.getDefault().lookup(PreviewController.class);
                PreviewModel previewModel = pc.getModel();
                if (previewModel != null && presetComboBox.getSelectedItem() instanceof PreviewPreset) {
                    if (previewModel.getCurrentPreset() != presetComboBox.getSelectedItem()) {
                        pc.setCurrentPreset((PreviewPreset) presetComboBox.getSelectedItem());
                        propertySheet.setNodes(new Node[]{new PreviewNode()});
                    }
                }
            }
View Full Code Here

        refreshModel();
    }

    public void refreshModel() {
        propertySheet.setNodes(new Node[]{new PreviewNode()});
        PreviewModel previewModel = Lookup.getDefault().lookup(PreviewController.class).getModel();
        if (previewModel != null) {
            ratioSlider.setValue((int) (previewModel.getVisibilityRatio() * 100));
        }

        //Presets
        if (previewModel == null) {
            saveButton.setEnabled(false);
            labelPreset.setEnabled(false);
            presetComboBox.setEnabled(false);
            presetComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"---"}));
        } else {
            saveButton.setEnabled(true);
            labelPreset.setEnabled(true);
            presetComboBox.setEnabled(true);
            PreviewController controller = Lookup.getDefault().lookup(PreviewController.class);
            DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel();
            defaultPresetLimit = 0;
            for (PreviewPreset preset : controller.getDefaultPresets()) {
                comboBoxModel.addElement(preset);
                defaultPresetLimit++;
            }
            PreviewPreset[] userPresets = controller.getUserPresets();
            if (userPresets.length > 0) {
                comboBoxModel.addElement(NO_SELECTION);
                for (PreviewPreset preset : userPresets) {
                    comboBoxModel.addElement(preset);
                }
            }
            presetComboBox.setSelectedItem(previewModel.getCurrentPreset());
            presetComboBox.setModel(comboBoxModel);
        }
    }
View Full Code Here

     * Private constructor.
     */
    private PreviewUIController() {
        PreviewController previewController = Lookup.getDefault().lookup(PreviewController.class);
        final GraphController gc = Lookup.getDefault().lookup(GraphController.class);
        PreviewModel previewModel = previewController.getModel();
        if (previewModel != null) {
            graphModel = gc.getModel();
            graphModel.addGraphListener(this);
        }

View Full Code Here

    @Override
    public Item[] getItems(Graph graph, AttributeModel attributeModel) {
        //Get the current preview model, little hack to get the current workspace from the graph
        PreviewController previewController = Lookup.getDefault().lookup(PreviewController.class);
        PreviewModel previewModel = previewController.getModel(graph.getGraphModel().getWorkspace());
       
        //Get the sort column from the properties, if any
        PreviewProperties previewProperties = previewModel.getProperties();
        final AttributeColumn sortColumn = previewProperties.getValue(SORT_COLUMN);
       
        //Get the standard node items from the node builder
        Item[] nodeItems = super.getItems(graph, attributeModel);
        if (sortColumn != null) {
View Full Code Here

            setup();
        }
    }

    private void setup() {
        PreviewModel model = previewController.getModel();
        setControlsEnabled(model != null);
        refresh();
    }
View Full Code Here

    /**
     * Restores the original order of the renderers list, preserving their enabled state.
     */
    private void restoreRenderersList() {
        PreviewModel model = previewController.getModel();
        Set<Renderer> enabledRenderers = null;
        if (model != null && model.getManagedRenderers() != null) {
            enabledRenderers = new HashSet<Renderer>();
            enabledRenderers.addAll(Arrays.asList(model.getManagedEnabledRenderers()));
        }
        renderersList.clear();
        for (Renderer r : previewController.getRegisteredRenderers()) {
            renderersList.add(new RendererCheckBox(r, enabledRenderers == null || enabledRenderers.contains(r)));
        }
View Full Code Here

    /**
     * Obtain renderers enabled state and order from the preview model.
     */
    private void loadModelManagedRenderers() {
        renderersList.clear();
        PreviewModel model = previewController.getModel();
        if (model != null) {
            if (model.getManagedRenderers() != null) {
                for (ManagedRenderer mr : model.getManagedRenderers()) {
                    renderersList.add(new RendererCheckBox(mr.getRenderer(), mr.isEnabled()));
                }
            } else {
                restoreRenderersList();
            }
View Full Code Here

TOP

Related Classes of org.gephi.preview.api.PreviewModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.