org.pm4j.core.pm
Interface PmObject

All Superinterfaces:
java.lang.Comparable<PmObject>
All Known Subinterfaces:
PmAttr<T>, PmAttrBigDecimal, PmAttrBoolean, PmAttrDate, PmAttrDouble, PmAttrEnum<T_ENUM>, PmAttrInteger, PmAttrList<T>, PmAttrLong, PmAttrNumber<T>, PmAttrPmList<T_ITEM_PM>, PmAttrPmRef<T_REFED_PM>, PmAttrShort, PmAttrString, PmBean<T_BEAN>, PmCommand, PmConversation, PmDataInput, PmElement, PmLabel, PmTable<T_ROW_OBJ>, PmTable.WithPager<T_ROW_ELEMENT>, PmTableCol, PmTableRowPm, PmTabSet, PmTreeNode
All Known Implementing Classes:
PmAttrBase, PmAttrBigDecimalImpl, PmAttrBooleanImpl, PmAttrDateBase, PmAttrDateBase.WithFormatTooltip, PmAttrDateImpl, PmAttrDoubleImpl, PmAttrEnumImpl, PmAttrImpl, PmAttrIntegerImpl, PmAttrListImpl, PmAttrListImpl.PmAttrListOfIntegers, PmAttrListImpl.PmAttrListOfLongs, PmAttrListImpl.PmAttrListOfStrings, PmAttrLongImpl, PmAttrNumBase, PmAttrPmListImpl, PmAttrPmRefImpl, PmAttrShortImpl, PmAttrStringImpl, PmBeanBase, PmBeanBase.Nested, PmCommandGroup, PmCommandImpl, PmCommandNaviBack, PmCommandProxy, PmCommandSeparator, PmContentChangeCommand, PmConversationImpl, PmConversationImpl.ChildSession, PmDataInputBase, PmElementBase, PmElementImpl, PmLabelImpl, PmListAddItemCommand, PmListRemoveItemCommand, PmObjectBase, PmPagerImpl, PmPagerImpl.SelectableItemPm, PmTableColImpl, PmTableColImpl.CmdSortPm, PmTableColImpl.SortOrderAttr, PmTableImpl, PmTabSetImpl, PmValueChangeCommand

public interface PmObject
extends java.lang.Comparable<PmObject>

Basic interface for common presentation model functionality.

Author:
olaf boede

Field Summary
static java.lang.String STYLE_CLASS_DISABLED
           
static java.lang.String STYLE_CLASS_ERROR
           
static java.lang.String STYLE_CLASS_INFO
           
static java.lang.String STYLE_CLASS_REQUIRED
           
static java.lang.String STYLE_CLASS_WARN
           
 
Method Summary
 void accept(PmVisitor visitor)
           
 boolean canSetPmTitle()
          Indicates if it is allowed to call the #setPmTitle(Object, String) method for the given item.
 int compareTo(PmObject otherPm)
          PMs may exist in sortable contexts.
 PmConversation getPmConversation()
           
 java.lang.String getPmIconPath()
           
 java.lang.String getPmName()
          A unique short name of this item within its parent scope.
 PmObject getPmParent()
           
 java.lang.Object getPmProperty(java.lang.String propName)
          Returns a application specific property that may have been defined using setPmProperty(String, Object).
 java.lang.String getPmRelativeName()
          The unique relative name of the pm within its PM-composite.
 java.lang.String getPmShortTitle()
          Some applications decorate titles for specific items with some extra characters.
 java.util.Set<java.lang.String> getPmStyleClasses()
          A PM may provide CSS style classes to provide layout hints.
 java.lang.String getPmTitle()
           
 java.lang.String getPmTooltip()
           
 boolean isPmEnabled()
           
 boolean isPmReadonly()
           
 boolean isPmValid()
          Checks if there is an error message related to this PM.
 boolean isPmVisible()
           
 void setPmEnabled(java.lang.Boolean enabled)
           
 void setPmParent(PmObject pmParent)
          Setter for dependency injection framework support.
 void setPmProperty(java.lang.String propName, java.lang.Object value)
          TODO
 void setPmTitle(java.lang.String titleString)
          An interface for 'in place editing' of node titles.
 void setPmVisible(java.lang.Boolean visible)
          The visibility state is usually defined by some UI logic code of the implementing class.
 

Field Detail

STYLE_CLASS_REQUIRED

static final java.lang.String STYLE_CLASS_REQUIRED
See Also:
Constant Field Values

STYLE_CLASS_DISABLED

static final java.lang.String STYLE_CLASS_DISABLED
See Also:
Constant Field Values

STYLE_CLASS_ERROR

static final java.lang.String STYLE_CLASS_ERROR
See Also:
Constant Field Values

STYLE_CLASS_WARN

static final java.lang.String STYLE_CLASS_WARN
See Also:
Constant Field Values

STYLE_CLASS_INFO

static final java.lang.String STYLE_CLASS_INFO
See Also:
Constant Field Values
Method Detail

getPmTitle

java.lang.String getPmTitle()
Returns:
A title string for this item.

getPmShortTitle

java.lang.String getPmShortTitle()
Some applications decorate titles for specific items with some extra characters.

Example: A required field or a modified item may be decorated with an asterisk. So that the attribute 'name' appears with the title 'Name *' in an data entry form.

That decorated title is provided by getPmTitle(). This method provides the undecorated title that may be used for generation of messages such as: 'Please enter a value for field Name.'.

In addition the simple title may be specified separately in the resource file with the postfix '.shortTitle'.

Example resource definition for explicit short title definition:

    myPm.oriSelection=Specify the Original
    myPm.oriSelection.shortTitle=Original
  

Returns:
The undecorated title string for this item.

getPmTooltip

java.lang.String getPmTooltip()
Returns:
The tool tip string of this item or null when there is no tool tip.

getPmIconPath

java.lang.String getPmIconPath()
Returns:
Resource path of the icon to show for this PM or null if no icon should be displayed.

canSetPmTitle

boolean canSetPmTitle()
Indicates if it is allowed to call the #setPmTitle(Object, String) method for the given item.

Returns:
true when it is allowed to call #setTitle(Object, Object, String).

setPmTitle

void setPmTitle(java.lang.String titleString)
An interface for 'in place editing' of node titles.

That might be a useful feature for title string editors of tree views where a user can simply click on a title and change it.

Parameters:
eventSource -
titleString -

getPmConversation

PmConversation getPmConversation()
Returns:
The conversation context of this model element. Never null.

getPmParent

PmObject getPmParent()
Returns:
The parent object of this PM.
Is null for the root session only.

setPmParent

void setPmParent(PmObject pmParent)
Setter for dependency injection framework support.

Should only be used if the instance has not yet an assigned pmParent.

Parameters:
pmParent - The context, this PM was created in.

isPmVisible

boolean isPmVisible()
Returns:
true when the element may be displayed.

setPmVisible

void setPmVisible(java.lang.Boolean visible)
The visibility state is usually defined by some UI logic code of the implementing class.

In some cases it is useful to control the visibility of an UI element by calling this setter.

Parameters:
visible - The new local visibility state. If set to null, the visibility provided by isPmVisibleImpl() will be applied.

isPmEnabled

boolean isPmEnabled()
Returns:
true when the element should be rendered as enabled UI element.

setPmEnabled

void setPmEnabled(java.lang.Boolean enabled)
Parameters:
enabled - The new local enabled state.

isPmReadonly

boolean isPmReadonly()
Returns:
true when the values of this PM may not be changed.

getPmName

java.lang.String getPmName()
A unique short name of this item within its parent scope.

Returns:
The attribute/command/session name.
Is null for models that are created dynamically (e.g. elements of a list).

getPmRelativeName

java.lang.String getPmRelativeName()
The unique relative name of the pm within its PM-composite. This kind of name may be used in html forms to identify the fields to enter.

Returns:
The unique name within the PM-composite.
An empty string for non-PM-composite children. FIXME: Derzeit nicht!

isPmValid

boolean isPmValid()
Checks if there is an error message related to this PM.

Is often used to check if the UI should show a not valid attribute with a special style.

Returns:
true if there is an error (may be a validation error) related this PM.

getPmStyleClasses

java.util.Set<java.lang.String> getPmStyleClasses()
A PM may provide CSS style classes to provide layout hints.

The set of style classes may change whenever the state of the PM changes. It usually contains an 'error' class if there is an error message related to this PM.

Returns:
The set of CSS style classes for this PM.

getPmProperty

java.lang.Object getPmProperty(java.lang.String propName)
Returns a application specific property that may have been defined using setPmProperty(String, Object).

Returns:
The property value or null if the property is not defined.

setPmProperty

void setPmProperty(java.lang.String propName,
                   java.lang.Object value)
TODO

Parameters:
propName -
value -

accept

void accept(PmVisitor visitor)
Parameters:
visitor - A visitor to call back.

compareTo

int compareTo(PmObject otherPm)
PMs may exist in sortable contexts. (For example a cell in a table.)
This method allows to perform the required sort operations in these contexts.

Specified by:
compareTo in interface java.lang.Comparable<PmObject>
Parameters:
otherPm - The PM to compare.
Returns:
The usual Comparable result: a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.