* @inheritDoc()
*/
public void open() {
// Fetch the current Cell, make sure it has the movable component and
// turn everything on.
Cell cell = editor.getCell();
if (cell == null) {
return;
}
// Store the values currently on the Cell. This will be used when we
// go to restore the values later
CellTransform transform = cell.getLocalTransform();
originalTranslation = transform.getTranslation(null);
originalRotation = transform.getRotation(null);
originalScaling = transform.getScaling(null);
// OWL issue #159: we are now up to date, no local changes have been made
isLocalChangesMade = false;
movableComponent = cell.getComponent(MovableComponent.class);
if (movableComponent == null) {
translationXTF.setEnabled(false);
translationYTF.setEnabled(false);
translationZTF.setEnabled(false);
rotationXTF.setEnabled(false);
rotationYTF.setEnabled(false);
rotationZTF.setEnabled(false);
scaleXTF.setEnabled(false);
}
// Listen for changes, if there is a movable component added or removed
// update the state of the fields. It is ok if open() is called more
// than once, this method call will not add duplicate listeners.
cell.addComponentChangeListener(componentListener);
// If it does not exist, attempt to add the movable component. Create
// a suitable message using only the server-side movable component
// class name and send over the cell channel.
if (movableComponent == null) {
String className = "org.jdesktop.wonderland.server.cell." +
"MovableComponentMO";
CellServerComponentMessage cscm =
CellServerComponentMessage.newAddMessage(
cell.getCellID(), className);
ResponseMessage response = cell.sendCellMessageAndWait(cscm);
if (response instanceof ErrorMessage) {
logger.log(Level.WARNING, "Unable to add movable component " +
"for Cell " + cell.getName() + " with ID " +
cell.getCellID(),
((ErrorMessage) response).getErrorCause());
}
}
// Listen for changes in the Cell's transform. It is ok if open() is
// called more than once, this method call will not add duplicate
// listeners.
cell.addTransformChangeListener(transformListener);
// Update the GUI, set local changes to true so that messages to the
// movable component are NOT generated.
setLocalChanges(true);
try {