Package com._1c.g5.lwt.controls
Class AbstractScrollableControl
- java.lang.Object
-
- com._1c.g5.lwt.AbstractLightControl
-
- com._1c.g5.lwt.controls.AbstractScrollableControl
-
- All Implemented Interfaces:
ILightControl
- Direct Known Subclasses:
LightList
public abstract class AbstractScrollableControl extends AbstractLightControl
Instance of this class represents scrollable control. If control content can not fit in given bounds, scroll bars will appear. By moving scroll bars user could see all contol content. Scrollable control can be scrolled vertically and horizontally.
-
-
Constructor Summary
Constructors Constructor Description AbstractScrollableControl()
Constructor.AbstractScrollableControl(int style)
Constuctor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.swt.graphics.Rectangle
getClientArea()
Returns control bounds without scroll bars.protected abstract org.eclipse.swt.graphics.Point
getContentSize()
Returns size of control content.org.eclipse.swt.graphics.Point
getScrollPosition()
Returns scroll position.protected org.eclipse.swt.graphics.Point
getScrollRange()
Returns scroll range.protected int
getScrollsStyle()
Returns scrolls style.protected org.eclipse.swt.graphics.Rectangle
getViewportBounds()
Returns viewport bounds.void
handleEvent(org.eclipse.swt.widgets.Event event)
Handles the SWT event, SWT events are pumped to this method if this control is active.protected abstract void
handleTranslatedEvent(org.eclipse.swt.widgets.Event event)
Process event with translated coordinates.void
paint(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle)
Paints the given rectangle of this control.protected void
recalculateScrollRange()
Recalculates scroll range.void
scrollBy(int horizontalDelta, int verticalDelta)
Scroll horizontally and vertically by given amount.void
scrollHorizontallyBy(int delta)
Scroll horizontally by given amount.void
scrollHorizontallyTo(int x)
Scrolls horizontally to given coordinatevoid
scrollTo(int x, int y)
Scrolls control to given coordinates.void
scrollVerticallyBy(int delta)
Scroll vertically by given amount.void
scrollVerticallyTo(int y)
Scrolls vertically to given coordinatevoid
setBounds(org.eclipse.swt.graphics.Rectangle bounds)
Sets the bounds of this control.protected void
setScrollRange(org.eclipse.swt.graphics.Point scrollRange)
Sets scroll range.-
Methods inherited from class com._1c.g5.lwt.AbstractLightControl
addControlListener, computeSize, dispose, getBounds, getCursor, getData, getLayoutData, getOverlay, getParent, getTooltip, getVisibleBounds, invalidate, invalidate, isDisposed, isEnabled, isFocused, isVisible, removeControlListener, setCursor, setData, setEnabled, setFocus, setFocusable, setLayoutData, setOverlay, setParent, setTooltip, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com._1c.g5.lwt.ILightControl
initialize
-
-
-
-
Constructor Detail
-
AbstractScrollableControl
public AbstractScrollableControl()
Constructor. Constructs control with vertical and horizontal scroll bars.
-
AbstractScrollableControl
public AbstractScrollableControl(int style)
Constuctor.- Parameters:
style
- - scrolls style. Can beSWT.VERTICAL
andSWT.HORIZONTAL
, one of them orSWT.NONE
.- See Also:
SWT.VERTICAL
,SWT.HORIZONTAL
,SWT.NONE
-
-
Method Detail
-
getScrollPosition
public org.eclipse.swt.graphics.Point getScrollPosition()
Returns scroll position.- Returns:
- scroll position. Cannot return
null
.
-
setBounds
public void setBounds(org.eclipse.swt.graphics.Rectangle bounds)
Description copied from interface:ILightControl
Sets the bounds of this control.- Specified by:
setBounds
in interfaceILightControl
- Overrides:
setBounds
in classAbstractLightControl
- Parameters:
bounds
- the new bounds.
-
scrollBy
public void scrollBy(int horizontalDelta, int verticalDelta)
Scroll horizontally and vertically by given amount.- Parameters:
horizontalDelta
- - horizontal scroll amount.verticalDelta
- - vertical scroll amount.
-
scrollHorizontallyBy
public void scrollHorizontallyBy(int delta)
Scroll horizontally by given amount.- Parameters:
delta
- - scroll amount.
-
scrollVerticallyBy
public void scrollVerticallyBy(int delta)
Scroll vertically by given amount.- Parameters:
delta
- - scroll amount.
-
scrollTo
public void scrollTo(int x, int y)
Scrolls control to given coordinates.- Parameters:
x
- - x coordinate to scroll to.y
- - y coordinate to scroll to.
-
scrollHorizontallyTo
public void scrollHorizontallyTo(int x)
Scrolls horizontally to given coordinate- Parameters:
x
- - x coordinate to scroll to.
-
scrollVerticallyTo
public void scrollVerticallyTo(int y)
Scrolls vertically to given coordinate- Parameters:
y
- - y coordinate to scroll to.
-
handleEvent
public void handleEvent(org.eclipse.swt.widgets.Event event)
Description copied from interface:ILightControl
Handles the SWT event, SWT events are pumped to this method if this control is active.- Specified by:
handleEvent
in interfaceILightControl
- Overrides:
handleEvent
in classAbstractLightControl
- Parameters:
event
- the event to handle.- See Also:
ILightComposite.setActiveControl(ILightControl)
-
paint
public void paint(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle)
Description copied from interface:ILightControl
Paints the given rectangle of this control.- Parameters:
gc
- theGC
to paint on.rectangle
- the rectangle to paint.
-
getScrollsStyle
protected int getScrollsStyle()
Returns scrolls style.- Returns:
- scrolls style.
- See Also:
SWT.VERTICAL
,SWT.HORIZONTAL
,SWT.NONE
-
setScrollRange
protected void setScrollRange(org.eclipse.swt.graphics.Point scrollRange)
Sets scroll range. Should be set after control/content size change.- Parameters:
scrollRange
- - new scroll range.
-
getScrollRange
protected org.eclipse.swt.graphics.Point getScrollRange()
Returns scroll range.- Returns:
- scroll range. Cannot be
null
.
-
getViewportBounds
protected org.eclipse.swt.graphics.Rectangle getViewportBounds()
Returns viewport bounds. Viewport bounds - part of control which is visible right now.--------------- | | | ---- | | |vb| | | ---- | | | --------------- vb - viewport bounds.
- Returns:
- viewport bounds. Cannot return
null
.
-
getClientArea
protected org.eclipse.swt.graphics.Rectangle getClientArea()
Returns control bounds without scroll bars.- Returns:
- control bounds without scroll bars. Cannot return
null
.
-
handleTranslatedEvent
protected abstract void handleTranslatedEvent(org.eclipse.swt.widgets.Event event)
Process event with translated coordinates.- Parameters:
event
- - event to process. Cannot benull
.
-
getContentSize
protected abstract org.eclipse.swt.graphics.Point getContentSize()
Returns size of control content.- Returns:
- size of control content. Cannot return
null
.
-
recalculateScrollRange
protected void recalculateScrollRange()
Recalculates scroll range.
-
-