net.sourceforge.rssowl.controller
Class ViewForm

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 bynet.sourceforge.rssowl.controller.ViewForm
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable

public class ViewForm
extends org.eclipse.swt.widgets.Composite

Instances of this class implement a Composite that lays out three children horizontally and allows programmatic control of layout and border parameters. ViewForm is used in the workbench to implement a view's label/menu/toolbar local bar.

Note that although this class is a subclass of Composite, it does not make sense to set a layout on it.

Styles:
BORDER, FLAT
Events:
(None)

IMPORTANT: This class is not intended to be subclassed.


Field Summary
private  int BORDER_BOTTOM
           
private  int BORDER_LEFT
           
private  int BORDER_RIGHT
           
private  int BORDER_TOP
           
private  org.eclipse.swt.graphics.Color borderColor1
           
private  org.eclipse.swt.graphics.Color borderColor2
           
private  org.eclipse.swt.graphics.Color borderColor3
           
static org.eclipse.swt.graphics.RGB borderInsideRGB
          Color of innermost line of drop shadow border.
static org.eclipse.swt.graphics.RGB borderMiddleRGB
          Color of middle line of drop shadow border.
static org.eclipse.swt.graphics.RGB borderOutsideRGB
          Color of outermost line of drop shadow border.
private  org.eclipse.swt.widgets.Control content
           
private  boolean draw3DBorder
           
private  int drawLine1
           
private  int drawLine2
           
 int marginHeight
          marginHeight specifies the number of pixels of vertical margin that will be placed along the top and bottom edges of the form.
 int marginWidth
          marginWidth specifies the number of pixels of horizontal margin that will be placed along the left and right edges of the form.
private static int OFFSCREEN
           
private  org.eclipse.swt.graphics.Rectangle oldArea
           
private  boolean onlyBorderBottom
           
private  boolean onlyBorderTop
           
private  boolean onlyBorderTopBottom
           
private  boolean separateTopCenter
           
private  boolean showBorder
           
private  org.eclipse.swt.widgets.Control topCenter
           
private  org.eclipse.swt.widgets.Control topLeft
          SWT widgets
private  org.eclipse.swt.widgets.Control topRight
           
 
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
ViewForm(org.eclipse.swt.widgets.Composite parent, int style)
          Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
 
Method Summary
(package private) static int checkStyle(int style)
           
 org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
           
 org.eclipse.swt.graphics.Rectangle computeTrim(int x, int y, int width, int height)
           
 org.eclipse.swt.graphics.Rectangle getClientArea()
           
 org.eclipse.swt.widgets.Control getContent()
          Returns the content area.
 org.eclipse.swt.widgets.Control getTopCenter()
          Returns Control that appears in the top center of the pane.
 org.eclipse.swt.widgets.Control getTopLeft()
          Returns the Control that appears in the top left corner of the pane.
 org.eclipse.swt.widgets.Control getTopRight()
          Returns the control in the top right corner of the pane.
 void layout(boolean changed)
           
(package private)  void onDispose()
           
(package private)  void onPaint(org.eclipse.swt.graphics.GC gc)
           
(package private)  void onResize()
           
 void set3DBorderState(boolean show)
          Show / Hide the 3D Border of the ViewForm
 void setBorderVisible(boolean show)
          Specify whether the border should be displayed or not.
 void setContent(org.eclipse.swt.widgets.Control content, boolean layout)
          Sets the content.
 void setFont(org.eclipse.swt.graphics.Font f)
           
 void setLayout(org.eclipse.swt.widgets.Layout layout)
          Sets the layout which is associated with the receiver to be the argument which may be null.
 void setOnlyBorderBottom(boolean onlyBorderBottom)
          Set that the ViewForm should only paint a single border on bottom.
 void setOnlyBorderTop(boolean onlyBorderTop)
          Set that the ViewForm should only paint a single border on top.
 void setOnlyBorderTopBottom(boolean onlyBorderTopBottom)
          Set that the ViewForm should only paint a single border on top and bottom.
 void setTopCenter(org.eclipse.swt.widgets.Control topCenter, boolean layout)
          Set the control that appears in the top center of the pane.
 void setTopCenterSeparate(boolean show, boolean layout)
          If true, the topCenter will always appear on a separate line by itself, otherwise the topCenter will appear in the top row if there is room and will be moved to the second row if required.
 void setTopLeft(org.eclipse.swt.widgets.Control c, boolean layout)
          Set the control that appears in the top left corner of the pane.
 void setTopRight(org.eclipse.swt.widgets.Control c, boolean layout)
          Set the control that appears in the top right corner of the pane.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, setFocus, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
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, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, 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
 

