public class StyledPanel extends ej.mwt.Panel implements Element, StyledRenderable
EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
StyledPanel()
Creates a styled panel 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) |
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.
|
StyledDesktop |
getDesktop() |
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 |
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 |
renderContent(ej.microui.display.GraphicsContext g,
Style style,
Rectangle bounds)
Renders the content of the renderable without the border, margin and padding specified in the style.
|
void |
setClassSelectors(java.lang.String classSelector)
Sets the class selectors.
|
void |
setWidget(ej.mwt.Widget widget) |
void |
show(ej.mwt.Desktop desktop)
Deprecated.
Use
showAdjustingToChild(Desktop) instead. |
void |
show(ej.mwt.Desktop desktop,
boolean fill)
Deprecated.
Use
showAdjustingToChild(Desktop) or showFullScreen(Desktop) instead. |
void |
showAdjustingToChild(ej.mwt.Desktop desktop)
Requests the panel to be shown on the specified desktop.
|
void |
showFullScreen(ej.mwt.Desktop desktop) |
void |
showUsingBounds(ej.mwt.Desktop desktop) |
protected void |
updateStyle()
Updates the style of the widget.
|
protected boolean |
updateStyleOnly()
Update widget style without repainting it.
|
void |
validate() |
void |
validate(int widthHint,
int heightHint) |
Rectangle |
validateContent(Style style,
Rectangle bounds)
Gets the content size of the renderable without the border, margin and padding specified in the style.
|
becameActive, becameInactive, getEventHandler, getFocus, getHeight, getPreferredHeight, getPreferredWidth, getWidget, getWidgetAt, getWidth, getX, getY, handleEvent, hide, hideNotify, invalidate, isActive, isAdjustedToChild, isPacked, isShown, isValid, repaint, repaint, revalidate, setBounds, setEventHandler, setFocus, setLocation, setPacked, setPreferredSize, setSize, showInternal, showNotify
public boolean isTransparent()
isTransparent
in class ej.mwt.Panel
public boolean contains(int x, int y)
contains
in class ej.mwt.Panel
public void setWidget(@Nullable ej.mwt.Widget widget) throws java.lang.IllegalArgumentException
If the given widget is not an element, an IllegalArgumentException
is thrown.
setWidget
in class ej.mwt.Panel
java.lang.IllegalArgumentException
- if the given widget is not an element.Element
,
StyledWidget
,
StyledComposite
@Deprecated public void show(@Nullable ej.mwt.Desktop desktop) throws java.lang.NullPointerException
showAdjustingToChild(Desktop)
instead.
If the given desktop is not a styled desktop, an IllegalArgumentException
is thrown.
show
in class ej.mwt.Panel
java.lang.IllegalArgumentException
- if the given desktop is not an element.java.lang.NullPointerException
StyledDesktop
@Deprecated public void show(@Nullable ej.mwt.Desktop desktop, boolean fill) throws java.lang.NullPointerException
showAdjustingToChild(Desktop)
or showFullScreen(Desktop)
instead.
If the given desktop is not a styled desktop, an IllegalArgumentException
is thrown.
show
in class ej.mwt.Panel
java.lang.IllegalArgumentException
- if the given desktop is not an element.java.lang.NullPointerException
StyledDesktop
public void showFullScreen(@Nullable ej.mwt.Desktop desktop) throws java.lang.NullPointerException
If the given desktop is not a styled desktop, an IllegalArgumentException
is thrown.
showFullScreen
in class ej.mwt.Panel
java.lang.IllegalArgumentException
- if the given desktop is not an element.java.lang.NullPointerException
StyledDesktop
public void showAdjustingToChild(@Nullable ej.mwt.Desktop desktop) throws java.lang.NullPointerException
The panel is fitted to its child widget size. Its location is set according to its style alignment.
If the desktop is shown, the panel is automatically validated.
The panel is added to the list of panels known by the desktop.
If the panel is already shown on another desktop, it is hidden on this desktop before being shown on the new
If the given desktop is not a styled desktop, an IllegalArgumentException
is thrown.
showAdjustingToChild
in class ej.mwt.Panel
desktop
- the desktopjava.lang.NullPointerException
- if the given desktop is null
.java.lang.IllegalArgumentException
- if the given desktop is not an element.StyledDesktop
,
Style.getAlignment()
,
Panel.hide()
,
Panel.isShown()
,
Panel.revalidate()
public void showUsingBounds(@Nullable ej.mwt.Desktop desktop) throws java.lang.NullPointerException
If the given desktop is not a styled desktop, an IllegalArgumentException
is thrown.
showUsingBounds
in class ej.mwt.Panel
java.lang.IllegalArgumentException
- if the given desktop is not an element.java.lang.NullPointerException
StyledDesktop
@Nullable public StyledDesktop getDesktop()
getDesktop
in class ej.mwt.Panel
@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.public void render(ej.microui.display.GraphicsContext g)
render
in interface ej.mwt.Renderable
render
in class ej.mwt.Panel
public void renderContent(ej.microui.display.GraphicsContext g, Style style, Rectangle bounds)
StyledRenderable
The given graphics context is translated and clipped according to the given bounds (the border, margin and padding are applied on this graphics context before).
renderContent
in interface StyledRenderable
g
- the graphics context where to render the content of the renderable.style
- the style to use.bounds
- the remaining size to render the content.Outline.apply(GraphicsContext, Rectangle)
,
Border.apply(GraphicsContext, Rectangle, int)
,
StyleHelper.renderWithoutContent(GraphicsContext, Rectangle, Style)
public void validate()
validate
in class ej.mwt.Panel
public void validate(int widthHint, int heightHint)
validate
in class ej.mwt.Panel
public Rectangle validateContent(Style style, Rectangle bounds)
StyledRenderable
validateContent
in interface StyledRenderable
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.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 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.