Examples of AvatarRegistry


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

        String avatarName = avatar.getName();
        avatar.delete();

        // If the deleted avatar is currently the avatar in use, then reset to
        // the default avatar.
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
        if (registry.isAvatarInUse(avatarName) == true) {
            AvatarSPI defaultAvatar = registry.getDefaultAvatar();
            if (defaultAvatar == null) {
                LOGGER.warning("Unable to reset avatar to default, none exists.");
                return;
            }
            registry.setAvatarInUse(defaultAvatar, false);
        }
    }//GEN-LAST:event_deleteButtonActionPerformed
View Full Code Here

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

        // Generate a new avatar, using the IMI avatar as a factory, since we
        // can only create new IMI avatars. (In the future, perhaps there should
        // be some registry that generates a new avatar, rather than hard-coding
        // the IMI stuff. First generate a new unique name for the avatar.
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
        String avatarName = registry.getUniqueAvatarName();
        ImiAvatar newAvatar = ImiAvatar.createAvatar(avatarName);

        // Next, simply tell the new avatar to configure itself. It is then
        // responsible for changing the appearance of the avatar, etc. to do
        // whatever it needs to do for configuration.
View Full Code Here

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

            String s = avatar.getName();
            setText(s);

            // From the avatar configuration manager, fetch the current avatar
            // in use.
            AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
            AvatarSPI avatarInUse = registry.getAvatarInUse();

            // If the avatar configuration is currently selected, then we
            // want to place a checkbox next to the name.
            if (avatar.equals(avatarInUse) == true) {
                setIcon(checkBoxIcon);
View Full Code Here

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

        // original settings when the dialog was first opened and close the
        // dialog
        cancelButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                // Revert to the avatar currently set and close the window
                AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
                registry.setAvatarInUse(registry.getAvatarInUse(), true);
                setVisible(false);
            }
        });

        // Upon the Use button, we need to set the avatar as the current
        // avatar. We do not need to apply() again, since that is done for
        // each change.
        useButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                use();
            }
        });

        // For the Randomize button, select a random set of attributes and
        // apply
        randomizeButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                currentParams.randomize();
                updateComboBoxes();
                apply();
            }
        });

        // Listen for when the window is close and do a cancel()
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                // Revert to the avatar currently set and close the window
                AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
                registry.setAvatarInUse(registry.getAvatarInUse(), true);
            }
        });

        // Listen to see if the avatar has been deleted. This can happen when
        // the window is up, but the Delete button has been pressed in the
        // main user list. We simply just close the window here.
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
        registry.addAvatarListener(new AvatarListener() {

            public void avatarAdded(AvatarSPI added) {
                // We don't care if an avatar has been added.
            }
View Full Code Here

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

    /**
     * Attempt to use the current avatar. Close the window if so.
     */
    private void use() {
        final AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();

        // Make sure the name text field is not empty.
        final String newAvatarName = nameTextField.getText().trim();
        if (newAvatarName == null || newAvatarName.equals("") == true) {
            String msg = BUNDLE.getString("PLEASE_ENTER_AVATAR_NAME");
            String title = BUNDLE.getString("AVATAR_NAME");
            JOptionPane.showMessageDialog(this, msg, title, JOptionPane.ERROR_MESSAGE);
            return;
        }

        // Make sure there are no spaces in the avatar name.
        // XXX Workaround for bug in content repo XXX
        if (newAvatarName.indexOf(" ") != -1) {
            String msg = BUNDLE.getString("AVATAR_NAME_SPACES");
            String title = BUNDLE.getString("AVATAR_NAME");
            JOptionPane.showMessageDialog(this, msg, title, JOptionPane.ERROR_MESSAGE);
            return;
        }

        // Check to see that the avatar name is not already taken. We only check
        // if the name has actually changed.
        AvatarSPI oldAvatar = registry.getAvatarByName(newAvatarName);
        if (newAvatarName.equals(originalAvatarName) == false && oldAvatar != null) {
            String msg = BUNDLE.getString("THE_AVATAR_NAME_TAKEN");
            msg = MessageFormat.format(msg, newAvatarName);
            String title = BUNDLE.getString("AVATAR_NAME");
            JOptionPane.showMessageDialog(this, msg, title, JOptionPane.ERROR_MESSAGE);
            return;
        }

        // If we are not changing the name of the avatar, then we just save the
        // avatar, close the window and return. We do this in a thread to make
        // sure the UI does not block without indication.
        if (newAvatarName.equals(originalAvatarName) == true) {
            setBusy(true);
            new Thread() {
                @Override
                public void run() {
                    avatar.setAvatarParams(currentParams);
                    save(avatar);
                    registry.setAvatarInUse(avatar, false);

                    // Close the dialog in the AWT Event Thread
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            setBusy(false);
                            setVisible(false);
                        }
                    });
                }
            }.start();
            return;
        }

        // If we are changing the name of the avatar, things get much more
        // complicated. We want to delete the old avatar, but we need to save
        // and use the new avatar first. (Because if we delete the old avatar
        // first, the system will default back to the "Default" avatar to use
        // perhaps). First, construct a new avatar, save it and use. We do
        // all of this in a thread so that we do not block the GUI
        setBusy(true);
        new Thread() {
            @Override
            public void run() {
                ImiAvatar newAvatar = ImiAvatar.createAvatar(newAvatarName);
                newAvatar.setAvatarParams(currentParams);
                save(newAvatar);
                registry.setAvatarInUse(newAvatar, false);

                // Next, delete the old avatar and close the dialog. We only
                // want to delete it if the old avatar is really new
                if (registry.getAvatarByName(originalAvatarName) != null) {
                    avatar.delete();
                }

                // Close the dialog in the AWT Event Thread
                SwingUtilities.invokeLater(new Runnable() {
View Full Code Here

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

    public synchronized void refreshAvatarInUse(ViewCell viewCell, boolean isLocal) {

        // Once the avatar loader is ready and the primary view has been set,
        // we tell the avatar cell component to set it's avatar in use.
        AvatarConfigComponent configComponent = viewCell.getComponent(AvatarConfigComponent.class);
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
        AvatarSPI avatar = registry.getAvatarInUse();
        if (avatar != null) {
            ServerSessionManager session = viewCell.getCellCache().getSession().getSessionManager();
            AvatarConfigInfo configInfo = avatar.getAvatarConfigInfo(session);
            configComponent.requestAvatarConfigInfo(configInfo, isLocal);
        }
View Full Code Here

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

    /**
     * {@inheritDoc}
     */
    public void registerAvatars(ServerSessionManager session) {
        // Create the set of basic avatars from the hard-coded list of URLs
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
        basicAvatarSet = new HashSet<BasicAvatar>();
        for (int i = 0; i < AVATARS.length; i++) {
            BasicAvatar avatar = new BasicAvatar(AVATARS[i][0], AVATARS[i][1]);
            basicAvatarSet.add(avatar);
            registry.registerAvatar(avatar, i == 0);
        }
    }
View Full Code Here

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

    /**
     * {@inheritDoc}
     */
    public void unregisterAvatars(ServerSessionManager session) {
        // Look through and unregistry all of the basic avatars
        AvatarRegistry registry = AvatarRegistry.getAvatarRegistry();
        for (BasicAvatar avatar : basicAvatarSet) {
            registry.unregisterAvatar(avatar);
        }
        basicAvatarSet.clear();
        basicAvatarSet = null;
    }
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.