Search in sources :

Example 1 with VizModel

use of org.gephi.visualization.VizModel in project gephi by gephi.

the class GlobalSettingsPanel method refreshSharedConfig.

private void refreshSharedConfig() {
    VizModel vizModel = VizController.getInstance().getVizModel();
    setEnable(!vizModel.isDefaultModel());
    if (vizModel.isDefaultModel()) {
        return;
    }
    if (autoSelectNeigborCheckbox.isSelected() != vizModel.isAutoSelectNeighbor()) {
        autoSelectNeigborCheckbox.setSelected(vizModel.isAutoSelectNeighbor());
    }
    ((JColorButton) backgroundColorButton).setColor(vizModel.getBackgroundColor());
    if (hightlightCheckBox.isSelected() != vizModel.isLightenNonSelectedAuto()) {
        hightlightCheckBox.setSelected(vizModel.isLightenNonSelectedAuto());
    }
}
Also used : JColorButton(org.gephi.ui.components.JColorButton) VizModel(org.gephi.visualization.VizModel)

Example 2 with VizModel

use of org.gephi.visualization.VizModel in project gephi by gephi.

the class VizBarController method getToolbar.

public VizToolbar getToolbar() {
    VizModel model = VizController.getInstance().getVizModel();
    toolbar = new VizToolbar(groups);
    toolbar.setEnable(!model.isDefaultModel());
    return toolbar;
}
Also used : VizModel(org.gephi.visualization.VizModel)

Example 3 with VizModel

use of org.gephi.visualization.VizModel in project gephi by gephi.

the class EdgeSettingsPanel method setup.

public void setup() {
    VizModel vizModel = VizController.getInstance().getVizModel();
    vizModel.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("init")) {
                refreshSharedConfig();
            } else if (evt.getPropertyName().equals("edgeHasUniColor")) {
                refreshSharedConfig();
            } else if (evt.getPropertyName().equals("showEdges")) {
                refreshSharedConfig();
            } else if (evt.getPropertyName().equals("edgeUniColor")) {
                refreshSharedConfig();
            } else if (evt.getPropertyName().equals("edgeSelectionColor")) {
                refreshSharedConfig();
            } else if (evt.getPropertyName().equals("edgeInSelectionColor")) {
                refreshSharedConfig();
            } else if (evt.getPropertyName().equals("edgeOutSelectionColor")) {
                refreshSharedConfig();
            } else if (evt.getPropertyName().equals("edgeBothSelectionColor")) {
                refreshSharedConfig();
            } else if (evt.getPropertyName().equals("edgeScale")) {
                refreshSharedConfig();
            }
        }
    });
    refreshSharedConfig();
    showEdgesCheckbox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            VizModel vizModel = VizController.getInstance().getVizModel();
            vizModel.setShowEdges(showEdgesCheckbox.isSelected());
            setEnable(true);
        }
    });
    ((JColorButton) edgeColorButton).addPropertyChangeListener(JColorButton.EVENT_COLOR, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            VizModel vizModel = VizController.getInstance().getVizModel();
            vizModel.setEdgeUniColor(((JColorButton) edgeColorButton).getColorArray());
        }
    });
    sourceNodeColorCheckbox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            VizModel vizModel = VizController.getInstance().getVizModel();
            vizModel.setEdgeHasUniColor(!sourceNodeColorCheckbox.isSelected());
        }
    });
    selectionColorCheckbox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            VizModel vizModel = VizController.getInstance().getVizModel();
            vizModel.setEdgeSelectionColor(selectionColorCheckbox.isSelected());
        }
    });
    edgeInSelectionColorChooser.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            VizModel vizModel = VizController.getInstance().getVizModel();
            vizModel.setEdgeInSelectionColor(edgeInSelectionColorChooser.getColor().getComponents(null));
        }
    });
    edgeBothSelectionColorChooser.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            VizModel vizModel = VizController.getInstance().getVizModel();
            vizModel.setEdgeBothSelectionColor(edgeBothSelectionColorChooser.getColor().getComponents(null));
        }
    });
    edgeOutSelectionColorChooser.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            VizModel vizModel = VizController.getInstance().getVizModel();
            vizModel.setEdgeOutSelectionColor(edgeOutSelectionColorChooser.getColor().getComponents(null));
        }
    });
    scaleSlider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            VizModel vizModel = VizController.getInstance().getVizModel();
            if (vizModel.getEdgeScale() != (scaleSlider.getValue() / 10f + 0.1f)) {
                vizModel.setEdgeScale(scaleSlider.getValue() / 10f + 0.1f);
            }
        }
    });
}
Also used : JColorButton(org.gephi.ui.components.JColorButton) VizModel(org.gephi.visualization.VizModel) PropertyChangeEvent(java.beans.PropertyChangeEvent) ItemEvent(java.awt.event.ItemEvent) PropertyChangeListener(java.beans.PropertyChangeListener) ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) PropertyChangeEvent(java.beans.PropertyChangeEvent) ActionEvent(java.awt.event.ActionEvent) ItemListener(java.awt.event.ItemListener) PropertyChangeListener(java.beans.PropertyChangeListener) ChangeListener(javax.swing.event.ChangeListener)

