Search in sources :

Example 31 with ChangeListener

use of javax.swing.event.ChangeListener in project gephi by gephi.

the class WizardPanel1 method fireChangeEvent.

protected final void fireChangeEvent() {
    Iterator<ChangeListener> it;
    synchronized (listeners) {
        it = new HashSet<>(listeners).iterator();
    }
    ChangeEvent ev = new ChangeEvent(this);
    while (it.hasNext()) {
        it.next().stateChanged(ev);
    }
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) HashSet(java.util.HashSet)

Example 32 with ChangeListener

use of javax.swing.event.ChangeListener in project gephi by gephi.

the class ImportCSVUIWizardPanel1 method fireChangeEvent.

protected final void fireChangeEvent() {
    Iterator<ChangeListener> it;
    synchronized (listeners) {
        it = new HashSet<>(listeners).iterator();
    }
    ChangeEvent ev = new ChangeEvent(this);
    while (it.hasNext()) {
        it.next().stateChanged(ev);
    }
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) HashSet(java.util.HashSet)

Example 33 with ChangeListener

use of javax.swing.event.ChangeListener in project gephi by gephi.

the class ImportCSVUIWizardPanel2 method fireChangeEvent.

protected final void fireChangeEvent() {
    Iterator<ChangeListener> it;
    synchronized (listeners) {
        it = new HashSet<>(listeners).iterator();
    }
    ChangeEvent ev = new ChangeEvent(this);
    while (it.hasNext()) {
        it.next().stateChanged(ev);
    }
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) HashSet(java.util.HashSet)

Example 34 with ChangeListener

use of javax.swing.event.ChangeListener 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 35 with ChangeListener

use of javax.swing.event.ChangeListener in project gephi by gephi.

the class SelectionBar method createPopup.

public JPopupMenu createPopup() {
    SelectionManager manager = VizController.getInstance().getSelectionManager();
    final MouseSelectionPopupPanel popupPanel = new MouseSelectionPopupPanel();
    popupPanel.setDiameter(manager.getMouseSelectionDiameter());
    popupPanel.setProportionnalToZoom(manager.isMouseSelectionZoomProportionnal());
    popupPanel.setChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            SelectionManager manager = VizController.getInstance().getSelectionManager();
            manager.setMouseSelectionDiameter(popupPanel.getDiameter());
            manager.setMouseSelectionZoomProportionnal(popupPanel.isProportionnalToZoom());
        }
    });
    JPopupMenu menu = new JPopupMenu();
    menu.add(popupPanel);
    return menu;
}
Also used : SelectionManager(org.gephi.visualization.api.selection.SelectionManager) ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) JPopupMenu(javax.swing.JPopupMenu)

Aggregations

ChangeListener (javax.swing.event.ChangeListener)472 ChangeEvent (javax.swing.event.ChangeEvent)449 ActionEvent (java.awt.event.ActionEvent)170 ActionListener (java.awt.event.ActionListener)164 Dimension (java.awt.Dimension)160 JPanel (javax.swing.JPanel)136 Point (java.awt.Point)108 JLabel (javax.swing.JLabel)98 JSlider (javax.swing.JSlider)69 JButton (javax.swing.JButton)66 JCheckBox (javax.swing.JCheckBox)55 MouseEvent (java.awt.event.MouseEvent)47 BorderLayout (java.awt.BorderLayout)46 GridBagConstraints (java.awt.GridBagConstraints)42 GridBagLayout (java.awt.GridBagLayout)39 MouseAdapter (java.awt.event.MouseAdapter)39 Insets (java.awt.Insets)37 PropertyChangeListener (java.beans.PropertyChangeListener)35 PropertyChangeEvent (java.beans.PropertyChangeEvent)34 ItemEvent (java.awt.event.ItemEvent)33