/** Create dialog descriptor. * If the action listener is null, all option buttons will close the dialog and the * getValue () will provide the pressed option. * * @param innerPane inner component of the dialog, or String message * @param title title of the dialog * @param isModal modal status * @param optionType one of the standard options (<code>OK_CANCEL_OPTION</code>, ...) * @param initialValue default option (default button) * @param optionsAlign specifies where to place * options in the dialog * @param helpCtx help context specifying help page * @param bl listener for the user's button presses or <code>null</code> for default close action on all options * (unless you specified the options yourself) */ public DialogDescriptor( final Object innerPane, final String title, final boolean isModal, final int optionType, final Object initialValue, final int optionsAlign, final HelpCtx helpCtx, final ActionListener bl ) { super(innerPane, title, optionType, PLAIN_MESSAGE, null, initialValue); this.modal = isModal; this.optionsAlign = optionsAlign; this.helpCtx = (helpCtx == null) ? HelpCtx.DEFAULT_HELP : helpCtx; this.buttonListener = bl; if (bl == null) { // if the listener is null all options are closing setClosingOptions(null); } }
/** * @param options the options to set */ @Override public void setClosingOptions(Object[] options) { super.setClosingOptions(convertOptions(options)); }
private <Data> WizardDescriptor(SettingsAndIterator<Data> data) { super("", "", true, DEFAULT_OPTION, null, CLOSE_PREVENTER); // NOI18N this.data = data; baseListener = new Listener(); weakNextButtonListener = WeakListeners.create( ActionListener.class, baseListener, nextButton ); // NOI18N weakPreviousButtonListener = WeakListeners.create( ActionListener.class, baseListener, previousButton ); // NOI18N weakFinishButtonListener = WeakListeners.create( ActionListener.class, baseListener, finishButton ); // NOI18N weakCancelButtonListener = WeakListeners.create( ActionListener.class, baseListener, cancelButton ); // NOI18N nextButton.addActionListener(weakNextButtonListener); previousButton.addActionListener(weakPreviousButtonListener); finishButton.addActionListener(weakFinishButtonListener); cancelButton.addActionListener(weakCancelButtonListener); finishOption = new WizardDescriptor.FinishAction(); super.setOptions(new Object[] { previousButton, nextButton, finishButton, cancelButton }); super.setClosingOptions(new Object[] { finishOption, cancelButton }); createNotificationLineSupport (); // attach the change listener to iterator weakChangeListener = WeakListeners.change(baseListener, data.getIterator(this)); data.getIterator(this).addChangeListener(weakChangeListener); callInitialize(); }
/** * @param options the options to set */ public void setClosingOptions (Object[] options) { super.setClosingOptions (convertOptions (options)); }
/** * @param options the options to set */ public void setClosingOptions (Object[] options) { super.setClosingOptions (convertOptions (options)); }
private DialogDescriptor createDialogDescriptor(String caption, String message, ProgressController controller) { this.controller = controller; progressLabel.setText(message); progressBar.setIndeterminate(true); DialogDescriptor dd = controller == null ? new DialogDescriptor(this, caption, true, new Object[0], null, 0, null, null) : new DialogDescriptor(this, caption, true, new Object[] { cancelButton }, null, 0, null, null); dd.setClosingOptions(new Object[0]); return dd; }
public void actionPerformed(ActionEvent event) { StringBuffer buffer = new StringBuffer(); buffer.append("<b>"); buffer.append(artifact.getArtifactId()); buffer.append("</b>"); buffer.append(":"); buffer.append("<b>"); buffer.append(artifact.getVersion().toString()); buffer.append("</b>"); UsagesUI uI = new UsagesUI(buffer.toString(), artifact); DialogDescriptor dd = new DialogDescriptor(uI, NbBundle.getMessage( FindArtifactUsages.class, "TIT_FindartifactUsages")); dd.setClosingOptions(new Object[]{ DialogDescriptor.CLOSED_OPTION }); dd.setOptions(new Object[]{ DialogDescriptor.CLOSED_OPTION }); DialogDisplayer.getDefault().notify(dd); } }
public void actionPerformed(ActionEvent arg0) { JButton butt = new JButton(); ProblemsPanel panel = new ProblemsPanel(reporter); panel.setActionButton(butt); JButton close = new JButton(); panel.setCloseButton(close); close.setText(NbBundle.getMessage(MavenProjectNode.class, "BTN_Close")); DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(MavenProjectNode.class, "TIT_Show_Problems")); dd.setOptions(new Object[] { butt, close}); dd.setClosingOptions(new Object[] { close }); dd.setModal(false); DialogDisplayer.getDefault().notify(dd); } }
private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed Collection<String> currentLocales = new HashSet<String>(); ListModel locales = installedLocalesList.getModel(); for (int c = 0; c < locales.getSize(); c++) { currentLocales.add(locales.getElementAt(c).toString()); } JButton okButton = new JButton(NbBundle.getMessage(SpellcheckerOptionsPanel.class, "BTN_Add")); DictionaryInstallerPanel panel = new DictionaryInstallerPanel(okButton, currentLocales); DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(SpellcheckerOptionsPanel.class, "LBL_AddDictionary"), true, new Object[] {okButton, DialogDescriptor.CANCEL_OPTION}, okButton, DialogDescriptor.DEFAULT_ALIGN, null, null); dd.setClosingOptions(null); panel.setNotifications(dd.createNotificationLineSupport()); Dialog d = DialogDisplayer.getDefault().createDialog(dd); d.setVisible(true); if (dd.getValue() == okButton) { DictionaryDescription desc = panel.createDescription(); addedDictionaries.add(desc); removedDictionaries.remove(desc.getLocale()); updateLocales(); } fireChanged(); }//GEN-LAST:event_addButtonActionPerformed
@NbBundle.Messages({ "LBL_Credentials=Credentials", "LBL_Close=Close" }) @Override public void actionPerformed(ActionEvent e) { CredentialsListPanel panel = new CredentialsListPanel(); JButton closeButton = new JButton(Bundle.LBL_Close()); DialogDescriptor descriptor = new DialogDescriptor(panel, Bundle.LBL_Credentials(), true, new Object[]{closeButton}, closeButton, DialogDescriptor.DEFAULT_ALIGN, null, null); descriptor.setClosingOptions(new Object[]{closeButton}); Dialog dlg = null; try { dlg = DialogDisplayer.getDefault().createDialog(descriptor); dlg.setVisible(true); } finally { if (dlg != null) { dlg.dispose(); } } } }
static KeyStroke[] showDialog() { Object[] buttons = new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION }; final ShortcutEnterPanel sepPanel = new ShortcutEnterPanel(); DialogDescriptor descriptor = new DialogDescriptor(sepPanel,sepPanel.getTitle(), true,buttons,DialogDescriptor.OK_OPTION,DialogDescriptor.DEFAULT_ALIGN, null,sepPanel.listener); descriptor.setClosingOptions(new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION }); descriptor.setAdditionalOptions(sepPanel.getAdditionalOptions()); DialogDisplayer.getDefault().notify(descriptor); String shortcut = sepPanel.getShortcutText(); if (descriptor.getValue() == DialogDescriptor.OK_OPTION && shortcut != null && shortcut.trim().length() > 0) { return WizardUtils.stringToKeyStrokes(shortcut);//NOI18N } else { return null; } }
protected void ifNecessaryShowNoWebFolderDialog() { if (isShowNoWebFolderDialog()) { final NotWebFolder panel = new NotWebFolder(NO_WEB_FOLDER_WARNING); DialogDescriptor descriptor = new DialogDescriptor(panel, NO_WEB_FOLDER_TITLE, true, NotifyDescriptor.PLAIN_MESSAGE, NotifyDescriptor.YES_OPTION, null); JButton okButton = new JButton( NbBundle.getMessage(PageFlowController.class, "MSG_OkButtonText")); //NOI18N descriptor.setOptions(new Object[]{okButton}); descriptor.setMessageType(NotifyDescriptor.PLAIN_MESSAGE); descriptor.setClosingOptions(new Object[]{okButton}); descriptor.setOptionsAlign(DialogDescriptor.BOTTOM_ALIGN); final Dialog d = DialogDisplayer.getDefault().createDialog(descriptor); d.setSize(400, 200); d.setVisible(true); setShowNoWebFolderDialog(panel.getShowDialog()); } }
private void btnAddRepoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddRepoActionPerformed final RepositoryRegisterUI rrui = new RepositoryRegisterUI(); DialogDescriptor dd = new DialogDescriptor(rrui, NbBundle.getMessage(RepositoryRegisterUI.class, "LBL_Repo_ADD")); dd.setClosingOptions(new Object[]{ rrui.getButton(), DialogDescriptor.CANCEL_OPTION }); dd.setOptions(new Object[]{ rrui.getButton(), DialogDescriptor.CANCEL_OPTION }); Object ret = DialogDisplayer.getDefault().notify(dd); if (rrui.getButton() == ret) { final RepositoryInfo info = rrui.getRepositoryInfo(); RepositoryPreferences.getInstance().addOrModifyRepositoryInfo(info); manager.setRootContext(createRootNode()); RequestProcessor.getDefault().post(new Runnable() { public void run() { RepositoryIndexer.indexRepo(info); } }); } }//GEN-LAST:event_btnAddRepoActionPerformed
AddWatchProcessor(NativeDebugger debugger, String scope) { panel = new EditWatchPanel(debugger, null, scope, null); boolean isModal = true; dd = new DialogDescriptor(panel, Catalog.get("TTL_NewWatch"), // NOI18N isModal, null); Object[] buttons = new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION }; dd.setOptions(buttons); dd.setClosingOptions(buttons); panel.getController().addPropertyChangeListener(this); setValid(); }
MaxFrameProcessor(NativeDebugger debugger, String max_frame) { panel = new EditMaxFramePanel(debugger, max_frame); Catalog.setAccessibleDescription(panel, "ACSD_MaxFrames"); // NOI18N boolean isModal = true; dd = new DialogDescriptor(panel, Catalog.get("TTL_MaxFrames"),// NOI18N isModal, null); Object[] buttons = new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION }; dd.setOptions(buttons); dd.setClosingOptions(buttons); panel.getController().addPropertyChangeListener(this); setValid(); }
public void actionPerformed(ActionEvent event) { AddDependencyPanel pnl = new AddDependencyPanel(); DialogDescriptor dd = new DialogDescriptor(pnl, org.openide.util.NbBundle.getMessage(DependenciesNode.class, "TIT_Add_Library")); dd.setClosingOptions(new Object[] { pnl.getOkButton(), DialogDescriptor.CANCEL_OPTION }); dd.setOptions(new Object[] { pnl.getOkButton(), DialogDescriptor.CANCEL_OPTION }); Object ret = DialogDisplayer.getDefault().notify(dd); if (pnl.getOkButton() == ret) { ModelUtils. addDependency(project.getProjectDirectory().getFileObject("pom.xml")/*NOI18N*/, pnl.getGroupId(), pnl.getArtifactId(), pnl.getVersion(), null, pnl.getScope(), null,false); } } }
MaxObjectProcessor(NativeDebugger debugger, String max_object_size) { panel = new EditMaxObjectPanel(debugger, max_object_size); Catalog.setAccessibleDescription(panel, "ACSD_MaxObjectSize"); // NOI18N boolean isModal = true; dd = new DialogDescriptor(panel, Catalog.get("TTL_MaxObjectSize"),//NOI18N isModal, null); Object[] buttons = new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION }; dd.setOptions(buttons); dd.setClosingOptions(buttons); panel.getController().addPropertyChangeListener(this); setValid(); }
public void actionPerformed(ActionEvent e) { final RepositoryRegisterUI rrui = new RepositoryRegisterUI(); rrui.modify(RepositoryNode.this.info); DialogDescriptor dd = new DialogDescriptor(rrui, NbBundle.getMessage(RepositoryRegisterUI.class, "LBL_Repo_ADD")); dd.setClosingOptions(new Object[]{ rrui.getButton(), DialogDescriptor.CANCEL_OPTION }); dd.setOptions(new Object[]{ rrui.getButton(), DialogDescriptor.CANCEL_OPTION }); Object ret = DialogDisplayer.getDefault().notify(dd); if (rrui.getButton() == ret) { RepositoryInfo info = rrui.getRepositoryInfo(); RepositoryPreferences.getInstance().addOrModifyRepositoryInfo(info); RepositoryNode.this.info = info; setDisplayName(info.getName()); fireIconChange(); fireOpenedIconChange(); ((GroupListChildren)getChildren()).refreshGroups(); } } }