Package org.eclipse.ui.forms
Class DetailsPart
java.lang.Object
org.eclipse.ui.forms.DetailsPart
- All Implemented Interfaces:
IFormPart,IPartSelectionListener
This managed form part handles the 'details' portion of the
'master/details' block. It has a page book that manages pages
of details registered for the current selection.
By default, details part accepts any number of pages. If dynamic page provider is registered, this number may be excessive. To avoid running out of steam (by creating a large number of pages with widgets on each), maximum number of pages can be set to some reasonable value (e.g. 10). When this number is reached, old pages (those created first) will be removed and disposed as new ones are added. If the disposed pages are needed again after that, they will be created again.
- Since:
- 3.0
-
Constructor Summary
ConstructorsConstructorDescriptionDetailsPart(IManagedForm mform, Composite parent, int style) Creates a new details part in the provided form by creating the page book.DetailsPart(IManagedForm mform, ScrolledPageBook pageBook) Creates a details part by wrapping the provided page book. -
Method Summary
Modifier and TypeMethodDescriptionvoidcommit(boolean onSave) Commits the part by committing the current page.voiddispose()Disposes the part allowing it to release allocated resources.Returns the current page visible in the part.intReturns the maximum number of pages that should be maintained in this part.voidinitialize(IManagedForm form) Initializes the part.booleanisDirty()Tests if the currently visible page is dirty.booleanisStale()Tests if the currently visible page is stale and needs refreshing.voidrefresh()Refreshes the current page.voidregisterPage(Object objectClass, IDetailsPage page) Registers the details page to be used for all the objects of the provided object class.voidselectionChanged(IFormPart part, ISelection selection) Called when the provided part has changed selection state.voidsetFocus()Sets the focus to the currently visible page.booleansetFormInput(Object input) Notifies the part that an object has been set as overall form's input.voidsetPageLimit(int pageLimit) Sets the page limit for this part.voidsetPageProvider(IDetailsPageProvider provider) Sets the dynamic page provider.
-
Constructor Details
-
DetailsPart
Creates a details part by wrapping the provided page book.- Parameters:
mform- the parent formpageBook- the page book to wrap
-
DetailsPart
Creates a new details part in the provided form by creating the page book.- Parameters:
mform- the parent formparent- the composite to create the page book instyle- the style for the page book
-
-
Method Details
-
registerPage
Registers the details page to be used for all the objects of the provided object class.- Parameters:
objectClass- an object of type 'java.lang.Class' to be used as a key for the provided pagepage- the page to show for objects of the provided object class
-
setPageProvider
Sets the dynamic page provider. The dynamic provider can return different pages for objects of the same class based on their state.- Parameters:
provider- the provider to use
-
commit
public void commit(boolean onSave) Commits the part by committing the current page. -
getCurrentPage
Returns the current page visible in the part.- Returns:
- the current page
-
dispose
public void dispose()Description copied from interface:IFormPartDisposes the part allowing it to release allocated resources. -
initialize
Description copied from interface:IFormPartInitializes the part.- Specified by:
initializein interfaceIFormPart- Parameters:
form- the managed form that manages the part
-
isDirty
public boolean isDirty()Tests if the currently visible page is dirty. -
isStale
public boolean isStale()Tests if the currently visible page is stale and needs refreshing. -
refresh
public void refresh()Refreshes the current page. -
setFocus
public void setFocus()Sets the focus to the currently visible page. -
setFormInput
Description copied from interface:IFormPartNotifies the part that an object has been set as overall form's input. The part can elect to react by revealing or selecting the object, or do nothing if not applicable.- Specified by:
setFormInputin interfaceIFormPart- Returns:
trueif the part has selected and revealed the input object,falseotherwise.
-
selectionChanged
Description copied from interface:IPartSelectionListenerCalled when the provided part has changed selection state.- Specified by:
selectionChangedin interfaceIPartSelectionListener- Parameters:
part- the selection sourceselection- the new selection
-
getPageLimit
public int getPageLimit()Returns the maximum number of pages that should be maintained in this part. When an attempt is made to add more pages, old pages are removed and disposed based on the order of creation (the oldest pages are removed). The exception is made for the page that should otherwise be disposed but is currently active.- Returns:
- maximum number of pages for this part
-
setPageLimit
public void setPageLimit(int pageLimit) Sets the page limit for this part.- Parameters:
pageLimit- the maximum number of pages that should be maintained in this part.- See Also:
-