Field Detail

borderInsideRGB

public static org.eclipse.swt.graphics.RGB borderInsideRGB
Color of innermost line of drop shadow border.


borderMiddleRGB

public static org.eclipse.swt.graphics.RGB borderMiddleRGB
Color of middle line of drop shadow border.


borderOutsideRGB

public static org.eclipse.swt.graphics.RGB borderOutsideRGB
Color of outermost line of drop shadow border.


OFFSCREEN

private static final int OFFSCREEN
See Also:
Constant Field Values

marginHeight

public int marginHeight
marginHeight specifies the number of pixels of vertical margin that will be placed along the top and bottom edges of the form. The default value is 0.


marginWidth

public int marginWidth
marginWidth specifies the number of pixels of horizontal margin that will be placed along the left and right edges of the form. The default value is 0.


BORDER_BOTTOM

private int BORDER_BOTTOM

BORDER_LEFT

private int BORDER_LEFT

BORDER_RIGHT

private int BORDER_RIGHT

BORDER_TOP

private int BORDER_TOP

borderColor1

private org.eclipse.swt.graphics.Color borderColor1

borderColor2

private org.eclipse.swt.graphics.Color borderColor2

borderColor3

private org.eclipse.swt.graphics.Color borderColor3

content

private org.eclipse.swt.widgets.Control content

draw3DBorder

private boolean draw3DBorder

drawLine1

private int drawLine1

drawLine2

private int drawLine2

oldArea

private org.eclipse.swt.graphics.Rectangle oldArea

onlyBorderBottom

private boolean onlyBorderBottom

onlyBorderTop

private boolean onlyBorderTop

onlyBorderTopBottom

private boolean onlyBorderTopBottom

separateTopCenter

private boolean separateTopCenter

showBorder

private boolean showBorder

topCenter

private org.eclipse.swt.widgets.Control topCenter

topLeft

private org.eclipse.swt.widgets.Control topLeft
SWT widgets


topRight

private org.eclipse.swt.widgets.Control topRight
Constructor Detail

ViewForm

public ViewForm(org.eclipse.swt.widgets.Composite parent,
                int style)
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
Throws:
IllegalArgumentException -
org.eclipse.swt.SWTException -
See Also:
SWT.BORDER, SWT.FLAT, Widget.getStyle()
Method Detail

checkStyle

static int checkStyle(int style)

computeSize

public org.eclipse.swt.graphics.Point computeSize(int wHint,
                                                  int hHint,
                                                  boolean changed)

computeTrim

public org.eclipse.swt.graphics.Rectangle computeTrim(int x,
                                                      int y,
                                                      int width,
                                                      int height)

getClientArea

public org.eclipse.swt.graphics.Rectangle getClientArea()

getContent

public org.eclipse.swt.widgets.Control getContent()
Returns the content area.

Returns:
the control in the content area of the pane or null

getTopCenter

public org.eclipse.swt.widgets.Control getTopCenter()
Returns Control that appears in the top center of the pane. Typically this is a toolbar.

Returns:
the control in the top center of the pane or null

getTopLeft

public org.eclipse.swt.widgets.Control getTopLeft()
Returns the Control that appears in the top left corner of the pane. Typically this is a label such as CLabel.

Returns:
the control in the top left corner of the pane or null

getTopRight

public org.eclipse.swt.widgets.Control getTopRight()
Returns the control in the top right corner of the pane. Typically this is a Close button or a composite with a Menu and Close button.

