Search in sources :

Example 6 with JColorButton

use of org.gephi.ui.components.JColorButton 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 7 with JColorButton

use of org.gephi.ui.components.JColorButton in project gephi by gephi.

the class DependantColorPanel method setup.

public void setup(DependantColorPropertyEditor propertyEditor) {
    this.propertyEditor = propertyEditor;
    DependantColor dependantColor = (DependantColor) propertyEditor.getValue();
    if (dependantColor.getMode().equals(DependantColor.Mode.CUSTOM)) {
        customRadio.setSelected(true);
        ((JColorButton) colorButton).setColor(dependantColor.getCustomColor());
    } else if (dependantColor.getMode().equals(DependantColor.Mode.PARENT)) {
        parentRadio.setSelected(true);
    }
}
Also used : JColorButton(org.gephi.ui.components.JColorButton) DependantColor(org.gephi.preview.types.DependantColor)

Example 8 with JColorButton

use of org.gephi.ui.components.JColorButton in project gephi by gephi.

the class DependantOriginalColorPanel method initComponents.

/** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
@SuppressWarnings("unchecked")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    buttonGroup1 = new javax.swing.ButtonGroup();
    jXHeader1 = new org.jdesktop.swingx.JXHeader();
    colorButton = new JColorButton(Color.BLACK);
    customRadio = new javax.swing.JRadioButton();
    originalRadio = new javax.swing.JRadioButton();
    parentRadio = new javax.swing.JRadioButton();
    // NOI18N
    jXHeader1.setDescription(org.openide.util.NbBundle.getMessage(DependantOriginalColorPanel.class, "DependantOriginalColorPanel.jXHeader1.description"));
    // NOI18N
    jXHeader1.setTitle(org.openide.util.NbBundle.getMessage(DependantOriginalColorPanel.class, "DependantOriginalColorPanel.jXHeader1.title"));
    buttonGroup1.add(customRadio);
    // NOI18N
    customRadio.setText(org.openide.util.NbBundle.getMessage(DependantOriginalColorPanel.class, "DependantOriginalColorPanel.customRadio.text"));
    buttonGroup1.add(originalRadio);
    // NOI18N
    originalRadio.setText(org.openide.util.NbBundle.getMessage(DependantOriginalColorPanel.class, "DependantOriginalColorPanel.originalRadio.text"));
    buttonGroup1.add(parentRadio);
    // NOI18N
    parentRadio.setText(org.openide.util.NbBundle.getMessage(DependantOriginalColorPanel.class, "DependantOriginalColorPanel.parentRadio.text"));
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(originalRadio).addContainerGap(360, Short.MAX_VALUE)).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(parentRadio).addContainerGap(365, Short.MAX_VALUE)).addComponent(jXHeader1, javax.swing.GroupLayout.DEFAULT_SIZE, 435, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(customRadio).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(colorButton).addContainerGap(326, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jXHeader1, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(18, 18, 18).addComponent(originalRadio).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(parentRadio).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(customRadio).addComponent(colorButton)).addGap(47, 47, 47)));
}
Also used : JColorButton(org.gephi.ui.components.JColorButton)

Example 9 with JColorButton

use of org.gephi.ui.components.JColorButton in project gephi by gephi.

the class EdgeColorPanel method setup.

public void setup(EdgeColorPropertyEditor propertyEditor) {
    this.propertyEditor = propertyEditor;
    EdgeColor edgeColor = (EdgeColor) propertyEditor.getValue();
    if (edgeColor.getMode().equals(EdgeColor.Mode.CUSTOM)) {
        customRadio.setSelected(true);
        ((JColorButton) colorButton).setColor(edgeColor.getCustomColor());
    } else if (edgeColor.getMode().equals(EdgeColor.Mode.MIXED)) {
        mixedRadio.setSelected(true);
    } else if (edgeColor.getMode().equals(EdgeColor.Mode.ORIGINAL)) {
        originalRadio.setSelected(true);
    } else if (edgeColor.getMode().equals(EdgeColor.Mode.SOURCE)) {
        sourceRadio.setSelected(true);
    } else if (edgeColor.getMode().equals(EdgeColor.Mode.TARGET)) {
        targetRadio.setSelected(true);
    }
}
Also used : EdgeColor(org.gephi.preview.types.EdgeColor) JColorButton(org.gephi.ui.components.JColorButton)

Example 10 with JColorButton

use of org.gephi.ui.components.JColorButton in project gephi by gephi.

the class EdgeColorPanel method initComponents.

/** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
@SuppressWarnings("unchecked")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    buttonGroup1 = new javax.swing.ButtonGroup();
    jXHeader1 = new org.jdesktop.swingx.JXHeader();
    originalRadio = new javax.swing.JRadioButton();
    mixedRadio = new javax.swing.JRadioButton();
    sourceRadio = new javax.swing.JRadioButton();
    targetRadio = new javax.swing.JRadioButton();
    customRadio = new javax.swing.JRadioButton();
    colorButton = new JColorButton(Color.BLACK);
    // NOI18N
    jXHeader1.setDescription(org.openide.util.NbBundle.getMessage(EdgeColorPanel.class, "EdgeColorPanel.jXHeader1.description"));
    // NOI18N
    jXHeader1.setTitle(org.openide.util.NbBundle.getMessage(EdgeColorPanel.class, "EdgeColorPanel.jXHeader1.title"));
    buttonGroup1.add(originalRadio);
    // NOI18N
    originalRadio.setText(org.openide.util.NbBundle.getMessage(EdgeColorPanel.class, "EdgeColorPanel.originalRadio.text"));
    buttonGroup1.add(mixedRadio);
    // NOI18N
    mixedRadio.setText(org.openide.util.NbBundle.getMessage(EdgeColorPanel.class, "EdgeColorPanel.mixedRadio.text"));
    buttonGroup1.add(sourceRadio);
    // NOI18N
    sourceRadio.setText(org.openide.util.NbBundle.getMessage(EdgeColorPanel.class, "EdgeColorPanel.sourceRadio.text"));
    buttonGroup1.add(targetRadio);
    // NOI18N
    targetRadio.setText(org.openide.util.NbBundle.getMessage(EdgeColorPanel.class, "EdgeColorPanel.targetRadio.text"));
    buttonGroup1.add(customRadio);
    // NOI18N
    customRadio.setText(org.openide.util.NbBundle.getMessage(EdgeColorPanel.class, "EdgeColorPanel.customRadio.text"));
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(originalRadio).addComponent(mixedRadio).addComponent(sourceRadio).addComponent(targetRadio).addGroup(layout.createSequentialGroup().addComponent(customRadio).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(colorButton))).addContainerGap(323, Short.MAX_VALUE)).addComponent(jXHeader1, javax.swing.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jXHeader1, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(originalRadio).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(mixedRadio).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(sourceRadio).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(targetRadio).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(customRadio).addComponent(colorButton)).addContainerGap(7, Short.MAX_VALUE)));
}
Also used : JColorButton(org.gephi.ui.components.JColorButton)

Aggregations

JColorButton (org.gephi.ui.components.JColorButton)22 VizModel (org.gephi.visualization.VizModel)6 ActionEvent (java.awt.event.ActionEvent)4 ActionListener (java.awt.event.ActionListener)4 ItemEvent (java.awt.event.ItemEvent)3 ItemListener (java.awt.event.ItemListener)3 PropertyChangeEvent (java.beans.PropertyChangeEvent)3 PropertyChangeListener (java.beans.PropertyChangeListener)3 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)3 ChangeEvent (javax.swing.event.ChangeEvent)3 ChangeListener (javax.swing.event.ChangeListener)3 Color (java.awt.Color)2 Font (java.awt.Font)2 TextModelImpl (org.gephi.visualization.text.TextModelImpl)2 BorderLayout (java.awt.BorderLayout)1 CardLayout (java.awt.CardLayout)1 Dimension (java.awt.Dimension)1 JButton (javax.swing.JButton)1 Edge (org.gephi.graph.api.Edge)1 Graph (org.gephi.graph.api.Graph)1