Package com.jbstrap.jbmap.layers
Interface ContainerLayer<T extends Layer<?>>
- Type Parameters:
T
- The layer class type
- All Known Implementing Classes:
DivLayer
,DivPoint
,PopupPoint
public interface ContainerLayer<T extends Layer<?>>
ContainerLayer interface for layers containing JBStrap components. e.g.:
DivPoint
, PopupPoint
and DivLayer
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault T
addComponent
(com.jbstrap.ui.Component<?> component) Adds the specified component as a subcomponent, and redraws the component immediatelydefault T
addComponents
(com.jbstrap.ui.Component<?>... components) Adds multiple components to the componentdraw()
The layer component content drawing.default com.jbstrap.ui.Component<?>
Gets the specified component.default List<com.jbstrap.ui.Component<?>>
Gets every previously added subcomponentdefault List<com.jbstrap.ui.Component<?>>
getComponents
(Predicate<com.jbstrap.ui.Component<?>> filter) Gets a list of components, according to the specified predicate.default <E> List<E>
getComponentsByClass
(Class<E> clazz) Gets the components, that are specified by class.default T
Removes every subcomponent from the componentdefault T
removeComponent
(com.jbstrap.ui.Component<?> component) Removes the specified subcomponent.default T
removeComponent
(Predicate<com.jbstrap.ui.Component<?>> filter) Removes the specified component(s), according to the specified predicate.default T
removeComponents
(com.jbstrap.ui.Component<?>... components) Removes the specified components.default T
replaceComponent
(com.jbstrap.ui.Component<?> oldComponent, com.jbstrap.ui.Component<?> newComponent) Replaces a previously added subcomponent with the specified new subcomponent.
-
Method Details
-
addComponent
Adds the specified component as a subcomponent, and redraws the component immediately- Parameters:
component
- The component to be added- Returns:
- The layer class instance
-
draw
T draw()The layer component content drawing.- Returns:
- The layer class instance
-
addComponents
Adds multiple components to the component- Parameters:
components
- The instances of the new, to be added components- Returns:
- The layer class instance
-
getComponents
Gets every previously added subcomponent- Returns:
- A collection of every subcomponent that was added to the component. If there are none, the collection will be empty.
-
getComponentById
Gets the specified component. It can be specified by its ID. If it has subcomponents,the method will look among the subcomponets too.- Parameters:
id
- The component id- Returns:
- If found, returns with the component instance. If not, returns with null
-
getComponentsByClass
Gets the components, that are specified by class. If they have subcomponents,the method will look among the subcomponets too.- Type Parameters:
E
- The component type- Parameters:
clazz
- The class that will be used as a reference for the operation- Returns:
- A list containing the component instances. If none was found, the list will be empty.
- Throws:
NullPointerException
- If the specified class isnull
-
getComponents
default List<com.jbstrap.ui.Component<?>> getComponents(Predicate<com.jbstrap.ui.Component<?>> filter) Gets a list of components, according to the specified predicate. If they have subcomponents,the method will look among the subcomponets too. This means that the list may contain components,that are not the component's direct subcomponent, but are subcomponents of a direct subcomponent.- Parameters:
filter
- The predicate filter- Returns:
- A list containing the components that meets the specified conditions.If there are none, the list will be empty
-
removeComponent
Removes the specified subcomponent.- Parameters:
component
- The component instance- Returns:
- The layer class instance
-
replaceComponent
default T replaceComponent(com.jbstrap.ui.Component<?> oldComponent, com.jbstrap.ui.Component<?> newComponent) Replaces a previously added subcomponent with the specified new subcomponent. The new component will bein the place of the old one, meaning the order of the components won't change.- Parameters:
oldComponent
- The to be replaced component.newComponent
- The new component.- Returns:
- The layer class instance
-
removeComponents
Removes the specified components.- Parameters:
components
- The components that will be removed- Returns:
- The layer class instance
-
removeAllComponents
Removes every subcomponent from the component- Returns:
- The layer class instance
-
removeComponent
Removes the specified component(s), according to the specified predicate.- Parameters:
filter
- The filter for the removal- Returns:
- The layer class instance
-