Package org.jdesktop.wonderland.modules.placemarks.common

Examples of org.jdesktop.wonderland.modules.placemarks.common.CoverScreenData


        //cell status change listener for removing cover screen
        if(!prop.equalsIgnoreCase("off")) {
           
            LoginCoverScreenInfo info = PlacemarkUtils.getLoginCoverScreenInfo();
           
            CoverScreenData csd = new CoverScreenData();
            if(info!=null) {
                csd.setBackgroundColor(info.getBackgroundColor());
                csd.setImageURL(info.getImageURL());
                csd.setMessage(info.getMessage());
                csd.setTextColor(info.getTextColor());
            }
            new CoverScreenListener(null,sessionManager,null,"initial",csd);
        }
       
        // We will listen for changes to the list of registered Placemarks and
        // edit the main menu as a result.
        listener = new PlacemarkPlugin.PlacemarkMenuListener();

        // Create a new base connection to use for Placemark Config updates and
        // registry for notifications in changes to the current session.
        placemarksConfigConnection = new PlacemarkClientConfigConnection();
        sessionManager.addLifecycleListener(this);

        // Create the "Manage Placemarks..." menu item. The menu will be added
        // when our server intiializes.
        manageMI = new JMenuItem(BUNDLE.getString("Manage_Placemarks..."));
        manageMI.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                EditPlacemarksJFrame managePlacemarksFrame;
                if (managePlacemarksFrameRef == null ||
                        managePlacemarksFrameRef.get() == null) {
                    JFrame frame = JmeClientMain.getFrame().getFrame();
                    managePlacemarksFrame = new EditPlacemarksJFrame();
                    managePlacemarksFrame.setLocationRelativeTo(frame);
                    managePlacemarksFrameRef =
                            new WeakReference(managePlacemarksFrame);
                } else {
                    managePlacemarksFrame = managePlacemarksFrameRef.get();
                }

                if (!managePlacemarksFrame.isVisible()) {
                    managePlacemarksFrame.setVisible(true);
                }
            }
        });

        // Create the "Add Placemark..." menu item. This menu will be added when
        // our server initializes.
        addMI = new JMenuItem(BUNDLE.getString("Add_Placemark..."));
        addMI.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                JFrame frame = JmeClientMain.getFrame().getFrame();

                // Form a placemark with the current position about the avatar's
                // location.
                Placemark placemark = getCurrentPlacemark(sessionManager);

                // Fetch the list of known USER Placemark names
                PlacemarkRegistry registry =
                        PlacemarkRegistryFactory.getInstance();
                Set<Placemark> placemarkSet =
                        registry.getAllPlacemarks(PlacemarkType.USER);

                // Display a dialog with the values in the Placemark. And if we
                // wish to update the values, then re-add the placemark.
                // (Re-adding the placemark should have the effect of updating
                // its values.
                AddEditPlacemarkJDialog dialog = new AddEditPlacemarkJDialog(
                        frame, true, placemark, placemarkSet);
                dialog.setTitle(BUNDLE.getString("Add_Placemark"));
                dialog.setLocationRelativeTo(frame);
                dialog.pack();
                dialog.setVisible(true);

                if (dialog.getReturnStatus() ==
                        AddEditPlacemarkJDialog.RET_OK) {
                    // Create a new placemark with the new information.
                    String name = dialog.getPlacemarkName();
                    String url = dialog.getServerURL();
                    float x = dialog.getLocationX();
                    float y = dialog.getLocationY();
                    float z = dialog.getLocationZ();
                    float angle = dialog.getLookAtAngle();
                    ColorRGBA backColor = dialog.getBackgroundColor();
                    ColorRGBA textColor = dialog.getTextColor();
                    String imageURL = dialog.getImageURL();
                    String message = dialog.getMessage();
                    Placemark newPlacemark = new Placemark(name, url, x, y, z, angle,
                            backColor, textColor, imageURL, message);

                    try {
                        PlacemarkUtils.addUserPlacemark(newPlacemark);
                    } catch (Exception excp) {
                        LOGGER.log(Level.WARNING, "Unable to add " + name +
                                " to user's placemarks", excp);
                        return;
                    }

                    // Tell the client-side registry of placemarks that a new
                    // one has been added
                    registry.registerPlacemark(newPlacemark, PlacemarkType.USER);
                }
            }
        });

        // Menu item to take avatar to starting location
        startingLocationMI = new JMenuItem(BUNDLE.getString("Starting_Location"));
        startingLocationMI.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
               
                Vector3f position = new Vector3f();
                Quaternion look = new Quaternion();

                String prop = System.getProperty("Placemark.CoverScreen");
                if(prop == null) {
                    prop="";
                }
                if(!prop.equalsIgnoreCase("off")) {
                    if(!(ClientContextJME.getViewManager()
                            .getPrimaryViewCell().getWorldTransform().getTranslation(null).x==position.x &&
                            ClientContextJME.getViewManager()
                            .getPrimaryViewCell().getWorldTransform().getTranslation(null).z==position.z)) {

                        Placemark pl = new Placemark("", sessionManager.getServerURL()
                                , position.x, position.y, position.z, 0);
                        if(systemPlacemarkMenuItems!=null && systemPlacemarkMenuItems.keySet()!=null) {
                            Iterator<Placemark> sysItr = systemPlacemarkMenuItems.keySet().iterator();
                            while(sysItr.hasNext()) {
                                Placemark p = sysItr.next();
                               
                                if(p.getX()==0 && p.getZ()==0) {
                                    pl = p;
                                }
                            }
                        }
                       
                        //cell status change listener for removing cover screen
                        CoverScreenData csd = new CoverScreenData();
                        csd.setBackgroundColor(pl.getBackgroundColor());
                        csd.setImageURL(pl.getImageURL());
                        csd.setMessage(pl.getMessage());
                        csd.setTextColor(pl.getTextColor());
                        new CoverScreenListener(pl,sessionManager,new Vector3f(pl.getX(),pl.getY(),pl.getZ()),"starting location",csd);

                    }
                }
                try {
View Full Code Here


                        .getPrimaryViewCell().getWorldTransform().getTranslation(null).x==location.x &&
                        ClientContextJME.getViewManager()
                        .getPrimaryViewCell().getWorldTransform().getTranslation(null).z==location.z)) {

                    //cell status change listener for removing cover screen
                    CoverScreenData csd = new CoverScreenData(placemark.getBackgroundColor(),
                            placemark.getTextColor(), placemark.getImageURL(), placemark.getMessage());
                    new CoverScreenListener(placemark,getSessionManager(),location,"change",csd);
                }
            }
           
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.placemarks.common.CoverScreenData

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.