org.jspresso.framework.view.descriptor.basic
Class BasicPropertyViewDescriptor

java.lang.Object
  extended by org.jspresso.framework.util.descriptor.DefaultDescriptor
      extended by org.jspresso.framework.util.descriptor.DefaultIconDescriptor
          extended by org.jspresso.framework.view.descriptor.basic.BasicViewDescriptor
              extended by org.jspresso.framework.view.descriptor.basic.BasicPropertyViewDescriptor
All Implemented Interfaces:
Cloneable, ISecurable, IPermIdSource, IDescriptor, IIconDescriptor, IGateAccessible, ICloneable, IActionable, IPropertyViewDescriptor, IViewDescriptor
Direct Known Subclasses:
BasicEnumerationPropertyViewDescriptor, BasicImageViewDescriptor, BasicReferencePropertyViewDescriptor

public class BasicPropertyViewDescriptor
extends BasicViewDescriptor
implements IPropertyViewDescriptor

This view descriptor serves 2 purposes :

The second usage might be a little bit unusual, but here is a use-case scenario : display a text area which maps a text property that contains XML content. This text area must be displayed in a split pane and provide actions to interact directly with the FS (save content to a file, load content from a file, ...). In that case, defining a property view alone on the text property of the owning component might be a good solution.

Version:
$LastChangedRevision: 5662 $
Author:
Vincent Vandenschrick

Field Summary
 
Fields inherited from interface org.jspresso.framework.util.descriptor.IDescriptor
DESCRIPTION, LAST_UPDATED, NAME
 
Constructor Summary
BasicPropertyViewDescriptor()
           
 
Method Summary
 IAction getAction()
          Gets the action.
 List<String> getDefaultRenderedChildProperties()
          Gets the default child properties to display in case of a complex property.
 EHorizontalAlignment getHorizontalAlignment()
          Returns the horizontal alignment used for displaying the property.
 String getLabelBackground()
          Gets the labelBackground.
 String getLabelFont()
          Gets the labelFont.
 String getLabelForeground()
          Gets the labelForeground.
protected  Integer getPreferredWidth()
          Gets the preferredWidth.
 List<String> getRenderedChildProperties()
          Gets the child properties to display in case of a complex property.
 Integer getWidth()
          Gets the width.
 boolean isReadOnly()
          Queries the model property descriptor to determine read-only state.
 boolean isSortable()
          Gets the sortability.
 void setAction(IAction action)
          Configures the action to be triggered when acting on this property.
 void setHorizontalAlignment(EHorizontalAlignment horizontalAlignment)
          This property allows to control the property alignment in views that support it.
 void setLabelBackground(String labelBackground)
          When the property has to be labelled (e.g. in a component view), this property defines the background color of the corresponding label.
 void setLabelFont(String labelFont)
          When the property has to be labelled (e.g. in a component view), this property defines the font of the corresponding label.
 void setLabelForeground(String labelForeground)
          When the property has to be labelled (e.g. in a component view), this property defines the foregroud color of the corresponding label.
 void setRenderedChildProperties(List<String> renderedChildProperties)
          Whenever the property decriptor backing the view is not scalar, this property allows to override which of the referenced component fields should be displayed : as columns when the rendered property is a collection property as fields when the rendered property is a reference property The property must be configured with a List containing the property names to render for the child element(s).
 void setSortable(boolean sortable)
          Configure the sortability of a property view when used to defines a table column for instance.
 void setWidth(Integer width)
          When the property has to be displayed in a grid-like layout (e.g. in a component view), this property defines the umber of grid columns the corresponding UI component will span.
 
Methods inherited from class org.jspresso.framework.view.descriptor.basic.BasicViewDescriptor
getActionMap, getBackground, getBorderType, getFont, getForeground, getGrantedRoles, getI18nDescription, getI18nName, getIconImageURL, getModelDescriptor, getPermId, getPreferredHeight, getPreferredSize, getReadabilityGates, getSecondaryActionMap, getWritabilityGates, setActionMap, setBackground, setBorderType, setFont, setForeground, setGrantedRoles, setModelDescriptor, setPermId, setPreferredHeight, setPreferredWidth, setReadabilityGates, setReadOnly, setSecondaryActionMap, setWritabilityGates
 
Methods inherited from class org.jspresso.framework.util.descriptor.DefaultIconDescriptor
clone, setIconImageURL
 
Methods inherited from class org.jspresso.framework.util.descriptor.DefaultDescriptor
getDescription, getI18nNameKey, getLastUpdated, getName, setDescription, setI18nNameKey, setLastUpdated, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jspresso.framework.view.descriptor.IViewDescriptor
getBackground, getBorderType, getFont, getForeground, getModelDescriptor, getPreferredSize
 
Methods inherited from interface org.jspresso.framework.util.descriptor.IIconDescriptor
getIconImageURL
 
Methods inherited from interface org.jspresso.framework.util.descriptor.IDescriptor
getDescription, getI18nDescription, getI18nName, getLastUpdated, getName
 
Methods inherited from interface org.jspresso.framework.security.ISecurable
getGrantedRoles
 
Methods inherited from interface org.jspresso.framework.view.action.IActionable
getActionMap, getSecondaryActionMap
 
Methods inherited from interface org.jspresso.framework.util.gate.IGateAccessible
getReadabilityGates, getWritabilityGates
 
Methods inherited from interface org.jspresso.framework.util.automation.IPermIdSource
getPermId, setPermId
 

