Package com.iizigo.vs.wizards
Class VSComponentCreation<VSTYPE extends VSComponent>
- java.lang.Object
- com.iizigo.vs.wizards.VSComponentCreation<VSTYPE>
- All Implemented Interfaces:
INewVSComponentWizardInfo
- Direct Known Subclasses:
VSActionCreation
,VSColumnCreation
,VSFieldCreation
,VSTableCreation
public abstract class VSComponentCreation<VSTYPE extends VSComponent> extends java.lang.Object implements INewVSComponentWizardInfo
Class for VirtualSpace component creation used in the wizards e.g. when creating panel components.- Author:
- Christopher Mindus
Field Summary
Fields Modifier and Type Field Description protected VSTYPE
createdComponent
The created component.
Constructor Summary
Constructors Constructor Description VSComponentCreation(EditorVirtualSpace virtualSpace, java.lang.String requestedName, Value.Type valueType, boolean doCreateDefaultValue, boolean isChooseTypeAllowed, java.lang.Boolean isNullAllowed, VSReferenceOwnerData<VSTable,VSTableReference> tableOwner, IPropUndoRedo undoRedo)
Constructor.
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
assignReference()
Completes the referencing to the VS component in the UI component.VSTYPE
createVSComponent(ComplexOperation op)
Creates the component required with the specified name.protected abstract VSTYPE
doCreate(Atom name, PropCnr parent, ComplexOperation op)
Creates the component required with the specified name.boolean
doCreateDefaultValue()
Returns if a default value should be created.abstract java.lang.String
getDefaultName()
Gets the default name for the VS component if no request name is defined.java.lang.String
getDescription()
Gets the description.java.lang.String
getRequestedName()
Gets the requested name.VSReferenceOwnerData<VSTable,VSTableReference>
getTableOwner()
Gets the table owner, for table column creation.java.lang.String
getTitle()
Gets the title.IPropUndoRedo
getUndoRedo()
Gets the undo/redo instance.Value.Type
getValueType()
Returns the value type where this applies (for VS Field and VS Column Header).EditorVirtualSpace
getVirtualSpace()
Returns the VirtualSpace.PropCnr
getVSParent()
Gets the parent for the component.boolean
isChooseTypeAllowed()
Returns if the user is allowed to choose type.boolean
isComponentSelectable()
Returns if the VS component should be selectable or not.java.lang.Boolean
isNullAllowed()
Returns if null is allowed.abstract void
onWizard(AddUICompWizard wizard)
Called to create required wizard pages.void
registerRequestedNameListener(java.lang.Runnable nameListener)
Registers a requested name listener.void
setDescription(java.lang.String descr)
Gets the description.void
setNullAllowed(boolean isNullAllowed)
Sets the null allowed flag.void
setRequestedName(java.lang.String requestedName)
Sets the requested name.void
setTitle(java.lang.String title)
Sets the title.void
setValueType(Value.Type valueType)
Sets the value type where this applies (for VS Field and VS Column Header).void
setVSParent(PropCnr vsParent)
Sets the parent.
Field Detail
createdComponent
protected VSTYPE extends VSComponent createdComponent
The created component.
Constructor Detail
VSComponentCreation
public VSComponentCreation(EditorVirtualSpace virtualSpace, java.lang.String requestedName, Value.Type valueType, boolean doCreateDefaultValue, boolean isChooseTypeAllowed, java.lang.Boolean isNullAllowed, VSReferenceOwnerData<VSTable,VSTableReference> tableOwner, IPropUndoRedo undoRedo)
Constructor.- Parameters:
virtualSpace
- The VirtualSpace.requestedName
- The requested name of the component.valueType
- The value type chosen when the VS type is VSField or VSColumnHeader.doCreateDefaultValue
- Flag to create a default value.isChooseTypeAllowed
- If user is allowed to choose value type.isNullAllowed
- Flag null is allowed, null to enable user to choose.tableOwner
- The table owner, or null for not available (or not applicable).undoRedo
- The undo/redo instance.
Method Detail
registerRequestedNameListener
public void registerRequestedNameListener(java.lang.Runnable nameListener)
Registers a requested name listener.- Specified by:
registerRequestedNameListener
in interfaceINewVSComponentWizardInfo
isComponentSelectable
public final boolean isComponentSelectable()
Returns if the VS component should be selectable or not.- Specified by:
isComponentSelectable
in interfaceINewVSComponentWizardInfo
- Returns:
- true by default in order to enable selecting an existing component.
setTitle
public final void setTitle(java.lang.String title)
Sets the title.- Parameters:
title
- The title for the page, or null for default.
getTitle
public final java.lang.String getTitle()
Gets the title.- Specified by:
getTitle
in interfaceINewVSComponentWizardInfo
- Returns:
- The title for the page, or null for default.
getDescription
public final java.lang.String getDescription()
Gets the description.- Specified by:
getDescription
in interfaceINewVSComponentWizardInfo
- Returns:
- The description of the page, or null for default.
setDescription
public final void setDescription(java.lang.String descr)
Gets the description.- Parameters:
descr
- The description of the page, or null for default.
getVSParent
public final PropCnr getVSParent()
Gets the parent for the component. This is initially set to the VirtualSpace.
setVSParent
public final void setVSParent(PropCnr vsParent)
Sets the parent.
setRequestedName
public final void setRequestedName(java.lang.String requestedName)
Sets the requested name.- Specified by:
setRequestedName
in interfaceINewVSComponentWizardInfo
- Parameters:
requestedName
- null if no name is requested.
getRequestedName
public final java.lang.String getRequestedName()
Gets the requested name.- Specified by:
getRequestedName
in interfaceINewVSComponentWizardInfo
- Returns:
- null if no name is requested.
getVirtualSpace
public final EditorVirtualSpace getVirtualSpace()
Returns the VirtualSpace.- Specified by:
getVirtualSpace
in interfaceINewVSComponentWizardInfo
getValueType
public final Value.Type getValueType()
Returns the value type where this applies (for VS Field and VS Column Header).- Specified by:
getValueType
in interfaceINewVSComponentWizardInfo
setValueType
public final void setValueType(Value.Type valueType)
Sets the value type where this applies (for VS Field and VS Column Header).- Specified by:
setValueType
in interfaceINewVSComponentWizardInfo
- Parameters:
valueType
- The new value type.
isChooseTypeAllowed
public final boolean isChooseTypeAllowed()
Returns if the user is allowed to choose type.- Specified by:
isChooseTypeAllowed
in interfaceINewVSComponentWizardInfo
isNullAllowed
public final java.lang.Boolean isNullAllowed()
Returns if null is allowed.- Specified by:
isNullAllowed
in interfaceINewVSComponentWizardInfo
- Returns:
- null to enable user to choose, otherwise Boolean.TRUE or Boolean.FALSE to disable user choice and use this setting.
setNullAllowed
public final void setNullAllowed(boolean isNullAllowed)
Sets the null allowed flag.- Specified by:
setNullAllowed
in interfaceINewVSComponentWizardInfo
doCreateDefaultValue
public final boolean doCreateDefaultValue()
Returns if a default value should be created.- Specified by:
doCreateDefaultValue
in interfaceINewVSComponentWizardInfo
getTableOwner
public final VSReferenceOwnerData<VSTable,VSTableReference> getTableOwner()
Gets the table owner, for table column creation.- Specified by:
getTableOwner
in interfaceINewVSComponentWizardInfo
- Returns:
- The table owner, or null for not available (or not applicable).
getUndoRedo
public final IPropUndoRedo getUndoRedo()
Gets the undo/redo instance.- Specified by:
getUndoRedo
in interfaceINewVSComponentWizardInfo
createVSComponent
public final VSTYPE createVSComponent(ComplexOperation op)
Creates the component required with the specified name.- Parameters:
op
- The complex operation.- Returns:
- The component, initiated with potential value or value type.
getDefaultName
public abstract java.lang.String getDefaultName()
Gets the default name for the VS component if no request name is defined.
onWizard
public abstract void onWizard(AddUICompWizard wizard)
Called to create required wizard pages.- Parameters:
wizard
- The wizard.
doCreate
protected abstract VSTYPE doCreate(Atom name, PropCnr parent, ComplexOperation op)
Creates the component required with the specified name.- Parameters:
name
- The name.parent
- The parent for the VS component.op
- The complex operation.- Returns:
- The component, initiated with potential value or value type.
assignReference
public abstract boolean assignReference()
Completes the referencing to the VS component in the UI component.- Returns:
- true if the component reference is set, false if the user chose not to create this VS component.