Package com.smartgwt.client.widgets.menu.events

Examples of com.smartgwt.client.widgets.menu.events.ClickHandler


        content = new HTMLFlow();
        content.setPosition(Positioning.ABSOLUTE);
        injectFunctions(this);
        showDetailsMenu = new Menu();
        MenuItem showDetailsMenuItem = new MenuItem(MSG.view_messageCenter_messageBarShowDetails());
        showDetailsMenuItem.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(MenuItemClickEvent event) {
                MessageCenterView.showDetails(MessageBar.this.currentMessage);
            }
        });

        MenuItem showRootCauseMenuItem = new MenuItem(MSG.view_messageCenter_messageRootCause());
        showRootCauseMenuItem.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(MenuItemClickEvent event) {
                Message msg = MessageBar.this.currentMessage;
                if (msg != null) {
                    String rootCause = msg.getRootCauseMessage();
View Full Code Here


    public OpenSupportCaseMenuItem(ResourceComposite rc) {
        super(RhAccessView.PAGE_RESOURCE_CASE.getTitle());
        this.resourceComposite = rc;

        addClickHandler(new ClickHandler() {
            @Override
            public void onClick(MenuItemClickEvent event) {
                CoreGUI.goToView(RhAccessView.VIEW_ID.getName() + "/" + RhAccessView.PAGE_RESOURCE_CASE.getName() + "/"
                    + resourceComposite.getResource().getId());
            }
View Full Code Here

            // separator
            addItem(new MenuItemSeparator());

            // refresh node
            MenuItem refresh = new MenuItem(MSG.common_button_refresh());
            refresh.addClickHandler(new ClickHandler() {

                public void onClick(MenuItemClickEvent event) {
                    // refresh the tree and detail
                    ((ResourceTreeView) treeView).contextMenuRefresh(treeGrid, node, false);
                }
            });
            addItem(refresh);
        }

        // separator
        addItem(new MenuItemSeparator());

        // plugin config
        MenuItem pluginConfiguration = new MenuItem(MSG.view_tabs_common_connectionSettings());
        boolean pluginConfigEnabled = resourceType.getPluginConfigurationDefinition() != null;
        pluginConfiguration.setEnabled(pluginConfigEnabled);
        if (pluginConfigEnabled) {
            pluginConfiguration.addClickHandler(new ClickHandler() {
                public void onClick(MenuItemClickEvent event) {
                    CoreGUI.goToView(LinkManager.getEntityTabLink(EntityContext.forGroup(group), "Inventory",
                        "ConnectionSettings"));
                }
            });
        }
        addItem(pluginConfiguration);

        // resource config
        MenuItem resourceConfiguration = new MenuItem(MSG.view_tree_common_contextMenu_resourceConfiguration());
        boolean resourceConfigEnabled = groupComposite.getResourcePermission().isConfigureRead()
            && resourceType.getResourceConfigurationDefinition() != null;
        resourceConfiguration.setEnabled(resourceConfigEnabled);
        if (resourceConfigEnabled) {
            resourceConfiguration.addClickHandler(new ClickHandler() {
                public void onClick(MenuItemClickEvent event) {
                    CoreGUI.goToView(LinkManager.getEntityTabLink(EntityContext.forGroup(group), "Configuration",
                        "Current"));
                }
            });
        }
        addItem(resourceConfiguration);

        // separator
        addItem(new MenuItemSeparator());

        // Operations Menu
        MenuItem operations = new MenuItem(MSG.common_title_operations());
        boolean operationsEnabled = (groupComposite.getResourcePermission().isControl()
            && null != resourceType.getOperationDefinitions() && !resourceType.getOperationDefinitions().isEmpty());
        operations.setEnabled(operationsEnabled);
        if (operationsEnabled) {
            Menu opSubMenu = new Menu();
            //sort the display items alphabetically
            TreeSet<String> ordered = new TreeSet<String>();
            Map<String, OperationDefinition> definitionMap = new HashMap<String, OperationDefinition>();
            for (OperationDefinition o : resourceType.getOperationDefinitions()) {
                ordered.add(o.getDisplayName());
                definitionMap.put(o.getDisplayName(), o);
            }

            for (String displayName : ordered) {
                final OperationDefinition operationDefinition = definitionMap.get(displayName);

                MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
                operationItem.addClickHandler(new ClickHandler() {
                    public void onClick(MenuItemClickEvent event) {
                        String viewPath = LinkManager.getEntityTabLink(EntityContext.forGroup(group),
                            ResourceDetailView.Tab.Operations.NAME, "Schedules")
                            + "/0/"
                            + operationDefinition.getId();
View Full Code Here

        Menu menu = new Menu();
        for (SectionStackSection section : sectionStack.getSections()) {
            MenuItem item = new MenuItem(section.getTitle());
            item.setAttribute("name", section.getName());
            item.addClickHandler(new ClickHandler() {
                public void onClick(MenuItemClickEvent event) {
                    int index = event.getMenu().getItemNum(event.getItem());
                    sectionStack.expandSection(index);
                    sectionStack.showSection(index);
                }
            });
            menu.addItem(item);
        }
        menu.addItem(new MenuItemSeparator());

        MenuItem hideAllItem = new MenuItem(MSG.view_configEdit_hideAll());
        hideAllItem.addClickHandler(new ClickHandler() {
            public void onClick(MenuItemClickEvent event) {
                for (int i = 0; i < sectionStack.getSections().length; i++) {
                    sectionStack.collapseSection(i);
                }
            }
View Full Code Here

        // separator
        resourceContextMenu.addItem(new MenuItemSeparator());

        // refresh node
        MenuItem refresh = new MenuItem(MSG.common_button_refresh());
        refresh.addClickHandler(new ClickHandler() {

            public void onClick(MenuItemClickEvent event) {
                contextMenuRefresh(treeGrid, node, false);
            }
        });
        resourceContextMenu.addItem(refresh);




        // separator
        resourceContextMenu.addItem(new MenuItemSeparator());

        // child resources
        MenuItem childResources = new MenuItem(MSG.view_tabs_common_child_resources());
        boolean childResourcesEnabled = resourceType.getChildResourceTypes() != null
            && !resourceType.getChildResourceTypes().isEmpty();
        childResources.setEnabled(childResourcesEnabled);
        if (childResourcesEnabled) {
            childResources.addClickHandler(new ClickHandler() {
                public void onClick(MenuItemClickEvent event) {
                    CoreGUI.goToView(LinkManager.getResourceTabLink(resource.getId(), "Inventory", "Children"));
                }
            });
        }
        resourceContextMenu.addItem(childResources);

        // plugin config
        MenuItem pluginConfiguration = new MenuItem(MSG.view_tabs_common_connectionSettings());
        boolean pluginConfigEnabled = resourceType.getPluginConfigurationDefinition() != null;
        pluginConfiguration.setEnabled(pluginConfigEnabled);
        if (pluginConfigEnabled) {
            pluginConfiguration.addClickHandler(new ClickHandler() {

                public void onClick(MenuItemClickEvent event) {
                    CoreGUI.goToView(LinkManager.getResourceTabLink(resource.getId(), "Inventory", "ConnectionSettings"));
                }
            });
        }
        resourceContextMenu.addItem(pluginConfiguration);

        // resource config
        MenuItem resourceConfiguration = new MenuItem(MSG.view_tree_common_contextMenu_resourceConfiguration());
        boolean resourceConfigEnabled = resourcePermission.isConfigureRead()
            && resourceType.getResourceConfigurationDefinition() != null;
        resourceConfiguration.setEnabled(resourceConfigEnabled);
        if (resourceConfigEnabled) {
            resourceConfiguration.addClickHandler(new ClickHandler() {

                public void onClick(MenuItemClickEvent event) {
                    CoreGUI.goToView(LinkManager.getResourceTabLink(resource.getId(), "Configuration", "Current"));
                }
            });
        }
        resourceContextMenu.addItem(resourceConfiguration);

        // separator
        resourceContextMenu.addItem(new MenuItemSeparator());

        // Operations Menu
        MenuItem operations = new MenuItem(MSG.common_title_operations());
        boolean operationsEnabled = (resourcePermission.isControl() && (resourceType.getOperationDefinitions() != null) && !resourceType
            .getOperationDefinitions().isEmpty());
        operations.setEnabled(operationsEnabled);
        if (operationsEnabled) {
            Menu opSubMenu = new Menu();

            //sort the display items alphabetically
            TreeSet<String> ordered = new TreeSet<String>();
            Map<String, OperationDefinition> definitionMap = new HashMap<String, OperationDefinition>();
            for (OperationDefinition o : resourceType.getOperationDefinitions()) {
                ordered.add(o.getDisplayName());
                definitionMap.put(o.getDisplayName(), o);
            }
            for (String displayName : ordered) {
                final OperationDefinition operationDefinition = definitionMap.get(displayName);

                MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
                operationItem.addClickHandler(new ClickHandler() {

                    public void onClick(MenuItemClickEvent event) {
                        String viewPath = LinkManager.getResourceTabLink(resource.getId(),
                            ResourceDetailView.Tab.Operations.NAME, "Schedules") + "/0/" + operationDefinition.getId();
                        CoreGUI.goToView(viewPath);
View Full Code Here

            // omit the type's menu item if the singleton already exists, otherwise add the necessary click handler.
            // note: we omit as opposed to disable the menu item to match the behavior of the buttons in the Inventory
            // -> Child Resources view, which has no facility to do the analogous disabling.
            if (!exists) {
                itemToAdd.addClickHandler(new ClickHandler() {
                    public void onClick(MenuItemClickEvent event) {
                        if (isCreate) {
                            ResourceFactoryCreateWizard.showCreateWizard(resource, type);
                        } else {
                            ResourceFactoryImportWizard.showImportWizard(resource, type);
View Full Code Here

        Menu refreshMenu = new Menu();
        refreshMenu.setShowShadow(true);
        refreshMenu.setShadowDepth(10);
        refreshMenu.setAutoWidth();
        refreshMenu.setHeight(15);
        ClickHandler menuClick = new ClickHandler() {
            @Override
            public void onClick(MenuItemClickEvent event) {
                String selection = event.getItem().getTitle();
                refreshInterval = 0;
                if (selection != null) {
View Full Code Here

  }
 
  private void addBugReportItem() {
    bugReportItem = new MenuItem("Report a bug or request a new feature");
    bugReportItem.setIcon(Imgs.BUG.get());
    bugReportItem.addClickHandler(new ClickHandler(){
      public void onClick(MenuItemClickEvent event) {
        ReportIssue.report(view);
      }});
    items.add(bugReportItem);
  }
View Full Code Here

  }

  private void addOfflineAvailabilityItem() {
    MenuItem offlineAvailabilityItem = new MenuItem("Configure offline availability");
    offlineAvailabilityItem.setIcon(Imgs.DISCONNECTED.get());
    offlineAvailabilityItem.addClickHandler(new ClickHandler(){
      public void onClick(MenuItemClickEvent event) {
        new OfflineAvailabilityConfig(view);
      }});
    items.add(offlineAvailabilityItem);
  }
View Full Code Here

  }

  private void addRecentChangelogItem() {
    MenuItem changes = new MenuItem("Show recent changes");
    changes.setIcon(Imgs.TOOLTIP.get());
    changes.addClickHandler(new ClickHandler(){
      public void onClick(MenuItemClickEvent event) {
        view.getChangelogHelper().draw(); //show from version 0 onwards
        view.showTooltips(StaticConfig.VERSION_ID-1);
      }});
    items.add(changes);
View Full Code Here

TOP

Related Classes of com.smartgwt.client.widgets.menu.events.ClickHandler

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.