public class Toggle extends ToggleWrapper
It is simply a toggle wrapper that contains a label, based on a toggle model.
Box
,
Label
,
ToggleModel
EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
Toggle(Box box,
java.lang.String text)
Creates a toggle with the given text to display.
|
Toggle(ToggleModel toggleModel,
Box box,
java.lang.String text)
Creates a toggle with the given text to display.
|
Toggle(ToggleModel toggleModel,
Box box,
java.lang.String text,
java.lang.String group)
Creates a toggle with the given text to display.
|
Modifier and Type | Method and Description |
---|---|
Label |
getLabel()
Gets the label contained in the toggle.
|
java.lang.String |
getText()
Gets the text displayed by this toggle.
|
protected void |
setBoundsContent(Rectangle bounds)
Sets the bounds of this widget by taking into account the border, margin and padding specified in the style.
|
protected void |
setPressed(boolean pressed)
Sets the pressed state of the toggle.
|
void |
setText(java.lang.String text)
Sets the text displayed by this toggle.
|
void |
setWidget(ej.mwt.Widget widget)
Sets the only child of this composite.
|
void |
update()
Something has changed.
|
Rectangle |
validateContent(Style style,
Rectangle bounds)
Gets the content size of the renderable without the border, margin and padding specified in the style.
|
addOnStateChangeListener, gainFocus, getToggle, handleEvent, isChecked, isInState, lostFocus, removeOnStateChangeListener, requestFocus, requestFocus, setChecked, setGroup, toggle
contains, isAdjustedToChild, setAdjustedToChild
add, addClassSelector, getAttribute, getChild, getChildrenCount, getChildrenElements, getParentElement, getStyle, hasClassSelector, isTransparent, mergeStyle, removeAllClassSelectors, removeClassSelector, removeInstanceStyle, render, renderContent, setBounds, setClassSelectors, setEnabled, updateStyle, updateStyleOnly, validate
getFocus, getFocusIndex, getNext, getWidget, getWidgetAt, getWidgets, getWidgetsCount, hideNotify, iterator, remove, removeAllWidgets, 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 Toggle(Box box, java.lang.String text)
null
.
The box state is updated along with the state of the toggle.
box
- the widget representing the state of the toggle.text
- the text to display.java.lang.NullPointerException
- if a parameter is null
.State.Checked
public Toggle(ToggleModel toggleModel, Box box, java.lang.String text)
null
.
The box state is updated along with the state of the toggle.
toggleModel
- the toggle model.box
- the widget representing the state of the toggle.text
- the text to display.java.lang.NullPointerException
- if a parameter is null
.State.Checked
public Toggle(ToggleModel toggleModel, Box box, java.lang.String text, java.lang.String group)
null
.
The box state is updated along with the state of the toggle.
toggleModel
- the toggle model.box
- the widget representing the state of the toggle.text
- the text to display.group
- the name of the toggle group.java.lang.NullPointerException
- if a parameter is null
.State.Checked
public void setWidget(ej.mwt.Widget widget)
Wrapper
public Label getLabel()
public void setText(java.lang.String text)
text
- the text to display.java.lang.NullPointerException
- if the text is null
.Label.setText(String)
public java.lang.String getText()
The text is hold by the inner label.
Label.getText()
public void update()
GenericListener
update
in interface GenericListener
update
in class ToggleWrapper
protected void setPressed(boolean pressed)
ToggleWrapper
setPressed
in class ToggleWrapper
pressed
- the new pressed state of the toggle.public Rectangle validateContent(Style style, Rectangle bounds)
StyledComposite
Lays out the children of this composite.
validateContent
in interface StyledRenderable
validateContent
in class Wrapper
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 Wrapper
bounds
- the bounds available for the content.