Eclipse Platform
Release 3.0

org.eclipse.ui.forms.widgets
Class ScrolledForm

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Composite
                  extended byorg.eclipse.swt.custom.ScrolledComposite
                      extended byorg.eclipse.ui.forms.widgets.SharedScrolledComposite
                          extended byorg.eclipse.ui.forms.widgets.ScrolledForm
All Implemented Interfaces:
Drawable

public class ScrolledForm
extends SharedScrolledComposite

ScrolledForm is a control that is capable of scrolling an instance of the Form class. It should be created in a parent that will allow it to use all the available area (for example, a shell, a view or an editor).

Children of the form should typically be created using FormToolkit to match the appearance and behaviour. When creating children, use a form body as a parent by calling 'getBody()' on the form instance. Example:

  FormToolkit toolkit = new FormToolkit(parent.getDisplay());
  ScrolledForm form = toolkit.createScrolledForm(parent);
  form.setText("Sample form");
  form.getBody().setLayout(new GridLayout());
  toolkit.createButton(form.getBody(), "Checkbox", SWT.CHECK);
 

No layout manager has been set on the body. Clients are required to set the desired layout manager explicitly.

Although the class is not final, it is not expected to be be extended.

Since:
3.0

Field Summary
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
ScrolledForm(Composite parent)
           
ScrolledForm(Composite parent, int style)
          Creates the form control as a child of the provided parent.
 
Method Summary
 Image getBackgroundImage()
          Returns the optional background image of this form.
 Composite getBody()
          Returns the container that occupies the body of the form (the form area below the title).
 Form getForm()
          Returns the instance of the form owned by the scrolled form.
 String getText()
          Returns the title text that will be rendered at the top of the form.
 IToolBarManager getToolBarManager()
          Returns the tool bar manager that is used to manage tool items in the form's title area.
 void reflow(boolean flushCache)
          Recomputes the body layout and form scroll bars.
 void setBackground(Color bg)
          Sets the background color of the form.
 void setBackgroundImage(Image backgroundImage)
          Sets the optional background image to be rendered behind the title starting at the position 0,0.
 void setContent(Control c)
          The form sets the content widget.
 void setForeground(Color fg)
          Sets the foreground color of the form.
 void setMenu(Menu menu)
          Passes the menu to the body.
 void setText(String text)
          Sets the text to be rendered at the top of the form above the body as a title.
 void updateToolBar()
          Updates the local tool bar manager if used.
 
Methods inherited from class org.eclipse.ui.forms.widgets.SharedScrolledComposite
setFocus, setFont
 
Methods inherited from class org.eclipse.swt.custom.ScrolledComposite
computeSize, getAlwaysShowScrollBars, getContent, getOrigin, layout, setAlwaysShowScrollBars, setExpandHorizontal, setExpandVertical, setLayout, setMinHeight, setMinSize, setMinSize, setMinWidth, setOrigin, setOrigin
 
Methods inherited from class org.eclipse.swt.widgets.Composite
checkSubclass, getChildren, getLayout, getTabList, layout, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBounds, setBounds, setCapture, setCursor, setEnabled, setLayoutData, setLocation, setLocation, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScrolledForm

public ScrolledForm(Composite parent)

ScrolledForm

public ScrolledForm(Composite parent,
                    int style)
Creates the form control as a child of the provided parent.

Parameters:
parent - the parent widget
Method Detail

setMenu

public void setMenu(Menu menu)
Passes the menu to the body.

Overrides:
setMenu in class Control
Parameters:
menu -

getText

public String getText()
Returns the title text that will be rendered at the top of the form.

Returns:
the title text

setForeground

public void setForeground(Color fg)
Sets the foreground color of the form. This color will also be used for the body.

Overrides:
setForeground in class SharedScrolledComposite
Parameters:
fg - the new foreground color

setBackground

public void setBackground(Color bg)
Sets the background color of the form. This color will also be used for the body.

Overrides:
setBackground in class SharedScrolledComposite
Parameters:
bg - the new background color

setContent

public final void setContent(Control c)
The form sets the content widget. This method should not be called by classes that instantiate this widget.

Overrides:
setContent in class SharedScrolledComposite

setText

public void setText(String text)
Sets the text to be rendered at the top of the form above the body as a title.

Parameters:
text - the title text

getBackgroundImage

public Image getBackgroundImage()
Returns the optional background image of this form. The image is rendered starting at the position 0,0 and is painted behind the title.

Returns:
Returns the background image.

setBackgroundImage

public void setBackgroundImage(Image backgroundImage)
Sets the optional background image to be rendered behind the title starting at the position 0,0.

Parameters:
backgroundImage - The backgroundImage to set.

getToolBarManager

public IToolBarManager getToolBarManager()
Returns the tool bar manager that is used to manage tool items in the form's title area.

Returns:
form tool bar manager

updateToolBar

public void updateToolBar()
Updates the local tool bar manager if used. Does nothing if local tool bar manager has not been created yet.


reflow

public void reflow(boolean flushCache)
Recomputes the body layout and form scroll bars. The method should be used when changes somewhere in the form body invalidate the current layout and/or scroll bars.

Overrides:
reflow in class SharedScrolledComposite
Parameters:
flushCache - if true , drop any cached layout information and compute new one.

getBody

public Composite getBody()
Returns the container that occupies the body of the form (the form area below the title). Use this container as a parent for the controls that should be in the form. No layout manager has been set on the form body.

Returns:
Returns the body of the form.

getForm

public Form getForm()
Returns the instance of the form owned by the scrolled form.

Returns:
the form instance

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

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