Author: ilya_shaikovsky
Date: 2011-03-03 06:08:07 -0500 (Thu, 03 Mar 2011)
New Revision: 22031
Added:
branches/4.0.X/examples/irc-client/src/main/webapp/chat.xhtml
Modified:
branches/4.0.X/examples/irc-client/
branches/4.0.X/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java
branches/4.0.X/examples/irc-client/src/main/webapp/welcome.xhtml
Log:
http://jira.jboss.org/browse/RF-10675
checked by @kmishin
Property changes on: branches/4.0.X/examples/irc-client
___________________________________________________________________
Modified: svn:ignore
- target
+ target
.settings
.classpath
.project
Modified:
branches/4.0.X/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java
===================================================================
---
branches/4.0.X/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java 2011-03-03
09:58:11 UTC (rev 22030)
+++
branches/4.0.X/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java 2011-03-03
11:08:07 UTC (rev 22031)
@@ -37,7 +37,7 @@
private String message;
private transient TopicsContext topicsContext;
- public void connect() {
+ public String connect() {
try {
this.connect(SERVER_URL, SERVER_PORT);
this.joinChannel(CHANNEL_PREFIX + DEFAULT_CHANNEL);
@@ -59,10 +59,12 @@
"Sorry, we encountered IRC services problems. Try again
later.",
"Sorry, we encountered IRC services problems. Try again
later."));
}
+ return "chat";
}
- public void leave() {
+ public String leave() {
this.disconnect();
+ return "welcome";
}
private TopicsContext getTopicsContext() {
Added: branches/4.0.X/examples/irc-client/src/main/webapp/chat.xhtml
===================================================================
--- branches/4.0.X/examples/irc-client/src/main/webapp/chat.xhtml
(rev 0)
+++ branches/4.0.X/examples/irc-client/src/main/webapp/chat.xhtml 2011-03-03 11:08:07 UTC
(rev 22031)
@@ -0,0 +1,61 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+ template="/templates/template.xhtml">
+ <ui:define name="body">
+ <style>
+.chatOutput {
+ overflow: auto;
+ width: 80%;
+ height: 200px;
+ float: left;
+}
+
+.chatList {
+ float: right;
+ width: 19%;
+ height: 200px;
+ overflow: auto;
+}
+</style>
+ <rich:panel
+ header="Welcome to #{chatBean.channelName} channel at
#{chatBean.serverName}" id="chatpanel">
+ <rich:panel styleClass="chatOutput"
+ bodyClass="#{chatBean.channelName}Output" />
+ <rich:panel styleClass="chatList">
+ <rich:list value="#{chatBean.users}" var="user"
id="users"
+ type="unordered">
+ #{user.nick}
+ </rich:list>
+ </rich:panel>
+ <br clear="all" />
+ <hr />
+ <h:form>
+ <a4j:push
address="#{chatBean.userName}_#{chatBean.channelName}List@chat"
+ onerror="alert(event.rf.data)">
+ <a4j:ajax event="dataavailable" render="users"
execute="@none" />
+ </a4j:push>
+ <a4j:push address="#{chatBean.userName}_#{chatBean.channelName}@chat"
+ onerror="alert(event.rf.data)"
+ ondataavailable="jQuery('<div
/>').prependTo('.#{chatBean.channelName}Output').text(event.rf.data)"
/>
+ <h:inputTextarea value="#{chatBean.message}" rows="3"
+ style="width:80%" id="nm" />
+ <a4j:commandButton value="Send" action="#{chatBean.send}"
+ render="@none" execute="@form" />
+ </h:form>
+ <hr />
+ <h:form>
+ <rich:panel header="Change nickname:">
+ <h:inputText valueChangeListener="#{chatBean.changeNick}"
id="cn" />
+ <a4j:commandButton value="Change" execute="@form"
render="@none"/>
+ </rich:panel>
+ <h:commandButton value="Disconnect"
action="#{chatBean.leave}"/>
+ </h:form>
+ </rich:panel>
+ </ui:define>
+</ui:composition>
\ No newline at end of file
Modified: branches/4.0.X/examples/irc-client/src/main/webapp/welcome.xhtml
===================================================================
--- branches/4.0.X/examples/irc-client/src/main/webapp/welcome.xhtml 2011-03-03 09:58:11
UTC (rev 22030)
+++ branches/4.0.X/examples/irc-client/src/main/webapp/welcome.xhtml 2011-03-03 11:08:07
UTC (rev 22031)
@@ -23,8 +23,7 @@
overflow: auto;
}
</style>
- <rich:panel header="Connect to IRC"
- rendered="#{not chatBean.connected}">
+ <rich:panel header="Connect to IRC">
<h:form>
<a4j:outputPanel ajaxRendered="true">
<h:messages style="color:red" />
@@ -37,44 +36,8 @@
<h:outputText value="Server:" />
<h:outputText value="irc.freenode.org"
style="font-weight:bold"/>
</h:panelGrid>
- <a4j:commandButton value="Connect" execute="@form"
render="@all"
- action="#{chatBean.connect}" />
+ <h:commandButton value="Connect" action="#{chatBean.connect}"
/>
</h:form>
</rich:panel>
- <rich:panel
- header="Welcome to #{chatBean.channelName} channel at
#{chatBean.serverName}"
- rendered="#{chatBean.connected}" id="chatpanel">
- <rich:panel styleClass="chatOutput"
- bodyClass="#{chatBean.channelName}Output" />
- <rich:panel styleClass="chatList">
- <rich:list value="#{chatBean.users}" var="user"
id="users"
- type="unordered">
- #{user.nick}
- </rich:list>
- </rich:panel>
- <br clear="all" />
- <hr />
- <h:form>
- <a4j:push
address="#{chatBean.userName}_#{chatBean.channelName}List@chat"
- onerror="alert(event.rf.data)">
- <a4j:ajax event="dataavailable" render="users"
execute="@none" />
- </a4j:push>
- <a4j:push address="#{chatBean.userName}_#{chatBean.channelName}@chat"
- onerror="alert(event.rf.data)"
- ondataavailable="jQuery('<div
/>').prependTo('.#{chatBean.channelName}Output').text(event.rf.data)"
/>
- <h:inputTextarea value="#{chatBean.message}" rows="3"
- style="width:80%" id="nm" />
- <a4j:commandButton value="Send" action="#{chatBean.send}"
- render="@none" execute="@form" />
- </h:form>
- <hr />
- <h:form>
- <rich:panel header="Change nickname:">
- <h:inputText valueChangeListener="#{chatBean.changeNick}"
id="cn" />
- <a4j:commandButton value="Change" execute="@form"
render="@none"/>
- </rich:panel>
- <a4j:commandButton value="disconnect"
action="#{chatBean.leave}" execute="@none"
render="@all"/>
- </h:form>
- </rich:panel>
</ui:define>
</ui:composition>
\ No newline at end of file