public class WebAccordionModel extends Object implements AccordionModel, PropertyChangeListener, ContainerListener
AccordionModel
implementation.WebAccordion
,
AccordionPane
,
AccordionModel
,
WebAccordionModel
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected WebAccordion |
accordion
WebAccordion into which this WebAccordionModel is currently installed. |
protected Comparator<AccordionPane> |
newToOldPaneComparator
Comparator for AccordionPane s for descending sorting by state change times. |
protected Map<String,AccordionPaneState> |
states
|
Constructor and Description |
---|
WebAccordionModel()
Constructs new
WebAccordionModel . |
Modifier and Type | Method and Description |
---|---|
boolean |
collapsePane(String id)
Asks model to collapse
AccordionPane with the specified identifier. |
protected void |
collapseUnconditionally(String id)
Collapses
AccordionPane with the specified identifier without any additional checks. |
void |
componentAdded(ContainerEvent e) |
void |
componentRemoved(ContainerEvent e) |
boolean |
expandPane(String id)
Asks model to expand
AccordionPane with the specified identifier. |
protected void |
expandUnconditionally(String id)
Expands
AccordionPane with the specified identifier without any additional checks. |
protected WebAccordion |
getAccordion()
Returns non-
null WebAccordion . |
AccordionState |
getAccordionState()
Returns
AccordionState . |
List<String> |
getCollapsedPaneIds()
Returns
List of identifiers of collapsed AccordionPane s. |
int[] |
getCollapsedPaneIndices()
Returns array of indices of collapsed
AccordionPane s. |
List<AccordionPane> |
getCollapsedPanes()
Returns
List of collapsed AccordionPane s. |
List<String> |
getExpandedPaneIds()
Returns
List of identifiers of expanded AccordionPane s. |
int[] |
getExpandedPaneIndices()
Returns array of indices of expanded
AccordionPane s. |
List<AccordionPane> |
getExpandedPanes()
Returns
List of expanded AccordionPane s. |
AccordionPane |
getFirstExpandedPane()
Returns first expanded
AccordionPane . |
AccordionPane |
getLastExpandedPane()
Returns last expanded
AccordionPane . |
protected AccordionPaneState |
getPaneState(String id)
Returns
AccordionPaneState for the AccordionPane with the specified identifier. |
void |
install(WebAccordion accordion)
Installs this
AccordionModel into specified WebAccordion . |
boolean |
isPaneCollapsed(String id)
Returns whether or not
AccordionPane with the specified identifier is collapsed. |
boolean |
isPaneExpanded(String id)
Returns whether or not
AccordionPane with the specified identifier is expanded. |
void |
propertyChange(PropertyChangeEvent e) |
void |
setAccordionState(AccordionState accordionState)
Sets
AccordionState . |
void |
setExpandedPaneIds(List<String> ids)
Changes state of the
AccordionPane s with identifiers from the specified List to expanded. |
void |
setExpandedPaneIndices(int[] indices)
Changes state of the
AccordionPane s at the specified indices to expanded. |
void |
uninstall(WebAccordion multiSplitPane)
Uninstalls this
AccordionModel from the specified WebAccordion . |
protected void |
validateStates()
Validating that our states comply with
WebAccordion conditions. |
@Nullable protected WebAccordion accordion
WebAccordion
into which this WebAccordionModel
is currently installed.@NotNull protected Map<String,AccordionPaneState> states
Map
of all AccordionPaneState
s available in this WebAccordionModel
.
It can also contain AccordionPaneState
for panes that do not yet exist in WebAccordion
.@NotNull protected Comparator<AccordionPane> newToOldPaneComparator
Comparator
for AccordionPane
s for descending sorting by state change times.public WebAccordionModel()
WebAccordionModel
.public void install(@NotNull WebAccordion accordion)
AccordionModel
AccordionModel
into specified WebAccordion
.install
in interface AccordionModel
accordion
- WebAccordion
this model should be installed intopublic void uninstall(@NotNull WebAccordion multiSplitPane)
AccordionModel
AccordionModel
from the specified WebAccordion
.uninstall
in interface AccordionModel
multiSplitPane
- WebAccordion
this model should be uninstalled from@NotNull protected WebAccordion getAccordion()
null
WebAccordion
.null
WebAccordion
RuntimeException
- if this model is not yet installed and WebAccordion
is unavailable@NotNull public AccordionState getAccordionState()
AccordionModel
AccordionState
.
Note that returned states will only contain states for panes that are actually available in WebAccordion
at the time.
All other states will be trimmed to avoid piling up unnecessary junk in the saved state.
The only exception is when model is not yet installed anywhere, in that case all available states will be returned.getAccordionState
in interface AccordionModel
AccordionState
public void setAccordionState(@NotNull AccordionState accordionState)
AccordionModel
AccordionState
.
Note that provided states will be set "as is" to avoid trimming state for any lazy-loaded panes.setAccordionState
in interface AccordionModel
accordionState
- AccordionState
public void propertyChange(PropertyChangeEvent e)
propertyChange
in interface PropertyChangeListener
public void componentAdded(ContainerEvent e)
componentAdded
in interface ContainerListener
public void componentRemoved(ContainerEvent e)
componentRemoved
in interface ContainerListener
protected void validateStates()
WebAccordion
conditions.
If they don't - we will automatically adjust states to fix issues.@NotNull protected AccordionPaneState getPaneState(@NotNull String id)
AccordionPaneState
for the AccordionPane
with the specified identifier.id
- AccordionPane
identifierAccordionPaneState
for the AccordionPane
with the specified identifier@Nullable public AccordionPane getFirstExpandedPane()
AccordionModel
AccordionPane
.getFirstExpandedPane
in interface AccordionModel
AccordionPane
@Nullable public AccordionPane getLastExpandedPane()
AccordionModel
AccordionPane
.getLastExpandedPane
in interface AccordionModel
AccordionPane
@NotNull public List<AccordionPane> getExpandedPanes()
AccordionModel
List
of expanded AccordionPane
s.getExpandedPanes
in interface AccordionModel
List
of expanded AccordionPane
s@NotNull public List<String> getExpandedPaneIds()
AccordionModel
List
of identifiers of expanded AccordionPane
s.getExpandedPaneIds
in interface AccordionModel
List
of identifiers of expanded AccordionPane
spublic void setExpandedPaneIds(@NotNull List<String> ids)
AccordionModel
AccordionPane
s with identifiers from the specified List
to expanded.setExpandedPaneIds
in interface AccordionModel
ids
- List
of identifiers of AccordionPane
s to set expanded@NotNull public int[] getExpandedPaneIndices()
AccordionModel
AccordionPane
s.getExpandedPaneIndices
in interface AccordionModel
AccordionPane
spublic void setExpandedPaneIndices(@NotNull int[] indices)
AccordionModel
AccordionPane
s at the specified indices to expanded.setExpandedPaneIndices
in interface AccordionModel
indices
- indices of AccordionPane
s to set expandedpublic boolean isPaneExpanded(@NotNull String id)
AccordionModel
AccordionPane
with the specified identifier is expanded.isPaneExpanded
in interface AccordionModel
id
- AccordionPane
identifiertrue
if AccordionPane
with the specified identifier is expanded, false
otherwisepublic boolean expandPane(@NotNull String id)
AccordionModel
AccordionPane
with the specified identifier.expandPane
in interface AccordionModel
id
- AccordionPane
identifiertrue
if AccordionPane
was successfully expanded, false
otherwiseprotected void expandUnconditionally(@NotNull String id)
AccordionPane
with the specified identifier without any additional checks.
This method is intended for internal use only to avoid issues with overlapping minimum/maximum conditions.id
- AccordionPane
identifier@NotNull public List<AccordionPane> getCollapsedPanes()
AccordionModel
List
of collapsed AccordionPane
s.getCollapsedPanes
in interface AccordionModel
List
of collapsed AccordionPane
s@NotNull public List<String> getCollapsedPaneIds()
AccordionModel
List
of identifiers of collapsed AccordionPane
s.getCollapsedPaneIds
in interface AccordionModel
List
of identifiers of collapsed AccordionPane
s@NotNull public int[] getCollapsedPaneIndices()
AccordionModel
AccordionPane
s.getCollapsedPaneIndices
in interface AccordionModel
AccordionPane
spublic boolean isPaneCollapsed(@NotNull String id)
AccordionModel
AccordionPane
with the specified identifier is collapsed.isPaneCollapsed
in interface AccordionModel
id
- AccordionPane
identifiertrue
if AccordionPane
with the specified identifier is collapsed, false
otherwisepublic boolean collapsePane(@NotNull String id)
AccordionModel
AccordionPane
with the specified identifier.collapsePane
in interface AccordionModel
id
- AccordionPane
identifiertrue
if AccordionPane
was successfully collapsed, false
otherwiseprotected void collapseUnconditionally(@NotNull String id)
AccordionPane
with the specified identifier without any additional checks.
This method is intended for internal use only to avoid issues with overlapping minimum/maximum conditions.id
- AccordionPane
identifierCopyright © 2020. All rights reserved.