org.eclipse.swt.custom
Class SashForm

java.lang.Object
  |
  +--org.eclipse.swt.widgets.Widget
        |
        +--org.eclipse.swt.widgets.Control
              |
              +--org.eclipse.swt.widgets.Scrollable
                    |
                    +--org.eclipse.swt.widgets.Composite
                          |
                          +--org.eclipse.swt.custom.SashForm
All Implemented Interfaces:
Drawable

public class SashForm
extends Composite

Safe: The SashForm lays out its children in a Row or Column arrangement (as specified by the orientation) and places a Sash between the children. One child may be maximized to occupy the entire size of the SashForm. The relative sizes of the children may be specfied using weights.

Styles:
HORIZONTAL, VERTICAL


Field Summary
private  Control[] controls
           
private static int DRAG_MINIMUM
           
private static String LAYOUT_RATIO
           
private  Control maxControl
           
private  int orientation
           
 int SASH_WIDTH
          Enabled:
private  Sash[] sashes
           
private  Listener sashListener
           
 
Fields inherited from class org.eclipse.swt.widgets.Composite
 
Fields inherited from class org.eclipse.swt.widgets.Scrollable
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
 
Constructor Summary
SashForm(Composite parent, int style)
          Enabled: Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
 
Method Summary
private static int checkStyle(int style)
           
 Point computeSize(int wHint, int hHint, boolean changed)
          Enabled:
private  Control[] getControls(boolean onlyVisible)
           
 Control getMaximizedControl()
          Enabled: Answer the control that currently is maximized in the SashForm.
 int getOrientation()
          Enabled: Returns SWT.HORIZONTAL if the controls in the SashForm are laid out side by side or SWT.VERTICAL if the controls in the SashForm are laid out top to bottom.
 int[] getWeights()
          Enabled: Answer the relative weight of each child in the SashForm.
 void layout(boolean changed)
          Enabled:
private  void onDragSash(Event event)
           
 void setLayout(Layout layout)
          Enabled:
 void setMaximizedControl(Control control)
          Enabled: Specify the control that should take up the entire client area of the SashForm.
 void setOrientation(int orientation)
          Enabled: If orientation is SWT.HORIZONTAL, lay the controls in the SashForm out side by side.
 void setWeights(int[] weights)
          Enabled: Specify the relative weight of each child in the SashForm.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
checkSubclass, getChildren, getLayout, getTabList, layout, moveAbove, moveBelow, setFocus, 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, getDisplay, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isDisposed, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, transferActive, transferFocus, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getStyle, 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
 

Field Detail

SASH_WIDTH

public int SASH_WIDTH
Enabled:


DRAG_MINIMUM

private static final int DRAG_MINIMUM

orientation

private int orientation

sashes

private Sash[] sashes

controls

private Control[] controls

maxControl

private Control maxControl

sashListener

private Listener sashListener

LAYOUT_RATIO

private static final String LAYOUT_RATIO
Constructor Detail

SashForm

public SashForm(Composite parent,
                int style)
Enabled: Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

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.

Parameters:
parent - a widget which will be the parent of the new instance (cannot be null)
style - the style of widget to construct
See Also:
SWT.HORIZONTAL, SWT.VERTICAL, Widget.getStyle()
Method Detail

checkStyle

private static int checkStyle(int style)

computeSize

public Point computeSize(int wHint,
                         int hHint,
                         boolean changed)
Enabled:

Overrides:
computeSize in class Composite
Parameters:
wHint - the width hint (can be SWT.DEFAULT)
hHint - the height hint (can be SWT.DEFAULT)
changed - true if the control's contents have changed, and false otherwise
Returns:
the preferred size of the control.
See Also:
Layout, Control.getBorderWidth(), Control.getBounds(), Control.getSize(), Control.pack(), "computeTrim, getClientArea for controls that implement them"

getOrientation

public int getOrientation()
Enabled: Returns SWT.HORIZONTAL if the controls in the SashForm are laid out side by side or SWT.VERTICAL if the controls in the SashForm are laid out top to bottom.

Returns:
SWT.HORIZONTAL or SWT.VERTICAL

getMaximizedControl

public Control getMaximizedControl()
Enabled: Answer the control that currently is maximized in the SashForm. This value may be null.

Returns:
the control that currently is maximized or null

getWeights

public int[] getWeights()
Enabled: Answer the relative weight of each child in the SashForm. The weight represents the percent of the total width (if SashForm has Horizontal orientation) or total height (if SashForm has Vertical orientation) each control occupies. The weights are returned in order of the creation of the widgets (weight[0] corresponds to the weight of the first child created).

Returns:
the relative weight of each child

getControls

private Control[] getControls(boolean onlyVisible)

layout

public void layout(boolean changed)
Enabled:

Overrides:
layout in class Composite
Parameters:
changed - true if the layout must flush its caches, and false otherwise

onDragSash

private void onDragSash(Event event)

setOrientation

public void setOrientation(int orientation)
Enabled: If orientation is SWT.HORIZONTAL, lay the controls in the SashForm out side by side. If orientation is SWT.VERTICAL, lay the controls in the SashForm out top to bottom.

Parameters:
orientation - SWT.HORIZONTAL or SWT.VERTICAL

setLayout

public void setLayout(Layout layout)
Enabled:

Overrides:
setLayout in class Composite
Parameters:
layout - the receiver's new layout or null

setMaximizedControl

public void setMaximizedControl(Control control)
Enabled: Specify the control that should take up the entire client area of the SashForm. If one control has been maximized, and this method is called with a different control, the previous control will be minimized and the new control will be maximized.. if the value of control is null, the SashForm will minimize all controls and return to the default layout where all controls are laid out separated by sashes.

Parameters:
control - the control to be maximized or null

setWeights

public void setWeights(int[] weights)
Enabled: Specify the relative weight of each child in the SashForm. This will determine what percent of the total width (if SashForm has Horizontal orientation) or total height (if SashForm has Vertical orientation) each control will occupy. The weights must be positive values and there must be an entry for each non-sash child of the SashForm.

Parameters:
weights - the relative weight of each child


comments?