public class Split extends StyledComposite
Horizontal:
Vertical:
EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
Split()
Creates a horizontal split composite, each widget filling half the size.
|
Split(boolean horizontal,
float ratio)
Creates a split composite specifying its orientation and the fill ratio of the first widget.
|
Modifier and Type | Method and Description |
---|---|
ej.mwt.Widget |
getFirst()
Gets the first widget of this composite.
|
ej.mwt.Widget |
getLast()
Gets the last widget of this composite.
|
float |
getRatio()
Gets the ratio.
|
boolean |
isHorizontal()
Gets whether the composite is horizontal or not.
|
void |
remove(ej.mwt.Widget widget) |
void |
removeAllWidgets() |
protected void |
setBoundsContent(Rectangle bounds)
Sets the bounds of this widget by taking into account the border, margin and padding specified in the style.
|
void |
setFirst(ej.mwt.Widget widget)
Sets the first widget of this composite.
|
void |
setHorizontal(boolean horizontal)
Sets the composite orientation: horizontal or vertical.
|
void |
setLast(ej.mwt.Widget widget)
Sets the last widget of this composite.
|
void |
setRatio(float ratio)
Sets the position of the separation between the children, that is the first child size relatively to this
composite size.
|
Rectangle |
validateContent(Style style,
Rectangle bounds)
Gets the content size of the renderable without the border, margin and padding specified in the style.
|
add, addClassSelector, contains, gainFocus, getAttribute, getChild, getChildrenCount, getChildrenElements, getParentElement, getStyle, hasClassSelector, isInState, isTransparent, lostFocus, mergeStyle, removeAllClassSelectors, removeClassSelector, removeInstanceStyle, render, renderContent, setBounds, setClassSelectors, setEnabled, updateStyle, updateStyleOnly, validate
getFocus, getFocusIndex, getNext, getWidget, getWidgetAt, getWidgets, getWidgetsCount, handleEvent, hideNotify, iterator, requestFocus, requestFocus, requestFocusFrom, showNotify
getAbsoluteX, getAbsoluteX, getAbsoluteY, getAbsoluteY, getEventHandler, getHeight, getPanel, getParent, getPreferredHeight, getPreferredWidth, getRelativeX, getRelativeY, getWidth, getX, getY, hasFocus, invalidate, isEnabled, isShown, isValid, isVisible, repaint, repaint, revalidate, revalidateSubTree, setEventHandler, setLocation, setPreferredSize, setSize, setVisible
public Split()
public Split(boolean horizontal, float ratio)
horizontal
- true
to set the composite horizontal, false
to set the composite vertical.ratio
- the fill ratio to set for the first widget.java.lang.IllegalArgumentException
- if the given ratio is not between 0.0
and 1.0
excluded.setRatio(float)
public void setHorizontal(boolean horizontal)
horizontal
- true
to set the composite horizontal, false
to set the composite vertical.public boolean isHorizontal()
true
if the composite is horizontal, false
otherwise.public void setRatio(float ratio)
Example: setting the ratio to 1/3 in horizontal mode will give a third of the width to the first child, and two third for the last one. Both will be given all available height.
ratio
- the ratio to set.java.lang.IllegalArgumentException
- if the given ratio is not between 0.0
and 1.0
excluded.public float getRatio()
setRatio(float)
public void setFirst(ej.mwt.Widget widget)
widget
- the widget to add.java.lang.NullPointerException
- if the given widget is null
.java.lang.IllegalArgumentException
- if the given widget or one of its children is already connected to a panel.StyledComposite.add(Widget)
@Nullable public ej.mwt.Widget getFirst()
public void setLast(ej.mwt.Widget widget)
widget
- the widget to add.java.lang.NullPointerException
- if the given widget is null
.java.lang.IllegalArgumentException
- if the given widget or one of its children is already connected to a panel.StyledComposite.add(Widget)
@Nullable public ej.mwt.Widget getLast()
public void remove(ej.mwt.Widget widget) throws java.lang.NullPointerException
remove
in class ej.mwt.Composite
java.lang.NullPointerException
public void removeAllWidgets()
removeAllWidgets
in class ej.mwt.Composite
public Rectangle validateContent(Style style, Rectangle bounds)
StyledComposite
Lays out the children of this composite.
validateContent
in interface StyledRenderable
validateContent
in class StyledComposite
style
- the style to use.bounds
- the bounds available for the content. A width or a height equals to MWT.NONE
means no
constraint on this dimension.protected void setBoundsContent(Rectangle bounds)
StyledComposite
setBoundsContent
in class StyledComposite
bounds
- the bounds available for the content.