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);
}
}
}
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");
}
};
}
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());
}
}
});
}
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);
}
});
}
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();
}
Aggregations