public void showCustomizer(String preselectedCategory, String preselectedSubCategory) { Dialog dialog = project2Dialog.get(project); if (dialog != null) { dialog.setVisible(true); return; } else { SharedRubyProjectProperties uiProperties = createUiProperties(project, updateHelper, evaluator, refHelper, genFileHelper); Lookup context = Lookups.fixed( new Object[] { project, uiProperties, new SubCategoryProvider(preselectedCategory, preselectedSubCategory) }); OptionListener listener = new OptionListener(project, uiProperties); dialog = ProjectCustomizer.createCustomizerDialog( getCustomizerFolderPath(), context, preselectedCategory, listener, null); dialog.addWindowListener(listener); dialog.setTitle( MessageFormat.format( NbBundle.getMessage( BaseRubyCustomizerProvider.class, "LBL_Customizer_Title"), // NOI18N new Object[] {ProjectUtils.getInformation(project).getDisplayName()})); project2Dialog.put(project, dialog); dialog.setVisible(true); } }
@Messages({ "PROGRESS_checking_for_upgrade=Checking for old harnesses to upgrade", "CTL_Close=&Close", "CTL_NbPlatformManager_Title=NetBeans Platform Manager" }) public static void showCustomizer() { final AtomicBoolean canceled = new AtomicBoolean(); ProgressUtils.runOffEventDispatchThread( new Runnable() { // #207451 @Override public void run() { HarnessUpgrader.checkForUpgrade(); } }, PROGRESS_checking_for_upgrade(), canceled, false); NbPlatformCustomizer customizer = new NbPlatformCustomizer(); JButton closeButton = new JButton(); Mnemonics.setLocalizedText(closeButton, CTL_Close()); DialogDescriptor descriptor = new DialogDescriptor( customizer, CTL_NbPlatformManager_Title(), true, new Object[] {closeButton}, closeButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx("org.netbeans.modules.apisupport.project.ui.platform.NbPlatformCustomizer"), null); Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor); dlg.setVisible(true); dlg.dispose(); }
/** * DOCUMENT ME! * * @param e DOCUMENT ME! */ @Override public void actionPerformed(final ActionEvent e) { final WizardDescriptor wizard = new WizardDescriptor(getPanels()); wizard.setTitleFormat(new MessageFormat("{0}")); // NOI18N wizard.setTitle( NbBundle.getMessage( ImportGeoCPMWizardAction.class, "ImportGeoCPMWizardAction.wizard.title")); // NOI18N final Dialog dialog = DialogDisplayer.getDefault().createDialog(wizard); dialog.pack(); dialog.setLocationRelativeTo(ComponentRegistry.getRegistry().getMainWindow()); dialog.setVisible(true); dialog.toFront(); final boolean cancelled = wizard.getValue() != WizardDescriptor.FINISH_OPTION; if (cancelled) { for (final Object o : getPanels()) { if (o instanceof Cancellable) { ((Cancellable) o).cancel(); } } } // there is no need to do anything, when finished successfully }
/** * DOCUMENT ME! * * @param b DOCUMENT ME! */ public void setVisible(boolean b) { super.setVisible(b); if (b) { rsrcBut[0].requestFocus(); } }
/** * Protocols that allow communication between GUI palette and GUI text editor. * * @return whether operation was a success. */ @NbBundle.Messages({"WriteFile_Customizer=Insert", "NAME_java-WriteFile=WriteFile"}) public boolean showDialog() { dialogOK = false; descriptor = new DialogDescriptor( this, Bundle.WriteFile_Customizer(), true, DialogDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) { evaluateInput(); dialogOK = true; } dialog.dispose(); } }); dialog = DialogDisplayer.getDefault().createDialog(descriptor); dialog.setResizable(false); dialog.setVisible(true); return dialogOK; }
public void showGotoDialog(final KeyEventBlocker blocker) { Dialog dialog = createGotoDialog(); if (dialog == null) { // already visible // TODO:beep() return; } dialog.setVisible(true); gotoPanel.popupNotify(blocker); WindowAdapter winAdapt = new WindowAdapter() { public @Override void windowClosing(WindowEvent evt) { disposeGotoDialog(); } public @Override void windowClosed(WindowEvent evt) { SwingUtilities.invokeLater( new Runnable() { public void run() { if (blocker != null) { blocker.stopBlocking(false); } // Utilities.returnFocus(); } }); } }; dialog.addWindowListener(winAdapt); }
@NbBundle.Messages("AddPluginsPanel.dialog.title=Install plugin") public DialogDescriptor showDialog() { DialogDescriptor dialogDescriptor = new DialogDescriptor(this, Bundle.AddPluginsPanel_dialog_title()); Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor); dialog.pack(); dialog.setVisible(true); return dialogDescriptor; }
public @Override void windowClosing(WindowEvent e) { // Dispose the dialog otherwsie the {@link WindowAdapter#windowClosed} // may not be called Dialog dialog = project2Dialog.get(project); if (dialog != null) { dialog.setVisible(false); dialog.dispose(); } }
// Listening to OK button ---------------------------------------------------------- public void actionPerformed(ActionEvent e) { // Store the properties into project uiProperties.save(); // Close & dispose the the dialog Dialog dialog = project2Dialog.get(project); if (dialog != null) { dialog.setVisible(false); dialog.dispose(); } }
/** * Overwritten set visible method to populate the list as soon as the map loader goes visible. * * @param visible the new value for the visible flag */ @Override public void setVisible(final boolean visible) { if (visible) { populateMaplist(); } super.setVisible(visible); if (!visible) { mapList.removeAll(); } }
public void showDifferences(DiffView diffView) { Frame window = WindowManager.getDefault().getMainWindow(); if (dialog == null) { DialogDescriptor descriptor = dialogDescriptor(diffPanel); dialog = org.openide.DialogDisplayer.getDefault().createDialog(descriptor); dialog.setSize(640, 480); } diffPanel.setDiffView(diffView); dialog.setLocationRelativeTo(window); dialog.setVisible(true); }
@Override public void showCustomizer() { init(); final Dialog dialog = ProjectCustomizer.createCustomizerDialog( categories, componentProvider, null, new PropertiesListener(this), null); dialog.setTitle(ProjectUtils.getInformation(project).getDisplayName()); dialog.setVisible(true); }
public void setVisible(boolean visible) { pack(); if (centered) { Dimension frameSize = getParent().getSize(); Point frameLoc = getParent().getLocation(); Dimension mySize = getSize(); int x, y; x = frameLoc.x + (frameSize.width / 2) - (mySize.width / 2); y = frameLoc.y + (frameSize.height / 2) - (mySize.height / 2); setBounds(x, y, getSize().width, getSize().height); } super.setVisible(visible); }
/* DESCRIPTION * Connect button event method, * Call the connect method * ARGUMENTS * ip - Peer IP variable, integer * port - Peer Port variable, integer * dlg - Warning dialog, Dialog * msg - Warning message, Label * ok - confirm button on the warning dialog */ protected void connect_btnMouseClicked(MouseEvent evt) { ip = ip_text.getText(); port = Integer.parseInt(port_text.getText()); final Dialog dlg = new Dialog(this, "Warning!"); dlg.setSize(300, 100); Label msg = new Label("Input the correct Ip address and Port number.", Label.CENTER); Button ok = new Button("OK"); dlg.setLayout(new FlowLayout()); dlg.add(msg); dlg.add(ok); ok.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { dlg.dispose(); } }); // if user didn't a peer ip, it shows alarm dialog if (ip.equals("")) { dlg.setVisible(true); } // Call the connect method else { try { connect(); } catch (Exception e) { dlg.setVisible(true); System.out.println(e); } } }
public void performAction() { WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels()); // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName() wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); wizardDescriptor.setTitle("Skybox Wizard"); Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor); dialog.setVisible(true); dialog.toFront(); boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION; if (!cancelled) { topComponent.generateSkybox(wizardDescriptor); } }
public static FileObject showDialog(SourceGroup[] folders, boolean showFiles) { BrowseFolders bf = new BrowseFolders(folders, showFiles); JButton options[] = new JButton[] { // new JButton( NbBundle.getMessage( BrowseFolders.class, // "LBL_BrowseFolders_Select_Option") ), // NOI18N // new JButton( NbBundle.getMessage( BrowseFolders.class, // "LBL_BrowseFolders_Cancel_Option") ), // NOI18N new JButton(NbBundle.getMessage(BrowseFolders.class, "LBL_SelectFile")), new JButton(NbBundle.getMessage(BrowseFolders.class, "LBL_Cancel")), }; options[0] .getAccessibleContext() .setAccessibleDescription(NbBundle.getMessage(BrowseFolders.class, "ACSD_SelectFile")); options[1] .getAccessibleContext() .setAccessibleDescription(NbBundle.getMessage(BrowseFolders.class, "ACSD_Cancel")); OptionsListener optionsListener = new OptionsListener(bf); options[0].setActionCommand(OptionsListener.COMMAND_SELECT); options[0].addActionListener(optionsListener); options[1].setActionCommand(OptionsListener.COMMAND_CANCEL); options[1].addActionListener(optionsListener); DialogDescriptor dialogDescriptor = new DialogDescriptor( bf, // innerPane NbBundle.getMessage(BrowseFolders.class, "LBL_BrowseFiles"), // displayName true, // modal options, // options options[0], // initial value DialogDescriptor.BOTTOM_ALIGN, // options align null, // helpCtx null); // listener dialogDescriptor.setClosingOptions(new Object[] {options[0], options[1]}); Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor); dialog .getAccessibleContext() .setAccessibleDescription( NbBundle.getMessage(BrowseFolders.class, "ACSD_BrowseFoldersDialog")); dialog.setVisible(true); return optionsListener.getResult(); }
/** * DOCUMENT ME! * * @param b DOCUMENT ME! */ public void setVisible(boolean b) { if (b) { /** set initial values */ SOCPlayer player = playerInterface.getGame().getPlayer(playerInterface.getClient().getNickname()); SOCResourceSet resources = player.getResources(); keep[0].setIntValue(resources.getAmount(SOCResourceConstants.CLAY)); keep[1].setIntValue(resources.getAmount(SOCResourceConstants.ORE)); keep[2].setIntValue(resources.getAmount(SOCResourceConstants.SHEEP)); keep[3].setIntValue(resources.getAmount(SOCResourceConstants.WHEAT)); keep[4].setIntValue(resources.getAmount(SOCResourceConstants.WOOD)); discardBut.requestFocus(); } super.setVisible(b); }
@Override public void performAction() { WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels()); // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName() wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); wizardDescriptor.setTitle("Import peak data from MeltDB"); wizardDescriptor.putProperty( "WizardPanel_image", ImageUtilities.loadImage("maltcms/io/xml/ws/meltdb/meltdb-logo-wizard.png", true)); Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor); dialog.setVisible(true); dialog.toFront(); boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION; if (!cancelled) { // do something } }
@Override public void showCustomizer() { Dialog dialog = ProjectCustomizer.createCustomizerDialog( // Path to layer folder: CUSTOMIZER_FOLDER_PATH, // Lookup, which must contain, at least, the Project: Lookups.fixed(project), // Preselected category: "", // OK button listener: new OKOptionListener(), // HelpCtx for Help button of dialog: null); dialog.setTitle(ProjectUtils.getInformation(project).getDisplayName()); dialog.setVisible(true); }
protected synchronized Dialog createGotoDialog() { if (gotoDialog == null) { gotoDialog = DialogSupport.createDialog( NbBundle.getBundle(org.netbeans.editor.BaseKit.class) .getString("goto-title"), // NOI18N gotoPanel, false, // non-modal gotoButtons, false, // sidebuttons, 0, // defaultIndex = 0 => gotoButton 1, // cancelIndex = 1 => cancelButton this // listener ); gotoDialog.pack(); // Position the dialog according to the history Rectangle lastBounds = (Rectangle) EditorState.get(BOUNDS_KEY); if (lastBounds != null) { gotoDialog.setBounds(lastBounds); } else { // no history, center it on the screen Dimension dim = gotoDialog.getPreferredSize(); int x; int y; JTextComponent c = EditorRegistry.lastFocusedComponent(); Window w = c != null ? SwingUtilities.getWindowAncestor(c) : null; if (w != null) { x = Math.max(0, w.getX() + (w.getWidth() - dim.width) / 2); y = Math.max(0, w.getY() + (w.getHeight() - dim.height) / 2); } else { Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); x = Math.max(0, (screen.width - dim.width) / 2); y = Math.max(0, (screen.height - dim.height) / 2); } gotoDialog.setLocation(x, y); } return gotoDialog; } else { gotoDialog.setVisible(true); gotoDialog.toFront(); return null; } }
@SuppressWarnings("unchecked") @Override public void performAction(Node[] nodes) { WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels(nodes[0])); // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName() wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); wizardDescriptor.setTitle("nLV Graph Configuration"); wizardDescriptor.putProperty("node", nodes[0]); Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor); dialog.setVisible(true); dialog.toFront(); boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION; if (!cancelled) { // do something int maxLevel = (Integer) wizardDescriptor.getProperty("maxLevel"); boolean inner = (Boolean) wizardDescriptor.getProperty("inner"); AbstractDistance ad = (AbstractDistance) wizardDescriptor.getProperty("distance"); if (ad.configurable()) { ad.configure(); } OutputPanel op = new OutputPanel( nodes[0].getParentNode().getDisplayName() + ": nLV Graph (" + ad.toString() + ") Output"); Runnable job = new GraphBuilder(nodes[0], op, ad, 0, maxLevel, inner); op.open(); op.requestActive(); Thread thread = new Thread(job); thread.setDaemon(true); thread.start(); nodes[0].addNodeListener(new LocalNodeListener(op)); } panels = null; }
@Override public void actionPerformed(java.awt.event.ActionEvent e) { try { PropertyEditor propEd = property.getPropertyEditor(); propEd.setValue(property.getValue()); final Component custEditor = propEd.getCustomEditor(); Object[] options = buttons(); DialogDescriptor descriptor = new DialogDescriptor( custEditor, (String) getValue(Action.NAME), true, options, DialogDescriptor.CANCEL_OPTION, DialogDescriptor.DEFAULT_ALIGN, HelpCtx.DEFAULT_HELP, (ActionEvent e1) -> { try { String action = e1.getActionCommand(); switch (action) { case OK_COMMAND: Object value = property.getPropertyEditor().getValue(); property.setValue(value); break; case RESTORE_COMMAND: property.restoreDefaultValue(); break; } dialog.dispose(); } catch (Exception ex) { NotifyDescriptor descriptor2 = new NotifyDescriptor.Message( NbBundle.getMessage(PropertyAction.class, "MSG_InvalidValue")); // NOI18N DialogDisplayer.getDefault().notify(descriptor2); } }); descriptor.setClosingOptions(new Object[0]); dialog = DialogDisplayer.getDefault().createDialog(descriptor); dialog.setVisible(true); dialog = null; } catch (Exception ex) { ErrorManager.getDefault().notify(ex); } }
void showWarning(Frame frame, String warning) { warningDialog = new Dialog(frame, "警告", true); warningDialog.setSize(200, 100); warningDialog.setLayout(new FlowLayout()); warningDialog.setResizable(false); warningDialog.setLocationRelativeTo(frame); warningText = new Label(warning); warningButton = new Button("确认"); warningDialog.add(warningText); warningDialog.add(warningButton); warningDialog.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { warningDialog.setVisible(false); warningDialog.dispose(); } }); warningButton.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_ENTER) { warningDialog.setVisible(false); warningDialog.dispose(); } } }); warningButton.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { warningDialog.setVisible(false); warningDialog.dispose(); } }); warningDialog.setVisible(true); }
public static void showDialog(DataObject template, DataFolder targetFolder) { int type; if (template.getPrimaryFile().getName().equals("file")) { type = TYPE_FILE; } else { type = TYPE_FOLDER; } JButton options[] = new JButton[] { new JButton( NbBundle.getMessage(NoProjectNew.class, "LBL_NonProject_OK_Button")), // NOI18N new JButton( NbBundle.getMessage(NoProjectNew.class, "LBL_NonProject_Cancel_Button")), // NOI18N }; NoProjectNew npn = new NoProjectNew(type, targetFolder, options[0]); options[0].setActionCommand(COMMAND_OK); options[0].addActionListener(npn); options[1].setActionCommand(COMMAND_CANCEL); options[1].addActionListener(npn); DialogDescriptor dialogDescriptor = new DialogDescriptor( npn, // innerPane type == TYPE_FILE ? FILE_TITLE : FOLDER_TITLE, // displayName true, // modal options, // options options[0], // initial value DialogDescriptor.BOTTOM_ALIGN, // options align null, // helpCtx null); // listener dialogDescriptor.setClosingOptions(new Object[] {options[0], options[1]}); Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor); dialog.setVisible(true); npn.createFile(); }
/** Implements <code>SaveCookie</code> interface. */ public void save() throws java.io.IOException { StrutsConfigDataObject obj = (StrutsConfigDataObject) getDataObject(); // invoke parsing before save restartTimer(); obj.parsingDocument(); if (obj.isDocumentValid()) { saveDocument(); } else { DialogDescriptor dialog = new DialogDescriptor( NbBundle.getMessage( StrutsConfigEditorSupport.class, "MSG_invalidXmlWarning"), // NOI18N NbBundle.getMessage( StrutsConfigEditorSupport.class, "TTL_invalidXmlWarning")); // NOI18N java.awt.Dialog d = org.openide.DialogDisplayer.getDefault().createDialog(dialog); d.setVisible(true); if (dialog.getValue() == org.openide.DialogDescriptor.OK_OPTION) { saveDocument(); } } }
public boolean showWindow() { DialogDescriptor dd = new DialogDescriptor( this, NbBundle.getMessage(FilterEditor.class, "LBL_FilterEditor"), true, // NOI18N new Object[] {btnOk, btnCancel}, btnOk, DialogDescriptor.DEFAULT_ALIGN, HelpCtx.DEFAULT_HELP, null); Dialog dlg = DialogDisplayer.getDefault().createDialog(dd); dlg.setVisible(true); if (btnOk.equals(dd.getValue())) { updateFilters(); return true; } return false; }
@Override() public void displayConfig(WSDLComponent component, UndoManager undoManager) { UndoCounter undoCounter = new UndoCounter(); WSDLModel model = component.getModel(); model.addUndoableEditListener(undoCounter); JPanel profConfigPanel = new Kerberos(component, this); DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName()); Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc); dlg.setVisible(true); if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) { for (int i = 0; i < undoCounter.getCounter(); i++) { if (undoManager.canUndo()) { undoManager.undo(); } } } model.removeUndoableEditListener(undoCounter); }
private void openDialog(String title, String string) { // TODO Auto-generated method stub Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension dialogSize = new Dimension(200, 120); final Dialog dialog = new Dialog((Frame) getParent(), title); dialog.setSize(dialogSize); dialog.setLayout(null); dialog.setResizable(true); Label label = new Label(string); label.setSize(400, 50); label.setLocation(20, 30); dialog.add(label, "Center"); Button enter = new Button("Return"); enter.setSize(50, 25); enter.setLocation(75, 80); enter.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub dialog.dispose(); } }); dialog.add(enter); dialog.setLocation( (screenSize.width - dialogSize.width + 50) / 2, (screenSize.height - dialogSize.height + 40) / 2); dialog.setModal(true); dialog.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent arg0) { // TODO Auto-generated method stub dialog.dispose(); } }); dialog.setVisible(true); }
/** Handles button events */ public void actionPerformed(ActionEvent e) { // only chooseMainClassButton can be performed final MainClassChooser panel = new MainClassChooser(sourceRoots.getRoots(), null, mainClassTextField.getText()); Object[] options = new Object[] {okButton, DialogDescriptor.CANCEL_OPTION}; panel.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof MouseEvent && MouseUtils.isDoubleClick(((MouseEvent) e.getSource()))) { // click button and finish the dialog with selected class okButton.doClick(); } else { okButton.setEnabled(panel.getSelectedMainClass() != null); } } }); okButton.setEnabled(false); DialogDescriptor desc = new DialogDescriptor( panel, NbBundle.getMessage(CustomizerRun.class, "LBL_ChooseMainClass_Title"), // NOI18N true, options, options[0], DialogDescriptor.BOTTOM_ALIGN, null, null); // desc.setMessageType (DialogDescriptor.INFORMATION_MESSAGE); Dialog dlg = DialogDisplayer.getDefault().createDialog(desc); dlg.setVisible(true); if (desc.getValue() == options[0]) { mainClassTextField.setText(panel.getSelectedMainClass()); } dlg.dispose(); }
public static int selectPID() { JButton okButton = new JButton(OK_BUTTON_NAME); PIDSelectPanel pidSelect = new PIDSelectPanel(okButton); DialogDescriptor dd = new DialogDescriptor( pidSelect, SELECT_PROCESS_DIALOG_CAPTION, true, new Object[] {okButton, CANCEL_OPTION}, okButton, BOTTOM_ALIGN, null, null); Dialog d = DialogDisplayer.getDefault().createDialog(dd); d.setVisible(true); if (dd.getValue() == okButton) { return pidSelect.getPID(); } else { return -1; } }