|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.inet.html.views.layouts.Layout
public abstract class Layout
Generic Layout class. Holds the size, span and offset of a view. The offset is calculated relativ to the parent of this layout's view. NOTE: The layout only contains data, which may change on resize! Everything else is calculated only once and therefore bound to the model.
Nested Class Summary | |
---|---|
class |
Layout.PositionInfo
A simple dataholder to store position relevant data when layouting a view |
static class |
Layout.ViewPosition
View Positioning class |
Field Summary | |
---|---|
static int |
MARKER_OFFSET
the default distance between a list marker and the content |
Constructor Summary | |
---|---|
Layout(BoxView view)
Creates the layout and set the view, which should be layouted |
Method Summary | |
---|---|
void |
getChildAllocation(int i,
java.awt.Rectangle rect)
Stores the position of a child to rect . |
Layout.PositionInfo |
getChildPosition(BoxView childView)
Returns the layouted position information of a child of this layout |
java.util.List<Layout.PositionInfo> |
getChildren()
Returns the list of all children known to this layout object. |
int |
getCurrentHeight()
Returns the current height of the referenced view |
int |
getCurrentLeft()
Returns the current x position of the top left corner |
float |
getCurrentSpan(int axis)
This returns the size calculated for the current layout. |
int |
getCurrentTop()
Returns the current y position of the top left corner |
int |
getCurrentWidth()
Returns the current width of the referenced view |
int |
getMinimumHeight()
Get MinimumHeight set by preLayout |
float |
getMinimumSpan(int axis)
Returns the minimums span as calculated by the prelayout function |
int |
getMinimumWidth()
Get MinimumWidth set by preLayout |
int |
getPreferredHeight()
Get PreferredHeight set by preLayout |
float |
getPreferredSpan(int axis)
This returns the pre-calculated preferred width, which is the maximim width the content of this layout may need. |
int |
getPreferredWidth()
Get PreferredWidth set by preLayout |
abstract java.awt.Rectangle |
getSpan()
Returns the area affected by the current layout or any of it's siblings, relative the it's own left upper corner. |
BoxView |
getView()
Returns the view this layouter is responsible for |
int |
getViewCount()
Returns the number of child-views known to this layout object |
abstract ViewPositionInfo |
getViewForPosition(java.awt.Point position,
java.awt.Rectangle a)
Finds the view and it's location for a specific point of the screen |
boolean |
isPreLayouted()
Returns true, if the view this layout is responsible for, has the PRE attribute |
abstract java.awt.Rectangle |
layout(boolean hard)
This method will do the final layouting |
abstract void |
layoutVerticalAlign(int align,
int baselineOffset)
This method performs the vertical alignment of the whole content within the box. |
abstract void |
layoutWidth()
Set the width of the layouted component. |
abstract java.awt.Shape |
modelToView(int pos,
java.awt.Shape a,
javax.swing.text.Position.Bias b)
Tries to find the rectangle representing a given model-position. |
static void |
offsetRelative(Layout.ViewPosition info)
Applies the relative position offset to a view |
abstract void |
predictWidth(int width)
Can be used to force a view to a specified width. |
abstract void |
preLayout()
This method doe's the part of the layouting, which has to be called only once per website. |
static void |
replace(javax.swing.text.View oldView,
javax.swing.text.View[] newViews)
Replace the old view with a list of new views in the same container. |
void |
setCurrentHeight(int currentHeight)
Sets the current content height for this box |
void |
setCurrentWidth(int currentWidth)
Sets the current content width for this box |
void |
setPreLayouted()
Marks is layout as PRE |
java.lang.String |
toString()
|
static void |
union(java.awt.Rectangle union,
int x,
int y,
int width,
int height)
Creates a union of the two rects without the requirement for another rectangle object NOTE: the width of both rectangles must be positive! |
static void |
union(java.awt.Rectangle union,
java.awt.Rectangle join)
Creates a union of the two rects. |
abstract int |
viewToModel(float x,
float y,
java.awt.Shape a,
javax.swing.text.Position.Bias[] biasReturn)
Searches the view-tree for a specified point and returns the model-offset for this position. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MARKER_OFFSET
Constructor Detail |
---|
public Layout(BoxView view)
view
- the view, which should be layoutedMethod Detail |
---|
public float getCurrentSpan(int axis)
axis
- axis constant
public float getPreferredSpan(int axis)
axis
- the axis constant
public float getMinimumSpan(int axis)
axis
- the axis to get the size for
public abstract java.awt.Shape modelToView(int pos, java.awt.Shape a, javax.swing.text.Position.Bias b) throws javax.swing.text.BadLocationException
pos
- the model position to be founda
- the reference area for the search process, is supposed to be the surrounding rectangle of the current viewb
- the search direction, empty interface implementation, has no effect
null
javax.swing.text.BadLocationException
- will be thrown if pos
is outside the model's rangepublic abstract int viewToModel(float x, float y, java.awt.Shape a, javax.swing.text.Position.Bias[] biasReturn)
x
- root-relative X offset in pixely
- root-relative Y offset in pixela
- the bounds of the current viewbiasReturn
- the search direction, empty interface implementation, has no effect
public void getChildAllocation(int i, java.awt.Rectangle rect)
rect
. This position is relative to the current view
i
- the number of the child to be found, MUST be >=0 and < getViewCount()rect
- the Rectangle-Object to store the childs position and sizepublic java.util.List<Layout.PositionInfo> getChildren()
public int getViewCount()
public abstract void preLayout()
public abstract java.awt.Rectangle layout(boolean hard)
hard
- If set to true, the status of the children will be ignored and all views will be layouted. This
should be done on view-size changes. If set to false the status of the children will be respected and
up-to-date views will not be layouted again.
public abstract void layoutWidth()
public static void replace(javax.swing.text.View oldView, javax.swing.text.View[] newViews)
oldView
- the old viewnewViews
- a list of new viewspublic Layout.PositionInfo getChildPosition(BoxView childView)
childView
- child to find
public BoxView getView()
public int getPreferredWidth()
public int getPreferredHeight()
public int getMinimumWidth()
public int getMinimumHeight()
public int getCurrentTop()
public int getCurrentLeft()
public int getCurrentWidth()
public int getCurrentHeight()
public boolean isPreLayouted()
public void setPreLayouted()
public void setCurrentHeight(int currentHeight)
currentHeight
- he current content height for this boxpublic void setCurrentWidth(int currentWidth)
currentWidth
- the current content width for this boxpublic abstract void predictWidth(int width)
width
- Width to setpublic java.lang.String toString()
toString
in class java.lang.Object
public abstract void layoutVerticalAlign(int align, int baselineOffset)
align
- The AlignValue constantbaselineOffset
- The difference between the contents top and the first baseline in pixelpublic abstract ViewPositionInfo getViewForPosition(java.awt.Point position, java.awt.Rectangle a)
position
- the location to searcha
- the bounds of THIS view
public abstract java.awt.Rectangle getSpan()
public static void union(java.awt.Rectangle union, java.awt.Rectangle join)
union
- a rectangle, will be modifiedjoin
- a rectangle o join to the first onepublic static void union(java.awt.Rectangle union, int x, int y, int width, int height)
union
- a rectangle, will be modifiedx
- the x offset of the other rectangley
- the y offset of the other rectanglewidth
- the width of the other rectangleheight
- the height of the other rectanglepublic static void offsetRelative(Layout.ViewPosition info)
info
- the position info to be modified
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |