Search in sources :

Example 61 with ItemListener

use of java.awt.event.ItemListener in project processdash by dtuma.

the class DashHierarchy method fireDataFileChange.

// Notify all listeners that have registered interest for
// notification on this event type.  The event instance
// is created using the parameters passed into the fire method.
// For the moment, the only events that will generate these events are:
// setChildKey/move(CHANGE), copyFrom(CREATE), removeChildKey/remove(DELETE)
protected void fireDataFileChange(PendingDataChange item) {
    // Guaranteed to return a non-null array
    Object[] listeners = ell.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    ItemEvent fooEvent = new ItemEvent(this, 0, item, 0);
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
        if (listeners[i] == ItemListener.class) {
            ((ItemListener) listeners[i + 1]).itemStateChanged(fooEvent);
        }
    }
}
Also used : ItemEvent(java.awt.event.ItemEvent) EventObject(java.util.EventObject) ItemListener(java.awt.event.ItemListener)

Example 62 with ItemListener

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

the class Input0 method testMethod3.

//should give an ncss of 12
private void testMethod3() {
    int a = 0;
    switch(a) {
        //falls through
        case 1:
        case 2:
            System.identityHashCode("Hello");
            break;
        default:
            break;
    }
    ItemListener lis = new ItemListener() {

        //should give an ncss of 2
        public void itemStateChanged(ItemEvent e) {
            System.identityHashCode("Hello");
        }
    };
}
Also used : ItemEvent(java.awt.event.ItemEvent) ItemListener(java.awt.event.ItemListener)

Example 63 with ItemListener

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

the class DynamicRangePanel method setup.

public void setup(final DynamicRangeFilter filter) {
    final BottomComponent bottomComponent = Lookup.getDefault().lookup(BottomComponent.class);
    timelineButton.setText(bottomComponent.isVisible() ? CLOSE : OPEN);
    timelineButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (!bottomComponent.isVisible()) {
                bottomComponent.setVisible(true);
                timelineButton.setText(CLOSE);
            } else {
                bottomComponent.setVisible(false);
                timelineButton.setText(OPEN);
            }
        }
    });
    keepEmptyCheckbox.setSelected(filter.isKeepNull());
    keepEmptyCheckbox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (!filter.isKeepNull() == keepEmptyCheckbox.isSelected()) {
                filter.getProperties()[1].setValue(keepEmptyCheckbox.isSelected());
            }
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) ItemListener(java.awt.event.ItemListener) BottomComponent(org.gephi.desktop.banner.perspective.spi.BottomComponent)

Example 64 with ItemListener

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

the class UIExporterPDFPanel method initEvents.

private void initEvents() {
    pageSizeCombo.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            Object selectedItem = pageSizeCombo.getSelectedItem();
            if (selectedItem != customSizeString) {
                PageSizeItem pageSize = (PageSizeItem) selectedItem;
                setPageSize(pageSize);
            }
        }
    });
    widthTextField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            updatePageSize();
        }
    });
    heightTextField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            updatePageSize();
        }
    });
    unitLink.setAction(new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            millimeter = !millimeter;
            refreshUnit(true);
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) ItemListener(java.awt.event.ItemListener) AbstractAction(javax.swing.AbstractAction)

Example 65 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)

Aggregations

ItemListener (java.awt.event.ItemListener)120 ItemEvent (java.awt.event.ItemEvent)119 ActionEvent (java.awt.event.ActionEvent)34 ActionListener (java.awt.event.ActionListener)31 JCheckBox (javax.swing.JCheckBox)21 JPanel (javax.swing.JPanel)14 JComboBox (javax.swing.JComboBox)10 JLabel (javax.swing.JLabel)10 DocumentEvent (javax.swing.event.DocumentEvent)10 JButton (javax.swing.JButton)9 ArrayList (java.util.ArrayList)8 ChangeEvent (javax.swing.event.ChangeEvent)8 ChangeListener (javax.swing.event.ChangeListener)8 DocumentAdapter (com.intellij.ui.DocumentAdapter)7 GridBagConstraints (java.awt.GridBagConstraints)7 BorderLayout (java.awt.BorderLayout)6 GridBagLayout (java.awt.GridBagLayout)6 Insets (java.awt.Insets)5 List (java.util.List)5 BoxLayout (javax.swing.BoxLayout)5