Example 4 with VizModel

use of org.gephi.visualization.VizModel in project gephi by gephi.

the class LabelSettingsPanel method refreshSharedConfig.

private void refreshSharedConfig() {
    VizModel vizModel = VizController.getInstance().getVizModel();
    setEnable(!vizModel.isDefaultModel());
    if (vizModel.isDefaultModel()) {
        return;
    }
    TextModelImpl model = vizModel.getTextModel();
    // node
    nodeFontButton.setText(model.getNodeFont().getFontName() + ", " + model.getNodeFont().getSize());
    ((JColorButton) nodeColorButton).setColor(model.getNodeColor());
    if (showNodeLabelsCheckbox.isSelected() != model.isShowNodeLabels()) {
        showNodeLabelsCheckbox.setSelected(model.isShowNodeLabels());
    }
    if (nodeSizeSlider.getValue() / 100f != model.getNodeSizeFactor()) {
        nodeSizeSlider.setValue((int) (model.getNodeSizeFactor() * 100f));
    }
    // edge
    edgeFontButton.setText(model.getEdgeFont().getFontName() + ", " + model.getEdgeFont().getSize());
    ((JColorButton) edgeColorButton).setColor(model.getEdgeColor());
    if (showEdgeLabelsCheckbox.isSelected() != model.isShowEdgeLabels()) {
        showEdgeLabelsCheckbox.setSelected(model.isShowEdgeLabels());
    }
    if (edgeSizeSlider.getValue() / 100f != model.getEdgeSizeFactor()) {
        edgeSizeSlider.setValue((int) (model.getEdgeSizeFactor() * 100f));
    }
    // general
    if (hideNonSelectedCheckbox.isSelected() != model.isSelectedOnly()) {
        hideNonSelectedCheckbox.setSelected(model.isSelectedOnly());
    }
    if (sizeModeCombo.getSelectedItem() != model.getSizeMode()) {
        sizeModeCombo.setSelectedItem(model.getSizeMode());
    }
    if (colorModeCombo.getSelectedItem() != model.getColorMode()) {
        colorModeCombo.setSelectedItem(model.getColorMode());
    }
}
Also used : JColorButton(org.gephi.ui.components.JColorButton) VizModel(org.gephi.visualization.VizModel) TextModelImpl(org.gephi.visualization.text.TextModelImpl)

Example 5 with VizModel

use of org.gephi.visualization.VizModel in project gephi by gephi.

the class CompatibilityEngine method display.

