net.sourceforge.nite.gui.util
Class AmigramConfig

java.lang.Object
  extended by net.sourceforge.nite.gui.util.AbstractCallableToolConfig
      extended by net.sourceforge.nite.gui.util.AmigramConfig

public class AmigramConfig
extends AbstractCallableToolConfig

This class contains settings for the AMIGram tool. See also superclass and NXTConfig class. The root name of the AMIGram configuration element is "AMIGramConfig".


Field Summary
static int ATTRIBUTE
           
static int DELEGATE
           
static int TEXT
           
 
Method Summary
 java.lang.String applyFilter(NOMElement nel)
          Return the String to be displayed for the NOM element
 java.lang.String defaultDelegateName()
          Return a String representing th ename of a delegate class: the value of the defaultfilterdelegateclass attribute of the corpussettings element.
 java.lang.String defaultFilterAttributeName()
          Return the name of the attribute AMIGram should use as the default presentation attribute.
 java.lang.String defaultFilterDelegateClass()
          Return the name of the attribute AMIGram should use as the default presentation attribute.
 int defaultFilterType()
          Return the constant TEXT if all elements should default to presenting their text content; ATTRIBUTE if an attribute should be used; or DELEGATE if a delegate class is teh default behaviour.
 boolean defaultToText()
          Return "true" if all elements should default to presenting their text content in AMIGram and "false" otherwise.
 java.lang.String getAttributeValue(org.w3c.dom.Node node, java.lang.String attrName)
          Returns the value of an attribute of the specified node.
 org.w3c.dom.Node getFilter(java.lang.String elementname)
          Returns the filter element for the specified element name.
 java.lang.String getFilterAttributeName(org.w3c.dom.Node filter)
          Returns the filter attribute name of the filter element.
 java.lang.String getFilterAttributeName(java.lang.String elementname)
          Returns the filter attribute name for the given element name.
 TranscriptionToTextDelegate getFilterDelegate()
          Default: new instance of class defined in transcriptiondelegateclassname attribute in corpussettings
 java.lang.String getFilterElementName(org.w3c.dom.Node filter)
          Returns the element name of the specified filter element.
 java.util.List getFilterList()
          Returns a list with all filter elements (Node objects) for the current corpus.
 int getFilterType(org.w3c.dom.Node filter)
          Return the constant TEXT if the given element name should present their text content in AMIGram, or ATTRIBUTE if an attribute should be used.
 int getFilterType(java.lang.String elementname)
          Return the constant TEXT if the given element name should present their text content in AMIGram; ATTRIBUTE if an attribute should be used, and DELEGATE if we should pass the node to a delegate class.
static AmigramConfig getInstance()
          Returns the singleton AMIGram configuration object.
 java.lang.String getNXTConfigRootName()
          Returns the root name of the Amigram configuration element.
 
Methods inherited from class net.sourceforge.nite.gui.util.AbstractCallableToolConfig
clearCachedValues, getAllowAnnotationSelect, getAllowMultiAgentSelect, getAllowTranscriptSelect, getApplicationName, getDisplayedAnnotationNames, getHelpSetName, getNXTConfig, getSegmentationElementName, getTranscriptionAttribute, getTranscriptionLayerName, getTranscriptionToTextDelegate, getWordlevelSelectionType, initDisplayedAnnotationNames, loadConfig, reloadConfig, setCorpusSettings, setGUISettings, setMetaDataFile, showLogWindows
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXT

public static final int TEXT
See Also:
Constant Field Values

ATTRIBUTE

public static final int ATTRIBUTE
See Also:
Constant Field Values

DELEGATE

public static final int DELEGATE
See Also:
Constant Field Values
Method Detail

getInstance

public static AmigramConfig getInstance()

Returns the singleton AMIGram configuration object. Don't forget to set the metadata file.

Returns:
the singleton AMIGram configuration object

getNXTConfigRootName

public java.lang.String getNXTConfigRootName()

Returns the root name of the Amigram configuration element.

Overrides:
getNXTConfigRootName in class AbstractCallableToolConfig
Returns:
the root name of the Amigram configuration element

getFilterList

public java.util.List getFilterList()

Returns a list with all filter elements (Node objects) for the current corpus.

