/** * This method initializes projectSelector. * @return javax.swing.JComboBox */ @SuppressWarnings("unchecked") private JComboBox<Project> getProjectSelector() { if (projectSelector == null) { projectSelector = new JComboBox<Project>(new EventComboBoxModel<Project>(model.getProjectList())); } return projectSelector; }
/** * Sets the currently selected item. * * <p>The selection notification process is very much a hack. This fires * a ListDataEvent where the range is between -1 and -1. This is identical * to the notification process used by the {@link DefaultComboBoxModel}. */ public void setSelectedItem(Object selected) { // if the selected item isn't actually changing values, avoid the work if (this.selected == selected) return; this.selected = selected; listDataEvent.setRange(-1, -1); listDataEvent.setType(ListDataEvent.CONTENTS_CHANGED); fireListDataEvent(listDataEvent); } }
/** * Sets the currently selected item. * * <p>The selection notification process is very much a hack. This fires * a ListDataEvent where the range is between -1 and -1. This is identical * to the notification process used by the {@link DefaultComboBoxModel}. */ public void setSelectedItem(Object selected) { // if the selected item isn't actually changing values, avoid the work if (this.selected == selected) return; this.selected = selected; listDataEvent.setRange(-1, -1); listDataEvent.setType(ListDataEvent.CONTENTS_CHANGED); fireListDataEvent(listDataEvent); } }
/** * Constructor. * * @param fileList * List of paths that will be dynamically updated. */ public ComboFilePath(EventList<String> fileList) { this.field = new JComboBox(new EventComboBoxModel<String>(fileList)); this.field.setEditable(true); this.field.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String text = getFilePath(); fireNewPath(text); } }); }
/** * Sets the currently selected item. * * <p>The selection notification process is very much a hack. This fires * a ListDataEvent where the range is between -1 and -1. This is identical * to the notification process used by the {@link DefaultComboBoxModel}. */ @Override public void setSelectedItem(Object selected) { // if the selected item isn't actually changing values, avoid the work if (this.selected == selected) return; this.selected = selected; listDataEvent.setRange(-1, -1); listDataEvent.setType(ListDataEvent.CONTENTS_CHANGED); fireListDataEvent(listDataEvent); } }
/** * This method initializes projectSelector. * @return javax.swing.JComboBox */ @SuppressWarnings("unchecked") private JComboBox<Project> getProjectSelector() { if (projectSelector == null) { projectSelector = new JComboBox<Project>(); projectSelector.setToolTipText(textBundle.textFor("SelectLastActionPanel.ProjectSelector.Hint")); //$NON-NLS-1$ projectSelector.setModel(new EventComboBoxModel<Project>(this.model.getProjectList())); } return projectSelector; }
/** * This method initializes projectSelector. * * @return javax.swing.JComboBox */ @SuppressWarnings("unchecked") private JComboBox<Project> getProjectSelector() { if (projectSelector == null) { projectSelector = new JComboBox<Project>(); projectSelector.setToolTipText(textBundle.textFor("SelectNextActionPanel.ProjectSelector.Hint")); //$NON-NLS-1$ projectSelector.setModel(new EventComboBoxModel<Project>(this.model.getProjectList())); } return projectSelector; }
/** * This method initializes projectSelector. * @return javax.swing.JComboBox */ @SuppressWarnings("unchecked") private JComboBox<Project> getProjectSelector() { if (projectSelector == null) { projectSelector = new JComboBox<>(); projectSelector.setToolTipText(textBundle.textFor("ProjectSelector.ToolTipText")); //$NON-NLS-1$ projectSelector.setModel(new EventComboBoxModel<>(this.model.getProjectList())); /* Handling of selection events: */ projectSelector.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { // 1. Set current project to the just selected project. final Project selectedProject = (Project) projectSelector.getSelectedItem(); ActivityPanelStopWatch.this.model.changeProject(selectedProject); } }); } return projectSelector; }
/** * This method initializes projectSelector. * @return javax.swing.JComboBox */ @SuppressWarnings("unchecked") private JComboBox<Project> getProjectSelector() { if (projectSelector == null) { projectSelector = new JComboBox<Project>(); projectSelector.setToolTipText(textBundle.textFor("ProjectSelector.ToolTipText")); //$NON-NLS-1$ projectSelector.setModel(new EventComboBoxModel<Project>(this.model.getProjectList())); /* Handling of selection events: */ projectSelector.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { // 1. Set current project to the just selected project. final Project selectedProject = (Project) projectSelector.getSelectedItem(); ActivityPanel.this.model.changeProject(selectedProject); // 2. Clear the description. if (descriptionEditor != null) { descriptionEditor.setText(""); } } }); } return projectSelector; }
/** * @return the projectFilterSelector */ private JComboBox getProjectFilterSelector() { if (projectFilterSelector == null) { projectFilterList = model.getProjectFilterList(); projectFilterSelector = new JComboBox( new EventComboBoxModel<LabeledItem<Project>>(projectFilterList.getProjectList()) ); projectFilterSelector.setToolTipText(textBundle.textFor("ProjectFilterSelector.ToolTipText")); //$NON-NLS-1$ // Select first entry if (!projectFilterList.getProjectList().isEmpty()) { projectFilterSelector.setSelectedIndex(0); } // Read from Settings. final Long selectedProjectId = UserSettings.instance().getFilterSelectedProjectId(); if (selectedProjectId != null) { for (LabeledItem<Project> item : projectFilterList.getProjectList()) { if (Objects.equals(item.getItem().getId(), selectedProjectId.longValue())) { projectFilterSelector.setSelectedItem(item); break; } } } projectFilterSelector.addActionListener(this); } return projectFilterSelector; }
cbo.setModel(new EventComboBoxModel<E>(sourceList));
new JComboBox(new EventComboBoxModel<>(model.getProjectList())) ); projectColumn.setCellEditor(cellEditor);