Returns:
the control in the top right corner of the pane or null

layout

public void layout(boolean changed)

set3DBorderState

public void set3DBorderState(boolean show)
Show / Hide the 3D Border of the ViewForm

Parameters:
show - If TRUE, show the 3D Boreder

setBorderVisible

public void setBorderVisible(boolean show)
Specify whether the border should be displayed or not.

Parameters:
show - true if the border should be displayed
Throws:
org.eclipse.swt.SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

setContent

public void setContent(org.eclipse.swt.widgets.Control content,
                       boolean layout)
Sets the content. Setting the content to null will remove it from the pane - however, the creator of the content must dispose of the content.

Parameters:
content - the control to be displayed in the content area or null
layout - If TRUE, layout the ViewForm
Throws:
org.eclipse.swt.SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm

setFont

public void setFont(org.eclipse.swt.graphics.Font f)

setLayout

public void setLayout(org.eclipse.swt.widgets.Layout layout)
Sets the layout which is associated with the receiver to be the argument which may be null.

Note : ViewForm does not use a layout class to size and position its children.

Parameters:
layout - the receiver's new layout or null
Throws:
org.eclipse.swt.SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

setOnlyBorderBottom

public void setOnlyBorderBottom(boolean onlyBorderBottom)
Set that the ViewForm should only paint a single border on bottom. This hint does only work when SWT.FLAT is also passed to the ViewForm.

Parameters:
onlyBorderBottom - If TRUE only paint a single, bottom border

setOnlyBorderTop

public void setOnlyBorderTop(boolean onlyBorderTop)
Set that the ViewForm should only paint a single border on top. This hint does only work when SWT.FLAT is also passed to the ViewForm.

Parameters:
onlyBorderTop - If TRUE only paint a single, top border

setOnlyBorderTopBottom

public void setOnlyBorderTopBottom(boolean onlyBorderTopBottom)
Set that the ViewForm should only paint a single border on top and bottom. This hint does only work when SWT.FLAT is also passed to the ViewForm.

Parameters:
onlyBorderTopBottom - If TRUE only paint a single, bottom border

setTopCenter

public void setTopCenter(org.eclipse.swt.widgets.Control topCenter,
                         boolean layout)
Set the control that appears in the top center of the pane. Typically this is a toolbar. The topCenter is optional. Setting the topCenter to null will remove it from the pane - however, the creator of the topCenter must dispose of the topCenter.

Parameters:
topCenter - the control to be displayed in the top center or null
layout - If TRUE, layout the ViewForm
Throws:
org.eclipse.swt.SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm

setTopCenterSeparate

public void setTopCenterSeparate(boolean show,
                                 boolean layout)
If true, the topCenter will always appear on a separate line by itself, otherwise the topCenter will appear in the top row if there is room and will be moved to the second row if required.

Parameters:
show - true if the topCenter will always appear on a separate line by itself
layout - If TRUE, layout the ViewForm
Throws:
org.eclipse.swt.SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

setTopLeft

public void setTopLeft(org.eclipse.swt.widgets.Control c,
                       boolean layout)
Set the control that appears in the top left corner of the pane. Typically this is a label such as CLabel. The topLeft is optional. Setting the top left control to null will remove it from the pane - however, the creator of the control must dispose of the control.

Parameters:
c - the control to be displayed in the top left corner or null
layout - If TRUE, layout the ViewForm
Throws:
org.eclipse.swt.SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm

setTopRight

public void setTopRight(org.eclipse.swt.widgets.Control c,
                        boolean layout)
Set the control that appears in the top right corner of the pane. Typically this is a Close button or a composite with a Menu and Close button. The topRight is optional. Setting the top right control to null will remove it from the pane - however, the creator of the control must dispose of the control.

Parameters:
c - the control to be displayed in the top right corner or null
layout - If TRUE, layout the ViewForm
Throws:
org.eclipse.swt.SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm

onDispose

void onDispose()

onPaint

void onPaint(org.eclipse.swt.graphics.GC gc)

onResize

void onResize()


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo