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);
}
}
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();
}
}
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");
}
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);
}
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);
}
Aggregations