com.ivata.mask.group
Class GroupImpl

java.lang.Object
  extended bycom.ivata.mask.group.GroupImpl
All Implemented Interfaces:
Group, java.io.Serializable
Direct Known Subclasses:
MaskImpl

public class GroupImpl
extends java.lang.Object
implements Group, java.io.Serializable

Implementation of Groupdefining a group of masks which share common field definitions and other characteristics.

Since:
ivata masks 0.1 (2004-02-26)
Author:
Colin MacLeod colin.macleod@ivata.com
See Also:
Serialized Form

Constructor Summary
GroupImpl(java.lang.String nameParam)
          Create a group with no parent.
GroupImpl(java.lang.String nameParam, Group parentParam)
          Create a mask with the specified parent.
 
Method Summary
 void addExcludedFieldName(java.lang.String nameParam)
          Add the name of a field to exclude from this mask group.
 void addField(Field fieldParam)
          Add a field definition to this group.
 void addFilter(Filter filterParam)
          Add a filter to the list.
 void addFirstFieldName(java.lang.String nameParam)
          Add the identifier for one of the first fields in the mask.
 void addIncludedFieldName(java.lang.String nameParam)
          Add the name of an included field.
 void addLastFieldName(java.lang.String nameParam)
          Add the identifier for one of the last fields in the mask.
 java.util.Set getAllExcludedFieldNames()
          Get the field names of all fields which have been excluded from this and its parents.
protected static java.util.Set getAllExcludedFieldNames(Group instance)
          Implementation of getAllExcludedFieldNames().
 java.util.List getAllFirstFieldNames()
           Get the field identifiers of all fields which should appear at the start of the group/mask, including those defined by its parent.
protected static java.util.List getAllFirstFieldNames(Group instance)
          Implementation of getAllFirstFieldNames().
 java.util.List getAllLastFieldNames()
           Get the field identifiers of all fields which should appear at the end of the group/mask, including those defined by its parent.
protected static java.util.List getAllLastFieldNames(Group instance)
          Implementation of getAllLastFieldNames().
 java.util.Set getExcludedFieldNames()
           Get the field ids which have been explicitly excluded from this group.
 Field getField(java.lang.String nameParam)
           Default field definitions.
 java.util.List getFilters()
          Refer to Group.getFilters().
 java.util.List getFirstFieldNames()
           Get the ids of all fields which should appear at the start of masks in this group.
 java.util.Set getIncludedFieldNames()
          By explicitly including fields in a mask, you can override fields excluded by one of its parents.
 java.util.List getLastFieldNames()
           Get the ids of all fields which should appear at the end of masks in this group.
 java.lang.String getName()
          Refer to Group.getName().
 Group getParent()
           Get the parent of this group, if any.
 boolean isDisplayOnly()
           If true, only the values in this mask will be displayed.
 boolean isParentFirstFieldNamesReplaced()
           When first field identifiers are defined for a group, normally these are appended to the list of all parent group first field identifiers, i.e.
 boolean isParentLastFieldNamesReplaced()
           When last field identifiers are defined for a group, normally these are appended to the list of all parent group last field identifiers, i.e.
 void setDisplayOnly(boolean b)
           If true, only the values in this mask will be displayed.
 void setParentFirstFieldNamesReplaced(boolean parentFirstFieldNamesReplacedParam)
          Set whether or not the first field name list of parent mask groups should be replaced.
 void setParentLastFieldNamesReplaced(boolean parentLastFieldNamesReplacedParam)
          Set whether or not the last field name list of parent mask groups should be replaced.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupImpl

public GroupImpl(java.lang.String nameParam)
Create a group with no parent.

Parameters:
nameParam - unique identifier for this group.

GroupImpl

public GroupImpl(java.lang.String nameParam,
                 Group parentParam)
Create a mask with the specified parent.

Parameters:
nameParam - unique identifier for this group.
parentParam - group which this group extends.
Method Detail

getAllExcludedFieldNames

protected static java.util.Set getAllExcludedFieldNames(Group instance)
Implementation of getAllExcludedFieldNames().

