Package org.gephi.graph.api

Examples of org.gephi.graph.api.GraphController


        }
        firePropertyChangeEvent(SELECTED_LAYOUT, oldValue, selectedLayout);
    }

    public void injectGraph() {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        if (selectedLayout != null && graphController.getGraphModel() != null) {
            selectedLayout.setGraphModel(graphController.getGraphModel());
        }
    }
View Full Code Here


        resetColorButton.setToolTipText(NbBundle.getMessage(ActionsToolbar.class, "ActionsToolbar.resetColors"));
        resetColorButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                color = resetColorButton.getColor();
                GraphController gc = Lookup.getDefault().lookup(GraphController.class);
                GraphModel gm = gc.getGraphModel();
                Graph graph = gm.getGraphVisible();
                for (Node n : graph.getNodes()) {
                    n.setR(color.getRed() / 255f);
                    n.setG(color.getGreen() / 255f);
                    n.setB(color.getBlue() / 255f);
                    n.setAlpha(1f);
                }
                for (Edge e : graph.getEdges()) {
                    e.setR(color.getRed() / 255f);
                    e.setG(color.getGreen() / 255f);
                    e.setB(color.getBlue() / 255f);
                    e.setAlpha(0f);
                }
            }
        });
        add(resetColorButton);

        //Reset sizes
        final JButton resetSizeButton = new JButton();
        resetSizeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/visualization/component/resetSize.png")));
        resetSizeButton.setToolTipText(NbBundle.getMessage(ActionsToolbar.class, "ActionsToolbar.resetSizes"));
        resetSizeButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                GraphController gc = Lookup.getDefault().lookup(GraphController.class);
                GraphModel gm = gc.getGraphModel();
                Graph graph = gm.getGraphVisible();
                for (Node n : graph.getNodes()) {
                    n.setSize(size);
                }
            }
        });
        resetSizeButton.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {

                if (SwingUtilities.isRightMouseButton(e)) {
                    Object res = JOptionPane.showInputDialog(resetSizeButton, NbBundle.getMessage(ActionsToolbar.class, "ActionsToolbar.resetSizes.dialog"), "" + size);
                    if (res != null) {
                        try {
                            size = Float.parseFloat((String) res);
                        } catch (Exception ex) {
                        }
                    }
                }
            }
        });
        add(resetSizeButton);

        //Reset label colors
        final JButton resetLabelColorButton = new JButton();
        resetLabelColorButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/visualization/component/resetLabelColor.png")));
        resetLabelColorButton.setToolTipText(NbBundle.getMessage(ActionsToolbar.class, "ActionsToolbar.resetLabelColors"));
        resetLabelColorButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                GraphController gc = Lookup.getDefault().lookup(GraphController.class);
                GraphModel gm = gc.getGraphModel();
                Graph graph = gm.getGraphVisible();
                for (Node n : graph.getNodes().toArray()) {
                    n.getTextProperties().setColor(null);
                }
                for (Edge e : graph.getEdges().toArray()) {
                    e.getTextProperties().setColor(null);
                }
            }
        });
        add(resetLabelColorButton);

        //Reset label colors
        final JButton resetLabelVisibleButton = new JButton();
        resetLabelVisibleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/visualization/component/resetLabelVisible.png")));
        resetLabelVisibleButton.setToolTipText(NbBundle.getMessage(ActionsToolbar.class, "ActionsToolbar.resetLabelVisible"));
        resetLabelVisibleButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                GraphController gc = Lookup.getDefault().lookup(GraphController.class);
                GraphModel gm = gc.getGraphModel();
                Graph graph = gm.getGraphVisible();
                for (Node n : graph.getNodes()) {
                    n.getTextProperties().setVisible(true);
                }
                for (Edge e : graph.getEdges()) {
                    e.getTextProperties().setVisible(true);
                }
            }
        });
        add(resetLabelVisibleButton);

        //Reset label size
        JButton resetLabelSizeButton = new JButton();
        resetLabelSizeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/visualization/component/resetLabelSize.png")));
        resetLabelSizeButton.setToolTipText(NbBundle.getMessage(ActionsToolbar.class, "ActionsToolbar.resetLabelSizes"));
        resetLabelSizeButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                GraphController gc = Lookup.getDefault().lookup(GraphController.class);
                GraphModel gm = gc.getGraphModel();
                Graph graph = gm.getGraphVisible();
                for (Node n : graph.getNodes()) {
                    n.getTextProperties().setSize(1f);
                }
            }
