public abstract class AbstractPopupMenu extends AbstractDialog
AbstractPopupMenu
acts as a super class for all generated
popup menus. It provides the open()
method as well as the default
event listener implementation. The AbstractDialog.close()
method is not required
for a AbstractPopupMenu
as it is automatically closed by the
operating system if the user presses a button or clicks somewhere outside the
menu.
To open/close the popup menu:
AbstractPopupMenu menu = ...; menu.open();To create the
AbstractPopupMenu
, the user has to deliver an
instance of the IDialogDelegate
interface with the constructor. Each
abstract view controller implements this interface per default. This also
means that there a two ways of creating the dialog:
final AbstractPopupMenu dialog = new MyPopupMenu(this);
IDialogDelegate
.
final AbstractPopupMenu dialog = new MyPopupMenu(new MyDialogDelegate());
IDialogDelegate.onDialogButtonPressed(AbstractDialog, int)
method
from a specific view controller or delegate implementation. The passed
AbstractPopupMenu
represents the current instance. The integer
value corresponds to the button id, the user entered in the outline editor.
This id, stored in the Constants interface, can be used to determine
different behaviors for different buttons, e.g.:
public void onDialogButtonPressed(final AbstractPopupMenu dialog, final int id) { switch (id) { case Constants.BUTTON_1: // ... break; case Constants.BUTTON_2: // ... break; } }This class is also just a wrapper for the Mobile Designer
nUIPopupMenuBuilder
. Each sub class has to override the
getDialog()
method to create the underlying
nUIPopupMenuBuilder
.
bottom, center, centre, CREATE, CUSTOM_EVENT_CODE0, EVT_BACK_BUTTON, EVT_COMPLETED_EDIT, EVT_DOUBLE_TAP, EVT_GAIN_FOCUS, EVT_LONG_PRESS, EVT_LOSE_FOCUS, EVT_ON_ADDITION, EVT_PICKER_CANCEL, EVT_PICKER_OK, EVT_POST_EDIT, EVT_PRE_EDIT, EVT_SWIPE_LEFT, EVT_SWIPE_RIGHT, EVT_TIMER_COMPLETE, EVT_TRANSITION_FROM_COMPLETE, EVT_TRIGGER, EVT_TRIGGER_HTTP_FAIL, EVT_TRIGGER_HTTP_SUCCESS, GESTURE_DOUBLE_TAP, GESTURE_LONG_PRESS, GESTURE_NONE, GESTURE_SWIPE, left, MAX_DY_FOR_SWIPE, MIN_DX_FOR_SWIPE, MIN_SCROLL_START_THRESHOLD, NO_YES, OFF_ON, POINTER_STATE_DRAGGED, POINTER_STATE_PRESSED, POINTER_STATE_PRESSED_AND_RELEASED, POINTER_STATE_RELEASED, REMOVE, right, size_absolute, size_huge, size_large, size_medium, size_relative, size_small, size_tiny, style_bold, style_default, style_italic, style_underlined, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, top
Constructor and Description |
---|
AbstractPopupMenu(IDialogDelegate delegate,
com.softwareag.mobile.runtime.nui.nUIObject anchorElement)
Creates a new AbstractPopupMenu by passing an IDialogDelegate.
|
Modifier and Type | Method and Description |
---|---|
com.softwareag.mobile.runtime.nui.nUIElementDisplay |
getAnchorElement() |
abstract com.softwareag.mobile.runtime.nui.nUIPopupMenuBuilder |
getDialog()
Returns the Mobile Designer
nUIPopupMenuBuilder this class wraps. |
void |
open()
Opens this dialog.
|
close, nUIEventCallback
public AbstractPopupMenu(IDialogDelegate delegate, com.softwareag.mobile.runtime.nui.nUIObject anchorElement)
public void open()
open
in class AbstractDialog
public abstract com.softwareag.mobile.runtime.nui.nUIPopupMenuBuilder getDialog()
nUIPopupMenuBuilder
this class wraps.public com.softwareag.mobile.runtime.nui.nUIElementDisplay getAnchorElement()
nUIPopupMenuBuilder
is attached
to; might be null