sk.uniba.euromath.editor.wizards.document
Class FillNewElementWizardProvider

java.lang.Object
  extended by sk.uniba.euromath.editor.wizards.document.FillNewElementWizardProvider
All Implemented Interfaces:
IMultiWizardProvider

public class FillNewElementWizardProvider
extends Object
implements IMultiWizardProvider

Fills given element with new content. The element is expected to be freshly created and thus must not contain any children nodes nor attributes.

Author:
Martin Vysny

Nested Class Summary
protected  class FillNewElementWizardProvider.AbstractStepFactory
          Produces new steps.
protected  class FillNewElementWizardProvider.CreateAttributesWS
          Step that allows user to create attributes in newly created element.
protected  class FillNewElementWizardProvider.CreateElementContentsWS
          Creates new elements or text nodes in new element.
protected static interface FillNewElementWizardProvider.WizardStep
          Represents one step in wizard.
 
Field Summary
protected  FillNewElementWizardProvider.AbstractStepFactory firstFactory
          The first factory.
protected  String name
          The provider name.
protected  NamespaceManager startupManager
          Namespace manager provided at construction time.
protected  List<FillNewElementWizardProvider.AbstractStepFactory> stepFactories
          All wizard step factories.
protected  List<FillNewElementWizardProvider.WizardStep> visitedSteps
          List of steps that have been already visited.
protected  XMLAccess xmlAccess
          The document instance.
 
Constructor Summary
FillNewElementWizardProvider(Element element, NewElementRule rule, XMLAccess xmlAccess, NamespaceManager nsMan, String name)
          Creates instance of the wizard.
 
Method Summary
 IWizard current()
          Fetches the current wizard.
 void dispose()
          Provider should dispose any objects it collected.
 String getName()
          Returns name of this wizard.
protected  FillNewElementWizardProvider.AbstractStepFactory getNextStep(NewElementRule rule, Element e)
          Determines which step is to be taken next.
 boolean hasNext()
          Checks if there is next wizard.
 boolean hasPrevious()
          Checks if there is previous wizard.
 NamespaceManager newNsManager()
          Determines and returns active namespace manager.
 IWizard next()
          Fetches the next wizard.
 void performCancel()
          Called when all opened wizards (from first wizard to current wizard) have already been cancelled.
 void performFinish()
          Called when all wizards (from first wizard to current wizard) have already been finished.
 IWizard previous()
          Fetches the previous wizard.
 void setWizard(MultiWizard wizard)
          Sets the multi-wizard object instance, that'll navigate user through other wizards using this provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected final String name
The provider name.


xmlAccess

protected final XMLAccess xmlAccess
The document instance.


stepFactories

protected final List<FillNewElementWizardProvider.AbstractStepFactory> stepFactories
All wizard step factories. This list may contain more items than already returned wizards - predictions, which wizard will follow are stored here aswell.


visitedSteps

protected final List<FillNewElementWizardProvider.WizardStep> visitedSteps
List of steps that have been already visited. Last item of this array is a step that was returned by recent call to next() and is currently interacting with user. This list is consistent with the stepFactories: i-th factory has produced i-th step.


firstFactory

protected final FillNewElementWizardProvider.AbstractStepFactory firstFactory
The first factory. May be null - in this case no element content needs to be created and this provider provides no wizards. If not null and stepFactories has at least one item, then stepFactories.get(0)==firstFactory.


startupManager

protected final NamespaceManager startupManager
Namespace manager provided at construction time.

Constructor Detail

FillNewElementWizardProvider

public FillNewElementWizardProvider(Element element,
                                    NewElementRule rule,
                                    XMLAccess xmlAccess,
                                    NamespaceManager nsMan,
                                    String name)
Creates instance of the wizard.

Parameters:
element - the element to be filled. The element is expected to be freshly created and thus must not contain any children nodes nor attributes.
rule - the rule for contents of the element.
xmlAccess - the document instance.
nsMan - actual namespace manager. It won't get modified. If null then xmlAccess current namespace manager is taken.
name - the name of the activity provided by this provider. If null then default name is used.
Method Detail

getNextStep

protected FillNewElementWizardProvider.AbstractStepFactory getNextStep(NewElementRule rule,
                                                                       Element e)
Determines which step is to be taken next.

Parameters:
rule - rule for element e.
e - the element. It may already have attributes created.
Returns:
new wizard step factory, or null if there are no required elements and/or attributes in given rule.

performCancel

public void performCancel()
Description copied from interface: IMultiWizardProvider
Called when all opened wizards (from first wizard to current wizard) have already been cancelled.

Specified by:
performCancel in interface IMultiWizardProvider

performFinish

public void performFinish()
Description copied from interface: IMultiWizardProvider
Called when all wizards (from first wizard to current wizard) have already been finished.

Specified by:
performFinish in interface IMultiWizardProvider

current

public IWizard current()
Description copied from interface: IMultiWizardProvider
Fetches the current wizard.

Specified by:
current in interface IMultiWizardProvider
Returns:
current wizard. May return null only if the provider provides no wizards.

hasNext

public boolean hasNext()
Description copied from interface: IMultiWizardProvider
Checks if there is next wizard.

Specified by:
hasNext in interface IMultiWizardProvider
Returns:
true if there is next wizard or false if next() will fail.

hasPrevious

public boolean hasPrevious()
Description copied from interface: IMultiWizardProvider
Checks if there is previous wizard.

Specified by:
hasPrevious in interface IMultiWizardProvider
Returns:
true if there is previous wizard or false if previous() will fail.

next

public IWizard next()
Description copied from interface: IMultiWizardProvider
Fetches the next wizard. Function may fail even when hasNext() returned true - it may throw ProviderException.

Specified by:
next in interface IMultiWizardProvider
Returns:
next wizard. The wizard does not have to be initialized - MultiWizard initializes it for you. Never null.

newNsManager

public NamespaceManager newNsManager()
Determines and returns active namespace manager.

Returns:
namespace manager of current step's wizard.

previous

public IWizard previous()
Description copied from interface: IMultiWizardProvider
Fetches the previous wizard. Current wizard is automatically disposed.

Specified by:
previous in interface IMultiWizardProvider
Returns:
previous wizard.

dispose

public void dispose()
Description copied from interface: IMultiWizardProvider
Provider should dispose any objects it collected. Wizards are disposed automatically by the MultiWizard.

Specified by:
dispose in interface IMultiWizardProvider

setWizard

public void setWizard(MultiWizard wizard)
Description copied from interface: IMultiWizardProvider
Sets the multi-wizard object instance, that'll navigate user through other wizards using this provider.

Specified by:
setWizard in interface IMultiWizardProvider
Parameters:
wizard - the wizard that'll use this provider.

getName

public String getName()
Description copied from interface: IMultiWizardProvider
Returns name of this wizard. Describes this wizard. Shown in the dialog.

Specified by:
getName in interface IMultiWizardProvider
Returns:
displayable wizard name, like 'New element contents'. If null then the name is collected from child wizards.


Copyright © 2003-2006 null. All Rights Reserved.