Constructor Detail

BasicPropertyViewDescriptor

public BasicPropertyViewDescriptor()
Method Detail

getLabelBackground

public String getLabelBackground()
Gets the labelBackground.

Specified by:
getLabelBackground in interface IPropertyViewDescriptor
Returns:
the labelBackground.

getLabelFont

public String getLabelFont()
Gets the labelFont.

Specified by:
getLabelFont in interface IPropertyViewDescriptor
Returns:
the labelFont.

getLabelForeground

public String getLabelForeground()
Gets the labelForeground.

Specified by:
getLabelForeground in interface IPropertyViewDescriptor
Returns:
the labelForeground.

getRenderedChildProperties

public List<String> getRenderedChildProperties()
Gets the child properties to display in case of a complex property.

Specified by:
getRenderedChildProperties in interface IPropertyViewDescriptor
Returns:
The list of displayed properties in the case of a complex property.

getDefaultRenderedChildProperties

public List<String> getDefaultRenderedChildProperties()
Gets the default child properties to display in case of a complex property.

Specified by:
getDefaultRenderedChildProperties in interface IPropertyViewDescriptor
Returns:
The list of displayed properties in the case of a complex property.

getWidth

public Integer getWidth()
Gets the width.

Specified by:
getWidth in interface IPropertyViewDescriptor
Returns:
the width.

setLabelBackground

public void setLabelBackground(String labelBackground)
When the property has to be labelled (e.g. in a component view), this property defines the background color of the corresponding label. It might differ from the field component one. The color must be defined using its string hexadecimal representation (0xargb encoded).

Default value is null, meaning use UI default.

Parameters:
labelBackground - the labelBackground to set.

setLabelFont

public void setLabelFont(String labelFont)
When the property has to be labelled (e.g. in a component view), this property defines the font of the corresponding label. It might differ from the field component one. The font must be string encoded using the pattern "[name];[style];[size]" : Any of the above pattern section can be left empty, thus falling back to the component default.

Default value is null, meaning use default component font.

Parameters:
labelFont - the labelFont to set.

setLabelForeground

public void setLabelForeground(String labelForeground)
When the property has to be labelled (e.g. in a component view), this property defines the foregroud color of the corresponding label. It might differ from the field component one. The color must be defined using its string hexadecimal representation (0xargb encoded).

Default value is null, meaning use UI default.

Parameters:
labelForeground - the labelForeground to set.

setRenderedChildProperties

public void setRenderedChildProperties(List<String> renderedChildProperties)
Whenever the property decriptor backing the view is not scalar, this property allows to override which of the referenced component fields should be displayed : The property must be configured with a List containing the property names to render for the child element(s).

A null value (default), means that the non-scalar property will be rendered using default rendered properties as specified in its referenced model descriptor.

Please note that this is quite unusual to embed non-scalar properties directly in a property view. Although permitted, you won't have as much flexibility in the content layouting as you would have when using composite views; so the latter is by far recommended.

Parameters:
renderedChildProperties - the renderedChildProperties to set.

setWidth

public void setWidth(Integer width)
When the property has to be displayed in a grid-like layout (e.g. in a component view), this property defines the umber of grid columns the corresponding UI component will span.

Default value is null, meaning use default span of 1.

Parameters:
width - the width to set.

getAction

public IAction getAction()
Gets the action.

Specified by:
getAction in interface IPropertyViewDescriptor
Returns:
the action.

setAction

public void setAction(IAction action)
Configures the action to be triggered when acting on this property. There are 2 cases :

  1. If the property is read-only, then assigning an action turns the property into a clickable hyperlink
  2. If the property is read-write, the registered action will be trigerred when the user changes the value of the field. Note thet in that case, the action is executed after the model has been updated. However the old property value can be retrieved from the context action param.

Parameters:
action - the action to set.

getPreferredWidth

protected Integer getPreferredWidth()
Gets the preferredWidth.

Overrides:
getPreferredWidth in class BasicViewDescriptor
Returns:
the preferredWidth.

setHorizontalAlignment

public void setHorizontalAlignment(EHorizontalAlignment horizontalAlignment)
This property allows to control the property alignment in views that support it. This is either a value of the EHorizontalAlignment enum or its equivalent string representation :

Default value is null, meaning use property type default.

Parameters:
horizontalAlignment - the horizontalAlignment to set.

getHorizontalAlignment

public EHorizontalAlignment getHorizontalAlignment()
Returns the horizontal alignment used for displaying the property.

Specified by:
getHorizontalAlignment in interface IPropertyViewDescriptor
Returns:
the horizontal alignment used for displaying the property.

isSortable

public boolean isSortable()
Gets the sortability.

Specified by:
isSortable in interface IPropertyViewDescriptor
Returns:
the sortable.

setSortable

public void setSortable(boolean sortable)
Configure the sortability of a property view when used to defines a table column for instance. Whenever it is not explicitely set, it falls back to the model property sortability. If no model descriptor is set, defaults to true.

Parameters:
sortable - the sortable to set.

isReadOnly

public boolean isReadOnly()
Queries the model property descriptor to determine read-only state.

Wether read-only is forced.

Specified by:
isReadOnly in interface IGateAccessible
Overrides:
isReadOnly in class BasicViewDescriptor
Returns:
true if read-only.


Copyright © 2005-2012 Jspresso. All Rights Reserved.