Package org.gephi.preview.api

Examples of org.gephi.preview.api.PreviewController


    }

    @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();
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

            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);
                }
View Full Code Here

    private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed
        PreviewUIController.findInstance().refreshPreview();
}//GEN-LAST:event_refreshButtonActionPerformed

    private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
        PreviewController previewController = Lookup.getDefault().lookup(PreviewController.class);
        PreviewPreset preset = previewController.getModel().getCurrentPreset();
        boolean saved = false;
        if (isDefaultPreset(preset)) {
            NotifyDescriptor.InputLine question = new NotifyDescriptor.InputLine(
                    NbBundle.getMessage(PreviewSettingsTopComponent.class, "PreviewSettingsTopComponent.savePreset.input"),
                    NbBundle.getMessage(PreviewSettingsTopComponent.class, "PreviewSettingsTopComponent.savePreset.input.title"));
            if (DialogDisplayer.getDefault().notify(question) == NotifyDescriptor.OK_OPTION) {
                String input = question.getInputText();
                if (input != null && !input.isEmpty()) {
                    previewController.savePreset(input);
                    saved = true;
                    StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(PreviewSettingsTopComponent.class, "PreviewSettingsTopComponent.savePreset.status", input));
                }
            }
        } else {
            previewController.savePreset(preset.getName());
            saved = true;
            StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(PreviewSettingsTopComponent.class, "PreviewSettingsTopComponent.savePreset.status", preset.getName()));
        }

        if (saved) {
            //refresh combo
            PreviewController controller = Lookup.getDefault().lookup(PreviewController.class);
            DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel();
            defaultPresetLimit = 0;
            for (PreviewPreset p : controller.getDefaultPresets()) {
                comboBoxModel.addElement(p);
                defaultPresetLimit++;
            }
            PreviewPreset[] userPresets = controller.getUserPresets();
            if (userPresets.length > 0) {
                comboBoxModel.addElement(NO_SELECTION);
                for (PreviewPreset p : userPresets) {
                    comboBoxModel.addElement(p);
                }
View Full Code Here

        //background color
        ((JColorButton) backgroundButton).addPropertyChangeListener(JColorButton.EVENT_COLOR, new PropertyChangeListener() {

            public void propertyChange(PropertyChangeEvent evt) {
                PreviewController controller = Lookup.getDefault().lookup(PreviewController.class);
                controller.setBackgroundColor((Color) evt.getNewValue());
            }
        });
        southBusyLabel.setVisible(false);
        resetZoomButton.addActionListener(new ActionListener() {
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

    /**
     * Refreshes the preview applet.
     */
    public void refreshPreview() {
        final PreviewController previewController = Lookup.getDefault().lookup(PreviewController.class);
        final PreviewTopComponent previewTopComponent = PreviewTopComponent.findInstance();
        final float visibilityRatio = PreviewSettingsTopComponent.findInstance().getVisibilityRatio();

        Thread refreshThread = new Thread(new Runnable() {

            public void run() {
                previewTopComponent.setRefresh(true);
                disableRefresh();
                hideRefreshNotification();
                GraphSheet controllerGraphSheet = previewController.getPartialGraphSheet(visibilityRatio);
                if (controllerGraphSheet != null) {
                    if (null == graphSheet || controllerGraphSheet != graphSheet) {
                        graphSheet = controllerGraphSheet;
                        previewTopComponent.setGraph(graphSheet);
                    }
View Full Code Here

        e.getAllFonts();
    }

    public boolean execute() {
        // fetches the preview graph sheet
        PreviewController controller = Lookup.getDefault().lookup(PreviewController.class);
        GraphSheet graphSheet = controller.getGraphSheet();
        Graph graph = graphSheet.getGraph();
        try {
            exportData(graph);
        } catch (Exception e) {
            throw new RuntimeException(e);
View Full Code Here

    private Element labelGroupElem;
    private Element labelBorderGroupElem;
    private float scaleRatio = 1f;

    public boolean execute() {
        PreviewController controller = Lookup.getDefault().lookup(PreviewController.class);
        GraphSheet graphSheet = controller.getGraphSheet();
        try {
            exportData(graphSheet);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

     * Returns the global edge supervisor.
     *
     * @return the controller's global edge supervisor
     */
    public GlobalEdgeSupervisor getGlobalEdgeSupervisor() {
        PreviewController controller = Lookup.getDefault().lookup(PreviewController.class);
        return controller.getModel().getGlobalEdgeSupervisor();
    }
View Full Code Here

TOP

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

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.