Fields Summary |
---|
int[] | viewableAn array which holds the scroll location and
the overall dimensions of the view being
shown in the parent Displayable's viewport
Note that the following is always true.
0 <= viewable[X] <= viewable[WIDTH] - viewport[WIDTH]
0 <= viewable[Y] <= viewable[HEIGHT] - viewport[HEIGHT] |
boolean | resetToTopScreens should automatically reset to the top of the when
they are shown, except in cases where it is interrupted by
a system menu or an off-screen editor - in which case it
should be reshown exactly as it was. |
private int | vScrollPositionThe vertical scroll position |
private int | vScrollProportionThe vertical scroll proportion |
private int | lastScrollPositionUsed in setupScroll in order to determine if scroll is needed |
private int | lastScrollSizeUsed in setupScroll in order to determine if scroll is needed.
The value has no meaning for the actual scroll size |
Methods Summary |
---|
protected int | getMaxScroll()The maximum amount of scroll needed to see all the contents
return viewable[HEIGHT] - viewport[HEIGHT];
|
protected int | getScrollAmount()This is the number of pixels left from the previous "page"
when a page up or down occurs. The same value is used for line by
line scrolling
return ScreenSkin.SCROLL_AMOUNT;
|
public int | getVerticalScrollPosition()Get the current vertical scroll position
// SYNC NOTE: return of atomic value
return vScrollPosition;
|
public int | getVerticalScrollProportion()Get the current vertical scroll proportion
// SYNC NOTE: return of atomic value
return vScrollProportion;
|
void | lCallFreeze()Override DisplayableLFImpl.lCallFreeze() to set local variables.
if (state == SHOWN) {
resetToTop = false;
}
super.lCallFreeze();
|
void | lCallHide()Override DisplayableLFImpl.lCallHide() to set local variables.
// NOTE that resetToTop is also set to false
// Display.setCurrentItem() is called.
// Because of that just knowing current state of DisplayLF
// is not enough to set it properly in lCallShow.
// That is why it has to be updated in lCallHide and lCallFreeze
super.lCallHide();
|
void | lRequestPaintItem(Item item, int x, int y, int w, int h)Paint an Item contained in this Screen. The Item requests a paint
in its own coordinate space. Screen translates those coordinates
into the overall coordinate space and schedules the repaint
ItemLFImpl iLF = (ItemLFImpl)item.getLF();
lRequestPaint(iLF.bounds[X] - viewable[X] + x,
iLF.bounds[Y] - viewable[Y] + y,
w, h);
|
boolean | setVerticalScroll(int scrollPosition, int scrollProportion)Set the vertical scroll position and proportion
this.vScrollPosition = scrollPosition;
this.vScrollProportion = scrollProportion;
if (lIsShown()) {
return currentDisplay.setVerticalScroll(scrollPosition, scrollProportion);
}
return false;
|
void | setVerticalScroll()Set the vertical scroll indicators for this Screen
if (viewable[HEIGHT] <= viewport[HEIGHT]) {
setVerticalScroll(0, 100);
} else {
setVerticalScroll((viewable[Y] * 100 /
(viewable[HEIGHT] - viewport[HEIGHT])),
(viewport[HEIGHT] * 100 / viewable[HEIGHT]));
}
|
void | setupScroll()all scroll actions should be handled through here.
if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
Logging.report(Logging.INFORMATION,
LogChannels.LC_HIGHUI_FORM_LAYOUT,
"[F] >> in FormLFImpl - setupScroll " +
invalidScroll +
"[F] >> viewable[Y] == "+viewable[Y] +
" lastScrollPosition] == "+lastScrollPosition +
"[F] >> viewable[HEIGHT] == "+viewable[HEIGHT] +
" lastScrollSize == "+lastScrollSize);
}
// check if scroll moves, and if so, refresh scrollbars
if (!invalidScroll &&
(viewable[Y] != lastScrollPosition ||
(lastScrollSize != 0 &&
viewable[HEIGHT] + viewport[HEIGHT] != lastScrollSize))) {
lastScrollPosition = viewable[Y];
lastScrollSize = viewport[HEIGHT] >= viewable[HEIGHT] ?
0: viewable[HEIGHT] + viewport[HEIGHT];
invalidScroll = true;
// IMPL_NOTE: mark Items for repaint. -au
}
if (invalidScroll) {
if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
Logging.report(Logging.INFORMATION,
LogChannels.LC_HIGHUI_FORM_LAYOUT,
"[F] ## invalidScroll ");
}
// draw the scrollbars
setVerticalScroll();
invalidScroll = false;
}
|
public void | uCallPaint(Graphics g, java.lang.Object target)Paint the contents of this Screen
if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
Logging.report(Logging.INFORMATION, LogChannels.LC_HIGHUI,
"Screen:Clip: " +
g.getClipX() + "," + g.getClipY() + "," +
g.getClipWidth() + "," + g.getClipHeight());
}
|
public void | uCallScrollContent(int scrollType, int thumbPosition)Scroll content inside of the form.
if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
Logging.report(Logging.INFORMATION,
LogChannels.LC_HIGHUI,
"Screen.uCallScrollContent scrollType=" + scrollType +
" thumbPosition=" + thumbPosition);
}
int oldY = viewable[Y];
switch (scrollType) {
case ScrollBarLayer.SCROLL_PAGEUP:
uScrollViewport(Canvas.UP);
break;
case ScrollBarLayer.SCROLL_PAGEDOWN:
uScrollViewport(Canvas.DOWN);
break;
case ScrollBarLayer.SCROLL_LINEUP:
uScrollByLine(Canvas.UP);
break;
case ScrollBarLayer.SCROLL_LINEDOWN:
uScrollByLine(Canvas.DOWN);
break;
case ScrollBarLayer.SCROLL_THUMBTRACK:
uScrollAt(thumbPosition);
break;
default:
break;
}
if (oldY != viewable[Y]) {
uRequestPaint();
setupScroll();
}
|
protected void | uScrollAt(int position)Perform a scrolling at the given position.
int max = getMaxScroll();
int newY = max * position / 100 ;
if (newY < 0) {
newY = 0;
} else if (newY > max) {
newY = max;
}
viewable[Y] = newY;
|
protected void | uScrollByLine(int dir)Perform a line scrolling in the given direction. This method will
attempt to scroll the view to show next/previous line.
int newY = viewable[Y];
if (dir == Canvas.UP) {
newY -= getScrollAmount();
if (newY < 0) {
newY = 0;
}
} else if (dir == Canvas.DOWN) {
newY += getScrollAmount();
int max = getMaxScroll();
if (newY > max) {
newY = max;
}
}
viewable[Y] = newY;
|
protected void | uScrollViewport(int dir)Perform a page flip in the given direction. This method will
attempt to scroll the view to show as much of the next page
as possible.
int newY = viewable[Y];
switch (dir) {
case Canvas.UP:
newY -= lGetHeight() - getScrollAmount();
if (newY < 0) {
newY = 0;
}
break;
case Canvas.DOWN:
newY += lGetHeight() - getScrollAmount();
int max = getMaxScroll();
if (newY > max) {
newY = max;
}
break;
default:
break;
}
viewable[Y] = newY;
|