Class TLcyApplicationPaneManager
Manager of the ILcyApplicationPane
instances that currently exist. The
application pane manager offers functionality to:
- retrieve the existing application panes
- listen to the creation of new application panes
- listen for the removal of existing application panes
- retrieve the application pane for a given
java.awt.Component
It is the responsibility of the ILcyApplicationPaneFactory
to notify this manager
when it creates an application pane and when an application pane is removed.
One usually does not create instances of this class, but retrieves it from the
TLcyUserInterfaceManager
.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
This interface defines the callback operation forapplyOnApplicationPane
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the specifiedILcyApplicationPaneManagerListener
to the list of listeners that should be notified of the addition and removal of application panes.void
applicationPaneAdded
(ILcyApplicationPane aApplicationPane) Adds the specifiedILcyApplicationPane
to the list of existing application panes.void
applicationPaneRemoved
(ILcyApplicationPane aApplicationPane) Removes the specifiedILcyApplicationPane
from the list of existing application panes.void
applyOnApplicationPane
(Component aComponent, TLcyApplicationPaneManager.ILcyApplicationPaneCallBack aCallBack) Applies the specified callback to theILcyApplicationPane
in which the specifiedComponent
is present.getApplicationPane
(int aIndex) Returns theILcyApplicationPane
at the specified index.getApplicationPane
(Component aComponent) Returns theILcyApplicationPane
in which the specified component is present.int
Returns the number of existing application panes.Returns aList
of the application panes.void
Removes the specifiedILcyApplicationPaneManagerListener
from the list of listeners that should be notified of the addition and removal of application panes.
-
Constructor Details
-
TLcyApplicationPaneManager
public TLcyApplicationPaneManager()
-
-
Method Details
-
getApplicationPaneCount
public int getApplicationPaneCount()Returns the number of existing application panes.
- Returns:
- The number of existing application panes. It is always greater than or equal to
0
.
-
getApplicationPane
Returns the
ILcyApplicationPane
at the specified index.- Parameters:
aIndex
- The index of the desired application pane. This index must always be smaller than the value returned bygetApplicationPaneCount
.- Returns:
- The
ILcyApplicationPane
ataIndex
. This is nevernull
- Throws:
IndexOutOfBoundsException
- ifaIndex
is greater than or equal to the value returned bygetApplicationPaneCount
.
-
getApplicationPanes
Returns aList
of the application panes.- Returns:
- an unmodifiable
List
of the managed panes. - Since:
- 2021.0
-
applicationPaneAdded
Adds the specified
ILcyApplicationPane
to the list of existing application panes. Any registered listeners are notified of this addition.Note: it is the responsibility of the
ILcyApplicationPaneFactory
to call this method. Addons requesting anILcyApplicationPane
from this factory should not call this method.- Parameters:
aApplicationPane
- TheILcyApplicationPane
to add to the list of existing application panes. This must not benull
.- See Also:
-
applicationPaneRemoved
Removes the specified
ILcyApplicationPane
from the list of existing application panes. Any registered listeners are notified of this removal.Note: it is the responsibility of the
ILcyApplicationPaneFactory
to call this method.ILcyApplicationPaneOwner
s being notified of the disposal of anILcyApplicationPane
should not call this method.- Parameters:
aApplicationPane
- TheILcyApplicationPane
to remove from the list of existing application panes. This must not benull
.- See Also:
-
addApplicationPaneManagerListener
Adds the specified
ILcyApplicationPaneManagerListener
to the list of listeners that should be notified of the addition and removal of application panes.- Parameters:
aListener
- The listener that should be notified of future additions and removals of application panes. This must not benull
.- See Also:
-
removeApplicationPaneManagerListener
Removes the specified
ILcyApplicationPaneManagerListener
from the list of listeners that should be notified of the addition and removal of application panes.- Parameters:
aListener
- The listener that should no longer be notified of future additions and removals of application panes. This must not benull
.- See Also:
-
getApplicationPane
Returns the
ILcyApplicationPane
in which the specified component is present. When you don't know when the specified component is added to an application pane, you should use theapplyOnApplicationPane
method, which will execute the specified callback when the component is added to the application pane.For instance, when a new
ILcyApplicationPane
is created and added to this manager, the content pane of this application pane is still empty. As a result, calling this method in the implementation ofILcyApplicationPaneManagerListener.applicationPaneAdded
will always result innull
.The specified component does not need to be a direct child of the content pane of the
ILcyApplicationPane
. It can be anywhere in the AWT component hierarchy beneath the content pane.- Parameters:
aComponent
- TheComponent
for which theILcyApplicationPane
should be retrieved. This must not benull
.- Returns:
- The
ILcyApplicationPane
in whichaComponent
is present. This can benull
. - See Also:
-
applyOnApplicationPane
public void applyOnApplicationPane(Component aComponent, TLcyApplicationPaneManager.ILcyApplicationPaneCallBack aCallBack) Applies the specified callback to the
ILcyApplicationPane
in which the specifiedComponent
is present. If the specified component is not yet present in any existingILcyApplicationPane
the necessary listeners are installed to execute the callback the moment the component is added to anILcyApplicationPane
.The specified component does not need to be a direct child of the content pane of the
ILcyApplicationPane
. It can be anywhere in the AWT component hierarchy beneath the content pane.Warning: make sure that the specified component is or will be added to an
ILcyApplicationPane
. Failure to do so may result in memory leaks, as the callback may then be referenced indefinitely.- Parameters:
aComponent
- TheComponent
for which theILcyApplicationPane
should be retrieved. This must not benull
.aCallBack
- The callback that should be executed when the application pane is found. This must not benull
.- See Also:
-