Package org.jdesktop.wonderland.modules.avatarbase.client.registry

Examples of org.jdesktop.wonderland.modules.avatarbase.client.registry.AvatarRegistry$AvatarRegistryHolder


     * Default constructor
     */
    private ImiAvatarConfigManager() {
        // Fetch the IMI base content collection for configuration, which is
        // the imi/ directory beneath the avatar base.
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
        ContentCollection bc = registry.getAvatarCollection();
        try {
            imiCollection = (ContentCollection) bc.getChild("imi");
            if (imiCollection == null) {
                imiCollection = (ContentCollection) bc.createChild("imi", Type.COLLECTION);
            }
View Full Code Here


    /**
     * Registers the known local avatars with the avatar registry.
     */
    public void registerAvatars() {
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
        synchronized (localAvatars) {
            for (String avatarName : localAvatars.keySet()) {
                ImiAvatar avatar = localAvatars.get(avatarName);
                registry.registerAvatar(avatar, false);
            }
        }
    }
View Full Code Here

    /**
     * Unregisters the known local avatars with the avatar registry.
     */
    public void unregisterAvatars() {
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
        synchronized (localAvatars) {
            for (String avatarName : localAvatars.keySet()) {
                ImiAvatar avatar = localAvatars.get(avatarName);
                registry.unregisterAvatar(avatar);
            }
        }
    }
View Full Code Here

        // them to remove the avatar too.
        synchronized (localAvatars) {
            localAvatars.remove(avatar.getName());

            // Remove the avatar from the system
            AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
            registry.unregisterAvatar(avatar);

            try {
                // Remove from the user's local repository.
                String fileName = avatar.getResource().getName();
                imiCollection.removeChild(fileName);
View Full Code Here

        }

        // If the avatar is new, tell the system.
        if (existingAvatar == null) {
            logger.info("Registering avater named " + avatarName + " in the system");
            AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
            registry.registerAvatar(avatar, false);
        }
    }
View Full Code Here

                    for (ImiAvatar newAvatar : newAvatarList) {
                        logger.info("Adding new local avatar to system " +
                                "named " + newAvatar.getName());

                        localAvatars.put(newAvatar.getName(), newAvatar);
                        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
                        registry.registerAvatar(newAvatar, false);
                    }
                }
            } catch (ContentRepositoryException excp) {
                logger.log(Level.WARNING, "Error synchronizing with server " +
                        manager.getServerURL(), excp);
View Full Code Here

        // the currently selected avatar configuration
        avatarList.setCellRenderer(new AvatarListCellRenderer());

        // Listen for when an avatar has been added or remove from the list of
        // avatars and update the JList appropriately.
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
        registry.addAvatarListener(new AvatarListener() {
            public void avatarAdded(AvatarSPI avatar) {
                ((DefaultListModel) avatarList.getModel()).addElement(avatar);
            }

            public void avatarRemoved(AvatarSPI avatar) {
                ((DefaultListModel) avatarList.getModel()).removeElement(
                        avatar);
            }
        });

        // Listen for when a new avatar has been selected for use and repaint
        // the list. We do not need to do this in the AWT Event Thread because
        // repaint() just schedules something there
        registry.addAvatarInUseListener(new AvatarInUseListener() {
            public void avatarInUse(AvatarSPI avatar, boolean isLocal) {
                avatarList.repaint();
            }
        });
View Full Code Here

    /**
     * Populates the list of configured avatar names.
     */
    private void populateAvatarList() {
        DefaultListModel listModel = (DefaultListModel) avatarList.getModel();
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
       
        // sort avatars by name
        Set<AvatarSPI> avatarSet = new TreeSet<AvatarSPI>(new Comparator<AvatarSPI>() {
            public int compare(AvatarSPI o1, AvatarSPI o2) {
                return o1.getName().compareTo(o2.getName());
            }
        });
        avatarSet.addAll(registry.getAllAvatars());

        // We want to make sure the default avatar if the first, so add it. We
        // also need to remove it from the list so it does not get added twice.
        AvatarSPI defaultAvatar = registry.getDefaultAvatar();
        if (defaultAvatar != null) {
            listModel.addElement(defaultAvatar);
            avatarSet.remove(defaultAvatar);
        }
       
View Full Code Here

        // Finally, we see if the select avatar is the one currently in use.
        // If so, do not enable the Use button
        if (selected == true) {
            AvatarSPI avatar = (AvatarSPI) avatarList.getSelectedValue();
            AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
            AvatarSPI avatarInUse = registry.getAvatarInUse();
            if ((avatarInUse != null) && avatarInUse.equals(avatar)) {
                useButton.setEnabled(false);
            }
        }
    }
View Full Code Here

    private void useButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useButtonActionPerformed

        // Find the selected avatar. If the avatar does not require high-res
        // graphics, then simply set the avatar in use and return.
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
        AvatarSPI avatar = (AvatarSPI) avatarList.getSelectedValue();
        if (avatar.isHighResolution() == false) {
            registry.setAvatarInUse(avatar, false);
            return;
        }

        if (!AvatarImiJME.supportsHighQualityAvatars()) {
            String msg = "Unfortunately your system graphics does not" +
                    " support the shaders which are required to use" +
                    " this avatar";
            String title = "Advanced Shaders Required";
            JFrame frame = JmeClientMain.getFrame().getFrame();
            JOptionPane.showMessageDialog(frame, msg, title, JOptionPane.ERROR_MESSAGE);
            return;
        }

        // Tell the server to use the selected avatar. Since the Use button is
        // only enabled when an item is selected, we assume something is
        // selected in the list. At this point, we also know the graphics system
        // supports the avatar, if high-res.
        registry.setAvatarInUse(avatar, false);
    }//GEN-LAST:event_useButtonActionPerformed
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.avatarbase.client.registry.AvatarRegistry$AvatarRegistryHolder

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.