List of usage examples for javax.swing ComboBoxModel getSize
int getSize();
From source file:org.netbeans.jcode.ejb.facade.SessionBeanPanel.java
@Override public void init(String _package, Project project, SourceGroup sourceGroup) { pref = ProjectUtils.getPreferences(project, SessionBeanData.class, true); if (sourceGroup != null) { packageCombo.setRenderer(PackageView.listRenderer()); ComboBoxModel model = PackageView.createListView(sourceGroup); if (model.getSize() > 0) { model.setSelectedItem(model.getElementAt(0)); }// w ww . ja v a 2s. co m packageCombo.setModel(model); addChangeListener(packageCombo); if (StringUtils.isBlank(_package)) { setPackage(DEFAULT_PACKAGE); } else { setPackage(_package + '.' + DEFAULT_PACKAGE); } } addChangeListener(prefixField); addChangeListener(suffixField); }
From source file:org.netbeans.jcode.ejb.facade.SessionBeanPanel.java
private void setPackage(String _package) { ComboBoxModel model = packageCombo.getModel(); for (int i = 0; i < model.getSize(); i++) { if (model.getElementAt(i).toString().equals(_package)) { model.setSelectedItem(model.getElementAt(i)); return; }// w w w . j a v a 2 s .com } ((JTextComponent) packageCombo.getEditor().getEditorComponent()).setText(_package); }
From source file:org.netbeans.jcode.mvc.controller.MVCPanel.java
@Override public void init(String _package, Project project, SourceGroup sourceGroup) { pref = ProjectUtils.getPreferences(project, MVCData.class, true); this.project = project; this.sourceGroup = sourceGroup; if (sourceGroup != null) { packageCombo.setRenderer(PackageView.listRenderer()); ComboBoxModel model = PackageView.createListView(sourceGroup); if (model.getSize() > 0) { model.setSelectedItem(model.getElementAt(0)); }//from w w w. ja v a 2s. co m packageCombo.setModel(model); addChangeListener(packageCombo); if (StringUtils.isBlank(_package)) { _package = DEFAULT_PACKAGE; } else { _package = _package + '.' + DEFAULT_PACKAGE; } setPackage(_package); } addChangeListener(prefixField); addChangeListener(suffixField); eventObserversPanel.removeAll(); for (ControllerEventType type : ControllerEventType.values()) { JCheckBox eventTypeBox = new JCheckBox(); org.openide.awt.Mnemonics.setLocalizedText(eventTypeBox, type.toString()); // NOI18N eventObserversPanel.add(eventTypeBox); eventTypeBoxs.put(eventTypeBox, type); } final RestSupport restSupport = project.getLookup().lookup(RestSupport.class); // if (restSupport != null) { // if (restSupport.isEE5() && restSupport.hasJersey1(true) // || restSupport.hasSpringSupport() && !restSupport.hasJersey2(true)) { // useJersey = true; // } // } if (restSupport != null) { ScanDialog.runWhenScanFinished(() -> { boolean configured;//restSupport.isRestSupportOn(); configured = restSupport.hasJerseyServlet(); restApplications = restSupport.getRestApplications(); if (!configured) { configured = restApplications != null && !restApplications.isEmpty(); } if (configDialog != null) { configDialog.setRestApplicationClasses(restApplications); } configurREST(configured); }, getMessage(MVCPanel.class, "MVCPanel.scanningExistingApp.text")); } }
From source file:org.netbeans.jcode.mvc.controller.MVCPanel.java
private void setPackage(String _package) { ComboBoxModel model = packageCombo.getModel(); for (int i = 0; i < model.getSize(); i++) { if (model.getElementAt(i).toString().equals(_package)) { model.setSelectedItem(model.getElementAt(i)); break; }//from w w w. j a va 2s . co m } ((JTextComponent) packageCombo.getEditor().getEditorComponent()).setText(_package); }
From source file:org.netbeans.jcode.rest.applicationconfig.RestConfigPanel.java
@Override public void init(String _package, Project project, SourceGroup sourceGroup) { pref = ProjectUtils.getPreferences(project, RestConfigData.class, true); if (sourceGroup != null) { packageCombo.setRenderer(PackageView.listRenderer()); ComboBoxModel model = PackageView.createListView(sourceGroup); if (model.getSize() > 0) { model.setSelectedItem(model.getElementAt(0)); }/*from w w w .j av a 2s . c o m*/ packageCombo.setModel(model); addChangeListener(packageCombo); if (StringUtils.isBlank(_package)) { setPackage(DEFAULT_PACKAGE); } else { setPackage(_package); } } addChangeListener(restConfigClassField); addChangeListener(restPathField); }
From source file:org.netbeans.jcode.rest.controller.RESTPanel.java
private void setPackageType(JComboBox comboBox) { comboBox.setRenderer(PackageView.listRenderer()); ComboBoxModel model = PackageView.createListView(sourceGroup); if (model.getSize() > 0) { model.setSelectedItem(model.getElementAt(0)); }// w w w .ja v a 2 s .co m comboBox.setModel(model); addChangeListener(comboBox); }
From source file:org.netbeans.jcode.rest.controller.RESTPanel.java
private void setAppPackage(String _package) { ComboBoxModel model = appPackageCombo.getModel(); for (int i = 0; i < model.getSize(); i++) { if (model.getElementAt(i).toString().equals(_package)) { model.setSelectedItem(model.getElementAt(i)); break; }//from w w w. j a va 2 s . c o m } ((JTextComponent) appPackageCombo.getEditor().getEditorComponent()).setText(_package); }
From source file:org.netbeans.jpa.modeler.source.generator.ui.GenerateCodeDialog.java
private void populatePackageCombo() { if (sourceGroup != null) { resourcePackageCombo.setRenderer(PackageView.listRenderer()); ComboBoxModel model = PackageView.createListView(sourceGroup); if (model.getSize() > 0) { model.setSelectedItem(model.getElementAt(0)); }/*from ww w . ja va 2 s. co m*/ resourcePackageCombo.setModel(model); } }
From source file:org.netbeans.jpa.modeler.source.generator.ui.GenerateCodeDialog.java
private void setPackage(String _package) { ComboBoxModel model = resourcePackageCombo.getModel(); for (int i = 0; i < model.getSize(); i++) { if (model.getElementAt(i).toString().equals(_package)) { model.setSelectedItem(model.getElementAt(i)); return; }/*from ww w . j av a 2 s. c o m*/ } ((JTextComponent) resourcePackageCombo.getEditor().getEditorComponent()).setText(_package); }
From source file:org.zaproxy.zap.extension.quickstart.launch.LaunchPanel.java
public void postInit() { // Plugable browsers (like JxBrowser) can be added after this add-ons // options have been loaded String def = this.getExtQuickStart().getQuickStartParam().getLaunchDefaultBrowser(); if (def == null || def.length() == 0) { // no default return;/*from www. j a v a 2 s .c o m*/ } ComboBoxModel<ProvidedBrowserUI> model = this.getBrowserComboBox().getModel(); for (int idx = 0; idx < model.getSize(); idx++) { ProvidedBrowserUI el = model.getElementAt(idx); if (el.getName().equals(def)) { model.setSelectedItem(el); break; } } this.getContentPanel().add(getHudCheckbox(), LayoutHelper.getGBC(1, hudOffset, 3, 0.25D)); PlugableHud hud = getExtQuickStart().getHudProvider(); if (hud != null) { // Build up a model just with the browsers supported by the HUD List<ProvidedBrowserUI> hudBrowsers = new ArrayList<ProvidedBrowserUI>(); List<String> browserIds = hud.getSupportedBrowserIds(); for (int i = 0; i < allBrowserModel.getSize(); i++) { ProvidedBrowserUI browser = allBrowserModel.getElementAt(i); if (browserIds.contains(browser.getBrowser().getProviderId())) { hudBrowsers.add(browser); } } hudBrowserModel = new ProvidedBrowsersComboBoxModel(hudBrowsers); setBrowserOptions(this.getHudCheckbox().isSelected()); } }