Search in sources :

Example 16 with ChangeEvent

use of javax.swing.event.ChangeEvent in project FBReaderJ by geometer.

the class ZLBooleanOptionView method createItem.

protected void createItem() {
    final ZLBooleanOptionEntry booleanEntry = (ZLBooleanOptionEntry) myOption;
    myCheckBox = new JCheckBox(myName);
    myCheckBox.setSelected(booleanEntry.initialState());
    myCheckBox.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            booleanEntry.onStateChanged(myCheckBox.isSelected());
        }
    });
    myTab.insertWidget(myCheckBox);
}
Also used : JCheckBox(javax.swing.JCheckBox) ZLBooleanOptionEntry(org.geometerplus.zlibrary.core.dialogs.ZLBooleanOptionEntry) ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener)

Example 17 with ChangeEvent

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

the class TextManager method initArchitecture.

@Override
public void initArchitecture() {
    model = VizController.getInstance().getVizModel().getTextModel();
    vizConfig = VizController.getInstance().getVizConfig();
    drawable = VizController.getInstance().getDrawable();
    //Settings
    antialised = vizConfig.isLabelAntialiased();
    mipmap = vizConfig.isLabelMipMap();
    fractionalMetrics = vizConfig.isLabelFractionalMetrics();
    //Init
    initRenderer();
    //Init sizemodes
    for (SizeMode s : sizeModes) {
        s.init();
    }
    //Model listening
    model.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            if (!nodeRenderer.getFont().equals(model.getNodeFont())) {
                nodeRenderer.setFont(model.getNodeFont());
            }
            if (!edgeRenderer.getFont().equals(model.getEdgeFont())) {
                edgeRenderer.setFont(model.getEdgeFont());
            }
            nodeRefresh = true;
            edgeRefresh = true;
        }
    });
    //Model change
    VizController.getInstance().getVizModel().addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("init")) {
                TextManager.this.model = VizController.getInstance().getVizModel().getTextModel();
                //Initialize columns if needed
                if (model.getNodeTextColumns() == null || model.getNodeTextColumns().length == 0) {
                    model.setTextColumns(new Column[0], new Column[0]);
                }
            }
        }
    });
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) ChangeEvent(javax.swing.event.ChangeEvent) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) Column(org.gephi.graph.api.Column) PropertyChangeListener(java.beans.PropertyChangeListener) ChangeListener(javax.swing.event.ChangeListener)

Example 18 with ChangeEvent

use of javax.swing.event.ChangeEvent 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 19 with ChangeEvent

use of javax.swing.event.ChangeEvent 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 20 with ChangeEvent

use of javax.swing.event.ChangeEvent 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)

Aggregations

ChangeEvent (javax.swing.event.ChangeEvent)164 ChangeListener (javax.swing.event.ChangeListener)130 JPanel (javax.swing.JPanel)45 ActionEvent (java.awt.event.ActionEvent)43 ActionListener (java.awt.event.ActionListener)38 JLabel (javax.swing.JLabel)30 GridBagConstraints (java.awt.GridBagConstraints)18 JButton (javax.swing.JButton)17 BorderLayout (java.awt.BorderLayout)16 JCheckBox (javax.swing.JCheckBox)16 JSpinner (javax.swing.JSpinner)16 SpinnerNumberModel (javax.swing.SpinnerNumberModel)16 GridBagLayout (java.awt.GridBagLayout)15 Dimension (java.awt.Dimension)14 PropertyChangeEvent (java.beans.PropertyChangeEvent)14 JSlider (javax.swing.JSlider)14 Insets (java.awt.Insets)13 ValidationPanel (org.netbeans.validation.api.ui.ValidationPanel)13 IOException (java.io.IOException)12 JTabbedPane (javax.swing.JTabbedPane)12