PopupLayerpublic class PopupLayer extends CLayer A "Popup" layer is a special kind of layer which can
also have commands associated with it. When a popup
layer is added to a MIDPWindow, its commands (if it has any)
can be accessed through the soft button bar. If a popup layer
does have commands associated with it, any commands on the
current displayable/item are no longer accessible. If
the popup layer does not have its own commands, any
existing commands from the displayable/item remain.
NOTE: For now, a PopupLayer is also always visible,
that is isVisible() always returns true. To control the
visibility of a PopupLayer, you add it and remove it
from a MIDPWindow. IMPL_NOTE: determine if a relationship between
PopupLayer and MIDPWindow can allow non visible popup layers. |
Fields Summary |
---|
protected Command[] | commandsThe set of Commands for this PopupLayer | protected CommandListener | listenerThe CommandListener to notify when a Command is selected |
Constructors Summary |
---|
public PopupLayer()Construct a new PopupLayer. By default, setSupportsInput()
is set to true.
this((Image)null, -1);
| public PopupLayer(Image bgImage, int bgColor)Construct a new PopupLayer, given a background image.
By default, setSupportsInput() is set to true, and so
is setVisible().
super(bgImage, bgColor);
this.supportsInput = true;
| public PopupLayer(Image[] bgImage, int bgColor)Construct a new PopupLayer, given a 9 pc background image.
By default, setSupportsInput() is set to true, and so
is setVisible().
super(bgImage, bgColor);
this.supportsInput = true;
|
Methods Summary |
---|
public CommandListener | getCommandListener()Get the CommandListener associated with this popup layer.
If the listener is null, any commands added to this popup layer
will not be visible when this popup is added to a MIDPWindow.
return listener;
| public Command[] | getCommands()Get the set of Commands associated with this PopupLayer
return commands;
| public boolean | handlePoint(int x, int y)Returns true for popup layer because almost all pointer events
have to be handled by popup even if it's out of bounds. The most of
popups has to be closed if the pointer event is out of its bounds.
The exception is the pointer is a part of the command layer.
boolean ret = true;
if (commands != null && commands.length > 0 && owner != null) {
ret = !((MIDPWindow)owner).belongToCmdLayers(x, y);
}
return ret | containsPoint(x, y);
| public void | setCommandListener(CommandListener listener)Establish a listener for the commands for this popup layer.
NOTE: When the CommandListener is notified of a command action,
the 'displayable' argument in its commandAction() method will
always be null.
this.listener = listener;
| public void | setCommands(Command[] commands)Set the set of Commands associated with this PopupLayer.
this.commands = commands;
| public void | setVisible(boolean visible)The setVisible() method is overridden in PopupLayer
so as not to have any effect. PopupLayers are always
visible by their very nature. In order to hide a
PopupLayer, it should be removed from its containing
MIDPWindow.
|
|