public class Cartesian extends Mod implements ItemMod
Constructor and Description |
---|
Cartesian(int width,
int height,
int left,
int top)
JSON-driven constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
attachTo, clone, context, ensureHolding, ensureInContext, ensureReachable, ensureSameContext, ensureSameUser, holder, isEphemeral, markAsChanged, markAsEphemeral, object
@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.public JSONLiteral encode(EncodeControl control)
@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.Copyright © 2017. All rights reserved.