Class
zebkit.layout.Layoutable
mixed with <zebkit.layout.Layout> <zebkit.EventProducer> <zebkit.PathSearch> |
<zebkit.layout> |
Layoutable class defines rectangular component that has elementary metrical properties like width, height and location and can be a participant of layout management process. Layoutable component is container that can contains other layoutable component as its children. The children components are ordered by applying a layout manager of its parent component.
zebkit.layout.Layoutable
(
)
protected
chainable
$setConstraints (c )
Set the component constraints without invalidating the component and its parents components layouts and metrics. It is supposed to be used for internal use Parameters:
|
public
<zebkit.layout.Layoutable>
add (constr, d )
Add the new children component with the given constraints Parameters:
Returns:
<zebkit.layout.Layoutable>
added layoutable component |
public
<zebkit.layout.Layoutable>
byConstraints ([p], c )
Get a children layoutable component by the given path (optionally) and the specified constraints. Parameters:
Returns:
<zebkit.layout.Layoutable>
a children component |
@Override
zebkit.layout.Layout
private
<Object>
calcPreferredSize (target )
Internal implementation of the component preferred size calculation. Parameters:
Returns:
<Object>
a preferred size. The method always returns { width:10, height:10 } as the component preferred size |
@Override
zebkit.layout.Layout
private
void
doLayout ( )
By default layoutbable component itself implements layout manager to order its children components. This method implementation does nothing, so children component will placed according locations and sizes they have set. |
public
<Integer>
getBottom ( )
Get bottom padding.
Returns:
<Integer>
bottom padding in pixel |
public
<Integer>
getHorPadding ( )
Get accumulated horizontal (top and bottom) padding.
Returns:
<Integer>
a horizontal padding |
public
<Integer>
getLeft ( )
Get left padding.
Returns:
<Integer>
left padding in pixel |
public
<Integer>
getRight ( )
Get right padding.
Returns:
<Integer>
right padding in pixel |
public
<Integer>
getTop ( )
Get top padding.
Returns:
<Integer>
top padding in pixel |
public
<Integer>
getVerPadding ( )
Get accumulated vertical (top and bottom) padding.
Returns:
<Integer>
a vertical padding |
public
<Integer>
indexOf (c )
Detect index of a children component. Parameters:
Returns:
<Integer>
|
public
<zebkit.layout.Layoutable>
insert (i, constr, d )
Insert the new children component at the given index with the specified layout constraints. The passed constraints can be set via a layoutable component that is inserted. Just set "constraints" property of in inserted component. Parameters:
Returns:
<zebkit.layout.Layoutable>
an inserted children layoutable component |
public
void
invalidate ( )
Invalidate component layout and metrics. |
protected
void
invalidateLayout ( )
Invalidate the component layout. Layout invalidation means the component children components have to be placed with the component layout manager. Layout invalidation causes a parent component layout is also invalidated. |
public
void
kidAdded (i, constr, d )
The method can be implemented to be informed every time a new component has been inserted into the component Parameters:
|
public
void
kidRemoved (i, c )
The method can be implemented to be informed every time a children component has been removed Parameters:
|
public
void
laidout ( )
The method can be implemented to be informed every time the component has completed to layout its children components |
public
chainable
properties ([path], props )
Apply the given set of properties to the given component or a number of children its components. Parameters:
Example:
|
protected
void
recalc ( )
By default there is no any implementation of "recalc" method in the layoutable component. In other words the method doesn't exist. Developer should implement the method if the need a proper and efficient place to calculate component properties that have influence to the component preferred size. The "recalc" method is called only when it is really necessary to compute the component metrics. |
public
void
relocated (px, py )
The method can be implemented to be informed every time the component has been moved Parameters:
|
public
<zebkit.layout.Layoutable>
remove (c )
Remove the given children component. Parameters:
Returns:
<zebkit.layout.Layoutable>
a removed children component |
public
<zebkit.layout.Layoutable>
removeAt (i )
Remove a children component at the specified position. Parameters:
Returns:
<zebkit.layout.Layoutable>
a removed children component |
public
<zebkit.layout.Layoutable>
removeByConstraints (ctr )
Remove a component by the given constraints. Parameters:
Returns:
<zebkit.layout.Layoutable>
a removed component |
public
void
removeMe ([after] )
Remove the component from its parent if it has a parent Parameters:
|
public
chainable
replaceMe ([ctr], c )
Replace the component with the new one. The replacement keeps layout constraints of the replaced component if other constraints value is not passed to the method. Parameters:
|
public
void
resized (w, h )
The method can be implemented to be informed every time the component has been resized Parameters:
|
public
<zebkit.layout.Layoutable>
setAt (i, d )
Replace a children component at the specified index with the given new children component Parameters:
Returns:
<zebkit.layout.Layoutable>
a previous component that has been re-set with the new one |
public
chainable
setBounds (x, y, w, h )
Set the layoutable component bounds. Bounds defines the component location and size. Parameters:
|
public
<zebkit.layout.Layoutable>
setByConstraints (constr, c )
Set the component by the given constraints or add new one with the given constraints Parameters:
Returns:
<zebkit.layout.Layoutable>
a previous component that has been re-set with the new one |
public
chainable
setId (id )
Set the given id for the component Parameters:
|
public
chainable
setLayout (m )
Set the given layout manager that is used to place children component. Layout manager is simple class that defines number of rules concerning the way children components have to be ordered on its parent surface. Parameters:
|
public
chainable
setLocation (xx, yy )
Set the layoutable component location. Location is x, y coordinates relatively to a parent component Parameters:
|
protected
void
setParent (o )
Set the parent component. Parameters:
|
public
chainable
setPreferredHeigh (h )
Set preferred height. Parameters:
|
public
chainable
setPreferredSize (w, h )
Set the specified preferred size the component has to have. Component preferred size is important thing that is widely used to layout the component. Usually the preferred size is calculated by a concrete component basing on its metrics. For instance, label component calculates its preferred size basing on text size. But if it is required the component preferred size can be fixed with the desired value. Parameters:
|
public
chainable
setPreferredWidth (w )
Set preferred width. Parameters:
|
public
chainable
setSize (w, h )
Set the layoutable component size. Parameters:
|
public
void
validate ( )
Force validation of the component metrics and layout if it is not valid |
protected
void
validateMetric ( )
Validate the component metrics. The method is called as a one step of the component validation procedure. The method causes "recalc" method execution if the method has been implemented and the component is in invalid state. It is supposed the "recalc" method has to be implemented by a component as safe place where the component metrics can be calculated. Component metrics is individual for the given component properties that has influence to the component preferred size value. In many cases the properties calculation has to be minimized what can be done by moving the calculation in "recalc" method |
public
<Object>
constraints
The component layout constraints. The constraints is specific to the parent component layout manager value that customizes the children component layouting on the parent component. |
public
![]() height
Height of rectangular area |
public
![]() layout
Layout manager that is used to order children layoutable components |
public
![]() width
Width of rectangular area |
public
![]() x
x coordinate |
public
![]() y
y coordinate |