|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.xith.java3d.overlay.OverlayScroller
A scrolling overlay is built on top of the overlay system. It maintains optional overlays for the borders of the overlay area and an array of equal size overlays to represent the lines. This is designed to be fast enough to support fast scrolling text and implementations like a chat box or debug window. A single scroll will effectively swap textures on geometry and stream one overlay's worth of data to the 3d card, so it should be maximally efficient. The design of this implementation is to keep an array of overlays one per virtual line from top to bottom inside the overlay. Because the position swaps (for scrolling) has to happen within a single behavior to guarentee its transactional status, a single repaint() of the OverlayScroller must set the re-order for the lines, even though the actual re-order won't happen until the behavior triggers (on next frame). We also have to handle the case where several repaints happen between one frame. In order to facilitate this, we keep an array of double-indirection, mapping overlay-lines to virtual lines, then unwind them when we commit the transaction to the card. So when we first start, or after a commit to the card, you would have a one-to-one mapping of virutal lines to overlays. If you issue a scroll-up or scroll-down directive, we just adjust the virtual pointers, mapping the first virtual line to the bottom overlay and adjusting from there. This means you can do multiple scrolls between frames and the buffer maintains consistancy. If you want a line repaint and a scroll action to be handled atomically, then you should call update() on the scroller. This will in-turn lock the overlay for update and call the paint() method, which you implement. This is a bit different than the paint method used at the overlay level since you are not given a graphics context. But from within this method you can call the scroll() and scrollDown() methods and request a graphics context for any virtual line. You will be writing to the backBuffer of the individual overlay's so it is safe, also none of the line-overlays will commit until you exit the paint() method. Copyright: Copyright (c) 2000,2001 Company: Teseract Software, LLP
Field Summary | |
static int |
BORDER_BOTTOM
|
static int |
BORDER_LEFT
|
static int |
BORDER_RIGHT
|
static int |
BORDER_TOP
|
Fields inherited from interface com.xith.java3d.overlay.Overlay |
BACKGROUND_COPY, BACKGROUND_NONE, PLACE_BOTTOM, PLACE_CENTER, PLACE_LEFT, PLACE_RIGHT, PLACE_TOP, X_PLACEMENT, Y_PLACEMENT |
Constructor Summary | |
OverlayScroller(javax.media.j3d.Canvas3D canvas3D,
boolean clipAlpha,
boolean blendAlpha,
java.awt.Dimension offset,
UpdateManager manager,
Overlay[] line,
java.awt.Insets margin)
|
|
OverlayScroller(javax.media.j3d.Canvas3D canvas3D,
java.awt.Dimension offset,
Overlay[] line,
java.awt.Insets margin)
|
|
OverlayScroller(javax.media.j3d.Canvas3D canvas3D,
java.awt.Dimension offset,
UpdateManager manager,
Overlay[] line,
java.awt.Insets margin)
|
|
OverlayScroller(javax.media.j3d.Canvas3D canvas3D,
Overlay[] line,
java.awt.Insets margin)
|
|
OverlayScroller(javax.media.j3d.Canvas3D canvas3D,
UpdateManager manager,
Overlay[] line,
java.awt.Insets margin)
|
Method Summary | |
void |
addScrollEventListener(ScrollEventListener listener)
|
void |
clean(int property)
|
void |
dirty(int property)
|
void |
fireItemScrolled(ScrollEvent e)
|
OverlayBase |
getBorder(int index)
|
java.awt.Rectangle |
getBounds()
Returns the rectangular portion of the canvas that this overlay covers. |
javax.media.j3d.Canvas3D |
getCanvas()
Returns the canvas being drawn on |
Overlay |
getLine(int index)
|
int |
getNumLines()
Returns the number of lines |
javax.media.j3d.BranchGroup |
getRoot()
Return the root of the Overlay so it can be added to the scene graph. |
UpdateManager |
getUpdateManager()
Returns the UpdateManager responsible for seeing that updates to the Overlay only take place between frames. |
void |
initialize()
Implement this to do extra initialization before the node goes live |
boolean |
isAntialiased()
Returns whether drawing on this overlay is anti-aliased |
boolean |
isUpdating()
|
boolean |
isVisible()
Returns the visiblity of the Overlay. |
void |
removeScrollEventListener(ScrollEventListener listener)
|
void |
scroll(int startLine,
int scrollDistance)
This will scroll lines starting at startLine the scrollDistance. |
void |
setAntialiased(boolean antialiased)
Sets whether drawing onto this Overlay is anialiased. |
void |
setOffset(java.awt.Dimension offset)
Sets the position of the window. |
void |
setOffset(int width,
int height)
Sets the position of the window. |
void |
setRelativePosition(int[] relativePositon)
Sets the relative position of the overlay on the screen using a 2 dimensional array. |
void |
setRelativePosition(int xType,
int yType)
This will set the relative position of the scroller elements. |
void |
setUpdateManager(UpdateManager updateManager)
Sets the UpdateManager |
void |
setUpdating(boolean updating)
|
void |
setVisible(boolean visible)
Sets the visibility of the overlay. |
void |
update()
This will commit any changes that have been made in the overlay. |
void |
updateRequested()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int BORDER_LEFT
public static final int BORDER_RIGHT
public static final int BORDER_TOP
public static final int BORDER_BOTTOM
Constructor Detail |
public OverlayScroller(javax.media.j3d.Canvas3D canvas3D, Overlay[] line, java.awt.Insets margin)
public OverlayScroller(javax.media.j3d.Canvas3D canvas3D, java.awt.Dimension offset, Overlay[] line, java.awt.Insets margin)
public OverlayScroller(javax.media.j3d.Canvas3D canvas3D, UpdateManager manager, Overlay[] line, java.awt.Insets margin)
public OverlayScroller(javax.media.j3d.Canvas3D canvas3D, java.awt.Dimension offset, UpdateManager manager, Overlay[] line, java.awt.Insets margin)
public OverlayScroller(javax.media.j3d.Canvas3D canvas3D, boolean clipAlpha, boolean blendAlpha, java.awt.Dimension offset, UpdateManager manager, Overlay[] line, java.awt.Insets margin)
Method Detail |
public void initialize()
public java.awt.Rectangle getBounds()
Overlay
getBounds
in interface Overlay
public javax.media.j3d.Canvas3D getCanvas()
Overlay
getCanvas
in interface Overlay
public javax.media.j3d.BranchGroup getRoot()
Overlay
getRoot
in interface Overlay
public OverlayBase getBorder(int index)
public void setAntialiased(boolean antialiased)
Overlay
setAntialiased
in interface Overlay
public boolean isAntialiased()
Overlay
isAntialiased
in interface Overlay
public UpdateManager getUpdateManager()
Overlay
getUpdateManager
in interface Overlay
public void setUpdateManager(UpdateManager updateManager)
Overlay
setUpdateManager
in interface Overlay
public boolean isUpdating()
isUpdating
in interface UpdateManager
public void setUpdating(boolean updating)
setUpdating
in interface UpdateManager
public int getNumLines()
public Overlay getLine(int index)
public void setVisible(boolean visible)
setVisible
in interface Overlay
public boolean isVisible()
Overlay
isVisible
in interface Overlay
public void scroll(int startLine, int scrollDistance)
public void setRelativePosition(int[] relativePositon)
setRelativePosition
in interface Overlay
relativePosition[X_PLACEMENT]
- May be PLACE_LEFT, PLACE_RIGHT, or PLACE_CENTERrelativePosition[Y_PLACEMENT]
- May be PLACE_TOP, PLACE_BOTTOM, or PLACE_CENTERpublic void setRelativePosition(int xType, int yType)
setRelativePosition
in interface Overlay
com.xith.java3d.overlay.Overlay
xType
- May be PLACE_LEFT, PLACE_RIGHT, or PLACE_CENTERyType
- May be PLACE_TOP, PLACE_BOTTOM, or PLACE_CENTERpublic void setOffset(java.awt.Dimension offset)
setOffset
in interface Overlay
public void setOffset(int width, int height)
setOffset
in interface Overlay
public void dirty(int property)
public void clean(int property)
public void updateRequested()
updateRequested
in interface UpdateManager
public void update()
update
in interface Overlay
public void addScrollEventListener(ScrollEventListener listener)
public void removeScrollEventListener(ScrollEventListener listener)
public void fireItemScrolled(ScrollEvent e)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |