Search in sources :

Example 1 with JColorButton

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

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

the class PreviewTopComponent 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.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;
    southBusyLabel = new JXBusyLabel(new Dimension(14, 14));
    bannerPanel = new javax.swing.JPanel();
    bannerLabel = new javax.swing.JLabel();
    refreshButton = new javax.swing.JButton();
    previewPanel = new javax.swing.JPanel();
    sketchPanel = new javax.swing.JPanel();
    refreshPanel = new javax.swing.JPanel();
    busyLabel = new JXBusyLabel(new Dimension(20, 20));
    southToolbar = new javax.swing.JToolBar();
    backgroundButton = new JColorButton(Color.WHITE);
    resetZoomButton = new javax.swing.JButton();
    minusButton = new javax.swing.JButton();
    plusButton = new javax.swing.JButton();
    setLayout(new java.awt.GridBagLayout());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
    add(southBusyLabel, gridBagConstraints);
    bannerPanel.setBackground(new java.awt.Color(178, 223, 240));
    bannerPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK));
    bannerPanel.setLayout(new java.awt.GridBagLayout());
    // NOI18N
    bannerLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/desktop/preview/resources/info.png")));
    // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(bannerLabel, org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.bannerLabel.text"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
    bannerPanel.add(bannerLabel, gridBagConstraints);
    // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(refreshButton, org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.refreshButton.text"));
    refreshButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            refreshButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(1, 0, 1, 1);
    bannerPanel.add(refreshButton, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    add(bannerPanel, gridBagConstraints);
    previewPanel.setLayout(new java.awt.CardLayout());
    sketchPanel.setBackground(new java.awt.Color(255, 255, 255));
    sketchPanel.setPreferredSize(new java.awt.Dimension(500, 500));
    sketchPanel.setLayout(new java.awt.BorderLayout());
    previewPanel.add(sketchPanel, "previewCard");
    refreshPanel.setOpaque(false);
    refreshPanel.setLayout(new java.awt.GridBagLayout());
    busyLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(busyLabel, org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.busyLabel.text"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    refreshPanel.add(busyLabel, gridBagConstraints);
    previewPanel.add(refreshPanel, "refreshCard");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    add(previewPanel, gridBagConstraints);
    southToolbar.setFloatable(false);
    southToolbar.setRollover(true);
    // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(backgroundButton, org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.backgroundButton.text"));
    backgroundButton.setFocusable(false);
    southToolbar.add(backgroundButton);
    // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(resetZoomButton, org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.resetZoomButton.text"));
    resetZoomButton.setFocusable(false);
    resetZoomButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    resetZoomButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    southToolbar.add(resetZoomButton);
    // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(minusButton, "-");
    // NOI18N
    minusButton.setToolTipText(org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.minusButton.toolTipText"));
    minusButton.setFocusable(false);
    minusButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    minusButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    southToolbar.add(minusButton);
    // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(plusButton, "+");
    // NOI18N
    plusButton.setToolTipText(org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.plusButton.toolTipText"));
    plusButton.setFocusable(false);
    plusButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    plusButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    southToolbar.add(plusButton);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    add(southToolbar, gridBagConstraints);
}
Also used : Color(java.awt.Color) JXBusyLabel(org.jdesktop.swingx.JXBusyLabel) ActionListener(java.awt.event.ActionListener) CardLayout(java.awt.CardLayout) Dimension(java.awt.Dimension) ActionEvent(java.awt.event.ActionEvent) JColorButton(org.gephi.ui.components.JColorButton) Dimension(java.awt.Dimension) BorderLayout(java.awt.BorderLayout)

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