Search in sources :

Example 1 with Tab

use of org.primefaces.component.tabview.Tab in project primefaces by primefaces.

the class AccordionPanelRenderer method encodeEnd.

@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    Map<String, String> params = context.getExternalContext().getRequestParameterMap();
    AccordionPanel acco = (AccordionPanel) component;
    if (acco.isContentLoadRequest(context)) {
        String clientId = acco.getClientId(context);
        if (acco.isRepeating()) {
            int index = Integer.parseInt(params.get(clientId + "_tabindex"));
            acco.setIndex(index);
            Tab tabToLoad = acco.getDynamicTab();
            tabToLoad.encodeAll(context);
            if (acco.isDynamic()) {
                tabToLoad.setLoaded(index, true);
            }
            acco.setIndex(-1);
        } else {
            String tabClientId = params.get(clientId + "_newTab");
            Tab tabToLoad = acco.findTab(tabClientId);
            tabToLoad.encodeAll(context);
            tabToLoad.setLoaded(true);
        }
    } else {
        acco.resetLoadedTabsState();
        encodeMarkup(context, acco);
        encodeScript(context, acco);
    }
}
Also used : Tab(org.primefaces.component.tabview.Tab)

Example 2 with Tab

use of org.primefaces.component.tabview.Tab in project primefaces by primefaces.

the class Wizard method processUpdates.

@Override
public void processUpdates(FacesContext context) {
    if (!isRendered()) {
        return;
    }
    if (!isBackRequest(context) || (isUpdateModelOnPrev() && isBackRequest(context))) {
        Tab step = getStepToProcess();
        if (step != null) {
            step.processUpdates(context);
        }
    }
    ELContext elContext = getFacesContext().getELContext();
    ValueExpression expr = ValueExpressionAnalyzer.getExpression(elContext, getValueExpression(PropertyKeys.step.toString()), true);
    if (expr != null && !expr.isReadOnly(elContext)) {
        expr.setValue(elContext, getStep());
        resetStep();
    }
}
Also used : ELContext(javax.el.ELContext) Tab(org.primefaces.component.tabview.Tab) ValueExpression(javax.el.ValueExpression)

Example 3 with Tab

use of org.primefaces.component.tabview.Tab in project primefaces by primefaces.

the class WizardRenderer method encodeStepStatus.

protected void encodeStepStatus(FacesContext context, Wizard wizard) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String currentStep = wizard.getStep();
    boolean currentFound = false;
    writer.startElement("ul", null);
    writer.writeAttribute("class", Wizard.STEP_STATUS_CLASS, null);
    for (UIComponent child : wizard.getChildren()) {
        if (child instanceof Tab && child.isRendered()) {
            Tab tab = (Tab) child;
            String title = tab.getTitle();
            UIComponent titleFacet = tab.getFacet("title");
            boolean active = (!currentFound) && (currentStep == null || tab.getId().equals(currentStep));
            String titleStyleClass = active ? Wizard.ACTIVE_STEP_CLASS : Wizard.STEP_CLASS;
            if (tab.getTitleStyleClass() != null) {
                titleStyleClass = titleStyleClass + " " + tab.getTitleStyleClass();
            }
            if (active) {
                currentFound = true;
            }
            writer.startElement("li", null);
            writer.writeAttribute("class", titleStyleClass, null);
            if (tab.getTitleStyle() != null) {
                writer.writeAttribute("style", tab.getTitleStyle(), null);
            }
            if (tab.getTitletip() != null) {
                writer.writeAttribute("title", tab.getTitletip(), null);
            }
            if (ComponentUtils.shouldRenderFacet(titleFacet)) {
                titleFacet.encodeAll(context);
            } else if (title != null) {
                writer.writeText(title, null);
            }
            writer.endElement("li");
        }
    }
    writer.endElement("ul");
}
Also used : Tab(org.primefaces.component.tabview.Tab) ResponseWriter(javax.faces.context.ResponseWriter) UIComponent(javax.faces.component.UIComponent)

Example 4 with Tab

use of org.primefaces.component.tabview.Tab in project primefaces by primefaces.

the class UITabPanel method processValidators.

@Override
public void processValidators(FacesContext context) {
    if (!isRendered()) {
        return;
    }
    if (shouldSkipChildren(context)) {
        return;
    }
    pushComponentToEL(context, null);
    Application app = context.getApplication();
    app.publishEvent(context, PreValidateEvent.class, this);
    if (isRepeating()) {
        process(context, PhaseId.PROCESS_VALIDATIONS);
    } else {
        if (isDynamic()) {
            for (int i = 0; i < getChildCount(); i++) {
                UIComponent child = getChildren().get(i);
                if (child instanceof Tab) {
                    Tab tab = (Tab) child;
                    if (tab.isLoaded()) {
                        tab.processValidators(context);
                    }
                }
            }
        } else {
            ComponentUtils.processValidatorsOfFacetsAndChilds(this, context);
        }
    }
    // check if an validation error forces the render response for our data
    if (context.getRenderResponse()) {
        _isValidChilds = false;
    }
    app.publishEvent(context, PostValidateEvent.class, this);
    popComponentFromEL(context);
}
Also used : Tab(org.primefaces.component.tabview.Tab) Application(javax.faces.application.Application)

Example 5 with Tab

use of org.primefaces.component.tabview.Tab in project primefaces by primefaces.

the class UITabPanel method processUpdates.

@Override
public void processUpdates(FacesContext context) {
    if (!isRendered()) {
        return;
    }
    if (shouldSkipChildren(context)) {
        return;
    }
    pushComponentToEL(context, null);
    if (isRepeating()) {
        process(context, PhaseId.UPDATE_MODEL_VALUES);
    } else {
        if (isDynamic()) {
            for (int i = 0; i < getChildCount(); i++) {
                UIComponent child = getChildren().get(i);
                if (child instanceof Tab) {
                    Tab tab = (Tab) child;
                    if (tab.isLoaded()) {
                        tab.processUpdates(context);
                    }
                }
            }
        } else {
            ComponentUtils.processUpdatesOfFacetsAndChilds(this, context);
        }
    }
    if (context.getRenderResponse()) {
        _isValidChilds = false;
    }
    popComponentFromEL(context);
}
Also used : Tab(org.primefaces.component.tabview.Tab)

Aggregations

Tab (org.primefaces.component.tabview.Tab)9 UIComponent (javax.faces.component.UIComponent)3 FacesException (javax.faces.FacesException)2 ResponseWriter (javax.faces.context.ResponseWriter)2 IOException (java.io.IOException)1 ELContext (javax.el.ELContext)1 ValueExpression (javax.el.ValueExpression)1 Application (javax.faces.application.Application)1 UIForm (javax.faces.component.UIForm)1 Renderer (javax.faces.render.Renderer)1 WidgetBuilder (org.primefaces.util.WidgetBuilder)1