public interface ILcyApplicationPane extends ILcdPropertyChangeSource
java.awt.Component
s of the
application in. So every gui element ( map, layercontrol, panels of addons, ... ) that needs to
be displayed to the user will be in an ILcyApplicationPane
.
To work with this pane - it is add your own components, set the layout, ... - use
getAppContentPane to retrieve a regular java.awt.Container. Make sure that every operation on
the content pane is performed in the event dispatch thread. See ILcyApplicationPaneFactory
for more information.
The idea of this interface is to make abstraction of the swing component used to represent the
gui elements. Implementations can range from a dialog over a frame to a regular panel or anything
else you can come up with. So one cannot make any assumptions on the looks or the size of an
ILcyApplicationPane
.
Note that there is no operation to add an application pane to Lucy's environment. The creation of
a pane will add it to the (visible) Lucy's environment right away. This means all swing
operations (like add, remove, ...) on the content pane of an application pane need to be
performed on the event dispatch thread (swing is designed to be single threaded).
ILcyApplicationPaneFactory
Modifier and Type | Field and Description |
---|---|
static String |
HINT_AUTO_HIDE
The key representing the hint 'auto-hide' of an application pane.
|
static String |
HINT_FLOATING
The key representing the hint 'floating' of an application pane.
|
static String |
HINT_FLOATING_LOCATION
The key representing the location of the application pane when the application pane is
floating.
|
static String |
LONG_DESCRIPTION
The key representing the long description of an application pane.
|
static String |
SHORT_DESCRIPTION
The key representing the short description of an application pane.
|
static String |
SMALL_ICON
The key representing the icon value of an application pane.
|
Modifier and Type | Method and Description |
---|---|
void |
bringAppToFront()
Brings the applicationpane to the front.
|
boolean |
canPackApp()
Returns true if this
ILcyApplicationPane can be packed, false otherwise. |
void |
disposeApp()
Disposes this
ILcyApplicationPane and removes it from the user interface. |
Container |
getAppContentPane()
Gets the AppContentPane.
|
Dimension |
getAppSize()
Returns the current size of this application pane.
|
String |
getAppTitle()
Returns the title of this ILcyApplicationPane.
|
Object |
getValue(String aKey)
Gets one of this object's properties using the associated key.
|
boolean |
isAppVisible()
Returns true if this
ILcyApplicationPane is visible, false otherwise. |
boolean |
isDisposable()
Returns true if this pane allows to be disposed, false otherwise.
|
void |
packApp()
Packs the
ILcyApplicationPane . |
void |
putValue(String aKey,
Object aValue)
Sets one of this object's properties using the associated key.
|
void |
setAppEnabled(boolean aEnabled)
Sets the enabled attribute of the ILcyApplicationPane.
|
void |
setAppSize(Dimension aDimension)
Sets the size of the
ILcyApplicationPane . |
void |
setAppTitle(String aTitle)
Sets the title of this ILcyApplicationPane.
|
void |
setAppVisible(boolean aVisible)
Sets the visible property of this
ILcyApplicationPane . |
void |
setDisposable(boolean aDisposable)
Sets if this pane can be disposed or not.
|
void |
setResizable(boolean aResizable)
Sets the Resizable attribute of the ILcyApplicationPane object.
|
addPropertyChangeListener, removePropertyChangeListener
static final String SMALL_ICON
ILcdIcon
.static final String SHORT_DESCRIPTION
String
.static final String LONG_DESCRIPTION
String
.static final String HINT_AUTO_HIDE
Boolean
. The value should be used to indicate if a docked
application pane should automatically hide itself or not. It is optional in the sense that
ILcyApplicationPane
implementations are allowed to ignore this property.static final String HINT_FLOATING
Boolean
. The value should be used to indicate if the
application pane is represented as a floating dialog (true) or a docked frame (false).
It is optional in the sense that ILcyApplicationPane
implementations are allowed
to ignore this property.static final String HINT_FLOATING_LOCATION
Point
. It is optional in
the sense that ILcyApplicationPane
implementations are allowed to ignore this
property.void packApp()
ILcyApplicationPane
. It is, giving it its preferred size and laying
out its subcomponents. Note that this is only possible if canPackApp returns true.canPackApp()
boolean canPackApp()
ILcyApplicationPane
can be packed, false otherwise.ILcyApplicationPane
can be packed, false otherwise.packApp()
void disposeApp()
Disposes this ILcyApplicationPane
and removes it from the user interface.
This application pane should no longer be used after calling this method.
The associated ILcyApplicationPaneOwner
is notified.
This method does not take isDisposable()
into account, it is up the user of this class to verify
if the application pane is disposable. This allows the application pane to be disposed regardless
of the disposable property, which can for example be useful to programmatically clean application panes.
boolean isDisposable()
setDisposable(boolean)
void setDisposable(boolean aDisposable)
Sets if this pane can be disposed or not.
Note that disposeApp()
does not respect this property, the properties primary use is to enable/disable
a close action in the user interface.
aDisposable
- True if this pane can be disposed, false otherwise.isDisposable()
void setAppEnabled(boolean aEnabled)
aEnabled
- The new AppEnabled valueboolean isAppVisible()
ILcyApplicationPane
is visible, false otherwise.ILcyApplicationPane
is visible, false otherwise.setAppVisible(boolean)
void setAppVisible(boolean aVisible)
Sets the visible property of this ILcyApplicationPane
. Make sure to set
an application pane visible after it is created and initialized. If not, it might not
be available in the user interface (depending on the implementation).
Setting it invisible is mostly useful to temporarily 'hide' it, as it won't disposed and all resources are still in use when invisible.
aVisible
- The new AppVisible valueisAppVisible()
void setAppSize(Dimension aDimension)
ILcyApplicationPane
. There is normally no need to use this
method. Instead let Swing calculate proper sizes, based on the minimum, preferred and maximum
sizes of the smallest components (such as text fields, check boxes etc.). This assures proper
functioning, even on systems that have custom font or display settings.aDimension
- The new sizegetAppSize()
Dimension getAppSize()
setAppSize(java.awt.Dimension)
void setAppTitle(String aTitle)
aTitle
- The new titlegetAppTitle()
String getAppTitle()
setAppTitle(java.lang.String)
Container getAppContentPane()
Gets the AppContentPane. The content pane is the visual part of this ILcyApplicationPane. It is
used to add, remove, ... your own components. Make sure that every operation on the content
pane is performed in the event dispatch thread. See ILcyApplicationPaneFactory
for
more information.
Note that the implementation of this interface is free to choose the LayoutManager
set on the returned Container
.
For example if you want to add a single Component
to the application pane which takes all available space,
you cannot assume that you can simply add the component.
In this case, you could for example set a BorderLayout
and add the component to the center:
ILcyApplicationPane appPane = ... ;
Component content = ... ;
Container contentPane = appPane.getAppContentPane();
//explicitly set a layout manager
contentPane.setLayoutManager( new BorderLayout() );
//ensure that the content takes all available space by adding it to the center
contentPane.add( content, BorderLayout.CENTER );
ILcyApplicationPaneFactory
void bringAppToFront()
isAppVisible()
void setResizable(boolean aResizable)
aResizable
- The new Resizable valuevoid putValue(String aKey, Object aValue)
Sets one of this object's properties using the associated key. There are three predefined
keys: SMALL_ICON
, SHORT_DESCRIPTION
and LONG_DESCRIPTION
.
Implementations of this interface can use these properties to show them in their user
interface. For instance the icon set with the SMALL_ICON key could be shown in the tab of a
tabbed pane.
The type of the value is specified by the key. For instance, the key SMALL_ICON
demands that the value is an ILcdIcon
.
If the value has changed, a PropertyChangeEvent
is sent to listeners with
aKey
as the property name.
aKey
- a String
representing the key. This must not be null
,
but can otherwise be any String
, ie. it is not restricted to being
one of SMALL_ICON
, SHORT_DESCRIPTION
or
LONG_DESCRIPTION
.aValue
- an Object
value. This may be null
.getValue(String)
Object getValue(String aKey)
aKey
- the String
of the key for which you want to retrieve the value. This
can be any String
, ie. it is not restricted to being one of
SMALL_ICON, SHORT_DESCRIPTION or LONG_DESCRIPTION.Object
value corresponding to aKey
, or null
if no value corresponding to aKey
could be found. The type of this value
is determined by the key. For instance, the SMALL_ICON
key specifies that
the returned value is an ILcdIcon
.putValue(String, Object)