|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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.
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);
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
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 |
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(java.lang.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. |
java.lang.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 |
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,
java.lang.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
java.lang.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
java.lang.IllegalArgumentException
- SWTException
- Method Detail |
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
java.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
public void close()
SWTException
- Shell.close()
public Composite createPage(java.lang.String title, Image icon)
title
- -
the title string. Cannot be null.icon
- -
the label icon image. May be null.
java.lang.IllegalArgumentException
- SWTException
- public void deletePage(int index)
index
- -
the index value. Cannot be negative, greater or equal to the
number of pages.
java.lang.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.
java.lang.IllegalArgumentException
- SWTException
- public int getPageCount()
SWTException
- public java.lang.String getTitle(int index)
index
- the index of the page to select.
java.lang.IllegalArgumentException
- SWTException
- setTitle(int, java.lang.String)
public int getSelectionIndex()
SWTException
- public void open()
SWTException
- public void removeSelectionListener(SelectionListener listener)
listener
- the listener which should no longer be notified
java.lang.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.
java.lang.IllegalArgumentException
- SWTException
- public void setImage(int index, Image icon)
index
- the index of the page to select.icon
- the new icon image.
java.lang.IllegalArgumentException
- SWTException
- public void setTitle(int index, java.lang.String title)
index
- the index of the page to select.title
- the new title string. Cannot be null.
java.lang.IllegalArgumentException
- SWTException
- getTitle(int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |