com.tensegrity.graphics.text
Interface Element

All Known Implementing Classes:
AbstractElement

public interface Element

An Element represents a structural piece of a document. An Element implementation is self-enclosing, iterable and can be formatted. This interface also provides the basic implementation of such an Iterator (@see ElementIterator).

Version:
$Id: Element.java,v 1.4 2004/08/09 10:41:49 GillesIachelini Exp $
Author:
Gilles Iachelini

Nested Class Summary
static class Element.ElementIterator
          The iterator implementation for TextElements.
 
Method Summary
 void addElement(Element element)
          Method addElement adds an element to this Element.
 Element getElement(int index)
          Method getElement returns the Element at position index.
 int getElementCount()
          Method getElementCount returns the number of elements contained by this Element as integer.
 FontFormat getFontFormat()
          Method getFontFormat returns the FontFormat instance associated with this element.
 java.lang.String getHtmlText()
          Method getHtmlText returns this elements text as html.
 java.lang.String getText()
          Method getText returns the text associated with this Element as String.
 boolean isEmpty()
          Method isEmpty returns true, if this Element doesn't contain any TextElements.
 java.util.Iterator iterator()
          Method iterator returns an iterator which allows to iterate through all elements of this Element.
 void remove(int index)
          Method remove removes the element at position index.
 void setFontFormat(FontFormat fontFormat)
          Method setFontFormat sets the FontFormat of this element.
 void setText(java.lang.String text)
          Method setText sets the text for this Element.
 

Method Detail

addElement

public void addElement(Element element)
Method addElement adds an element to this Element.

Parameters:
element - the new Element to add.

getElement

public Element getElement(int index)
Method getElement returns the Element at position index. within this Element.

Parameters:
index - the index of the element.
Returns:
Element The Element at position index.

getElementCount

public int getElementCount()
Method getElementCount returns the number of elements contained by this Element as integer.

Returns:
int the number of Elements within this Element.

iterator

public java.util.Iterator iterator()
Method iterator returns an iterator which allows to iterate through all elements of this Element.

Returns:
Iterator a java.util based Iterator.

getFontFormat

public FontFormat getFontFormat()
Method getFontFormat returns the FontFormat instance associated with this element.

Returns:
FontFormat the FontFormat instance of this element.

getHtmlText

public java.lang.String getHtmlText()
Method getHtmlText returns this elements text as html.

Returns:
String the text of this element as html.

getText

public java.lang.String getText()
Method getText returns the text associated with this Element as String.

Returns:
String The text as String.

isEmpty

public boolean isEmpty()
Method isEmpty returns true, if this Element doesn't contain any TextElements. This method should be equal to
  return getElementCount() == 0;
 

Returns:
boolean true, if this Element is empty.

remove

public void remove(int index)
Method remove removes the element at position index.

Parameters:
index - the position of the element to remove.

setFontFormat

public void setFontFormat(FontFormat fontFormat)
Method setFontFormat sets the FontFormat of this element.

Parameters:
fontFormat - The FontFormat instance to be set.

setText

public void setText(java.lang.String text)
Method setText sets the text for this Element.

Parameters:
text - the text of this Element as String.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.