public abstract class StyledWidget extends ej.mwt.Widget implements Element, StyledRenderable
EMPTY_ELEMENT_ARRAY
Modifier | Constructor and Description |
---|---|
protected |
StyledWidget()
Creates a styled widget without class selector.
|
Modifier and Type | Method and Description |
---|---|
void |
addClassSelector(java.lang.String classSelector)
Adds a class selector.
|
boolean |
contains(int x,
int y) |
void |
gainFocus() |
java.lang.String |
getAttribute(java.lang.String attribute)
Gets the value of an attribute.
|
Element |
getChild(int index)
Gets the child element at an index.
|
int |
getChildrenCount()
Gets the number of children of this element.
|
Element[] |
getChildrenElements()
Gets the children elements.
|
protected Rectangle |
getContentBounds()
Gets the content bounds of this widget.
|
Element |
getParentElement()
Gets the parent element.
|
Style |
getStyle()
Gets the current style of the renderable.
|
boolean |
hasClassSelector(java.lang.String classSelector)
Gets whether or not the element has the given class selector.
|
boolean |
isInState(State state)
Gets whether or not the element is in the given state.
|
boolean |
isTransparent() |
void |
lostFocus() |
void |
mergeStyle(Style style)
Merges a style with the style of this renderable.
|
void |
removeAllClassSelectors()
Removes all the class selectors.
|
void |
removeClassSelector(java.lang.String classSelector)
Removes a class selector.
|
void |
removeInstanceStyle()
Removes the style specific to this renderable.
|
void |
render(ej.microui.display.GraphicsContext g) |
void |
setClassSelectors(java.lang.String classSelector)
Sets the class selectors.
|
void |
setEnabled(boolean enabled) |
protected void |
updateStyle()
Updates the style of the widget.
|
protected boolean |
updateStyleOnly()
Update widget style without repainting it.
|
void |
validate(int widthHint,
int heightHint) |
getAbsoluteX, getAbsoluteX, getAbsoluteY, getAbsoluteY, getEventHandler, getHeight, getPanel, getParent, getPreferredHeight, getPreferredWidth, getRelativeX, getRelativeY, getWidgetAt, getWidth, getX, getY, handleEvent, hasFocus, hideNotify, invalidate, isEnabled, isShown, isValid, isVisible, repaint, repaint, requestFocus, requestFocus, revalidate, revalidateSubTree, setBounds, setEventHandler, setLocation, setPreferredSize, setSize, setVisible, showNotify
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
renderContent, validateContent
protected StyledWidget()
public boolean isTransparent()
isTransparent
in class ej.mwt.Widget
public boolean contains(int x, int y)
contains
in class ej.mwt.Widget
@Nullable public Element getParentElement()
Element
getParentElement
in interface Element
public Element[] getChildrenElements()
Element
Returns an empty array if no children.
getChildrenElements
in interface Element
Element.EMPTY_ELEMENT_ARRAY
public Element getChild(int index)
Element
public int getChildrenCount()
Element
getChildrenCount
in interface Element
public void mergeStyle(Style style)
StyledRenderable
Equivalent to StyleHelper.getStylesheet().addRule(new InstanceSelector(renderable), style);
mergeStyle
in interface StyledRenderable
style
- the style to merge.StyledRenderable.removeInstanceStyle()
,
InstanceSelector
public void removeInstanceStyle()
StyledRenderable
Equivalent to StyleHelper.getStylesheet().removeRule(new InstanceSelector(renderable));
removeInstanceStyle
in interface StyledRenderable
StyledRenderable.mergeStyle(Style)
,
InstanceSelector
public Style getStyle()
StyledRenderable
The style is retrieved from the global stylesheet: StyleHelper.getStylesheet().getStyle(renderable);
getStyle
in interface StyledRenderable
Stylesheet.getStyle(ej.style.Element)
protected void updateStyle()
protected boolean updateStyleOnly()
true
if the style has been updated, false
otherwise.protected Rectangle getContentBounds()
Widget.getWidth()
,
Widget.getHeight()
,
StyleHelper.computeContentBounds(Rectangle, Style)
public void render(ej.microui.display.GraphicsContext g)
render
in interface ej.mwt.Renderable
public void validate(int widthHint, int heightHint)
validate
in class ej.mwt.Widget
public void setEnabled(boolean enabled)
setEnabled
in class ej.mwt.Widget
public boolean hasClassSelector(java.lang.String classSelector)
Element
hasClassSelector
in interface Element
classSelector
- the class selector to check.true
if the element has the given class selector, false
otherwise.public void addClassSelector(java.lang.String classSelector)
StyledRenderable
addClassSelector
in interface StyledRenderable
classSelector
- the class selector to add.public void removeClassSelector(java.lang.String classSelector)
StyledRenderable
removeClassSelector
in interface StyledRenderable
classSelector
- the class selector to remove.public void setClassSelectors(java.lang.String classSelector)
StyledRenderable
The given string is a space separated list of class selectors.
If there is already some class selectors, they are removed.
setClassSelectors
in interface StyledRenderable
classSelector
- the class selectors list to split.public void removeAllClassSelectors()
StyledRenderable
removeAllClassSelectors
in interface StyledRenderable
public void gainFocus()
gainFocus
in class ej.mwt.Widget
public void lostFocus()
lostFocus
in class ej.mwt.Widget
public boolean isInState(State state)
Element
@Nullable public java.lang.String getAttribute(java.lang.String attribute)
Element
getAttribute
in interface Element
attribute
- the attribute to search.null
if the attribute does not exist.