net.sourceforge.nite.gui.transcriptionviewer
Class TextStyleDisplayStrategy

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

public class TextStyleDisplayStrategy
extends AbstractDisplayStrategy

This DisplayStrategy implementation shows annotation elements in the transcription text by changing the style (font, color, etc) of the text. You can set this style by calling one of the many-parameter-constructors or by creating a template style that is to be used as example.

Uses NTranscriptionView.insertCopyOfStyle and NTranscriptionView.removeStyleFromChain for maintaining the styles.

See also @link net.sourceforge.nite.gui.transcriptionviewer.DisplayStrategy DisplayStrategy See also @link net.sourceforge.nite.gui.transcriptionviewer.NTranscriptionView#setDisplayStrategy NTranscriptionView.setDisplayStrategy

Author:
Dennis Reidsma, Natasa Jovanovic, Dennis Hofs

Constructor Summary
TextStyleDisplayStrategy(NTranscriptionView ntv, int fontSize, java.lang.String fontStyle, java.awt.Color c, boolean isBackground)
          Initialize a TextStyleDisplayStrategy, creating a template style with the given parameters.
TextStyleDisplayStrategy(NTranscriptionView ntv, javax.swing.text.Style style)
          Initialize a TextStyleDisplayStrategy that uses the given template style for display.
 
Method Summary
 boolean display(NOMElement element)
          Display annotation element by changing the text style of all text for all relevant transcription elements.
 void undisplay(NOMElement element)
          Undisplay annotation elements by removing the relevant styles from the style chain for the appropriate transcription elements.
 
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
 

Constructor Detail

TextStyleDisplayStrategy

public TextStyleDisplayStrategy(NTranscriptionView ntv,
                                javax.swing.text.Style style)
Initialize a TextStyleDisplayStrategy that uses the given template style for display.


TextStyleDisplayStrategy

public TextStyleDisplayStrategy(NTranscriptionView ntv,
                                int fontSize,
                                java.lang.String fontStyle,
                                java.awt.Color c,
                                boolean isBackground)
Initialize a TextStyleDisplayStrategy, creating a template style with the given parameters.

Parameters:
fontSize - (if fontSize==0 font size is unchanged )
fontStyle - "italic","bold","underline" (if fontStyle==null fontStyle is to be unchanged
c - (if Color==null -> unchanged)
isBackground - Determines if colour is foreground or background colour (if color==null, isBackround is set to false)
Method Detail

display

public boolean display(NOMElement element)
Display annotation element by changing the text style of all text for all relevant transcription elements.

Returns:
true if displayed successfully, i.e. if the text to which given element relates was actually visible in the NTranscriptionView.

undisplay

public void undisplay(NOMElement element)
Undisplay annotation elements by removing the relevant styles from the style chain for the appropriate transcription elements.