|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.elkoserver.server.context.Mod
org.elkoserver.server.context.mods.Cartesian
public class Cartesian
Mod to provide an item with 2D (rectangular) geometry. This mod may only be attached to an item, not to a context or a user. This mod keeps track of a position and a rectangular extent (e.g., a width and a height). Position is reckoned relative to the object's container. Dimensions are specified by integers whose unit interpretation (e.g., pixels, inches, furlongs, attoparsecs, etc.) is left to the application.
| Constructor Summary | |
|---|---|
Cartesian(int width,
int height,
int left,
int top)
JSON-driven constructor. |
|
| Method Summary | |
|---|---|
JSONLiteral |
encode(EncodeControl control)
Encode this mod for transmission or persistence. |
void |
move(User from,
OptString into,
int left,
int top)
Message handler for the 'move' message. |
| Methods inherited from class org.elkoserver.server.context.Mod |
|---|
attachTo, clone, context, ensureHolding, ensureInContext, ensureReachable, ensureSameContext, ensureSameUser, holder, isEphemeral, markAsChanged, markAsEphemeral, object |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
@JSONMethod(value={"width","height","left","top"})
public Cartesian(int width,
int height,
int left,
int top)
width - Horizontal extent of the geometry.height - Vertical extent of the geometry.left - X coordinate of object position relative to container.top - Y coordinate of object position relative to container.| Method Detail |
|---|
public JSONLiteral encode(EncodeControl control)
encode in interface Encodablecontrol - Encode control determining what flavor of encoding
should be done.
@JSONMethod(value={"into","left","top"})
public void move(User from,
OptString into,
int left,
int top)
throws MessageHandlerException
This message is a request from a client to move this object to a different location and/or container. If the move is successful, a corresponding 'move' message is broadcast to the context.
recv: { to:REF, op:"move", into:optREF,
left:INT, top:INT }
send: { to:REF, op:"move", into:optREF,
left:INT, top:INT }
from - The user who sent the message.into - Container into which object should be placed (optional,
defaults to same container, i.e., to leaving the container
unchanged).left - X coordinate of new position relative to container.top - Y coordinate of new position relative to container.
MessageHandlerException - if 'from' is not in the same context as
this mod or if the proposed destination container is invalid.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||