Package org.jdesktop.wonderland.modules.placemarks.api.client

Examples of org.jdesktop.wonderland.modules.placemarks.api.client.PlacemarkRegistry


            }
        });

        // Listen for changes in the list of registered Placemarks in the
        // system and update the table model accordingly
        PlacemarkRegistry registry = PlacemarkRegistryFactory.getInstance();
        registry.addPlacemarkRegistryListener(new PlacemarkListener() {

            public void placemarkAdded(
                    Placemark placemark, PlacemarkType type) {
                if (type == PlacemarkType.USER) {
                    placemarksTableModel.addToPlacemarkList(placemark);
View Full Code Here


        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
        // Fetch the list of known USER Placemark names
        PlacemarkRegistry registry = PlacemarkRegistryFactory.getInstance();
        Set<Placemark> placemarkSet =
                registry.getAllPlacemarks(PlacemarkType.USER);

        // When the Add... button is pressed popup a dialog asking for all of
        // the information. Add it to the repository and registry upon OK.
        AddEditPlacemarkJDialog dialog =
                new AddEditPlacemarkJDialog(this, true, placemarkSet);
        dialog.setTitle(BUNDLE.getString("Add_Placemark"));
        dialog.setLocationRelativeTo(this);
        dialog.pack();
        dialog.setVisible(true);

        if (dialog.getReturnStatus() == AddEditPlacemarkJDialog.RET_OK) {
            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 placemark = new Placemark(name, url, x, y, z, angle, backColor, textColor,
                    imageURL, message);
            try {
                PlacemarkUtils.addUserPlacemark(placemark);
            } 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(placemark, PlacemarkType.USER);
        }
}//GEN-LAST:event_addButtonActionPerformed
View Full Code Here

            return;
        }

        // Tell the client-side registry of placemarks that a new one has
        // been added
        PlacemarkRegistry registry = PlacemarkRegistryFactory.getInstance();
        registry.unregisterPlacemark(placemark, PlacemarkType.USER);
}//GEN-LAST:event_removeButtonActionPerformed
View Full Code Here

        registry.unregisterPlacemark(placemark, PlacemarkType.USER);
}//GEN-LAST:event_removeButtonActionPerformed

    private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed
        // Fetch the list of known USER Placemark names
        PlacemarkRegistry registry = PlacemarkRegistryFactory.getInstance();
        Set<Placemark> placemarkSet =
                registry.getAllPlacemarks(PlacemarkType.USER);

        // When the Edit..... button is pressed find the Placemark selected
        // and display a dialog with the values filled in.
        int row = placemarksTable.getSelectedRow();
        if (row == -1) {
            return;
        }
        Placemark placemark = placemarksTableModel.getPlacemark(row);

        // 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(
                this, true, placemark, placemarkSet);
        dialog.setTitle(BUNDLE.getString("Edit_Placemark"));
        dialog.setLocationRelativeTo(this);
        dialog.pack();
        dialog.setVisible(true);

        if (dialog.getReturnStatus() == AddEditPlacemarkJDialog.RET_OK) {
            // First remove the old placemark.
            String oldName = placemark.getName();
            try {
                PlacemarkUtils.removeUserPlacemark(oldName);
            } catch (Exception excp) {
                LOGGER.log(Level.WARNING, "Unable to remove " + oldName +
                        " from " + " user's placemarks", excp);
                return;
            }

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

            // 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);
        }
    }//GEN-LAST:event_editButtonActionPerformed
View Full Code Here

        if (origAudioSource == null) {
      origAudioSource = "";
  }

        // update list of placemarks
        PlacemarkRegistry reg = PlacemarkRegistryFactory.getInstance();
       
        List<Placemark> allPlacemarks = new ArrayList<Placemark>();
        Placemark firstEntry = new Placemark("Select Placemark", null, 0, 0, 0, 0);
        allPlacemarks.add(firstEntry);
       
        // separator
        allPlacemarks.add(null);
       
        // system placemarks
        List<Placemark> sysPlacemarks = new ArrayList<Placemark>();
        sysPlacemarks.addAll(reg.getAllPlacemarks(PlacemarkType.SYSTEM));
        Collections.sort(sysPlacemarks, new PlacemarkSorter());
        allPlacemarks.addAll(sysPlacemarks);
       
        // separator
        allPlacemarks.add(null);
       
        // user placemarks
        List<Placemark> userPlacemarks = new ArrayList<Placemark>();
        userPlacemarks.addAll(reg.getAllPlacemarks(PlacemarkType.USER));
        Collections.sort(userPlacemarks, new PlacemarkSorter());
        allPlacemarks.addAll(userPlacemarks);
       
        placemarkCB.setModel(new DefaultComboBoxModel(allPlacemarks.toArray()));
   
View Full Code Here

                // 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
View Full Code Here

    @Override
    protected void activate() {

        // Listen for changes to the list of Placemarks. This needs to come
        // first before we actually add the Placemarks from WebDav
        PlacemarkRegistry registry = PlacemarkRegistryFactory.getInstance();
        registry.addPlacemarkRegistryListener(listener);

        // Fetch the list of user placemarks from WebDav and register them
        for (Placemark placemark : PlacemarkUtils.getUserPlacemarkList().getPlacemarksAsList()) {
            registry.registerPlacemark(placemark, PlacemarkType.USER);
        }

        // Add the MANAGEMENT related Placemarks to the main frame
        JmeClientMain.getFrame().addToPlacemarksMenu(startingLocationMI, 0, MainFrame.PlacemarkType.MANAGEMENT);
        JmeClientMain.getFrame().addToPlacemarksMenu(addMI, -1, MainFrame.PlacemarkType.MANAGEMENT);
View Full Code Here

     * Listens for when Placemarks are added or removed.
     */
    private class ClientPlacemarkConfigListener implements PlacemarkConfigListener {

        public void placemarkAdded(Placemark placemark) {
            PlacemarkRegistry registry =
                    PlacemarkRegistryFactory.getInstance();
            registry.registerPlacemark(placemark, PlacemarkType.SYSTEM);
            //addCoverScreenMenu();
        }
View Full Code Here

            registry.registerPlacemark(placemark, PlacemarkType.SYSTEM);
            //addCoverScreenMenu();
        }

        public void placemarkRemoved(Placemark placemark) {
            PlacemarkRegistry registry =
                    PlacemarkRegistryFactory.getInstance();
            registry.unregisterPlacemark(placemark, PlacemarkType.SYSTEM);
            //addCoverScreenMenu();
        }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.placemarks.api.client.PlacemarkRegistry

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.