Returns:
a list with filter elements

getAttributeValue

public java.lang.String getAttributeValue(org.w3c.dom.Node node,
                                          java.lang.String attrName)

Returns the value of an attribute of the specified node. If the node does not have the specified attribute, this method returns null.

Parameters:
node - the node that contains the attribute
attrName - the name of the attribute
Returns:
the attribute value or null

getFilter

public org.w3c.dom.Node getFilter(java.lang.String elementname)

Returns the filter element for the specified element name. The element name should be specified in the "elementname" attribute. If there is no such filter element, this method returns null.

Parameters:
elementname - the element name
Returns:
the filter element for the specified element or null

getFilterElementName

public java.lang.String getFilterElementName(org.w3c.dom.Node filter)

Returns the element name of the specified filter element. The elementname is specified in the "elementname" attribute.

Parameters:
filter - a filter element
Returns:
the element name of the specified filter element

getFilterType

public int getFilterType(java.lang.String elementname)
Return the constant TEXT if the given element name should present their text content in AMIGram; ATTRIBUTE if an attribute should be used, and DELEGATE if we should pass the node to a delegate class. This first checks for a specific filter for this element, then the default values, and finally defaults to TEXT if neither is present.

Parameters:
elementname - the element name
Returns:
the integer TEXT, ATTRIBUTE or DELEGATE

getFilterType

public int getFilterType(org.w3c.dom.Node filter)
Return the constant TEXT if the given element name should present their text content in AMIGram, or ATTRIBUTE if an attribute should be used. Note that DELEGATE is never returned by this method as if a delegate class is to be used, it should be defined in the defaultfilterdelegate class attribute of the corpussettings element. The filter type should be specified in the "filtertype" attribute and be either "attribute" or "text".

Parameters:
filter - a filter element
Returns:
the filter type of the filter element

getFilterAttributeName

public java.lang.String getFilterAttributeName(java.lang.String elementname)

Returns the filter attribute name for the given element name. If the element has its own filter node, we use that value, and otherwise the default. This method returns null if neither is present or if it's a TEXT or DELEGATE filter.

Parameters:
elementname - an element name
Returns:
the attribute name for the filter element, or null

getFilterAttributeName

public java.lang.String getFilterAttributeName(org.w3c.dom.Node filter)

Returns the filter attribute name of the filter element. The name should be specified in the "attname" attribute, but will only be present if the filter type is ATTRIBUTE rather than TEXT.

Parameters:
filter - a filter element
Returns:
the attribute name for the filter element

defaultToText

public boolean defaultToText()
Return "true" if all elements should default to presenting their text content in AMIGram and "false" otherwise. This default can be overridden by specific filters.

Returns:
"true" if AMIGram should default to text content as presentation mode.

getFilterDelegate

public TranscriptionToTextDelegate getFilterDelegate()
Default: new instance of class defined in transcriptiondelegateclassname attribute in corpussettings


defaultDelegateName

public java.lang.String defaultDelegateName()
Return a String representing th ename of a delegate class: the value of the defaultfilterdelegateclass attribute of the corpussettings element.

Returns:
the name of the default delegate class

defaultFilterType

public int defaultFilterType()
Return the constant TEXT if all elements should default to presenting their text content; ATTRIBUTE if an attribute should be used; or DELEGATE if a delegate class is teh default behaviour. This default can be overridden by specific filters. The default if nothing is declared should be TEXT.

Returns:
TEXT if AMIGram should default to text content as presentation mode and ATTRIBUTE if an attribute should be used or DELEGATE if a delegate class is the default handler.

defaultFilterAttributeName

public java.lang.String defaultFilterAttributeName()
Return the name of the attribute AMIGram should use as the default presentation attribute. This default can be null and can be overridden by specific filters.

Returns:
the default attribute AMIGram should use for display.

defaultFilterDelegateClass

public java.lang.String defaultFilterDelegateClass()
Return the name of the attribute AMIGram should use as the default presentation attribute. This default can be null and can be overridden by specific filters.

Returns:
the default attribute AMIGram should use for display.

applyFilter

public java.lang.String applyFilter(NOMElement nel)
Return the String to be displayed for the NOM element

Returns:
the String to be displayed for the NOMElement