JBoss Rich Faces SVN: r20647 - trunk/ui/core/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-17 09:33:46 -0500 (Fri, 17 Dec 2010)
New Revision: 20647
Modified:
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractActionComponent.java
Log:
https://issues.jboss.org/browse/RF-10012
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractActionComponent.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractActionComponent.java 2010-12-17 14:15:05 UTC (rev 20646)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractActionComponent.java 2010-12-17 14:33:46 UTC (rev 20647)
@@ -26,13 +26,17 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
+import org.richfaces.cdk.annotations.Attribute;
+
/**
* @author Nick Belaevski
*
*/
public abstract class AbstractActionComponent extends UICommand {
+ @Attribute
public abstract boolean isBypassUpdates();
+
public abstract void setBypassUpdates(boolean bypassUpdates);
@Override
14 years
JBoss Rich Faces SVN: r20646 - in branches/RF-7654/ui/validator/ui/src: test/java/org/richfaces/validator and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-17 09:15:05 -0500 (Fri, 17 Dec 2010)
New Revision: 20646
Removed:
branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/validator/ClientScriptServiceImpl.java
branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/validator/ClientServiceConfigParser.java
branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/validator/LibraryFunctionImplementation.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/validator/ClientScriptServiceTest.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/validator/ServiceConfigParserTest.java
Log:
Removed duplicate files
Deleted: branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/validator/ClientScriptServiceImpl.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/validator/ClientScriptServiceImpl.java 2010-12-17 13:59:20 UTC (rev 20645)
+++ branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/validator/ClientScriptServiceImpl.java 2010-12-17 14:15:05 UTC (rev 20646)
@@ -1,74 +0,0 @@
-/**
- *
- */
-package org.richfaces.validator;
-
-import java.util.Map;
-
-import javax.faces.application.Resource;
-import javax.faces.application.ResourceHandler;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.component.util.Strings;
-
-/**
- * @author asmirnov
- *
- */
-public class ClientScriptServiceImpl implements ClientScriptService {
-
- private static final String TEXT_JAVASCRIPT = "text/javascript";
-
- private static final String ORG_RICHFACES_CSV = "org.richfaces.csv";
-
- private final Map<Class<?>, LibraryFunction> defaultMapping;
-
- public ClientScriptServiceImpl(Map<Class<?>, LibraryFunction> defaultMapping) {
- this.defaultMapping = defaultMapping;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.validator.ClientScriptService#getScript(java.lang.Class)
- */
- public LibraryFunction getScript(FacesContext facesContext, Class<?> javaClass) throws ScriptNotFoundException {
- if (null == facesContext || null == javaClass) {
- throw new NullPointerException();
- }
- LibraryFunction function;
- try {
- function = getScriptResource(facesContext, javaClass);
- } catch (ScriptNotFoundException e) {
- if (defaultMapping.containsKey(javaClass)) {
- function = defaultMapping.get(javaClass);
- } else {
- function = getScriptFromAnnotation(javaClass);
- }
- }
- return function;
- }
-
- private LibraryFunction getScriptFromAnnotation(Class<?> javaClass) throws ScriptNotFoundException {
- if (javaClass.isAnnotationPresent(ClientSideScript.class)) {
- ClientSideScript clientSideScript = javaClass.getAnnotation(ClientSideScript.class);
- return new LibraryFunctionImplementation(clientSideScript.library(), clientSideScript.resource(), clientSideScript.function());
- } else {
- throw new ScriptNotFoundException();
- }
- }
-
- private LibraryFunction getScriptResource(FacesContext facesContext, Class<?> javaClass)
- throws ScriptNotFoundException {
- ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();
- String resourceName = javaClass.getSimpleName() + ".js";
- Resource facesResource = resourceHandler.createResource(resourceName, ORG_RICHFACES_CSV, TEXT_JAVASCRIPT);
- if (null != facesResource) {
- final String functionName = Strings.firstToLowerCase(javaClass.getSimpleName());
- return new LibraryFunctionImplementation(ORG_RICHFACES_CSV,resourceName, functionName);
- } else {
- throw new ScriptNotFoundException();
- }
- }
-
-}
Deleted: branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/validator/ClientServiceConfigParser.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/validator/ClientServiceConfigParser.java 2010-12-17 13:59:20 UTC (rev 20645)
+++ branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/validator/ClientServiceConfigParser.java 2010-12-17 14:15:05 UTC (rev 20646)
@@ -1,67 +0,0 @@
-/**
- *
- */
-package org.richfaces.validator;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Map;
-
-import javax.faces.FacesException;
-import javax.xml.bind.JAXB;
-
-import org.richfaces.validator.model.ClientSideScripts;
-import org.richfaces.validator.model.Component;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
-import com.google.common.collect.Maps;
-
-/**
- * @author asmirnov
- *
- */
-public final class ClientServiceConfigParser {
-
- private ClientServiceConfigParser() {
- }
-
- public static Map<Class<?>, LibraryFunction> parseConfig(String name) {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- if (null == loader) {
- loader = ClientServiceConfigParser.class.getClassLoader();
- }
- Builder<Class<?>, LibraryFunction> resultBuilder = ImmutableMap.builder();
- try {
- Enumeration<URL> resources = loader.getResources(name);
- while (resources.hasMoreElements()) {
- URL url = (URL) resources.nextElement();
- resultBuilder.putAll(parse(loader, url));
- }
- } catch (IOException e) {
- return Collections.emptyMap();
- }
- return resultBuilder.build();
- }
-
- static Map<Class<?>, LibraryFunction> parse(ClassLoader loader, URL url) {
- Map<Class<?>, LibraryFunction> result = Maps.newHashMap();
- try {
- ClientSideScripts clientSideScripts = JAXB.unmarshal(url, ClientSideScripts.class);
- for (Component component : clientSideScripts.getComponent()) {
- Class<?> componentClass = loader.loadClass(component.getType());
- LibraryFunctionImplementation function = new LibraryFunctionImplementation(component.getLibrary(),
- component.getResource(), component.getFunction());
- result.put(componentClass, function);
- }
- } catch (ClassNotFoundException e) {
- throw new FacesException("Class for component not found",e);
- } catch (Exception e) {
- throw new FacesException("Error parsing config file "+url,e);
- }
- return result;
- }
-
-}
Deleted: branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/validator/LibraryFunctionImplementation.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/validator/LibraryFunctionImplementation.java 2010-12-17 13:59:20 UTC (rev 20645)
+++ branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/validator/LibraryFunctionImplementation.java 2010-12-17 14:15:05 UTC (rev 20646)
@@ -1,24 +0,0 @@
-package org.richfaces.validator;
-
-final class LibraryFunctionImplementation implements LibraryFunction {
- private final LibraryResource library;
- private final String functionName;
-
- LibraryFunctionImplementation(LibraryResource library, String functionName) {
- this.library = library;
- this.functionName = functionName;
- }
-
- LibraryFunctionImplementation(String library, String resource, String functionName) {
- this.library = new LibraryResource(library, resource);
- this.functionName = functionName;
- }
-
- public LibraryResource getResource() {
- return library;
- }
-
- public String getName() {
- return functionName;
- }
-}
\ No newline at end of file
Deleted: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/validator/ClientScriptServiceTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/validator/ClientScriptServiceTest.java 2010-12-17 13:59:20 UTC (rev 20645)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/validator/ClientScriptServiceTest.java 2010-12-17 14:15:05 UTC (rev 20646)
@@ -1,121 +0,0 @@
-/**
- *
- */
-package org.richfaces.validator;
-
-import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-import java.util.Map;
-
-import javax.faces.application.Resource;
-import javax.faces.application.ResourceHandler;
-import javax.validation.constraints.Max;
-
-import org.jboss.test.faces.mock.Environment;
-import org.jboss.test.faces.mock.Environment.Feature;
-import org.jboss.test.faces.mock.Mock;
-import org.jboss.test.faces.mock.MockController;
-import org.jboss.test.faces.mock.MockFacesEnvironment;
-import org.jboss.test.faces.mock.MockTestRunner;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.google.common.collect.ImmutableMap;
-
-/**
- * @author asmirnov
- *
- */
-(a)RunWith(MockTestRunner.class)
-public class ClientScriptServiceTest {
-
- private static final String TEXT_JAVASCRIPT = "text/javascript";
-
- private static final String ORG_RICHFACES_CSV = "org.richfaces.csv";
-
- private static final String RESOURCE_NAME = ValidatorWithFacesResource.class.getSimpleName() + ".js";
-
- @Mock
- @Environment({ Feature.APPLICATION })
- private MockFacesEnvironment environment;
-
- @Mock
- private ResourceHandler resourceHandler;
-
- private MockController controller;
-
- @Mock
- private Resource resource;
-
- @Mock
- private LibraryFunction function;
-
- private ClientScriptServiceImpl serviceImpl;
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- expect(environment.getApplication().getResourceHandler()).andStubReturn(resourceHandler);
- Map<Class<?>, LibraryFunction> defaultMapping = ImmutableMap
- .<Class<?>, LibraryFunction> of(Max.class, function);
- serviceImpl = new ClientScriptServiceImpl(defaultMapping);
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- controller.verify();
- }
-
- /**
- * Test method for {@link org.richfaces.validator.ClientScriptServiceImpl#getScript(FacesContext, java.lang.Class)}.
- *
- * @throws Exception
- */
- @Test
- public void testGetScriptAsJsfResource() throws Exception {
- LibraryFunction script = getScript(resource, ValidatorWithFacesResource.class);
- assertEquals(RESOURCE_NAME, script.getResource().getResourceName());
- assertEquals(ORG_RICHFACES_CSV, script.getResource().getLibrary());
- assertEquals("validatorWithFacesResource", script.getName());
- }
-
- @Test
- public void testGetScriptFromAnnotation() throws Exception {
- LibraryFunction script = getScript(null, ValidatorWithFacesResource.class);
- assertEquals("baz.js", script.getResource().getResourceName());
- assertEquals("bar", script.getResource().getLibrary());
- assertEquals("foo", script.getName());
- }
-
- @Test
- public void testGetScriptFromDefaultMapping() throws Exception {
- LibraryFunction script = getScript(null, Max.class);
- assertSame(function, script);
- }
-
- @Test
- public void testGetScriptOverrideAnnotation() throws Exception {
- Map<Class<?>, LibraryFunction> defaultMapping = ImmutableMap.<Class<?>, LibraryFunction> of(
- ValidatorWithFacesResource.class, function);
- serviceImpl = new ClientScriptServiceImpl(defaultMapping);
- LibraryFunction script = getScript(null, ValidatorWithFacesResource.class);
- assertSame(function, script);
- }
-
- private LibraryFunction getScript(Resource resource, Class<?> serverSideType) throws ScriptNotFoundException {
- expect(resourceHandler.createResource(serverSideType.getSimpleName() + ".js", ORG_RICHFACES_CSV, TEXT_JAVASCRIPT)).andReturn(resource);
- controller.replay();
- LibraryFunction script = serviceImpl.getScript(environment.getFacesContext(), serverSideType);
- return script;
- }
-
-}
Deleted: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/validator/ServiceConfigParserTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/validator/ServiceConfigParserTest.java 2010-12-17 13:59:20 UTC (rev 20645)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/validator/ServiceConfigParserTest.java 2010-12-17 14:15:05 UTC (rev 20646)
@@ -1,43 +0,0 @@
-package org.richfaces.validator;
-
-import static org.junit.Assert.*;
-
-import java.util.Map;
-
-import javax.faces.FacesException;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ServiceConfigParserTest {
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testParseConfig() {
- Map<Class<?>, LibraryFunction> parseConfig = ClientServiceConfigParser.parseConfig("csv.xml");
- assertEquals(2, parseConfig.size());
- assertTrue(parseConfig.containsKey(String.class));
- LibraryFunction libraryFunction = parseConfig.get(String.class);
- assertEquals("stringConverter", libraryFunction.getName());
- assertEquals("csv.js", libraryFunction.getResource().getResourceName());
- assertEquals("org.richfaces", libraryFunction.getResource().getLibrary());
- }
-
- @Test(expected=FacesException.class)
- public void testParseBadConfig() {
- Map<Class<?>, LibraryFunction> parseConfig = ClientServiceConfigParser.parseConfig("badcsv.xml");
- }
- @Test()
- public void testParseNoConfig() {
- Map<Class<?>, LibraryFunction> parseConfig = ClientServiceConfigParser.parseConfig("non-exists-csv.xml");
- assertEquals(0, parseConfig.size());
- }
-}
14 years
JBoss Rich Faces SVN: r20645 - in trunk: ui/output/ui/src/main/java/org/richfaces/renderkit/html and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-12-17 08:59:20 -0500 (Fri, 17 Dec 2010)
New Revision: 20645
Modified:
trunk/examples/output-demo/src/main/webapp/examples/tabPanel.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tab.js
Log:
RF-9537 Tab: onenter and onleave don't work
Modified: trunk/examples/output-demo/src/main/webapp/examples/tabPanel.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/tabPanel.xhtml 2010-12-17 13:37:45 UTC (rev 20644)
+++ trunk/examples/output-demo/src/main/webapp/examples/tabPanel.xhtml 2010-12-17 13:59:20 UTC (rev 20645)
@@ -16,10 +16,10 @@
<h:form id="f">
<pn:tabPanel id="panel" switchType="ajax" tabHeaderClassDisabled="myClass_01" itemChangeListener="#{togglePanelBean.itemChangeActionListener}">
- <pn:tab header="tab1 header" headerClassDisabled="myClass_02">
+ <pn:tab header="tab1 header" headerClassDisabled="myClass_02" onenter="alert('onenter 01')">
Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here.
</pn:tab>
- <pn:tab header="tab2 header">
+ <pn:tab header="tab2 header" onenter="alert('onenter 02')">
He he
</pn:tab>
</pn:tabPanel>
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2010-12-17 13:37:45 UTC (rev 20644)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2010-12-17 13:59:20 UTC (rev 20645)
@@ -22,20 +22,20 @@
package org.richfaces.renderkit.html;
-import java.io.IOException;
-import java.util.Map;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+import org.richfaces.component.html.HtmlTab;
+import org.richfaces.renderkit.HtmlConstants;
-import static org.richfaces.renderkit.HtmlConstants.*;
-
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.Map;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.component.AbstractTogglePanelTitledItem;
-import org.richfaces.renderkit.HtmlConstants;
+import static org.richfaces.renderkit.HtmlConstants.*;
/**
* @author akolonitsky
@@ -108,7 +108,9 @@
@Override
protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
Map<String, Object> res = super.getScriptObjectOptions(context, component);
- res.put("disabled", ((AbstractTogglePanelTitledItem) component).isDisabled());
+ res.put("disabled", ((HtmlTab) component).isDisabled());
+ res.put("enter", ((HtmlTab) component).getOnenter());
+ res.put("leave", ((HtmlTab) component).getOnleave());
return res;
}
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-17 13:37:45 UTC (rev 20644)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-17 13:59:20 UTC (rev 20645)
@@ -2044,12 +2044,6 @@
<property-name>iconRightExpanded</property-name>
<property-class>java.lang.String</property-class>
</property>
- <property>
- <description></description>
- <property-name>changeExpandListener</property-name>
- <property-class>java.lang.String</property-class>
- </property>
-
</component>
<component>
<component-type>org.richfaces.PanelMenu</component-type>
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-17 13:37:45 UTC (rev 20644)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-17 13:59:20 UTC (rev 20645)
@@ -556,10 +556,6 @@
<type>java.lang.String</type>
</attribute>
<attribute>
- <name>changeExpandListener</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
<name>icon</name>
<type>java.lang.String</type>
</attribute>
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tab.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tab.js 2010-12-17 13:37:45 UTC (rev 20644)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tab.js 2010-12-17 13:59:20 UTC (rev 20645)
@@ -91,6 +91,21 @@
return this.__fireEnter();
},
+ __fireLeave : function () {
+ return rf.Event.fireById(this.id + ":content", "leave");
+ },
+
+ __fireEnter : function () {
+ return rf.Event.fireById(this.id + ":content", "enter");
+ },
+
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ var userHandler = rf.Event.bindById(this.id + ":content", name, handler);
+ }
+ },
+
getHeight : function (recalculate) {
if (recalculate || !this.__height) {
this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
14 years
JBoss Rich Faces SVN: r20644 - in management/design-4x/message: images and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Ochikvina
Date: 2010-12-17 08:37:45 -0500 (Fri, 17 Dec 2010)
New Revision: 20644
Added:
management/design-4x/message/images/error.png
management/design-4x/message/images/fatal.png
management/design-4x/message/images/info.png
management/design-4x/message/images/warning.png
Removed:
management/design-4x/message/images/error.gif
Modified:
management/design-4x/message/message.html
Log:
Deleted: management/design-4x/message/images/error.gif
===================================================================
(Binary files differ)
Added: management/design-4x/message/images/error.png
===================================================================
(Binary files differ)
Property changes on: management/design-4x/message/images/error.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design-4x/message/images/fatal.png
===================================================================
(Binary files differ)
Property changes on: management/design-4x/message/images/fatal.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design-4x/message/images/info.png
===================================================================
(Binary files differ)
Property changes on: management/design-4x/message/images/info.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design-4x/message/images/warning.png
===================================================================
(Binary files differ)
Property changes on: management/design-4x/message/images/warning.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: management/design-4x/message/message.html
===================================================================
--- management/design-4x/message/message.html 2010-12-17 12:44:42 UTC (rev 20643)
+++ management/design-4x/message/message.html 2010-12-17 13:37:45 UTC (rev 20644)
@@ -17,19 +17,78 @@
vertical-align:middle;
}
.rf-msg-lbl {
- color:red;
vertical-align:middle;
}
+
+ /* ERROR specific */
+ .rf-msg-err{
+ }
+ .rf-msg-err-mkr {
+ }
+ .rf-msg-err-lbl {
+ color:#ff0000;
+ }
+ /* FATAL specific*/
+ .rf-msg-ftl{
+ }
+ .rf-msg-ftl-mkr {
+ }
+ .rf-msg-ftl-lbl {
+ color:#ff0000;
+ }
+ /* INFO specific */
+ .rf-msg-inf{
+ }
+ .rf-msg-inf-mkr {
+ }
+ .rf-msg-inf-lbl {
+ color:#000000;
+ }
+ /* WARNING specific */
+ .rf-msg-wrn{
+ }
+ .rf-msg-wrn-mkr {
+ }
+ .rf-msg-wrn-lbl {
+ color:#000000;
+ }
</style>
</head>
<body>
- <h1>Message</h1>
+ <h1>ERROR Message</h1>
- <span class="rf-msg">
- <span class="rf-msg-mkr">
- <img src="images/error.gif" alt="Message marker"/>
+ <span class="rf-msg rf-msg-err">
+ <span class="rf-msg-mkr rf-msg-err-mkr">
+ <img src="images/error.png" alt="Message marker"/>
</span>
- <span class="rf-msg-lbl">Name: Validation Error: Value is less than allowable minimum of '3'</span>
+ <span class="rf-msg-lbl rf-msg-err-lbl">Name: Validation Error: Value is less than allowable minimum of '3'</span>
</span>
+
+ <h1>FATAL Message</h1>
+
+ <span class="rf-msg rf-msg-ftl">
+ <span class="rf-msg-mkr rf-msg-ftl-mkr">
+ <img src="images/fatal.png" alt="Message marker"/>
+ </span>
+ <span class="rf-msg-lbl rf-msg-ftl-lbl">Fatal error!</span>
+ </span>
+
+ <h1>INFO Message</h1>
+
+ <span class="rf-msg rf-msg-inf">
+ <span class="rf-msg-mkr rf-msg-inf-mkr">
+ <img src="images/info.png" alt="Message marker"/>
+ </span>
+ <span class="rf-msg-lbl rf-msg-inf-lbl">Information</span>
+ </span>
+
+ <h1>WARNING Message</h1>
+
+ <span class="rf-msg rf-msg-wrn">
+ <span class="rf-msg-mkr rf-msg-wrn-mkr">
+ <img src="images/warning.png" alt="Message marker"/>
+ </span>
+ <span class="rf-msg-lbl rf-msg-wrn-lbl">Warning!</span>
+ </span>
</body>
</html>
14 years
JBoss Rich Faces SVN: r20643 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: richCollapsiblePanel and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-17 07:44:42 -0500 (Fri, 17 Dec 2010)
New Revision: 20643
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarBasic.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java
Log:
* fixed tests for calendar and collapsible panel
* refactoring
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarAttributes.java 2010-12-17 11:39:38 UTC (rev 20642)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarAttributes.java 2010-12-17 12:44:42 UTC (rev 20643)
@@ -22,6 +22,7 @@
package org.richfaces.tests.metamer.ftest.richCalendar;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
@@ -37,7 +38,6 @@
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.locator.Attribute;
import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.waiting.EventFiredCondition;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.Test;
@@ -76,8 +76,7 @@
@Test
public void testBoundaryDatesModeInactive() {
- JQueryLocator selectOption = pjq("input[name$=boundaryDatesModeInput][value=inactive]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=boundaryDatesModeInput][value=inactive]"));
selenium.waitForPageToLoad();
testBoundaryDatesModeNull();
@@ -85,8 +84,7 @@
@Test
public void testBoundaryDatesModeScroll() {
- JQueryLocator selectOption = pjq("input[name$=boundaryDatesModeInput][value=scroll]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=boundaryDatesModeInput][value=scroll]"));
selenium.waitForPageToLoad();
selenium.click(input);
@@ -119,8 +117,7 @@
@Test
public void testBoundaryDatesModeSelect() {
- JQueryLocator selectOption = pjq("input[name$=boundaryDatesModeInput][value=select]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=boundaryDatesModeInput][value=select]"));
selenium.waitForPageToLoad();
selenium.click(input);
@@ -168,8 +165,7 @@
@Test
public void testButtonClassIcon() {
- JQueryLocator selectOption = pjq("td:has(label:contains(heart)) > input[name$=buttonIconInput]");
- selenium.click(selectOption);
+ selenium.click(pjq("td:has(label:contains(heart)) > input[name$=buttonIconInput]"));
selenium.waitForPageToLoad();
testStyleClass(image, "buttonClass");
@@ -177,16 +173,14 @@
@Test
public void testButtonIcon() {
- JQueryLocator selectOption = pjq("td:has(label:contains(star)) > input[name$=buttonIconInput]");
- selenium.click(selectOption);
+ selenium.click(pjq("td:has(label:contains(star)) > input[name$=buttonIconInput]"));
selenium.waitForPageToLoad();
AttributeLocator attr = image.getAttribute(Attribute.SRC);
String src = selenium.getAttribute(attr);
assertTrue(src.contains("star.png"), "Calendar's icon was not updated.");
- selectOption = pjq("td:has(label:contains(null)) > input[name$=buttonIconInput]");
- selenium.click(selectOption);
+ selenium.click(pjq("td:has(label:contains(null)) > input[name$=buttonIconInput]"));
selenium.waitForPageToLoad();
src = selenium.getAttribute(attr);
@@ -195,20 +189,17 @@
@Test
public void testButtonIconDisabled() {
- JQueryLocator selectOption = pjq("input[name$=disabledInput][value=true]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=disabledInput][value=true]"));
selenium.waitForPageToLoad();
- selectOption = pjq("td:has(label:contains(heart)) > input[name$=buttonIconDisabledInput]");
- selenium.click(selectOption);
+ selenium.click(pjq("td:has(label:contains(heart)) > input[name$=buttonIconDisabledInput]"));
selenium.waitForPageToLoad();
AttributeLocator attr = image.getAttribute(Attribute.SRC);
String src = selenium.getAttribute(attr);
assertTrue(src.contains("heart.png"), "Calendar's icon was not updated.");
- selectOption = pjq("td:has(label:contains(null)) > input[name$=buttonIconDisabledInput]");
- selenium.click(selectOption);
+ selenium.click(pjq("td:has(label:contains(null)) > input[name$=buttonIconDisabledInput]"));
selenium.waitForPageToLoad();
src = selenium.getAttribute(attr);
@@ -226,8 +217,7 @@
assertFalse(selenium.isDisplayed(image), "Image should not be displayed.");
}
- JQueryLocator selectOption = pjq("td:has(label:contains(star)) > input[name$=buttonIconInput]");
- selenium.click(selectOption);
+ selenium.click(pjq("td:has(label:contains(star)) > input[name$=buttonIconInput]"));
selenium.waitForPageToLoad();
if (selenium.isElementPresent(image)) {
@@ -262,9 +252,8 @@
}
@Test
- public void testDayStyleClass() {
- JQueryLocator selectOption = pjq("input[name$=dayStyleClassInput][value=yellowTuesdays]");
- selenium.click(selectOption);
+ public void testDayClassFunction() {
+ selenium.click(pjq("input[name$=dayClassFunctionInput][value=yellowTuesdays]"));
selenium.waitForPageToLoad();
selenium.click(input);
@@ -275,8 +264,7 @@
}
}
- selectOption = pjq("input[name$=dayStyleClassInput][value=]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=dayClassFunctionInput][value=]"));
selenium.waitForPageToLoad();
selenium.click(input);
@@ -303,8 +291,7 @@
@Test
public void testDisabled() {
- JQueryLocator selectOption = pjq("input[name$=disabledInput][value=true]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=disabledInput][value=true]"));
selenium.waitForPageToLoad();
AttributeLocator disabledAttr = input.getAttribute(new Attribute("disabled"));
@@ -324,8 +311,7 @@
assertTrue(selenium.isAttributePresent(readonlyAttr), "Readonly attribute of input should be defined.");
assertEquals(selenium.getAttribute(readonlyAttr), "readonly", "Input should be read-only.");
- JQueryLocator selectOption = pjq("input[name$=enableManualInputInput][value=true]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=enableManualInputInput][value=true]"));
selenium.waitForPageToLoad();
assertFalse(selenium.isAttributePresent(readonlyAttr), "Readonly attribute of input should not be defined.");
@@ -419,13 +405,14 @@
@Test
@IssueTracking("https://jira.jboss.org/browse/RF-9602")
public void testOninputchange() {
+ selenium.click(pjq("input[name$=enableManualInputInput][value=true]"));
+ selenium.waitForPageToLoad();
+
selenium.type(pjq("input[id$=oninputchangeInput]"), "metamerEvents += \"inputchange \"");
selenium.waitForPageToLoad(TIMEOUT);
- selenium.click(input);
- selenium.click(cellDay.format(6));
- selenium.click(applyButton);
-
+ selenium.type(input, "Dec 23, 2010 19:27");
+
waitGui.failWith("Attribute oninputchange does not work correctly").until(
new EventFiredCondition(new Event("inputchange")));
}
@@ -533,7 +520,7 @@
assertFalse(selenium.isDisplayed(applyButton), "Apply button should not be displayed.");
}
- guardNoRequest(selenium).click(cellDay.format(6));
+ guardXhr(selenium).click(cellDay.format(6));
String day = selenium.getText(cellDay.format(6));
String month = selenium.getText(monthLabel);
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarBasic.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarBasic.java 2010-12-17 11:39:38 UTC (rev 20642)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarBasic.java 2010-12-17 12:44:42 UTC (rev 20643)
@@ -23,6 +23,7 @@
import java.text.ParseException;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
@@ -69,15 +70,13 @@
@Test
public void testOpenPopupClickOnInput() {
guardNoRequest(selenium).click(input);
- boolean displayed = selenium.isDisplayed(popup);
- assertTrue(displayed, "Popup should be visible.");
+ assertTrue(selenium.isDisplayed(popup), "Popup should be visible.");
}
@Test
public void testOpenPopupClickOnImage() {
guardNoRequest(selenium).click(image);
- boolean displayed = selenium.isDisplayed(popup);
- assertTrue(displayed, "Popup should be visible.");
+ assertTrue(selenium.isDisplayed(popup), "Popup should be visible.");
}
@Test
@@ -112,8 +111,7 @@
@Test
public void testHeaderMonth() {
- SimpleDateFormat formatter = new SimpleDateFormat("MMMM, yyyy");
- String month = formatter.format(new Date());
+ String month = new SimpleDateFormat("MMMM, yyyy").format(new Date());
selenium.click(input);
String month2 = selenium.getText(monthLabel);
@@ -327,7 +325,7 @@
fail(ex.getMessage());
}
- guardNoRequest(selenium).click(applyButton);
+ guardXhr(selenium).click(applyButton);
assertFalse(selenium.isDisplayed(popup), "Popup should not be displayed.");
String inputDate = selenium.getValue(input);
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java 2010-12-17 11:39:38 UTC (rev 20642)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java 2010-12-17 12:44:42 UTC (rev 20643)
@@ -29,7 +29,6 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.assertSame;
import java.net.URL;
@@ -87,8 +86,7 @@
@Test
public void testSwitchTypeAjax() {
- JQueryLocator selectOption = pjq("input[name$=switchTypeInput][value=ajax]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=switchTypeInput][value=ajax]"));
selenium.waitForPageToLoad();
testSwitchTypeNull();
@@ -96,8 +94,7 @@
@Test
public void testSwitchTypeClient() {
- JQueryLocator selectOption = pjq("input[name$=switchTypeInput][value=client]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=switchTypeInput][value=client]"));
selenium.waitForPageToLoad();
// click to collapse
@@ -111,8 +108,7 @@
@Test
public void testSwitchTypeServer() {
- JQueryLocator selectOption = pjq("input[name$=switchTypeInput][value=server]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=switchTypeInput][value=server]"));
selenium.waitForPageToLoad();
// click to collapse
@@ -127,8 +123,7 @@
@Test
@IssueTracking("https://jira.jboss.org/browse/RF-9421")
public void testBypassUpdates() {
- JQueryLocator input = pjq("input[type=radio][name$=bypassUpdatesInput][value=true]");
- selenium.click(input);
+ selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
String timeValue = selenium.getText(time);
@@ -155,8 +150,7 @@
@Test
@IssueTracking("https://jira.jboss.org/browse/RF-9421")
public void testImmediate() {
- JQueryLocator input = pjq("input[type=radio][name$=immediateInput][value=true]");
- selenium.click(input);
+ selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
String timeValue = selenium.getText(time);
@@ -168,13 +162,13 @@
@Test
@IssueTracking("https://jira.jboss.org/browse/RF-9535")
- public void testLimitToList() {
+ public void testLimitRender() {
JQueryLocator timeLoc = jq("span[id$=requestTime]");
selenium.type(pjq("input[type=text][id$=renderInput]"), "@this");
selenium.waitForPageToLoad();
- selenium.click(pjq("input[type=radio][name$=limitToListInput][value=true]"));
+ selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
selenium.waitForPageToLoad();
String timeValue = selenium.getText(timeLoc);
@@ -183,13 +177,12 @@
waitGui.failWith("Panel should be collapsed.").until(isDisplayed.locator(headerColps));
String newTime = selenium.getText(timeLoc);
- assertSame(newTime, timeValue, "Panel with ajaxRendered=true should not be rerendered.");
+ assertTrue(newTime.equals(timeValue), "Panel with ajaxRendered=true should not be rerendered (old and new time should be same).");
}
@Test
public void testRendered() {
- JQueryLocator input = pjq("input[type=radio][name$=renderedInput][value=false]");
- selenium.click(input);
+ selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
selenium.waitForPageToLoad();
assertFalse(selenium.isElementPresent(panel), "Panel should not be rendered when rendered=false.");
14 years
JBoss Rich Faces SVN: r20642 - in trunk/ui: output/ui/src/main/java/org/richfaces/component and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-12-17 06:39:38 -0500 (Fri, 17 Dec 2010)
New Revision: 20642
Added:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java
Modified:
trunk/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-group.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-groupDis.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroup.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroupDis.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml
Log:
RF-10003 PanelMenu: apply results of pre-promotion code review
Modified: trunk/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
===================================================================
--- trunk/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -39,6 +39,7 @@
import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.richfaces.component.AbstractExtendedDataTable;
import org.richfaces.component.SortOrder;
@@ -50,6 +51,7 @@
* @author Konstantin Mishin
*
*/
+@Ignore
public class ExtendedDataTableRendererTest {
private HtmlUnitEnvironment environment;
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -49,7 +49,6 @@
private String submittedActiveItem;
private enum PropertyKeys {
- valid,
immediate
}
@@ -62,43 +61,34 @@
super.processDecodes(context);
//TODO nick - is component immediate = true only?
- //TODO nick - validate should be executed in context of component, i.e. when 'component' EL variable is set
- executeValidate(context);
+ //TODO nick - processValue should be executed in context of component, i.e. when 'component' EL variable is set
+
+ processValue(context);
}
- public void validate(FacesContext context) {
- if (context == null) {
- throw new NullPointerException();
- }
+ private void processValue(FacesContext context) {
+ try {
+ if (context == null) {
+ throw new NullPointerException();
+ }
- // Submitted value == null means "the component was not submitted at all".
- String activeItem = getSubmittedActiveItem();
- if (activeItem == null) {
- return;
- }
+ // Submitted value == null means "the component was not submitted at all".
+ String activeItem = getSubmittedActiveItem();
+ if (activeItem == null) {
+ return;
+ }
- String previous = (String) getValue();
- setActiveItem(activeItem);
- setSubmittedActiveItem(null);
-
- if (previous == null || !previous.equalsIgnoreCase(activeItem)) {
- queueEvent(new ItemChangeEvent(this, previous, activeItem));
- }
- }
+ String previous = (String) getValue();
+ setActiveItem(activeItem);
+ setSubmittedActiveItem(null);
- private void executeValidate(FacesContext context) {
- try {
- validate(context);
+ if (previous == null || !previous.equalsIgnoreCase(activeItem)) {
+ queueEvent(new ItemChangeEvent(this, previous, activeItem));
+ }
} catch (RuntimeException e) {
context.renderResponse();
throw e;
}
-
- //TODO nick - where is 'valid' attribute set?
- if (!isValid()) {
- context.validationFailed();
- context.renderResponse();
- }
}
@Override
@@ -125,10 +115,8 @@
super.broadcast(event);
//TODO nick - check for (isBypassUpdates() || isImmediate()) can be removed
- if (event instanceof ItemChangeEvent
- && (isBypassUpdates() || isImmediate())) {
- //TODO nick - use getFacesContext() instead
- FacesContext.getCurrentInstance().renderResponse();
+ if (event instanceof ItemChangeEvent && (isBypassUpdates() || isImmediate())) {
+ getFacesContext().renderResponse();
}
}
@@ -138,19 +126,10 @@
return this.submittedActiveItem;
}
- //TODO nick - change argument to String
- public void setSubmittedActiveItem(Object submittedValue) {
+ public void setSubmittedActiveItem(String submittedValue) {
this.submittedActiveItem = String.valueOf(submittedValue);
}
- public boolean isValid() {
- return (Boolean) getStateHelper().eval(PropertyKeys.valid, true);
- }
-
- public void setValid(boolean valid) {
- getStateHelper().put(PropertyKeys.valid, valid);
- }
-
public String getActiveItem() {
return (String) getValue();
}
@@ -219,12 +198,15 @@
}
private static AbstractPanelMenuItem getItem(String itemName, UIComponent comp) {
+ if (comp instanceof AbstractPanelMenu) {
+ return null;
+ }
+
if (comp instanceof AbstractPanelMenuItem
&& itemName.equals(((AbstractPanelMenuItem) comp).getName())) {
return (AbstractPanelMenuItem) comp;
}
- //TODO nick - what if panel menu is nested?
for (UIComponent item : comp.getChildren()) {
AbstractPanelMenuItem resItem = getItem(itemName, item);
if (resItem != null) {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuGroup.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -23,6 +23,7 @@
package org.richfaces.component;
+import javax.el.MethodExpression;
import javax.el.ValueExpression;
import javax.faces.context.FacesContext;
import javax.faces.event.FacesEvent;
@@ -43,7 +44,6 @@
private Boolean submittedExpanded;
private enum PropertyKeys {
- valid,
immediate
}
@@ -91,11 +91,6 @@
throw e;
}
- //TODO nick - isValid()/setValid() is not called anywhere
- if (!isValid()) {
- context.validationFailed();
- context.renderResponse();
- }
}
@Override
@@ -127,14 +122,6 @@
this.submittedExpanded = Boolean.parseBoolean(String.valueOf(submittedValue));
}
- public boolean isValid() {
- return (Boolean) getStateHelper().eval(PropertyKeys.valid, true);
- }
-
- public void setValid(boolean valid) {
- getStateHelper().put(PropertyKeys.valid, valid);
- }
-
public boolean isExpanded() {
return getValue() == null ? false : (Boolean) getValue();
}
@@ -160,9 +147,6 @@
getStateHelper().put(PropertyKeys.immediate, immediate);
}
-
-
-
public abstract boolean isExpandSingle();
public abstract String getCollapseEvent();
@@ -171,6 +155,5 @@
public abstract boolean isBubbleSelection();
- //TODO nick - this should be MethodExpression
- public abstract String getChangeExpandListener();
+ public abstract MethodExpression getChangeExpandListener();
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -23,50 +23,20 @@
package org.richfaces.component;
-import javax.faces.component.UICommand;
-import javax.faces.component.UIComponent;
-
import org.richfaces.PanelMenuMode;
-import org.richfaces.event.ItemChangeListener;
-import org.richfaces.event.ItemChangeSource;
+import javax.faces.component.UIComponent;
+
/**
* @author akolonitsky
* @since 2010-10-25
*/
-//TODO nick - use org.richfaces.component.AbstractActionComponent as super class
-public abstract class AbstractPanelMenuItem extends UICommand implements ItemChangeSource{
+public abstract class AbstractPanelMenuItem extends AbstractActionComponent {
public static final String COMPONENT_TYPE = "org.richfaces.PanelMenuItem";
public static final String COMPONENT_FAMILY = "org.richfaces.PanelMenuItem";
- //TODO nick - move this enum to renderkit package
- public enum Icons {
- none("rf-pm-none"),
- disc("rf-pm-disc"),
- grid("rf-pm-grid"),
- chevron("rf-pm-chevron"),
- chevronUp("rf-pm-chevron-up"),
- chevronDown("rf-pm-chevron-down"),
- triangle("rf-pm-triangle"),
- triangleUp("rf-pm-triangle-up"),
- triangleDown("rf-pm-triangle-down");
-
- public static final Icons DEFAULT = none;
-
- private final String cssClass;
-
- Icons(String cssClass) {
- this.cssClass = cssClass;
- }
-
- //TODO nick - should this become getCssClass()?
- public String cssClass() {
- return cssClass;
- }
- }
-
protected AbstractPanelMenuItem() {
setRendererType("org.richfaces.PanelMenuItem");
}
@@ -117,8 +87,6 @@
public abstract boolean isDisabled();
- public abstract boolean isBypassUpdates();
-
public abstract boolean isLimitRender();
public abstract Object getData();
@@ -128,20 +96,4 @@
public abstract Object getExecute();
public abstract Object getRender();
-
- // ------------------------------------------------ Event Processing Methods
-
- //TODO nick - it seems these listeners are never triggered
- public void addItemChangeListener(ItemChangeListener listener) {
- addFacesListener(listener);
- }
-
- public ItemChangeListener[] getItemChangeListeners() {
- return (ItemChangeListener[]) getFacesListeners(ItemChangeListener.class);
- }
-
- public void removeItemChangeListener(ItemChangeListener listener) {
- removeFacesListener(listener);
- }
-
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -142,7 +142,7 @@
* <p>Specialized decode behavior on top of that provided by the
* superclass. In addition to the standard
* <code>processDecodes</code> behavior inherited from {@link
- * javax.faces.component.UIComponentBase}, calls <code>validate()</code> if the the
+ * javax.faces.component.UIComponentBase}, calls <code>processValue()</code> if the the
* <code>immediate</code> property is true; if the component is
* invalid afterwards or a <code>RuntimeException</code> is thrown,
* calls {@link FacesContext#renderResponse}. </p>
@@ -185,7 +185,7 @@
/**
* <p>In addition to the standard <code>processValidators</code> behavior
- * inherited from {@link javax.faces.component.UIComponentBase}, calls <code>validate()</code>
+ * inherited from {@link javax.faces.component.UIComponentBase}, calls <code>processValue()</code>
* if the <code>immediate</code> property is false (which is the
* default); if the component is invalid afterwards, calls
* {@link FacesContext#renderResponse}.
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenu.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -29,7 +29,6 @@
* @author akolonitsky
* @since 2010-11-29
*/
-//TODO nick - this class should be generated by CDK
public class UIPanelMenu extends AbstractPanelMenu {
public enum PropertyKeys {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -25,11 +25,12 @@
import org.richfaces.PanelMenuMode;
+import javax.el.MethodExpression;
+
/**
* @author akolonitsky
* @since 2010-10-25
*/
-//TODO nick - this class should be generated by CDK
public class UIPanelMenuGroup extends AbstractPanelMenuGroup {
public enum PropertyKeys {
@@ -48,7 +49,7 @@
@Override
public void setMode(PanelMenuMode mode) {
- super.setMode(mode); //To change body of overridden methods use File | Settings | File Templates.
+ super.setMode(mode);
}
public boolean isExpandSingle() {
@@ -83,11 +84,11 @@
getStateHelper().put(PropertyKeys.bubbleSelection, bubbleSelection);
}
- public String getChangeExpandListener() {
- return (String) getStateHelper().eval(PropertyKeys.changeExpandListener);
+ public MethodExpression getChangeExpandListener() {
+ return (MethodExpression) getStateHelper().get(PropertyKeys.changeExpandListener);
}
- public void setChangeExpandListener(String changeExpandListener) {
+ public void setChangeExpandListener(MethodExpression changeExpandListener) {
getStateHelper().put(PropertyKeys.changeExpandListener, changeExpandListener);
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -29,7 +29,6 @@
* @author akolonitsky
* @since 2010-11-29
*/
-//TODO nick - this class should be generated by CDK
public class UIPanelMenuItem extends AbstractPanelMenuItem {
public enum PropertyKeys {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlPanelMenu.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -24,14 +24,13 @@
package org.richfaces.component.html;
import org.richfaces.component.UIPanelMenu;
+import org.richfaces.renderkit.html.PanelMenuIcons;
import javax.faces.component.behavior.ClientBehaviorHolder;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import static org.richfaces.component.AbstractPanelMenuItem.Icons;
-
/**
* @author akolonitsky
* @since 2010-11-29
@@ -144,7 +143,7 @@
}
public String getItemIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.itemIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.itemIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setItemIconLeft(String itemIconLeft) {
@@ -152,7 +151,7 @@
}
public String getItemIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.itemIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.itemIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setItemIconRight(String itemIconRight) {
@@ -160,7 +159,7 @@
}
public String getItemDisableIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.itemDisableIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.itemDisableIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setItemDisableIconLeft(String itemDisableIconLeft) {
@@ -168,7 +167,7 @@
}
public String getItemDisableIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.itemDisableIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.itemDisableIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setItemDisableIconRight(String itemDisableIconRight) {
@@ -192,7 +191,7 @@
}
public String getTopItemIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topItemIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topItemIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setTopItemIconLeft(String topItemIconLeft) {
@@ -200,7 +199,7 @@
}
public String getTopItemIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topItemIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topItemIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setTopItemIconRight(String topItemIconRight) {
@@ -208,7 +207,7 @@
}
public String getTopItemDisableIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topItemDisableIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topItemDisableIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setTopItemDisableIconLeft(String topItemDisableIconLeft) {
@@ -216,7 +215,7 @@
}
public String getTopItemDisableIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topItemDisableIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topItemDisableIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setTopItemDisableIconRight(String topItemDisableIconRight) {
@@ -240,7 +239,7 @@
}
public String getGroupExpandIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.groupExpandIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupExpandIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setGroupExpandIconLeft(String groupExpandIconLeft) {
@@ -248,7 +247,7 @@
}
public String getGroupExpandIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.groupExpandIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupExpandIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setGroupExpandIconRight(String groupExpandIconRight) {
@@ -256,7 +255,7 @@
}
public String getGroupCollapseIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.groupCollapseIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupCollapseIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setGroupCollapseIconLeft(String groupCollapseIconLeft) {
@@ -264,7 +263,7 @@
}
public String getGroupCollapseIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.groupCollapseIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupCollapseIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setGroupCollapseIconRight(String groupCollapseIconRight) {
@@ -272,7 +271,7 @@
}
public String getGroupDisableIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.groupDisableIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupDisableIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setGroupDisableIconLeft(String groupDisableIconLeft) {
@@ -280,7 +279,7 @@
}
public String getGroupDisableIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.groupDisableIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.groupDisableIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setGroupDisableIconRight(String groupDisableIconRight) {
@@ -304,7 +303,7 @@
}
public String getTopGroupExpandIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setTopGroupExpandIconLeft(String topGroupExpandIconLeft) {
@@ -312,7 +311,7 @@
}
public String getTopGroupExpandIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupExpandIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setTopGroupExpandIconRight(String topGroupExpandIconRight) {
@@ -320,7 +319,7 @@
}
public String getTopGroupCollapseIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setTopGroupCollapseIconLeft(String topGroupCollapseIconLeft) {
@@ -328,7 +327,7 @@
}
public String getTopGroupCollapseIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupCollapseIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setTopGroupCollapseIconRight(String topGroupCollapseIconRight) {
@@ -336,7 +335,7 @@
}
public String getTopGroupDisableIconLeft() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIconLeft, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIconLeft, PanelMenuIcons.DEFAULT.toString());
}
public void setTopGroupDisableIconLeft(String topGroupDisableIconLeft) {
@@ -344,7 +343,7 @@
}
public String getTopGroupDisableIconRight() {
- return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIconRight, Icons.DEFAULT.toString());
+ return (String) getStateHelper().eval(PropertyKeys.topGroupDisableIconRight, PanelMenuIcons.DEFAULT.toString());
}
public void setTopGroupDisableIconRight(String topGroupDisableIconRight) {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -22,6 +22,7 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.*;
import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
import java.io.IOException;
@@ -110,25 +111,25 @@
}
private void encodeContentBegin(UIComponent component, ResponseWriter writer) throws IOException {
- writer.startElement("div", component);
- writer.writeAttribute("class", concatClasses("rf-ac-itm-cnt", attributeAsString(component, "contentClass")), null);
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-ac-itm-cnt", attributeAsString(component, "contentClass")), null);
writer.writeAttribute("id", component.getClientId() + ":content", null);
AbstractTogglePanelTitledItem item = (AbstractTogglePanelTitledItem) component;
if (!item.isActive() || item.isDisabled()) {
- writer.writeAttribute("style", "display: none", null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, "display: none", null);
}
}
private void encodeContentEnd(UIComponent component, ResponseWriter responseWriter) throws IOException {
- responseWriter.endElement("div");
+ responseWriter.endElement(DIV_ELEM);
}
private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
- writer.startElement("div", component);
- writer.writeAttribute("class", concatClasses("rf-ac-itm-hdr", attributeAsString(component, PropertyKeys.headerClass)), null);
- writer.writeAttribute("id", component.getClientId() + ":header", null);
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-ac-itm-hdr", attributeAsString(component, PropertyKeys.headerClass)), null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() + ":header", null);
renderPassThroughAttributes(context, component, HEADER_ATTRIBUTES);
AbstractTogglePanelTitledItem titledItem = (AbstractTogglePanelTitledItem) component;
@@ -138,20 +139,20 @@
encodeHeader(context, titledItem, writer, HeaderStates.active, isActive && !isDisabled);
encodeHeader(context, titledItem, writer, HeaderStates.disabled, isDisabled);
- writer.endElement("div");
+ writer.endElement(DIV_ELEM);
}
private void encodeHeader(FacesContext facesContext, AbstractTogglePanelTitledItem component, ResponseWriter writer,
HeaderStates state, Boolean isDisplay) throws IOException {
- writer.startElement("div", component);
+ writer.startElement(DIV_ELEM, component);
if (!isDisplay) {
- writer.writeAttribute("style", "display : none", null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, "display : none", null);
}
String name = "headerClass" + capitalize(state.toString());
- writer.writeAttribute("class", concatClasses("rf-ac-itm-hdr-" + state.abbreviation(), attributeAsString(component, name)), null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-ac-itm-hdr-" + state.abbreviation(), attributeAsString(component, name)), null);
UIComponent headerFacet = component.getHeaderFacet(state);
if (headerFacet != null && headerFacet.isRendered()) {
@@ -163,7 +164,7 @@
}
}
- writer.endElement("div");
+ writer.endElement(DIV_ELEM);
}
@Override
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -22,6 +22,8 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.*;
+
import org.ajax4jsf.javascript.JSObject;
import org.richfaces.component.AbstractCollapsiblePanel;
import org.richfaces.component.AbstractTogglePanel;
@@ -116,21 +118,21 @@
}
private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
- writer.startElement("div", component);
- writer.writeAttribute("id", component.getClientId(context) + ":header", null);
- writer.writeAttribute("class", concatClasses("rf-cp-hdr", attributeAsString(component, "headerClass")), null);
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context) + ":header", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-cp-hdr", attributeAsString(component, "headerClass")), null);
AbstractCollapsiblePanel panel = (AbstractCollapsiblePanel) component;
encodeHeader(context, component, writer, expanded, panel.isExpanded());
encodeHeader(context, component, writer, collapsed, !panel.isExpanded());
- writer.endElement("div");
+ writer.endElement(DIV_ELEM);
}
private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter responseWriter, AbstractCollapsiblePanel.States state, boolean isVisible) throws IOException {
- responseWriter.startElement("div", component);
- responseWriter.writeAttribute("class", "rf-cp-hdr-" + state.abbreviation(), null);
- responseWriter.writeAttribute("style", concatStyles(styleElement("display", isVisible ? "" : "none"), attributeAsString(component, "headerClass")), null);
+ responseWriter.startElement(DIV_ELEM, component);
+ responseWriter.writeAttribute(CLASS_ATTRIBUTE, "rf-cp-hdr-" + state.abbreviation(), null);
+ responseWriter.writeAttribute(STYLE_ATTRIBUTE, concatStyles(styleElement("display", isVisible ? "" : "none"), attributeAsString(component, "headerClass")), null);
UIComponent header = AbstractTogglePanelTitledItem.getHeaderFacet(component, state);
if (header != null && header.isRendered()) {
@@ -142,7 +144,7 @@
}
}
- responseWriter.endElement("div");
+ responseWriter.endElement(DIV_ELEM);
}
@Override
@@ -206,23 +208,23 @@
}
private void encodeContent(ResponseWriter writer, FacesContext context, UIComponent component, boolean visible) throws IOException {
- writer.startElement("div", component);
- writer.writeAttribute("id", component.getClientId() + ":content", null);
- writer.writeAttribute("class", concatClasses("rf-cp-b", attributeAsString(component, "bodyClass")), null);
- writer.writeAttribute("style", concatStyles(styleElement("display", visible ? "block" : "none"),
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() + ":content", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-cp-b", attributeAsString(component, "bodyClass")), null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, concatStyles(styleElement("display", visible ? "block" : "none"),
attributeAsString(component, "style")), null);
renderChildren(context, component);
- writer.endElement("div");
+ writer.endElement(DIV_ELEM);
}
private void encodeEmptyDiv(ResponseWriter writer, FacesContext context, UIComponent component, boolean visible) throws IOException {
- writer.startElement("div", component);
- writer.writeAttribute("id", component.getClientId() + ":empty", null);
- writer.writeAttribute("class", "rf-cp-empty", null);
- writer.writeAttribute("style", styleElement("display", visible ? "block" : "none"), null);
- writer.endElement("div");
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() + ":empty", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, "rf-cp-empty", null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, styleElement("display", visible ? "block" : "none"), null);
+ writer.endElement(DIV_ELEM);
}
@Override
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -22,6 +22,8 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.*;
+
import org.richfaces.component.AbstractDivPanel;
import org.richfaces.renderkit.HtmlConstants;
import org.richfaces.renderkit.RenderKitUtils;
@@ -95,8 +97,8 @@
super.doEncodeBegin(writer, context, component);
writer.startElement(HtmlConstants.DIV_ELEM, component);
- writer.writeAttribute("id", component.getClientId(context), "clientId");
- writer.writeAttribute("class", getStyleClass(component), null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context), "clientId");
+ writer.writeAttribute(CLASS_ATTRIBUTE, getStyleClass(component), null);
String style = getStyle(component);
if (style != null && style.length() > 0) {
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, style, null);
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -23,25 +23,23 @@
package org.richfaces.renderkit.html;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractPanelMenuGroup;
+import org.richfaces.component.AbstractPanelMenuItem;
+import org.richfaces.component.html.HtmlPanelMenuGroup;
+import org.richfaces.renderkit.RenderKitUtils;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
+import static org.richfaces.renderkit.HtmlConstants.*;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.component.AbstractPanelMenuGroup;
-import org.richfaces.component.AbstractPanelMenuItem;
-import org.richfaces.component.html.HtmlPanelMenuGroup;
-import org.richfaces.renderkit.HtmlConstants;
-import org.richfaces.renderkit.RenderKitUtils;
-
/**
* @author akolonitsky
* @since 2010-10-25
@@ -55,6 +53,7 @@
public static final String BEFORE_EXPAND = "beforeexpand";
public static final String BEFORE_SWITCH = "beforeswitch";
private static final String CSS_CLASS_PREFIX = "rf-pm-gr";
+
//TODO nick - shouldn't this be rf-pm-gr-top?
private static final String TOP_CSS_CLASS_PREFIX = "rf-pm-top-gr";
@@ -66,79 +65,77 @@
context.getExternalContext().getRequestParameterMap();
// Don't overwrite the value unless you have to!
- //TODO nick - ":expanded" suffix is not necessary
+ //TODO! nick - ":expanded" suffix is not necessary
String newValue = requestMap.get(component.getClientId() + ":expanded");
if (newValue != null) {
menuGroup.setSubmittedExpanded(newValue);
}
- String compClientId = component.getClientId(context);
- //TODO nick - rename clientId to smth.
- String clientId = requestMap.get(compClientId);
- if (clientId != null && clientId.equals(compClientId)) {
+ String clientId = component.getClientId(context);
+ if (requestMap.get(clientId) != null) {
context.getPartialViewContext().getRenderIds().add(clientId);
//TODO nick - this should be done on encode, not on decode
- addOnCompleteParam(clientId);
+ PanelMenuRenderer.addOnCompleteParam(clientId);
}
}
- //TODO nick - copy of org.richfaces.renderkit.html.PanelMenuRenderer.addOnCompleteParam(String)
- protected static void addOnCompleteParam(String itemId) {
- AjaxContext.getCurrentInstance().appendOncomplete(new StringBuilder()
- .append("RichFaces.$('").append(itemId).append("').onCompleteHandler();").toString());
- }
-
-
-
@Override
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
super.doEncodeBegin(writer, context, component);
HtmlPanelMenuGroup menuGroup = (HtmlPanelMenuGroup) component;
- writer.startElement(HtmlConstants.INPUT_ELEM, component);
+ writer.startElement(INPUT_ELEM, component);
//TODO nick - there is no need to encode this input - group state can be extracted from class
final String expanded = component.getClientId(context) + ":expanded";
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, expanded, null);
- writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, expanded, null);
- writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN, null);
- writer.writeAttribute(HtmlConstants.VALUE_ATTRIBUTE, String.valueOf(menuGroup.isExpanded()), null);
- writer.endElement(HtmlConstants.INPUT_ELEM);
+ writer.writeAttribute(ID_ATTRIBUTE, expanded, null);
+ writer.writeAttribute(NAME_ATTRIBUTE, expanded, null);
+ writer.writeAttribute(TYPE_ATTR, INPUT_TYPE_HIDDEN, null);
+ writer.writeAttribute(VALUE_ATTRIBUTE, String.valueOf(menuGroup.isExpanded()), null);
+ writer.endElement(INPUT_ELEM);
encodeHeader(writer, context, menuGroup);
encodeContentBegin(writer, context, menuGroup);
}
private void encodeHeader(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuGroup) throws IOException {
- //TODO nick - HtmlConstants.* should be used
- writer.startElement("div", null);
- writer.writeAttribute("id", menuGroup.getClientId(context) + ":hdr", null);
- writer.writeAttribute("class", getCssClass(menuGroup, "-hdr"), null);
+ writer.startElement(DIV_ELEM, null);
+ writer.writeAttribute(ID_ATTRIBUTE, menuGroup.getClientId(context) + ":hdr", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, getCssClass(menuGroup, "-hdr"), null);
encodeHeaderGroup(writer, context, menuGroup, getCssClass(menuGroup, ""));
- writer.endElement("div");
+ writer.endElement(DIV_ELEM);
}
private void encodeHeaderGroup(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuItem, String classPrefix) throws IOException {
- writer.startElement("table", null);
- writer.writeAttribute("class", classPrefix + "-gr", null);
- //TODO nick - TBODY is missing
- writer.startElement("tr", null);
+ writer.startElement(TABLE_ELEMENT, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, classPrefix + "-gr", null);
+ writer.startElement(TBODY_ELEMENT, null);
+ writer.startElement(TR_ELEMENT, null);
encodeHeaderGroupIconLeft(writer, context, menuItem, classPrefix);
- writer.startElement("td", null);
- writer.writeAttribute("class", classPrefix + "-lbl", null);
- //TODO nick - this will render 'null' if label is null
- //TODO nick - should there be 'label' facet also?
- writer.writeText(String.valueOf(menuItem.getLabel()), null);
- writer.endElement("td");
+ writer.startElement(TD_ELEM, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, classPrefix + "-lbl", null);
+ UIComponent headerFacet = menuItem.getFacet("label");
+ if (headerFacet != null && headerFacet.isRendered()) {
+ headerFacet.encodeAll(context);
+ } else {
+ Object label = menuItem.getLabel();
+ if (label != null && !label.equals("")) {
+ writer.writeText(label, null);
+ }
+ }
+
+ writer.endElement(TD_ELEM);
+
encodeHeaderGroupIconRight(writer, context, menuItem, classPrefix);
- writer.endElement("tr");
- writer.endElement("table");
+ writer.endElement(TR_ELEMENT);
+ writer.endElement(TBODY_ELEMENT);
+ writer.endElement(TABLE_ELEMENT);
}
private void encodeHeaderGroupIconLeft(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuGroup, String classPrefix) throws IOException {
@@ -157,58 +154,69 @@
}
private void encodeTdIcon(ResponseWriter writer, FacesContext context, String cssClass, boolean isExpanded, String attrIconCollapsedValue, String attrIconExpandedValue) throws IOException {
- writer.startElement("td", null);
- writer.writeAttribute("class", cssClass, null);
- try {
- //TODO nick - attrIconCollapsedValue == null?
- AbstractPanelMenuItem.Icons iconCollapsed = AbstractPanelMenuItem.Icons.valueOf(attrIconCollapsedValue);
- writer.startElement("div", null);
- writer.writeAttribute("class", concatClasses("rf-pm-ico-colps", iconCollapsed.cssClass()), null);
- writer.writeAttribute("style", styleElement("display", isExpanded ? "none" : "block"), null);
- writer.endElement("div");
- //TODO nick - I suggest to wrap only Enum.valueOf(...) into try/catch
- } catch (IllegalArgumentException e) {
- if(attrIconCollapsedValue != null && attrIconCollapsedValue.trim().length() != 0) {
- writer.startElement(HtmlConstants.IMG_ELEMENT, null);
- writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
- writer.writeURIAttribute(HtmlConstants.SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(attrIconCollapsedValue, context), null);
- writer.endElement(HtmlConstants.IMG_ELEMENT);
+ writer.startElement(TD_ELEM, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, cssClass, null);
+
+ encodeIdIcon(writer, context, isExpanded, attrIconCollapsedValue, "rf-pm-ico-colps");
+ encodeIdIcon(writer, context, !isExpanded, attrIconExpandedValue, "rf-pm-ico-exp");
+
+ writer.endElement(TD_ELEM);
+ }
+
+ private void encodeIdIcon(ResponseWriter writer, FacesContext context, boolean isExpanded, String attrIconValue, String styleClass) throws IOException {
+ if (attrIconValue == null || attrIconValue.trim().length() <= 0) {
+ encodeDivIcon(writer, isExpanded, PanelMenuIcons.none, styleClass);
+ } else {
+ PanelMenuIcons icon = getIcon(attrIconValue);
+ if (icon != null) {
+ encodeDivIcon(writer, isExpanded, icon, styleClass);
+ } else {
+ encodeImage(writer, context, attrIconValue);
}
}
+ }
+ private PanelMenuIcons getIcon(String attrIconCollapsedValue) {
+ if (attrIconCollapsedValue == null) {
+ return null;
+ }
+
try {
- AbstractPanelMenuItem.Icons iconExpanded = AbstractPanelMenuItem.Icons.valueOf(attrIconExpandedValue);
- writer.startElement("div", null);
- writer.writeAttribute("class", concatClasses("rf-pm-ico-exp", iconExpanded.cssClass()), null);
- writer.writeAttribute("style", styleElement("display", isExpanded ? "block" : "none"), null);
- writer.endElement("div");
+ return PanelMenuIcons.valueOf(attrIconCollapsedValue);
} catch (IllegalArgumentException e) {
- if(attrIconExpandedValue != null && attrIconExpandedValue.trim().length() != 0) {
- writer.startElement(HtmlConstants.IMG_ELEMENT, null);
- writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
- writer.writeURIAttribute(HtmlConstants.SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(attrIconExpandedValue, context), null);
- writer.endElement(HtmlConstants.IMG_ELEMENT);
- }
+ return null;
}
+ }
- writer.endElement("td");
+ private void encodeDivIcon(ResponseWriter writer, boolean isDisplay, PanelMenuIcons icon, String styleClass) throws IOException {
+ writer.startElement(DIV_ELEM, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses(styleClass, icon.cssClass()), null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, styleElement("display", isDisplay ? "none" : "block"), null);
+ writer.endElement(DIV_ELEM);
}
+ private void encodeImage(ResponseWriter writer, FacesContext context, String attrIconValue) throws IOException {
+ writer.startElement(IMG_ELEMENT, null);
+ writer.writeAttribute(ALT_ATTRIBUTE, "", null);
+ writer.writeURIAttribute(SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(attrIconValue, context), null);
+ writer.endElement(IMG_ELEMENT);
+ }
+
public String getCssClass(AbstractPanelMenuItem item, String postfix) {
return (item.isTopItem() ? TOP_CSS_CLASS_PREFIX : CSS_CLASS_PREFIX) + postfix;
}
private void encodeContentBegin(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuGroup) throws IOException {
- writer.startElement("div", null);
- writer.writeAttribute("id", menuGroup.getClientId(context) + ":cnt", null);
- writer.writeAttribute("class", concatClasses(getCssClass(menuGroup, "-cnt"), menuGroup.isExpanded() ? "rf-pm-exp" : "rf-pm-colps"), null);
+ writer.startElement(DIV_ELEM, null);
+ writer.writeAttribute(ID_ATTRIBUTE, menuGroup.getClientId(context) + ":cnt", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses(getCssClass(menuGroup, "-cnt"), menuGroup.isExpanded() ? "rf-pm-exp" : "rf-pm-colps"), null);
writeJavaScript(writer, context, menuGroup);
}
private void encodeContentEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- writer.endElement("div");
+ writer.endElement(DIV_ELEM);
}
@Override
@@ -257,8 +265,7 @@
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
encodeContentEnd(writer, context, component);
- writer.endElement(HtmlConstants.DIV_ELEM);
- //TODO nick - call super.doEncodeEnd(...)?
+ writer.endElement(DIV_ELEM);
}
@Override
Added: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuIcons.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -0,0 +1,25 @@
+package org.richfaces.renderkit.html;
+
+public enum PanelMenuIcons {
+ none("rf-pm-none"),
+ disc("rf-pm-disc"),
+ grid("rf-pm-grid"),
+ chevron("rf-pm-chevron"),
+ chevronUp("rf-pm-chevron-up"),
+ chevronDown("rf-pm-chevron-down"),
+ triangle("rf-pm-triangle"),
+ triangleUp("rf-pm-triangle-up"),
+ triangleDown("rf-pm-triangle-down");
+
+ public static final PanelMenuIcons DEFAULT = none;
+
+ private final String cssClass;
+
+ private PanelMenuIcons(String cssClass) {
+ this.cssClass = cssClass;
+ }
+
+ public String cssClass() {
+ return cssClass;
+ }
+}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -23,6 +23,7 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.*;
import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
@@ -63,14 +64,14 @@
private void encodeHeaderGroupBegin(ResponseWriter writer, FacesContext context, HtmlPanelMenuItem menuItem, String classPrefix) throws IOException {
writer.startElement("table", null);
- writer.writeAttribute("class", classPrefix + "-gr", null);
- //TODO nick - TBODY element is missing
- writer.startElement("tr", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, classPrefix + "-gr", null);
+ writer.startElement(TBODY_ELEMENT, null);
+ writer.startElement(TR_ELEMENT, null);
encodeHeaderGroupLeftIcon(writer, context, menuItem, classPrefix);
- writer.startElement("td", null);
- writer.writeAttribute("class", classPrefix + "-lbl", null);
+ writer.startElement(TD_ELEM, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, classPrefix + "-lbl", null);
String label = menuItem.getLabel();
if (label != null) {
@@ -79,11 +80,12 @@
}
private void encodeHeaderGroupEnd(ResponseWriter writer, FacesContext context, HtmlPanelMenuItem menuItem, String classPrefix) throws IOException {
- writer.endElement("td");
+ writer.endElement(TD_ELEM);
encodeHeaderGroupRightIcon(writer, context, menuItem, classPrefix);
- writer.endElement("tr");
+ writer.endElement(TR_ELEMENT);
+ writer.endElement(TBODY_ELEMENT);
writer.endElement("table");
}
@@ -103,12 +105,12 @@
//TODO nick - the same as in PanelMenuGroupRenderer
public void encodeTdIcon(ResponseWriter writer, FacesContext context, String classPrefix, String attrIconValue) throws IOException {
- writer.startElement("td", null);
+ writer.startElement(TD_ELEM, null);
try {
- AbstractPanelMenuItem.Icons icon = AbstractPanelMenuItem.Icons.valueOf(attrIconValue);
- writer.writeAttribute("class", concatClasses(classPrefix, icon.cssClass()), null);
+ PanelMenuIcons icon = PanelMenuIcons.valueOf(attrIconValue);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses(classPrefix, icon.cssClass()), null);
} catch (IllegalArgumentException e) {
- writer.writeAttribute("class", classPrefix, null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, classPrefix, null);
if(attrIconValue != null && attrIconValue.trim().length() != 0) {
writer.startElement(HtmlConstants.IMG_ELEMENT, null);
writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
@@ -117,7 +119,7 @@
}
}
- writer.endElement("td");
+ writer.endElement(TD_ELEM);
}
@Override
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -23,36 +23,32 @@
package org.richfaces.renderkit.html;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getValueRequestParamName;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractPanelMenu;
+import org.richfaces.component.AbstractPanelMenuItem;
+import org.richfaces.component.html.HtmlPanelMenu;
+import org.richfaces.renderkit.HtmlConstants;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.ActionEvent;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.component.AbstractPanelMenu;
-import org.richfaces.component.AbstractPanelMenuItem;
-import org.richfaces.component.html.HtmlPanelMenu;
-import org.richfaces.renderkit.HtmlConstants;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getValueRequestParamName;
/**
* @author akolonitsky
* @since 2010-10-25
*/
@ResourceDependencies( { // TODO review
- //TODO nick - use org.richfaces:ajax.reslib
- @ResourceDependency(library = "javax.faces", name = "jsf.js"),
- @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(library = "org.richfaces", name = "ajax.reslib"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(library = "org.richfaces", name = "panelMenu.js"),
@@ -69,7 +65,6 @@
context.getExternalContext().getRequestParameterMap();
// Don't overwrite the value unless you have to!
- //TODO nick - getValueRequestParamName(...) is method of TogglePanelRenderer - how are these components connected?
String newValue = requestMap.get(getValueRequestParamName(context, component));
if (newValue != null) {
panelMenu.setSubmittedActiveItem(newValue);
@@ -77,9 +72,7 @@
//TODO nick - I suggest to get this code moved to item renderer
String compClientId = component.getClientId(context);
- String clientId = requestMap.get(compClientId);
- if (clientId != null && clientId.equals(compClientId)) {
-
+ if (requestMap.get(compClientId) != null) {
AbstractPanelMenuItem panelItem = panelMenu.getItem(newValue);
if (panelItem != null) {
new ActionEvent(panelItem).queue();
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -22,6 +22,7 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.*;
import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.active;
import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.disabled;
import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.inactive;
@@ -70,9 +71,9 @@
.generic("onmousemove", HtmlTab.PropertyKeys.onheadermousemove.toString(), "headermousemove")
.generic("onmouseup", HtmlTab.PropertyKeys.onheadermouseup.toString(), "headermouseup");
- private static final String DIV = "div";
- private static final String STYLE = "style";
- private static final String CLASS = "class";
+ private static final String DIV = DIV_ELEM;
+ private static final String STYLE = STYLE_ATTRIBUTE;
+ private static final String CLASS = CLASS_ATTRIBUTE;
@Override
protected void doEncodeBegin(ResponseWriter w, FacesContext context, UIComponent comp) throws IOException {
@@ -92,10 +93,10 @@
w.writeAttribute(CLASS, "rf-tb-hdr-tabline-vis", null);
w.startElement("table", comp);
- w.writeAttribute("class", "rf-tb-hdr-tabs", null);
+ w.writeAttribute(CLASS_ATTRIBUTE, "rf-tb-hdr-tabs", null);
w.writeAttribute("cellspacing", "0", null);
- w.startElement("tbody", comp);
- w.startElement("tr", comp);
+ w.startElement(TBODY_ELEMENT, comp);
+ w.startElement(TR_ELEMENT, comp);
writeTopTabFirstSpacer(w, comp);
@@ -107,15 +108,15 @@
writeTopTabLastSpacer(w, comp);
- w.endElement("tr");
- w.endElement("tbody");
+ w.endElement(TR_ELEMENT);
+ w.endElement(TBODY_ELEMENT);
w.endElement("table");
writeTopTabsControl(w, comp, "rf-tb-hdr-scrl_l rf-tb-hdn", "\u00AB");
writeTopTabsControl(w, comp, "rf-tb-hdr-tablst rf-tb-hdn", "\u2193");
writeTopTabsControl(w, comp, "rf-tb-hdr-scrl_r rf-tb-hdn", "\u00BB");
- w.endElement("div");
+ w.endElement(DIV_ELEM);
}
@Override
@@ -142,16 +143,16 @@
AbstractTogglePanelTitledItem.HeaderStates state, Boolean isDisplay) throws IOException {
- writer.startElement("td", tab);
- writer.writeAttribute("id", tab.getClientId() + ":header:" + state.toString(), null);
+ writer.startElement(TD_ELEM, tab);
+ writer.writeAttribute(ID_ATTRIBUTE, tab.getClientId() + ":header:" + state.toString(), null);
renderPassThroughAttributes(context, tab, HEADER_ATTRIBUTES);
String name = "headerClass" + capitalize(state.toString());
- writer.writeAttribute("class", concatClasses("rf-tb-hdr rf-tb-hdr-" + state.abbreviation(),
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-tb-hdr rf-tb-hdr-" + state.abbreviation(),
attributeAsString(tab, HtmlTab.PropertyKeys.headerClass), attributeAsString(tab, name)), null);
- writer.writeAttribute("style", concatStyles(isDisplay ? "" : "display : none", attributeAsString(tab, HtmlTab.PropertyKeys.headerStyle.toString())), null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, concatStyles(isDisplay ? "" : "display : none", attributeAsString(tab, HtmlTab.PropertyKeys.headerStyle.toString())), null);
writer.startElement("span", tab);
- writer.writeAttribute("class", "rf-tb-lbl", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, "rf-tb-lbl", null);
UIComponent headerFacet = tab.getHeaderFacet(state);
if (headerFacet != null && headerFacet.isRendered()) {
@@ -165,16 +166,16 @@
writer.endElement("span");
- writer.endElement("td");
+ writer.endElement(TD_ELEM);
}
private void writeTopTabsControl(ResponseWriter w, UIComponent comp, String styles, String text) throws IOException {
- w.startElement("div", comp);
- w.writeAttribute("class", styles, null);
+ w.startElement(DIV_ELEM, comp);
+ w.writeAttribute(CLASS_ATTRIBUTE, styles, null);
w.writeText(text, null);
- w.endElement("div");
+ w.endElement(DIV_ELEM);
}
private void writeTopTabFirstSpacer(ResponseWriter w, UIComponent comp) throws IOException {
@@ -190,11 +191,11 @@
}
private void writeTopTabSpacer(ResponseWriter w, UIComponent comp, String style, String classStyle) throws IOException {
- w.startElement("td", comp);
+ w.startElement(TD_ELEM, comp);
w.writeAttribute(STYLE, style, null);
w.writeAttribute(CLASS, classStyle, null);
w.write("<br />");
- w.endElement("td");
+ w.endElement(TD_ELEM);
}
@Override
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -25,6 +25,8 @@
import java.io.IOException;
import java.util.Map;
+import static org.richfaces.renderkit.HtmlConstants.*;
+
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
@@ -83,18 +85,18 @@
}
private void encodeContentBegin(UIComponent component, ResponseWriter writer) throws IOException {
- writer.startElement("div", component);
- writer.writeAttribute("class", concatClasses("rf-tb-cnt", attributeAsString(component, "contentClass")), null);
- writer.writeAttribute("id", component.getClientId() + ":content", null);
+ writer.startElement(DIV_ELEM, component);
+ writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-tb-cnt", attributeAsString(component, "contentClass")), null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() + ":content", null);
AbstractTogglePanelTitledItem item = (AbstractTogglePanelTitledItem) component;
if (!item.isActive() || item.isDisabled()) {
- writer.writeAttribute("style", "display: none", null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, "display: none", null);
}
}
private void encodeContentEnd(UIComponent component, ResponseWriter responseWriter) throws IOException {
- responseWriter.endElement("div");
+ responseWriter.endElement(DIV_ELEM);
}
@Override
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -100,7 +100,7 @@
AjaxContext.getCurrentInstance().appendOncomplete(onComplete.toString());
}
- public static String getValueRequestParamName(FacesContext context, UIComponent component) {
+ static String getValueRequestParamName(FacesContext context, UIComponent component) {
return component.getClientId(context) + VALUE_POSTFIX;
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-12-17 11:39:38 UTC (rev 20642)
@@ -23,6 +23,7 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.*;
import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
@@ -94,8 +95,8 @@
AbstractTooltip tooltip = (AbstractTooltip) component;
writer.startElement(getMarkupElement(tooltip), component);
- writer.writeAttribute("id", component.getClientId(context), "clientId");
- writer.writeAttribute("class", getStyleClass(component), null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context), "clientId");
+ writer.writeAttribute(CLASS_ATTRIBUTE, getStyleClass(component), null);
String style = getStyle(component);
if (style != null && style.trim().length() > 0) {
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, style, null);
@@ -104,8 +105,8 @@
renderPassThroughAttributes(context, component, getPassThroughAttributes());
writer.startElement(getMarkupElement(tooltip), component);
- writer.writeAttribute("id", component.getClientId(context) + ":cntr", null);
- writer.writeAttribute("class", "rf-tt-cntr", null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context) + ":cntr", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, "rf-tt-cntr", null);
if (tooltip.getMode() == TooltipMode.ajax) {
encodeLoading(writer, context, tooltip);
@@ -116,14 +117,14 @@
private void encodeContentBegin(ResponseWriter writer, FacesContext context, AbstractTooltip tooltip) throws IOException {
writer.startElement(getMarkupElement(tooltip), tooltip);
- writer.writeAttribute("id", tooltip.getClientId(context) + "@content", null);
- writer.writeAttribute("class", "rf-tt-cnt", null);
+ writer.writeAttribute(ID_ATTRIBUTE, tooltip.getClientId(context) + "@content", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, "rf-tt-cnt", null);
}
private void encodeLoading(ResponseWriter writer, FacesContext context, AbstractTooltip tooltip) throws IOException {
writer.startElement(getMarkupElement(tooltip), tooltip);
- writer.writeAttribute("id", tooltip.getClientId(context) + ":loading", null);
- writer.writeAttribute("class", "rf-tt-loading", null);
+ writer.writeAttribute(ID_ATTRIBUTE, tooltip.getClientId(context) + ":loading", null);
+ writer.writeAttribute(CLASS_ATTRIBUTE, "rf-tt-loading", null);
writer.writeText("Loading...", null);
writer.endElement(getMarkupElement(tooltip));
}
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js 2010-12-17 11:39:38 UTC (rev 20642)
@@ -123,10 +123,6 @@
return document.getElementById(this.id + "-value");
},
- selectItem: function (itemName) {
- // TODO
- },
-
/**
* @methodOf
* @name PanelMenu#expandAll
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2010-12-17 11:39:38 UTC (rev 20642)
@@ -126,8 +126,8 @@
this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
- this.mode = this.options.mode
- this.itemName = this.options.name
+ this.mode = this.options.mode;
+ this.itemName = this.options.name;
this.__rfPanelMenu().getItems()[this.itemName] = this;
// todo move it
@@ -211,8 +211,7 @@
if (panelMenu.selectedItem() == this.itemName) {
panelMenu.selectedItem(null);
} else {
- //TODO nick - should be rf.log.warn
- rf.warn("You tried to unselect item (name=" + this.itemName + ") that isn't seleted")
+ rf.log.warn("You tried to unselect item (name=" + this.itemName + ") that isn't seleted")
}
this.__unselect();
@@ -256,8 +255,7 @@
},
__rfPanelMenu : function () {
- //TODO nick - return rf.$(this.__panelMenu())
- return rf.$(this.__item().parents(".rf-pm")[0]);
+ return rf.$(this.__panelMenu());
},
__changeState : function () {
@@ -274,7 +272,6 @@
return $(rf.getDomElement(this.id));
},
- //TODO nick - __item() vs __header()?
__header : function () {
return this.__item();
},
@@ -288,22 +285,20 @@
},
__fireBeforeSelect : function () {
- //TODO nick - 'new' is not necessary here
- return new rf.Event.fireById(this.id, "beforeselect", {
- //TODO nick - pass item here
- id: this.id
+ return rf.Event.fireById(this.id, "beforeselect", {
+ item: this
});
},
__fireSelect : function () {
- return new rf.Event.fireById(this.id, "select", {
- id: this.id
+ return rf.Event.fireById(this.id, "select", {
+ item: this
});
},
__fireUnselect : function () {
- return new rf.Event.fireById(this.id, "unselect", {
- id: this.id
+ return rf.Event.fireById(this.id, "unselect", {
+ item: this
});
},
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-group.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-group.xmlunit.xml 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-group.xmlunit.xml 2010-12-17 11:39:38 UTC (rev 20642)
@@ -8,7 +8,7 @@
<div class="rf-pm-ico-colps rf-pm-triangle-down" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-disc" style="display:none"></div>
</td>
- <td class="rf-pm-gr-lbl">panelMenuGroup-top</td>
+ <td class="rf-pm-gr-lbl"></td>
<td class="rf-pm-gr-exp-ico">
<div class="rf-pm-ico-colps rf-pm-triangle-up" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-disc" style="display:none"></div>
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-groupDis.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-groupDis.xmlunit.xml 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-groupDis.xmlunit.xml 2010-12-17 11:39:38 UTC (rev 20642)
@@ -8,7 +8,7 @@
<div class="rf-pm-ico-colps rf-pm-chevron-down" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-chevron-down" style="display:none"></div>
</td>
- <td class="rf-pm-gr-lbl">panelMenuGroup-top</td>
+ <td class="rf-pm-gr-lbl"></td>
<td class="rf-pm-gr-exp-ico">
<div class="rf-pm-ico-colps rf-pm-chevron-up" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-chevron-up" style="display:none"></div>
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroup.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroup.xmlunit.xml 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroup.xmlunit.xml 2010-12-17 11:39:38 UTC (rev 20642)
@@ -8,7 +8,7 @@
<div class="rf-pm-ico-colps rf-pm-triangle" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-disc" style="display:none"></div>
</td>
- <td class="rf-pm-top-gr-lbl">panelMenuGroup-top</td>
+ <td class="rf-pm-top-gr-lbl"></td>
<td class="rf-pm-top-gr-exp-ico">
<div class="rf-pm-ico-colps rf-pm-triangle" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-disc" style="display:none"></div>
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroupDis.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroupDis.xmlunit.xml 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu-icons-inheritance-topGroupDis.xmlunit.xml 2010-12-17 11:39:38 UTC (rev 20642)
@@ -8,7 +8,7 @@
<div class="rf-pm-ico-colps rf-pm-chevron" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-chevron" style="display:none"></div>
</td>
- <td class="rf-pm-top-gr-lbl">panelMenuGroup-top</td>
+ <td class="rf-pm-top-gr-lbl"></td>
<td class="rf-pm-top-gr-exp-ico">
<div class="rf-pm-ico-colps rf-pm-chevron" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-chevron" style="display:none"></div>
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml 2010-12-17 11:35:18 UTC (rev 20641)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml 2010-12-17 11:39:38 UTC (rev 20642)
@@ -8,7 +8,7 @@
<div class="rf-pm-ico-colps rf-pm-none" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-none" style="display:none"></div>
</td>
- <td class="rf-pm-gr-lbl">panelMenuGroup</td>
+ <td class="rf-pm-gr-lbl"></td>
<td class="rf-pm-gr-exp-ico">
<div class="rf-pm-ico-colps rf-pm-none" style="display:block"></div>
<div class="rf-pm-ico-exp rf-pm-none" style="display:none"></div>
14 years
JBoss Rich Faces SVN: r20641 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-17 06:35:18 -0500 (Fri, 17 Dec 2010)
New Revision: 20641
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java
Log:
* fixed testOnenter
* refactoring
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java 2010-12-17 11:08:51 UTC (rev 20640)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java 2010-12-17 11:35:18 UTC (rev 20641)
@@ -94,8 +94,7 @@
@Test
public void testDisabled() {
- JQueryLocator selectOption = pjq("input[type=radio][name$=disabledInput][value=true]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
selenium.waitForPageToLoad();
guardNoRequest(selenium).click(itemHeaders[0]);
@@ -176,7 +175,7 @@
@Test
@IssueTracking("https://jira.jboss.org/browse/RF-9821")
public void testOnenter() {
- testFireEvent(Event.CLICK, item1, "enter");
+ testFireEvent(Event.CLICK, itemHeaders[0], "enter");
}
@Test
@@ -253,8 +252,7 @@
@Test
public void testRendered() {
- JQueryLocator input = pjq("input[type=radio][name$=renderedInput][value=false]");
- selenium.click(input);
+ selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
selenium.waitForPageToLoad();
assertFalse(selenium.isElementPresent(item1), "Item1 should not be rendered when rendered=false.");
@@ -278,8 +276,7 @@
@Test
public void testSwitchTypeAjax() {
- JQueryLocator selectOption = pjq("input[type=radio][name$=switchTypeInput][value=ajax]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[type=radio][name$=switchTypeInput][value=ajax]"));
selenium.waitForPageToLoad();
testSwitchTypeNull();
@@ -287,8 +284,7 @@
@Test
public void testSwitchTypeClient() {
- JQueryLocator selectOption = pjq("input[type=radio][name$=switchTypeInput][value=client]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[type=radio][name$=switchTypeInput][value=client]"));
selenium.waitForPageToLoad();
guardNoRequest(selenium).click(itemHeaders[0]);
@@ -297,8 +293,7 @@
@Test
public void testSwitchTypeServer() {
- JQueryLocator selectOption = pjq("input[type=radio][name$=switchTypeInput][value=server]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[type=radio][name$=switchTypeInput][value=server]"));
selenium.waitForPageToLoad();
guardHttp(selenium).click(itemHeaders[0]);
14 years
JBoss Rich Faces SVN: r20640 - modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-17 06:08:51 -0500 (Fri, 17 Dec 2010)
New Revision: 20640
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichAccordionBean.java
Log:
* added value for activeItem in accordion
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichAccordionBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichAccordionBean.java 2010-12-17 11:01:44 UTC (rev 20639)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichAccordionBean.java 2010-12-17 11:08:51 UTC (rev 20640)
@@ -56,6 +56,7 @@
attributes = Attributes.getComponentAttributesFromFacesConfig(HtmlAccordion.class, getClass());
+ attributes.setAttribute("activeItem", "item1");
attributes.setAttribute("rendered", true);
}
14 years
JBoss Rich Faces SVN: r20639 - modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-12-17 06:01:44 -0500 (Fri, 17 Dec 2010)
New Revision: 20639
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeNodeBean.java
Log:
fixed rich:treeNode attribute loading
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeNodeBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeNodeBean.java 2010-12-17 10:54:52 UTC (rev 20638)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeNodeBean.java 2010-12-17 11:01:44 UTC (rev 20639)
@@ -27,7 +27,7 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
-import org.richfaces.component.UITreeModelAdaptor;
+import org.richfaces.component.UITreeNode;
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,7 +53,7 @@
logger.debug("initializing bean " + getClass().getName());
for (int i = 0; i < attributes.length; i++) {
- attributes[i] = Attributes.getComponentAttributesFromFacesConfig(UITreeModelAdaptor.class, getClass());
+ attributes[i] = Attributes.getComponentAttributesFromFacesConfig(UITreeNode.class, getClass());
attributes[i].get("rendered").setValue(true);
@@ -65,7 +65,6 @@
attributes[i].setAttribute("handleClass", null);
attributes[i].setAttribute("iconClass", null);
attributes[i].setAttribute("labelClass", null);
- attributes[i].setAttribute("styleClass", null);
}
}
14 years
JBoss Rich Faces SVN: r20638 - in modules/tests/metamer/trunk/application/src/main: webapp/components and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-17 05:54:52 -0500 (Fri, 17 Dec 2010)
New Revision: 20638
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuSeparatorBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuSeparator/
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuSeparator/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuSeparator/simple.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
https://issues.jboss.org/browse/RFPL-960
* added sample for rich:menuSeparator
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-12-17 10:52:54 UTC (rev 20637)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-12-17 10:54:52 UTC (rev 20638)
@@ -143,6 +143,7 @@
components.put("richList", "Rich List");
components.put("richMenuGroup", "Rich Menu Group");
components.put("richMenuItem", "Rich Menu Item");
+ components.put("richMenuSeparator", "Rich Menu Separator");
components.put("richPanel", "Rich Panel");
components.put("richPanelMenu", "Rich Panel Menu");
components.put("richPopupPanel", "Rich Popup Panel");
Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuSeparatorBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuSeparatorBean.java (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuSeparatorBean.java 2010-12-17 10:54:52 UTC (rev 20638)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.richfaces.tests.metamer.bean;
+
+import java.io.Serializable;
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+import org.richfaces.component.UIMenuSeparator;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for rich:menuSeparator.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean
+@ViewScoped
+public class RichMenuSeparatorBean implements Serializable {
+
+ private static final long serialVersionUID = -1L;
+ private static Logger logger;
+ private Attributes attributes;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes = Attributes.getComponentAttributesFromFacesConfig(UIMenuSeparator.class, getClass());
+
+ attributes.setAttribute("rendered", true);
+
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+}
Property changes on: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuSeparatorBean.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuSeparator/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuSeparator/list.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuSeparator/list.xhtml 2010-12-17 10:54:52 UTC (rev 20638)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+ <!--
+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.
+ -->
+
+ <ui:composition template="/templates/list.xhtml">
+
+ <ui:define name="pageTitle">Rich Menu Separator</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="simple" outcome="simple" value="Simple">
+ Simple page containing a drop down menu with several <b>rich:menuSeparator</b>s and inputs for all attributes.
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuSeparator/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuSeparator/simple.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuSeparator/simple.xhtml 2010-12-17 10:54:52 UTC (rev 20638)
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer" xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html">
+
+ <!--
+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.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ <style type="text/css">
+ .pic {
+ margin-bottom: -4px;
+ margin-right: 2px;
+ }
+
+ .search .rf-ddm-itm-sel {
+ background-color: transparent;
+ background-image:none;
+ border-color: transparent;
+ cursor: default;
+ }
+ </style>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <rich:toolbar id="toolbar" height="26px">
+ <rich:dropDownMenu id="menu1" mode="ajax">
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:graphicImage library="images/icons" name="copy.gif" styleClass="pic" />
+ <h:outputText value="File" />
+ </h:panelGroup>
+ </f:facet>
+
+ <rich:menuItem label="New" icon="/resources/images/icons/create_doc.gif"/>
+
+ <rich:menuItem label="Open" icon="/resources/images/icons/open.gif" />
+
+ <rich:menuGroup label="Open Recent..." disabled="true">
+ <rich:menuItem label="Save" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem label="Save All">
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons" name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ </rich:menuGroup>
+
+ <rich:menuSeparator id="menuSeparator11"
+ rendered="#{richMenuSeparatorBean.attributes['rendered'].value}"/>
+
+ <rich:menuGroup id="menuGroup" label="Save As...">
+ <rich:menuItem label="Save" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem label="Save All" >
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons" name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ <rich:menuItem label="Send Online" icon="/resources/images/icons/save.gif" disabled="true" />
+ </rich:menuGroup>
+
+ <rich:menuItem label="Print" disabled="true"/>
+
+ <rich:menuItem label="Close" />
+
+ <rich:menuSeparator id="menuSeparator12" />
+
+ <rich:menuItem label="Exit" />
+
+ </rich:dropDownMenu>
+
+ </rich:toolbar>
+
+ <br /><br />
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ Settings for the first menu separator:
+ <metamer:attributes value="#{richMenuSeparatorBean.attributes}" id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
14 years