com.flexive.shared.structure
Class FxPropertyAssignmentEdit

java.lang.Object
  extended by com.flexive.shared.structure.FxAssignment
      extended by com.flexive.shared.structure.FxPropertyAssignment
          extended by com.flexive.shared.structure.FxPropertyAssignmentEdit
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<FxAssignment>

public class FxPropertyAssignmentEdit
extends FxPropertyAssignment

FxPropertyAssignment for editing

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.flexive.shared.structure.FxPropertyAssignment
ACL, defaultLang, defaultValue, property
 
Fields inherited from class com.flexive.shared.structure.FxAssignment
alias, baseAssignment, defaultMultiplicity, enabled, hint, label, multiplicity, NO_BASE, NO_PARENT, options, parentGroupAssignment, position, POSITION_BOTTOM, ROOT_BASE, scriptMapping, TYPE_GROUP, TYPE_PROPERTY, XPath
 
Constructor Summary
FxPropertyAssignmentEdit(FxPropertyAssignment pa)
          Create an editable instance from an existing FxPropertyAssignment
FxPropertyAssignmentEdit(FxProperty property, FxType type, java.lang.String alias, java.lang.String parentXPath)
          Create a new FxPropertyAssignmentEdit from an existing property for a given type with a new alias and a given parentXPath
 
Method Summary
 FxPropertyAssignmentEdit clearDefaultLanguage()
          Reset the default language to the system language
 void clearDefaultValue()
          Clear the default value
 void clearOption(java.lang.String key)
          Clear an option entry
static FxPropertyAssignmentEdit createNew(FxPropertyAssignment pa, FxType type, java.lang.String alias, java.lang.String parentXPath)
          Create a new FxPropertyAssignmentEdit from an existing FxPropertyAssignment as a new one for a given type with a new alias and a given parentXPath
static FxPropertyAssignmentEdit createNew(FxPropertyAssignment pa, FxType type, java.lang.String alias, java.lang.String parentXPath, FxAssignment parent)
          Create a new FxPropertyAssignmentEdit from an existing FxPropertyAssignment as a new one for a given type with a new alias and a given parentXPath
static FxPropertyAssignmentEdit createNew(java.lang.String property, FxType type, java.lang.String alias, java.lang.String parentXPath)
          Create a new FxPropertyAssignmentEdit from an existing property for a given type with a new alias and a given parentXPath
protected  java.util.List<FxStructureOption> getAllAvailableOptions()
          Returns a new List of all available options.
 FxPropertyEdit getPropertyEdit()
          Returns the property of this assignment as editable.
 boolean isNew()
           
static FxPropertyAssignmentEdit reuse(java.lang.String originalAssignment, java.lang.String type, java.lang.String parentXPath)
          Convenience method to create a new FxPropertyAssignmentEdit from an existing FxPropertyAssignment as a new one for a given type with a new alias and a given parentXPath
