org.apache.pivot.wtk.skin
Class TextPaneSkinElementView

java.lang.Object
  extended by org.apache.pivot.wtk.skin.TextPaneSkinNodeView
      extended by org.apache.pivot.wtk.skin.TextPaneSkinElementView
All Implemented Interfaces:
Iterable<TextPaneSkinNodeView>, Sequence<TextPaneSkinNodeView>, ElementListener, NodeListener
Direct Known Subclasses:
TextPaneSkinBlockView, TextPaneSkinSpanView, TextPaneSkinVerticalElementView

abstract class TextPaneSkinElementView
extends TextPaneSkinNodeView
implements Sequence<TextPaneSkinNodeView>, Iterable<TextPaneSkinNodeView>, ElementListener

Abstract base class for element views.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
Sequence.Tree<T>
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.text.ElementListener
ElementListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.text.NodeListener
NodeListener.Adapter
 
Constructor Summary
TextPaneSkinElementView(Element element)
           
 
Method Summary
 int add(TextPaneSkinNodeView nodeView)
          Adds an item to the sequence.
protected  void attach()
           
 void backgroundColorChanged(Element element, Color previousBackgroundColor)
          Called when the background color has changed.
protected  void detach()
           
 void fontChanged(Element element, Font previousFont)
          Called when the font has changed.
 void foregroundColorChanged(Element element, Color previousForegroundColor)
          Called when the foreground color has changed.
 TextPaneSkinNodeView get(int index)
          Retrieves the item at the given index.
 int getBaseline()
           
 Bounds getCharacterBounds(int offset)
           
 int getLength()
          Returns the length of the sequence.
 int indexOf(TextPaneSkinNodeView nodeView)
          Returns the index of an item in the sequence.
 void insert(TextPaneSkinNodeView nodeView, int index)
          Inserts an item into the sequence at a specific index.
 void invalidateDownTree()
           
 Iterator<TextPaneSkinNodeView> iterator()
           
 void nodeInserted(Element element, int index)
          Called when a node has been inserted into an element.
 void nodesRemoved(Element element, int index, Sequence<Node> nodes)
          Called when nodes have been removed from an element.
 void paint(Graphics2D graphics)
           
protected  void paintChild(Graphics2D graphics, Bounds paintBounds, TextPaneSkinNodeView nodeView)
           
 Sequence<TextPaneSkinNodeView> remove(int index, int count)
          Removes one or more items from the sequence.
 int remove(TextPaneSkinNodeView nodeView)
          Removes the first occurrence of the given item from the sequence.
protected  void setSkinLocation(int skinX, int skinY)
          Set location of the NodeView relative to the skin component.
 void strikethroughChanged(Element element)
          Called when strikethrough style has changed.
 void underlineChanged(Element element)
          Called when underline style has changed.
 TextPaneSkinNodeView update(int index, TextPaneSkinNodeView nodeView)
          Updates the item at the given index.
 
Methods inherited from class org.apache.pivot.wtk.skin.TextPaneSkinNodeView
childLayout, getBounds, getCharacterCount, getDocumentOffset, getHeight, getInsertionPoint, getLocation, getNextInsertionPoint, getNode, getOffset, getParent, getPreferredSize, getRowAt, getRowCount, getSize, getTextPaneSkin, getWidth, getX, getY, invalidateUpTree, isValid, layout, nodeInserted, nodesRemoved, offsetChanged, parentChanged, rangeInserted, rangeRemoved, repaint, repaint, setLocation, setParent, setSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextPaneSkinElementView

public TextPaneSkinElementView(Element element)
Method Detail

attach

protected void attach()
Overrides:
attach in class TextPaneSkinNodeView

detach

protected void detach()
Overrides:
detach in class TextPaneSkinNodeView

invalidateDownTree

public void invalidateDownTree()
Overrides:
invalidateDownTree in class TextPaneSkinNodeView

add

public int add(TextPaneSkinNodeView nodeView)
Description copied from interface: Sequence
Adds an item to the sequence.

Specified by:
add in interface Sequence<TextPaneSkinNodeView>
Parameters:
nodeView - The item to be added to the sequence.
Returns:
The index at which the item was added, or -1 if the item was not added to the sequence.

insert

public void insert(TextPaneSkinNodeView nodeView,
                   int index)
Description copied from interface: Sequence
Inserts an item into the sequence at a specific index.

Specified by:
insert in interface Sequence<TextPaneSkinNodeView>
Parameters:
nodeView - The item to be added to the sequence.
index - The index at which the item should be inserted. Must be a value between 0 and getLength().

