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

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


    /**
     * @inheritDoc()
     */
    public <T extends CellServerState> void updateGUI(T cellServerState) {
        CellComponentServerState state =
                cellServerState.getComponentServerState(
                CellPhysicsPropertiesComponentServerState.class);
        if (state != null) {
            originalMass =
                    ((CellPhysicsPropertiesComponentServerState) state).getPhyiscsProperties(
View Full Code Here


        }
       
        // For all components in the setup class, create the component classes
        // and setup them up and add to the cell.
        for (Map.Entry<Class, CellComponentServerState> e : state.getComponentServerStates().entrySet()) {
            CellComponentServerState compState = e.getValue();

            // Check to see if the component server state is the special case
            // of the Position state. If so, set the values in the cell manually.
            if (compState instanceof PositionComponentServerState) {
               
                // Set up the transform (origin, rotation, scaling) and cell bounds
                PositionComponentServerState posState = (PositionComponentServerState)compState;
                setLocalTransform(PositionServerStateHelper.getCellTransform(posState));
                setLocalBounds(PositionServerStateHelper.getCellBounds(posState));
                continue;
            }

            // Otherwise, set the state of the server-side component, creating
            // it if necessary.
            String className = compState.getServerComponentClassName();
            if (className == null) {
                continue;
            }
            Class clazz=null;
            try {
View Full Code Here

        setup.addComponentServerState(position);

        // add setups for each component
        for (ManagedReference<CellComponentMO> componentRef : components.values()) {
            CellComponentMO component = componentRef.get();
            CellComponentServerState compSetup = component.getServerState(null);
            if (compSetup != null) {
                setup.addComponentServerState(compSetup);
            }
        }
View Full Code Here

        private void handleAddComponentMessage(WonderlandClientSender sender,
                WonderlandClientID clientID, CellServerComponentMessage message) {

            // Fetch the initial component server state and the class name of
            // the component to create.
            CellComponentServerState state = message.getCellComponentServerState();
            String className = message.getCellComponentServerClassName();
            CellMO cellMO = getCell();

            try {
                // Try to create the cmponent class and add it if the component
                // does not exist. Upon success, return a message
                Class clazz = Class.forName(className);
                Class lookupClazz = CellComponentUtils.getLookupClass(clazz);
                CellComponentMO comp = cellMO.getComponent(lookupClazz);
                if (comp == null) {
                    // Create the component class, set its state, and add it
                    Constructor<CellComponentMO> constructor = clazz.getConstructor(CellMO.class);
                    comp = constructor.newInstance(cellMO);
                    comp.setServerState(state);
                    cellMO.addComponent(comp);

                    // Now ask the component for its server state.  This may
                    // be different than the one we just set, for example if
                    // the cell does some work to calculate new properties when
                    // the state is set.  If the component returns null, just
                    // use the state that was passed in to avoid errors.
                    CellComponentServerState newState = comp.getServerState(null);
                    if (newState != null) {
                        state = newState;
                    }

                    // Send a response message back to the client indicating
View Full Code Here

    /**
     * @inheritDoc()
     */
    public void open() {
        CellServerState state = editor.getCellServerState();
        CellComponentServerState compState = state.getComponentServerState(
                JmeColladaCellComponentServerState.class);
        if (state != null) {
            originalInfo =
                    ((JmeColladaCellComponentServerState) compState).getModel();
            urlTF.setText(originalInfo);
View Full Code Here

     * @inheritDoc()
     */
    public void apply() {
        // Fetch the latest from the info text field and set it.
        CellServerState state = editor.getCellServerState();
        CellComponentServerState compState = state.getComponentServerState(
                JmeColladaCellComponentServerState.class);
        // Model is read only
//        ((JmeColladaCellComponentServerState)compState).setModel(urlTF.getText());
        editor.addToUpdateList(compState);
    }
View Full Code Here

        // each see if there is a properties sheet registered for it. If so,
        // then add it.
        for (Map.Entry<Class, CellComponentServerState> e :
                selectedCellServerState.getComponentServerStates().entrySet()) {

            CellComponentServerState state = e.getValue();
            PropertiesFactorySPI spi = manager.getPropertiesByClass(state.getClass());
            if (spi != null) {
                JPanel panel = spi.getPropertiesJPanel();
                if (panel != null) {
                    String displayName = spi.getDisplayName();
                    spi.setCellPropertiesEditor(this);
View Full Code Here

     * the GUI to indicate its presence
     */
    private void addComponent(CellComponentFactorySPI spi) {
        // Fetch the default server state for the factory, and cell id. Make
        // sure we make it dynamically added
        CellComponentServerState state = spi.getDefaultCellComponentServerState();
        CellID cellID = selectedCell.getCellID();
       
        // Send a ADD component message on the cell channel. Wait for a
        // response. If OK, then update the GUI with the new component.
        // Otherwise, display an error dialog box.
        CellServerComponentMessage message =
                CellServerComponentMessage.newAddMessage(cellID, state);
        ResponseMessage response = selectedCell.sendCellMessageAndWait(message);
        if (response == null) {
            // log and error and post a dialog box
            LOGGER.warning("Received a null reply from cell with id " +
                    selectedCell.getCellID() + " with name " +
                    selectedCell.getName() + " adding component.");
            return;
        }

        if (response instanceof CellServerComponentResponseMessage) {
            // If successful, add the component to the GUI by refreshing the
            // Cell that is selected.
            setSelectedCell(selectedCell);
            PropertiesManager manager = PropertiesManager.getPropertiesManager();
            PropertiesFactorySPI prop = manager.getPropertiesByClass(state.getClass());
            capabilityList.setSelectedValue(prop.getDisplayName(),true);
        }
        else if (response instanceof ErrorMessage) {
            // Log an error. Eventually we should display a dialog
            LOGGER.log(Level.WARNING, "Unable to add component to the server: " +
View Full Code Here

        }

        // Create a new (default) instance of the server-side cell component
        // state class. We use this to find out what the class name is for
        // the cell component on the server side.
        CellComponentServerState s = spi.getDefaultCellComponentServerState();
        String className = s.getServerComponentClassName();

        // Send a message to remove the component giving the class name. Wait
        // for a response.
        CellID cellID = selectedCell.getCellID();
View Full Code Here

    /**
     * @inheritDoc()
     */
    public void open() {
        CellServerState state = editor.getCellServerState();
        CellComponentServerState compState = state.getComponentServerState(
                ModelCellComponentServerState.class);
        if (state != null) {
            ModelCellComponentServerState mState =
                    (ModelCellComponentServerState) compState;
            origState = (ModelCellComponentServerState) mState.clone(null);
View Full Code Here

TOP

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

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.