Package org.jdesktop.wonderland.client.cell

Examples of org.jdesktop.wonderland.client.cell.Cell


                });
            }
            else if (event instanceof ContextEvent) {
                // Show the context menu, initialize the menu if this is the
                // first time
                final Cell cell = ((ContextEvent)event).getPrimaryCell();
                if (cell == null) {
                    // Hide the context menu in the AWT Event Thread so that we do
                    // not interfere with the MT Game Render thread
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
View Full Code Here


     *
     * @param event The ContextEvent that caused the menu to be displayed
     */
    public void fireContextMenuEvent(ContextMenuEvent event) {
        synchronized (listeners) {
          final Cell cell = event.getPrimaryCell();
          for (ContextMenuListener listener : listeners) {
              listener.contextMenuDisplayed(event);
          }
        }
    }
View Full Code Here

        final SimpleContextMenuItem editItem = new SimpleContextMenuItem(
                BUNDLE.getString("Edit..."), new EditContextListener());

        // if there is security on this cell, do some calculation to
        // figure out if the user has access to this cell
        Cell cell = event.getPrimaryCell();
        final SecurityComponent sc = cell.getComponent(SecurityComponent.class);
        if (sc != null) {
            // see if the permissions are available immediately
            if (sc.hasPermissions()) {
                editItem.setEnabled(canMove(sc));
            } else {
View Full Code Here

    public void updateGUI() {
        // Update the GUI of the Position HUD Panel
        positionHUDPanel.updateGUI();

        // Fetch the currently selected Cell. If none, then do nothing
        Cell cell = getSelectedCell();
        if (cell == null) {
            affordanceHUD.setName(BUNDLE.getString("Edit_Object_None_Selected"));
            translateToggleButton.setSelected(false);
            translateToggleButton.setEnabled(false);
            rotateToggleButton.setSelected(false);
            rotateToggleButton.setEnabled(false);
            resizeToggleButton.setSelected(false);
            resizeToggleButton.setEnabled(false);
            sizeSlider.setValue(50);
            sizeSlider.setEnabled(false);
            return;
        }

        // Set the name of the Cell label
        String name = BUNDLE.getString("Edit_Object");
        name = MessageFormat.format(name, cell.getName());
        affordanceHUD.setName(name);
        Logger.getLogger(AffordanceHUDPanel.class.getName()).warning("Setting name to " + name);

        // Enable all of the buttons on theHUD
        translateToggleButton.setEnabled(true);
        rotateToggleButton.setEnabled(true);
        resizeToggleButton.setEnabled(true);
        sizeSlider.setEnabled(true);

        // See if there is a translate component on the Cell. If so, then set
        // the toggle button state.
        CellComponent component = cell.getComponent(TranslateAffordanceCellComponent.class);
        translateToggleButton.setSelected(component != null);
        translateToggleButton.repaint();

        // In theory each affordance component can hold a different size value.
        // In practice this can never happen since the GUI enforces all of the
        // affordances to have the same size. So we just use the size from the
        // translate affordance to initialize the slider value
        if (component != null) {
            float size = ((AffordanceCellComponent) component).getSize();
            sizeSlider.setValue((int) ((size - 1.0f) * 100.0f));
        }
        else {
            sizeSlider.setValue(50);
        }

        // See if there is a rotate component on the Cell. If so, then set the
        // toggle button state.
        component = cell.getComponent(RotateAffordanceCellComponent.class);
        rotateToggleButton.setSelected(component != null);
        rotateToggleButton.repaint();

        // See if there is a resize component on the Cell. If so, then set the
        // toggle button state.
        component = cell.getComponent(ResizeAffordanceCellComponent.class);
        resizeToggleButton.setSelected(component != null);
        resizeToggleButton.repaint();
    }
View Full Code Here

     * @inheritDoc()
     */
    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;
View Full Code Here

     *
     * @param visible True if the translation affordance should be visible
     */
    public void setTranslationVisible(boolean visible) {
        // Fetch the currently selected Cell. If none, then do nothing
        Cell cell = getSelectedCell();
        if (cell == null) {
            return;
        }

        // Make sure the translate toggle button is in the same state. We need
        // to check to make sure the toggle button isn't already in this
        // state to prevent generated a spurious event.
        if (translateToggleButton.isSelected() != visible) {
            translateToggleButton.setSelected(visible);
        }

        // See if there is already a translate component on the Cell.
        CellComponent component = cell.getComponent(TranslateAffordanceCellComponent.class);

        // If we are selecting the translate toggle button, then add the
        // translate component if it is not already on there. Also, set its
        // size.
        if (visible == true) {
            if (component == null) {
                component = new TranslateAffordanceCellComponent(cell);
                cell.addComponent(component);
            }
            ((AffordanceCellComponent) component).setSize(getSliderSize());
        }
        else {
            // Otherwise if the remove exists, then remove it from the Cell
View Full Code Here

     *
     * @param visible True if the rotation affordance should be visible
     */
    public void setRotationVisible(boolean visible) {
        // Fetch the currently selected Cell. If none, then do nothing
        Cell cell = getSelectedCell();
        if (cell == null) {
            return;
        }

        // Make sure the rotation toggle button is in the same state. We need
        // to check to make sure the toggle button isn't already in this
        // state to prevent generated a spurious event.
        if (rotateToggleButton.isSelected() != visible) {
            rotateToggleButton.setSelected(visible);
        }

        // See if there is already a rotate component on the Cell.
        CellComponent component = cell.getComponent(RotateAffordanceCellComponent.class);

        // If we are selecting the rotation toggle button, then add the rotate
        // component if it is not already on there. Also, set its size.
        if (visible == true) {
            if (component == null) {
                component = new RotateAffordanceCellComponent(cell);
                cell.addComponent(component);
            }
            ((AffordanceCellComponent) component).setSize(getSliderSize());
        }
        else {
            // Otherwise if the remove exists, then remove it from the Cell
View Full Code Here

     *
     * @param visible True if the resizing affordance should be visible
     */
    public void setResizingVisible(boolean visible) {
        // Fetch the currently selected Cell. If none, then do nothing
        Cell cell = getSelectedCell();
        if (cell == null) {
            return;
        }

        // Make sure the resize toggle button is in the same state. We need
        // to check to make sure the toggle button isn't already in this
        // state to prevent generated a spurious event.
        if (resizeToggleButton.isSelected() != visible) {
            resizeToggleButton.setSelected(visible);
        }

        // See if there is already a rotate component on the Cell.
        CellComponent component = cell.getComponent(ResizeAffordanceCellComponent.class);

        // If we are selecting the resize toggle button, then add the resize
        // component if it is not already on there. Also, set its size.
        if (visible == true) {
            if (component == null) {
                component = new ResizeAffordanceCellComponent(cell);
                cell.addComponent(component);
            }
            ((AffordanceCellComponent) component).setSize(getSliderSize());
        }
        else {
            // Otherwise if the remove exists, then remove it from the Cell
View Full Code Here

     */
    private void updateAffordanceSize() {
        // Fetch the current value of the slide and the currently selected
        // cell
        float newSize = getSliderSize();
        Cell cell = getSelectedCell();
        if (cell == null) {
            return;
        }

        // Set the size on the translate affordance
        TranslateAffordanceCellComponent translateComponent = cell.getComponent(
                TranslateAffordanceCellComponent.class);
        if (translateComponent != null) {
            translateComponent.setSize(newSize);
        }

        // Set the size on the rotate affordance
        RotateAffordanceCellComponent rotateComponent = cell.getComponent(
                RotateAffordanceCellComponent.class);
        if (rotateComponent != null) {
            rotateComponent.setSize(newSize);
        }

        // Set the size on the resize affordance
        ResizeAffordanceCellComponent resizeComponent = cell.getComponent(
                ResizeAffordanceCellComponent.class);
        if (resizeComponent != null) {
            resizeComponent.setSize(newSize);
        }
    }
View Full Code Here

        // This is used in the drag and drop mechanism to figure out which
        // Cell is being dragged.
        SortedTreeNode ret = new SortedTreeNode(cell) {
            @Override
            public String toString() {
                Cell cell = (Cell) getUserObject();
                return "CellID@" + cell.getCellID().toString();
            }
        };
        cellNodes.put(cell, ret);

        // Find the parent node of the new node, and insert it into the tree
        SortedTreeNode parentNode = cellNodes.get(cell.getParent());
        if (parentNode == null) {
            parentNode = treeRoot;
        }
        parentNode.add(ret);

        // Tell the model that a new node has been inserted
        DefaultTreeModel model = (DefaultTreeModel)cellHierarchyTree.getModel();
        int childIndex = parentNode.getIndex(ret);
        model.nodesWereInserted(parentNode, new int[] { childIndex });

        // Recursively iterate through all of the Cell's children and add to
        // the tree.
        List<Cell> children = cell.getChildren();
        for (Cell child : children) {
            createJTreeNode(child);
        }
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.client.cell.Cell

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.