update

public TextPaneSkinNodeView update(int index,
                                   TextPaneSkinNodeView nodeView)
Description copied from interface: Sequence
Updates the item at the given index.

Specified by:
update in interface Sequence<TextPaneSkinNodeView>
Parameters:
index - The index of the item to update.
nodeView - The item that will replace any existing value at the given index.
Returns:
The item that was previously stored at the given index.

remove

public int remove(TextPaneSkinNodeView nodeView)
Description copied from interface: Sequence
Removes the first occurrence of the given item from the sequence.

Specified by:
remove in interface Sequence<TextPaneSkinNodeView>
Parameters:
nodeView - The item to remove.
Returns:
The index of the item that was removed, or -1 if the item could not be found.
See Also:
Sequence.remove(int, int)

remove

public Sequence<TextPaneSkinNodeView> remove(int index,
                                             int count)
Description copied from interface: Sequence
Removes one or more items from the sequence.

Specified by:
remove in interface Sequence<TextPaneSkinNodeView>
Parameters:
index - The starting index to remove.
count - The number of items to remove, beginning with index.
Returns:
A sequence containing the items that were removed.

get

public TextPaneSkinNodeView get(int index)
Description copied from interface: Sequence
Retrieves the item at the given index.

Specified by:
get in interface Sequence<TextPaneSkinNodeView>
Parameters:
index - The index of the item to retrieve.

indexOf

public int indexOf(TextPaneSkinNodeView nodeView)
Description copied from interface: Sequence
Returns the index of an item in the sequence.

Specified by:
indexOf in interface Sequence<TextPaneSkinNodeView>
Parameters:
nodeView - The item to locate.
Returns:
The index of first occurrence of the item if it exists in the sequence; -1, otherwise.

getLength

public int getLength()
Description copied from interface: Sequence
Returns the length of the sequence.

Specified by:
getLength in interface Sequence<TextPaneSkinNodeView>
Returns:
The number of items in the sequence.

getBaseline

public int getBaseline()
Specified by:
getBaseline in class TextPaneSkinNodeView

setSkinLocation

protected void setSkinLocation(int skinX,
                               int skinY)
Description copied from class: TextPaneSkinNodeView
Set location of the NodeView relative to the skin component. This is needed by the ComponentViewNode to correctly position child Component's.

Specified by:
setSkinLocation in class TextPaneSkinNodeView
Parameters:
skinX - the X coordinate in the skin's frame of reference
skinY - the Y coordinate in the skin's frame of reference

paint

public void paint(Graphics2D graphics)
Specified by:
paint in class TextPaneSkinNodeView

paintChild

protected final void paintChild(Graphics2D graphics,
                                Bounds paintBounds,
                                TextPaneSkinNodeView nodeView)

getCharacterBounds

public Bounds getCharacterBounds(int offset)
Specified by:
getCharacterBounds in class TextPaneSkinNodeView

nodeInserted

public void nodeInserted(Element element,
                         int index)
Description copied from interface: ElementListener
Called when a node has been inserted into an element.

Specified by:
nodeInserted in interface ElementListener

nodesRemoved

public void nodesRemoved(Element element,
                         int index,
                         Sequence<Node> nodes)
Description copied from interface: ElementListener
Called when nodes have been removed from an element.

Specified by:
nodesRemoved in interface ElementListener

fontChanged

public void fontChanged(Element element,
                        Font previousFont)
Description copied from interface: ElementListener
Called when the font has changed.

Specified by:
fontChanged in interface ElementListener

backgroundColorChanged

public void backgroundColorChanged(Element element,
                                   Color previousBackgroundColor)
Description copied from interface: ElementListener
Called when the background color has changed.

Specified by:
backgroundColorChanged in interface ElementListener

foregroundColorChanged

public void foregroundColorChanged(Element element,
                                   Color previousForegroundColor)
Description copied from interface: ElementListener
Called when the foreground color has changed.

Specified by:
foregroundColorChanged in interface ElementListener

underlineChanged

public void underlineChanged(Element element)
Description copied from interface: ElementListener
Called when underline style has changed.

Specified by:
underlineChanged in interface ElementListener

strikethroughChanged

public void strikethroughChanged(Element element)
Description copied from interface: ElementListener
Called when strikethrough style has changed.

Specified by:
strikethroughChanged in interface ElementListener

iterator

public Iterator<TextPaneSkinNodeView> iterator()
Specified by:
iterator in interface Iterable<TextPaneSkinNodeView>