Package org.jboss.errai.workspaces.client.api

Examples of org.jboss.errai.workspaces.client.api.Tool


    if (null == deck)
      throw new IllegalArgumentException("No such toolSet: " + toolSetId);

    // select tool
    ToolSet selectedToolSet = deck.toolSet;
    Tool selectedTool = null;
    if (toolId != null// particular tool
    {
      for (Tool t : selectedToolSet.getAllProvidedTools()) {
        if (toolId.equals(t.getId())) {
          selectedTool = t;
          break;
        }
      }
    }
    else  // default tool, the first one
    {
      Tool[] availableTools = selectedToolSet.getAllProvidedTools();
      if (availableTools == null || availableTools.length == 0)
        throw new IllegalArgumentException("Empty toolset: " + toolSetId);

      selectedTool = availableTools[0];
    }

    // is it already open?
    boolean isOpen = false;
    for (int i = 0; i < deck.tabLayout.getWidgetCount(); i++)
    {
      ToolTabPanel toolTab = (ToolTabPanel) deck.tabLayout.getWidget(i);
      if (toolTab.toolId.equals(selectedTool.getId())) {
        isOpen = true;
        deck.tabLayout.selectTab(i);
      }
    }

    if (!isOpen) // & selectedTool.multipleAllowed()==false
    {
      final ToolTabPanel panelTool = new ToolTabPanel(toolSetId, selectedTool);
      panelTool.invalidate();

      ResourceFactory resourceFactory = GWT.create(ResourceFactory.class);
      ErraiImageBundle erraiImageBundle = GWT.create(ErraiImageBundle.class);
      ImageResource resource = resourceFactory.createImage(selectedTool.getName()) != null ?
          resourceFactory.createImage(selectedTool.getName()) : erraiImageBundle.application();

      deck.tabLayout.add(
          panelTool,
          AbstractImagePrototype.create(resource).getHTML() + "&nbsp;" + selectedTool.getName(),
          true
      );


      deck.tabLayout.selectTab(
View Full Code Here


    if (!toBeLoadedGroups.containsKey(group)) toBeLoadedGroups.put(group, new ArrayList<ToolProvider>());

    final String toolId = createToolId(name);
    Image img = createIcon(name,icon);

    final Tool toolImpl = new ToolImpl(name, toolId, multipleAllowed, img, component);
    ToolProvider provider = new ToolProvider() {
      public Tool getTool() {
        return toolImpl;
      }
    };
View Full Code Here

    for (String role : renderIfRoles) {
      requiredRoles.add(role.trim());
    }


    final Tool toolImpl = new ToolImpl(name, toolId, multipleAllowed, img, component);
    ToolProvider provider = new ToolProvider() {
      public Tool getTool() {

        AuthenticationContext authContext =
            Registry.get(SecurityService.class).getAuthenticationContext();
View Full Code Here

        if (toBeLoadedGroups.containsKey(group)) {
          loaded.add(group);

          final List<Tool> toBeRendered = new ArrayList<Tool>();
          for (ToolProvider provider : toBeLoadedGroups.get(group)) {
            Tool t = provider.getTool();
            if (t != null) {
              toBeRendered.add(t);
            }
          }

          if (!toBeRendered.isEmpty()) {
            ToolSet ts = new ToolSet() {
              public Tool[] getAllProvidedTools() {
                Tool[] toolArray = new Tool[toBeRendered.size()];
                toBeRendered.toArray(toolArray);
                return toolArray;
              }

              public String getToolSetName() {
                return group;
              }

              public Widget getWidget() {
                return null;
              }
            };

            workspace.addToolSet(ts);
          }
        }
      }
    }

    for (ToolSet ts : toBeLoaded) {
      if (loaded.contains(ts.getToolSetName())) continue;
      workspace.addToolSet(ts);
    }

    for (final String group : toBeLoadedGroups.keySet()) {
      if (loaded.contains(group)) continue;

      final List<Tool> toBeRendered = new ArrayList<Tool>();
      for (ToolProvider provider : toBeLoadedGroups.get(group)) {
        Tool t = provider.getTool();
        if (t != null) {
          toBeRendered.add(t);
        }
      }
View Full Code Here

        if (!toBeLoadedGroups.containsKey(group)) toBeLoadedGroups.put(group, new ArrayList<ToolProvider>());

        final String toolId = createToolId(name);
        Image img = createIcon(name, icon);

        final Tool toolImpl = new ToolImpl(name, toolId, multipleAllowed, img, component);
        ToolProvider provider = new ToolProvider() {
            public Tool getTool() {
                return toolImpl;
            }
        };
View Full Code Here

        for (String role : renderIfRoles) {
            requiredRoles.add(role.trim());
        }


        final Tool toolImpl = new ToolImpl(name, toolId, multipleAllowed, img, component);
        ToolProvider provider = new ToolProvider() {
            public Tool getTool() {

                AuthenticationContext authContext =
                        Registry.get(SecurityService.class).getAuthenticationContext();
View Full Code Here

                if (toBeLoadedGroups.containsKey(group)) {
                    loaded.add(group);

                    final List<Tool> toBeRendered = new ArrayList<Tool>();
                    for (ToolProvider provider : toBeLoadedGroups.get(group)) {
                        Tool t = provider.getTool();
                        if (t != null) {
                            toBeRendered.add(t);
                        }
                    }

                    if (!toBeRendered.isEmpty()) {
                        ToolSet ts = new ToolSet() {
                            public Tool[] getAllProvidedTools() {
                                Tool[] toolArray = new Tool[toBeRendered.size()];
                                toBeRendered.toArray(toolArray);
                                return toolArray;
                            }

                            public String getToolSetName() {
                                return group;
                            }

                            public Widget getWidget() {
                                return null;
                            }
                        };

                        workspace.addToolSet(ts);
                    }
                }
            }
        }

        for (ToolSet ts : toBeLoaded) {
            if (loaded.contains(ts.getToolSetName())) continue;
            workspace.addToolSet(ts);
        }

        for (final String group : toBeLoadedGroups.keySet()) {
            if (loaded.contains(group)) continue;

            final List<Tool> toBeRendered = new ArrayList<Tool>();
            for (ToolProvider provider : toBeLoadedGroups.get(group)) {
                Tool t = provider.getTool();
                if (t != null) {
                    toBeRendered.add(t);
                }
            }
View Full Code Here

        if (null == deck)
            throw new IllegalArgumentException("No such toolSet: " + toolSetId);

        // select tool
        ToolSet selectedToolSet = deck.toolSet;
        Tool selectedTool = null;
        if (toolId != null// particular tool
        {
            for (Tool t : selectedToolSet.getAllProvidedTools()) {
                if (toolId.equals(t.getId())) {
                    selectedTool = t;
                    break;
                }
            }
        } else  // default tool, the first one
        {
            Tool[] availableTools = selectedToolSet.getAllProvidedTools();
            if (availableTools == null || availableTools.length == 0)
                throw new IllegalArgumentException("Empty toolset: " + toolSetId);

            selectedTool = availableTools[0];
        }

        // is it already open?
        boolean isOpen = false;
        for (int i = 0; i < deck.tabLayout.getWidgetCount(); i++) {
            ToolTabPanel toolTab = (ToolTabPanel) deck.tabLayout.getWidget(i);
            if (toolTab.toolId.equals(selectedTool.getId())) {
                isOpen = true;
                deck.tabLayout.selectTab(i);
            }
        }

        if (!isOpen) // & selectedTool.multipleAllowed()==false
        {
            final ToolTabPanel panelTool = new ToolTabPanel(toolSetId, selectedTool);
            panelTool.invalidate();

            ResourceFactory resourceFactory = GWT.create(ResourceFactory.class);
            ErraiImageBundle erraiImageBundle = GWT.create(ErraiImageBundle.class);
            ImageResource resource = resourceFactory.createImage(selectedTool.getName()) != null ?
                    resourceFactory.createImage(selectedTool.getName()) : erraiImageBundle.application();

            deck.tabLayout.add(
                    panelTool,
                    AbstractImagePrototype.create(resource).getHTML() + "&nbsp;" + selectedTool.getName(),
                    true
            );


            deck.tabLayout.selectTab(
View Full Code Here

TOP

Related Classes of org.jboss.errai.workspaces.client.api.Tool

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.