## org.eclipse.wst.server.ui.wizard
Class WizardFragment

    java.lang.Object
      org.eclipse.wst.server.ui.wizard.WizardFragment

    public abstract class WizardFragment

extends java.lang.Object

A wizard fragment is a node within a wizard that provides a completely extendable wizard flow by supporting a flexible tree structure for the pages. As the user walks pages through the wizard, they are actually traversing the nodes of a tree, and each node can add or remove children at any time. Each node may be non-UI (useful for injecting behaviour into the tree) or contain a single wizard page (@see hasComposite() and createComposite(Composite, IWizardHandle)). The node may also have children (@see getChildFragments(), which should be updated or refreshed whenever the updateChildFragments() method is called by another node to let this node know that it's state may have changed. This implementation uses a createChildFragments() method to allow the fragment to add it's children into the tree. Note that this method may be called multiple times as the tree is updated and it must return the same instance of any children that have previously been returned.

Since:
  1.0

Constructor Summary
`WizardFragment()`

Method Summary
`Composite` `createComposite(Composite parent, IWizardHandle handle)` Creates the composite associated with this fragment.
`void` `enter()` Called when the wizard that this fragment belongs to has traversed into this wizard fragment.
`void` `exit()` Called when the wizard that this fragment belongs to has traversed out of this wizard fragment.
`java.util.List` `getChildFragments()` Returns the child fragments.
`TaskModel` `getTaskModel()` Returns the wizard task model.
`boolean` `hasComposite()` Returns `true` if this fragment has an associated UI, and `false` otherwise.
`boolean` `isComplete()` Returns true if this fragment is complete (can finish).
`void` `performCancel(IProgressMonitor monitor)` Called when the wizard that this fragment belongs to is canceled.
`void` `performFinish(IProgressMonitor monitor)` Called when the wizard that this fragment belongs to is finished.
`void` `setTaskModel(TaskModel taskModel)` Sets the wizard task model.
`void` `updateChildFragments()` Called to give the fragment a chance to update it's child fragments in response to other changes within the wizard or task model.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WizardFragment

    public WizardFragment()

Method Detail

### hasComposite

    public boolean hasComposite()

  Returns `true` if this fragment has an associated UI, and `false` otherwise.

  Returns:
    true if the fragment has a composite

### createComposite

    public Composite createComposite(Composite parent,
                                     IWizardHandle handle)

  Creates the composite associated with this fragment. This method is only called when hasComposite() returns true.

  Parameters:
    `parent` - a parent composite
    `handle` - a wizard handle
  Returns:
    the created composite

### setTaskModel

    public void setTaskModel(TaskModel taskModel)

  Sets the wizard task model.

  A task model is shared by all fragments in the wizard and is used to share data. It contains information about the overall task flow and allows fragments to store and retrieve data. Its usage allows multiple fragments to be chained together and share data from the output of one fragment to the input of another.

  Parameters:
    `taskModel` - the task model
  See Also:
    `getTaskModel()`

### getTaskModel

    public TaskModel getTaskModel()

  Returns the wizard task model.

  Returns:
    the task model
  See Also:
    `setTaskModel(TaskModel)`

### enter

    public void enter()

  Called when the wizard that this fragment belongs to has traversed into this wizard fragment. It is called to give the fragment the opportunity to initialize any values shown in the composite or update the task model.

  When finish is pressed, the current fragment is exit()ed, and then performFinish() is called on all of the fragments in the tree. enter() and exit() are not called on the remaining fragments.

### exit

    public void exit()

  Called when the wizard that this fragment belongs to has traversed out of this wizard fragment. It is called to give the fragment the opportunity to save any values entered into the composite or update the task model.

  When finish is pressed, the current fragment is exit()ed, and then performFinish() is called on all of the fragments in the tree. enter() and exit() are not called on the remaining fragments.

### performFinish

    public void performFinish(IProgressMonitor monitor)
                       throws CoreException

  Called when the wizard that this fragment belongs to is finished. After exit()ing the current page, all fragment's performFinish() methods are called in order.

  This method is not called on the UI thread and must not access the composite. Not only might the user never have accessed the fragment's composite, but this method may be called asynchronously on a job once the wizard has closed.

  Parameters:
    `monitor` - a progress monitor, or `null` if progress reporting and cancellation are not desired
  Throws:
    `CoreException` - if something goes wrong

### performCancel

    public void performCancel(IProgressMonitor monitor)
                       throws CoreException

  Called when the wizard that this fragment belongs to is canceled. After exit()ing the current page, all fragment's performCancel() methods are called in order.

  This method is not called on the UI thread and must not access the composite. Not only might the user never have accessed the fragment's composite, but this method may be called asynchronously on a job once the wizard has closed.

  Parameters:
    `monitor` - a progress monitor, or `null` if progress reporting and cancellation are not desired
  Throws:
    `CoreException` - if something goes wrong

### getChildFragments

    public java.util.List getChildFragments()

  Returns the child fragments. Child fragments come directly after this fragment in the wizard flow.

  Returns:
    a list of child fragments

### updateChildFragments

    public void updateChildFragments()

  Called to give the fragment a chance to update it's child fragments in response to other changes within the wizard or task model.

### isComplete

    public boolean isComplete()

  Returns true if this fragment is complete (can finish). If it is complete the user will be allowed to go to the next fragment or finish the wizard. If the fragment is not complete, the Next button will be disabled. If the fragment is complete but another fragment is not complete, the Finish button will not be enabled.

  Returns:
    `true` if the fragment is complete, and `false` otherwise