Java Code Examples for org.openide.WizardDescriptor#Panel

The following examples show how to use org.openide.WizardDescriptor#Panel . 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: TemplateIterator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private String[] createSteps(String[] before, WizardDescriptor.Panel[] panels) {
    int diff = 0;
    if (before == null) {
        before = new String[0];
    } else if (before.length > 0) {
        diff = ("...".equals(before[before.length - 1])) ? 1 : 0; // NOI18N
    }
    String[] res = new String[(before.length - diff) + panels.length];
    for (int i = 0; i < res.length; i++) {
        if (i < (before.length - diff)) {
            res[i] = before[i];
        } else {
            res[i] = panels[i - before.length + diff].getComponent().getName();
        }
    }
    return res;
}
 
Example 2
Source File: NewTestWizardIterator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private String[] createSteps(String[] before, WizardDescriptor.Panel[] panels) {
    assert panels != null;
    // hack to use the steps set before this panel processed
    int diff = 0;
    if (before == null) {
        before = new String[0];
    } else if (before.length > 0) {
        diff = ("...".equals(before[before.length - 1])) ? 1 : 0; // NOI18N
    }
    String[] res = new String[(before.length - diff) + panels.length];
    for (int i = 0; i < res.length; i++) {
        if (i < (before.length - diff)) {
            res[i] = before[i];
        } else {
            res[i] = panels[i - before.length + diff].getComponent().getName();
        }
    }
    return res;
}
 
Example 3
Source File: MessageHandlerWizard.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void initialize(WizardDescriptor wizard) {

        wiz = wizard;
        project = Templates.getProject(wiz);
        SourceGroup[] sourceGroups = SourceGroups.getJavaSourceGroups(project);

        //create the Java Project chooser
        if (sourceGroups.length == 0) {
            SourceGroup[] genericSourceGroups = ProjectUtils.getSources(project).getSourceGroups(Sources.TYPE_GENERIC);
            firstPanel = new FinishableProxyWizardPanel(Templates.createSimpleTargetChooser(project, genericSourceGroups, new BottomPanel()), sourceGroups, false);
        } else {
            firstPanel = new FinishableProxyWizardPanel(JavaTemplates.createPackageChooser(project, sourceGroups, new BottomPanel(), true));
        }
        JComponent c = (JComponent) firstPanel.getComponent();
        Utils.changeLabelInComponent(c, NbBundle.getMessage(MessageHandlerWizard.class, "LBL_JavaTargetChooserPanelGUI_ClassName_Label"), NbBundle.getMessage(MessageHandlerWizard.class, "LBL_Handler_Name")); //NOI18N
        c.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, HANDLER_STEPS);
        c.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(0));
        c.getAccessibleContext().setAccessibleDescription(HANDLER_STEPS[0]);
        wizardPanels = new WizardDescriptor.Panel[]{firstPanel};
    }
 
Example 4
Source File: ImportBlueprintEarWizardIterator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private WizardDescriptor.Panel[] createPanels() {
    return new WizardDescriptor.Panel[] {
        new ProjectImportLocationWizardPanel(J2eeModule.EAR, 
                NbBundle.getMessage(NewEarProjectWizardIterator.class, "LBL_NWP1_ProjectTitleName"),
                NbBundle.getMessage(NewEarProjectWizardIterator.class, "TXT_ImportProject"),
                NbBundle.getMessage(NewEarProjectWizardIterator.class, "LBL_NPW1_DefaultProjectName"),
                NbBundle.getMessage(NewEarProjectWizardIterator.class, "LBL_ImportInstructions1")),
        new ProjectServerWizardPanel(J2eeModule.EAR, 
                NbBundle.getMessage(NewEarProjectWizardIterator.class, "NewEarProjectWizardIterator.secondStep"),
                NbBundle.getMessage(NewEarProjectWizardIterator.class, "TXT_ImportProject"),
                false, false, false, false, true, false),
        new PanelModuleDetection()
    };
}
 
Example 5
Source File: ManagedBeanPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void updateManagedBeanName(WizardDescriptor.Panel panel) {
    String targetName = null;
    Component gui = panel.getComponent();
    try {
        // XXX JavaTargetChooserPanel should introduce new API to get current contents
        // of its component JavaTargetChooserPanelGUI (see Issue#154655)
        Method getTargetName = gui.getClass().getMethod("getTargetName", (Class[]) null); // NOI18N
        targetName = (String) getTargetName.invoke(gui, (Object[]) null);
    } catch (Exception ex) {
        return;
    }

    if ((targetName == null) || targetName.trim().equals("")) {
        return;
    }

    if (managedBeanClass!=null && targetName.equals(managedBeanClass.substring(0, 1).toUpperCase()+ managedBeanClass.substring(1))) {
        return;
    } else {
        managedBeanClass = targetName.substring(0, 1).toLowerCase()+targetName.substring(1);
    }

    getComponent();
    String name = component.getManagedBeanName();
    if ((name == null) || !name.equals(managedBeanClass)) {
        component.setManagedBeanName(managedBeanClass);
    }
}
 
