org.eml.MMAX2.annotation.scheme
Class MMAX2AnnotationScheme

java.lang.Object
  extended by org.eml.MMAX2.annotation.scheme.MMAX2AnnotationScheme
All Implemented Interfaces:
AnnotationSchemeAPI

public class MMAX2AnnotationScheme
extends java.lang.Object
implements AnnotationSchemeAPI


Constructor Summary
MMAX2AnnotationScheme(java.lang.String schemefilename)
           
 
Method Summary
 void addValueIDToAttributeIDMapping(java.lang.String valueID, java.lang.String attributeID)
           
 void annotationHintToBack()
           
 void annotationHintToFront()
           
 void destroyDependentComponents()
           
 java.util.ArrayList getAllAttributeNames()
           
 java.util.ArrayList getAllDistinctDisplayAttributeNames_()
          This method returns an ArrayList of all distinct DisplayAttributeNames (cased!), irrespective of their SchemeLevels.
 MMAX2Attribute getAttributeByID(java.lang.String id)
          (API) Returns the MMAX2Attribute object with ID attributeID, as defined in annotation scheme file.
 java.lang.String[] getAttributeNamesByType(int type)
           
 java.util.ArrayList getAttributeNamesForValues(java.lang.String valueList, java.lang.String optionalAttributeName)
          This method returns a list of attribute names for which *all* the values in valueList are defined, or empty list.
 MMAX2AttributePanel getAttributePanel()
           
 java.util.ArrayList getAttributes()
           
 MMAX2Attribute[] getAttributes(Markable markable)
          This method returns an array of MMAX2Attribute objects reflecting the attributes of Markable markable.
 MMAX2Attribute[] getAttributesByName(java.lang.String nameRegExp)
          (API) Returns an array of all MMAX2Attribute objects of whose name matches the RegExp attributeNameRegExp.
 MMAX2Attribute[] getAttributesByNameAndType(java.lang.String name, int type)
          (API) Returns an array of all MMAX2Attribute objects of type attributeType whose name matches the RegExp attributeNameRegExp.
 MMAX2Attribute[] getAttributesByNameAndType(java.lang.String name, int type1, int type2)
          (API) Returns an array of all MMAX2Attribute objects of type attributeType1 or attributeType2 whose name matches the RegExp attributeNameRegExp.
 MMAX2Attribute[] getAttributesByType(int type)
          (API) Returns an array of all MMAX2Attribute objects of type attributeType.
 MMAX2Attribute[] getAttributesByType(int type1, int type2)
          (API) Returns an array of all MMAX2Attribute objects of either type attributeType1 or attributeType2.
 int getAttributeTypeByAttributeName(java.lang.String attribute)
           
 MMAX2AttributePanel getCurrentAttributePanel()
           
 java.util.ArrayList getIndependentAttributes(boolean enable)
          This method produces an ArrayList of those MMAX2Attributes in annotation scheme order that do not depend on any other attribute.
 java.util.ArrayList getInitialAttributes()
          This method is used to create the list of attributes to be applied to new markables.
 java.lang.String getSchemeFileName()
           
 int getSize()
           
 MMAX2Attribute getUniqueAttributeByName(java.lang.String nameRegExp)
          (API) Returns the MMAX2Attribute object whose name matches the RegExp attributeNameRegExp.
 MMAX2Attribute getUniqueAttributeByNameAndType(java.lang.String name, int type)
          (API) Returns the MMAX2Attribute object of type attributeType whose name matches the RegExp attributeNameRegExp.
 MMAX2Attribute getUniqueAttributeByNameAndType(java.lang.String name, int type1, int type2)
          (API) Returns a MMAX2Attribute object of type attributeType1 or attributeType2 whose name matches the RegExp attributeNameRegExp.
 MMAX2Attribute getUniqueAttributeByType(int type)
          (API) Returns the MMAX2Attribute object of type attributeType.
 MMAX2Attribute getUniqueAttributeByType(int type1, int type2)
          (API) Returns the MMAX2Attribute object of either type attributeType1 or attributeType2.
 void hideAnnotationHint()
           
 boolean isDefined(java.lang.String attributename)
           
 void mapSelections(MMAX2Attribute[] removedLevels, MMAX2Attribute[] requestedLevels)
          This method transfers those selections in removedLevels that are valid for requestedLevels to the latter.
