net.sourceforge.jeuclid.elements.support
Class ElementListSupport

java.lang.Object
  extended by net.sourceforge.jeuclid.elements.support.ElementListSupport

public final class ElementListSupport
extends Object

Class to support Lists of MathElements.

This class can be used by all elements that have some kinf of a list of children that they need to handle in a row-like manner.

Version:
$Revision: 310 $
Author:
Max Berger

Method Summary
static List<JEuclidElement> createListOfChildren(Node parent)
          Creates a list of children for the given MathElement.
static void fireChangeForSubTree(List<JEuclidElement> elements)
          Calls ChangeTrackingInterface.fireChangeForSubTree() on all the given elements.
static float getAscentHeight(Graphics2D g, List<JEuclidElement> elements)
          Retrieve the maximum ascent height of the list.
static float getDescentHeight(Graphics2D g, List<JEuclidElement> elements)
          Retrieve the maximum descent height of the list.
static float getHeight(Graphics2D g, List<JEuclidElement> elements)
          Retrieve the total height of the list.
static float getWidth(Graphics2D g, List<JEuclidElement> elements)
          Retrieve the total witdth of the list.
static void paint(Graphics2D g, float posX, float posY, List<JEuclidElement> elements)
          Paint all elements in a row-like fashion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createListOfChildren

public static List<JEuclidElement> createListOfChildren(Node parent)
Creates a list of children for the given MathElement.

Parameters:
parent - the parent element.
Returns:
list of Children.

getAscentHeight

public static float getAscentHeight(Graphics2D g,
                                    List<JEuclidElement> elements)
Retrieve the maximum ascent height of the list.

Parameters:
g - Graphics2D context to use.
elements - List of elements.
Returns:
the max ascent height.

getDescentHeight

public static float getDescentHeight(Graphics2D g,
                                     List<JEuclidElement> elements)
Retrieve the maximum descent height of the list.

Parameters:
g - Graphics2D context to use.
elements - List of elements.
Returns:
the max descent height.

getHeight

public static float getHeight(Graphics2D g,
                              List<JEuclidElement> elements)
Retrieve the total height of the list.

Parameters:
g - Graphics2D context to use.
elements - List of elements.
Returns:
thetotal height.

getWidth

public static float getWidth(Graphics2D g,
                             List<JEuclidElement> elements)
Retrieve the total witdth of the list.

Parameters:
g - Graphics2D context to use.
elements - List of elements.
Returns:
the total width.

paint

public static void paint(Graphics2D g,
                         float posX,
                         float posY,
                         List<JEuclidElement> elements)
Paint all elements in a row-like fashion.

Parameters:
g - Graphics2D context to use.
elements - List of elements.
posX - x-origin to use for painting.
posY - y-origin to use for painting.

fireChangeForSubTree

public static void fireChangeForSubTree(List<JEuclidElement> elements)
Calls ChangeTrackingInterface.fireChangeForSubTree() on all the given elements.

Parameters:
elements - a list of elements to fire the change on.


Copyright © 2002-2008 The JEuclid project. All Rights Reserved.