Skip to content

Commit

Permalink
#842 #842 command buttons should work even if they are in a tab
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanrauh committed Aug 21, 2017
1 parent 0b33e74 commit 4cd183d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/main/java/net/bootsfaces/component/tab/TabRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class TabRenderer extends CoreRenderer {
public void decode(FacesContext context, UIComponent component) {
// The AJAXRenderer generates the id of the child element, but the AJAX event is processed by the parent instead
component.getParent().decode(context);
for (UIComponent c: component.getChildren()) {
c.decode(context);
}
}

/**
Expand Down
26 changes: 14 additions & 12 deletions src/main/java/net/bootsfaces/component/tabView/TabViewRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,23 @@ public void decode(FacesContext context, UIComponent component) {
if (Integer.valueOf(newIndexValue) != tabView.getActiveIndex()) {
int newIndex = Integer.valueOf(newIndexValue);
if (newIndex < tabView.getChildCount()) {
if (!(((Tab) tabView.getChildren().get(newIndex)).isDisabled())) {

ValueExpression ve = component.getValueExpression("activeIndex");
if (ve != null) {
try {
ve.setValue(context.getELContext(), newIndex);
} catch (ELException e) {
tabView.setActiveIndex(newIndex);
} catch (Exception e) {
UIComponent maybeTab = tabView.getChildren().get(newIndex);
if (maybeTab instanceof Tab) {
if (!(((Tab) maybeTab).isDisabled())) {
ValueExpression ve = component.getValueExpression("activeIndex");
if (ve != null) {
try {
ve.setValue(context.getELContext(), newIndex);
} catch (ELException e) {
tabView.setActiveIndex(newIndex);
} catch (Exception e) {
tabView.setActiveIndex(newIndex);
}
} else {
tabView.setActiveIndex(newIndex);
}
} else {
tabView.setActiveIndex(newIndex);

}

}
}
}
Expand Down

0 comments on commit 4cd183d

Please sign in to comment.