My favorites | Sign in
Project Home Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<f:view xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:pm="http://primefaces.org/mobile"
contentType="text/html">

<pm:page title="Chat">

<f:facet name="postinit">
<script type="text/javascript">
//<![CDATA[
function handleMessage(evt, data) {
var chatContent = $('.chatContent');
chatContent.append(data + '<br />');

//keep scroll
chatContent.scrollTop(chatContent.height());
}
//]]>
</script>
</f:facet>

<!-- Main View -->
<pm:view id="main" swatch="a">
<pm:header title="Chat">
</pm:header>

<pm:content>
<h:form id="chatForm">

<p:outputPanel id="container">
<h:panelGroup rendered="#{chatController.loggedIn}" >
<p:outputPanel layout="block" style="width:100%;height:200px;overflow:auto"
styleClass="chatContent" />

<p:separator />

<h:inputText value="#{chatController.message}" styleClass="messageInput" />
<p:commandButton value="Send" actionListener="#{chatController.send}"
oncomplete="$('.messageInput').val('')"/>
</h:panelGroup>

<h:panelGroup rendered="#{not chatController.loggedIn}" >
<h:inputText id="username" value="#{chatController.username}" />
<p:watermark for="username" value="Username" />

<p:separator />

<p:commandButton value="Login" icon="refresh" update="container"
actionListener="#{chatController.login}" />
</h:panelGroup>
</p:outputPanel>

</h:form>

<p:push onmessage="handleMessage" channel="chat" widgetVar="chatAgent" />

</pm:content>

</pm:view>

</pm:page>

</f:view>

Change log

r5887 by cagatay.civici on Nov 15, 2011   Diff
Replaced pm:commandButton with
p:commandButton.
Go to: 
Project members, sign in to write a code review

Older revisions

r5635 by cagatay.civici on Oct 15, 2011   Diff
Basic mobile chat client
All revisions of this file

File info

Size: 2535 bytes, 66 lines
Powered by Google Project Hosting