|
org.openide.loaders 5.9.22 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openide.NotifyDescriptor org.openide.DialogDescriptor org.openide.WizardDescriptor org.openide.loaders.TemplateWizard
public class TemplateWizard
Wizard for creation of new objects from a template.
Nested Class Summary | |
---|---|
static interface |
TemplateWizard.Iterator
The interface for custom iterator. |
Nested classes/interfaces inherited from class org.openide.WizardDescriptor |
---|
WizardDescriptor.ArrayIterator, WizardDescriptor.AsynchronousInstantiatingIterator, WizardDescriptor.AsynchronousValidatingPanel, WizardDescriptor.FinishablePanel, WizardDescriptor.FinishPanel, WizardDescriptor.InstantiatingIterator, WizardDescriptor.Panel, WizardDescriptor.ValidatingPanel |
Nested classes/interfaces inherited from class org.openide.NotifyDescriptor |
---|
NotifyDescriptor.Confirmation, NotifyDescriptor.Exception, NotifyDescriptor.InputLine, NotifyDescriptor.Message |
Field Summary |
---|
Fields inherited from class org.openide.WizardDescriptor |
---|
FINISH_OPTION, NEXT_OPTION, PREVIOUS_OPTION |
Fields inherited from class org.openide.DialogDescriptor |
---|
BOTTOM_ALIGN, DEFAULT_ALIGN, PROP_BUTTON_LISTENER, PROP_CLOSING_OPTIONS, PROP_HELP_CTX, PROP_LEAF, PROP_MODAL, PROP_OPTIONS_ALIGN, RIGHT_ALIGN |
Fields inherited from class org.openide.NotifyDescriptor |
---|
CANCEL_OPTION, CLOSED_OPTION, DEFAULT_OPTION, ERROR_MESSAGE, INFORMATION_MESSAGE, NO_OPTION, OK_CANCEL_OPTION, OK_OPTION, PLAIN_MESSAGE, PROP_DETAIL, PROP_MESSAGE, PROP_MESSAGE_TYPE, PROP_OPTION_TYPE, PROP_OPTIONS, PROP_TITLE, PROP_VALID, PROP_VALUE, QUESTION_MESSAGE, WARNING_MESSAGE, YES_NO_CANCEL_OPTION, YES_NO_OPTION, YES_OPTION |
Constructor Summary | |
---|---|
|
TemplateWizard()
Creates new TemplateWizard |
protected |
TemplateWizard(TemplateWizard.Iterator it)
Constructor for wizards that require the target chooser or template chooser panel. |
Method Summary | |
---|---|
protected TemplateWizard.Iterator |
createDefaultIterator()
Allows subclasses to provide their own default iterator the one that will be used if not special iterator is associated with selected template. |
protected WizardDescriptor.Panel |
createTargetChooser()
Method that allows subclasses to second (default) panel. |
protected WizardDescriptor.Panel |
createTemplateChooser()
Method that allows subclasses to provide their own panel for choosing the template (the first panel). |
static URL |
getDescription(DataObject obj)
Method to get a description for a data object. |
static String |
getDescriptionAsResource(DataObject obj)
Deprecated. Use getDescription(org.openide.loaders.DataObject) instead. |
static TemplateWizard.Iterator |
getIterator(DataObject obj)
Finds a custom iterator attached to a template that should be used to instantiate the object. |
DataFolder |
getTargetFolder()
Getter for target folder. |
String |
getTargetName()
Getter for the name of the target template. |
DataObject |
getTemplate()
Getter for template to create object from. |
DataFolder |
getTemplatesFolder()
Getter for the folder with templates. |
MessageFormat |
getTitleFormat()
Overriden to be able to set a default value for the title format. |
protected Set |
handleInstantiate()
Calls iterator's instantiate. |
protected void |
initialize()
Initializes important settings. |
Set |
instantiate()
Chooses the template and instantiates it. |
Set |
instantiate(DataObject template)
Chooses the template and instantiates it. |
Set |
instantiate(DataObject template,
DataFolder targetFolder)
Chooses the template and instantiates it. |
static void |
setDescription(DataObject obj,
URL url)
Method to attach a description to a data object. |
static void |
setDescriptionAsResource(DataObject obj,
String rsrc)
Deprecated. Use setDescription(org.openide.loaders.DataObject, java.net.URL) instead. |
static void |
setIterator(DataObject obj,
TemplateWizard.Iterator iter)
Deprecated. since 2.13 you should provide the iterator from getCookie method |
void |
setTargetFolder(DataFolder f)
Sets the target folder. |
void |
setTargetName(String name)
Setter for the name of the template. |
void |
setTemplate(DataObject obj)
Sets the template. |
void |
setTemplatesFolder(DataFolder folder)
Setter for the folder with templates. |
void |
setTitleFormat(MessageFormat format)
Overriden to be able to set own default value for the title format. |
WizardDescriptor.Panel |
targetChooser()
Returns wizard panel that that is used to choose target folder and name of the template. |
WizardDescriptor.Panel |
templateChooser()
Returns wizard panel that is used to choose a template. |
protected void |
updateState()
Overriden to add/remove listener to/from displayed component. |
Methods inherited from class org.openide.WizardDescriptor |
---|
getInstantiatedObjects, getProperty, getValue, putProperty, setAdditionalOptions, setClosingOptions, setHelpCtx, setOptions, setPanels, setValue |
Methods inherited from class org.openide.DialogDescriptor |
---|
getButtonListener, getClosingOptions, getHelpCtx, getOptionsAlign, isLeaf, isModal, setButtonListener, setLeaf, setModal, setOptionsAlign |
Methods inherited from class org.openide.NotifyDescriptor |
---|
addPropertyChangeListener, firePropertyChange, getAdditionalOptions, getDefaultValue, getMessage, getMessageType, getOptions, getOptionType, getTitle, getTitleForType, isValid, removePropertyChangeListener, setMessage, setMessageType, setOptionType, setTitle, setValid |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TemplateWizard()
protected TemplateWizard(TemplateWizard.Iterator it)
it
- panel iterator instanceMethod Detail |
---|
protected void initialize()
initialize
in class WizardDescriptor
public DataObject getTemplate()
public void setTemplate(DataObject obj)
obj
- the template to start withpublic void setTemplatesFolder(DataFolder folder)
folder
- the root folder for all templates if null the
default folder is usedpublic DataFolder getTemplatesFolder()
public DataFolder getTargetFolder() throws IOException
IOException
- if the target folder has not been setpublic void setTargetFolder(DataFolder f)
f
- the folderpublic String getTargetName()
null
if not yet setpublic void setTargetName(String name)
name
- name for the new object, or null
public WizardDescriptor.Panel templateChooser()
public WizardDescriptor.Panel targetChooser()
protected WizardDescriptor.Panel createTemplateChooser()
protected WizardDescriptor.Panel createTargetChooser()
protected TemplateWizard.Iterator createDefaultIterator()
This implementation creates iterator that just shows the targetChooser panel.
public Set instantiate() throws IOException
IOException
- I/O errorpublic Set instantiate(DataObject template) throws IOException
template
- predefined template that should be instantiated
IOException
- I/O errorpublic Set instantiate(DataObject template, DataFolder targetFolder) throws IOException
template
- predefined template that should be instantiatedtargetFolder
- the target folder
IOException
- I/O errorpublic void setTitleFormat(MessageFormat format)
setTitleFormat
in class WizardDescriptor
format
- message formatpublic MessageFormat getTitleFormat()
getTitleFormat
in class WizardDescriptor
protected Set handleInstantiate() throws IOException
IOException
- if the instantiation failspublic static void setDescription(DataObject obj, URL url) throws IOException
nbresloc
protocol.
obj
- data object to attach description tourl
- the url with description or null if there should be
no description
IOException
- if I/O failspublic static URL getDescription(DataObject obj)
obj
- data object to attach description to
public static void setDescriptionAsResource(DataObject obj, String rsrc) throws IOException
setDescription(org.openide.loaders.DataObject, java.net.URL)
instead.
obj
- data object to set description forrsrc
- a resource string, e.g. "com/foo/MyPage.html", or null
to clear
IOException
- if the attribute cannot be setpublic static String getDescriptionAsResource(DataObject obj)
getDescription(org.openide.loaders.DataObject)
instead.
obj
- the data object
null
if unset (incl. if only set as a raw URL)public static void setIterator(DataObject obj, TemplateWizard.Iterator iter) throws IOException
getCookie
method
Better way for providing an Iterator is to return it from the
dataobject.getCookie (TemplateWizard.Iterator.class)
call.
obj
- data objectiter
- TemplateWizard.Iterator to use for instantiation of this
data object, or null
to clear
IOException
- if I/O failspublic static TemplateWizard.Iterator getIterator(DataObject obj)
setIterator
method, if not it asks the
data object for the Iterator as cookie.
obj
- the data object
protected void updateState()
updateState
in class WizardDescriptor
|
org.openide.loaders 5.9.22 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |