TPTP 4.2.0 Platform Project
Internal API Specification

org.eclipse.tptp.platform.report.ui.swt.widgets.internal
Class ScrollView

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.tptp.platform.report.ui.swt.widgets.internal.ScrollView
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
Direct Known Subclasses:
SWTViewer

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

ScrollView widget provides a scrolling area with on-demand scroll bars. Overview scrollable panel can be use (@see setOverviewEnabled()).


Field Summary
static int ALWAYS_OFF
           
static int ALWAYS_ON
           
static int AUTO
          Value for scroll bar mode, default is AUTO
protected  org.eclipse.swt.widgets.Control corner_control_
          control used in the bottom right corner @see setCornerControl() and @see setOverviewEnabled(true)
static int HBAR
           
static int VBAR
           
 
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
 
Constructor Summary
ScrollView(org.eclipse.swt.widgets.Composite c, int style)
          Create a ScrollView, child of composite c.
 
Method Summary
protected  boolean checkFocusOnChildren(org.eclipse.swt.widgets.Control child)
          Returns true if a child has the user focus Called by isFocusControl to check in deep
 int computeBarVisibility(int for_width, int for_height, boolean curr_h_vis, boolean curr_v_vis)
          compute visibility of vert/hor bar using given width/height and current visilibity (ie is barr size are alreay in for_xxx
 org.eclipse.swt.graphics.Rectangle computeTrim(int x, int y, int w, int h)
           
protected  void contentsMouseDoubleClickEvent(org.eclipse.swt.events.MouseEvent e)
          Called when user double on contents area.
protected  void contentsMouseDownEvent(org.eclipse.swt.events.MouseEvent e)
          Called when mouse is on contents area and button is pressed.
protected  void contentsMouseEnter(org.eclipse.swt.events.MouseEvent e)
          Called when the mouse enters the ScrollView area
protected  void contentsMouseExit(org.eclipse.swt.events.MouseEvent e)
          Called when the mouse exits the ScrollView area
protected  void contentsMouseHover(org.eclipse.swt.events.MouseEvent e)
          Called when the mouse hovers the ScrollView area after and system definied time
protected  void contentsMouseMoveEvent(org.eclipse.swt.events.MouseEvent _event)
          Called when mouse is on contents area and mode.
protected  void contentsMouseUpEvent(org.eclipse.swt.events.MouseEvent _event)
          Called when mouse is on contents area and button is released
 org.eclipse.swt.graphics.Point contentsToView(int _x, int _y)
          Transform (x,y) point from contents coordinates, to widget coordinates.
 int contentsToViewX(int _x)
          Transform X axis coordinates from contents to widgets.
 int contentsToViewY(int _y)
          Transform Y axis coordinates from contents to widgets.
 void dispose()
           
protected  void drawContents(org.eclipse.swt.graphics.GC gc, int clipx, int clipy, int clipw, int cliph)
          Responsible to draw contents area.
protected  void drawOverview(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle r)
          Draw overview area, @see setOverviewEnabled.
 void ensureVisible(int _px, int _py)
          Scroll to ensure point(in contents coordinates) is visible.
 void ensureVisible(int _x, int _y, int _w, int _h, int _align)
          Make rectangle (_x,_y,_w,_h, in contents coordinates) visible.
 org.eclipse.swt.graphics.Rectangle getClientArea()
           
 int getContentsHeight()
          Access method for the contentsHeight property.
 int getContentsWidth()
          Access method for the contentsWidth property.
 int getContentsX()
          Access method for the contentsX property.
 int getContentsY()
          Access method for the contentsY property.
 boolean getDragAutoScroll()
          Determines if the dragAutoScroll property is true.
 int getDragAutoScrollPeriod()
          Return auto scroll period.
 org.eclipse.swt.widgets.ScrollBar getHorizontalBar()
           
 int getHorizontalBarHeight()
           
 int getHScrollBarIncrement()
          Return horizontal scroll bar increment, default:1
 int getHScrollBarMode()
          Access method for the hScrollBarMode property.
 boolean getOverviewEnabled()
           
 int getOverviewSize()
           
 org.eclipse.swt.widgets.ScrollBar getVerticalBar()
           
 int getVerticalBarWidth()
           
 org.eclipse.swt.widgets.Control getViewControl()
           
 int getVisibleHeight()
           
 org.eclipse.swt.graphics.Rectangle getVisiblePart(int _x, int _y, int _w, int _h)
           
 org.eclipse.swt.graphics.Rectangle getVisiblePart(org.eclipse.swt.graphics.Rectangle _r)
           
 int getVisibleWidth()
           
 int getVScrollBarIncrement()
          Return vertical scroll bar increment, default:1
 int getVScrollBarMode()
          Access method for the vScrollBarMode property.
 boolean isFocusControl()
          Returns true if a child has the user focus
 boolean isVisible(int _px, int _py)
           
 boolean isVisible(int _x, int _y, int _w, int _h)
           
protected  void keyPressedEvent(org.eclipse.swt.events.KeyEvent _e)
          Add support for arrow key, scroll the ... scroll view.
protected  void keyReleasedEvent(org.eclipse.swt.events.KeyEvent _e)
          Redefine this method at your convenience
static void main(java.lang.String[] argv)
          Test for ScrollView.
 void redraw()
           
 void replaceControlListener(org.eclipse.swt.events.ControlListener nlistener)
          Remove the local Listener and add the new listener.
 void replaceKeyListener(org.eclipse.swt.events.KeyListener nlistener)
          Remove the local Listener and add the new listener.
 void replaceMouseListener(org.eclipse.swt.events.MouseListener nlistener)
          Remove the local Listener and add the new listener.
 void replaceMouseMoveListener(org.eclipse.swt.events.MouseMoveListener nlistener)
          Remove the local Listener and add the new listener.
 void replacePaintListener(org.eclipse.swt.events.PaintListener nlistener)
          Remove the local Listener and add the new listener.
 void resizeContents(int _w, int _h)
          Change the size of the contents area.
 void scrollBy(int _dx, int _dy)
           
 void setBackground(org.eclipse.swt.graphics.Color c)
          change background color of client area
 boolean setContentsPos(int _x, int _y)
          Change top left position of visible area.
 void setCornerControl(org.eclipse.swt.widgets.Control _w)
          Change the control used in the bottom right corner (between two scrollbar), if control is null reset previous corner control.
 void setDragAutoScroll(boolean aDragAutoScroll)
          Sets the value of the dragAutoScroll property.
 void setDragAutoScrollPeriod(int _period)
          Change delay (in millisec) used for auto scroll feature.
 boolean setFocus()
           
 void setHScrollBarIncrement(int _inc)
          Change horizontal scroll bar increment, minimum:1.
 void setHScrollBarMode(int aHScrollBarMode)
          Sets the value of the hScrollBarMode property.
 void setOverviewEnabled(boolean _b)
          Enable or disable overview feature.
 void setOverviewSize(int _size)
          Change overview size (at ratio 1:1), default is 100
 void setToolTipText(java.lang.String text)
           
 void setVScrollBarIncrement(int _inc)
          Change vertical scroll bar increment, minimum:1.
 void setVScrollBarMode(int aVScrollBarMode)
          Sets the value of the vScrollBarMode property.
protected  void viewResized()
          Called when ScrollView view is resized.
 org.eclipse.swt.graphics.Point viewToContents(int _x, int _y)
          Transform (x,y) point in widget coordinates to contents coordinates.
 int viewToContentsX(int _x)
          Transform x in widget coordinates to contents coodinates
 int viewToContentsY(int _y)
          Transform y in widget coordinates to contents coodinates
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
getBorderWidth
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, 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

AUTO

public static final int AUTO
Value for scroll bar mode, default is AUTO

See Also:
Constant Field Values

ALWAYS_OFF

public static final int ALWAYS_OFF
See Also:
Constant Field Values

ALWAYS_ON

public static final int ALWAYS_ON
See Also:
Constant Field Values

corner_control_

protected org.eclipse.swt.widgets.Control corner_control_
control used in the bottom right corner @see setCornerControl() and @see setOverviewEnabled(true)


VBAR

public static final int VBAR
See Also:
Constant Field Values

HBAR

public static final int HBAR
See Also:
Constant Field Values
Constructor Detail

ScrollView

public ScrollView(org.eclipse.swt.widgets.Composite c,
                  int style)
Create a ScrollView, child of composite c. Both scroll bar have the mode AUTO. Auto scroll feature is enabled using a delay of 250ms. Overview feature is not enabled by default (use setOverviewEnabled()).

Parameters:
c -
style - SWT style bits @see SWT
Method Detail

setFocus

public boolean setFocus()

dispose

public void dispose()

getClientArea

public org.eclipse.swt.graphics.Rectangle getClientArea()
Returns:
client area of scrollview

setBackground

public void setBackground(org.eclipse.swt.graphics.Color c)
change background color of client area


setToolTipText

public void setToolTipText(java.lang.String text)

drawOverview

protected void drawOverview(org.eclipse.swt.graphics.GC gc,
                            org.eclipse.swt.graphics.Rectangle r)
Draw overview area, @see setOverviewEnabled. By default draw a rectangle corresponding to the visible area of scrollview. You can redefine this method to draw the contents as drawContents does... ...in an other magnify factor.

Parameters:
gc - GC to used to draw.
r - Rectangle corresponding to the client area of overview.

replaceControlListener

public void replaceControlListener(org.eclipse.swt.events.ControlListener nlistener)
Remove the local Listener and add the new listener.

Parameters:
nlistener - the new listener

replaceKeyListener

public void replaceKeyListener(org.eclipse.swt.events.KeyListener nlistener)
Remove the local Listener and add the new listener.

Parameters:
nlistener - the new listener

replaceMouseListener

public void replaceMouseListener(org.eclipse.swt.events.MouseListener nlistener)
Remove the local Listener and add the new listener.

Parameters:
nlistener - the new listener

replaceMouseMoveListener

public void replaceMouseMoveListener(org.eclipse.swt.events.MouseMoveListener nlistener)
Remove the local Listener and add the new listener.

Parameters:
nlistener - the new listener

replacePaintListener

public void replacePaintListener(org.eclipse.swt.events.PaintListener nlistener)
Remove the local Listener and add the new listener.

Parameters:
nlistener - the new listener

getContentsHeight

public int getContentsHeight()
Access method for the contentsHeight property.

Returns:
the current value of the contentsHeight property

getContentsWidth

public int getContentsWidth()
Access method for the contentsWidth property.

Returns:
the current value of the contentsWidth property

getContentsX

public int getContentsX()
Access method for the contentsX property.

Returns:
the current value of the contentsX property

getContentsY

public int getContentsY()
Access method for the contentsY property.

Returns:
the current value of the contentsY property

getDragAutoScroll

public boolean getDragAutoScroll()
Determines if the dragAutoScroll property is true.

Returns:
true if the dragAutoScroll property is true

setDragAutoScroll

public void setDragAutoScroll(boolean aDragAutoScroll)
Sets the value of the dragAutoScroll property.

Parameters:
aDragAutoScroll - the new value of the dragAutoScroll property

setDragAutoScrollPeriod

public void setDragAutoScrollPeriod(int _period)
Change delay (in millisec) used for auto scroll feature.

Parameters:
_period - new period between to auto scroll

getDragAutoScrollPeriod

public int getDragAutoScrollPeriod()
Return auto scroll period.


getHScrollBarMode

public int getHScrollBarMode()
Access method for the hScrollBarMode property.

Returns:
the current value of the hScrollBarMode property

setHScrollBarMode

public void setHScrollBarMode(int aHScrollBarMode)
Sets the value of the hScrollBarMode property.

Parameters:
aHScrollBarMode - the new value of the hScrollBarMode property

getVScrollBarMode

public int getVScrollBarMode()
Access method for the vScrollBarMode property.

Returns:
the current value of the vScrollBarMode property

setVScrollBarMode

public void setVScrollBarMode(int aVScrollBarMode)
Sets the value of the vScrollBarMode property.

Parameters:
aVScrollBarMode - the new value of the vScrollBarMode property

getHScrollBarIncrement

public int getHScrollBarIncrement()
Return horizontal scroll bar increment, default:1


getVScrollBarIncrement

public int getVScrollBarIncrement()
Return vertical scroll bar increment, default:1


setHScrollBarIncrement

public void setHScrollBarIncrement(int _inc)
Change horizontal scroll bar increment, minimum:1. Page increment is always set to visible width.


setVScrollBarIncrement

public void setVScrollBarIncrement(int _inc)
Change vertical scroll bar increment, minimum:1. Page increment is always set to visible height.


setOverviewEnabled

public void setOverviewEnabled(boolean _b)
Enable or disable overview feature. Enabling overview, dispose and replace existing corner control by a button. Cliking in it open overview, move mouse cursor holding button to move scroll view and release button to hide overview. Tip: hold control and/or shift key while moving mouse when overview is open made fine scroll.

Parameters:
_b - true to engage overview feature
See Also:
setCornerControl()).

