Skip to content

Commit

Permalink
#855 stop using rogue array indexes for tabs which aren't backed by a…
Browse files Browse the repository at this point in the history
…n array
  • Loading branch information
stephanrauh committed Sep 12, 2017
1 parent 9ccf14c commit 91024a7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/main/java/net/bootsfaces/component/tab/Tab.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import javax.el.ValueExpression;
import javax.faces.component.FacesComponent;
import javax.faces.component.UINamingContainer;
import javax.faces.component.behavior.ClientBehaviorHolder;

import net.bootsfaces.C;
Expand Down
22 changes: 15 additions & 7 deletions src/main/java/net/bootsfaces/component/tab/TabRepeat.java
Original file line number Diff line number Diff line change
Expand Up @@ -904,17 +904,25 @@ public void processDecodes(FacesContext faces) {

public void processUpdates(FacesContext faces) {
if (!this.isRendered()) return;
this.resetDataModel();
this.process(faces, PhaseId.UPDATE_MODEL_VALUES, null);
if (null == this.getVar()) {
super.processUpdates(faces);
} else {
this.resetDataModel();
this.process(faces, PhaseId.UPDATE_MODEL_VALUES, null);
}
}

public void processValidators(FacesContext faces) {
if (!this.isRendered()) return;
this.resetDataModel();
Application app = faces.getApplication();
app.publishEvent(faces, PreValidateEvent.class, this);
this.process(faces, PhaseId.PROCESS_VALIDATIONS, null);
app.publishEvent(faces, PostValidateEvent.class, this);
if (null == this.getVar()) {
super.processValidators(faces);
} else {
this.resetDataModel();
Application app = faces.getApplication();
app.publishEvent(faces, PreValidateEvent.class, this);
this.process(faces, PhaseId.PROCESS_VALIDATIONS, null);
app.publishEvent(faces, PostValidateEvent.class, this);
}
}

private final static SavedState NullState = new SavedState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,6 @@ private static void encodeTabs(final FacesContext context, final ResponseWriter
int offset = 0;
public void run() {
try {
if (currentlyActiveIndex==6) {
System.out.println("Offset: " + offset + " currentIndex: " + currentIndex);
}
encodeTab(context, writer, tab, currentIndex + offset == currentlyActiveIndex, hiddenInputFieldID,
currentIndex + offset, disabled);
offset++;
Expand Down

0 comments on commit 91024a7

Please sign in to comment.