Examples of UITabPanel


Examples of org.richfaces.component.UITabPanel

   
   
    protected void preEncodeBegin(FacesContext context, UIComponent component) throws IOException {
      super.preEncodeBegin(context, component);
        if(component instanceof UITabPanel){
          UITabPanel tabPanel = (UITabPanel)component;
            ComponentVariables componentVariables = ComponentsVariableResolver.getVariables(this, tabPanel);
          componentVariables.setVariable("tabPanel", getTabPanelInfoCollector().collectTabPanelInfo(context, (UITabPanel)component));
      }
    }
View Full Code Here

Examples of org.richfaces.component.UITabPanel

        tabPanel.setRenderedValue(null);
       
        Object checkedValue = checkValue(tabPanel.getValue());

        UITabPanel pane = tabPanel;
        UITab activeTab = null;

        TabsIteratorHelper helper = new TabsIteratorHelper(pane.getRenderedTabs(), checkedValue);
        activeTab = helper.getTab();

        if (activeTab == null) {
          Object label = MessageUtil.getLabel(context, tabPanel);
          String message = label + ": tab panel has no enabled or rendered tabs!";
          context.getExternalContext().log(message);
          return ;
        }

        if (helper.isFallback()) {
          Object label = MessageUtil.getLabel(context, tabPanel);
          String message = label + ": tab panel [@selectedTab=" + checkedValue +
              "] has no enabled or rendered tab with such name. Tab: " + activeTab.getName() +
              " will be used instead!";
          context.getExternalContext().log(message);
          tabPanel.setRenderedValue(activeTab.getName());
      } else if (checkedValue == null) {
          tabPanel.setRenderedValue(activeTab.getName());
      } else {
        tabPanel.setRenderedValue(null);
      }
       
        helper = null;

        ArrayList tabs = new ArrayList();
        boolean clientSide = UISwitchablePanel.CLIENT_METHOD.equals(pane.getSwitchType());

        TabInfoCollector tabInfoCollector = getTabInfoCollector();
       
        UITab prevTab = null;
       
        for (Iterator iter = pane.getRenderedTabs(); iter.hasNext();) {
            UITab tab = (UITab) iter.next();
            boolean active = activeTab == tab;
            tab.setActive(active);

            if (!clientSide) {
View Full Code Here

Examples of org.richfaces.component.UITabPanel

    }

    protected void doDecode(FacesContext context, UIComponent component) {
        super.doDecode(context, component);

        UITabPanel panel = (UITabPanel) component;

        String clientId = component.getClientId(context);
        Map requestParameterMap = context.getExternalContext().getRequestParameterMap();

        UITab eventTab = null;

        for (Iterator tabsIterator = panel.getRenderedTabs();
             tabsIterator.hasNext() && eventTab == null;) {

            UITab tab = (UITab) tabsIterator.next();
            if (tab.isDisabled()) {
                continue;
View Full Code Here

Examples of org.richfaces.component.UITabPanel

   
   
    protected void preEncodeBegin(FacesContext context, UIComponent component) throws IOException {
      super.preEncodeBegin(context, component);
        if(component instanceof UITabPanel){
          UITabPanel tabPanel = (UITabPanel)component;
            ComponentVariables componentVariables = ComponentsVariableResolver.getVariables(this, tabPanel);
          componentVariables.setVariable("tabPanel", getTabPanelInfoCollector().collectTabPanelInfo(context, (UITabPanel)component));
      }
    }
View Full Code Here

Examples of org.richfaces.component.UITabPanel

        tabPanel.setRenderedValue(null);
       
        Object checkedValue = checkValue(tabPanel.getValue());

        UITabPanel pane = tabPanel;
        UITab activeTab = null;

        TabsIteratorHelper helper = new TabsIteratorHelper(pane.getRenderedTabs(), checkedValue);
        activeTab = helper.getTab();

        if (activeTab == null) {
          Object label = MessageUtil.getLabel(context, tabPanel);
          String message = label + ": tab panel has no enabled or rendered tabs!";
          context.getExternalContext().log(message);
          return ;
        }

        if (helper.isFallback()) {
          Object label = MessageUtil.getLabel(context, tabPanel);
          String message = label + ": tab panel [@selectedTab=" + checkedValue +
              "] has no enabled or rendered tab with such name. Tab: " + activeTab.getName() +
              " will be used instead!";
          context.getExternalContext().log(message);
          tabPanel.setRenderedValue(activeTab.getName());
      } else if (checkedValue == null) {
          tabPanel.setRenderedValue(activeTab.getName());
      } else {
        tabPanel.setRenderedValue(null);
      }
       
        helper = null;

        ArrayList tabs = new ArrayList();
        boolean clientSide = UISwitchablePanel.CLIENT_METHOD.equals(pane.getSwitchType());

        TabInfoCollector tabInfoCollector = getTabInfoCollector();
       
        UITab prevTab = null;
       
        for (Iterator iter = pane.getRenderedTabs(); iter.hasNext();) {
            UITab tab = (UITab) iter.next();
            boolean active = activeTab == tab;
            tab.setActive(active);

            if (!clientSide) {
View Full Code Here

Examples of org.richfaces.component.UITabPanel

   public void testDefaultTabPanel() throws IOException
   {
      /*
       * Note: This test is known to fail with RichFaces 3.2.1
       */
      UITabPanel panel = (UITabPanel)server.findComponent("defaultTabPanel");
      String selectedTab = (String)panel.getSelectedTab();
      assertEquals("defaultFirst", selectedTab);
     
      String xml = client.getElement("defaultFirst").getTextContent();
      assertTrue(xml.contains("Here is tab #1"));
     
      ajaxClient.clickTab("defaultSecond");
     
      xml = client.getElement("defaultSecond").getTextContent();
      assertTrue(xml.contains("Here is tab #2"));
     
      panel = (UITabPanel)server.findComponent("defaultTabPanel");
      selectedTab = (String)panel.getSelectedTab();
      assertEquals("defaultSecond", selectedTab)
   }
View Full Code Here

Examples of org.richfaces.component.UITabPanel

      assertEquals("defaultSecond", selectedTab)
   }
  
   public void testAjaxTabPanel() throws IOException
   {
      UITabPanel panel = (UITabPanel)server.findComponent("ajaxTabPanel");
      String selectedTab = (String)panel.getSelectedTab();
      assertEquals("ajaxFirst", selectedTab);
      ajaxClient.clickTab("ajaxThird");
      panel = (UITabPanel)server.findComponent("ajaxTabPanel");
      selectedTab = (String)panel.getSelectedTab();
      assertEquals("ajaxThird", selectedTab);
   }
View Full Code Here

Examples of org.richfaces.component.UITabPanel

   public void testDisabledTabPanel() throws IOException
   {
      // if the tab is disabled, this is a no-op     
      ajaxClient.clickTab("ajaxSecond");
     
      UITabPanel panel = (UITabPanel)server.findComponent("ajaxTabPanel");
      String selectedTab = (String)panel.getSelectedTab();
      assertEquals("ajaxFirst", selectedTab);
   }
View Full Code Here

Examples of org.richfaces.component.UITabPanel

  protected void setProperties(UIComponent component) {
    super.setProperties(component);

    if (_value != null) {
      if (_value.isLiteralText()) {
        UITabPanel tabPanel = (UITabPanel) component;
        try {
          tabPanel.setSelectedTab(_value.getExpressionString());
        } catch (ELException e) {
          throw new FacesException(e);
        }
      } else {
        component.setValueExpression("value", _value);
View Full Code Here

Examples of org.richfaces.component.UITabPanel

   
    public void encodeTabLabel(FacesContext context, UITab tab) throws IOException {
        ResponseWriter writer = context.getResponseWriter();

        boolean disabled = tab.isDisabled();
        UITabPanel pane = tab.getPane();
        String method = tab.getSwitchTypeOrDefault();
        boolean ajax = UISwitchablePanel.AJAX_METHOD.equals(method);
        boolean clientSide = UISwitchablePanel.CLIENT_METHOD.equals(method);
        String label = tab.getLabel();

        if (label == null) {
            label = "";
        }

        String clientId = tab.getClientId(context);

        //String style = "position:relative; top:1px;" + (String) tab.getAttributes().get("style");
       
        //TODO use CSS classes
        String defShift = tab.isActive() ? "position:relative; top:1px;" : "position:relative;";
        String componentStyle = (String) tab.getAttributes().get("style");
        String style = defShift + (componentStyle != null ? componentStyle : "");

        //TODO format code block properly
        if (!disabled) {
            if (clientSide) {
          //TODO use StringBuilder
                writer.writeAttribute(HTML.onclick_ATTRIBUTE, "if (RichFaces.onTabChange(event, '"+pane.getClientId(context)+"','"+
                  clientId+"')) RichFaces.switchTab('" +
                  pane.getClientId(context) + "','" + clientId + "','" +
                  getUtils().formatValue(context, pane, tab.getName()) + "');", "switchScript");
            } else {
                String activeCheck = "if (RichFaces.isTabActive('" + clientId + LABEL_SUFFIX + "')) return false;";
                String eventCheck = " if (!RichFaces.onTabChange(event, '"+pane.getClientId(context)+"','"+clientId+"')) return false;";
               
                if (ajax) {
                    JSFunction function = AjaxRendererUtils.buildAjaxFunction(tab,
                            context);
                    Map eventOptions = AjaxRendererUtils.buildEventOptions(context,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.