本文整理汇总了Java中org.openide.WizardDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java WizardDescriptor类的具体用法?Java WizardDescriptor怎么用?Java WizardDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WizardDescriptor类属于org.openide包,在下文中一共展示了WizardDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addPlatform
import org.openide.WizardDescriptor; //导入依赖的package包/类
@Messages("CTL_AddNetbeansPlatformTitle=Add NetBeans Platform")
private void addPlatform(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPlatform
PlatformChooserWizardPanel chooser = new PlatformChooserWizardPanel(null);
PlatformInfoWizardPanel info = new PlatformInfoWizardPanel(null);
WizardDescriptor wd = new WizardDescriptor(new BasicWizardPanel[] {chooser, info});
initPanel(chooser, wd, 0);
initPanel(info, wd, 1);
wd.setTitleFormat(new MessageFormat("{0}")); // NOI18N
Dialog dialog = DialogDisplayer.getDefault().createDialog(wd);
dialog.setTitle(CTL_AddNetbeansPlatformTitle());
dialog.setVisible(true);
dialog.toFront();
if (wd.getValue() == WizardDescriptor.FINISH_OPTION) {
String plafDir = (String) wd.getProperty(PLAF_DIR_PROPERTY);
String plafLabel = (String) wd.getProperty(PLAF_LABEL_PROPERTY);
String id = plafLabel.replace(' ', '_');
NbPlatform plaf = getPlafListModel().addPlatform(id, plafDir, plafLabel);
if (plaf != null) {
platformsList.setSelectedValue(plaf, true);
refreshPlatform();
}
}
}
示例2: modifyOptionsForDisabledCancel
import org.openide.WizardDescriptor; //导入依赖的package包/类
public void modifyOptionsForDisabledCancel (final WizardDescriptor wd) {
recognizeButtons (wd);
Object [] options = wd.getOptions ();
final List<JButton> newOptionsL = new ArrayList<JButton> ();
List<Object> optionsL = Arrays.asList (options);
for (Object o : optionsL) {
assert o instanceof JButton : o + " instanceof JButton";
if (o instanceof JButton) {
JButton b = (JButton) o;
if (b.equals (getOriginalCancel (wd))) {
JButton disabledCancel = new JButton (b.getText ());
disabledCancel.setEnabled (false);
newOptionsL.add (disabledCancel);
} else {
newOptionsL.add (b);
}
}
}
SwingUtilities.invokeLater (new Runnable () {
@Override
public void run () {
wd.setOptions (newOptionsL.toArray ());
}
});
}
示例3: getTargetPanel
import org.openide.WizardDescriptor; //导入依赖的package包/类
private WizardDescriptor.Panel getTargetPanel() {
if (targetPanel == null) {
targetPanel = templateWizard.targetChooser();
// fill component with step hints
if (targetPanel.getComponent() instanceof JComponent) {
JComponent panel = (JComponent) targetPanel.getComponent();
targetSteps = panel.getClientProperty(WizardDescriptor.PROP_CONTENT_DATA);
String[] steps = new String[3];
//steps[0] = "Hello";
steps[0] = getTargetPanelName();
steps[1] = getDocumentPanelName();
steps[2] = Util.THIS.getString(XMLWizardIterator.class, "MSG_unknown");
String[] newSteps = createSteps(beforeSteps,steps);
panel.putClientProperty(
WizardDescriptor.PROP_CONTENT_DATA, // NOI18N
newSteps
);
}
}
return targetPanel;
}
示例4: NameIconLocationPanel
import org.openide.WizardDescriptor; //导入依赖的package包/类
/** Creates new NameIconLocationPanel */
public NameIconLocationPanel(final WizardDescriptor setting, final DataModel data) {
super(setting);
this.data = data;
initComponents();
initAccessibility();
putClientProperty("NewFileWizard_Title", getMessage("LBL_WizardWizardTitle"));
DocumentListener updateListener = new UIUtil.DocumentAdapter() {
public void insertUpdate(DocumentEvent e) {
updateData();
}
};
classNamePrefix.getDocument().addDocumentListener(updateListener);
displayName.getDocument().addDocumentListener(updateListener);
icon.getDocument().addDocumentListener(updateListener);
Component editorComp = packageName.getEditor().getEditorComponent();
if (editorComp instanceof JTextComponent) {
((JTextComponent) editorComp).getDocument().addDocumentListener(updateListener);
}
if (category.getEditor().getEditorComponent() instanceof JTextField) {
JTextComponent txt = (JTextComponent) category.getEditor().getEditorComponent();
txt.getDocument().addDocumentListener(updateListener);
}
}
示例5: getClassChooserPanel
import org.openide.WizardDescriptor; //导入依赖的package包/类
/**
* Returns a panel for choosing name and target location of the test
* class. If the panel already exists, returns the existing panel,
* otherwise creates a new panel.
*
* @return existing panel or a newly created panel if it did not exist
*/
private WizardDescriptor.Panel<WizardDescriptor> getClassChooserPanel() {
final Project project = Templates.getProject(wizard);
if (classChooserPanel == null || project != lastSelectedProject) {
SourceGroupModifier.createSourceGroup(project, JavaProjectConstants.SOURCES_TYPE_JAVA, JavaProjectConstants.SOURCES_HINT_TEST);
final JUnitUtils utils = new JUnitUtils(project);
if (utils.getSourcesToTestsMap(true).isEmpty()) {
classChooserPanel = new StepProblemMessage(
project,
NbBundle.getMessage(EmptyTestCaseWizardIterator.class,
"MSG_NoTestSourceGroup")); //NOI18N
} else {
if (classChooserPanel == null) {
classChooserPanel = new SimpleTestStepLocation();
}
((SimpleTestStepLocation) classChooserPanel).setUp(utils);
}
}
lastSelectedProject = project;
return classChooserPanel;
}
示例6: getXMLContentPanel
import org.openide.WizardDescriptor; //导入依赖的package包/类
private WizardDescriptor.Panel getXMLContentPanel() {
if (xmlPanel == null) {
xmlPanel = new XMLContentPanel();
xmlPanel.setObject(model);
String[] steps = new String[4];
steps[0] = getTargetPanelName();
steps[1] = getDocumentPanelName();
steps[2] = getSchemaPanelName();
steps[3] = getXMLContentPanelName();
String[] newSteps = createSteps(beforeSteps,steps);
xmlPanel.putClientProperty(
WizardDescriptor.PROP_CONTENT_DATA, // NOI18N
newSteps
);
}
return new AbstractPanel.WizardStep(xmlPanel);
}
示例7: createSteps
import org.openide.WizardDescriptor; //导入依赖的package包/类
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;
}
示例8: readSettings
import org.openide.WizardDescriptor; //导入依赖的package包/类
@Override
public void readSettings(WizardDescriptor wizard) {
this.wizard = wizard;
if (gui != null) {
// Try to preselect a folder
FileObject preselectedFolder = Templates.getTargetFolder(wizard);
// Init values
gui.initValues(Templates.getTemplate(wizard), preselectedFolder);
}
// XXX hack, TemplateWizard in final setTemplateImpl() forces new wizard's title
// this name is used in NewFileWizard to modify the title
if (gui != null) {
Object substitute = gui.getClientProperty ("NewFileWizard_Title"); // NOI18N
if (substitute != null) {
wizard.putProperty ("NewFileWizard_Title", substitute); // NOI18N
}
}
}
示例9: show
import org.openide.WizardDescriptor; //导入依赖的package包/类
public boolean show() {
wizardIterator = new PanelsIterator();
wizardDescriptor = new WizardDescriptor(wizardIterator);
wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); // NOI18N
wizardDescriptor.setTitle(org.openide.util.NbBundle.getMessage(CheckoutWizard.class, "CTL_Checkout")); // NOI18N
Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CheckoutWizard.class, "CTL_Checkout"));
dialog.setVisible(true);
dialog.toFront();
Object value = wizardDescriptor.getValue();
boolean finnished = value == WizardDescriptor.FINISH_OPTION;
if(finnished) {
onFinished();
} else {
// wizard wasn't properly finnished ...
if(value == WizardDescriptor.CLOSED_OPTION ||
value == WizardDescriptor.CANCEL_OPTION )
{
// wizard was closed or canceled -> reset all steps & kill all running tasks
repositoryStep.stop();
}
}
return finnished;
}
示例10: initialize
import org.openide.WizardDescriptor; //导入依赖的package包/类
@Override
public void initialize(WizardDescriptor wiz) {
this.wiz = wiz;
index = 0;
panels = createPanels();
// Make sure list of steps is accurate.
String[] steps = createSteps();
for (int i = 0; i < panels.length; i++) {
Component c = panels[i].getComponent();
if (steps[i] == null) {
// Default step name to component name of panel.
// Mainly useful for getting the name of the target
// chooser to appear in the list of steps.
steps[i] = c.getName();
}
if (c instanceof JComponent) { // assume Swing components
JComponent jc = (JComponent) c;
// Step #.
// TODO if using org.openide.dialogs >= 7.8, can use WizardDescriptor.PROP_*:
jc.putClientProperty("WizardPanel_contentSelectedIndex", i);
// Step name (actually the whole list for reference).
jc.putClientProperty("WizardPanel_contentData", steps);
}
}
}
示例11: readSettings
import org.openide.WizardDescriptor; //导入依赖的package包/类
@Override
public void readSettings(WizardDescriptor settings) {
wizardDescriptor = settings;
wizardDescriptor.putProperty("NewFileWizard_Title", title); // NOI18N
if (!componentInitialized) {
componentInitialized = true;
project = Templates.getProject(wizardDescriptor);
RelatedCMPHelper helper = RelatedCMPWizard.getHelper(wizardDescriptor);
DBSchemaFileList dbschemaFileList = helper.getDBSchemaFileList();
PersistenceGenerator persistenceGen = helper.getPersistenceGenerator();
TableSource tableSource = helper.getTableSource();
FileObject targetFolder = Templates.getTargetFolder(wizardDescriptor);
getComponent().initialize(project, dbschemaFileList, persistenceGen, tableSource, targetFolder);
}
}
示例12: getDTDPanel
import org.openide.WizardDescriptor; //导入依赖的package包/类
private WizardDescriptor.Panel getDTDPanel() {
if (dtdPanel == null) {
dtdPanel = new DTDPanel();
dtdPanel.setObject(model);
String[] steps = new String[3];
steps[0] = getTargetPanelName();
steps[1] = getDocumentPanelName();
steps[2] = getDTDPanelName();
String[] newSteps = createSteps(beforeSteps,steps);
dtdPanel.putClientProperty(
WizardDescriptor.PROP_CONTENT_DATA, // NOI18N
newSteps
);
}
return new AbstractPanel.WizardStep(dtdPanel);
}
示例13: read
import org.openide.WizardDescriptor; //导入依赖的package包/类
void read(WizardDescriptor d) {
Object lastType = d.getProperty("wizard-type"); // NOI18N
if (lastType == null || lastType != type) {
//bugfix #46387 The type of project changed, reset values to defaults
d.putProperty("name", null); // NOI18N
d.putProperty("projdir", null); // NOI18N
}
projectLocationPanel.read(d);
optionsPanel.read(d);
}
示例14: initialize
import org.openide.WizardDescriptor; //导入依赖的package包/类
@Override
public void initialize(WizardDescriptor wizard) {
this.wizard = wizard;
project =
Templates.getProject(wizard);
String wizardTitle = NbBundle.getMessage(HibernateConfigurationWizard.class, "LBL_ConfWizardTitle"); // NOI18N
descriptor =
new HibernateConfigurationWizardDescriptor(project, wizardTitle);
getPanels();
// #164631 - the 1st java source folder is the default
List<SourceGroup> javaSourceGroups = HibernateUtil.getJavaSourceGroups(project);
assert javaSourceGroups.size() > 0 : "No Java Sources found for project " + project.getProjectDirectory();
Templates.setTargetFolder(wizard, javaSourceGroups.get(0).getRootFolder());
// Set the targetName here. Default name for new files should be in the form : 'hibernate<i>.cfg.xml
// and not like : hibernate.cfg<i>.xml.
if (wizard instanceof TemplateWizard) {
HibernateEnvironment hibernateEnv = (HibernateEnvironment) project.getLookup().lookup(HibernateEnvironment.class);
// Check for unsupported projects. #142296
if (hibernateEnv == null) {
// Returning without initialization. User will be informed about this using error panel.
return;
}
List<FileObject> configFiles = hibernateEnv.getAllHibernateConfigFileObjects();
String targetName = DEFAULT_CONFIGURATION_FILENAME;
if (!configFiles.isEmpty() && foundConfigFileInProject(configFiles, DEFAULT_CONFIGURATION_FILENAME)) {
int configFilesCount = configFiles.size();
targetName = "hibernate" + (configFilesCount++) + ".cfg"; //NOI18N
while (foundConfigFileInProject(configFiles, targetName)) {
targetName = "hibernate" + (configFilesCount++) + ".cfg"; //NOI18N
}
}
((TemplateWizard) wizard).setTargetName(targetName);
}
}
示例15: initialize
import org.openide.WizardDescriptor; //导入依赖的package包/类
@Override
public void initialize(WizardDescriptor wiz) {
panel = getPanel(wiz);
this.wiz = wiz;
// Make sure list of steps is accurate.
String[] beforeSteps = null;
Object prop = wiz.getProperty (WizardDescriptor.PROP_CONTENT_DATA);
if (prop != null && prop instanceof String[]) {
beforeSteps = (String[])prop;
}
String[] steps = createSteps (beforeSteps);
for (int i = 0; i < 1; i++) { // XXX what was this loop for, exactly? panels.length was always 1
Component c = panel.getComponent();
if (steps[i] == null) {
// Default step name to component name of panel.
// Mainly useful for getting the name of the target
// chooser to appear in the list of steps.
steps[i] = c.getName();
}
if (c instanceof JComponent) { // assume Swing components
JComponent jc = (JComponent)c;
// Step #.
jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, new Integer(i));
// Step name (actually the whole list for reference).
jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
}
}
}