View Full Code Here

        this.textModel = model;
        refresh();
    }

    private void refresh() {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);

        List<Column> availableColumns = new ArrayList<Column>();
        List<Column> selectedColumns = new ArrayList<Column>();
        AttributesCheckBox[] target;
        if (elementButtonGroup.getSelection() == nodesToggleButton.getModel()) {
            for (Column c : graphController.getAttributeModel().getNodeTable()) {
                if (c.getOrigin().equals(Origin.DATA)) {
                    availableColumns.add(c);
                } else if (showProperties) {
                    if (c.getId().equalsIgnoreCase("label")) {
                        availableColumns.add(c);
                    }
                }
            }

            if (textModel.getNodeTextColumns() != null) {
                selectedColumns = Arrays.asList(textModel.getNodeTextColumns());
            }
            nodeCheckBoxs = new AttributesCheckBox[availableColumns.size()];
            target = nodeCheckBoxs;
        } else {
            for (Column c : graphController.getAttributeModel().getEdgeTable()) {
                if (c.getOrigin().equals(Origin.DATA)) {
                    availableColumns.add(c);
                } else if (showProperties) {
                    if (c.getId().equalsIgnoreCase("label")) {
                        availableColumns.add(c);
View Full Code Here

            }
        });
    }
   
    public void setup(DynamicStatistics dynamicStatistics) {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        GraphModel graphModel = graphController.getGraphModel();
        AttributeModel attributeModel = graphController.getAttributeModel();
        TimeFormat timeFormat = attributeModel.getTimeFormat();

        //Bounds
        bounds = dynamicStatistics.getBounds();
        if (bounds == null) {
View Full Code Here

    /** Creates new form DynamicClusteringCoefficientPanel */
    public DynamicClusteringCoefficientPanel() {
        initComponents();

        //Disable directed if the graph is undirecteds
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        if (graphController.getGraphModel().isUndirected()) {
            directedRadioButton.setEnabled(false);
        }
    }
View Full Code Here

    public PageRankPanel() {
        initComponents();
       
        //Disable directed if the graph is undirecteds
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        if(graphController.getGraphModel().isUndirected()){
            directedRadioButton.setEnabled(false);
        }
    }
View Full Code Here

    /** Creates new form DynamicDegreePanel */
    public DynamicDegreePanel() {
        initComponents();

        //Disable directed if the graph is undirecteds
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        if (graphController.getGraphModel().isUndirected()) {
            directedRadioButton.setEnabled(false);
        }
    }
View Full Code Here

    public Column[] getNodeTextColumns() {
        return nodeTextColumns;
    }

    public void readXML(XMLStreamReader reader, Workspace workspace) throws XMLStreamException {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        AttributeModel attributeModel = graphController != null ? graphController.getAttributeModel(workspace) : null;
        List<Column> nodeCols = new ArrayList<Column>();
        List<Column> edgeCols = new ArrayList<Column>();

        boolean nodeColumn = false;
        boolean edgeColumn = false;
View Full Code Here

    private Column dynamicDegreeColumn;
    //Average
    private Map<Double, Double> averages;

    public DynamicDegree() {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        if (graphController != null && graphController.getGraphModel() != null) {
            isDirected = graphController.getGraphModel().isDirected();
        }
    }
View Full Code Here

    public ClusteringCoefficientPanel() {
        initComponents();
       
        //Disable directed if the graph is undirecteds
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        if(graphController.getGraphModel().isUndirected()){
            directedRadioButton.setEnabled(false);
        }
    }
View Full Code Here

TOP

Related Classes of org.gephi.graph.api.GraphController

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.