org.eml.MMAX2.annotation.markables
Class MarkableSet

java.lang.Object
  extended by org.eml.MMAX2.annotation.markables.MarkableSet
All Implemented Interfaces:
Renderable, MarkableSetAPI

public class MarkableSet
extends java.lang.Object
implements Renderable, MarkableSetAPI


Constructor Summary
MarkableSet(java.lang.String _attributeValue, boolean _ordered, int _lineWidth, java.awt.Color _color, int _lineStyle, MarkableRelation relation)
          Creates a new MarkableSet for attributeValue _attributeValue (e.g.
 
Method Summary
 void addMarkable(Markable _markable)
          Adds a Markable to this MarkableSet.
 boolean containsMarkable(Markable markable)
          (API) Whether this MarkableSet contains the Markable markable.
 boolean containsMatchingMarkableFromLevel(java.lang.String markableProducingQuery, MarkableLevel level)
           
 void drawSet(java.awt.Graphics2D graphics)
           
 java.lang.String getAttributeValue()
          Returns the value of the MARKABLE_SET-type MarkableRelation that this set belongs to, e.g.
 java.util.ArrayList getIDVilainRepresentation()
           
 Markable getInitialMarkable()
          (API) Returns the Markable object that this MarkableSet starts with.
 boolean getIsPermanent()
           
 int getMarkableIndex(Markable _markable)
          (API) Returns the position of Markable markable in this MarkableSet.
 MarkableRelation getMarkableRelation()
          (API) Returns the MarkableRelation object that this MarkableSet is associated with.
 Markable[] getOrderedMarkables()
          (API) Returns an array of all Markable objects in this MarkableSet.
 java.util.HashSet getSetOfStrings()
           
 int getSize()
           
 java.util.ArrayList getVilainRepresentation()
           
 boolean isOpaque()
           
 boolean matches(int requiredSize, java.util.ArrayList startsWithMarkables)
           
 void refresh(java.awt.Graphics2D graphics)
          This method is called whenever this set is to be re-rendered.
 void removeMarkable(Markable _markable)
           
 void removeMeFromMarkableRelation()
           
 void select(java.awt.Graphics2D graphics, MMAX2Document doc, Markable currentlySelectedMarkable)
          This method is called ONCE when this set is to be rendered initially.
 void setFlagLevel(int _level)
           
 void setIsPermanent(boolean _permanent)
           
 void setOpaque(boolean status)
           
 boolean startsWithMarkable(Markable markable)
           
 boolean startsWithMatchingMarkableFromLevel(java.lang.String markableProducingQuery, MarkableLevel level)
           
 java.lang.String toString()
           
 void unselect(MMAX2Document doc)
          This method is called ONCE to remove all selection-dependent rendering from this set.
 void updateLinePoints()
           
 void updateLinePoints(boolean recalcExtent)
          This method updates the cached XY-coordinates of the top left corners of each Markable in this MarkableSet.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MarkableSet

public MarkableSet(java.lang.String _attributeValue,
                   boolean _ordered,
                   int _lineWidth,
                   java.awt.Color _color,
                   int _lineStyle,
                   MarkableRelation relation)
Creates a new MarkableSet for attributeValue _attributeValue (e.g. set_4), with ordering set to _ordered.

Method Detail

setIsPermanent

public final void setIsPermanent(boolean _permanent)
Specified by:
setIsPermanent in interface Renderable

getIsPermanent

public final boolean getIsPermanent()
Specified by:
getIsPermanent in interface Renderable

setOpaque

public final void setOpaque(boolean status)

isOpaque

public final boolean isOpaque()
Specified by:
isOpaque in interface Renderable

getAttributeValue

public final java.lang.String getAttributeValue()
Returns the value of the MARKABLE_SET-type MarkableRelation that this set belongs to, e.g. 'set_4'.


removeMarkable

public final void removeMarkable(Markable _markable)

addMarkable

public final void addMarkable(Markable _markable)
Adds a Markable to this MarkableSet. If this.ordered, the Markable will be inserted at the correct (document order) position in this.orderedSet, otherwise it is just added to this.unorderedSet. Document order position is determined on the basis of the displayStartPosition of the first fragment in the Markable.


updateLinePoints

public final void updateLinePoints()
Specified by:
updateLinePoints in interface Renderable

updateLinePoints

public final void updateLinePoints(boolean recalcExtent)
This method updates the cached XY-coordinates of the top left corners of each Markable in this MarkableSet. The method is called after display changes.


select

public final void select(java.awt.Graphics2D graphics,
                         MMAX2Document doc,
                         Markable currentlySelectedMarkable)
This method is called ONCE when this set is to be rendered initially. It renders both the individual set member Markables and the lines between them (if any.) It is also called after deletion of set members occurred.

Specified by:
select in interface Renderable

refresh

public final void refresh(java.awt.Graphics2D graphics)
This method is called whenever this set is to be re-rendered. It renders only the lines between set member Markables (if any.)

Specified by:
refresh in interface Renderable

unselect

public final void unselect(MMAX2Document doc)
This method is called ONCE to remove all selection-dependent rendering from this set. It renders unselected all member set Markables, and refreshes the display so that lines between Markables (if any) are removed.

Specified by:
unselect in interface Renderable

drawSet

public final void drawSet(java.awt.Graphics2D graphics)

containsMatchingMarkableFromLevel

public final boolean containsMatchingMarkableFromLevel(java.lang.String markableProducingQuery,
                                                       MarkableLevel level)

startsWithMatchingMarkableFromLevel

public final boolean startsWithMatchingMarkableFromLevel(java.lang.String markableProducingQuery,
                                                         MarkableLevel level)

getMarkableRelation

public final MarkableRelation getMarkableRelation()
Description copied from interface: MarkableSetAPI
(API) Returns the MarkableRelation object that this MarkableSet is associated with.

Specified by:
getMarkableRelation in interface MarkableSetAPI
Returns:
The MarkableRelation object that this MarkableSet is associated with.

containsMarkable

public final boolean containsMarkable(Markable markable)
Description copied from interface: MarkableSetAPI
(API) Whether this MarkableSet contains the Markable markable.

Specified by:
containsMarkable in interface Renderable
Specified by:
containsMarkable in interface MarkableSetAPI
Parameters:
markable - The Markable object to be tested for membership in this MarkableSet.
Returns:
True if markable is contained in this MarkableSet, else false.

startsWithMarkable

public final boolean startsWithMarkable(Markable markable)

getInitialMarkable

public final Markable getInitialMarkable()
Description copied from interface: MarkableSetAPI
(API) Returns the Markable object that this MarkableSet starts with.

Specified by:
getInitialMarkable in interface MarkableSetAPI
Returns:
The Markable object that this MarkableSet begins with. This method is available for ordered sets only!

getOrderedMarkables

public final Markable[] getOrderedMarkables()
Description copied from interface: MarkableSetAPI
(API) Returns an array of all Markable objects in this MarkableSet.

Specified by:
getOrderedMarkables in interface MarkableSetAPI
Returns:
An array of all Markable objects in this MarkableSet, in discourse order. This method is available for ordered sets only!

getMarkableIndex

public final int getMarkableIndex(Markable _markable)
Description copied from interface: MarkableSetAPI
(API) Returns the position of Markable markable in this MarkableSet.

Specified by:
getMarkableIndex in interface MarkableSetAPI
Parameters:
_markable - The Markable to be localized in this MarkableSet.
Returns:
The index (zero-based) of Markable markable, or -1. This method is available for ordered sets only!

matches

public final boolean matches(int requiredSize,
                             java.util.ArrayList startsWithMarkables)

getVilainRepresentation

public final java.util.ArrayList getVilainRepresentation()

getIDVilainRepresentation

public final java.util.ArrayList getIDVilainRepresentation()

getSetOfStrings

public final java.util.HashSet getSetOfStrings()

getSize

public final int getSize()

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

removeMeFromMarkableRelation

public final void removeMeFromMarkableRelation()

setFlagLevel

public void setFlagLevel(int _level)
Specified by:
setFlagLevel in interface Renderable