public class Collapsible extends Object implements org.jboss.elemento.IsElement<elemental2.dom.HTMLElement>, IsCollapsible<Collapsible>
Collapsible component can wrap any element to provide functionality to show and hide the wrapped element also it allows attaching callbacks when the element is shown/hidden
Collapsible.create(DominoElement.div().setTextContent("Hello world"))
.addShowHandler(() -> DomGlobal.console.info("Div visible"))
.addHideHandler(() -> DomGlobal.console.info("Div visible"));
| Modifier and Type | Class and Description |
|---|---|
static interface |
Collapsible.HideCompletedHandler
A callback interface to attach some listener when finish hiding the element
|
static interface |
Collapsible.ShowCompletedHandler
A callback interface to attach some listener when showing an element.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
DOM_UI_SCROLL_HEIGHT |
| Constructor and Description |
|---|
Collapsible(elemental2.dom.HTMLElement element)
Creates a collapsible wrapping the element
|
| Modifier and Type | Method and Description |
|---|---|
Collapsible |
addHideHandler(Collapsible.HideCompletedHandler handler)
Add handler to be called when ever the element changed state to hidden
|
Collapsible |
addShowHandler(Collapsible.ShowCompletedHandler handler)
Add handler to be called when ever the element changed state to visible
|
static Collapsible |
create(elemental2.dom.HTMLElement element)
A factory to create a collapsible wrapping the element
|
static Collapsible |
create(org.jboss.elemento.IsElement<?> isElement)
A factory to create a collapsible wrapping the element
|
elemental2.dom.HTMLElement |
element() |
CollapseStrategy |
getStrategy() |
Collapsible |
hide()
Make the element hidden and call any attached hide handlers
|
boolean |
isCollapsed()
checks if the wrapped element is collapsed
|
boolean |
isForceHidden() |
boolean |
isHidden()
Deprecated.
|
void |
removeHideHandler(Collapsible.HideCompletedHandler handler)
removes the hide handler
|
void |
removeShowHandler(Collapsible.ShowCompletedHandler handler)
removes the show handler
|
Collapsible |
setForceHidden(boolean forceHidden)
Disable/Enable force hidden
|
Collapsible |
setStrategy(CollapseStrategy strategy) |
Collapsible |
show()
Make the element visible and call any attached show handlers
|
Collapsible |
toggleDisplay()
toggle the element visibility, if its visible it hides it, otherwise it make it visible
|
Collapsible |
toggleDisplay(boolean state)
toggle the element visibility based on the flag.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisExpandedpublic static final String DOM_UI_SCROLL_HEIGHT
public Collapsible(elemental2.dom.HTMLElement element)
element - HTMLElement to be wrapped in a collapsiblepublic static Collapsible create(elemental2.dom.HTMLElement element)
element - HTMLElement to be wrapped in a collapsiblepublic static Collapsible create(org.jboss.elemento.IsElement<?> isElement)
isElement - IsElement to be wrapped in a collapsiblepublic boolean isForceHidden()
show()public Collapsible setForceHidden(boolean forceHidden)
forceHidden - boolean, if true it will hide the element if it is visible and wont allow
the element to be shown unless it is turned off, when turned off the element will remain
hidden until we call show()public Collapsible show()
show in interface IsCollapsible<Collapsible>public Collapsible hide()
hide in interface IsCollapsible<Collapsible>@Deprecated public boolean isHidden()
isHidden in interface IsCollapsible<Collapsible>public boolean isCollapsed()
isCollapsed in interface IsCollapsible<Collapsible>public Collapsible toggleDisplay()
toggleDisplay in interface IsCollapsible<Collapsible>public Collapsible toggleDisplay(boolean state)
toggleDisplay in interface IsCollapsible<Collapsible>state - boolean, if true make the element visible otherwise make it hiddenpublic Collapsible addHideHandler(Collapsible.HideCompletedHandler handler)
handler - Collapsible.HideCompletedHandlerpublic void removeHideHandler(Collapsible.HideCompletedHandler handler)
handler - Collapsible.HideCompletedHandlerpublic Collapsible addShowHandler(Collapsible.ShowCompletedHandler handler)
handler - Collapsible.ShowCompletedHandlerpublic void removeShowHandler(Collapsible.ShowCompletedHandler handler)
handler - Collapsible.ShowCompletedHandlerpublic CollapseStrategy getStrategy()
CollapseStrategy used by this Collapsiblepublic Collapsible setStrategy(CollapseStrategy strategy)
strategy - CollapseStrategy to be used with this collapsiblepublic elemental2.dom.HTMLElement element()
element in interface org.jboss.elemento.IsElement<elemental2.dom.HTMLElement>Copyright © 2019–2022 Dominokit. All rights reserved.