static FxPropertyAssignmentEdit reuse(java.lang.String originalAssignment, java.lang.String type, java.lang.String parentXPath, java.lang.String alias)
          Convenience method to create a new FxPropertyAssignmentEdit from an existing FxPropertyAssignment as a new one for a given type with a new alias and a given parentXPath
 FxPropertyAssignmentEdit setACL(ACL ACL)
           
 FxPropertyAssignmentEdit setAlias(java.lang.String alias)
          Set the alias of this property assignment.
 FxPropertyAssignmentEdit setDefaultLanguage(long language)
          Set a default language.
 FxPropertyAssignmentEdit setDefaultMultiplicity(int defaultMultiplicity)
          Set the default multiplicity (used i.e.
 FxPropertyAssignmentEdit setDefaultValue(FxValue defaultValue)
          Set the default value for this property assignment
 FxPropertyAssignmentEdit setEnabled(boolean enabled)
          Set this property assignment as (temporary) disabled - it will not be initialized when creating new instances, etc.
 FxPropertyAssignmentEdit setHint(FxString hint)
          Set the hint message
 FxPropertyAssignmentEdit setInOverview(boolean inOverview)
          Set overview appearance setting
 FxPropertyAssignmentEdit setLabel(FxString label)
          Setter for the label
 FxPropertyAssignmentEdit setMaxLength(int maxLength)
          Shortcut to set the maximum input length (if applicable to the component)
 FxPropertyAssignmentEdit setMultiLang(boolean multiLang)
          Should this assignment support multilingual data?
 FxPropertyAssignmentEdit setMultiLine(boolean multiLine)
          Set multiline display ability
 FxPropertyAssignmentEdit setMultiplicity(FxMultiplicity multiplicity)
          Set the multiplicity of this assignment
 FxPropertyAssignmentEdit setOption(java.lang.String key, boolean value)
          Set a boolean option
 FxPropertyAssignmentEdit setOption(java.lang.String key, java.lang.String value)
          Set an option
 void setOptions(java.util.List<FxStructureOption> options)
          Assign options
 void setParentGroupAssignment(FxGroupAssignment parent)
          Sets the parent group assignment.
 FxPropertyAssignmentEdit setPosition(int position)
          Set the position of this assignment (within the same parent group).
 FxPropertyAssignmentEdit setSearchable(boolean searchable)
          Set if this property be used in the visual query editor (UI hint)
 FxPropertyAssignmentEdit setUseHTMLEditor(boolean useHTMLEditor)
          Set if to use an HTML editor to edit values of this property?
 FxPropertyAssignmentEdit setXPath(java.lang.String XPath)
          Set the XPath of this assignment - this is used mainly internally and affects new assignments only
 
Methods inherited from class com.flexive.shared.structure.FxPropertyAssignment
asEditable, createEmptyData, createRandomData, getACL, getDefaultLanguage, getDefaultValue, getEmptyValue, getMaxLength, getMultiLines, getMultiplicity, getOption, getProperty, hasAssignmentDefaultValue, hasDefaultLanguage, hasMaxLength, hasOption, isInOverview, isMultiLang, isMultiLine, isOverridingPropertyACL, isOverridingPropertyMultiplicity, isSearchable, isUseHTMLEditor, isValid
 
Methods inherited from class com.flexive.shared.structure.FxAssignment
_setSystemInternal, compareTo, equals, getAlias, getAssignedType, getBaseAssignmentId, getDefaultMultiplicity, getDisplayLabel, getDisplayName, getHint, getId, getLabel, getOptions, getParentGroupAssignment, getPosition, getScriptMapping, getXPath, hashCode, hasParentGroupAssignment, hasScriptMapping, hasScriptMappings, isDerivedAssignment, isEnabled, isSystemInternal, resolveParentDependencies, resolvePreloadDependencies, resolveReferences, sort, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FxPropertyAssignmentEdit

public FxPropertyAssignmentEdit(FxPropertyAssignment pa)
Create an editable instance from an existing FxPropertyAssignment

Parameters:
pa - existing FxPropertyAssignment

FxPropertyAssignmentEdit

public FxPropertyAssignmentEdit(FxProperty property,
                                FxType type,
                                java.lang.String alias,
                                java.lang.String parentXPath)
Create a new FxPropertyAssignmentEdit from an existing property for a given type with a new alias and a given parentXPath

Parameters:
property - the property name
type - type to assign it
alias - new alias
parentXPath - parent XPath within the type to assign
Method Detail

isNew

public boolean isNew()

clearDefaultValue

public void clearDefaultValue()
Clear the default value


setACL

public FxPropertyAssignmentEdit setACL(ACL ACL)
                                throws FxInvalidParameterException
Throws:
FxInvalidParameterException

setDefaultValue

public FxPropertyAssignmentEdit setDefaultValue(FxValue defaultValue)
Set the default value for this property assignment

Parameters:
defaultValue - default value
Returns:
this

setOption

public FxPropertyAssignmentEdit setOption(java.lang.String key,
                                          java.lang.String value)
                                   throws FxInvalidParameterException
Set an option

Parameters:
key - option key
value - value of the option
Returns:
the assignment itself, useful for chained calls
Throws:
FxInvalidParameterException - if the property does not allow overriding

setOption

public FxPropertyAssignmentEdit setOption(java.lang.String key,
                                          boolean value)
                                   throws FxInvalidParameterException
Set a boolean option

Parameters:
key - option key
value - value of the option
Returns:
the assignemnt itself, useful for chained calls
Throws:
FxInvalidParameterException - if the property does not allow overriding

clearOption

public void clearOption(java.lang.String key)
Clear an option entry

Parameters:
key - option name

setOptions

public void setOptions(java.util.List<FxStructureOption> options)
Assign options

Parameters:
options - options to assign

setMultiLang

public FxPropertyAssignmentEdit setMultiLang(boolean multiLang)
                                      throws FxInvalidParameterException
Should this assignment support multilingual data?

Parameters:
multiLang - multi lingual data supported?
Returns:
this
Throws:
FxInvalidParameterException - on errors

setDefaultLanguage

public FxPropertyAssignmentEdit setDefaultLanguage(long language)
Set a default language. Multilingual FxPropertyData instances will be initialized with this language

Parameters:
language - the default language
Returns:
this

clearDefaultLanguage

public FxPropertyAssignmentEdit clearDefaultLanguage()
Reset the default language to the system language

Returns:
this

setSearchable

public FxPropertyAssignmentEdit setSearchable(boolean searchable)
                                       throws FxInvalidParameterException
Set if this property be used in the visual query editor (UI hint)

Parameters:
searchable - property can be used in the visual query editor
Returns:
the property itself, useful for chained calls
Throws:
FxInvalidParameterException - if overriding is not allowed

setInOverview

public FxPropertyAssignmentEdit setInOverview(boolean inOverview)
                                       throws FxInvalidParameterException
Set overview appearance setting

Parameters:
inOverview - overview appearance setting
Returns:
the property itself, useful for chained calls
Throws:
FxInvalidParameterException - if not allowed to override

setUseHTMLEditor

public FxPropertyAssignmentEdit setUseHTMLEditor(boolean useHTMLEditor)
                                          throws FxInvalidParameterException
Set if to use an HTML editor to edit values of this property?

Parameters:
useHTMLEditor - use HTML editor to edit values of this property?
Returns:
the property itself, useful for chained calls
Throws:
FxInvalidParameterException - if not allowed to override

setMultiLine

public FxPropertyAssignmentEdit setMultiLine(boolean multiLine)
                                      throws FxInvalidParameterException
Set multiline display ability

Parameters:
multiLine - render property in multiple lines?
Returns:
the property itself, useful for chained calls
Throws:
FxInvalidParameterException - on errors

setMaxLength

public FxPropertyAssignmentEdit setMaxLength(int maxLength)
                                      throws FxInvalidParameterException
Shortcut to set the maximum input length (if applicable to the component)

Parameters:
maxLength - desired maximum input length
Returns:
the property itself, useful for chained calls
Throws:
FxInvalidParameterException - on errors

setEnabled

public FxPropertyAssignmentEdit setEnabled(boolean enabled)
Set this property assignment as (temporary) disabled - it will not be initialized when creating new instances, etc.

Parameters:
enabled - enabled flag
Returns:
this

setMultiplicity

public FxPropertyAssignmentEdit setMultiplicity(FxMultiplicity multiplicity)
                                         throws FxInvalidParameterException
Set the multiplicity of this assignment

Parameters:
multiplicity - new multiplicity
Returns:
this
Throws:
FxInvalidParameterException - on errors

setDefaultMultiplicity

public FxPropertyAssignmentEdit setDefaultMultiplicity(int defaultMultiplicity)
                                                throws FxInvalidParameterException
Set the default multiplicity (used i.e. in user interfaces editors and determines the amount of values that will be initialized when creating an empty element).

Parameters:
defaultMultiplicity - the default multiplicity
Returns:
this
Throws:
FxInvalidParameterException - if the defaultMultiplicity is not within the range of min and max

setPosition

public FxPropertyAssignmentEdit setPosition(int position)
Set the position of this assignment (within the same parent group). Changing an assignments position will be upate all affected other assignments within the same group. Invalid values will be adjusted (to 0 or the max. possible position)

Parameters:
position - position within the parent group
Returns:
this

setAlias

public FxPropertyAssignmentEdit setAlias(java.lang.String alias)
                                  throws FxInvalidParameterException
Set the alias of this property assignment. Property assignments may define an alias to allow multiple use of the same property but using a different name. The alias is the rightmost part of the XPath used to address an assignment.

Parameters:
alias - the alias of this assignment
Returns:
this
Throws:
FxInvalidParameterException - on errors

setXPath

public FxPropertyAssignmentEdit setXPath(java.lang.String XPath)
                                  throws FxInvalidParameterException
Set the XPath of this assignment - this is used mainly internally and affects new assignments only

Parameters:
XPath - the XPath to set
Returns:
this
Throws:
FxInvalidParameterException - on errors

setLabel

public FxPropertyAssignmentEdit setLabel(FxString label)
Setter for the label

Parameters:
label - label to set
Returns:
this

setHint

public FxPropertyAssignmentEdit setHint(FxString hint)
Set the hint message

Parameters:
hint - hint message
Returns:
the property itself, useful for chained calls

createNew

public static FxPropertyAssignmentEdit createNew(FxPropertyAssignment pa,
                                                 FxType type,
                                                 java.lang.String alias,
                                                 java.lang.String parentXPath,
                                                 FxAssignment parent)
                                          throws FxNotFoundException,
                                                 FxInvalidParameterException
Create a new FxPropertyAssignmentEdit from an existing FxPropertyAssignment as a new one for a given type with a new alias and a given parentXPath

Parameters:
pa - original property assignment
type - type to assign it
alias - new alias
parentXPath - parent XPath within the type to assign
parent - optional parent assignment if already known (prevents lookup of parentXPath if valid)
Returns:
new FxPropertyAssignmentEdit
Throws:
FxNotFoundException - if parentXPath is invalid
FxInvalidParameterException - if parentXPath is invalid

createNew

public static FxPropertyAssignmentEdit createNew(FxPropertyAssignment pa,
                                                 FxType type,
                                                 java.lang.String alias,
                                                 java.lang.String parentXPath)
                                          throws FxNotFoundException,
                                                 FxInvalidParameterException
Create a new FxPropertyAssignmentEdit from an existing FxPropertyAssignment as a new one for a given type with a new alias and a given parentXPath

Parameters:
pa - original property assignment
type - type to assign it
alias - new alias
parentXPath - parent XPath within the type to assign
Returns:
new FxPropertyAssignmentEdit
Throws:
FxNotFoundException - if parentXPath is invalid
FxInvalidParameterException - if parentXPath is invalid

createNew

public static FxPropertyAssignmentEdit createNew(java.lang.String property,
                                                 FxType type,
                                                 java.lang.String alias,
                                                 java.lang.String parentXPath)
                                          throws FxNotFoundException,
                                                 FxInvalidParameterException
Create a new FxPropertyAssignmentEdit from an existing property for a given type with a new alias and a given parentXPath

Parameters:
property - the property name
type - type to assign it
alias - new alias
parentXPath - parent XPath within the type to assign
Returns:
new FxPropertyAssignmentEdit
Throws:
FxNotFoundException - if parentXPath is invalid
FxInvalidParameterException - if parentXPath is invalid

reuse

public static FxPropertyAssignmentEdit reuse(java.lang.String originalAssignment,
                                             java.lang.String type,
                                             java.lang.String parentXPath,
                                             java.lang.String alias)
                                      throws FxNotFoundException,
                                             FxInvalidParameterException
Convenience method to create a new FxPropertyAssignmentEdit from an existing FxPropertyAssignment as a new one for a given type with a new alias and a given parentXPath

Parameters:
originalAssignment - the original assignments XPath (like ROOT/CAPTION)
type - name of the type to assign it
parentXPath - parent XPath within the type to assign
alias - new alias
Returns:
new FxPropertyAssignmentEdit
Throws:
FxNotFoundException - if parentXPath is invalid
FxInvalidParameterException - if parentXPath is invalid

reuse

public static FxPropertyAssignmentEdit reuse(java.lang.String originalAssignment,
                                             java.lang.String type,
                                             java.lang.String parentXPath)
                                      throws FxNotFoundException,
                                             FxInvalidParameterException
Convenience method to create a new FxPropertyAssignmentEdit from an existing FxPropertyAssignment as a new one for a given type with a new alias and a given parentXPath

Parameters:
originalAssignment - the original assignments XPath (like ROOT/CAPTION)
type - name of the type to assign it
parentXPath - parent XPath within the type to assign
Returns:
new FxPropertyAssignmentEdit
Throws:
FxNotFoundException - if parentXPath is invalid
FxInvalidParameterException - if parentXPath is invalid

setParentGroupAssignment

public void setParentGroupAssignment(FxGroupAssignment parent)
Sets the parent group assignment.

Parameters:
parent - the parent group assignment.

getPropertyEdit

public FxPropertyEdit getPropertyEdit()
Returns the property of this assignment as editable.

Returns:
the editable property object.

getAllAvailableOptions

protected java.util.List<FxStructureOption> getAllAvailableOptions()
Returns a new List of all available options. The options include those of the class itsself and of its assigned FxProperty To eliminate duplicate keys and determine the correct overriding oder, the FxPropertyAssignment.getOption(key) method is used. If an option is contained in the returned List then hasOption(key) ==true, otherwise false.

Returns:
new List containing all availiable options.