|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.wirefusion.player.Wob
public abstract class Wob
A Wob is the object representing a WireFusion object. Both graphical and non graphical objects should be subclasses of this object. Several methods in this object are meant to be used by graphical subclasses only.
| Constructor Summary | |
|---|---|
Wob()
It is recommended that you initialize the object in the init method instead of the constructor, if you access the engine in your initialization code. |
|
| Method Summary | |
|---|---|
void |
addChild(Wob child)
Adds a child to this object. |
void |
addFocusListener(java.awt.event.FocusListener l)
Adds the specified focus listener to receive focus events from this component when this component gains input focus. |
void |
addInteractiveSceneChild(SceneWob scene)
Adds a SceneWob object as a child to this object. |
void |
addKeyListener(java.awt.event.KeyListener l)
Adds the specified key listener to receive key events from this component. |
void |
addMouseListener(java.awt.event.MouseListener l)
Adds the specified mouse listener to receive mouse events from this component. |
void |
addMouseMotionListener(java.awt.event.MouseMotionListener l)
Adds the specified mouse motion listener to receive mouse motion events from this component. |
void |
addMouseWheelListener(java.awt.event.MouseWheelListener l)
Adds the specified mouse wheel listener to receive mouse wheel events from this component. |
boolean |
contains(int x,
int y)
Checks whether this component "contains" the specified point, where x and y are defined to be relative to the coordinate system of this component. |
void |
destroy()
Called to inform this object that it is being reclaimed and that it should destroy any resources that it has allocated. |
void |
disableEvents(long eventsToDisable)
Disables the events defined by the specified event mask parameter from being delivered to this component. |
void |
enableEvents(long eventsToEnable)
Enables the events defined by the specified event mask parameter to be delivered to their corresponding processEvent method in this this object. |
void |
filterPixels(WfImage sceneImage,
WfImage processedImage,
java.awt.Rectangle targetArea,
java.awt.Rectangle areaToProcess)
Processes the pixels in the sceneImage parameter and writes the result to processedImage. |
java.awt.Component |
getAwtComponent()
Each Wob with a target area has an associated AWT Component, from which it receives AWT events for example. |
java.awt.Rectangle |
getBounds()
Gets the bounds of this Wob in the form of a Rectangle object. |
Wob |
getChild(java.lang.String childName)
Returns a child of this Wob. |
java.util.Enumeration |
getChildren()
Returns the children of this Wob, or null if it has no children. |
Core |
getCore()
Returns the core player object |
java.awt.Cursor |
getCursor()
Gets the cursor set in the component. |
Port |
getInPort(int portNo)
Returns the in-port with the specified port number. |
int |
getMemoryUsage()
Returns the approximate memory used by this object (in bytes). |
java.lang.String |
getName()
Gets the name of the Wob. |
Port |
getOutPort(int portNo)
Returns the out-port with the specified port number. |
Wob |
getParent()
Gets the parent of this object. |
Resource |
getResource(java.lang.String filename)
Tries to located a resource whos filename equals the argument. |
Resource |
getResourceById(java.lang.String resourceId)
Tries to located a resource whos "resource ID" equals resourceId. |
java.awt.Dimension |
getSize()
Gets the size of this Wob in the form of a Dimension object. |
void |
init()
Override this method to initialize this Wob. |
boolean |
isFocusable()
Returns whether this Component can be focused. |
boolean |
isVisible()
Determines whether this object should be visible when its parent is visible. |
void |
paint(java.awt.Graphics g)
Paints this component. |
void |
prepareForSceneRender()
This method is called just before the rendering process of each frame starts if this object has a Target Area and is visible (even if this Wob doesn't intersect any areas currently scheduled for repainting). |
void |
printMemoryUsageInfo(java.io.PrintStream out)
Prints information about the memory usage to the PrintStream parameter. |
protected void |
processComponentEvent(java.awt.event.ComponentEvent ev)
This method is not called unless component events are enabled for this component. |
protected void |
processEvent(java.awt.AWTEvent e)
Processes events occurring on this component. |
protected void |
processFocusEvent(java.awt.event.FocusEvent ev)
This method is not called unless focus events are enabled for this component. |
protected void |
processInportEvent(Wob arg,
int inport)
Override to handle inport events sent to your Wob. |
protected void |
processKeyEvent(java.awt.event.KeyEvent ev)
This method is not called unless key events are enabled for this component. |
protected void |
processMouseEvent(java.awt.event.MouseEvent ev)
This method is not called unless mouse events are enabled for this component. |
protected void |
processMouseMotionEvent(java.awt.event.MouseEvent ev)
This method is not called unless mouse motion events are enabled for this component. |
protected void |
processMouseWheelEvent(java.awt.event.MouseWheelEvent ev)
This method is not called unless mouse wheel events are enabled for this component. |
protected void |
processPlayerEvent(PlayerEvent ev)
This method is not called unless player events are enabled for this component. |
void |
readData(java.io.DataInputStream dataInputStream)
Reads the data written by the coresponding WobProperties.writeData method. |
void |
removeChild(Wob child)
Removes a child of this object. |
void |
repaint()
Repaints this object. |
void |
repaint(int x,
int y,
int width,
int height)
Repaints the specified rectangle of this component. |
void |
requestFocus()
Requests that this Component get the input focus. |
void |
send(Wob argument,
int sourcePort)
Sends data through all wires connected to the out-port of this Wob that has the specified port number. |
void |
sendBoolean(boolean value,
int outport)
Sends the specified value as a Boolean Wob through the specified out-port of this Wob. |
void |
sendColor(int color,
int outport)
Sends the specified value as a Color Wob through the specified out-port of this Wob. |
void |
sendNumber(double value,
int outport)
Sends the specified value as a Number Wob through the specified out-port of this Wob. |
void |
sendNumber2D(double x,
double y,
int outport)
Sends the specified x and y values as a Number2D Wob through the specified out-port of this Wob. |
void |
sendPulse(int outport)
Sends a pulse through the specified out-port of this Wob. |
void |
sendText(java.lang.String value,
int outport)
Sends the specified value as a Text Wob through the specified out-port of this Wob. |
void |
setBounds(int x,
int y,
int width,
int height)
Moves and resizes this object. |
void |
setCursor(java.awt.Cursor cursor)
Sets the cursor image to the specified cursor. |
void |
setLayer(int layer,
int position)
Sets the layer attribute for this Wob and also sets the position within that layer. |
void |
setLocation(int x,
int y)
Sets the position of this object |
void |
setName(java.lang.String name)
Sets this Wob's name |
void |
setSize(int width,
int height)
Resizes this component so that it has width width
and height height. |
void |
setVisible(boolean visible)
Shows or hides this object depending on the value of parameter b. |
java.lang.String |
toString()
Returns a string represenation of this objects "value". |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Wob()
| Method Detail |
|---|
public void init()
public java.awt.Component getAwtComponent()
public Core getCore()
public int getMemoryUsage()
public void printMemoryUsageInfo(java.io.PrintStream out)
public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public Port getInPort(int portNo)
portNo - a port number
public Port getOutPort(int portNo)
portNo - a port number
public void prepareForSceneRender()
public void send(Wob argument,
int sourcePort)
argument - the data that will be sent from this objectsourcePort - the port number of the out-port of this object through which the data should be sentpublic void sendPulse(int outport)
outport - the out-port number
public void sendNumber(double value,
int outport)
value - the number valueoutport - the out-port number
public void sendBoolean(boolean value,
int outport)
value - the boolean valueoutport - the out-port number
public void sendText(java.lang.String value,
int outport)
value - the String valueoutport - the out-port number
public void sendNumber2D(double x,
double y,
int outport)
x - the x valuey - the y valueoutport - the out-port number
public void sendColor(int color,
int outport)
color - the rgb color value (0xRRGGBB)outport - the out-port numberpublic void readData(java.io.DataInputStream dataInputStream)
dataInputStream - the input stream of the data file
protected void processInportEvent(Wob arg,
int inport)
arg - the argument of an event sent to this objectinport - the in-port number the event has been sent topublic void destroy()
public void paint(java.awt.Graphics g)
g - the graphics context to use for painting
public void filterPixels(WfImage sceneImage,
WfImage processedImage,
java.awt.Rectangle targetArea,
java.awt.Rectangle areaToProcess)
Wobs implementing this method will not display correctly in OpenGL presentations
sceneImage - an RGB image containing the current scene pixels. Do not change pixels in this image.processedImage - an RGB image, with the same dimension av sceneImage. Write processed pixels to this image.targetArea - the target area of this Wob in the scene image. May extend outside of the image area.areaToProcess - equals targetArea or is a sub area of target area. It is completely inside of the scene image area. Only process pixels inside this area.
public void repaint(int x,
int y,
int width,
int height)
x - the x coordinatey - the y coordinatewidth - the widthheight - the heightpublic void repaint()
public void setLocation(int x,
int y)
x - the x positiony - the y position
public void setSize(int width,
int height)
width
and height height.
width - the new widthheight - the new height
public void setBounds(int x,
int y,
int width,
int height)
x and y, and the
new size is specified by width and height.
x - the new x-coordinate of this objecty - the new y-coordinate of this objectwidth - the new width of this objectheight - the new height of this
object
public void setLayer(int layer,
int position)
Sets the layer attribute for this Wob and also sets the position within that layer.
The following layers are supported:
layer - an int specifying the layer to set, where lower numbers are closer to the bottomposition - an int specifying the position within the layer, where 0 is the topmost position and -1 is the bottommost positionpublic Wob getChild(java.lang.String childName)
childName - the name of the child.
public java.util.Enumeration getChildren()
public void addInteractiveSceneChild(SceneWob scene)
scene - a Wobpublic void addChild(Wob child)
child - a Wobpublic void removeChild(Wob child)
child - a childpublic final void enableEvents(long eventsToEnable)
Enables the events defined by the specified event mask parameter to be delivered to their corresponding processEvent method in this this object. Event types are automatically enabled when a listener for that event type is added to the component (using for example addMouseListener()). This method only needs to be invoked by subclasses of Wob who desire to have the specified event types delivered to its corresponding processEvent method, regardless of whether or not a listener is registered.
The following event masks are supported:
AWTEvent.MOUSE_EVENT_MASK
AWTEvent.MOUSE_MOTION_EVENT_MASK
AWTEvent.MOUSE_WHEEL_EVENT_MASK
AWTEvent.COMPONENT_EVENT_MASK
AWTEvent.FOCUS_EVENT_MASK
AWTEvent.KEY_EVENT_MASK
PlayerEvent.PLAYER_EVENT_MASK
Example:
enableEvents(PlayerEvent.PLAYER_EVENT_MASK) will cause the player
to send player events to processPlayerEvent() (until
disableEvents(PlayerEvent.PLAYER_EVENT_MASK) is called).
Note: PlayerEvents and Component events doesn't have no associated "add listener" methods.
Note2: Using Mouse Wheel events could break Java 1.1 compatibility if not carefully implemented.
eventsToEnable - the event mask defining the event typespublic final void disableEvents(long eventsToDisable)
eventsToDisable - the event mask defining the event typesprotected void processEvent(java.awt.AWTEvent e)
e - the eventprotected void processComponentEvent(java.awt.event.ComponentEvent ev)
enableEvents.
ev - the eventprotected void processFocusEvent(java.awt.event.FocusEvent ev)
FocusListener object is registered via
addFocusListener.
enableEvents.
ev - the eventprotected void processKeyEvent(java.awt.event.KeyEvent ev)
KeyListener object is registered via
addKeyListener.
enableEvents.
ev - the eventprotected void processMouseEvent(java.awt.event.MouseEvent ev)
MouseListener object is registered via
addMouseListener.
enableEvents.
ev - the eventprotected void processMouseMotionEvent(java.awt.event.MouseEvent ev)
MouseMotionListener object is registered via
addMouseMotionListener.
enableEvents.
ev - the eventprotected void processMouseWheelEvent(java.awt.event.MouseWheelEvent ev)
MouseWheelListener object is registered via
addMouseWheelListener.
enableEvents.
ev - the eventprotected void processPlayerEvent(PlayerEvent ev)
enableEvents.
A subclass of Wob overriding this method must call super.processPlayerEvent().
ev - the eventpublic void addFocusListener(java.awt.event.FocusListener l)
l - the focus listenerpublic void addKeyListener(java.awt.event.KeyListener l)
l - the key listenerpublic void addMouseListener(java.awt.event.MouseListener l)
l - the mouse listenerpublic void addMouseWheelListener(java.awt.event.MouseWheelListener l)
l - the mouse wheel listenerpublic void addMouseMotionListener(java.awt.event.MouseMotionListener l)
l - the mouse motion listenerpublic void setVisible(boolean visible)
visible - if true, shows this object; otherwise, hides this objectpublic final boolean isVisible()
public void requestFocus()
public boolean isFocusable()
public java.awt.Rectangle getBounds()
public java.awt.Dimension getSize()
public boolean contains(int x,
int y)
x - The x value of the mouse position.y - The y value of the mouse position.
public java.lang.String getName()
public void setName(java.lang.String name)
name - a namepublic void setCursor(java.awt.Cursor cursor)
cursor - the cursorpublic java.awt.Cursor getCursor()
public Wob getParent()
public Resource getResource(java.lang.String filename)
filename - a resource filename
public Resource getResourceById(java.lang.String resourceId)
resourceId - a resource ID
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||