|
Eclipse eRCP Release 1.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.widgets.Dialog
org.eclipse.ercp.swt.mobile.MultiPageDialog
Instances of this class represents a tabbed dialog. The dialog contains multiple pages. Each page contains a composite. At any given time, only one page is visible. The page visibility can be selected by end-users or applications programmatically. The dialog is modal. Modality hints SWT.SYSTEM_MODAL, SWT.APPLICATION_MODAL, and SWT.PRIMARY_MODAL may be specified on construction. It is implementation dependent as to how these hints are interpreted since platforms may not support all modality modes.
Each page has a label. The platform may display the label as text, an icon, or both together. The size and position of page labels is implementation-dependent.
There is no fixed limit on the number of pages. A run-time exception may be thrown when resources are insufficient to create a new page.
Note: The bounds of this dialog is implementation-dependent. Applications can
query the actual page size through page.getBounds
after the page
has been created.
Commands associated to a page are only visible when that page is visible.
Commands may be associated with the whole MultiPageDialog by querying
a page's Shell and using it as the Control when creating Commands.
For example: Command c = new Command(page.getShell(), Command.GENERAL, 10);
MultiPageDialog dialog = new MultiPageDialog(shell, SWT.PRIMARY_MODAL);
Composite page1 = dialog.createPage("Page 1", null);
// add child controls here
Command okCMD = new Command(page1, Command.OK, 1);
okCMD.setText("Ok");
okCMD.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
// do something here before closing the dialog
dialog.close(); // Make the dialog invisible
dialog.dispose(); // Dispose the dialog and its children.
}
public void widgetDefaultSelected(SelectionEvent e) {}
});
dialog.setSelection(dialog.getPageCount() - 1); // The last page
dialog.open(); // open a modal dialog
Style VIRTUAL
is used to create a MultipageDialog
whose
Composite
s are to be populated by the client on an on-demand basis
instead of up-front. This can provide significant performance and memory consumption
improvements.
Here is an example of using a MultipageDialog
with style VIRTUAL
:
final MultiPageDialog dialog = new MultiPageDialog(shell, SWT.PRIMARY_MODAL | SWT.VIRTUAL);
dialog.createPage("Page 1", null);
dialog.createPage("Page 2", null);
dialog.createPage("Page 3", null);
dialog.addListener(SWT.SetData, new Listener() {
public void handleEvent(Event event) {
Composite page = (Composite)event.item;
//Populate rest of the UI
}
});
IMPORTANT: This class is not intended to be subclassed.
Constructor Summary | |
---|---|
MultiPageDialog(Shell parent)
Constructs a new instance of this class given only its parent. |
|
MultiPageDialog(Shell parent,
int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. |
Method Summary | |
---|---|
void |
addListener(int eventType,
Listener listener)
Adds the listener to the collection of listeners who will be notifed when an event of the given type occurs. |
void |
addSelectionListener(SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when the page changes, by sending it one of the messages defined in the SelectionListener interface.
|
void |
close()
Requests that the window manager close the dialog in the same way it would be closed when the user clicks on the "close box" or performs some other platform specific key or mouse combination that indicates the window should be removed. |
Composite |
createPage(String title,
Image icon)
Creates a new page with the specified title string and icon. |
void |
deletePage(int index)
Deletes the page from the receiver at the given zero-relative index |
void |
dispose()
Disposes of the operating system resources associated with the receiver. |
Composite |
getPage(int index)
Returns the composite of the page at the given zero-relative index in the receiver. |
int |
getPageCount()
Returns the number of pages contained in the receiver. |
int |
getSelectionIndex()
Returns the zero-relative index of the page which is currently selected in the receiver, or the newest page created to the receiver. |
String |
getTitle(int index)
Returns the title string of the page at the given zero-relative index in the receiver. |
void |
open()
Makes the dialog visible and brings it to the front of the display. |
void |
removeListener(int eventType,
Listener listener)
Removes the listener from the collection of listeners who will be notifed when an event of the given type occurs. |
void |
removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the receiver's selection changes. |
void |
setImage(int index,
Image icon)
Sets the icon image of the page at the given zero-relative index. |
void |
setSelection(int index)
Selects the active page by the given zero-relative index. |
void |
setTitle(int index,
String title)
Sets the title string of the page at the given zero-relative index. |
Methods inherited from class org.eclipse.swt.widgets.Dialog |
---|
checkSubclass, getParent, getStyle, getText, setText |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MultiPageDialog(Shell parent)
parent
- a shell which will be the parent of the new instance
IllegalArgumentException
- SWTException
- public MultiPageDialog(Shell parent, int style)
The style value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or
must be built by bitwise OR 'ing together (that is, using the
int
"|" operator) two or more of those SWT
style constants. The class description lists the style constants that are
applicable to the class. Style bits are also inherited from superclasses.
parent
- a shell which will be the parent of the new instancestyle
- the style of dialog to construct
IllegalArgumentException
- SWTException
- Method Detail |
public void addListener(int eventType, Listener listener)
handleEvent()
message.
eventType
- the type of event to listen forlistener
- the listener which should be notified when the event occurs
IllegalArgumentException
- SWTException
- Listener
,
removeListener(int, org.eclipse.swt.widgets.Listener)
public void addSelectionListener(SelectionListener listener)
SelectionListener
interface.
When widgetSelected
is called, the item field of the event
object is valid. widgetDefaultSelected
is not called.
listener
- the listener which should be notified
IllegalArgumentException
- SWTException
- SelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
public void close()
SWTException
- Shell.close()
public Composite createPage(String title, Image icon)
title
- -
the title string. Cannot be null.icon
- -
the label icon image. May be null.
IllegalArgumentException
- SWTException
- public void deletePage(int index)
index
- -
the index value. Cannot be negative, greater or equal to the
number of pages.
IllegalArgumentException
- SWTException
- public void dispose()
true
when sent the message
isDisposed()
. Any internal connections between the
widgets in the tree will have been removed to facilitate garbage
collection.
SWTException
- Widget.dispose()
public Composite getPage(int index)
index
- the index of the page to select. Cannot be negative, greater
or equal to the number of pages.
IllegalArgumentException
- SWTException
- public int getPageCount()
SWTException
- public String getTitle(int index)
index
- the index of the page to select.
IllegalArgumentException
- SWTException
- setTitle(int, java.lang.String)
public int getSelectionIndex()
SWTException
- public void open()
SWTException
- public void removeListener(int eventType, Listener listener)
eventType
- the type of event to listen forlistener
- the listener which should no longer be notified when the event occurs
IllegalArgumentException
- SWTException
- Listener
,
addListener(int, org.eclipse.swt.widgets.Listener)
public void removeSelectionListener(SelectionListener listener)
listener
- the listener which should no longer be notified
IllegalArgumentException
- SWTException
- SelectionListener
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
public void setSelection(int index)
index
- the index of the page to select. Cannot be negative, greater
or equal to the number of pages.
IllegalArgumentException
- SWTException
- public void setImage(int index, Image icon)
index
- the index of the page to select.icon
- the new icon image.
IllegalArgumentException
- SWTException
- public void setTitle(int index, String title)
index
- the index of the page to select.title
- the new title string. Cannot be null.
IllegalArgumentException
- SWTException
- getTitle(int)
|
Eclipse eRCP Release 1.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |