Package org.jdesktop.wonderland.client.contextmenu

Examples of org.jdesktop.wonderland.client.contextmenu.ContextMenuInvocationSettings


        // Tell the context menu listeners that we are about to display a
        // context menu, giving listeners an opportunity to make adjustments
        ContextMenuManager.getContextMenuManager().fireContextMenuEvent(ctxEvent);

        // get the settings from the event, possibly adjusted by listeners
        ContextMenuInvocationSettings settings = ctxEvent.getSettings();
        // Adjust name of menu (by default, this is the cell's name)
        JPanel titlePanel = new JPanel();
        titlePanel.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
        titlePanel.setBackground(WL_BLUE);
        JLabel title = new JLabel("<html><b>" + settings.getMenuName() + "</b></html>");
        title.setForeground(Color.WHITE);
        title.setBackground(Color.GRAY);
        titlePanel.add(title);
        contextPanel.add(titlePanel);
        contextPanel.invalidate();
       
        // Fetch the manager of the context menu
        ContextMenuManager cmm = ContextMenuManager.getContextMenuManager();
       
        // fetch context menu component
        ContextMenuComponent cmc = cell.getComponent(ContextMenuComponent.class);
       
        // show standard menu items?
        if (settings.isDisplayStandard() == true) {
          // fetch standard items from CMM
          List<ContextMenuFactorySPI> factoryList = cmm.getContextMenuFactoryList();
          // add each item to the menu
          for (ContextMenuFactorySPI factory : factoryList) {
              ContextMenuItem items[] = factory.getContextMenuItems(event);
              for (ContextMenuItem item : items) {
                  addContextMenuItem(item, cell);
              }
          }
        }

        // show cell-specific standard items?
        if (settings.isDisplayCellStandard() && cmc != null) {
          // fetch standard factories from CMC
          ContextMenuFactorySPI factories[] = cmc.getContextMenuFactories();
          // add each item to the menu
          for (ContextMenuFactorySPI factory : factories) {
              ContextMenuItem items[] = factory.getContextMenuItems(event);
              for (ContextMenuItem item : items) {
                  addContextMenuItem(item, cell);
              }
          }
        }

        // show temporary items?

        if (settings.isDisplayTemporaryFactories()) {
          // fetch standard factories from CMC
          List<ContextMenuFactorySPI> factoryList = settings.getFactoryList();
          // add each item to the menu
          for (ContextMenuFactorySPI factory : factoryList) {
              ContextMenuItem items[] = factory.getContextMenuItems(event);
              for (ContextMenuItem item : items) {
                  addContextMenuItem(item, cell);
View Full Code Here


                // only deal with invocations on AvatarCell
                if (!(event.getPrimaryCell() instanceof AvatarCell)) {
                    return;
                }

                ContextMenuInvocationSettings settings = event.getSettings();
                settings.setDisplayStandard(false);
                settings.setDisplayCellStandard(false);

                AvatarCell cell = (AvatarCell) event.getPrimaryCell();
                settings.setMenuName(cell.getIdentity().getUsername());

                // if this is our avatar, add the configuration menu
                if (cell == ViewManager.getViewManager().getPrimaryViewCell()) {
                    settings.addTempFactory(new ConfigureContextMenuFactory());
                }
            }
        };

        // register the renderer for this session
View Full Code Here

                // only deal with invocations on AvatarCell
                if (!(event.getPrimaryCell() instanceof AvatarCell)) {
                    return;
                }

                ContextMenuInvocationSettings settings = event.getSettings();
                AvatarCell cell = (AvatarCell) event.getPrimaryCell();

                // if this is our avatar, add the configuration menu
                if (cell != ViewManager.getViewManager().getPrimaryViewCell()) {
                    settings.addTempFactory(new AudioContextMenuFactory(cell));
                }
            }
        };

        audioMeterListener = new HUDEventListener() {
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.client.contextmenu.ContextMenuInvocationSettings

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.