setOverviewSize

public void setOverviewSize(int _size)
Change overview size (at ratio 1:1), default is 100


getOverviewEnabled

public boolean getOverviewEnabled()
Returns:
true is overview feature is enabled

getOverviewSize

public int getOverviewSize()
Returns:
current overview size at ratio 1:1

getViewControl

public org.eclipse.swt.widgets.Control getViewControl()
Returns:
control used to display view (might not be this object). use this control to add/remove listener on the draw area

contentsMouseExit

protected void contentsMouseExit(org.eclipse.swt.events.MouseEvent e)
Called when the mouse exits the ScrollView area

Parameters:
e -

contentsMouseHover

protected void contentsMouseHover(org.eclipse.swt.events.MouseEvent e)
Called when the mouse hovers the ScrollView area after and system definied time

Parameters:
e -

contentsMouseEnter

protected void contentsMouseEnter(org.eclipse.swt.events.MouseEvent e)
Called when the mouse enters the ScrollView area

Parameters:
e -

contentsMouseDoubleClickEvent

protected void contentsMouseDoubleClickEvent(org.eclipse.swt.events.MouseEvent e)
Called when user double on contents area.

Parameters:
e -

contentsMouseDownEvent

protected void contentsMouseDownEvent(org.eclipse.swt.events.MouseEvent e)
Called when mouse is on contents area and button is pressed.

