cz.cmc.tcgui.datadef
Class AttributeGroup

java.lang.Object
  extended bycz.cmc.tcgui.datadef.TCEntry
      extended bycz.cmc.tcgui.datadef.AttributeEntry
          extended bycz.cmc.tcgui.datadef.AttributeGroup
All Implemented Interfaces:
Cloneable

public class AttributeGroup
extends AttributeEntry

AttributeGroup is a container for more AttributeEntries (which are in turn AttributeGroups or Attributes).


Nested Class Summary
static class AttributeGroup.AttributeEntryComparator
          Comparator comparing order of AttributeGroup's entries
static class AttributeGroup.AttributeSet
          Class for defining attribute sets.
static class AttributeGroup.AttributeSetPriorityComparator
          Comparator for comparing priority of AttributeSets
 
Field Summary
protected  TreeMap attributeEntries
          Map AttributeEntry => ordered set of AttributeSets
protected  TreeMap attributeSets
          Map attributeSet => ordered set of attributeEntries
 
Fields inherited from class cz.cmc.tcgui.datadef.AttributeEntry
generated, interpreted, maxInstances, minInstances, parent, position, UNLIMITED_INSTANCES, virtual
 
Fields inherited from class cz.cmc.tcgui.datadef.TCEntry
description, id, label, name
 
Constructor Summary
AttributeGroup()
          Creates a new AttributeEntry
AttributeGroup(String id, String name, String label)
          Creates a new AttributeGroup with given id, name and label
 
Method Summary
 void addAttributeEntry(AttributeEntry attributeEntry)
          Appends AttributeEntry to this group.
 void addAttributeSet(AttributeGroup.AttributeSet as)
          Add a new attribute set into this group
 AttributeEntry[] attributeEntries()
          Get array of contained attribute group entries (sorted by index)
 AttributeEntry[] attributeEntriesInSet(AttributeGroup.AttributeSet attributeSet)
          Returns all attribute entries in the given set (sorted by index).
 int attributeEntryCount()
          Returns number of AttributeEntries in group.
 int attributeSetCount()
          Returns number of AttributeSet in group.
 AttributeGroup.AttributeSet[] attributeSets()
          Get array of contained attribute sets (sorted by priority)
 AttributeGroup.AttributeSet[] attributeSetsContainingAttributeEntry(AttributeEntry age)
          Returns all sets containing the given attribute (sorted by priority).
 Object clone()
          Clones this AttributeGroup
 AttributeEntry getAttributeEntryForID(String id)
          Get attribute entry with the given ID from the AttributeGroup
 void insertAttributeEntryAt(AttributeEntry attributeEntry, int position)
          Inserts AttributeEntry into this group at position index.
 void putAttributeEntryIntoSet(AttributeEntry ae, AttributeGroup.AttributeSet as)
          Puts given AttributeEntry into given AttributeSet.
 void removeAttributeEntry(AttributeEntry ae)
          Removes AttributeEntry
 void removeAttributeEntryFromSet(AttributeEntry age, AttributeGroup.AttributeSet as)
          Removes given AttributeEntry from given AttributeSet.
 void removeAttributeSet(AttributeGroup.AttributeSet as)
          Removes AttributeSet
 
Methods inherited from class cz.cmc.tcgui.datadef.AttributeEntry
getGenerated, getInterpreted, getMaxInstances, getMinInstances, getParent, getPosition, getVirtual, setGenerated, setInterpreted, setMaxInstances, setMinInstances, setParent, setPosition, setVirtual, toString
 
Methods inherited from class cz.cmc.tcgui.datadef.TCEntry
getDescription, getID, getLabel, getName, setDescription, setID, setLabel, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

attributeEntries

protected TreeMap attributeEntries
Map AttributeEntry => ordered set of AttributeSets


attributeSets

protected TreeMap attributeSets
Map attributeSet => ordered set of attributeEntries

Constructor Detail

AttributeGroup

public AttributeGroup()
Creates a new AttributeEntry


AttributeGroup

public AttributeGroup(String id,
                      String name,
                      String label)
Creates a new AttributeGroup with given id, name and label

Parameters:
id - id of the AttributeEntry
name - name of the AttributeEntry
label - human-readable label of the AttributeEntry
Method Detail

attributeEntryCount

public int attributeEntryCount()
Returns number of AttributeEntries in group.

Returns:
number of AttributeEntries in group

attributeEntries

public AttributeEntry[] attributeEntries()
Get array of contained attribute group entries (sorted by index)

Returns:
array of attribute group entries

getAttributeEntryForID

public AttributeEntry getAttributeEntryForID(String id)
Get attribute entry with the given ID from the AttributeGroup

Parameters:
id - id to find AttributeEntry for
Returns:
AttributeEntry

attributeSetCount

public int attributeSetCount()
Returns number of AttributeSet in group.

Returns:
number of AttributeSets in group

attributeSets

public AttributeGroup.AttributeSet[] attributeSets()
Get array of contained attribute sets (sorted by priority)

Returns:
array of attribute sets

insertAttributeEntryAt

public void insertAttributeEntryAt(AttributeEntry attributeEntry,
                                   int position)
Inserts AttributeEntry into this group at position index.

Parameters:
attributeEntry - AttributeEntry to insert into group
position - position where to insert the AttributeEntry

addAttributeEntry

public void addAttributeEntry(AttributeEntry attributeEntry)
Appends AttributeEntry to this group.

Parameters:
attributeEntry - AttributeEntry to append to group

removeAttributeEntry

public void removeAttributeEntry(AttributeEntry ae)
Removes AttributeEntry


addAttributeSet

public void addAttributeSet(AttributeGroup.AttributeSet as)
Add a new attribute set into this group

Parameters:
as - AttributeSet to add

removeAttributeSet

public void removeAttributeSet(AttributeGroup.AttributeSet as)
Removes AttributeSet

Parameters:
as - AttributeSet to remove

attributeEntriesInSet

public AttributeEntry[] attributeEntriesInSet(AttributeGroup.AttributeSet attributeSet)
Returns all attribute entries in the given set (sorted by index).

Parameters:
attributeSet - attribute set to return attribute entries for
Returns:

attributeSetsContainingAttributeEntry

public AttributeGroup.AttributeSet[] attributeSetsContainingAttributeEntry(AttributeEntry age)
Returns all sets containing the given attribute (sorted by priority).

Returns:

putAttributeEntryIntoSet

public void putAttributeEntryIntoSet(AttributeEntry ae,
                                     AttributeGroup.AttributeSet as)
Puts given AttributeEntry into given AttributeSet.

Parameters:
as - AttributeSet to put into

removeAttributeEntryFromSet

public void removeAttributeEntryFromSet(AttributeEntry age,
                                        AttributeGroup.AttributeSet as)
Removes given AttributeEntry from given AttributeSet.

Parameters:
age - AttributeEntry to remove
as - AttributeSet to remove from

clone

public Object clone()
Clones this AttributeGroup

Overrides:
clone in class AttributeEntry
Returns:
cloned AttributeGroup