Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.ui.forms
Class ManagedForm

    java.lang.Object
      org.eclipse.ui.forms.ManagedForm

All Implemented Interfaces:
  IManagedForm

public class ManagedForm
extends Object
implements IManagedForm

Managed form wraps a form widget and adds life cycle methods for form parts. A form part is a portion of the form that participates in form life cycle events.

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.

Since:
  3.0

Constructor Summary
`ManagedForm(Composite parent)` Creates a managed form in the provided parent.
`ManagedForm(FormToolkit toolkit, ScrolledForm form)` Creates a managed form that will use the provided toolkit and

Method Summary
`void` | `addPart(IFormPart part)` Add a part to be managed by this form.
`void` | `commit(boolean onSave)` Commits the form by commiting all the dirty parts to the model.
`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, ISelection selection)` A part can use this method to notify other parts that implement IPartSelectionListener about selection changes.
`Object` | `getContainer()` Returns the container of this form.
`ScrolledForm` | `getForm()` Returns the form widget managed by this form.
`Object` | `getInput()` Returns the current page input.
`IFormPart[]` | `getParts()` Returns all the parts current managed by this form.
`FormToolkit` | `getToolkit()` Returns the toolkit used by this form.
`void` | `initialize()` Initializes all the parts in this form.
`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 a layout change.
`void` | `refresh()` Refreshes the form by refreshes all the stale parts.
`void` | `removePart(IFormPart part)` Remove the part from this form.
`void` | `setContainer(Object container)` Sets the container that owns this form.
`void` | `setFocus()` Transfers the focus to the first form part.
`boolean` | `setInput(Object input)` Sets the form input.
`void` | `staleStateChanged()` Notifies the form that the stale state of one of its parts has changed.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ManagedForm

    public ManagedForm(Composite parent)

  Creates a managed form in the provided parent. Form toolkit and widget will be created and owned by this object.

Parameters:
  `parent` - the parent widget

### ManagedForm

    public ManagedForm(FormToolkit toolkit,
                       ScrolledForm form)

  Creates a managed form that will use the provided toolkit and

Parameters:
  `toolkit` -
  `form` -

Method Detail

### addPart

    public void addPart(IFormPart part)

  Add a part to be managed by this form.

  Specified by:
    `addPart` in interface `IManagedForm`
  Parameters:
    `part` - part to add

### removePart

    public void removePart(IFormPart part)

  Remove the part from this form.

  Specified by:
    `removePart` in interface `IManagedForm`
  Parameters:
    `part` - part to remove

### getParts

    public IFormPart[] getParts()

  Returns all the parts current managed by this form.

  Specified by:
    `getParts` in interface `IManagedForm`
  Returns:
    the managed parts

### getToolkit

    public FormToolkit getToolkit()

  Returns the toolkit used by this form.

  Specified by:
    `getToolkit` in interface `IManagedForm`
  Returns:
    the toolkit

### getForm

    public ScrolledForm getForm()

  Returns the form widget managed by this form.

  Specified by:
    `getForm` in interface `IManagedForm`
  Returns:
    the form widget

### reflow

    public void reflow(boolean changed)

  Reflows the form as a result of a layout change.

  Specified by:
    `reflow` in interface `IManagedForm`
  Parameters:
    `changed` - if `true`, discard cached layout information

### fireSelectionChanged

    public void fireSelectionChanged(IFormPart part,
                                     ISelection selection)

  A part can use this method to notify other parts that implement IPartSelectionListener about selection changes.

  Specified by:
    `fireSelectionChanged` in interface `IManagedForm`
  Parameters:
    `part` - the part that broadcasts the selection
    `selection` - the selection in the part
  See Also:
    `IPartSelectionListener`

### initialize

    public void initialize()

  Initializes all the parts in this form.

### dispose

    public void dispose()

  Disposes all the parts in this form.

### refresh

    public void refresh()

  Refreshes the form by refreshes all the stale parts.

  Specified by:
    `refresh` in interface `IManagedForm`

### commit

    public void commit(boolean onSave)

  Commits the form by commiting all the dirty parts to the model.

  Specified by:
    `commit` in interface `IManagedForm`
  Parameters:
    `onSave` -

### setInput

    public boolean setInput(Object input)

  Sets the form input. Managed parts could opt to react to it by selecting and/or revealing the object if they contain it.

  Specified by:
    `setInput` in interface `IManagedForm`
  Parameters:
    `input` - the input object
  Returns:
    `true` if the form contains this object, `false` otherwise.

### getInput

    public Object getInput()

  Description copied from interface: `IManagedForm`
  Returns the current page input.

  Specified by:
    `getInput` in interface `IManagedForm`
  Returns:
    page input object or `null` if not applicable.

### setFocus

    public void setFocus()

  Transfers the focus to the first form part.

### isDirty

    public boolean isDirty()

  Description copied from interface: `IManagedForm`
  Tests if form is dirty. A managed form is dirty if at least one managed part is dirty.

  Specified by:
    `isDirty` in interface `IManagedForm`
  Returns:
    `true` if at least one managed part is dirty, `false` otherwise.

### isStale

    public boolean isStale()

  Description copied from interface: `IManagedForm`
  Tests if form is stale. A managed form is stale if at least one managed part is stale. This can happen when the underlying model changes, resulting in the presentation of the part being out of sync with the model and needing refreshing.

  Specified by:
    `isStale` in interface `IManagedForm`
  Returns:
    `true` if the form is stale, `false` otherwise.

### dirtyStateChanged

    public void dirtyStateChanged()

  Description copied from interface: `IManagedForm`
  Notifies the form that the dirty state of one of its parts has changed. The global dirty state of the form can be obtained by calling 'isDirty'.

  Specified by:
    `dirtyStateChanged` in interface `IManagedForm`
  See Also:
    `IManagedForm.dirtyStateChanged()`

### staleStateChanged

    public void staleStateChanged()

  Description copied from interface: `IManagedForm`
  Notifies the form that the stale state of one of its parts has changed. The global stale state of the form can be obtained by calling 'isStale'.

  Specified by:
    `staleStateChanged` in interface `IManagedForm`
  See Also:
    `IManagedForm.staleStateChanged()`

### getContainer

    public Object getContainer()

  Description copied from interface: `IManagedForm`
  Returns the container of this form.

  Specified by:
    `getContainer` in interface `IManagedForm`
  Returns:
    Returns the container.

### setContainer

    public void setContainer(Object container)

  Description copied from interface: `IManagedForm`
  Sets the container that owns this form. Depending on the context, the container may be wizard, editor page, editor etc.

  Specified by:
    `setContainer` in interface `IManagedForm`
  Parameters:
    `container` - The container to set.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.