static java.lang.String readHTMLFromFile(java.lang.String file)
           
 void reset()
          This method resets the AttributeWindow to the initial state as defined in this AnnotationScheme
 void resetAllAttributes()
           
 void setAttributePanelContainer(MMAX2AttributePanelContainer _container)
           
 void setEnabled(boolean status)
           
 void setMMAX2(MMAX2 _mmax2)
           
 void showAnnotationHint(java.lang.String hint, boolean _lock, java.lang.String _att)
           
 void valueChanged(MMAX2Attribute callingAttribute, MMAX2Attribute topCallingAttribute, MMAX2Attribute[] oldRemovedAttributes, int position, java.util.ArrayList requestedAttributesAsList)
          This method is called from the mmaxattribute callingAttribute when the user changed some value on it by clicking a button or changing the selection in a listbox.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MMAX2AnnotationScheme

public MMAX2AnnotationScheme(java.lang.String schemefilename)
Method Detail

readHTMLFromFile

public static java.lang.String readHTMLFromFile(java.lang.String file)

setAttributePanelContainer

public final void setAttributePanelContainer(MMAX2AttributePanelContainer _container)

getSchemeFileName

public java.lang.String getSchemeFileName()

showAnnotationHint

public final void showAnnotationHint(java.lang.String hint,
                                     boolean _lock,
                                     java.lang.String _att)

hideAnnotationHint

public final void hideAnnotationHint()

annotationHintToFront

public final void annotationHintToFront()

annotationHintToBack

public final void annotationHintToBack()

getAttributesByType

public MMAX2Attribute[] getAttributesByType(int type)
Description copied from interface: AnnotationSchemeAPI
(API) Returns an array of all MMAX2Attribute objects of type attributeType.

Specified by:
getAttributesByType in interface AnnotationSchemeAPI
Parameters:
type - The type of the MMAX2Attribute objects to return, as specified in the annotation scheme file, one of the values defined in AttributeAPI.
Returns:
An array of MMAX2Attribute objects of type attributeType, or empty array.

getUniqueAttributeByType

public MMAX2Attribute getUniqueAttributeByType(int type)
Description copied from interface: AnnotationSchemeAPI
(API) Returns the MMAX2Attribute object of type attributeType.

Specified by:
getUniqueAttributeByType in interface AnnotationSchemeAPI
Parameters:
type - The type of the MMAX2Attribute object to return, as specified in the annotation scheme file, one of the values defined in AttributeAPI.
Returns:
A MMAX2Attribute objects of type attributeType, or null.

getAttributesByType

public MMAX2Attribute[] getAttributesByType(int type1,
                                            int type2)
Description copied from interface: AnnotationSchemeAPI
(API) Returns an array of all MMAX2Attribute objects of either type attributeType1 or attributeType2.

Specified by:
getAttributesByType in interface AnnotationSchemeAPI
Parameters:
type1 - The type of the MMAX2Attribute objects to return, as specified in the annotation scheme file, one of the values defined in AttributeAPI.
type2 - The type of the MMAX2Attribute objects to return, as specified in the annotation scheme file, one of the values defined in AttributeAPI.
Returns:
An array of MMAX2Attribute objects of type attributeType1 and attributeType2, or empty array.

getUniqueAttributeByType

public MMAX2Attribute getUniqueAttributeByType(int type1,
                                               int type2)
Description copied from interface: AnnotationSchemeAPI
(API) Returns the MMAX2Attribute object of either type attributeType1 or attributeType2.

Specified by:
getUniqueAttributeByType in interface AnnotationSchemeAPI
Parameters:
type1 - The type of the MMAX2Attribute object to return, as specified in the annotation scheme file, one of the values defined in AttributeAPI.
type2 - The type of the MMAX2Attribute object to return, as specified in the annotation scheme file, one of the values defined in AttributeAPI.
Returns:
A MMAX2Attribute object of type attributeType1 or attributeType2, or empty array.

getAttributesByName

public MMAX2Attribute[] getAttributesByName(java.lang.String nameRegExp)
Description copied from interface: AnnotationSchemeAPI
(API) Returns an array of all MMAX2Attribute objects of whose name matches the RegExp attributeNameRegExp.

Specified by:
getAttributesByName in interface AnnotationSchemeAPI
Parameters:
nameRegExp - A regular expression to match the name(s) of the MMAX2Attribute object(s) to return, as specified in the annotation scheme file.
Returns:
An array of MMAX2Attribute objects whose names match the RegExp attributeName, or empty array.

getUniqueAttributeByName

public MMAX2Attribute getUniqueAttributeByName(java.lang.String nameRegExp)
Description copied from interface: AnnotationSchemeAPI
(API) Returns the MMAX2Attribute object whose name matches the RegExp attributeNameRegExp.

Specified by:
getUniqueAttributeByName in interface AnnotationSchemeAPI
Parameters:
nameRegExp - A regular expression to match the name(s) of the MMAX2Attribute object(s) to return, as specified in the annotation scheme file.
Returns:
An array of MMAX2Attribute objects whose names match the RegExp attributeName, or empty array.

getAttributesByNameAndType

public MMAX2Attribute[] getAttributesByNameAndType(java.lang.String name,
                                                   int type)
Description copied from interface: AnnotationSchemeAPI
(API) Returns an array of all MMAX2Attribute objects of type attributeType whose name matches the RegExp attributeNameRegExp.

Specified by:
getAttributesByNameAndType in interface AnnotationSchemeAPI
Parameters:
name - A regular expression to match the name(s) of the MMAX2Attribute object(s) to return, as specified in the annotation scheme file.
type - The type of the MMAX2Attribute objects to return, as specified in the annotation scheme file, one of the values defined in AttributeAPI.
Returns:
An array of MMAX2Attribute objects of type attributeType whose name match attributeNameRegExp, or empty array.

getUniqueAttributeByNameAndType

public MMAX2Attribute getUniqueAttributeByNameAndType(java.lang.String name,
                                                      int type)
Description copied from interface: AnnotationSchemeAPI
(API) Returns the MMAX2Attribute object of type attributeType whose name matches the RegExp attributeNameRegExp.

Specified by:
getUniqueAttributeByNameAndType in interface AnnotationSchemeAPI
Parameters:
name - A regular expression to match the name of the MMAX2Attribute object to return, as specified in the annotation scheme file.
type - The type of the MMAX2Attribute object to return, as specified in the annotation scheme file, one of the values defined in AttributeAPI.
Returns:
A MMAX2Attribute object of type attributeType whose name match attributeNameRegExp, or empty array.

getAttributesByNameAndType

public MMAX2Attribute[] getAttributesByNameAndType(java.lang.String name,
                                                   int type1,
                                                   int type2)
Description copied from interface: AnnotationSchemeAPI
(API) Returns an array of all MMAX2Attribute objects of type attributeType1 or attributeType2 whose name matches the RegExp attributeNameRegExp.

Specified by:
getAttributesByNameAndType in interface AnnotationSchemeAPI
Parameters:
name - A regular expression to match the name(s) of the MMAX2Attribute object(s) to return, as specified in the annotation scheme file.
type1 - The type of the MMAX2Attribute objects to return, as specified in the annotation scheme file, one of the values defined in AttributeAPI.
type2 - The type of the MMAX2Attribute objects to return, as specified in the annotation scheme file, one of the values defined in AttributeAPI.
Returns:
An array of MMAX2Attribute objects of type attributeType1 or attributeType2 whose name match attributeNameRegExp, or empty array.

getUniqueAttributeByNameAndType

public MMAX2Attribute getUniqueAttributeByNameAndType(java.lang.String name,
                                                      int type1,
                                                      int type2)
Description copied from interface: AnnotationSchemeAPI
(API) Returns a MMAX2Attribute object of type attributeType1 or attributeType2 whose name matches the RegExp attributeNameRegExp.

Specified by:
getUniqueAttributeByNameAndType in interface AnnotationSchemeAPI
Parameters:
name - A regular expression to match the name of the MMAX2Attribute object to return, as specified in the annotation scheme file.
type1 - The type of the MMAX2Attribute object to return, as specified in the annotation scheme file, one of the values defined in AttributeAPI.
type2 - The type of the MMAX2Attribute object to return, as specified in the annotation scheme file, one of the values defined in AttributeAPI.
Returns:
A MMAX2Attribute objects of type attributeType1 or attributeType2 whose name match attributeNameRegExp, or empty array.

