org.pm4j.core.pm.impl.title
Class TitleProviderPmResBased<T extends PmObjectBase>

java.lang.Object
  extended by org.pm4j.core.pm.impl.title.TitleProviderPmResBased<T>
All Implemented Interfaces:
PmTitleProvider<T>
Direct Known Subclasses:
AsteriskAttrTitleProvider, TitleProviderAttrValueBased

public class TitleProviderPmResBased<T extends PmObjectBase>
extends java.lang.Object
implements PmTitleProvider<T>

Provides titles based on presentation model resource keys.

Author:
olaf boede

Field Summary
static TitleProviderPmResBased<PmObjectBase> INSTANCE
          An instance that can be used as a singleton.
 
Constructor Summary
TitleProviderPmResBased()
           
 
Method Summary
 boolean canSetTitle(T item)
          Indicates if it is allowed to call the #setTitle(Object, Object, String) method for the given item.
 java.lang.String getIconPath(T item)
          Provides an icon resource string that is defined within the resource file(s).
 java.lang.String getShortTitle(T item)
          
 java.lang.String getTitle(T item)
          
 java.lang.String getToolTip(T item)
          
 void setTitle(T item, java.lang.String titleString)
          An interface for 'in place editing' of node titles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final TitleProviderPmResBased<PmObjectBase> INSTANCE
An instance that can be used as a singleton.

Constructor Detail

TitleProviderPmResBased

public TitleProviderPmResBased()
Method Detail

canSetTitle

public boolean canSetTitle(T item)
Description copied from interface: PmTitleProvider
Indicates if it is allowed to call the #setTitle(Object, Object, String) method for the given item.

Specified by:
canSetTitle in interface PmTitleProvider<T extends PmObjectBase>
Returns:
false.

setTitle

public void setTitle(T item,
                     java.lang.String titleString)
Description copied from interface: PmTitleProvider
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.

Specified by:
setTitle in interface PmTitleProvider<T extends PmObjectBase>
Throws:
java.lang.UnsupportedOperationException

getTitle

public java.lang.String getTitle(T item)

Specified by:
getTitle in interface PmTitleProvider<T extends PmObjectBase>
Parameters:
item - An item to get a title for.
Returns:
The title string for the given item.

getShortTitle

public java.lang.String getShortTitle(T item)

Specified by:
getShortTitle in interface PmTitleProvider<T extends PmObjectBase>
Parameters:
item - An item to get the undecorated title for.
Returns:
The undecorated title string for the given item.
See Also:
PmTitledObject#getPmShortTitle()

getToolTip

public java.lang.String getToolTip(T item)

Specified by:
getToolTip in interface PmTitleProvider<T extends PmObjectBase>
Parameters:
item - The item to get a tooltip for.
Returns:
A tooltip string or null when there is no tooltip for the given item.

getIconPath

public java.lang.String getIconPath(T item)
Provides an icon resource string that is defined within the resource file(s).

For enabled items a resource string with the postfix '.icon' will be used.
For disabled item a resource string with the postfix '.icon_disabled' will be used.
If there is no '.icon_disabled' resource defined, the '.icon' resource will be used for the disabled state too.

Specified by:
getIconPath in interface PmTitleProvider<T extends PmObjectBase>
Parameters:
item - The item to get a icon name for.
Returns:
A icon string or null when there is no icon for the given item.