Unified Typesetting API M1-20040817

de.inghuimische.uta.test
Class SimpleItem

java.lang.Object
  extended byde.inghuimische.uta.AbstractItem
      extended byde.inghuimische.uta.test.SimpleItem
All Implemented Interfaces:
Item

public class SimpleItem
extends AbstractItem

A simple implementation of the item interface with no support for multiple widths or item position. Implementations using this class can therefore not claim to support Feature.MULTIPLE_WIDTHS or Feature.ITEM_POSITION.

This item allows to associate text in form of a string with it (for debugging).

Author:
Christian Ziesemer

Field Summary
 
Fields inherited from interface de.inghuimische.uta.Item
DENSITY_END, DENSITY_START, POSTBREAK, PREBREAK, STANDALONE, SURROUNDED
 
Constructor Summary
SimpleItem(Width aWidth, String aText)
          Constructs a new item with given width and text.
 
Method Summary
 void addJustifiable(Justifiable aJustifable)
          Adds a justifiable to the item.
 List getBoxes()
          Returns a list of boxes contained in this item.
 double getBreakPenalty()
          Always returns 0.
 int getPosition()
          Returns the position of the item within the line.
 String getText()
          Returns the text associated with this item.
 Width getWidth(int itemPos)
          Returns the width of the item, the item position is not honored.
 List setPosition(int finalPosition)
          Sets the final position of the item and returns a list of Justifiables contained in this item.
 
Methods inherited from class de.inghuimische.uta.AbstractItem
getInnerEmbeddingLevels, getOpticalDensity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleItem

public SimpleItem(Width aWidth,
                  String aText)
Constructs a new item with given width and text. The text is thought for debugging purposes only.

Parameters:
aWidth - The width of the item.
aText - The text associated with this item.
Method Detail

getWidth

public Width getWidth(int itemPos)
Returns the width of the item, the item position is not honored.

Parameters:
itemPos - This parameter is ignored by this implementation.
Returns:
The width of the item, the position is not honored.
See Also:
Item.STANDALONE, Item.PREBREAK, Item.POSTBREAK, Item.SURROUNDED

getBreakPenalty

public double getBreakPenalty()
Always returns 0.

Returns:
Always 0.

getText

public String getText()
Returns the text associated with this item.

Returns:
The text associated with this item.

addJustifiable

public void addJustifiable(Justifiable aJustifable)
Adds a justifiable to the item.

Parameters:
aJustifable - The justifiable to add.

setPosition

public List setPosition(int finalPosition)
Description copied from interface: Item
Sets the final position of the item and returns a list of Justifiables contained in this item. This method has to be called after the optimal line breaks are calculated and when justification has to take place.

Returns:
A list of Justifiables contained in this item.

getBoxes

public List getBoxes()
Description copied from interface: Item
Returns a list of boxes contained in this item.

Returns:
A list of boxes contained in this item.

getPosition

public int getPosition()
Description copied from interface: Item
Returns the position of the item within the line.

Returns:
The position of the item within the line.

Unified Typesetting API M1-20040817


An inghuimische.de project.
Copyright (C) 2004 Christian Ziesemer; See the Mozilla Public License for more details.