TPTP 4.5.0 Platform Project
Public API Specification

org.eclipse.hyades.uml2sd.ui.view
Class ScrollView

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.eclipse.hyades.uml2sd.ui.view.ScrollView
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
Direct Known Subclasses:
SDWidget, TimeCompressionBar

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
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.
ScrollView(org.eclipse.swt.widgets.Composite c, int style, boolean mouseWheel)
          Create a ScrollView, child of composite c.
 
Method Summary
 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)
           
 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()
           
 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 isVisible(int _px, int _py)
           
 boolean isVisible(int _x, int _y, int _w, int _h)
           
 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 setCursor(org.eclipse.swt.graphics.Cursor cursor)
           
 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.
 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, 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, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackgroundImage, setBounds, setBounds, setCapture, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
equals, 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

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

ScrollView

public ScrollView(org.eclipse.swt.widgets.Composite c,
                  int style,
                  boolean mouseWheel)
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
mouseWheel - force scrollView to handles mouse wheel
Method Detail

setFocus

public boolean setFocus()
Overrides:
setFocus in class org.eclipse.swt.widgets.Composite

setCursor

public void setCursor(org.eclipse.swt.graphics.Cursor cursor)
Overrides:
setCursor in class org.eclipse.swt.widgets.Control

dispose

public void dispose()
Overrides:
dispose in class org.eclipse.swt.widgets.Widget

getClientArea

public org.eclipse.swt.graphics.Rectangle getClientArea()
Overrides:
getClientArea in class org.eclipse.swt.widgets.Composite
Returns:
client area of scrollview

setBackground

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

Overrides:
setBackground in class org.eclipse.swt.widgets.Control

setToolTipText

public void setToolTipText(java.lang.String text)
Overrides:
setToolTipText in class org.eclipse.swt.widgets.Control

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

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

resizeContents

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

Parameters:
w - new width of the area.
h - new height of the area.

redraw

public void redraw()
Overrides:
redraw in class org.eclipse.swt.widgets.Control

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)

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()
Overrides:
getVerticalBar in class org.eclipse.swt.widgets.Scrollable

getHorizontalBar

public org.eclipse.swt.widgets.ScrollBar getHorizontalBar()
Overrides:
getHorizontalBar in class org.eclipse.swt.widgets.Scrollable

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.

Parameters:
x -
y -
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.

Parameters:
x -
y -
Returns:
org.eclipse.swt.graphics.Point

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()

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)
Overrides:
computeTrim in class org.eclipse.swt.widgets.Scrollable

TPTP 4.5.0 Platform Project
Public API Specification