Parameters:
e -

contentsMouseMoveEvent

protected void contentsMouseMoveEvent(org.eclipse.swt.events.MouseEvent _event)
Called when mouse is on contents area and mode.

Parameters:
_event -

contentsMouseUpEvent

protected void contentsMouseUpEvent(org.eclipse.swt.events.MouseEvent _event)
Called when mouse is on contents area and button is released

Parameters:
_event -

drawContents

protected void drawContents(org.eclipse.swt.graphics.GC gc,
                            int clipx,
                            int clipy,
                            int clipw,
                            int cliph)
Responsible to draw contents area. At least rectangle clipX must be redrawn. This rectangle is given in contents coordinates. By default, no paint is produced.

Parameters:
gc -
clipx -
clipy -
clipw -
cliph -

resizeContents

public void resizeContents(int _w,
                           int _h)
Change the size of the contents area.


redraw

public void redraw()

scrollBy

public void scrollBy(int _dx,
                     int _dy)
Parameters:
_dx -
_dy -

ensureVisible

public void ensureVisible(int _px,
                          int _py)
Scroll to ensure point(in contents coordinates) is visible.


ensureVisible

public void ensureVisible(int _x,
                          int _y,
                          int _w,
                          int _h,
                          int _align)
Make rectangle (_x,_y,_w,_h, in contents coordinates) visible. if rectangle cannot be completly visible, use _align flags.

