JBoss Rich Faces SVN: r21265 - sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/listeners.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2011-01-27 06:05:12 -0500 (Thu, 27 Jan 2011)
New Revision: 21265
Removed:
sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/listeners/HornetQInitializer.java
Log:
IRC-Client ready in draft
Deleted: sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/listeners/HornetQInitializer.java
===================================================================
--- sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/listeners/HornetQInitializer.java 2011-01-27 11:00:20 UTC (rev 21264)
+++ sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/listeners/HornetQInitializer.java 2011-01-27 11:05:12 UTC (rev 21265)
@@ -1,118 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.ircclient.listeners;
-
-import java.util.HashSet;
-
-import javax.faces.application.Application;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.PostConstructApplicationEvent;
-import javax.faces.event.PreDestroyApplicationEvent;
-import javax.faces.event.SystemEvent;
-import javax.faces.event.SystemEventListener;
-import javax.naming.InitialContext;
-
-import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
-import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.core.server.HornetQServers;
-import org.hornetq.jms.server.JMSServerManager;
-import org.hornetq.jms.server.impl.JMSServerManagerImpl;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class HornetQInitializer implements SystemEventListener {
-
- private JMSServerManager serverManager;
-
- public void processEvent(SystemEvent event) throws AbortProcessingException {
- if (event instanceof PostConstructApplicationEvent) {
- try {
- startHornetQ();
- } catch (Exception e) {
- throw new AbortProcessingException(e);
- }
-
- Application application = FacesContext.getCurrentInstance().getApplication();
- application.subscribeToEvent(PreDestroyApplicationEvent.class, this);
- } else {
- try {
- stopHornetQ();
- } catch (Exception e) {
- throw new AbortProcessingException(e);
- }
- }
- }
-
- /**
- * @throws Exception
- *
- */
- private void stopHornetQ() throws Exception {
- serverManager.stop();
- serverManager = null;
- }
-
- /**
- * @throws Exception
- *
- */
- private void startHornetQ() throws Exception {
- // Step 2. Create the Configuration, and set the properties accordingly
- Configuration configuration = new ConfigurationImpl();
- configuration.setPersistenceEnabled(false);
- configuration.setSecurityEnabled(false);
-
- TransportConfiguration transpConf = new TransportConfiguration(NettyAcceptorFactory.class.getName());
-
- HashSet<TransportConfiguration> setTransp = new HashSet<TransportConfiguration>();
- setTransp.add(transpConf);
-
- configuration.setAcceptorConfigurations(setTransp);
-
- // Step 3. Create and start the server
- HornetQServer server = HornetQServers.newHornetQServer(configuration);
-
- serverManager = new JMSServerManagerImpl(server);
-
- // if you want to use JNDI, simple inject a context here or don't call this method and make sure the JNDI
- // parameters are set.
- serverManager.setContext(new InitialContext());
- serverManager.start();
-
- serverManager.createConnectionFactory("ConnectionFactory", new TransportConfiguration(
- NettyConnectorFactory.class.getName()), "ConnectionFactory");
-
- serverManager.createTopic(false, "chat", "/topic/chat");
- }
-
- public boolean isListenerForSource(Object source) {
- return true;
- }
-
-}
13 years, 11 months
JBoss Rich Faces SVN: r21264 - in sandbox/trunk/examples/irc-client: src/main/java/org/ircclient/controller and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2011-01-27 06:00:20 -0500 (Thu, 27 Jan 2011)
New Revision: 21264
Added:
sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
Modified:
sandbox/trunk/examples/irc-client/pom.xml
sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java
sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/faces-config.xml
sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/web.xml
sandbox/trunk/examples/irc-client/src/main/webapp/welcome.xhtml
Log:
IRC-Client ready in draft
Modified: sandbox/trunk/examples/irc-client/pom.xml
===================================================================
--- sandbox/trunk/examples/irc-client/pom.xml 2011-01-27 10:56:14 UTC (rev 21263)
+++ sandbox/trunk/examples/irc-client/pom.xml 2011-01-27 11:00:20 UTC (rev 21264)
@@ -1,158 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <groupId>org.demo</groupId>
- <artifactId>irc-client</artifactId>
- <name>irc-client</name>
- <version>1.0-SNAPSHOT</version>
- <packaging>war</packaging>
+ <groupId>org.demo</groupId>
+ <artifactId>irc-client</artifactId>
+ <name>irc-client</name>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>war</packaging>
- <url>http://jboss.org/richfaces</url>
+ <url>http://jboss.org/richfaces</url>
- <repositories>
- <repository>
- <id>jboss-public-repository-group</id>
- <name>Jboss Repository for Maven</name>
- <url>https://repository.jboss.org/nexus/content/groups/public/</url>
- </repository>
- <repository>
- <id>java-net</id>
- <name>Java.net Maven Repository</name>
- <url>http://download.java.net/maven/2</url>
- </repository>
- </repositories>
+ <repositories>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>Jboss Repository for Maven</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ </repository>
+ <repository>
+ <id>java-net</id>
+ <name>Java.net Maven Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <hornetq.version>2.1.2.Final</hornetq.version>
- <org.richfaces.bom.version>4.0.0-SNAPSHOT</org.richfaces.bom.version>
- </properties>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <hornetq.version>2.1.2.Final</hornetq.version>
+ <org.richfaces.bom.version>4.0.0-SNAPSHOT</org.richfaces.bom.version>
+ </properties>
- <build>
- <finalName>irc-client-${project.version}</finalName>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webResources>
- <resource>
- <directory>${basedir}/src/main/java</directory>
- <targetPath>/WEB-INF/src</targetPath>
- </resource>
- </webResources>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <finalName>irc-client-${project.version}</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webResources>
+ <resource>
+ <directory>${basedir}/src/main/java</directory>
+ <targetPath>/WEB-INF/src</targetPath>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.richfaces</groupId>
- <artifactId>richfaces-bom</artifactId>
- <version>${org.richfaces.bom.version}</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-bom</artifactId>
+ <version>${org.richfaces.bom.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>richfaces-components-ui</artifactId>
- </dependency>
- <dependency>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>richfaces-components-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.richfaces.core</groupId>
- <artifactId>richfaces-core-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-components-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-components-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ </dependency>
- <dependency>
- <groupId>net.sf.ehcache</groupId>
- <artifactId>ehcache</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-core</artifactId>
- <version>${hornetq.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-jms</artifactId>
- <version>${hornetq.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-logging</artifactId>
- <version>${hornetq.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.netty</groupId>
- <artifactId>netty</artifactId>
- <version>3.2.2.Final</version>
- </dependency>
- <dependency>
- <groupId>javax.jms</groupId>
- <artifactId>jms</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>org.atmosphere</groupId>
- <artifactId>atmosphere-runtime</artifactId>
- </dependency>
<dependency>
- <groupId>pircbot</groupId>
- <artifactId>pircbot</artifactId>
- <version>1.4.2</version>
- </dependency>
- <!-- Tests -->
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>5.10</version>
- <classifier>jdk15</classifier>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <groupId>net.sf.ehcache</groupId>
+ <artifactId>ehcache</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.atmosphere</groupId>
+ <artifactId>atmosphere-runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>pircbot</groupId>
+ <artifactId>pircbot</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+ <!-- Tests -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.10</version>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
Modified: sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java
===================================================================
--- sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java 2011-01-27 10:56:14 UTC (rev 21263)
+++ sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java 2011-01-27 11:00:20 UTC (rev 21264)
@@ -29,7 +29,8 @@
private static final String SERVER_URL = "irc.freenode.org";
private static final int SERVER_PORT = 6667;
private static final String CHANNEL_PREFIX = "#";
- private static final String DEFAULT_CHANNEL = "richfaces_push";
+ private static final String SUBTOPIC_SEPARATOR = "_";
+ private static final String DEFAULT_CHANNEL = "richfaces";
private static final Logger LOGGER = LogFactory.getLogger(ChatBean.class);
private String channelName;
@@ -60,22 +61,22 @@
}
}
- public void leave(){
+ public void leave() {
this.disconnect();
}
-
+
private TopicsContext getTopicsContext() {
- if (topicsContext == null){
+ if (topicsContext == null) {
topicsContext = TopicsContext.lookup();
}
return topicsContext;
}
-
+
@Override
protected void onMessage(String channel, String sender, String login, String hostname, String message) {
String channelName = channel.replace(CHANNEL_PREFIX, "");
try {
- getTopicsContext().publish(new TopicKey("chat", channelName),
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName() + SUBTOPIC_SEPARATOR + channelName),
MessageFormat.format("{0,time,medium} {1}: {2}", new Date(), sender, message));
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
@@ -85,7 +86,7 @@
@Override
protected void onUserList(String channel, User[] users) {
try {
- getTopicsContext().publish(new TopicKey("chat", channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName() + SUBTOPIC_SEPARATOR + channelName + "List"), null);
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
}
@@ -94,8 +95,8 @@
@Override
protected void onJoin(String channel, String sender, String login, String hostname) {
try {
- getTopicsContext().publish(new TopicKey("chat", channelName + "List"), null);
- getTopicsContext().publish(new TopicKey("chat", channelName),
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName() + SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName() + SUBTOPIC_SEPARATOR + channelName),
MessageFormat.format("{0,time,medium} {1}: {2}", new Date(), sender, "joined channel"));
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
@@ -105,30 +106,30 @@
@Override
protected void onPart(String channel, String sender, String login, String hostname) {
try {
- getTopicsContext().publish(new TopicKey("chat", channelName + "List"), null);
- getTopicsContext().publish(new TopicKey("chat", channelName),
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName() + SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName() + SUBTOPIC_SEPARATOR + channelName),
MessageFormat.format("{0,time,medium} {1}: {2}", new Date(), sender, "left channel"));
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
}
}
-
+
@Override
protected void onNickChange(String oldNick, String login, String hostname, String newNick) {
try {
- getTopicsContext().publish(new TopicKey("chat", channelName + "List"), null);
- getTopicsContext().publish(new TopicKey("chat", channelName),
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName() + SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName() + SUBTOPIC_SEPARATOR + channelName),
MessageFormat.format("{0,time,medium} {1}", new Date(), oldNick + " changed nick to " + newNick));
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
}
}
-
+
@Override
protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) {
try {
- getTopicsContext().publish(new TopicKey("chat", channelName + "List"), null);
- getTopicsContext().publish(new TopicKey("chat", channelName),
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName() + SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName() + SUBTOPIC_SEPARATOR + channelName),
MessageFormat.format("{0,time,medium} {1}: {2} {3}", new Date(), sourceNick, "joined channel", reason));
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
@@ -142,13 +143,13 @@
public void send() {
this.sendMessage(CHANNEL_PREFIX + channelName, message);
try {
- getTopicsContext().publish(new TopicKey("chat", channelName),
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName() + SUBTOPIC_SEPARATOR + channelName),
MessageFormat.format("{0,time,medium} {1}: {2}", new Date(), this.getName(), message));
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
}
}
-
+
public void changeNick(ValueChangeEvent event) {
this.changeNick((String) event.getNewValue());
}
Added: sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
===================================================================
--- sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia (rev 0)
+++ sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2011-01-27 11:00:20 UTC (rev 21264)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS model-entity="JSFProcess"/>
Modified: sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/faces-config.xml 2011-01-27 10:56:14 UTC (rev 21263)
+++ sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/faces-config.xml 2011-01-27 11:00:20 UTC (rev 21264)
@@ -5,12 +5,9 @@
<application>
<system-event-listener>
- <system-event-listener-class>org.ircclient.listeners.HornetQInitializer</system-event-listener-class>
- <system-event-class>javax.faces.event.PostConstructApplicationEvent</system-event-class>
- </system-event-listener>
- <system-event-listener>
<system-event-listener-class>org.ircclient.listeners.TopicsInitializer</system-event-listener-class>
<system-event-class>javax.faces.event.PostConstructApplicationEvent</system-event-class>
</system-event-listener>
</application>
+
</faces-config>
Modified: sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/web.xml
===================================================================
--- sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/web.xml 2011-01-27 10:56:14 UTC (rev 21263)
+++ sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/web.xml 2011-01-27 11:00:20 UTC (rev 21264)
@@ -16,6 +16,14 @@
<param-name>org.richfaces.skin</param-name>
<param-value>#{skinBean.skin}</param-value>
</context-param>
+ <context-param>
+ <param-name>org.richfaces.push.jms.connectionUsername</param-name>
+ <param-value>guest</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.push.jms.connectionPassword</param-name>
+ <param-value>guest</param-value>
+ </context-param>
<filter>
<filter-name>PushFilter</filter-name>
<filter-class>org.richfaces.webapp.PushFilter</filter-class>
Modified: sandbox/trunk/examples/irc-client/src/main/webapp/welcome.xhtml
===================================================================
--- sandbox/trunk/examples/irc-client/src/main/webapp/welcome.xhtml 2011-01-27 10:56:14 UTC (rev 21263)
+++ sandbox/trunk/examples/irc-client/src/main/webapp/welcome.xhtml 2011-01-27 11:00:20 UTC (rev 21264)
@@ -55,11 +55,11 @@
<br clear="all" />
<hr />
<h:form>
- <a4j:push address="#{chatBean.channelName}List@chat"
+ <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.channelName}@chat"
+ <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"
13 years, 11 months
JBoss Rich Faces SVN: r21263 - modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-27 05:56:14 -0500 (Thu, 27 Jan 2011)
New Revision: 21263
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/simple.xhtml
Log:
a4j:status - fixed simple sample after refactoring in main template
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/simple.xhtml 2011-01-27 10:45:55 UTC (rev 21262)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/simple.xhtml 2011-01-27 10:56:14 UTC (rev 21263)
@@ -27,6 +27,7 @@
-->
<ui:composition template="/templates/template.xhtml">
+ <ui:param name="componentId" value="status" />
<ui:define name="head">
<f:metadata>
@@ -49,11 +50,13 @@
<h:outputText value="Facet Error: " />
<h:inputText id="facetErrorTextInput" value="#{a4jStatusBean.facetErrorValue}" />
</h:panelGrid>
+
+ <a4j:commandButton id="applyFacets" value="ApplyFacets" render="#{nestedComponentId}" execute="facetsSettings" />
</fieldset>
</ui:define>
<ui:define name="component">
- <a4j:commandButton id="applyFacets" value="ApplyFacets" render="status" execute="facetsSettings" />
+
<fieldset style="height: 3em">
<legend>status (inside form)</legend>
13 years, 11 months
JBoss Rich Faces SVN: r21262 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-27 05:45:55 -0500 (Thu, 27 Jan 2011)
New Revision: 21262
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSimple.java
Log:
rich:collapsibleSubTable - removed testExpanded() since expanded attribute is hidden
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSimple.java 2011-01-27 10:45:20 UTC (rev 21261)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSimple.java 2011-01-27 10:45:55 UTC (rev 21262)
@@ -79,23 +79,6 @@
}
@Test
- @Use(field = "configuration", empty = true)
- public void testExpanded() {
- attributes.setExpanded(false);
-
- assertFalse(configurationMen.subtable.hasVisibleRows());
- assertFalse(configurationWomen.subtable.hasVisibleRows());
-
- selenium.click(configurationMen.toggler);
- assertTrue(configurationMen.subtable.hasVisibleRows());
-
- attributes.setExpanded(true);
-
- assertTrue(configurationMen.subtable.hasVisibleRows());
- assertTrue(configurationWomen.subtable.hasVisibleRows());
- }
-
- @Test
public void testFirst() {
attributes.setFirst(2);
13 years, 11 months
JBoss Rich Faces SVN: r21261 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-27 05:45:20 -0500 (Thu, 27 Jan 2011)
New Revision: 21261
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java
Log:
AbstractComponentAttributes - fixed locator for input type - needs to be formatted with empty parameter
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java 2011-01-27 10:44:44 UTC (rev 21260)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java 2011-01-27 10:45:20 UTC (rev 21261)
@@ -68,7 +68,7 @@
protected void setProperty(String propertyName, Object value) {
ExtendedLocator<JQueryLocator> locator = propertyLocator.format(propertyName);
- final AttributeLocator<?> typeLocator = locator.getAttribute(Attribute.TYPE);
+ final AttributeLocator<?> typeLocator = locator.format("").getAttribute(Attribute.TYPE);
final ExtendedLocator<JQueryLocator> optionLocator = locator.getChild(jq("option"));
String inputType = null;
13 years, 11 months
JBoss Rich Faces SVN: r21260 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org: richfaces/tests/metamer/ftest/model and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-27 05:44:44 -0500 (Thu, 27 Jan 2011)
New Revision: 21260
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/locator/reference/ReferencedLocator.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/AbstractModel.java
Log:
following changes in richfaces-selenium: format() method for Locator returns Locator<T> - all childs are returning own type
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/locator/reference/ReferencedLocator.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/locator/reference/ReferencedLocator.java 2011-01-27 10:43:57 UTC (rev 21259)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/locator/reference/ReferencedLocator.java 2011-01-27 10:44:44 UTC (rev 21260)
@@ -65,7 +65,6 @@
public T getReferenced() {
ExtendedLocator<T> referencedLocator = reference.getLocator();
-
@SuppressWarnings("unchecked")
Class<T> tClass = (Class<T>) referencedLocator.getClass();
@@ -125,11 +124,10 @@
return getReferenced().getDescendants(elementLocator);
}
- public T format(Object... args) {
+ public ReferencedLocator<T> format(Object... args) {
String newAddition = SimplifiedFormat.format(addition, args);
try {
- // TODO fix the <T> param cast
- return (T) new ReferencedLocator<T>(this.reference, newAddition);
+ return (ReferencedLocator<T>) new ReferencedLocator<T>(this.reference, newAddition);
} catch (Exception e) {
throw new IllegalStateException(e);
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/AbstractModel.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/AbstractModel.java 2011-01-27 10:43:57 UTC (rev 21259)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/AbstractModel.java 2011-01-27 10:44:44 UTC (rev 21260)
@@ -128,7 +128,7 @@
}
@Override
- public T format(Object... args) {
+ public ExtendedLocator<T> format(Object... args) {
return root.getLocator().format(args);
}
13 years, 11 months
JBoss Rich Faces SVN: r21259 - in modules/tests/metamer/trunk/application/src/main/webapp: components/richDragSource and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-27 05:43:57 -0500 (Thu, 27 Jan 2011)
New Revision: 21259
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/simple.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDragSource/simple.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/resources/css/richDragBehavior.css
Log:
drag-n-drop: pre-automation activities (RFPL-992)
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/simple.xhtml 2011-01-27 10:26:27 UTC (rev 21258)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/simple.xhtml 2011-01-27 10:43:57 UTC (rev 21259)
@@ -62,6 +62,7 @@
<a4j:outputPanel id="draggable1" layout="block" styleClass="draggable">
<h:outputText value="#1: type=#{richDragSourceBean.attributes['type'].value}" />
<rich:dragSource
+ dragIndicator="indicator"
dragValue="#{richDragSourceBean.dragValues[0]}"
type="drg1" />
</a4j:outputPanel>
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richDragSource/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDragSource/simple.xhtml 2011-01-27 10:26:27 UTC (rev 21258)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDragSource/simple.xhtml 2011-01-27 10:43:57 UTC (rev 21259)
@@ -59,7 +59,8 @@
<rich:dragSource
dragValue="#{richDragSourceBean.dragValues[0]}"
dragIndicator="#{richDragSourceBean.attributes['dragIndicator'].value}"
- type="#{richDragSourceBean.attributes['type'].value}" />
+ type="#{richDragSourceBean.attributes['type'].value}"
+ rendered="#{richDragSourceBean.attributes['rendered'].value}" />
</a4j:outputPanel>
</td>
<td>
Modified: modules/tests/metamer/trunk/application/src/main/webapp/resources/css/richDragBehavior.css
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/resources/css/richDragBehavior.css 2011-01-27 10:26:27 UTC (rev 21258)
+++ modules/tests/metamer/trunk/application/src/main/webapp/resources/css/richDragBehavior.css 2011-01-27 10:43:57 UTC (rev 21259)
@@ -32,11 +32,11 @@
background-color: red;
}
-.acceptClass {
- border: 5px solid green;
+.draggingClass {
+ border: 5px dashed black;
}
-.draggingClass {
+.acceptClass {
border: 5px solid black;
}
13 years, 11 months
JBoss Rich Faces SVN: r21258 - trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-27 05:26:27 -0500 (Thu, 27 Jan 2011)
New Revision: 21258
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableTogglerRendererBase.java
Log:
RF-9725 Sub table toggle control: attributes collapseIcon and expandIcon don't work
-The icon is applied when only one attribute is set.
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableTogglerRendererBase.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableTogglerRendererBase.java 2011-01-27 09:47:10 UTC (rev 21257)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableTogglerRendererBase.java 2011-01-27 10:26:27 UTC (rev 21258)
@@ -98,6 +98,10 @@
}
}
+ private boolean isEmpty(String value) {
+ return (value == null || value.trim().length() == 0);
+ }
+
protected void encodeControl(FacesContext context, ResponseWriter writer, AbstractCollapsibleSubTableToggler control,
boolean expanded, boolean visible) throws IOException {
String state = getState(expanded);
@@ -114,8 +118,6 @@
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, styleClass, null);
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, style, null);
- boolean encodeDefault = true;
-
UIComponent controlFacet = control.getFacet(state);
if (controlFacet != null && controlFacet.isRendered()) {
@@ -125,24 +127,28 @@
controlFacet.getAttributes().put(HtmlConstants.STYLE_ATTRIBUTE, facetStyle);
}
controlFacet.encodeAll(context);
- encodeDefault = false;
}
String expandIcon = control.getExpandIcon();
+ if (isEmpty(expandIcon)) {
+ expandIcon = context.getApplication().getResourceHandler().createResource(UP_ICON_URL).getRequestPath();
+ } else {
+ expandIcon = RenderKitUtils.getResourceURL(expandIcon, context);
+ }
+
String collapseIcon = control.getCollapseIcon();
+ if (isEmpty(collapseIcon)) {
+ collapseIcon = context.getApplication().getResourceHandler().createResource(DOWN_ICON_URL).getRequestPath();
+ } else {
+ collapseIcon = RenderKitUtils.getResourceURL(collapseIcon, context);
+ }
- if ((expandIcon != null && collapseIcon != null)
- && (expandIcon.trim().length() > 0 && collapseIcon.trim().length() > 0)) {
-
- String image = expanded ? expandIcon : collapseIcon;
- image = RenderKitUtils.getResourceURL(image, context);
- if (image != null && image.trim().length() > 0) {
- writer.startElement(HtmlConstants.IMG_ELEMENT, control);
- writer.writeAttribute(HtmlConstants.SRC_ATTRIBUTE, image, null);
- writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
- writer.endElement(HtmlConstants.IMG_ELEMENT);
- }
- encodeDefault = false;
+ String image = expanded ? expandIcon : collapseIcon;
+ if (image != null && image.trim().length() > 0) {
+ writer.startElement(HtmlConstants.IMG_ELEMENT, control);
+ writer.writeAttribute(HtmlConstants.SRC_ATTRIBUTE, image, null);
+ writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
+ writer.endElement(HtmlConstants.IMG_ELEMENT);
}
String label = expanded ? control.getExpandLabel() : control.getCollapseLabel();
@@ -151,22 +157,8 @@
writer.writeAttribute(HtmlConstants.HREF_ATTR, "javascript:void(0);", null);
writer.writeText(label, null);
writer.endElement(HtmlConstants.A_ELEMENT);
- encodeDefault = false;
}
- if (encodeDefault) {
- expandIcon = context.getApplication().getResourceHandler().createResource(UP_ICON_URL).getRequestPath();
- collapseIcon = context.getApplication().getResourceHandler().createResource(DOWN_ICON_URL).getRequestPath();
-
- String image = expanded ? expandIcon : collapseIcon;
- if (image != null && image.trim().length() > 0) {
- writer.startElement(HtmlConstants.IMG_ELEMENT, control);
- writer.writeAttribute(HtmlConstants.SRC_ATTRIBUTE, image, null);
- writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
- writer.endElement(HtmlConstants.IMG_ELEMENT);
- }
- }
-
writer.endElement(HtmlConstants.SPAN_ELEM);
}
13 years, 11 months
JBoss Rich Faces SVN: r21257 - in management/design-4x: select-disabled and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Ochikvina
Date: 2011-01-27 04:47:10 -0500 (Thu, 27 Jan 2011)
New Revision: 21257
Added:
management/design-4x/select-disabled/
management/design-4x/select-disabled/images/
management/design-4x/select-disabled/images/AutocompleteButtonGradient.png
management/design-4x/select-disabled/images/AutocompleteFieldGradient.png
management/design-4x/select-disabled/images/InputBackgroundImage.png
management/design-4x/select-disabled/images/combo_down_button.gif
management/design-4x/select-disabled/images/combo_down_button_dis.gif
management/design-4x/select-disabled/select-disabled.html
Log:
RF-10102 - added disabled mode for select and autocomplete components.
Added: management/design-4x/select-disabled/images/AutocompleteButtonGradient.png
===================================================================
(Binary files differ)
Property changes on: management/design-4x/select-disabled/images/AutocompleteButtonGradient.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design-4x/select-disabled/images/AutocompleteFieldGradient.png
===================================================================
(Binary files differ)
Property changes on: management/design-4x/select-disabled/images/AutocompleteFieldGradient.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design-4x/select-disabled/images/InputBackgroundImage.png
===================================================================
(Binary files differ)
Property changes on: management/design-4x/select-disabled/images/InputBackgroundImage.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design-4x/select-disabled/images/combo_down_button.gif
===================================================================
(Binary files differ)
Property changes on: management/design-4x/select-disabled/images/combo_down_button.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design-4x/select-disabled/images/combo_down_button_dis.gif
===================================================================
(Binary files differ)
Property changes on: management/design-4x/select-disabled/images/combo_down_button_dis.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design-4x/select-disabled/select-disabled.html
===================================================================
--- management/design-4x/select-disabled/select-disabled.html (rev 0)
+++ management/design-4x/select-disabled/select-disabled.html 2011-01-27 09:47:10 UTC (rev 21257)
@@ -0,0 +1,183 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <title>Select disabled</title>
+ <style rel="stylesheet" type="text/css">
+ body{
+ font:normal 11px Arial, Verdana, sans-serif;
+ margin:20px;
+ }
+
+ input, select, textarea, button, keygen, isindex, legend, a {
+ color:#000000;
+ font-family:Arial,Verdana,sans-serif;
+ font-size:11px;
+ }
+
+ input, select, textarea, button, keygen, isindex {
+ border-color:#BED6F8;
+ border-width:1px;
+ color:#000000;
+ }
+
+ textarea, input[type="text"], input[type="password"], select {
+ background-color:#FFFFFF;
+ background-image:url("images/AutocompleteFieldGradient.png");
+ background-position:1px 1px;
+ background-repeat:repeat-x;
+ border:1px solid #BED6F8;
+ color:#000000;
+ font-family:Arial,Verdana,sans-serif;
+ font-size:11px;
+ }
+
+ textarea[disabled], input[type="text"][disabled], input[type="password"][disabled], select[disabled] {
+ cursor:default;
+ }
+
+ /*--- RF Select styles ---*/
+ .rf-sel {
+ display:inline-block;
+ width:200px;
+ }
+ .rf-sel-fld {
+ background-color:#FFFFFF;
+ background-image:url("images/AutocompleteFieldGradient.png");
+ background-position:left top;
+ background-repeat:repeat-x;
+ border:1px solid #BED6F8;
+ width:100%;
+ }
+ input.rf-sel-inp {
+ border-width:0;
+ color:#000000;
+ font-family:Arial,Verdana,sans-serif;
+ font-size:11px;
+ width:100%;
+ }
+ input.rf-sel-inp-dis{
+ color:#BED6F8; /*headerBackgroundColor*/
+ cursor:default;
+ }
+ .rf-sel-inp, .rf-sel-opt {
+ color:#000000;
+ font-family:Arial,Verdana,sans-serif;
+ font-size:11px;
+ }
+ .rf-sel-btn {
+ background-color:#BED6F8;
+ background-image:url("images/AutocompleteButtonGradient.png");
+ background-position:left top;
+ background-repeat:repeat-x;
+ border-color:#BED6F8;
+ border-style:solid;
+ border-width:1px 1px 1px 0;
+ height:200px;
+ padding-top:1px;
+ position:absolute;
+ right:0;
+ text-align:center;
+ top:0;
+ width:15px;
+ }
+ .rf-sel-btn-arrow {
+ background-image:url("images/combo_down_button.gif");
+ background-position:center center;
+ background-repeat:no-repeat;
+ cursor:pointer;
+ height:15px;
+ width:15px;
+ }
+ .rf-sel-btn-arrow-dis {
+ background-image:url("images/combo_down_button_dis.gif");
+ background-position:center center;
+ background-repeat:no-repeat;
+ cursor:default;
+ height:15px;
+ width:15px;
+ }
+ .rf-sel-lst-cord {
+ display:none;
+ position:absolute;
+ }
+
+ /*--- RF Autocomplete styles ---*/
+
+ .rf-au-fld {
+ background-color:#FFFFFF;
+ background-image:url("images/AutocompleteFieldGradient.png");
+ background-position:left top;
+ background-repeat:repeat-x;
+ border:1px solid #BED6F8;
+ display:inline-block;
+ width:200px;
+ }
+ input.rf-au-inp {
+ border-width:0;
+ width:100%;
+ }
+ input.rf-au-inp-dis {
+ color:#BED6F8; /*headerBackgroundColor*/
+ cursor:default;
+ }
+ .rf-au-lst-cord {
+ display:none;
+ position:absolute;
+ }
+ </style>
+</head>
+<body>
+ <h1>Select disabled</h1>
+ <div class="rf-sel">
+ <div style="position: relative; overflow: hidden; text-align: left; padding-right: 18px;">
+ <input type="hidden" value="2"/>
+ <div class="rf-sel-fld">
+ <input type="text" readonly="readonly" class="rf-sel-inp rf-sel-inp-dis" autocomplete="off" value="Option1" disabled="disabled"/>
+ </div>
+ <div class="rf-sel-btn">
+ <div class="rf-sel-btn-arrow-dis"></div>
+ </div>
+ </div>
+ <div class="rf-sel-lst-cord" style="left: 349px; top: 353px; display: none;">
+ <div class="rf-sel-shdw">
+ <div class="rf-sel-shdw-t"></div>
+ <div class="rf-sel-shdw-l"></div>
+ <div class="rf-sel-shdw-r"></div>
+ <div class="rf-sel-shdw-b"></div>
+ <div class="rf-sel-lst-dcrtn">
+ <div style="min-height: 20px; max-height: 100px; width: 200px;" class="rf-sel-lst-scrl">
+ <div>
+ <div class="rf-sel-opt rf-sel-sel" >Option 1</div>
+ <div class="rf-sel-opt">Option 2</div>
+ <div class="rf-sel-opt">Option 3</div>
+ <div class="rf-sel-opt">Option 4</div>
+ <div class="rf-sel-opt">Option 5</div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <h1>Autocomplete disabled</h1>
+
+ <div class="rf-au-fld">
+ <input type="hidden" class="rf-au-fnt rf-au-inp"/>
+ <div style="position: relative; overflow: hidden; text-align: left; padding-right: 21px;">
+ <input type="text" class="rf-au-fnt rf-au-inp rf-au-inp-dis" autocomplete="off" value="Rhode Island" disabled="disabled"/>
+ </div>
+ <div class="rf-au-lst-cord">
+ <div class="rf-au-shdw">
+ <div class="rf-au-shdw-t"></div>
+ <div class="rf-au-shdw-l"></div>
+ <div class="rf-au-shdw-r"></div>
+ <div class="rf-au-shdw-b"></div>
+ <div class="rf-au-lst-dcrtn">
+ <div class="rf-au-lst-scrl">
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
13 years, 11 months
JBoss Rich Faces SVN: r21256 - trunk/ui/misc/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-27 04:40:59 -0500 (Thu, 27 Jan 2011)
New Revision: 21256
Modified:
trunk/ui/misc/ui/src/main/java/org/richfaces/renderkit/ComponentControlBehaviorRenderer.java
Log:
RF-9745 rich:componentControl - when @operation=null, JS exception is thrown
-added IllegalArgumentException.
Modified: trunk/ui/misc/ui/src/main/java/org/richfaces/renderkit/ComponentControlBehaviorRenderer.java
===================================================================
--- trunk/ui/misc/ui/src/main/java/org/richfaces/renderkit/ComponentControlBehaviorRenderer.java 2011-01-27 09:06:26 UTC (rev 21255)
+++ trunk/ui/misc/ui/src/main/java/org/richfaces/renderkit/ComponentControlBehaviorRenderer.java 2011-01-27 09:40:59 UTC (rev 21256)
@@ -80,15 +80,22 @@
private static final Pattern COMMA_SEPARATED_STRING = Pattern.compile("\\s*,\\s*");
+ private boolean isEmpty(String value) {
+ return (value == null || value.trim().length() == 0);
+ }
+
@Override
public String getScript(ClientBehaviorContext behaviorContext, ClientBehavior behavior) {
FacesContext facesContext = behaviorContext.getFacesContext();
ComponentControlBehavior controlBehavior = (ComponentControlBehavior) behavior;
String apiFunctionName = controlBehavior.getOperation();
+ String targetSourceString = controlBehavior.getTarget();
+ String selector = controlBehavior.getSelector();
// Fix https://issues.jboss.org/browse/RF-9745
- if (apiFunctionName == null || apiFunctionName.trim().length() == 0) {
- return "";
+ if (isEmpty(apiFunctionName) ||
+ (isEmpty(targetSourceString) && isEmpty(selector))) {
+ throw new IllegalArgumentException("One of the necessary attributes is null or empty. Check operation attribute and selector or target attributes.");
}
JSFunctionDefinition callback = new JSFunctionDefinition();
@@ -104,8 +111,7 @@
script.append(REF_COMPONENT).append(",").append(ScriptUtils.toScript(apiFunctionParams.toArray())).append(");");
callback.addToBody(script);
- String targetSourceString = controlBehavior.getTarget();
- String selector = controlBehavior.getSelector();
+
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(PARAM_CALLBACK, callback);
13 years, 11 months