示例#1
0
  /**
   * <span class="ja"> 新しいテンプレート方式を使用するか旧方式で実行するかを決定する為のコード
   *
   * @return true の場合には最新テンプレート方式 </span>
   */
  public boolean hastTemplateInComponent() {
    boolean result = false;

    WOElement content = _childTemplate();
    if (content instanceof WODynamicGroup) {
      WODynamicGroup group = (WODynamicGroup) content;
      for (Enumeration<WOElement> e = group.childrenElements().objectEnumerator();
          e.hasMoreElements() && !result; ) {
        WOElement current = e.nextElement();
        if (current instanceof ERXWOTemplate) {
          result = true;
        }
      }
    } else if (content instanceof ERXWOTemplate) {
      result = true;
    }
    return result;
  }
示例#2
0
  /**
   * Looks through the child components to locate the AjaxTabbedPanelTabs that are controlled by
   * this panel. Tabs without an explicit id attributed are assigned a calculated one.
   *
   * @param template the graph of elements passed to the constructor.
   */
  private void findTabs(WODynamicGroup template) {
    if (template == null || template.childrenElements() == null) return;

    NSArray children = template.childrenElements();
    for (int i = 0; i < children.count(); i++) {
      WOElement child = (WOElement) children.objectAtIndex(i);
      if (child instanceof MTAjaxTabbedPanelTab) {
        MTAjaxTabbedPanelTab childTab = (MTAjaxTabbedPanelTab) child;

        // The tabs need to have an id attribute so we assign one if needed
        if (childTab.id() == null) {
          childTab.setId(
              new WOConstantValueAssociation(id.valueInComponent(null) + "_pane_" + tabs.count()));
        }

        tabs.addObject(childTab);
      } else if (child instanceof WODynamicGroup) {
        findTabs((WODynamicGroup) child);
      }
    }
  }