public class ManagedForm extends java.lang.Object implements IManagedForm
There is requirement for 1/1 mapping between widgets and form parts. A widget like Section can be a part by itself, but a number of widgets can join around one form part.
Note to developers: this class is left public to allow its use beyond the original intention (inside a multi-page editor's page). You should limit the use of this class to make new instances inside a form container (wizard page, dialog etc.). Clients that need access to the class should not do it directly. Instead, they should do it through IManagedForm interface as much as possible.
Constructor and Description |
---|
ManagedForm(org.eclipse.swt.widgets.Composite parent)
Creates a managed form in the provided parent.
|
ManagedForm(FormToolkit toolkit,
org.eclipse.swt.custom.ScrolledComposite form)
Creates a managed form that will use the provided toolkit and
|
Modifier and Type | Method and Description |
---|---|
void |
addPart(IFormPart part)
Adds the new part to the form.
|
void |
commit(boolean onSave)
Commits the dirty form.
|
void |
dirtyStateChanged()
Notifies the form that the dirty state of one of its parts has changed.
|
void |
dispose()
Disposes all the parts in this form.
|
void |
fireSelectionChanged(IFormPart part,
org.eclipse.jface.viewers.ISelection selection)
A part can use this method to notify other parts that implement
IPartSelectionListener about selection changes.
|
java.lang.Object |
getContainer()
Returns the container of this form.
|
org.eclipse.swt.custom.ScrolledComposite |
getForm()
Returns the form widget managed by this form.
|
java.lang.Object |
getInput()
Returns the current page input.
|
IFormPart[] |
getParts()
Returns all the parts currently managed by this form.
|
FormToolkit |
getToolkit()
Returns the toolkit used by this form.
|
void |
initialize()
Initializes the form by looping through the managed parts and
initializing them.
|
boolean |
isDirty()
Tests if form is dirty.
|
boolean |
isStale()
Tests if form is stale.
|
void |
reflow(boolean changed)
Reflows the form as a result of the layout change.
|
void |
refresh()
Refreshes the form by refreshes all the stale parts.
|
void |
removePart(IFormPart part)
Removes the part from the form.
|
void |
setContainer(java.lang.Object container)
Sets the container that owns this form.
|
void |
setFocus()
Transfers the focus to the first form part.
|
boolean |
setInput(java.lang.Object input)
Sets the input of this page to the provided object.
|
void |
staleStateChanged()
Notifies the form that the stale state of one of its parts has changed.
|
public ManagedForm(org.eclipse.swt.widgets.Composite parent)
parent
- the parent widgetpublic ManagedForm(FormToolkit toolkit, org.eclipse.swt.custom.ScrolledComposite form)
toolkit
- form
- public void addPart(IFormPart part)
IManagedForm
addPart
in interface IManagedForm
part
- the part to addpublic void removePart(IFormPart part)
IManagedForm
removePart
in interface IManagedForm
part
- the part to removepublic IFormPart[] getParts()
IManagedForm
getParts
in interface IManagedForm
public FormToolkit getToolkit()
IManagedForm
getToolkit
in interface IManagedForm
public org.eclipse.swt.custom.ScrolledComposite getForm()
IManagedForm
getForm
in interface IManagedForm
public void reflow(boolean changed)
IManagedForm
reflow
in interface IManagedForm
changed
- if true
, discard cached layout informationpublic void fireSelectionChanged(IFormPart part, org.eclipse.jface.viewers.ISelection selection)
fireSelectionChanged
in interface IManagedForm
part
- the part that broadcasts the selectionselection
- the selection in the partIPartSelectionListener
public void initialize()
initialize
in interface IManagedForm
public void dispose()
public void refresh()
Display.syncExec
or
asyncExec
.refresh
in interface IManagedForm
public void commit(boolean onSave)
IManagedForm
commit
in interface IManagedForm
public boolean setInput(java.lang.Object input)
IManagedForm
setInput
in interface IManagedForm
input
- the new page inputtrue
if the form contains this object,
false
otherwise.public java.lang.Object getInput()
IManagedForm
getInput
in interface IManagedForm
null
if not applicable.public void setFocus()
public boolean isDirty()
IManagedForm
isDirty
in interface IManagedForm
true
if at least one managed part is dirty,
false
otherwise.public boolean isStale()
IManagedForm
isStale
in interface IManagedForm
true
if the form is stale, false
otherwise.public void dirtyStateChanged()
IManagedForm
dirtyStateChanged
in interface IManagedForm
IManagedForm.isDirty()
public void staleStateChanged()
IManagedForm
staleStateChanged
in interface IManagedForm
public java.lang.Object getContainer()
IManagedForm
getContainer
in interface IManagedForm
public void setContainer(java.lang.Object container)
IManagedForm
setContainer
in interface IManagedForm
container
- the container of this formCopyright © 2007–2020. All rights reserved.