Search in sources :

Example 86 with ItemListener

use of java.awt.event.ItemListener in project gephi by gephi.

the class WelcomeTopComponent method loadPrefs.

private void loadPrefs() {
    Boolean openStartup = NbPreferences.forModule(WelcomeTopComponent.class).getBoolean(STARTUP_PREF, Boolean.TRUE);
    openOnStartupCheckbox.setSelected(openStartup);
    openOnStartupCheckbox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            NbPreferences.forModule(WelcomeTopComponent.class).putBoolean(STARTUP_PREF, openOnStartupCheckbox.isSelected());
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) ItemListener(java.awt.event.ItemListener)

Example 87 with ItemListener

use of java.awt.event.ItemListener in project gitblit by gitblit.

the class EditRepositoryDialog method initialize.

private void initialize(int protocolVersion, RepositoryModel anRepository) {
    nameField = new JTextField(anRepository.name == null ? "" : anRepository.name, 35);
    descriptionField = new JTextField(anRepository.description == null ? "" : anRepository.description, 35);
    JTextField originField = new JTextField(anRepository.origin == null ? "" : anRepository.origin, 40);
    originField.setEditable(false);
    if (ArrayUtils.isEmpty(anRepository.availableRefs)) {
        headRefField = new JComboBox();
        headRefField.setEnabled(false);
    } else {
        headRefField = new JComboBox(anRepository.availableRefs.toArray());
        headRefField.setSelectedItem(anRepository.HEAD);
    }
    Integer[] gcPeriods = { 1, 2, 3, 4, 5, 7, 10, 14 };
    gcPeriod = new JComboBox(gcPeriods);
    gcPeriod.setSelectedItem(anRepository.gcPeriod);
    gcThreshold = new JTextField(8);
    gcThreshold.setText(anRepository.gcThreshold);
    ownersPalette = new JPalette<String>(true);
    acceptNewTickets = new JCheckBox(Translation.get("gb.acceptsNewTicketsDescription"), anRepository.acceptNewTickets);
    acceptNewPatchsets = new JCheckBox(Translation.get("gb.acceptsNewPatchsetsDescription"), anRepository.acceptNewPatchsets);
    requireApproval = new JCheckBox(Translation.get("gb.requireApprovalDescription"), anRepository.requireApproval);
    if (ArrayUtils.isEmpty(anRepository.availableRefs)) {
        mergeToField = new JComboBox();
        mergeToField.setEnabled(false);
    } else {
        mergeToField = new JComboBox(anRepository.availableRefs.toArray());
        mergeToField.setSelectedItem(anRepository.mergeTo);
    }
    useIncrementalPushTags = new JCheckBox(Translation.get("gb.useIncrementalPushTagsDescription"), anRepository.useIncrementalPushTags);
    showRemoteBranches = new JCheckBox(Translation.get("gb.showRemoteBranchesDescription"), anRepository.showRemoteBranches);
    skipSizeCalculation = new JCheckBox(Translation.get("gb.skipSizeCalculationDescription"), anRepository.skipSizeCalculation);
    skipSummaryMetrics = new JCheckBox(Translation.get("gb.skipSummaryMetricsDescription"), anRepository.skipSummaryMetrics);
    isFrozen = new JCheckBox(Translation.get("gb.isFrozenDescription"), anRepository.isFrozen);
    maxActivityCommits = new JComboBox(new Integer[] { -1, 0, 25, 50, 75, 100, 150, 250, 500 });
    maxActivityCommits.setSelectedItem(anRepository.maxActivityCommits);
    mailingListsField = new JTextField(ArrayUtils.isEmpty(anRepository.mailingLists) ? "" : StringUtils.flattenStrings(anRepository.mailingLists, " "), 50);
    accessRestriction = new JComboBox(AccessRestrictionType.values());
    accessRestriction.setRenderer(new AccessRestrictionRenderer());
    accessRestriction.setSelectedItem(anRepository.accessRestriction);
    accessRestriction.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                AccessRestrictionType art = (AccessRestrictionType) accessRestriction.getSelectedItem();
                EditRepositoryDialog.this.setupAccessPermissions(art);
            }
        }
    });
    boolean authenticated = anRepository.authorizationControl != null && AuthorizationControl.AUTHENTICATED.equals(anRepository.authorizationControl);
    allowAuthenticated = new JRadioButton(Translation.get("gb.allowAuthenticatedDescription"));
    allowAuthenticated.setSelected(authenticated);
    allowAuthenticated.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                usersPalette.setEnabled(false);
                teamsPalette.setEnabled(false);
            }
        }
    });
    allowNamed = new JRadioButton(Translation.get("gb.allowNamedDescription"));
    allowNamed.setSelected(!authenticated);
    allowNamed.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                usersPalette.setEnabled(true);
                teamsPalette.setEnabled(true);
            }
        }
    });
    ButtonGroup group = new ButtonGroup();
    group.add(allowAuthenticated);
    group.add(allowNamed);
    JPanel authorizationPanel = new JPanel(new GridLayout(0, 1));
    authorizationPanel.add(allowAuthenticated);
    authorizationPanel.add(allowNamed);
    allowForks = new JCheckBox(Translation.get("gb.allowForksDescription"), anRepository.allowForks);
    verifyCommitter = new JCheckBox(Translation.get("gb.verifyCommitterDescription"), anRepository.verifyCommitter);
    // federation strategies - remove ORIGIN choice if this repository has
    // no origin.
    List<FederationStrategy> federationStrategies = new ArrayList<FederationStrategy>(Arrays.asList(FederationStrategy.values()));
    if (StringUtils.isEmpty(anRepository.origin)) {
        federationStrategies.remove(FederationStrategy.FEDERATE_ORIGIN);
    }
    federationStrategy = new JComboBox(federationStrategies.toArray());
    federationStrategy.setRenderer(new FederationStrategyRenderer());
    federationStrategy.setSelectedItem(anRepository.federationStrategy);
    JPanel fieldsPanel = new JPanel(new GridLayout(0, 1));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.name"), nameField));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.description"), descriptionField));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.origin"), originField));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.headRef"), headRefField));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.gcPeriod"), gcPeriod));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.gcThreshold"), gcThreshold));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.acceptsNewTickets"), acceptNewTickets));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.acceptsNewPatchsets"), acceptNewPatchsets));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.requireApproval"), requireApproval));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.mergeTo"), mergeToField));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.enableIncrementalPushTags"), useIncrementalPushTags));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.showRemoteBranches"), showRemoteBranches));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.skipSizeCalculation"), skipSizeCalculation));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.skipSummaryMetrics"), skipSummaryMetrics));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.maxActivityCommits"), maxActivityCommits));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.mailingLists"), mailingListsField));
    JPanel clonePushPanel = new JPanel(new GridLayout(0, 1));
    clonePushPanel.add(newFieldPanel(Translation.get("gb.isFrozen"), isFrozen));
    clonePushPanel.add(newFieldPanel(Translation.get("gb.allowForks"), allowForks));
    clonePushPanel.add(newFieldPanel(Translation.get("gb.verifyCommitter"), verifyCommitter));
    usersPalette = new RegistrantPermissionsPanel(RegistrantType.USER);
    JPanel northFieldsPanel = new JPanel(new BorderLayout(0, 5));
    northFieldsPanel.add(newFieldPanel(Translation.get("gb.owners"), ownersPalette), BorderLayout.NORTH);
    northFieldsPanel.add(newFieldPanel(Translation.get("gb.accessRestriction"), accessRestriction), BorderLayout.CENTER);
    JPanel northAccessPanel = new JPanel(new BorderLayout(5, 5));
    northAccessPanel.add(northFieldsPanel, BorderLayout.NORTH);
    northAccessPanel.add(newFieldPanel(Translation.get("gb.authorizationControl"), authorizationPanel), BorderLayout.CENTER);
    northAccessPanel.add(clonePushPanel, BorderLayout.SOUTH);
    JPanel accessPanel = new JPanel(new BorderLayout(5, 5));
    accessPanel.add(northAccessPanel, BorderLayout.NORTH);
    accessPanel.add(newFieldPanel(Translation.get("gb.userPermissions"), usersPalette), BorderLayout.CENTER);
    teamsPalette = new RegistrantPermissionsPanel(RegistrantType.TEAM);
    JPanel teamsPanel = new JPanel(new BorderLayout(5, 5));
    teamsPanel.add(newFieldPanel(Translation.get("gb.teamPermissions"), teamsPalette), BorderLayout.CENTER);
    setsPalette = new JPalette<String>();
    JPanel federationPanel = new JPanel(new BorderLayout(5, 5));
    federationPanel.add(newFieldPanel(Translation.get("gb.federationStrategy"), federationStrategy), BorderLayout.NORTH);
    federationPanel.add(newFieldPanel(Translation.get("gb.federationSets"), setsPalette), BorderLayout.CENTER);
    indexedBranchesPalette = new JPalette<String>();
    JPanel indexedBranchesPanel = new JPanel(new BorderLayout(5, 5));
    indexedBranchesPanel.add(newFieldPanel(Translation.get("gb.indexedBranches"), indexedBranchesPalette), BorderLayout.CENTER);
    preReceivePalette = new JPalette<String>(true);
    preReceiveInherited = new JLabel();
    JPanel preReceivePanel = new JPanel(new BorderLayout(5, 5));
    preReceivePanel.add(preReceivePalette, BorderLayout.CENTER);
    preReceivePanel.add(preReceiveInherited, BorderLayout.WEST);
    postReceivePalette = new JPalette<String>(true);
    postReceiveInherited = new JLabel();
    JPanel postReceivePanel = new JPanel(new BorderLayout(5, 5));
    postReceivePanel.add(postReceivePalette, BorderLayout.CENTER);
    postReceivePanel.add(postReceiveInherited, BorderLayout.WEST);
    customFieldsPanel = new JPanel();
    customFieldsPanel.setLayout(new BoxLayout(customFieldsPanel, BoxLayout.Y_AXIS));
    JScrollPane customFieldsScrollPane = new JScrollPane(customFieldsPanel);
    customFieldsScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    customFieldsScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    JTabbedPane panel = new JTabbedPane(JTabbedPane.TOP);
    panel.addTab(Translation.get("gb.general"), fieldsPanel);
    panel.addTab(Translation.get("gb.accessRestriction"), accessPanel);
    if (protocolVersion >= 2) {
        panel.addTab(Translation.get("gb.teams"), teamsPanel);
    }
    panel.addTab(Translation.get("gb.federation"), federationPanel);
    if (protocolVersion >= 3) {
        panel.addTab(Translation.get("gb.indexedBranches"), indexedBranchesPanel);
    }
    panel.addTab(Translation.get("gb.preReceiveScripts"), preReceivePanel);
    panel.addTab(Translation.get("gb.postReceiveScripts"), postReceivePanel);
    panel.addTab(Translation.get("gb.customFields"), customFieldsScrollPane);
    setupAccessPermissions(anRepository.accessRestriction);
    JButton createButton = new JButton(Translation.get("gb.save"));
    createButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            if (validateFields()) {
                canceled = false;
                setVisible(false);
            }
        }
    });
    JButton cancelButton = new JButton(Translation.get("gb.cancel"));
    cancelButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            canceled = true;
            setVisible(false);
        }
    });
    JPanel controls = new JPanel();
    controls.add(cancelButton);
    controls.add(createButton);
    final Insets _insets = new Insets(5, 5, 5, 5);
    JPanel centerPanel = new JPanel(new BorderLayout(5, 5)) {

        private static final long serialVersionUID = 1L;

        @Override
        public Insets getInsets() {
            return _insets;
        }
    };
    centerPanel.add(panel, BorderLayout.CENTER);
    centerPanel.add(controls, BorderLayout.SOUTH);
    getContentPane().setLayout(new BorderLayout(5, 5));
    getContentPane().add(centerPanel, BorderLayout.CENTER);
    pack();
    nameField.requestFocus();
}
Also used : JPanel(javax.swing.JPanel) ItemEvent(java.awt.event.ItemEvent) JRadioButton(javax.swing.JRadioButton) Insets(java.awt.Insets) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JTabbedPane(javax.swing.JTabbedPane) ArrayList(java.util.ArrayList) JButton(javax.swing.JButton) JTextField(javax.swing.JTextField) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) AccessRestrictionType(com.gitblit.Constants.AccessRestrictionType) JScrollPane(javax.swing.JScrollPane) JComboBox(javax.swing.JComboBox) FederationStrategy(com.gitblit.Constants.FederationStrategy) JLabel(javax.swing.JLabel) JCheckBox(javax.swing.JCheckBox) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) ItemListener(java.awt.event.ItemListener)

Example 88 with ItemListener

use of java.awt.event.ItemListener in project gephi by gephi.

the class AppearanceTopComponent method refreshCombo.

private void refreshCombo() {
    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            final DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel();
            if (model != null) {
                TransformerUI ui = model.getSelectedTransformerUI();
                if (ui != null && model.isAttributeTransformerUI(ui)) {
                    //Ranking
                    Function selectedColumn = model.getSelectedFunction();
                    attibuteBox.removeItemListener(attributeListener);
                    comboBoxModel.addElement(NO_SELECTION);
                    comboBoxModel.setSelectedItem(NO_SELECTION);
                    List<Function> rows = new ArrayList<>();
                    rows.addAll(model.getFunctions());
                    Collections.sort(rows, new Comparator<Function>() {

                        @Override
                        public int compare(Function o1, Function o2) {
                            if (o1.isAttribute() && !o2.isAttribute()) {
                                return 1;
                            } else if (!o1.isAttribute() && o2.isAttribute()) {
                                return -1;
                            }
                            return o1.toString().compareTo(o2.toString());
                        }
                    });
                    for (Function r : rows) {
                        comboBoxModel.addElement(r);
                        if (selectedColumn != null && selectedColumn.equals(r)) {
                            comboBoxModel.setSelectedItem(r);
                        }
                    }
                    attributeListener = new ItemListener() {

                        @Override
                        public void itemStateChanged(ItemEvent e) {
                            if (model != null) {
                                if (!attibuteBox.getSelectedItem().equals(NO_SELECTION)) {
                                    Function selectedItem = (Function) attibuteBox.getSelectedItem();
                                    Function selectedFunction = model.getSelectedFunction();
                                    if (selectedFunction != selectedItem) {
                                        controller.setSelectedFunction(selectedItem);
                                    }
                                } else {
                                    controller.setSelectedFunction(null);
                                }
                            }
                        }
                    };
                    attibuteBox.addItemListener(attributeListener);
                }
            }
            attibuteBox.setModel(comboBoxModel);
        }
    });
}
Also used : Function(org.gephi.appearance.api.Function) RankingFunction(org.gephi.appearance.api.RankingFunction) AttributeFunction(org.gephi.appearance.api.AttributeFunction) ItemEvent(java.awt.event.ItemEvent) ArrayList(java.util.ArrayList) List(java.util.List) ItemListener(java.awt.event.ItemListener) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) TransformerUI(org.gephi.appearance.spi.TransformerUI) Comparator(java.util.Comparator)

