Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.elexis.text.model
Class SSDRange

java.lang.Object
  extended by ch.rgw.tools.GenericRange
      extended by ch.elexis.text.model.SSDRange

public class SSDRange
extends GenericRange

An SSDRange is some part of a SimpleStructuredDocument (SSD). It has a position and a length within the text. Optionally, it can be placed outside the text flow. In that case, it must provide a viewport position relative to the character indicated by position. The contents of the Range is totally implementation specific. It might be some text or some graphics or both. Whenever the framework loads or saves an SSD, it converts SSDRanges to or creates SSDRanges from XML transparently. There are built-in types of SSDRanges for markup purposes: Bold, italic, underline, foreground and background colors. A bundle that wishes to handle other types of SSDRanges, must add its correctly formed SSDRanges to the SSD (with SimpleStructuredDocument#addRange()) and implement an IRangeHandler to be able to display the contents and to react on user interactions. If the SSD needs to display or "execute" am SSDRange it will follow this algorithm to find code to display or execute the Range:

  1. check wether a ProviderID ist given to tghe Range. If so:
    1. check wether this provider is loaded or can be loaded from extenson points
    2. If yes, ask the provider to display or execute the Range. If No, go to (2) below.
  2. check wether a Provider exists for the typename of the Range. If yes, ask this provider to display or execute the Range.
  3. If no Provider was found, display the "hint" attribute at the given location. If no "hint" attribute is given, display the caption as plaintext. If no caption is given, don't do anything.

Author:
gerry
See Also:
SimpleStructuredDocument, IRangeHandler

Field Summary
static java.lang.String ATTR_VIEWPORT
          Some range types are displayed off the text flow.
 java.lang.String compat_name
          Backward compatibility to make an SSDRange convertable to an XREF
static java.lang.String ELEM_NAME
           
static java.lang.String STYLE_BACKGROUND
           
static java.lang.String STYLE_BOLD
           
static java.lang.String STYLE_FOREGROUND
           
static java.lang.String STYLE_ITALIC
           
static java.lang.String STYLE_UNDERLINE
           
static java.lang.String TYPE_MARKUP
           
 
Fields inherited from class ch.rgw.tools.GenericRange
IS_AFTER_OTHER, IS_AT_BEGIN_OF_OTHER, IS_AT_END_OF_OTHER, IS_BEFORE_OTHER, IS_INSIDE_OTHER, IS_OVER_OTHER, IS_ZERO_LENGTH
 
Constructor Summary
SSDRange(Element el)
           
SSDRange(int start, int len, java.lang.String typename, java.lang.String id)
           
 
Method Summary
 java.lang.String getCaption()
           
 java.lang.String getContents()
           
 java.lang.Object getData()
          return user defined fata
 IRangeHandler getHandler()
          Find a handler for an SSDRange.
static java.util.Collection<IRangeHandler> getHandlers()
           
 java.lang.String getHint()
           
 java.lang.String getID()
           
 java.lang.String getProvider()
           
 java.lang.String getType()
           
 Rectangle getViewPort()
           
 boolean isbLocked()
           
 boolean isLocked()
           
 void setbLocked(boolean bLocked)
           
 void setCaption(java.lang.String c)
           
 void setContents(java.lang.String c)
           
 void setData(java.lang.Object data)
          Link some user defined data to the object
 void setHint(java.lang.String hint)
           
 void setID(java.lang.String id)
           
 void setProvider(java.lang.String provider)
           
 void setType(java.lang.String tn)
           
 void setViewPort(Rectangle r)
           
 Element toElement()
           
 
Methods inherited from class ch.rgw.tools.GenericRange
getEnd, getLength, getPos, overlap, positionTo, setEnd, setLen, setPos
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_MARKUP

public static final java.lang.String TYPE_MARKUP
See Also:
Constant Field Values

ELEM_NAME

public static final java.lang.String ELEM_NAME
See Also:
Constant Field Values

ATTR_VIEWPORT

public static final java.lang.String ATTR_VIEWPORT
Some range types are displayed off the text flow. This is a hint in wich region of the screen to display

See Also:
Constant Field Values

STYLE_BOLD

public static final java.lang.String STYLE_BOLD
See Also:
Constant Field Values

STYLE_ITALIC

public static final java.lang.String STYLE_ITALIC
See Also:
Constant Field Values

STYLE_UNDERLINE

public static final java.lang.String STYLE_UNDERLINE
See Also:
Constant Field Values

STYLE_FOREGROUND

public static final java.lang.String STYLE_FOREGROUND
See Also:
Constant Field Values

STYLE_BACKGROUND

public static final java.lang.String STYLE_BACKGROUND
See Also:
Constant Field Values

compat_name

public java.lang.String compat_name
Backward compatibility to make an SSDRange convertable to an XREF

Constructor Detail

SSDRange

public SSDRange(Element el)

SSDRange

public SSDRange(int start,
                int len,
                java.lang.String typename,
                java.lang.String id)
Method Detail

setCaption

public void setCaption(java.lang.String c)

getCaption

public java.lang.String getCaption()

isbLocked

public boolean isbLocked()

setbLocked

public void setbLocked(boolean bLocked)

getProvider

public java.lang.String getProvider()

setProvider

public void setProvider(java.lang.String provider)

isLocked

public boolean isLocked()

getType

public java.lang.String getType()

setType

public void setType(java.lang.String tn)

getID

public java.lang.String getID()

setID

public void setID(java.lang.String id)

getViewPort

public Rectangle getViewPort()

setViewPort

public void setViewPort(Rectangle r)

getHint

public java.lang.String getHint()

setHint

public void setHint(java.lang.String hint)

getContents

public java.lang.String getContents()

setContents

public void setContents(java.lang.String c)

toElement

public Element toElement()

setData

public void setData(java.lang.Object data)
Link some user defined data to the object

Parameters:
data -

getData

public java.lang.Object getData()
return user defined fata

Returns:
data as perviously set by setData()

getHandler

public IRangeHandler getHandler()
Find a handler for an SSDRange. If a provider-ID is given, the provider will be searched, else a handler for the type of the range.

Parameters:
r - the Range
Returns:
a handler or null

getHandlers

public static java.util.Collection<IRangeHandler> getHandlers()

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis