@Override
 protected void setDefaulButtonIcon(Component btn, Boolean selected) {
   ButtonTabImpl btnTabImpl = (ButtonTabImpl) btn;
   String tabId = btnTabImpl.getTabId();
   Resource resource = SettingAssetsManager.getAsset(tabId);
   btn.setIcon(resource);
 }
Esempio n. 2
0
 public void showTabsCaption() {
   Iterator<Component> iter = navigatorContainer.iterator();
   while (iter.hasNext()) {
     ButtonTabImpl comp = (ButtonTabImpl) iter.next();
     comp.showCaption();
   }
 }
Esempio n. 3
0
 public Button addButtonOnNavigatorContainer(String id, String caption, Resource icon) {
   final ButtonTabImpl button = new ButtonTabImpl(id, 0, caption, "");
   navigatorContainer.addComponent(button);
   navigatorContainer.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
   button.setStyleName(TAB_STYLENAME);
   button.setWidth("90%");
   button.setIcon(icon);
   return button;
 }
Esempio n. 4
0
  private ButtonTabImpl getButtonById(String viewId) {
    for (int i = 0; i < navigatorContainer.getComponentCount(); i++) {
      ButtonTabImpl button = (ButtonTabImpl) navigatorContainer.getComponent(i);
      if (viewId.equals(button.getTabId())) {
        return button;
      }
    }

    return null;
  }
Esempio n. 5
0
  public void addTab(
      Component component, String id, int level, String caption, String link, Resource resource) {
    if (!hasTab(id)) {
      final ButtonTabImpl button = new ButtonTabImpl(id, level, caption, link);

      button.addClickListener(
          new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
              if (!event.isCtrlKey() && !event.isMetaKey()) {
                if (selectedButton != button) {
                  clearTabSelection(true);
                  selectedButton = button;
                  selectedButton.addStyleName(TAB_SELECTED_STYLENAME);
                  selectedComp = compMap.get(button.getTabId());
                }
                fireTabChangeEvent(new SelectedTabChangeEvent(VerticalTabsheet.this));
              } else {
                Page.getCurrent().open(button.link, "_blank", false);
              }
            }
          });

      if (resource == null) {
        setDefaulButtonIcon(button, false);
      } else {
        button.setIcon(resource);
      }
      button.setStyleName(TAB_STYLENAME);
      button.setWidth("90%");

      if (button.getLevel() > 0) {
        int insertIndex = 0;
        for (int i = 0; i < navigatorContainer.getComponentCount(); i++) {
          ButtonTabImpl buttonTmp = (ButtonTabImpl) navigatorContainer.getComponent(i);
          if (buttonTmp.getLevel() > level) {
            break;
          } else {
            insertIndex++;
          }
        }
        navigatorContainer.addComponent(button, insertIndex);
        navigatorContainer.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
      } else {
        navigatorContainer.addComponent(button);
        navigatorContainer.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
      }

      TabImpl tabImpl = new TabImpl(id, caption, component);
      compMap.put(id, tabImpl);
    }
  }