Example 89 with ItemListener

use of java.awt.event.ItemListener 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)

Example 90 with ItemListener

use of java.awt.event.ItemListener in project gephi by gephi.

the class LabelSettingsPanel method setup.

public void setup() {
    VizModel vizModel = VizController.getInstance().getVizModel();
    TextModelImpl model = vizModel.getTextModel();
    vizModel.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("init")) {
                refreshSharedConfig();
            }
        }
    });
    //NodePanel
    showNodeLabelsCheckbox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            boolean value = showNodeLabelsCheckbox.isSelected();
            TextModelImpl model = VizController.getInstance().getVizModel().getTextModel();
            if (value != model.isShowNodeLabels()) {
                model.setShowNodeLabels(value);
                setEnable(true);
            }
        }
    });
    nodeFontButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            TextModelImpl model = VizController.getInstance().getVizModel().getTextModel();
            Font font = JFontChooser.showDialog(WindowManager.getDefault().getMainWindow(), model.getNodeFont());
            if (font != null && font != model.getNodeFont()) {
                model.setNodeFont(font);
            }
        }
    });
    ((JColorButton) nodeColorButton).addPropertyChangeListener(JColorButton.EVENT_COLOR, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            TextModelImpl model = VizController.getInstance().getVizModel().getTextModel();
            if (!model.getNodeColor().equals(((JColorButton) nodeColorButton).getColor())) {
                model.setNodeColor(((JColorButton) nodeColorButton).getColor());
            }
        }
    });
    nodeSizeSlider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            TextModelImpl model = VizController.getInstance().getVizModel().getTextModel();
            if (model.getNodeSizeFactor() != nodeSizeSlider.getValue() / 100f) {
                model.setNodeSizeFactor(nodeSizeSlider.getValue() / 100f);
            }
        }
    });
    //EdgePanel
    showEdgeLabelsCheckbox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            boolean value = showEdgeLabelsCheckbox.isSelected();
            TextModelImpl model = VizController.getInstance().getVizModel().getTextModel();
            if (value != model.isShowEdgeLabels()) {
                model.setShowEdgeLabels(value);
                setEnable(true);
            }
        }
    });
    edgeFontButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            TextModelImpl model = VizController.getInstance().getVizModel().getTextModel();
            Font font = JFontChooser.showDialog(WindowManager.getDefault().getMainWindow(), model.getEdgeFont());
            if (font != null && font != model.getEdgeFont()) {
                model.setEdgeFont(font);
            }
        }
    });
    ((JColorButton) edgeColorButton).addPropertyChangeListener(JColorButton.EVENT_COLOR, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            TextModelImpl model = VizController.getInstance().getVizModel().getTextModel();
            if (!model.getEdgeColor().equals(((JColorButton) edgeColorButton).getColor())) {
                model.setEdgeColor(((JColorButton) edgeColorButton).getColor());
            }
        }
    });
    edgeSizeSlider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            TextModelImpl model = VizController.getInstance().getVizModel().getTextModel();
            model.setEdgeSizeFactor(edgeSizeSlider.getValue() / 100f);
        }
    });
    //General
    final TextManager textManager = VizController.getInstance().getTextManager();
    final DefaultComboBoxModel sizeModeModel = new DefaultComboBoxModel(textManager.getSizeModes());
    sizeModeCombo.setModel(sizeModeModel);
    final DefaultComboBoxModel colorModeModel = new DefaultComboBoxModel(textManager.getColorModes());
    colorModeCombo.setModel(colorModeModel);
    sizeModeCombo.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            TextModelImpl model = VizController.getInstance().getVizModel().getTextModel();
            if (model.getSizeMode() != sizeModeModel.getSelectedItem()) {
                model.setSizeMode((SizeMode) sizeModeModel.getSelectedItem());
            }
        }
    });
    colorModeCombo.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            TextModelImpl model = VizController.getInstance().getVizModel().getTextModel();
            if (model.getColorMode() != colorModeModel.getSelectedItem()) {
                model.setColorMode((ColorMode) colorModeModel.getSelectedItem());
            }
        }
    });
    hideNonSelectedCheckbox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            TextModelImpl model = VizController.getInstance().getVizModel().getTextModel();
            if (model.isSelectedOnly() != hideNonSelectedCheckbox.isSelected()) {
                model.setSelectedOnly(hideNonSelectedCheckbox.isSelected());
            }
        }
    });
    //Attributes
    configureLabelsButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            TextModelImpl model = VizController.getInstance().getVizModel().getTextModel();
            LabelAttributesPanel panel = new LabelAttributesPanel();
            panel.setup(model);
            DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(VizBarController.class, "LabelAttributesPanel.title"), true, NotifyDescriptor.OK_CANCEL_OPTION, null, null);
            if (DialogDisplayer.getDefault().notify(dd).equals(NotifyDescriptor.OK_OPTION)) {
                panel.unsetup();
                return;
            }
        }
    });
    //Evt
    model.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            refreshSharedConfig();
        }
    });
    refreshSharedConfig();
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) ItemEvent(java.awt.event.ItemEvent) TextManager(org.gephi.visualization.text.TextManager) PropertyChangeListener(java.beans.PropertyChangeListener) ActionEvent(java.awt.event.ActionEvent) ColorMode(org.gephi.visualization.text.ColorMode) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) Font(java.awt.Font) JColorButton(org.gephi.ui.components.JColorButton) VizModel(org.gephi.visualization.VizModel) ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) PropertyChangeEvent(java.beans.PropertyChangeEvent) SizeMode(org.gephi.visualization.text.SizeMode) TextModelImpl(org.gephi.visualization.text.TextModelImpl) DialogDescriptor(org.openide.DialogDescriptor) ItemListener(java.awt.event.ItemListener) PropertyChangeListener(java.beans.PropertyChangeListener) ChangeListener(javax.swing.event.ChangeListener)

Aggregations

ItemListener (java.awt.event.ItemListener)162 ItemEvent (java.awt.event.ItemEvent)154 ActionEvent (java.awt.event.ActionEvent)45 ActionListener (java.awt.event.ActionListener)43 JCheckBox (javax.swing.JCheckBox)33 JPanel (javax.swing.JPanel)27 JLabel (javax.swing.JLabel)23 JComboBox (javax.swing.JComboBox)18 BoxLayout (javax.swing.BoxLayout)15 JTextField (javax.swing.JTextField)14 DocumentEvent (javax.swing.event.DocumentEvent)13 JButton (javax.swing.JButton)12 ChangeEvent (javax.swing.event.ChangeEvent)12 Dimension (java.awt.Dimension)11 ChangeListener (javax.swing.event.ChangeListener)11 GridBagConstraints (java.awt.GridBagConstraints)10 GridLayout (java.awt.GridLayout)10 Box (javax.swing.Box)10 GridBagLayout (java.awt.GridBagLayout)9 BorderLayout (java.awt.BorderLayout)8