Example 6
Source File: EmptyTestCaseWizardIterator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("MSG_WizardInitializationError=There was an error initializing the wizard.")
   private WizardDescriptor.Panel<WizardDescriptor> getTargetPanel() {
if(wizard == null) {
    targetPanel = new StepProblemMessage(null, Bundle.MSG_WizardInitializationError());
    return targetPanel;
}
       final Project project = Templates.getProject(wizard);
       if (targetPanel == null || project != lastSelectedProject) {
           Collection<SourceGroup> sourceGroups = JUnitUtils.getTestTargets(project, true);
           if (sourceGroups.isEmpty()) {
               if (SourceGroupModifier.createSourceGroup(project, JavaProjectConstants.SOURCES_TYPE_JAVA, JavaProjectConstants.SOURCES_HINT_TEST) != null) {
                   sourceGroups = JUnitUtils.getTestTargets(project, true);
               }
           }
           if (sourceGroups.isEmpty()) {
               targetPanel = new StepProblemMessage(
                       project,
                       NbBundle.getMessage(EmptyTestCaseWizardIterator.class,
                                           "MSG_NoTestSourceGroup"));  //NOI18N
           } else {
               SourceGroup[] testSrcGroups;
               sourceGroups.toArray(testSrcGroups = new SourceGroup[sourceGroups.size()]);
               if (optionsPanel == null) {
                   optionsPanel = new EmptyTestStepLocation();
               }
               targetPanel = JavaTemplates.createPackageChooser(project, testSrcGroups, new EmptyTestStepLocation());
           }
           lastSelectedProject = project;
       }

       return targetPanel;
   }
 
Example 7
Source File: NewJavaFreeformProjectSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * There is special logic in Java panels that Sources panel should enable 
 * Next button only when at least one source folder was specified. Wizard
 * iterator which is using panels created by createJavaPanels() method 
 * should always call this method in hasNext() method.
 */
public static boolean enableNextButton(WizardDescriptor.Panel panel) {
    if (panel instanceof SourceFoldersWizardPanel) {
        SourceFoldersPanel sfp = (SourceFoldersPanel)panel.getComponent();
        if (!sfp.hasSomeSourceFolder()) {
            return false;
        }
    }
    return true;
}
 
Example 8
Source File: PersistenceUnitWizard.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(WizardDescriptor wizard) {
    project = Templates.getProject(wizard);
    descriptor = new PersistenceUnitWizardDescriptor(project);
    panels = new WizardDescriptor.Panel[] {descriptor};
    wizard.putProperty("NewFileWizard_Title",
            NbBundle.getMessage(PersistenceUnitWizard.class, "Templates/Persistence/PersistenceUnit"));
    Wizards.mergeSteps(wizard, panels, null);
}
 
Example 9
Source File: WebServiceClientWizardIterator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public WizardDescriptor.Panel<WizardDescriptor> current() {
   return panels[index];
}
 
Example 10
Source File: ImportBlueprintEarWizardIterator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public WizardDescriptor.Panel current() {
    return panels[index];
}
 
Example 11
Source File: WildflyInstantiatingIterator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected final WizardDescriptor.Panel[] getPanels() {
    if (panels == null) {
        panels = createPanels();
    }
    return panels;
}
 
Example 12
Source File: NewNbModuleWizardIterator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public WizardDescriptor.Panel<WizardDescriptor> current() {
    return panels.get(position);
}
 
Example 13
Source File: hostviewWizardIterator.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
public WizardDescriptor.Panel current() {
    return panels[index];
}
 
Example 14
Source File: ServiceLocatorWizard.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public WizardDescriptor.Panel current () {
    return panels[index];
}
 
Example 15
Source File: MetadataWizardIterator.java    From nb-springboot with Apache License 2.0 4 votes vote down vote up
@Override
public WizardDescriptor.Panel<WizardDescriptor> current() {
    return panel;
}
 
Example 16
Source File: ProjectImporterWizard.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public List<WizardDescriptor.Panel<WizardDescriptor>> getExtraPanels() {
    return extraPanels;
}
 
Example 17
Source File: ImportEjbJarProjectWizardIterator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public WizardDescriptor.Panel current() {
    return panels[index];
}
 
Example 18
Source File: AbstractFileWizard.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private WizardDescriptor.Panel[] createPanels() {
    return new WizardDescriptor.Panel[] {
        JavaTemplates.createPackageChooser(project, sourceGroupToArray(getSourceGroups()))
    };
}
 
Example 19
Source File: JerseyClientWizardIterator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public WizardDescriptor.Panel<WizardDescriptor> current() {
    return getPanels()[index];
}
 
Example 20
Source File: BaseWizardIterator.java    From netbeans with Apache License 2.0 votes vote down vote up
protected abstract WizardDescriptor.Panel[] createPanels(ValidationGroup vg);