net.sourceforge.nite.gui.transcriptionviewer
Class StringInsertDisplayStrategy

java.lang.Object
  extended by net.sourceforge.nite.gui.transcriptionviewer.AbstractDisplayStrategy
      extended by net.sourceforge.nite.gui.transcriptionviewer.StringInsertDisplayStrategy
All Implemented Interfaces:
DisplayStrategy

public class StringInsertDisplayStrategy
extends AbstractDisplayStrategy

This DisplayStrategy implementation shows annotation elements in the transcription text by inserting text before the first and/or after the last NTextElement that is related to the annotation element.

The prefix and postfix strings can be customized. The actual strings for pre and postfix are determined in the utility methods formStartString(NOMElement element) and formEndString(NOMElement element). This makes it easy to extend this class with more specific visualization in a public subclass or an inner class.

The style of these strings can also be customized. The style may be dependent on the annotation element. This is achieved by overriding the method getStyle(NOMElement element).

See also DisplayStrategy See also NTranscriptionView.setDisplayStrategy

EXAMPLES!!!

Author:
Dennis Reidsma, Natasa Jovanovic, Dennis Hofs

Field Summary
static java.lang.String BRACKET_STYLE
          Documentation !!!
 
Constructor Summary
StringInsertDisplayStrategy(NTranscriptionView ntv)
          Default behaviour of this class: display annotation elements by placing relevant text between brackets (...), which are coloured red.
StringInsertDisplayStrategy(NTranscriptionView ntv, javax.swing.text.Style newStyle)
          Default behaviour of this class: display annotation elements by placing relevant text between brackets (...), which get the given style.
 
Method Summary
 boolean display(NOMElement element)
          The display method of this class consists of tracking down the relevant NTextElements in the NTranscriptionView, placing the prefix just before the first displayed transcription element and placing the postfix just after the last displayed transcription element.
 void setEndString(java.lang.String newEndString)
          Changes the value of the postfix string
 void setStartString(java.lang.String newStartString)
          Changes the value of the prefix string
 void undisplay(NOMElement element)
          This method is used to undisplay the annotation element.
 
Methods inherited from class net.sourceforge.nite.gui.transcriptionviewer.AbstractDisplayStrategy
init, setTransToAnnoMap
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BRACKET_STYLE

public static final java.lang.String BRACKET_STYLE
Documentation !!!

See Also:
Constant Field Values
Constructor Detail

StringInsertDisplayStrategy

public StringInsertDisplayStrategy(NTranscriptionView ntv)
Default behaviour of this class: display annotation elements by placing relevant text between brackets (...), which are coloured red.


StringInsertDisplayStrategy

public StringInsertDisplayStrategy(NTranscriptionView ntv,
                                   javax.swing.text.Style newStyle)
Default behaviour of this class: display annotation elements by placing relevant text between brackets (...), which get the given style.

Method Detail

setStartString

public void setStartString(java.lang.String newStartString)
Changes the value of the prefix string


setEndString

public void setEndString(java.lang.String newEndString)
Changes the value of the postfix string


display

public boolean display(NOMElement element)
The display method of this class consists of tracking down the relevant NTextElements in the NTranscriptionView, placing the prefix just before the first displayed transcription element and placing the postfix just after the last displayed transcription element.

The newly inserted NTextElements will have the annotation element as dataElement.

Returns:
true if displayed successful,

undisplay

public void undisplay(NOMElement element)
This method is used to undisplay the annotation element. Since the display was only creation of two strings that both have the annotation element as data element, removing them is easy...