|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.yospace.yae.yogi.YogiComponent
|
+--com.yospace.yae.yogi.YogiScrollContentPane
The generic scrolling component. When asked to scroll by a number of units (eg rows) or blocks (eg screens), it relocates all its children so as to give the impression of a scrollable area.
The scrollpane can move both horizontally and vertically.
The size of a unit and a block is configurable in both directions.
Generally, if a method is working in rows and columns, then its args are in (rows, cols) order. If it is working in pixels, then they are in (x, y) order.
| Field Summary | |
static int |
MODE_CONTRACTED
Constant representing contracted mode. |
static int |
MODE_MAXIMIZED
Constant representing maximized mode. |
static int |
PROPERTY_CHILD_COMPONENT
Constant for the child component property |
static int |
PROPERTY_SCROLL_HORIZONTAL
Constant for the horizontal scroll property |
static int |
PROPERTY_SCROLL_VERTICAL
Constant for the vertical scroll property |
| Constructor Summary | |
YogiScrollContentPane()
Default constructor which initialises the scroll offset to the top-left corner, (0,0). |
|
| Method Summary | |
void |
add(YogiComponent c)
Overrides the YogiComponent.add(YogiComponent c) method, in order to notify the parent
YogiScrollPane when the child component changes. |
protected void |
ensureVisible(YogiComponent child,
int fx,
int fy,
int fw,
int fh)
This method ensures that the specified region is visible by scrolling as far as it can in both directions until the region is in view. |
int |
getColor(int index)
Overrides YogiComponent.getColor(int) to ensure
that the content pane has the same background color as the parent
YogiScrollPane. |
int |
getHorizontalMode()
Gets the horizontal mode of the content pane. |
int |
getHorizontalOffset()
Gets the current horizontal pixel offset. |
protected int |
getHorizViewSize(YogiScrollPane scrollPane,
YogiScrollBar horizScroller,
YogiScrollBar vertScroller)
Calculates the size of the horizontal scrollbar, expressed as a precentage of the size of the displayed component to the content pane. |
protected int |
getMaxComponentHeight()
Used to calculate the maximum height of a component contained within the scroll content pane. |
protected int |
getMaxComponentWidth()
Used to calculate the maximum width of a component contained within the scroll content pane. |
protected int |
getMaximumHorizontalScrollOffset()
This method is used internally to discover the largest horizontal index that can be scrolled to by the ScrollPane. |
protected int |
getMaximumVerticalScrollOffset()
This method is used internally to discover the largest vertical index that can be scrolled to by the ScrollPane. |
int |
getVerticalMode()
Gets the vertical mode of the content pane. |
int |
getVerticalOffset()
Gets the current vertical pixel offset. |
protected int |
getVertViewSize(YogiScrollPane scrollPane,
YogiScrollBar vertScroller,
YogiScrollBar horizScroller)
Calculates the size of the vertical scrollbar, expressed as a precentage of the size of the displayed component to the content pane. |
void |
propertyChanged(java.lang.Object source,
int property)
Implements the PropertyChangeListener interface. |
void |
remove(YogiComponent c)
Overrides the YogiComponent.remove(YogiComponent c) method, in order to notify the parent
YogiScrollPane when the child component changes. |
boolean |
reset()
Resets the content pane's scroll offsets to 0, 0. |
boolean |
resetX()
Resets the content pane's scroll x offset. |
boolean |
resetY()
Resets the content pane's scroll y offset. |
boolean |
scroll(int rowUnits,
int colUnits)
Causes the scroller to scroll (relative to its current setting) by the specified number of vertical units and horizontal units. |
boolean |
scrollBlock(int rowBlocks,
int colBlocks)
Causes the scroller to scroll (relative to its current setting) by the specified number of vertical and horizontal blocks. |
boolean |
scrollToPosition(int x,
int y)
Moves the scroller so that the specified pixel coordinate is in the top left of the scroller. |
boolean |
scrollXProportion(int proportion)
Moves the scroller so that the specified proportion of the width of the content pane is in the left of the scroller. |
boolean |
scrollYProportion(int proportion)
Moves the scroller so that the specified proportion of the height of the content pane is in the top of the scroller. |
void |
setMode(YogiScrollBar horizScroller,
YogiScrollBar vertScroller)
Sets the mode of the content pane, with respect to the state of the the two scrollbars. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int PROPERTY_CHILD_COMPONENT
public static final int PROPERTY_SCROLL_HORIZONTAL
public static final int PROPERTY_SCROLL_VERTICAL
public static final int MODE_CONTRACTED
public static final int MODE_MAXIMIZED
| Constructor Detail |
public YogiScrollContentPane()
| Method Detail |
public int getColor(int index)
YogiComponent.getColor(int) to ensure
that the content pane has the same background color as the parent
YogiScrollPane.getColor in class YogiComponentindex - the index of the color to get.public int getHorizontalMode()
MODE_CONTRACTED,
MODE_MAXIMIZED.public int getVerticalMode()
MODE_CONTRACTED,
MODE_MAXIMIZED.
public boolean scroll(int rowUnits,
int colUnits)
scroll(0, -1);will scroll one "unit" number of pixels to the left.
rowUnits - the number of rows to scroll: positive values
will scroll down and negative will scroll up.colUnits - the number of columns to scroll: positive values
will scroll right and negative will scroll left.
public boolean scrollBlock(int rowBlocks,
int colBlocks)
scrollBlock(-2, 1);will scroll one "unit" number of pixels to the right and two up.
rowBlocks - the number of row blocks to scroll: positive values
will scroll down and negative will scroll up.colBlocks - the number of column blocks to scroll: positive values
will scroll right and negative will scroll left.
public boolean scrollToPosition(int x,
int y)
x - the horizontal pixel coordinate.y - the vertical pixel coordinate.public boolean scrollXProportion(int proportion)
proportion - the horizontal scroll proportion.public boolean scrollYProportion(int proportion)
proportion - the vertical scroll proportion.public boolean reset()
public boolean resetX()
public boolean resetY()
public int getHorizontalOffset()
public int getVerticalOffset()
protected int getMaximumHorizontalScrollOffset()
protected int getMaximumVerticalScrollOffset()
protected int getVertViewSize(YogiScrollPane scrollPane,
YogiScrollBar vertScroller,
YogiScrollBar horizScroller)
YogiScrollBar.APPEAR_NEVER, -1 is returned.
If the vertical scrollbar's configuration has been set to
YogiScrollBar.APPEAR_ALWAYS, 100 is returned.scrollPane - the parent scroll pane.vertScroller - the vertical scroller.horizScroller - the horizontal scroller.
protected int getHorizViewSize(YogiScrollPane scrollPane,
YogiScrollBar horizScroller,
YogiScrollBar vertScroller)
YogiScrollBar.APPEAR_NEVER, -1 is returned.
If the horizontal scrollbar's configuration has been set to
YogiScrollBar.APPEAR_ALWAYS, 100 is returned.scrollPane - the parent scroll pane.horizScroller - the horizontal scroller.vertScroller - the vertical scroller.
public void setMode(YogiScrollBar horizScroller,
YogiScrollBar vertScroller)
horizScroller - the horizontal scrollbar.vertScroller - the vertical scrollbar.
public void propertyChanged(java.lang.Object source,
int property)
YogiScrollPane that the
child component has changed size.propertyChanged in interface PropertyChangeListenersource - the event source.property - the property changed.public void add(YogiComponent c)
YogiComponent.add(YogiComponent c) method, in order to notify the parent
YogiScrollPane when the child component changes.add in class YogiComponentc - the component to add.public void remove(YogiComponent c)
YogiComponent.remove(YogiComponent c) method, in order to notify the parent
YogiScrollPane when the child component changes.remove in class YogiComponentc - the component to remove.protected final int getMaxComponentHeight()
protected final int getMaxComponentWidth()
protected void ensureVisible(YogiComponent child,
int fx,
int fy,
int fw,
int fh)
ensureVisible in class YogiComponentchild - this argument is ignored in this implementation, as scrollers are not interested in
layering.fx - the x coordinate of the top left point of the region.fy - the y coordinate of the top left point of the region.fw - the width of the region.fh - the height of the region.
|
Copyright 2002 Yospace Holdings Ltd. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||