org.zaval.lw
Class LwWrappedText

java.lang.Object
  |
  +--org.zaval.util.ValidationObject
        |
        +--org.zaval.lw.LwView
              |
              +--org.zaval.lw.LwRender
                    |
                    +--org.zaval.lw.LwTextRender
                          |
                          +--org.zaval.lw.LwWrappedText
All Implemented Interfaces:
java.util.EventListener, TextListener, Validationable

public class LwWrappedText
extends LwTextRender

This is wrapped text render. The class inherits the LwTextRender functionality and allows to render text according the owner component size. It means if a text line size is greater than drawable area size than the render will try to break the line to several lines that can be placed completely. The render can be used as follow:

   ...
   LwWrappedText text  = new LwWrappedText("This is demo text that can be wrapped ...");
   LwLabel       label = new LwLabel (text);
   ...
 


Fields inherited from class org.zaval.lw.LwView
MOSAIC, ORIGINAL, STRETCH
 
Fields inherited from class org.zaval.util.ValidationObject
isValidFlag
 
Constructor Summary
LwWrappedText(java.lang.String t)
          Constructs the render with the specified target string.
LwWrappedText(TextModel t)
          Constructs the render with the specified target text model.
 
Method Summary
protected  void broke(java.lang.String s, int sw, int w, java.util.Vector v)
          Checks if the specified string with the specified width can be placed in an area with the given width and if it is necessary breaks the line to several.
 void invalidate()
          Invalidates the render.
 void paint(java.awt.Graphics g, int x, int y, int w, int h, Drawable d)
          Renders the text model using the specified graphics context, location, size and owner component.
 
Methods inherited from class org.zaval.lw.LwTextRender
calcPreferredSize, getAscent, getFont, getFontMetrics, getForeground, getLine, getLineHeight, getLineIndent, getText, getTextModel, invalidate, lineWidth, ownerChanged, paintLine, recalc, setFont, setForeground, stringWidth, substrWidth, targetWasChanged, textInserted, textRemoved, textUpdated
 
Methods inherited from class org.zaval.lw.LwRender
getTarget, setTarget
 
Methods inherited from class org.zaval.lw.LwView
getInsets, getPreferredSize, getType, paint, setType
 
Methods inherited from class org.zaval.util.ValidationObject
isValid, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LwWrappedText

public LwWrappedText(java.lang.String t)
Constructs the render with the specified target string.
Parameters:
t - the specified target string.

LwWrappedText

public LwWrappedText(TextModel t)
Constructs the render with the specified target text model.
Parameters:
t - the specified target text model.
Method Detail

invalidate

public void invalidate()
Description copied from class: LwTextRender
Invalidates the render. If the render has been registered as a view of a lightweight component than the owner component will be invalidated too.
Overrides:
invalidate in class LwTextRender

paint

public void paint(java.awt.Graphics g,
                  int x,
                  int y,
                  int w,
                  int h,
                  Drawable d)
Description copied from class: LwTextRender
Renders the text model using the specified graphics context, location, size and owner component.
Overrides:
paint in class LwTextRender
Following copied from class: org.zaval.lw.LwTextRender
Parameters:
g - the graphics context.
x - the x coordinate of the text location.
y - the y coordinate of the text location.
w - the specified width.
h - the specified height.
d - the specified owner component that uses the render.

broke

protected void broke(java.lang.String s,
                     int sw,
                     int w,
                     java.util.Vector v)
Checks if the specified string with the specified width can be placed in an area with the given width and if it is necessary breaks the line to several. The result is put to the specified vector.
Parameters:
s - the specified string.
sw - the specified string width.
w - the specified area width.
v - the splitting result.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org