Parameters:
instance - instance for which to get the excluded fields.
Returns:
list of all excluded field ids, as a List of String instances.
See Also:
getAllExcludedFieldNames()

getAllFirstFieldNames

protected static java.util.List getAllFirstFieldNames(Group instance)
Implementation of getAllFirstFieldNames().

Parameters:
instance - instance for which to get the first fields.
Returns:
list of all first field ids, as a List of String instances.
See Also:
getAllFirstFieldNames()

getAllLastFieldNames

protected static java.util.List getAllLastFieldNames(Group instance)
Implementation of getAllLastFieldNames().

Parameters:
instance - instance for which to get the last fields.
Returns:
list of all last field ids, as a List of String instances.
See Also:
getAllLastFieldNames()

addExcludedFieldName

public final void addExcludedFieldName(java.lang.String nameParam)
Add the name of a field to exclude from this mask group.

Parameters:
nameParam - unique identifier for the field which should be excluded.
See Also:
getExcludedFieldNames()

addField

public final void addField(Field fieldParam)
Add a field definition to this group.

Parameters:
fieldParam - field definition to add to this mask group.

addFilter

public final void addFilter(Filter filterParam)
Add a filter to the list.

Parameters:
filterParam - filter to be added.
See Also:
Group#getFilters.

addFirstFieldName

public final void addFirstFieldName(java.lang.String nameParam)
Add the identifier for one of the first fields in the mask.

Parameters:
nameParam - unique identifier for the field which should appear at the start of the mask group.
See Also:
getFirstFieldNames()

addIncludedFieldName

public final void addIncludedFieldName(java.lang.String nameParam)
Add the name of an included field.

Parameters:
nameParam - unique identifier for the field which should appear in the mask group, overriding parent excluded fields.
See Also:
getIncludedFieldNames()

addLastFieldName

public final void addLastFieldName(java.lang.String nameParam)
Add the identifier for one of the last fields in the mask.

Parameters:
nameParam - unique identifier for the field which should appear at the end of the mask group.
See Also:
getLastFieldNames()

getAllExcludedFieldNames

public final java.util.Set getAllExcludedFieldNames()
Get the field names of all fields which have been excluded from this and its parents.

Note: This will include fields which were explicitly included, even if a parent class excluded them before.

Specified by:
getAllExcludedFieldNames in interface Group
Returns:
list of all excluded field names, as a Set of String instances.
See Also:
Group.getExcludedFieldNames()

getAllFirstFieldNames

public final java.util.List getAllFirstFieldNames()

Get the field identifiers of all fields which should appear at the start of the group/mask, including those defined by its parent.

Specified by:
getAllFirstFieldNames in interface Group
Returns:
list of all first field ids, as a List of String instances.
See Also:
getFirstFieldNames()

getAllLastFieldNames

public final java.util.List getAllLastFieldNames()

Get the field identifiers of all fields which should appear at the end of the group/mask, including those defined by its parent.

Specified by:
getAllLastFieldNames in interface Group
Returns:
list of all last field ids, as a List of String instances.
See Also:
getFirstFieldNames()

getExcludedFieldNames

public final java.util.Set getExcludedFieldNames()

Get the field ids which have been explicitly excluded from this group.

Specified by:
getExcludedFieldNames in interface Group
Returns:
the field ids which have been explicitly excluded from this group (not including those excluded by parent groups).

getField

public final Field getField(java.lang.String nameParam)

Default field definitions. These can be altered/overridden.

Specified by:
getField in interface Group
Parameters:
nameParam - name of the field to be returned.
Returns:
read-only copy of the fields.

getFilters

public java.util.List getFilters()
Refer to Group.getFilters().

Specified by:
getFilters in interface Group
Returns:
Refer to Group.getFilters().

getFirstFieldNames

public final java.util.List getFirstFieldNames()

Get the ids of all fields which should appear at the start of masks in this group. For an input mask this usually means the fields will appear at the top of the page; for a list the fields will appear at the left of the list.

Note that all these fields do not need to be present in all masks of this group (some value objects may not have all the fields listed). Those fields which are listed and present in the value object will appear at the start, in the order given.

