コード例 #1
0
    @Override
    public void execute(Event<UITabContainer> event) throws Exception {
      UITabContainer container = event.getSource();
      PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();
      if (container == null) {
        return;
      }

      List<UIComponent> children = container.getChildren();
      for (UIComponent child : children) {
        if (child.isRendered() && child instanceof UIContainer) {
          UIContainer newTabContainer = container.addChild(UIContainer.class, null, null);
          newTabContainer.setTemplate(child.getTemplate());
          child.setRendered(false);
          newTabContainer.setRendered(true);
          newTabContainer.setId(String.valueOf(newTabContainer.hashCode()));
          pcontext.addUIComponentToUpdateByAjax(container);
          pcontext
              .getJavascriptManager()
              .require("SHARED/portal", "portal")
              .addScripts("portal.PortalComposer.toggleSaveButton();");
          return;
        }
      }
    }
コード例 #2
0
 public String getTabState(UIComponent uiChild, UITabContainer uiContainer) {
   String tabState = "";
   List<UIComponent> children = uiContainer.getChildren();
   int tabIndex = children.indexOf(uiChild);
   if (tabIndex == 0) {
     tabState = FIRST_TAB;
   } else if (tabIndex == children.size() - 1) {
     tabState = LAST_TAB;
   }
   return tabState;
 }
コード例 #3
0
 private void moveTab(UITabContainer container, String childId, boolean isToLeft) {
   UIComponent selectedChild = container.getChildById(childId);
   List<UIComponent> children = container.getChildren();
   int selectedIndex = children.indexOf(selectedChild);
   if (isToLeft) {
     if (selectedIndex > 0) {
       Collections.swap(children, selectedIndex, selectedIndex - 1);
     }
   } else {
     if (selectedIndex < children.size() - 1) {
       Collections.swap(children, selectedIndex, selectedIndex + 1);
     }
   }
 }
コード例 #4
0
 public void execute(Event<UITabContainer> event) throws Exception {
   String objectId = event.getRequestContext().getRequestParameter(OBJECTID);
   UITabContainer container = event.getSource();
   UIComponent goal = container.findComponentById(objectId);
   if (goal == null) {
     return;
   }
   UITabContainer parent = goal.getParent();
   List<UIComponent> children = parent.getChildren();
   for (UIComponent child : children) {
     if (child.getId().equals(objectId)) {
       child.setRendered(true);
       continue;
     }
     child.setRendered(false);
   }
 }