Examples of PlacemarkList


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

        // Upon error, log an error and return an empty list. Then fetch the
        // items from this collection
        try {
            ContentCollection sysNode = getUserPlacemarksContentCollection();
            if (sysNode == null) {
                return new PlacemarkList();
            }
            return getItemList(sysNode);
        } catch (ContentRepositoryException excp) {
            logger.log(Level.WARNING, "Unable to get user placemarks", excp);
            return new PlacemarkList();
        } catch (JAXBException excp) {
            logger.log(Level.WARNING, "Unable to parse user placemarks", excp);
            return new PlacemarkList();
        }
    }
View Full Code Here

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

        // Find the placemarks.xml file and parse as a PlacemarkList object.
        ContentResource resource = (ContentResource)collection.getChild("placemarks.xml");
        if (resource == null) {
            logger.warning("Unable to find placemarks.xml in " + collection.getPath());
            return new PlacemarkList();
        } else {
            logger.warning("find placemarks.xml in " + collection.getPath());
        }
       
        Reader r = new InputStreamReader(resource.getInputStream());
        PlacemarkList out = PlacemarkList.decode(r);
   
        // Filtering out placemarks that are not for the server we're logged on.
        // getPlacemarksAsList() returns a copy, so we can safely remove
        // placemarks without ConcurrentModificationExceptions
        String serverURL = LoginManager.getPrimary().getServerURL();
        for (Placemark p : out.getPlacemarksAsList()) {
           if (!p.getUrl().equals(serverURL)) {
               out.removePlacemark(p.getName());
           }
        }
       
        return out;
    }
View Full Code Here

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

    public static void addUserPlacemark(Placemark placemark)
            throws ContentRepositoryException, JAXBException {

        // First fetch the PlacemarkList for the user and add the new Placemark
        // and write the new list out
        PlacemarkList placemarkList = getUserPlacemarkList();
        placemarkList.addPlacemark(placemark);
        ContentCollection c = getUserPlacemarksContentCollection();
        setItemList(c, placemarkList);
    }
View Full Code Here

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

    public static void removeUserPlacemark(String name)
            throws ContentRepositoryException, JAXBException {

        // First fetch the PlacemarkList for the user and remove the Placemark
        // and write the new list out
        PlacemarkList placemarkList = getUserPlacemarkList();
        placemarkList.removePlacemark(name);
        ContentCollection c = getUserPlacemarksContentCollection();
        setItemList(c, placemarkList);
    }
View Full Code Here

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

        df = (DecimalFormat)DecimalFormat.getNumberInstance();
        df.setMinimumFractionDigits(2);
        df.setMaximumFractionDigits(2);

        // Create the user table to display the user Placemarks
        PlacemarkList placemarkList = PlacemarkUtils.getUserPlacemarkList();
        placemarksTableModel =
                new PlacemarkTableModel(placemarkList.getPlacemarksAsList());
        placemarksTable = new JTable(placemarksTableModel);
        placemarksTable.setColumnSelectionAllowed(false);
        placemarksTable.setRowSelectionAllowed(true);
        placemarksTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        userScrollPane.setViewportView(placemarksTable);
View Full Code Here

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

        // Fetch the name of the placemark to be deleted.
        String name = request.getParameter("name");

        // Fetch the PlacemarkList from the /system/placemarks/placemarks.xml
        // file.
        PlacemarkList placemarkList = getPlacemarkList();
        Placemark placemark = placemarkList.getPlacemark(name);

        // Remove the placemark given the name. It should exist. If not, then
        // the HTML list will get reloaded anyway. Write back to the placemarks.xml
        // file
        placemarkList.removePlacemark(name);
        setPlacemarkList(placemarkList);

        // Tell the config connection that we have removed a Placemark, if the
        // config connection exists (it should)
        Object obj = getServletContext().getAttribute(PLACEMARKS_CONN_ATTR);
View Full Code Here

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

        float z = parseFloatString(request.getParameter("z"));
        float angle = parseFloatString(request.getParameter("angle"));

        // Fetch the PlacemarkList from the /system/placemarks/placemarks.xml
        // file.
        PlacemarkList placemarkList = getPlacemarkList();

        // Check to see if a name has been entered, flag an error if not
        if (name == null || name.equals("") == true) {
            String msg = "No name was entered for the Placemark. Cancelling.";
            error(request, response, msg);
            return;
        }
       
        // Check to see if the placemark already exists, flag an error if so.
        if (placemarkList.getPlacemark(name) != null) {
            String msg = "A Placemark named " + name + " already exists.";
            error(request, response, msg);
            return;
        }

        // Add the new placemark to the list of placemarks. Write the data
        // back out to the file.
        Placemark placemark = new Placemark(name, url, x, y, z, angle);
        placemarkList.addPlacemark(placemark);
        setPlacemarkList(placemarkList);

        // Tell the config connection that we have added a new Placemark, if
        // the config connection exists (it should)
        Object obj = getServletContext().getAttribute(PLACEMARKS_CONN_ATTR);
View Full Code Here

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

    {
        // Read in and parse the system-wide Placemarks configuration file.
        // Iterate through each child found and add an entry to spit out to
        // the HTML page.
        Collection<PlacemarkEntry> entries = new ArrayList();
        PlacemarkList placemarkList = getPlacemarkList();
        Set<String> nameSet = placemarkList.getPlacemarkNames();
        for (String name : nameSet) {
            // Create a new entry for the HTML page to list
            Placemark placemark = placemarkList.getPlacemark(name);
            PlacemarkEntry entry = new PlacemarkEntry();
            entry.name = placemark.getName();
            entry.url = placemark.getUrl();
            entry.x = placemark.getX();
            entry.y = placemark.getY();
View Full Code Here

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

        // Try to find the "placemarks.xml" file. If it does not exist, then
        // create it with an empty PlacemarksList.
        ContentResource r = (ContentResource)c.getChild("placemarks.xml");
        if (r == null) {
            r = (ContentResource)c.createChild("placemarks.xml", Type.RESOURCE);
            PlacemarkList placemarkList = new PlacemarkList();
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            Writer w = new OutputStreamWriter(os);
            placemarkList.encode(w);
            r.put(os.toByteArray());
        }
        return r;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.