Package org.jdesktop.wonderland.client.cell

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


    private synchronized boolean checkIfAllCellsLoaded(Collection<Cell> rootCells,int level,boolean log) {
       
        Iterator<Cell> itr = rootCells.iterator();
        while(itr.hasNext()) {
           
            Cell c = itr.next();
            if(log) {
                for(int i=0; i<level; i++)
                    System.out.print("   ");
                System.out.println(" "+c.getName()+" - "+c.getStatus());
            }
            List<Cell> childs = c.getChildren();
            if(!c.getStatus().equals(CellStatus.VISIBLE)) {
                return false;
            }
            if(childs.size()!=0) {
                if(!checkIfAllCellsLoaded(childs,level+1,log)) {
                    return false;
View Full Code Here


         /**
         * {@inheritDoc}
         */
        public int compareTo(Object obj) {
            // Fetch the Cell names from this node and from obj and compare.
            Cell thisCell = (Cell)getUserObject();
            String thisName = thisCell.getName() + " (" +
                    thisCell.getCellID().toString() + ")";

            DefaultMutableTreeNode objNode = (DefaultMutableTreeNode) obj;
            Cell objCell = (Cell) objNode.getUserObject();
            String objName = objCell.getName() + " (" +
                    objCell.getCellID().toString() + ")";

            return thisName.compareToIgnoreCase(objName);
        }
View Full Code Here

            // Using the name of the Cell to set the name of the tree node.
            if (treeNode.getDisplayName() != null) {
                setText(treeNode.getDisplayName());
            } else if (treeNode.getUserObject() instanceof Cell) {
                Cell cell = (Cell) treeNode.getUserObject();
                setText(cell.getName() + " (" + cell.getCellID().toString() + ")");
            }
            return this;
        }
View Full Code Here

            CellCache cache = ClientContext.getCellCache(session);
            if (cache == null) {
                LOGGER.warning("Unable to find Cell cache for session " + session);
                return;
            }
            Cell draggedCell = cache.getCell(cellID);
            if (draggedCell == null) {
                LOGGER.warning("Unable to find dragged Cell with ID " + cellID);
                return;
            }

            // Find out what Cell ID this was dropped over. This will form the
            // new parent. If the Cell is dropped over the world root, then set
            // the CellID to InvalidCellID
            CellID parentCellID = CellID.getInvalidCellID();
            SortedTreeNode treeNode = (SortedTreeNode) path.getLastPathComponent();
            Object userObject = treeNode.getUserObject();
            Cell newParent = null;
            if (userObject instanceof Cell && !(userObject instanceof EnvironmentCell)) {
                parentCellID = ((Cell) userObject).getCellID();
                newParent = (Cell) userObject;
                if (draggedCell.equals(newParent) == true) {
                    // User dropped cell on itself, return !
                    return;
                }
            }

            // Find the world transform of the new parent. If there is no new
            // parent (e.g. if the Cell is to be placed at the world root), then
            // use a null transform.
            CellTransform newParentWorld = new CellTransform(null, null);
            if (newParent != null) {
                newParentWorld = newParent.getWorldTransform();
            }

            CellTransform newChildLocal = ScenegraphUtils.computeChildTransform(
                    newParentWorld, draggedCell.getWorldTransform());
View Full Code Here

    private static final Logger LOGGER = Logger.getLogger(AvatarImiJME.class.getName());

    public AvatarImiJME(Cell cell) {
        super(cell);
        assert (cell != null);
        final Cell c = cell;

        // Listen for avatar configuration changes.
        AvatarConfigComponent comp = cell.getComponent(AvatarConfigComponent.class);
        comp.addAvatarConfigChangeListener(new AvatarChangeListener());

        // XXX NPC HACK XXX
        if (cell instanceof AvatarCell)
            username = ((AvatarCell) cell).getIdentity().getUsername();
        else
            username = "npc"; // HACK !

        characterMotionListener = new CharacterMotionListener() {
            Vector3f prevTrans;
            PMatrix prevRot;
            float prevHeight;
            boolean prevCollision;
           
            public void transformUpdate(Vector3f translation, PMatrix rotation) {
                if (logger.isLoggable(Level.FINEST)) {
                    logger.finest("Transform update: translation: prev: " +
                            prevTrans + " cur: " + translation +
                            " rotation: prev: " + prevRot + " cur: " +
                            rotation);
                }
               
                float height = avatarCharacter.getController().getHeight();
                boolean collision = avatarCharacter.getController().isColliding();
            
                if (prevTrans == null || !Math3DUtils.epsilonEquals(prevTrans, translation, 0.001f) ||
                    prevRot == null || !prevRot.epsilonEquals(rotation, 0.001f) ||
                    !Math3DUtils.epsilonEquals(prevHeight, height, 0.001f) ||
                    prevCollision != collision)
                {                   
                    MovableAvatarComponent mac = ((MovableAvatarComponent) c.getComponent(MovableComponent.class));
                    mac.localMoveRequest(new CellTransform(rotation.getRotation(), translation), height, collision);

                    prevTrans = translation.clone();
                    prevRot = new PMatrix(rotation);
                    prevHeight = height;
                    prevCollision = collision;
                }
            };  
        };

        // This info will be sent to the other clients to animate the avatar
        gameContextListener = new GameContextListener() {

            public void trigger(boolean pressed, int trigger, Vector3f translation, Quaternion rotation) {
                synchronized (this) {
                    currentTrigger = trigger;
                    currentPressed = pressed;
                }
               
                String animationName = null;
               
                // OWL issue #237 - regardless of the current state, send the
                // animation that is currently set in CycleActionState. This
                // is consistent with the behavior of
                // WlAvatarContext.setMiscAnimation() used in the trigger()
                // method below
                CycleActionState cas = (CycleActionState)
                        avatarCharacter.getContext().getState(CycleActionState.class);
                if (cas != null) {
                    animationName = cas.getAnimationName();
                }
                               
                float height = avatarCharacter.getController().getHeight();
                boolean collision = avatarCharacter.getController().isColliding();
               
                if (c.getComponent(MovableComponent.class)==null) {
                    logger.warning("!!!! NULL MovableComponent");
                } else {
                    MovableAvatarComponent mac = ((MovableAvatarComponent) c.getComponent(MovableComponent.class));
                    mac.localMoveRequest(new CellTransform(rotation, translation),
                                         trigger, pressed, animationName,
                                         height, collision, null);
               
                }
View Full Code Here

                CellID parentCellID,
                CellTransform cellTransform,
                CellClientState setup,
                String cellName) {
            System.out.println("LOAD CELL "+cellID);
            Cell ret = cacheImpl.loadCell(cellID,
                               className,
                               localBounds,
                               parentCellID,
                               cellTransform,
                               setup,
                               cellName);
            repaint();
           
            // add a move listener
            MovableComponent mc = ret.getComponent(MovableComponent.class);
            if (mc != null) {
                mc.addServerCellMoveListener(this);
            }
           
           
View Full Code Here

    if (presenceInfo.getCellID() == null) {
        logger.warning("CellID is null for " + presenceInfo);
        continue;
    }

    Cell cell = cellCache.getCell(presenceInfo.getCellID());

    if (cell == null) {
        logger.warning("Unable to find cell for " + presenceInfo.getCellID());
        continue;
    }

    NameTagComponent nameTag = cell.getComponent(NameTagComponent.class);

    if (presenceInfo.getUsernameAlias().equals(username) == false) {
         pm.changeUsernameAlias(presenceInfo, presenceInfo.getUsernameAlias());
     }
View Full Code Here

    private synchronized boolean checkIfAllCellsLoaded(Collection<Cell> rootCells, int level, boolean log) {

        Iterator<Cell> itr = rootCells.iterator();
        while (itr.hasNext()) {
            Cell c = itr.next();
            if (log) {
                for (int i = 0; i < level; i++) {
                    System.out.print("   ");
                }
                System.out.println(" " + c.getName() + " - " + c.getStatus());
            }
            List<Cell> childs = c.getChildren();
            if (!c.getStatus().equals(CellStatus.VISIBLE)) {
                return false;
            }
            if (childs.size() != 0) {
                if (!checkIfAllCellsLoaded(childs, level + 1, log)) {
                    return false;
View Full Code Here

        final SimpleContextMenuItem duplicateItem = new SimpleContextMenuItem(
                BUNDLE.getString("Duplicate"), null, new DuplicateListener());

        // find the security component for both this cell and it's parent,
        // if any
        final Cell cell = event.getPrimaryCell();
        final SecurityComponent sc = cell.getComponent(SecurityComponent.class);
        final SecurityComponent psc;
        if (cell.getParent() != null) {
            psc = cell.getParent().getComponent(SecurityComponent.class);
        } else {
            psc = null;
        }

        // see if we can check security locally, or if we have to make a
View Full Code Here

    private class DeleteListener implements ContextMenuActionListener {

        public void actionPerformed(ContextMenuItemEvent event) {
            // Display a confirmation dialog to make sure we really want to
            // delete the cell.
            Cell cell = event.getCell();
            String message = BUNDLE.getString("Confirm_Delete_Message");
            message = MessageFormat.format(message, cell.getName());
            int result = JOptionPane.showConfirmDialog(
                    JmeClientMain.getFrame().getFrame(),
                    message, BUNDLE.getString("Confirm_Delete"),
                    JOptionPane.YES_NO_OPTION);
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.