@Override
public synchronized void display(GL2 gl, GLU glu) {
    markTime++;
    VizModel vizModel = VizController.getInstance().getVizModel();
    // Edges
    if (edgeModeler.isEnabled()) {
        edgeModeler.beforeDisplay(gl, glu);
        for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext(); ) {
            EdgeModel obj = itr.next();
            if (obj.markTime != markTime) {
                obj.display(gl, glu, vizModel);
                obj.markTime = markTime;
            }
        }
        edgeModeler.afterDisplay(gl, glu);
    }
    markTime++;
    // Arrows
    if (edgeModeler.isEnabled() && vizConfig.isShowArrows() && dataBridge.isDirected()) {
        gl.glBegin(GL2.GL_TRIANGLES);
        for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext(); ) {
            EdgeModel obj = itr.next();
            if (obj.getEdge().isDirected() && obj.markTime != markTime) {
                obj.displayArrow(gl, glu, vizModel);
                obj.markTime = markTime;
            }
        }
        gl.glEnd();
    }
    // Nodes
    if (nodeModeler.isEnabled()) {
        nodeModeler.beforeDisplay(gl, glu);
        for (Iterator<NodeModel> itr = octree.getNodeIterator(); itr.hasNext(); ) {
            NodeModel obj = itr.next();
            if (obj.markTime != markTime) {
                obj.display(gl, glu, vizModel);
                obj.markTime = markTime;
            }
        }
        nodeModeler.afterDisplay(gl, glu);
    }
    // Labels
    if (vizModel.getTextModel().isShowNodeLabels() || vizModel.getTextModel().isShowEdgeLabels()) {
        markTime++;
        if (nodeModeler.isEnabled() && vizModel.getTextModel().isShowNodeLabels()) {
            textManager.getNodeRenderer().beginRendering();
            textManager.defaultNodeColor();
            if (textManager.isSelectedOnly()) {
                for (Iterator<NodeModel> itr = octree.getNodeIterator(); itr.hasNext(); ) {
                    NodeModel obj = itr.next();
                    if (obj.markTime != markTime) {
                        if (obj.isSelected() && obj.isTextVisible()) {
                            textManager.getNodeRenderer().drawTextNode(obj);
                        }
                        obj.markTime = markTime;
                    }
                }
            } else {
                for (Iterator<NodeModel> itr = octree.getNodeIterator(); itr.hasNext(); ) {
                    NodeModel obj = itr.next();
                    if (obj.markTime != markTime) {
                        if (obj.isTextVisible()) {
                            textManager.getNodeRenderer().drawTextNode(obj);
                        }
                        obj.markTime = markTime;
                    }
                }
            }
            textManager.getNodeRenderer().endRendering();
        }
        // }
        if (edgeModeler.isEnabled() && vizModel.getTextModel().isShowEdgeLabels()) {
            markTime++;
            textManager.getEdgeRenderer().beginRendering();
            textManager.defaultEdgeColor();
            if (textManager.isSelectedOnly()) {
                for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext(); ) {
                    EdgeModel obj = itr.next();
                    if (obj.markTime != markTime) {
                        if ((obj.isSelected() || obj.isAutoSelected()) && obj.isTextVisible()) {
                            textManager.getEdgeRenderer().drawTextEdge(obj);
                        }
                        obj.markTime = markTime;
                    }
                }
            } else {
                for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext(); ) {
                    EdgeModel obj = itr.next();
                    if (obj.markTime != markTime) {
                        if (obj.isTextVisible()) {
                            textManager.getEdgeRenderer().drawTextEdge(obj);
                        }
                        obj.markTime = markTime;
                    }
                }
            }
            textManager.getEdgeRenderer().endRendering();
        }
    }
// octree.displayOctree(gl, glu);
}
Also used : VizModel(org.gephi.visualization.VizModel) NodeModel(org.gephi.visualization.model.node.NodeModel) EdgeModel(org.gephi.visualization.model.edge.EdgeModel)

Aggregations

VizModel (org.gephi.visualization.VizModel)9 JColorButton (org.gephi.ui.components.JColorButton)6 PropertyChangeEvent (java.beans.PropertyChangeEvent)4 PropertyChangeListener (java.beans.PropertyChangeListener)4 ItemEvent (java.awt.event.ItemEvent)3 ItemListener (java.awt.event.ItemListener)3 ChangeEvent (javax.swing.event.ChangeEvent)3 ChangeListener (javax.swing.event.ChangeListener)3 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 TextModelImpl (org.gephi.visualization.text.TextModelImpl)2 Color (java.awt.Color)1 Font (java.awt.Font)1 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)1 GraphIO (org.gephi.visualization.apiimpl.GraphIO)1 EdgeModel (org.gephi.visualization.model.edge.EdgeModel)1 NodeModel (org.gephi.visualization.model.node.NodeModel)1 ColorMode (org.gephi.visualization.text.ColorMode)1 SizeMode (org.gephi.visualization.text.SizeMode)1 TextManager (org.gephi.visualization.text.TextManager)1