setMMAX2

public final void setMMAX2(MMAX2 _mmax2)

getIndependentAttributes

public final java.util.ArrayList getIndependentAttributes(boolean enable)
This method produces an ArrayList of those MMAX2Attributes in annotation scheme order that do not depend on any other attribute. Independence is determined by checking if the attributes's dependsOn list is empty.


getAttributePanel

public MMAX2AttributePanel getAttributePanel()

valueChanged

public void valueChanged(MMAX2Attribute callingAttribute,
                         MMAX2Attribute topCallingAttribute,
                         MMAX2Attribute[] oldRemovedAttributes,
                         int position,
                         java.util.ArrayList requestedAttributesAsList)
This method is called from the mmaxattribute callingAttribute when the user changed some value on it by clicking a button or changing the selection in a listbox. This method also calls itself recursively.


mapSelections

public void mapSelections(MMAX2Attribute[] removedLevels,
                          MMAX2Attribute[] requestedLevels)
This method transfers those selections in removedLevels that are valid for requestedLevels to the latter. If a requestedLevel cannot be set according to a removedLevel, it is set to default. // wrong: This method will not alter attributes of type MARAKABLE_SET! New: removed levels of type MARKABLE_POINTER and MARKABLE_SET are now correctly mapped / removed The two parameter arrays may contain references to the same objects !


addValueIDToAttributeIDMapping

public void addValueIDToAttributeIDMapping(java.lang.String valueID,
                                           java.lang.String attributeID)

resetAllAttributes

public void resetAllAttributes()

reset

public void reset()
This method resets the AttributeWindow to the initial state as defined in this AnnotationScheme


setEnabled

public void setEnabled(boolean status)

getInitialAttributes

public java.util.ArrayList getInitialAttributes()
This method is used to create the list of attributes to be applied to new markables. It also supplies the attributes to be displayed in the attribute panel if no markable is selected. It returns the list of independent attributes with default values, expanded to also contain all dependent attributes.


getAttributes

public MMAX2Attribute[] getAttributes(Markable markable)
This method returns an array of MMAX2Attribute objects reflecting the attributes of Markable markable. If Markable does not have any attributes, or an error occured, only independent Attributes with default values are returned. This method handles branching independent attributes as well, and sets all defaults! This method is the central instance for enforcing annotation scheme constraints!


isDefined

public boolean isDefined(java.lang.String attributename)

getAttributeTypeByAttributeName

public int getAttributeTypeByAttributeName(java.lang.String attribute)

getAllAttributeNames

public java.util.ArrayList getAllAttributeNames()

getAllDistinctDisplayAttributeNames_

public java.util.ArrayList getAllDistinctDisplayAttributeNames_()
This method returns an ArrayList of all distinct DisplayAttributeNames (cased!), irrespective of their SchemeLevels.


getCurrentAttributePanel

public final MMAX2AttributePanel getCurrentAttributePanel()

getSize

public final int getSize()

getAttributes

public final java.util.ArrayList getAttributes()

getAttributeByID

public final MMAX2Attribute getAttributeByID(java.lang.String id)
Description copied from interface: AnnotationSchemeAPI
(API) Returns the MMAX2Attribute object with ID attributeID, as defined in annotation scheme file.

Specified by:
getAttributeByID in interface AnnotationSchemeAPI
Parameters:
id - The ID of the MMAX2Attribute object to return.
Returns:
The MMAX2Attribute object with ID attributeID, or null.

getAttributeNamesByType

public final java.lang.String[] getAttributeNamesByType(int type)

getAttributeNamesForValues

public final java.util.ArrayList getAttributeNamesForValues(java.lang.String valueList,
                                                            java.lang.String optionalAttributeName)
This method returns a list of attribute names for which *all* the values in valueList are defined, or empty list. valueList is a comma-separated list of values, and the entire list is enclosed in curly braces. optionalAttributeName is either empty or the name of the attribute for which the values are required to be defined. This method does not return freetext attributes except for the one given in optionalAttributeName. If the name of an attribute was passed in, and if this attribute is of type freetext it will be contained in the result list, with a * prepended to its name.


destroyDependentComponents

public final void destroyDependentComponents()