Specified by:
getFirstFieldNames in interface Group
Returns:
list containing string identifiers of fields which should appear first in the mask.

getIncludedFieldNames

public final java.util.Set getIncludedFieldNames()
By explicitly including fields in a mask, you can override fields excluded by one of its parents.

Specified by:
getIncludedFieldNames in interface Group
Returns:
fields explicitly included (overridden) in this mask.

getLastFieldNames

public final java.util.List getLastFieldNames()

Get the ids of all fields which should appear at the end of masks in this group. For an input mask this usually means the fields will appear at the bottom of the page; for a list the fields will appear at the right of the list.

Note that all these fields do not need to be present in all masks of this group (some value objects may not have all the fields listed). Those fields which are listed and present in the value object will appear at the end, in the order given.

Specified by:
getLastFieldNames in interface Group
Returns:
list containing string identifiers of fields which should appear last in the mask.

getName

public final java.lang.String getName()
Refer to Group.getName().

Specified by:
getName in interface Group
Returns:
unique identifier of this group.

getParent

public final Group getParent()

Get the parent of this group, if any.

Each group or mask can define a parent, from which it can inherit field definitions and group/mask properties.

Specified by:
getParent in interface Group
Returns:
parent of this group, or null if this is a top-level group.

isDisplayOnly

public final boolean isDisplayOnly()

If true, only the values in this mask will be displayed. Otherwise, input fields are displayed.

This setting is inherited. If it is not set in a group directly, the value for the group's parent is taken.

Specified by:
isDisplayOnly in interface Group
Returns:
whether or not the mask should only display field values.

isParentFirstFieldNamesReplaced

public final boolean isParentFirstFieldNamesReplaced()

When first field identifiers are defined for a group, normally these are appended to the list of all parent group first field identifiers, i.e. the list returned by calling getFirstFieldNames on the parent group.

This is the standard, default behavior when this method returns false. However, if this method returns true, then the first field identifiers in this group override (replace) the list returned by the group's parents.

Specified by:
isParentFirstFieldNamesReplaced in interface Group
Returns:
true if this group replaces the list of first field ids defined by parent groups, otherwise false if this group's list will be appended to that of its parents.
See Also:
getFirstFieldNames()

isParentLastFieldNamesReplaced

public final boolean isParentLastFieldNamesReplaced()

When last field identifiers are defined for a group, normally these are appended to the list of all parent group last field identifiers, i.e. the list returned by calling getLastFieldNameson the parent group.

This is the standard, default behavior when this method returns false. However, if this method returns true, then the last field identifiers in this group override (replace) the list returned by the group's parents.

Specified by:
isParentLastFieldNamesReplaced in interface Group
Returns:
true if this group replaces the list of last field ids defined by parent groups, otherwise false if this group's list will be appended to that of its parents.
See Also:
getLastFieldNames()

setDisplayOnly

public final void setDisplayOnly(boolean b)

If true, only the values in this mask will be displayed. Otherwise, input fields are displayed.

This setting is inherited. If it is not set in a group directly, the value for the group's parent is taken.

Parameters:
b - if true field values are just displayed and cannot be changed.
See Also:
isDisplayOnly()

setParentFirstFieldNamesReplaced

public final void setParentFirstFieldNamesReplaced(boolean parentFirstFieldNamesReplacedParam)
Set whether or not the first field name list of parent mask groups should be replaced.

Parameters:
parentFirstFieldNamesReplacedParam - true if parent first field ids should be replaced (ignored), otherwise false.
See Also:
isParentFirstFieldNamesReplaced()

setParentLastFieldNamesReplaced

public final void setParentLastFieldNamesReplaced(boolean parentLastFieldNamesReplacedParam)
Set whether or not the last field name list of parent mask groups should be replaced.

Parameters:
parentLastFieldNamesReplacedParam - true if parent last field ids should be replaced (ignored), otherwise false.
See Also:
isParentLastFieldNamesReplaced()


Copyright © 2001-2005 ivata limited. All Rights Reserved.