Package org.jdesktop.wonderland.common.cell.state

Examples of org.jdesktop.wonderland.common.cell.state.CellServerState


     * @inheritDoc()
     */
    public void apply() {
        // Figure out whether there already exists a server state for the
        // component.
        CellServerState cellServerState = editor.getCellServerState();
        ContainerComponentServerState state = (ContainerComponentServerState)
            cellServerState.getComponentServerState(ContainerComponentServerState.class);
        if (state == null) {
            state = new ContainerComponentServerState();
        }
      
        editor.addToUpdateList(state);
View Full Code Here


        if (editMessage.getEditType() == EditType.CREATE_CELL) {

            // The create message contains a setup class of the cell setup
            // information. Simply parse this stream, which will result in a
            // setup class of the property type.
            CellServerState setup = ((CellCreateMessage)editMessage).getCellSetup();
           
            // Fetch the server-side cell class name and create the cell
            String className = setup.getServerClassName();
            logger.fine("Attempting to load cell mo: " + className);
            CellMO cellMO = CellMOFactory.loadCellMO(className);
            if (cellMO == null) {
                /* Log a warning and move onto the next cell */
                logger.warning("Unable to load cell MO: " + className );
                sender.send(clientID, new ErrorMessage(editMessage.getMessageID(),
                        "Unable to load cell MO: " + className));
                return;
            }

            // Find the parent cell (if any)
            CellMO parent = null;
            CellID parentCellID = ((CellCreateMessage)editMessage).getParentCellID();
            if (parentCellID != null) {
                parent = CellManagerMO.getCell(parentCellID);
            }

            /* Call the cell's setup method */
            try {
                cellMO.setServerState(setup);

                if (parent == null) {
                    WonderlandContext.getCellManager().insertCellInWorld(cellMO);
                } else {
                    parent.addChild(cellMO);
                }
                //everything worked okay. send response message
                sender.send(clientID, new CellCreatedMessage(editMessage.getMessageID(), cellMO.getCellID()));

            } catch (ClassCastException cce) {
                logger.log(Level.WARNING, "Error setting up new cell " +
                        cellMO.getName() + " of type " +
                        cellMO.getClass() + ", it does not implement " +
                        "BeanSetupMO.", cce);
                sender.send(clientID,
                        new ErrorMessage(editMessage.getMessageID(),cce));
                return;
            } catch (MultipleParentException excp) {
                logger.log(Level.WARNING, "Error adding new cell " + cellMO.getName()
                        + " of type " + cellMO.getClass() + ", has multiple parents", excp);
                sender.send(clientID,
                        new ErrorMessage(editMessage.getMessageID(), excp));
                return;
            }
        }
        else if (editMessage.getEditType() == EditType.DELETE_CELL) {
            // Find the cell object given the ID of the cell. If the ID is
            // invalid, we just log an error and return.
            CellID cellID = ((CellDeleteMessage)editMessage).getCellID();
            CellMO cellMO = CellManagerMO.getCell(cellID);
            if (cellMO == null) {
                logger.warning("No cell found to delete with cell id " + cellID);
                return;
            }

            // Find out the parent of the cell. This may be null if the cell is
            // at the world root. This determines from where to remove the cell
            CellMO parentMO = cellMO.getParent();
            if (parentMO != null) {
                parentMO.removeChild(cellMO);
            }
            else {
                CellManagerMO.getCellManager().removeCellFromWorld(cellMO);
            }
        }
        else if (editMessage.getEditType() == EditType.DUPLICATE_CELL) {
            // Find the cell object given the ID of the cell. If the ID is
            // invalid, we just log an error and return.
            CellID cellID = ((CellDuplicateMessage)editMessage).getCellID();
            CellMO cellMO = CellManagerMO.getCell(cellID);
            if (cellMO == null) {
                logger.warning("No cell found to duplicate with cell id " + cellID);
                sender.send(clientID, new ErrorMessage(editMessage.getMessageID(),
                        "No cell found to duplicate with cell id " + cellID));
                return;
            }
            CellMO parentCellMO = cellMO.getParent();

            // We need to fetch the current state of the cell from the cell we
            // wish to duplicate. We also need the name of the server-side cell
            // class
            CellServerState state = cellMO.getServerState(null);
            String className = state.getServerClassName();

            // Attempt to create the cell using the cell factory and the class
            // name of the server-side cell.
            CellMO newCellMO = CellMOFactory.loadCellMO(className);
            if (newCellMO == null) {
                /* Log a warning and move onto the next cell */
                logger.warning("Unable to duplicate cell MO: " + className);
                sender.send(clientID, new ErrorMessage(editMessage.getMessageID(),
                        "Unable to duplicate cell MO: " + className));
                return;
            }

            // We want to modify the position of the new cell slight, so we
            // offset the position by (1, 1, 1).
            PositionComponentServerState position = (PositionComponentServerState)state.getComponentServerState(PositionComponentServerState.class);
            if (position == null) {
                logger.warning("Unable to determine the position of the cell " +
                        "to duplicate with id " + cellID);
                sender.send(clientID, new ErrorMessage(editMessage.getMessageID(),
                        "Unable to determine the position of the cell " +
                        "to duplicate with id " + cellID));
                return;
            }
            Vector3f offset = new Vector3f(1, 0, 1);
            Vector3f origin = position.getTranslation();
            position.setTranslation(offset.add(origin));
            state.addComponentServerState(position);

            // Set the desired name of the cell contained within the message
            state.setName(((CellDuplicateMessage)editMessage).getCellName());
           
            // Set the state of the new cell and add it to the same parent as
            // the old cell. If the old parent cell is null, we just insert it
            // as root.
            newCellMO.setServerState(state);
View Full Code Here

     */
    public void open() {
        // Fetch the name and CellID from the Cell and Cell server state and
        // update the GUI
        Cell cell = editor.getCell();
        CellServerState cellServerState = editor.getCellServerState();

        if (cellServerState != null) {
            originalCellName = cellServerState.getName();
            cellNameTextField.setText(originalCellName);
            cellIDLabel.setText(cell.getCellID().toString());
            cellClassLabel.setText(cell.getClass().getName());

            InteractionComponentServerState icss = (InteractionComponentServerState)
                    cellServerState.getComponentServerState(InteractionComponentServerState.class);
            if (icss == null) {
                origCollidable = true;
                origSelectable = true;
            } else {
                origCollidable = icss.isCollidable();
                origSelectable = icss.isSelectable();
            }
           
            collidableCB.setSelected(origCollidable);
            selectableCB.setSelected(origSelectable);
           
            NewInteractionComponentServerState hcss = (NewInteractionComponentServerState) cellServerState
                    .getComponentServerState(NewInteractionComponentServerState.class);
           
            if(hcss != null) {
                origHighlightColor = new Color(hcss.getRed(), hcss.getGreen(), hcss.getBlue());
                origHighlightEnable = hcss.isHighlightEnable();
View Full Code Here

     * @inheritDoc()
     */
    public void apply() {
        // Update the server-side state for the Cell.
        String name = cellNameTextField.getText();
        CellServerState cellServerState = editor.getCellServerState();
        ((CellServerState) cellServerState).setName(name);
        editor.addToUpdateList(cellServerState);
        
        saveInteractionComponent(cellServerState);
       
View Full Code Here

        }

        // As a first step, remove all of the cell component server states from
        // the cell server state. These cell component server states to update
        // are kept in a separate list.
        CellServerState updateState = stateUpdates.cellServerState;
        if (updateState != null) {
            updateState.removeAllComponentServerStates();
        }

        // Form a new CellUpdateServerState message with the appropriate
        // information and send it
        CellServerStateUpdateMessage msg = new CellServerStateUpdateMessage(
View Full Code Here

        }

        // We need to remove the position component first as a special case
        // since we do not want to update it after the cell is created.
        CellServerStateResponseMessage cssrm = (CellServerStateResponseMessage) response;
        CellServerState state = cssrm.getCellServerState();
        if (state != null) {
            state.removeComponentServerState(PositionComponentServerState.class);
        }
        return state;
    }
View Full Code Here

        // From the selected value, find the proper means to create the object
        final String cellDisplayName = (String) cellList.getSelectedValue();
        final CellFactorySPI factory = cellFactoryMap.get(cellDisplayName);
        new Thread(new Runnable() {
            public void run() {
                CellServerState setup = factory.getDefaultCellServerState(null);

                // Create the new cell at a distance away from the avatar
                try {
                    // OWL issue #224: api update
                    CellUtils.createCell(setup);
View Full Code Here

    /**
     * @inheritDoc()
     */
    public void open() {
        CellServerState cellServerState = editor.getCellServerState();
        SecurityComponentServerState state =
                (SecurityComponentServerState) cellServerState.getComponentServerState(
                SecurityComponentServerState.class);

        // set the lists up based on the model
        originalCellPermissions = state.getPermissions();
        perms.fromPermissions(originalCellPermissions);
View Full Code Here

     * @inheritDoc()
     */
    public void apply() {
        // Figure out whether there already exists a server state for the
        // component.
        CellServerState cellServerState = editor.getCellServerState();
        SecurityComponentServerState state =
                (SecurityComponentServerState) cellServerState.getComponentServerState(
                SecurityComponentServerState.class);
        if (state == null) {
            state = new SecurityComponentServerState();
        }

View Full Code Here

     */
    public void handleDrop(DropTargetDropEvent3D dtde, DataFlavor flavor) {
        try {
            // Fetch the CellServerState from the dropped transferable and
            // create an instance of the cell on the server
            CellServerState state = (CellServerState) dtde.getTransferData(dataFlavor);

            // Create the new cell at a distance away from the avatar
            // OWL issue #224: api update
            CellUtils.createCell(state);

View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.common.cell.state.CellServerState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.