Java Code Examples for org.openide.WizardDescriptor#setModal()

The following examples show how to use org.openide.WizardDescriptor#setModal() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: I18nTestWizardAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Initializes wizard descriptor. */
private void initWizard(WizardDescriptor wizardDesc) {
    // Init properties.
    wizardDesc.putProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, Boolean.TRUE);
    wizardDesc.putProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, Boolean.TRUE);
    wizardDesc.putProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, Boolean.TRUE);

    ArrayList contents = new ArrayList(3);
    contents.add(Util.getString("TXT_SelectTestSources"));          //NOI18N
    contents.add(Util.getString("TXT_SelectTestResources"));        //NOI18N
    contents.add(Util.getString("TXT_FoundMissingResources"));      //NOI18N
    
    wizardDesc.putProperty(WizardDescriptor.PROP_CONTENT_DATA, (String[])contents.toArray(new String[contents.size()]));
    
    wizardDesc.setTitle(Util.getString("LBL_TestWizardTitle"));     //NOI18N
    wizardDesc.setTitleFormat(new MessageFormat("{0} ({1})"));      //NOI18N

    wizardDesc.setModal(false);
}
 
Example 2
Source File: I18nWizardAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Initializes wizard descriptor. */
private void initWizard(WizardDescriptor wizardDesc) {
    // Init properties.
    wizardDesc.putProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, Boolean.TRUE);
    wizardDesc.putProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, Boolean.TRUE);
    wizardDesc.putProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, Boolean.TRUE);

    List<String> contents = new ArrayList<String>(4);
    contents.add(Util.getString("TXT_SelectSourcesHelp"));          //NOI18N
    contents.add(Util.getString("TXT_SelectResourceHelp"));         //NOI18N
    contents.add(Util.getString("TXT_AdditionalHelp"));             //NOI18N
    contents.add(Util.getString("TXT_FoundStringsHelp"));           //NOI18N
    
    wizardDesc.putProperty(
        WizardDescriptor.PROP_CONTENT_DATA,
        contents.toArray(new String[contents.size()])
    ); 
    
    wizardDesc.setTitle(Util.getString("LBL_WizardTitle"));         //NOI18N
    wizardDesc.setTitleFormat(new MessageFormat("{0} ({1})"));              // NOI18N

    wizardDesc.setModal(false);
}
 
Example 3
Source File: InstallUnitWizard.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private boolean implInvokeWizard (WizardDescriptor.Iterator<WizardDescriptor> iterator) {
    WizardDescriptor wizardDescriptor = new WizardDescriptor (iterator);
    wizardDescriptor.setModal (true);
    
    wizardDescriptor.setTitleFormat (new MessageFormat(NbBundle.getMessage (InstallUnitWizard.class, "InstallUnitWizard_MessageFormat")));
    wizardDescriptor.setTitle (NbBundle.getMessage (InstallUnitWizard.class, "InstallUnitWizard_Title"));
    
    Dialog dialog = DialogDisplayer.getDefault ().createDialog (wizardDescriptor);
    dialog.setVisible (true);
    dialog.toFront ();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    log.log (Level.FINE, "InstallUnitWizard returns with value " + wizardDescriptor.getValue ());
    return !cancelled;
}
 
Example 4
Source File: WizardOperatorTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Opens test wizard with 3 steps. */
private void showTestWizard() {
    TestPanel panel0 = new TestPanel(0);
    panel0.addPropertyChangeListener(this);
    TestPanel panel1 = new TestPanel(1);
    panel1.addPropertyChangeListener(this);
    TestPanel panel2 = new TestPanel(2);
    panel2.addPropertyChangeListener(this);
    WizardDescriptor.Panel[] panels = {
        panel0,
        panel1,
        panel2
    };
    WizardDescriptor.ArrayIterator iterator = new WizardDescriptor.ArrayIterator(panels);
    wd = new WizardDescriptor(iterator);
    wd.putProperty(PROP_AUTO_WIZARD_STYLE, Boolean.TRUE);
    wd.putProperty(PROP_CONTENT_DISPLAYED, Boolean.TRUE);
    wd.putProperty(PROP_CONTENT_NUMBERED, Boolean.TRUE);
    wd.putProperty(PROP_CONTENT_DATA, new String[]{
                TEST_WIZARD_PANEL0,
                TEST_WIZARD_PANEL1,
                TEST_WIZARD_PANEL2
            });
    wd.setTitle(TEST_WIZARD_TITLE);
    wd.setModal(false);
    dialog = DialogDisplayer.getDefault().createDialog(wd);
    dialog.setSize(600, 400);
    dialog.setVisible(true);
}
 
Example 5
Source File: NbPresenterLeakTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@RandomlyFails // NB-Core-Build #1189
public void testLeakingNbPresenterDescriptor () throws InterruptedException, InvocationTargetException {
    try {
        Class.forName("java.lang.AutoCloseable");
    } catch (ClassNotFoundException ex) {
        // this test is known to fail due to JDK bugs 7070542 & 7072167
        // which are unlikely to be fixed on JDK6. Thus, if AutoCloseable
        // is not present, skip the test
        return;
    }
    
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels(), null);
    wizardDescriptor.setModal (false);
    Dialog dialog = DialogDisplayer.getDefault ().createDialog (wizardDescriptor);
    WeakReference<WizardDescriptor> w = new WeakReference<WizardDescriptor> (wizardDescriptor);
    
    SwingUtilities.invokeAndWait (new EDTJob(dialog, true));
    assertShowing("button is visible", true, dialog);
    SwingUtilities.invokeAndWait (new EDTJob(dialog, false));
    assertShowing("button is no longer visible", false, dialog);
    boolean cancelled = wizardDescriptor.getValue() !=
        WizardDescriptor.FINISH_OPTION;
    Dialog d = new JDialog();
    
    // workaround for JDK bug 6575402
    JPanel p = new JPanel();
    d.setLayout(new BorderLayout());
    d.add(p, BorderLayout.CENTER);
    JButton btn = new JButton("Button");
    p.add(btn, BorderLayout.NORTH);
    
    SwingUtilities.invokeAndWait (new EDTJob(d, true));
    assertShowing("button is visible", true, btn);
    dialog.setBounds(Utilities.findCenterBounds(dialog.getSize()));
    SwingUtilities.invokeAndWait (new EDTJob(d, false));
    assertShowing("button is no longer visible", false, btn);

    assertNull ("BufferStrategy was disposed.", dialog.getBufferStrategy ());

    RepaintManager rm = RepaintManager.currentManager(dialog);
    rm.setDoubleBufferingEnabled(!rm.isDoubleBufferingEnabled());
    rm.setDoubleBufferingEnabled(!rm.isDoubleBufferingEnabled());
    
    dialog = null;
    wizardDescriptor = null;
    
    SwingUtilities.invokeAndWait (new Runnable() {

        @Override
        public void run() {
            Frame f = new Frame();
            f.setPreferredSize( new Dimension(100,100));
            f.setVisible( true );
            JDialog dlg = new JDialog(f);
            dlg.setVisible(true);
        }
    });

    assertGC ("Dialog disappears.", w);
}