Search in sources :

Example 1 with GraphIO

use of org.gephi.visualization.apiimpl.GraphIO in project gephi by gephi.

the class GlobalSettingsPanel 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("backgroundColor")) {
                refreshSharedConfig();
            } else if (evt.getPropertyName().equals("autoSelectNeighbor")) {
                refreshSharedConfig();
            } else if (evt.getPropertyName().equals("lightenNonSelectedAuto")) {
                refreshSharedConfig();
            } else if (evt.getPropertyName().equals("use3d")) {
                refreshSharedConfig();
            }
        }
    });
    refreshSharedConfig();
    hightlightCheckBox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            VizModel vizModel = VizController.getInstance().getVizModel();
            vizModel.setLightenNonSelectedAuto(hightlightCheckBox.isSelected());
        }
    });
    ((JColorButton) backgroundColorButton).addPropertyChangeListener(JColorButton.EVENT_COLOR, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            VizModel vizModel = VizController.getInstance().getVizModel();
            vizModel.setBackgroundColor(((JColorButton) backgroundColorButton).getColor());
        }
    });
    autoSelectNeigborCheckbox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            VizModel vizModel = VizController.getInstance().getVizModel();
            vizModel.setAutoSelectNeighbor(autoSelectNeigborCheckbox.isSelected());
        }
    });
    zoomSlider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            int cam = (int) VizController.getInstance().getVizModel().getCameraDistance();
            if (zoomSlider.getValue() != cam && cam < zoomSlider.getMaximum()) {
                GraphIO io = VizController.getInstance().getGraphIO();
                io.setCameraDistance(zoomSlider.getValue());
            }
        }
    });
}
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) ChangeEvent(javax.swing.event.ChangeEvent) PropertyChangeEvent(java.beans.PropertyChangeEvent) ItemListener(java.awt.event.ItemListener) PropertyChangeListener(java.beans.PropertyChangeListener) ChangeListener(javax.swing.event.ChangeListener) GraphIO(org.gephi.visualization.apiimpl.GraphIO)

Aggregations

ItemEvent (java.awt.event.ItemEvent)1 ItemListener (java.awt.event.ItemListener)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 ChangeEvent (javax.swing.event.ChangeEvent)1 ChangeListener (javax.swing.event.ChangeListener)1 JColorButton (org.gephi.ui.components.JColorButton)1 VizModel (org.gephi.visualization.VizModel)1 GraphIO (org.gephi.visualization.apiimpl.GraphIO)1