Parameters:
_x - x contents coordinates of rectangle.
_y - y contents coordinates of rectangle.
_w - width of rectangle.
_h - height of rectangle.
_align - bit or'ed SWT flag like SWT.LEFT,RIGHT,CENTER,TOP,BOTTOM,VERTICAL used only for bigger rectangle than visible area. By default CENTER/VERTICAL

isVisible

public boolean isVisible(int _px,
                         int _py)
Returns:
true if point is visible (expressed in contents coordinates)

isVisible

public boolean isVisible(int _x,
                         int _y,
                         int _w,
                         int _h)
Returns:
true if rectangle if partially visible.

getVisiblePart

public org.eclipse.swt.graphics.Rectangle getVisiblePart(int _x,
                                                         int _y,
                                                         int _w,
                                                         int _h)
Returns:
visible part of rectangle, or null if rectangle is not visible. rectangle is expressed in contents coordinates.

getVisiblePart

public final org.eclipse.swt.graphics.Rectangle getVisiblePart(org.eclipse.swt.graphics.Rectangle _r)
See Also:
getVisiblePart

setContentsPos

public boolean setContentsPos(int _x,
                              int _y)
Change top left position of visible area. Check if the given point is inside contents area.

Parameters:
_x -
_y -
Returns:
true if view really moves

