Skip to content

Commit

Permalink
added an example for naviation with and without AJAX
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanrauh committed Sep 18, 2015
1 parent c374d4f commit bb431aa
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 18 deletions.
Binary file modified .DS_Store
Binary file not shown.
42 changes: 26 additions & 16 deletions AJAX/src/main/java/de/beyondjava/bootsfaces/examples/AJAXBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void setMessages(List<String> messages) {
public String onBlur() {
String event = " blur";
report(event);
return "Hallo";
return null;
}

private void report(String event) {
Expand All @@ -141,85 +141,91 @@ private void report(String event) {
public String onChange() {
String event = " change";
report(event);
return "Hallo";
return null;
}

public String onValueChange() {
String event = " valueChange";
report(event);
return "Hallo";
return null;
}

public String onClick() {
String event = " click";
report(event);
return "Hallo";
return null;
}

public String onClickNavigate() {
String event = " click";
report(event);
return "landingPage.xhtml";
}

public String onDblClick() {
String event = " dblclick";
report(event);
return "Hallo";
return null;
}

public String onFocus() {
String event = " focus";
report(event);
return "Hallo";
return null;
}

public String onKeyDown() {
String event = " keydown";
report(event);
return "Hallo";
return null;
}

public String onKeyPress() {
String event = " keypress";
report(event);
return "Hallo";
return null;
}

public String onKeyUp() {
String event = " keyup";
report(event);
return "Hallo";
return null;
}

public String onMouseDown() {
String event = " mousedown";
report(event);
return "Hallo";
return null;
}

public String onMouseMove() {
String event = " mousemove";
report(event);
return "Hallo";
return null;
}

public String onMouseOut() {
String event = " mouseout";
report(event);
return "Hallo";
return null;
}

public String onMouseOver() {
String event = " mouseover";
report(event);
return "Hallo";
return null;
}

public String onMouseUp() {
String event = " mouseup";
report(event);
return "Hallo";
return null;
}

public String onSelect() {
String event = " select";
report(event);
return "Hallo";
return null;
}

public boolean isBool() {
Expand All @@ -240,7 +246,11 @@ public void setInput(String input) {

public String standardJSFAction() {
report("Standard JSF action called");
return null; // "landingPage.jsf";
return null;
}
public String navigationAction() {
report("Navigation action called");
return "landingPage.jsf";
}

public void facetListener(javax.faces.event.AjaxBehaviorEvent event) throws javax.faces.event.AbortProcessingException {
Expand Down
37 changes: 37 additions & 0 deletions AJAX/src/main/webapp/commandbutton3.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:b="http://bootsfaces.net/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">


<h:form id="navigation_form">
<b:row>
<b:column col-sm="6">
<b:panelGrid colSpans="12">
<b:commandButton value="Navigate (AJAX - action)"
ajax="true" onclick="ajax:AJAXBean.onClick()"
action="#{AJAXBean.navigationAction}"
update="@form:**:messages" />
<b:commandButton value="Navigate (AJAX - onclick)"
ajax="true" onclick="ajax:AJAXBean.onClickNavigate()"

update="@form:**:messages" />
<b:commandButton value="Navigate (Non-AJAX)"
action="#{AJAXBean.navigationAction}" />
</b:panelGrid>
</b:column>
<b:column col-sm="6">
<b:well id="messages">
Last action:
<ul>
<ui:repeat var="message" value="#{AJAXBean.messages}">
<li>#{message}</li>
</ui:repeat>
</ul>
</b:well>
</b:column>
</b:row>
</h:form>
</ui:fragment>
9 changes: 7 additions & 2 deletions AJAX/src/main/webapp/index.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@

<b:container id="content">
<b:tabView id="tabViewID">
<b:tab title="command button"
<b:tab title="Navigation"
onclick="ajax:AJAXBean.clearMessages()" update="**:*messages">
<div style="height: 10px" />
<ui:include src="commandbutton.xhtml" />
<ui:include src="commandbutton3.xhtml" />
</b:tab>
<b:tab title="command button"
onclick="ajax:AJAXBean.clearMessages()" update="**:*messages">
<div style="height: 10px" />
<ui:include src="commandbutton.xhtml" />
</b:tab>
<b:tab title="command button 2" update="**:*messages"
onclick="ajax:AJAXBean.clearMessages()">
<div style="height: 10px" />
Expand Down

0 comments on commit bb431aa

Please sign in to comment.