org.xith3d.ui.swingui
Class UIWindow

java.lang.Object
  extended by org.xith3d.ui.swingui.UIWindow
All Implemented Interfaces:
UIDragDropInterface, UIOverlayInterface

public class UIWindow
extends java.lang.Object
implements UIOverlayInterface, UIDragDropInterface

A UI window is a special container for Swing components which can be rendered on a Xith3D canvas.


Constructor Summary
UIWindow(int width, int height, boolean clipAlpha, boolean blendAlpha)
           
UIWindow(javax.swing.JComponent root, int width, int height, boolean clipAlpha, boolean blendAlpha)
           
 
Method Summary
 void dispatchEvent(java.awt.AWTEvent e)
           
 boolean dragging(int index, java.awt.Component c, java.awt.event.MouseEvent me, UIDraggingInformation info)
          Finds the deepest component that will accept the dragging request.
 boolean dragging(java.awt.event.MouseEvent me, UIDraggingInformation info)
          Once a legitimate dragging operation is started then windows which implement this interface will get this callback as the icon is moved over their surface.
 boolean drop(int index, java.awt.Component c, java.awt.event.MouseEvent me, UIDraggingInformation info)
          Finds the deepest component that will accept the drop request.
 boolean dropped(java.awt.event.MouseEvent me, UIDraggingInformation info)
          When the mouse is released the dragging operation will stop.
 java.awt.image.BufferedImage getBuffer()
           
 java.util.ArrayList<?> getDirtyAreas()
           
 int getHeight()
           
 UIOverlay getOverlay()
           
 Node getRoot()
           
 void getSize(java.awt.Dimension dim)
          Gets the dimension of the overlay.
 int getWidth()
           
 UIWindowManager getWindowManager()
           
 int getX()
           
 int getY()
           
 boolean isDisabled()
           
 boolean isDraggable()
           
 boolean isOpaque()
          This method is used by overlay manager to optimize the display of the overlay.
 void pack()
           
 void processWindowEvent(java.awt.event.WindowEvent event)
           
 void renderToBuffer(java.util.ArrayList<?> dirtyList)
           
 void setComponentFocus(java.awt.Component focus)
           
 void setDisabled(boolean b)
           
 void setDraggable(boolean b)
           
 void setFocus(boolean hasFocus)
           
 void setPosition(int x, int y)
           
 void setRoot(javax.swing.JComponent root)
           
 void setVisible(boolean visible)
           
 void setWindowManager(UIWindowManager manager)
           
 UIDraggingInformation startDrag(java.awt.event.MouseEvent me)
          Called when the overlay manager starts a drag action.
 void update()
          Called once per frame.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UIWindow

public UIWindow(int width,
                int height,
                boolean clipAlpha,
                boolean blendAlpha)

UIWindow

public UIWindow(javax.swing.JComponent root,
                int width,
                int height,
                boolean clipAlpha,
                boolean blendAlpha)
Method Detail

getWidth

public int getWidth()

getHeight

public int getHeight()

setWindowManager

public void setWindowManager(UIWindowManager manager)

getWindowManager

public UIWindowManager getWindowManager()

setRoot

public void setRoot(javax.swing.JComponent root)

getBuffer

public java.awt.image.BufferedImage getBuffer()

getOverlay

public UIOverlay getOverlay()

dragging

public boolean dragging(int index,
                        java.awt.Component c,
                        java.awt.event.MouseEvent me,
                        UIDraggingInformation info)
Finds the deepest component that will accept the dragging request.

Returns:
null if there is no such component.

drop

public boolean drop(int index,
                    java.awt.Component c,
                    java.awt.event.MouseEvent me,
                    UIDraggingInformation info)
Finds the deepest component that will accept the drop request.

Returns:
false if there is no such component.

getDirtyAreas

public java.util.ArrayList<?> getDirtyAreas()

pack

public void pack()

setComponentFocus

public void setComponentFocus(java.awt.Component focus)

setVisible

public void setVisible(boolean visible)

dispatchEvent

public void dispatchEvent(java.awt.AWTEvent e)

processWindowEvent

public void processWindowEvent(java.awt.event.WindowEvent event)

renderToBuffer

public void renderToBuffer(java.util.ArrayList<?> dirtyList)

getSize

public void getSize(java.awt.Dimension dim)
Description copied from interface: UIOverlayInterface
Gets the dimension of the overlay. This is necessary for the window manager to be able to move the overlay to new positions, as well to detect that the window has been clicked on

Specified by:
getSize in interface UIOverlayInterface

update

public void update()
Description copied from interface: UIOverlayInterface
Called once per frame. This should not do anything unless absolutely necessary. Specifically it is assumed this will be used to do a texture swap for changing the overlay contents.

Specified by:
update in interface UIOverlayInterface

getRoot

public Node getRoot()
Specified by:
getRoot in interface UIOverlayInterface
Returns:
the root of the overlay scenegraph

isOpaque

public boolean isOpaque()
Description copied from interface: UIOverlayInterface
This method is used by overlay manager to optimize the display of the overlay.

Specified by:
isOpaque in interface UIOverlayInterface

startDrag

public UIDraggingInformation startDrag(java.awt.event.MouseEvent me)
Description copied from interface: UIDragDropInterface
Called when the overlay manager starts a drag action. If null is returned then the dragging action is cancelled. otherwise the icon specified in the DraggingInformation will be moved around the screen until the mouse is released.

Specified by:
startDrag in interface UIDragDropInterface
Returns:
the UIDraggingInformation

dragging

public boolean dragging(java.awt.event.MouseEvent me,
                        UIDraggingInformation info)
Description copied from interface: UIDragDropInterface
Once a legitimate dragging operation is started then windows which implement this interface will get this callback as the icon is moved over their surface.

Specified by:
dragging in interface UIDragDropInterface

dropped

public boolean dropped(java.awt.event.MouseEvent me,
                       UIDraggingInformation info)
Description copied from interface: UIDragDropInterface
When the mouse is released the dragging operation will stop. If there is a window or an object underneath the mouse and it implements this interface then this method will be called. Returning false means that the target is rejecting the drop.

Specified by:
dropped in interface UIDragDropInterface

setDisabled

public void setDisabled(boolean b)

isDisabled

public boolean isDisabled()

setDraggable

public void setDraggable(boolean b)

isDraggable

public boolean isDraggable()

getX

public int getX()

getY

public int getY()

setPosition

public void setPosition(int x,
                        int y)

setFocus

public void setFocus(boolean hasFocus)