Package org.jdesktop.wonderland.common.cell

Examples of org.jdesktop.wonderland.common.cell.ProximityListenerRecord$ProximityListenerWrapper


     * @param listener the listener that will be notified
     * @param localBounds the array of bounds (in cell local coordinates) for which the listener will be notified
     */
    public void addProximityListener(ProximityListener listener, BoundingVolume[] localBounds) {
        synchronized(listenerRecords) {
           ProximityListenerRecord lr = new ProximityListenerRecord(new ClientProximityListenerWrapper(cell,listener), localBounds);
           listenerRecords.add(lr);
           if (status!=null && status.ordinal()>=CellStatus.ACTIVE.ordinal()) {
               lr.updateWorldBounds(cell.getWorldTransform());

               // OWL issue #32: update the view position as well, so we are
               // notified immediately if the client is already in view
               Cell viewCell = ClientContextJME.getViewManager().getPrimaryViewCell();
               if (viewCell != null) {
                   lr.viewCellMoved(viewCell.getCellID(), viewCell.getWorldTransform());
               }
           }
        }
    }
View Full Code Here


     * attached to this ProximityComponent
     * @param listener the listener to remove
     */
    public void removeProximityListener(ProximityListener listener) {
        // dummy record to compare against
        ProximityListenerRecord comp = new ProximityListenerRecord(
                new ClientProximityListenerWrapper(cell, listener), new BoundingVolume[0]);
        ProximityListenerRecord found = null;
       
        synchronized(listenerRecords) {
            // find and cleanup the record
            for (ProximityListenerRecord rec : listenerRecords) {
                if (rec.equals(comp)) {
                    found = rec;
                    break;
                }
            }
           
            listenerRecords.remove(comp);
           
            if (found != null) {
                // clean up the listener so an exit event is generated
                Cell viewCell = ClientContextJME.getViewManager().getPrimaryViewCell();
                found.cleanup(viewCell.getCellID());
            }           
        }
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.common.cell.ProximityListenerRecord$ProximityListenerWrapper

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.