getVerticalBar

public org.eclipse.swt.widgets.ScrollBar getVerticalBar()

getHorizontalBar

public org.eclipse.swt.widgets.ScrollBar getHorizontalBar()

computeBarVisibility

public int computeBarVisibility(int for_width,
                                int for_height,
                                boolean curr_h_vis,
                                boolean curr_v_vis)
compute visibility of vert/hor bar using given width/height and current visilibity (ie is barr size are alreay in for_xxx


setCornerControl

public void setCornerControl(org.eclipse.swt.widgets.Control _w)
Change the control used in the bottom right corner (between two scrollbar), if control is null reset previous corner control. This control is visible only if at leat one scrollbar is visible. Given control will be disposed by ScrollView, at dispose() time, at next setCornetControl() call or when calling setOverviewEnabled(). Pay attention calling this reset overview feature util setOverviewEnabled(true) if called.


viewToContents

public final org.eclipse.swt.graphics.Point viewToContents(int _x,
                                                           int _y)
Transform (x,y) point in widget coordinates to contents coordinates.

Returns:
org.eclipse.swt.graphics.Point

viewToContentsX

public int viewToContentsX(int _x)
Transform x in widget coordinates to contents coodinates


viewToContentsY

public int viewToContentsY(int _y)
Transform y in widget coordinates to contents coodinates


contentsToView

public final org.eclipse.swt.graphics.Point contentsToView(int _x,
                                                           int _y)
Transform (x,y) point from contents coordinates, to widget coordinates.

Returns:
org.eclipse.swt.graphics.Point
See Also:
contentsToViewX, contentsToViewY

contentsToViewX

public int contentsToViewX(int _x)
Transform X axis coordinates from contents to widgets.

Parameters:
_x - contents coordinate to transform
Returns:
coordinate in widget area

contentsToViewY

public int contentsToViewY(int _y)
Transform Y axis coordinates from contents to widgets.

Parameters:
_y - contents coordinate to transform
Returns:
coordinate in widget area

getVisibleHeight

public int getVisibleHeight()
Returns:
int the visible height of scroll view, might be > contentsHeight()

getVisibleWidth

public int getVisibleWidth()
Returns:
int the visible width of scroll view, might be > contentsWidth()

keyPressedEvent

protected void keyPressedEvent(org.eclipse.swt.events.KeyEvent _e)
Add support for arrow key, scroll the ... scroll view. But you can redefine this method for your convenience.


keyReleasedEvent

protected void keyReleasedEvent(org.eclipse.swt.events.KeyEvent _e)
Redefine this method at your convenience


viewResized

protected void viewResized()
Called when ScrollView view is resized.


getVerticalBarWidth

public int getVerticalBarWidth()
Returns:
vertical bar width, even if bar isn't visible

getHorizontalBarHeight

public int getHorizontalBarHeight()
Returns:
horizontal bar height even if bar isn't visible

computeTrim

public org.eclipse.swt.graphics.Rectangle computeTrim(int x,
                                                      int y,
                                                      int w,
                                                      int h)

main

public static void main(java.lang.String[] argv)
Test for ScrollView.


checkFocusOnChildren

protected boolean checkFocusOnChildren(org.eclipse.swt.widgets.Control child)
Returns true if a child has the user focus Called by isFocusControl to check in deep


isFocusControl

public boolean isFocusControl()
Returns true if a child has the user focus


TPTP 4.2.0 Platform Project
Internal API Specification