JBoss Rich Faces SVN: r16504 - root/cdk-sandbox/trunk/xsd2javadoc/src/main/java/org/richfaces/xsd2tld.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-02-28 13:37:27 -0500 (Sun, 28 Feb 2010)
New Revision: 16504
Modified:
root/cdk-sandbox/trunk/xsd2javadoc/src/main/java/org/richfaces/xsd2tld/SchemaTransformer.java
Log:
Reference elements/attributes removed from schema documentation generation
Modified: root/cdk-sandbox/trunk/xsd2javadoc/src/main/java/org/richfaces/xsd2tld/SchemaTransformer.java
===================================================================
--- root/cdk-sandbox/trunk/xsd2javadoc/src/main/java/org/richfaces/xsd2tld/SchemaTransformer.java 2010-02-26 15:14:27 UTC (rev 16503)
+++ root/cdk-sandbox/trunk/xsd2javadoc/src/main/java/org/richfaces/xsd2tld/SchemaTransformer.java 2010-02-28 18:37:27 UTC (rev 16504)
@@ -1,4 +1,5 @@
package org.richfaces.xsd2tld;
+
import static org.richfaces.xsd2tld.SchemaTransformerUtils.createLookup;
import static org.richfaces.xsd2tld.SchemaTransformerUtils.createTagClassName;
import static org.richfaces.xsd2tld.SchemaTransformerUtils.getJavaClassNameByType;
@@ -76,9 +77,9 @@
private SchemaModelFactory schemaModelFactory = SchemaModelFactory.getDefault();
private List<SchemaModel> schemaModels = new ArrayList<SchemaModel>();
-
+
private AXIModelFactory axiModelFactory = AXIModelFactory.getDefault();
-
+
private TldTaglibType createTaglib(String namespaceUri) {
TldTaglibType taglib = objectFactory.createTldTaglibType();
@@ -86,37 +87,37 @@
taglib.setUri(namespaceUri);
return taglib;
}
-
+
protected SchemaModel parseSchema(String fileName) throws Exception {
ModelSource modelSource = new ModelSource(createLookup(fileName), false);
SchemaModel schemaModel = schemaModelFactory.getModel(modelSource);
schemaModel.sync();
-
+
return schemaModel;
}
-
+
public void setTaglibShortNames(Map<String, String> taglibShortNames) {
this.taglibShortNames = taglibShortNames;
}
-
+
public void addSchema(String fileName) throws Exception {
SchemaModel schemaModel = parseSchema(fileName);
schemaModels.add(schemaModel);
}
-
+
public void parseSchemas() {
for (SchemaModel schemaModel : schemaModels) {
Schema schema = schemaModel.getSchema();
String targetNamespace = schema.getTargetNamespace();
TldTaglibType taglib = createTaglib(targetNamespace);
-
+
String shortName = taglibShortNames.get(targetNamespace);
if (shortName == null) {
shortName = getShortName(schema);
}
-
+
taglib.setShortName(shortName);
Annotation schemaAnnotation = schema.getAnnotation();
@@ -125,7 +126,7 @@
if (documentationElements != null) {
List<Object> descriptionsList = taglib.getDescription();
for (Documentation documentationElement : documentationElements) {
- //descriptionsList.addAll(parseRawXml(documentationElement.getContentFragment()));
+ // descriptionsList.addAll(parseRawXml(documentationElement.getContentFragment()));
descriptionsList.add(documentationElement.getContentFragment());
}
}
@@ -133,31 +134,29 @@
addElementsAndAttributes(schemaModel, taglib);
}
-
+
schemaModels.clear();
}
-
+
public void writeTransformedSchemas(String outputDirectory) {
File outputDirectoryObject = new File(outputDirectory);
outputDirectoryObject.mkdirs();
-
+
for (TldTaglibType taglib : taglibs.values()) {
File outputFile = new File(outputDirectoryObject, taglib.getShortName() + ".tld");
outputFile.delete();
JAXB.marshal(objectFactory.createTaglib(taglib), outputFile);
}
}
-
+
private static String getDocumentation(AXIComponent axiComponent) {
SchemaComponent peer = axiComponent.getPeer();
- if (peer == null ||
- peer.getAnnotation() == null ||
- peer.getAnnotation().getDocumentationElements() == null) {
+ if (peer == null || peer.getAnnotation() == null || peer.getAnnotation().getDocumentationElements() == null) {
return null;
}
StringBuilder buffer = new StringBuilder();
- for(Documentation doc : peer.getAnnotation().getDocumentationElements()) {
+ for (Documentation doc : peer.getAnnotation().getDocumentationElements()) {
buffer.append(doc.getContentFragment());
}
@@ -167,7 +166,7 @@
private String getElementQName(AXIComponent component) {
return "{" + component.getTargetNamespace() + "}" + ((AXIType) component).getName();
}
-
+
/**
* @param schema
* @param taglib
@@ -178,39 +177,40 @@
AXIModel axiModel = axiModelFactory.getModel(schemaModel);
final Set<String> visitedObjects = new HashSet<String>();
-
+
axiModel.getRoot().accept(new AXINonCyclicVisitor(axiModel) {
-
+
private void addAttribute(TagType tagType, AbstractAttribute abstractAttribute) {
TldAttributeType tldAttribute = objectFactory.createTldAttributeType();
- //TODO namespace check
+ // TODO namespace check
tldAttribute.setName(abstractAttribute.getName());
if (abstractAttribute instanceof Attribute) {
Attribute attribute = (Attribute) abstractAttribute;
tldAttribute.setRequired(Use.REQUIRED.equals(attribute.getUse()));
- tldAttribute.setType(getJavaClassNameByType( (Datatype) attribute.getType() ));
+ tldAttribute.setType(getJavaClassNameByType((Datatype) attribute.getType()));
} else {
- //TODO
+ // TODO
}
String attributeDocumentation = getDocumentation(abstractAttribute);
if (attributeDocumentation != null && attributeDocumentation.length() != 0) {
- //tldAttribute.getDescription().addAll(parseRawXml(attributeDocumentation));
+ // tldAttribute.getDescription().addAll(parseRawXml(attributeDocumentation));
tldAttribute.getDescription().add(normalizeXml(attributeDocumentation));
}
tagType.getAttribute().add(tldAttribute);
}
-
+
private static final String GLOBAL_ATTRIBUTES = "_global_attributes";
-
+
@Override
public void visit(Attribute attribute) {
super.visit(attribute);
-
- if (targetNamespace.equals(attribute.getTargetNamespace()) && attribute.isGlobal() && visitedObjects.add(getElementQName(attribute))) {
+
+ if (!attribute.isReference() && targetNamespace.equals(attribute.getTargetNamespace())
+ && attribute.isGlobal() && visitedObjects.add(getElementQName(attribute))) {
TagType globalTagType = null;
List<TagType> tags = taglib.getTag();
for (TagType tagType : tags) {
@@ -219,35 +219,37 @@
break;
}
}
-
+
if (globalTagType == null) {
globalTagType = objectFactory.createTagType();
globalTagType.setName(GLOBAL_ATTRIBUTES);
- globalTagType.getDescription().add("Global attributes of " + attribute.getTargetNamespace() + " namespace");
-
+ globalTagType.getDescription().add(
+ "Global attributes of " + attribute.getTargetNamespace() + " namespace");
+
taglib.getTag().add(globalTagType);
}
-
+
addAttribute(globalTagType, attribute);
}
}
-
+
@Override
public void visit(Element e) {
super.visit(e);
- if (targetNamespace.equals(e.getTargetNamespace()) && visitedObjects.add(getElementQName(e))) {
+ if (!e.isReference() && targetNamespace.equals(e.getTargetNamespace())
+ && visitedObjects.add(getElementQName(e))) {
List<TagType> tagsList = taglib.getTag();
TagType tagType = objectFactory.createTagType();
-
+
String tagName = e.getName();
tagType.setName(tagName);
tagType.setTagClass(createTagClassName(tagName));
String documentation = getDocumentation(e);
if (documentation != null && documentation.length() != 0) {
- //tagType.getDescription().addAll(parseRawXml(documentation));
+ // tagType.getDescription().addAll(parseRawXml(documentation));
tagType.getDescription().add(normalizeXml(documentation));
}
@@ -267,13 +269,13 @@
private static enum State {
FILES, LOCAL_NAMES_HASH, OUTPUT_DIR
}
-
+
public static void main(String[] args) throws Exception {
State state = State.FILES;
-
+
String outputDirectoryPath = null;
SchemaTransformer schemaTransformer = new SchemaTransformer();
-
+
for (String arg : args) {
if (state == State.LOCAL_NAMES_HASH) {
schemaTransformer.setTaglibShortNames(parseLiteralHash(arg));
@@ -289,11 +291,11 @@
schemaTransformer.addSchema(arg);
}
}
-
+
schemaTransformer.parseSchemas();
-
+
File outputDirectory = new File(outputDirectoryPath);
-
+
schemaTransformer.writeTransformedSchemas(outputDirectory.getAbsolutePath());
}
}
14 years, 9 months
JBoss Rich Faces SVN: r16503 - in root/ui-sandbox/trunk/components/datascroller/ui/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-02-26 10:14:27 -0500 (Fri, 26 Feb 2010)
New Revision: 16503
Added:
root/ui-sandbox/trunk/components/datascroller/ui/src/main/templates/
root/ui-sandbox/trunk/components/datascroller/ui/src/main/templates/datascroller.template.xml
Removed:
root/ui-sandbox/trunk/components/datascroller/ui/src/main/tempates/
Log:
fix dir name
Added: root/ui-sandbox/trunk/components/datascroller/ui/src/main/templates/datascroller.template.xml
===================================================================
--- root/ui-sandbox/trunk/components/datascroller/ui/src/main/templates/datascroller.template.xml (rev 0)
+++ root/ui-sandbox/trunk/components/datascroller/ui/src/main/templates/datascroller.template.xml 2010-02-26 15:14:27 UTC (rev 16503)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cdk:root xmlns="http://richfaces.org/cdk/xhtml-el" xmlns:cdk="http://richfaces.org/cdk/core"
+ xmlns:c="http://richfaces.org/cdk/jstl/core" xmlns:cc="http://richfaces.org/cdk/jsf/composite"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.GenerateDataScrollerRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.DataScrollerBaseRenderer</cdk:superclass>
+ <cdk:component-family>org.richfaces.DataScroller</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.GeneratedDataScroller</cdk:renderer-type>
+ </cc:interface>
+
+ <cc:implementation>
+ <span id="" class="ds_container !ds_container_decor"><!-- Now decor is disabled !!! -->
+
+ <span class="ds_button ds_left ds_disabled">
+ ««
+ </span>
+
+ <span class="ds_button ds_left ds_disabled">
+ «
+ </span>
+
+ <span class="ds_digital" onmouseover="this.className='ds_digital ds_over'" onmouseout="this.className='ds_digital'" onmouseup="this.className='ds_digital ds_over'" onmousedown="this.className='ds_digital ds_press'">
+ </span>
+
+ <span class="ds_button ds_right" onmousedown="this.className='ds_button ds_right ds_over'" onmouseup="this.className='ds_button ds_right'" onmouseout="this.className='ds_button ds_right'">
+ »
+ </span>
+
+ <span class="ds_button ds_right" onmousedown="this.className='ds_button ds_right ds_over'" onmouseup="this.className='ds_button ds_right'" onmouseout="this.className='ds_button ds_right'">
+ »»
+ </span>
+ </span>
+ </cc:implementation>
+</cdk:root>
\ No newline at end of file
14 years, 10 months
JBoss Rich Faces SVN: r16502 - in root/ui/trunk/components/core: src and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-02-26 09:54:47 -0500 (Fri, 26 Feb 2010)
New Revision: 16502
Added:
root/ui/trunk/components/core/src/test-old/
root/ui/trunk/components/core/src/test-old/java/
Removed:
root/ui/trunk/components/core/src/test-new/
root/ui/trunk/components/core/src/test/java/
Modified:
root/ui/trunk/components/core/pom.xml
Log:
Test directories renamed in ui/trunk/components/core
Modified: root/ui/trunk/components/core/pom.xml
===================================================================
--- root/ui/trunk/components/core/pom.xml 2010-02-26 14:11:13 UTC (rev 16501)
+++ root/ui/trunk/components/core/pom.xml 2010-02-26 14:54:47 UTC (rev 16502)
@@ -39,8 +39,6 @@
</executions>
</plugin>
</plugins>
-
- <testSourceDirectory>src/test-new</testSourceDirectory>
</build>
<dependencies>
Copied: root/ui/trunk/components/core/src/test-old/java (from rev 16500, root/ui/trunk/components/core/src/test/java)
14 years, 10 months
JBoss Rich Faces SVN: r16501 - in root: framework/trunk and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-02-26 09:11:13 -0500 (Fri, 26 Feb 2010)
New Revision: 16501
Added:
root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsMocksTest.java
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/renderer-template-test/pom.xml
root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsTest.java
root/framework/trunk/pom.xml
root/ui/trunk/version-matrix/pom.xml
Log:
JSF Mock version updated to 1.0.0
Some tests refactored
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/renderer-template-test/pom.xml
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/it/renderer-template-test/pom.xml 2010-02-26 05:41:07 UTC (rev 16500)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/it/renderer-template-test/pom.xml 2010-02-26 14:11:13 UTC (rev 16501)
@@ -54,7 +54,7 @@
<dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-mock</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
Copied: root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsMocksTest.java (from rev 16500, root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsTest.java)
===================================================================
--- root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsMocksTest.java (rev 0)
+++ root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsMocksTest.java 2010-02-26 14:11:13 UTC (rev 16501)
@@ -0,0 +1,375 @@
+/*
+ * 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.renderkit;
+
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.same;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorContext;
+import javax.faces.component.behavior.ClientBehaviorHint;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.easymock.EasyMock;
+import org.jboss.test.faces.mock.MockFacesEnvironment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class RenderKitUtilsMocksTest {
+
+ /**
+ *
+ */
+ private static final String CLIENT_ID = "submittedId";
+
+ private MockFacesEnvironment facesEnvironment;
+
+ private ResponseWriter responseWriter;
+
+ private FacesContext facesContext;
+
+ private ExternalContext externalContext;
+
+ private Map<String, Object> componentAttributes;
+
+ private Map<String, List<ClientBehavior>> behaviorsMap;
+
+ private Map<String, ComponentAttribute> knownAttributes;
+
+ @Before
+ public void setUp() throws Exception {
+ facesEnvironment = MockFacesEnvironment.createEnvironment().withExternalContext();
+
+ facesContext = facesEnvironment.getFacesContext();
+ externalContext = facesEnvironment.getExternalContext();
+
+ responseWriter = facesEnvironment.createMock(ResponseWriter.class);
+ expect(facesContext.getResponseWriter()).andStubReturn(responseWriter);
+ expect(responseWriter.getContentType()).andStubReturn("application/xhtml+xml");
+
+ componentAttributes = new HashMap<String, Object>();
+ behaviorsMap = new HashMap<String, List<ClientBehavior>>();
+ knownAttributes = new TreeMap<String, ComponentAttribute>();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ this.facesEnvironment.verify();
+ this.facesEnvironment.release();
+
+ this.facesEnvironment = null;
+ this.responseWriter = null;
+ this.facesContext = null;
+ this.externalContext = null;
+ this.componentAttributes = null;
+ this.behaviorsMap = null;
+ this.knownAttributes = null;
+ }
+
+ private UIComponent createMockComponent() {
+ UIComponent component = facesEnvironment.createMock(UIComponent.class);
+ expect(component.getAttributes()).andStubReturn(componentAttributes);
+ expect(component.getClientId(same(facesContext))).andStubReturn(CLIENT_ID);
+ return component;
+ }
+
+ private ClientBehaviorHolder createMockClientBehaviorHolder() {
+ UIComponent component = facesEnvironment.createMock(MockClientBehaviorHolder.class);
+ expect(component.getClientId(same(facesContext))).andStubReturn(CLIENT_ID);
+ expect(component.getAttributes()).andStubReturn(componentAttributes);
+ ClientBehaviorHolder behaviorHolder = (ClientBehaviorHolder) component;
+ expect(behaviorHolder.getClientBehaviors()).andStubReturn(behaviorsMap);
+ expect(behaviorHolder.getEventNames()).andStubReturn(
+ Arrays.asList("click", "action", "mousemove", "keypress", "blur", "contextmenu"));
+ return behaviorHolder;
+ }
+
+ @Test
+ public void testRenderPassThroughAttributes() throws Exception {
+ knownAttributes.put("disabled", new ComponentAttribute("disabled"));
+ knownAttributes.put("checked", new ComponentAttribute("checked"));
+ knownAttributes.put("style", new ComponentAttribute("style"));
+ knownAttributes.put("src", new ComponentAttribute("src"));
+ knownAttributes.put("lang", new ComponentAttribute("lang"));
+ knownAttributes.put("class", new ComponentAttribute("class").setComponentAttributeName("styleClass"));
+
+ componentAttributes.put("disabled", Boolean.TRUE);
+ componentAttributes.put("checked", Boolean.FALSE);
+ componentAttributes.put("style", "color:red");
+ componentAttributes.put("src", "urn:abc");
+ componentAttributes.put("facelets.Mark", 123);
+ componentAttributes.put("lang", "ru");
+ componentAttributes.put("styleClass", "rich-component");
+
+ UIComponent component = createMockComponent();
+
+ responseWriter.writeAttribute(eq("disabled"), eq(Boolean.TRUE), EasyMock.<String>isNull());
+ // checked attribute shouldn't be rendered - it's 'false'
+ responseWriter.writeAttribute(eq("style"), eq("color:red"), EasyMock.<String>isNull());
+ responseWriter.writeURIAttribute(eq("src"), eq("urn:abc"), EasyMock.<String>isNull());
+ // facelets.Mark shouldn't be rendered - it's unknown
+ responseWriter.writeAttribute(eq("xml:lang"), eq("ru"), EasyMock.<String>isNull());
+ responseWriter.writeAttribute(eq("class"), eq("rich-component"), EasyMock.<String>isNull());
+
+ facesEnvironment.replay();
+
+ RenderKitUtils.renderPassThroughAttributes(facesContext, component, knownAttributes);
+ }
+
+ private ClientBehavior createClientBehavior(String handlerData, Set<ClientBehaviorHint> hints) {
+ ClientBehavior behavior = facesEnvironment.createMock(ClientBehavior.class);
+ expect(behavior.getScript(EasyMock.<ClientBehaviorContext> notNull())).andStubReturn(
+ MessageFormat.format("prompt({0})", handlerData));
+
+ expect(behavior.getHints()).andStubReturn(hints);
+ return behavior;
+ }
+
+ @Test
+ public void testBehaviors() throws Exception {
+ knownAttributes.put("onclick", new ComponentAttribute("onclick")
+ .setEventNames(new String[] { "click", "action" }));
+ knownAttributes.put("onmousemove", new ComponentAttribute("onmousemove")
+ .setEventNames(new String[] { "mousemove" }));
+ knownAttributes.put("onkeypress", new ComponentAttribute("onkeypress")
+ .setEventNames(new String[] { "keypress" }));
+ knownAttributes.put("oncontextmenu", new ComponentAttribute("oncontextmenu")
+ .setEventNames(new String[] { "contextmenu" }));
+
+ componentAttributes.put("onkeypress", "alert(keypress)");
+ componentAttributes.put("onmousemove", "alert(mousemove)");
+ componentAttributes.put("onclick", "alert(click)");
+
+ Set<ClientBehaviorHint> emptyHintsSet = EnumSet.noneOf(ClientBehaviorHint.class);
+ Set<ClientBehaviorHint> submittingHintsSet = EnumSet.of(ClientBehaviorHint.SUBMITTING);
+
+ ClientBehavior keypressBehavior = createClientBehavior("keypress", emptyHintsSet);
+ ClientBehavior actionBehavior1 = createClientBehavior("action1", emptyHintsSet);
+ ClientBehavior actionBehavior2 = createClientBehavior("action2", submittingHintsSet);
+ ClientBehavior actionBehavior3 = createClientBehavior("action3", emptyHintsSet);
+ ClientBehavior contextmenuBehavior = createClientBehavior("contextmenu", emptyHintsSet);
+
+ behaviorsMap.put("keypress", Arrays.asList(keypressBehavior));
+ behaviorsMap.put("action", Arrays.asList(actionBehavior1, actionBehavior2, actionBehavior3));
+ behaviorsMap.put("contextmenu", Arrays.asList(contextmenuBehavior));
+
+ ClientBehaviorHolder behaviorHolder = createMockClientBehaviorHolder();
+ UIComponent component = (UIComponent) behaviorHolder;
+
+ responseWriter.writeAttribute(eq("onkeypress"), eq("jsf.util.chain('alert(keypress)','prompt(keypress)')"),
+ EasyMock.<String>isNull());
+ responseWriter.writeAttribute(eq("onclick"),
+ eq("jsf.util.chain('alert(click)','prompt(action1)','prompt(action2)')"), EasyMock.<String>isNull());
+ responseWriter.writeAttribute(eq("onmousemove"), eq("alert(mousemove)"), EasyMock.<String>isNull());
+ responseWriter.writeAttribute(eq("oncontextmenu"), eq("prompt(contextmenu)"), EasyMock.<String>isNull());
+
+ facesEnvironment.replay();
+
+ RenderKitUtils.renderPassThroughAttributes(facesContext, component, knownAttributes);
+ }
+
+ private UIComponent setupBehaviorsTestForDisabledComponent() throws IOException {
+ knownAttributes.put("style", new ComponentAttribute("style"));
+ knownAttributes.put("onclick", new ComponentAttribute("onclick")
+ .setEventNames(new String[] { "click", "action" }));
+ knownAttributes.put("onmousemove", new ComponentAttribute("onmousemove")
+ .setEventNames(new String[] { "mousemove" }));
+
+ componentAttributes.put("onmousemove", "alert(mousemove)");
+ componentAttributes.put("onclick", "alert(click)");
+ componentAttributes.put("style", "color:green");
+
+ Set<ClientBehaviorHint> emptyHintsSet = EnumSet.noneOf(ClientBehaviorHint.class);
+
+ ClientBehavior actionBehavior1 = createClientBehavior("action1", emptyHintsSet);
+ behaviorsMap.put("action", Arrays.asList(actionBehavior1));
+
+ ClientBehaviorHolder behaviorHolder = createMockClientBehaviorHolder();
+ UIComponent component = (UIComponent) behaviorHolder;
+ return component;
+ }
+
+ @Test
+ public void testBehaviorsForDisabledComponent() throws Exception {
+ componentAttributes.put("disabled", Boolean.TRUE);
+ UIComponent component = setupBehaviorsTestForDisabledComponent();
+
+ responseWriter.writeAttribute(eq("style"), eq("color:green"), EasyMock.<String>isNull());
+
+ facesEnvironment.replay();
+
+ RenderKitUtils.renderPassThroughAttributes(facesContext, component, knownAttributes);
+ }
+
+ @Test
+ public void testBehaviorsForNonDisabledComponent() throws Exception {
+ componentAttributes.put("disabled", Boolean.FALSE);
+ UIComponent component = setupBehaviorsTestForDisabledComponent();
+
+ responseWriter.writeAttribute(eq("onclick"), eq("jsf.util.chain('alert(click)','prompt(action1)')"),
+ EasyMock.<String>isNull());
+ responseWriter.writeAttribute(eq("onmousemove"),
+ eq("alert(mousemove)"), EasyMock.<String>isNull());
+ responseWriter.writeAttribute(eq("style"), eq("color:green"), EasyMock.<String>isNull());
+
+ facesEnvironment.replay();
+
+ RenderKitUtils.renderPassThroughAttributes(facesContext, component, knownAttributes);
+ }
+
+ public void checkDisabled(Object attributeValue, boolean expectedValue) throws Exception {
+ componentAttributes.put("disabled", attributeValue);
+
+ UIComponent component = createMockComponent();
+ facesEnvironment.replay();
+ assertTrue(expectedValue == RenderKitUtils.isDisabled(component));
+ }
+
+ @Test
+ public void testIsDisabled() throws Exception {
+ checkDisabled(Boolean.TRUE, true);
+ }
+
+ @Test
+ public void testIsDisabledString() throws Exception {
+ checkDisabled("true", true);
+ }
+
+ @Test
+ public void testIsNonDisabled() throws Exception {
+ checkDisabled(Boolean.FALSE, false);
+ }
+
+ @Test
+ public void testIsNonDisabledString() throws Exception {
+ checkDisabled("false", false);
+ }
+
+ @Test
+ public void testIsNonDisabledNull() throws Exception {
+ checkDisabled(null, false);
+ }
+
+ private UIComponent setupTestDecodeBehaviors(String behaviorSourceId, String behaviorEventName) throws Exception {
+ ClientBehaviorHolder behaviorHolder = createMockClientBehaviorHolder();
+ UIComponent component = (UIComponent) behaviorHolder;
+
+ Map<String, String> requestParameterMap = new HashMap<String, String>();
+ requestParameterMap.put(RenderKitUtils.BEHAVIOR_SOURCE_ID, behaviorSourceId);
+ requestParameterMap.put(RenderKitUtils.BEHAVIOR_EVENT_NAME, behaviorEventName);
+ expect(externalContext.getRequestParameterMap()).andStubReturn(requestParameterMap);
+
+ ClientBehavior actionBehavior = createClientBehavior("action1", EnumSet.of(ClientBehaviorHint.SUBMITTING));
+ ClientBehavior actionBehavior1 = createClientBehavior("action2", EnumSet.of(ClientBehaviorHint.SUBMITTING));
+ behaviorsMap.put("action", Arrays.asList(actionBehavior, actionBehavior1));
+
+ ClientBehavior blurBehavior = createClientBehavior("blur1", EnumSet.of(ClientBehaviorHint.SUBMITTING));
+ behaviorsMap.put("blur", Arrays.asList(blurBehavior));
+
+ return component;
+ }
+
+ @Test
+ public void testDecodeActionBehaviors() throws Exception {
+ UIComponent component = setupTestDecodeBehaviors(CLIENT_ID, "action");
+
+ List<ClientBehavior> behaviors = behaviorsMap.get("action");
+ for (ClientBehavior clientBehavior : behaviors) {
+ clientBehavior.decode(same(facesContext), same(component));
+ expectLastCall();
+ }
+
+ facesEnvironment.replay();
+
+ RenderKitUtils.decodeBehaviors(facesContext, component);
+ }
+
+ @Test
+ public void testDecodeBlurBehaviors() throws Exception {
+ UIComponent component = setupTestDecodeBehaviors(CLIENT_ID, "blur");
+
+ List<ClientBehavior> behaviors = behaviorsMap.get("blur");
+ for (ClientBehavior clientBehavior : behaviors) {
+ clientBehavior.decode(same(facesContext), same(component));
+ expectLastCall();
+ }
+
+ facesEnvironment.replay();
+
+ RenderKitUtils.decodeBehaviors(facesContext, component);
+ }
+
+ @Test
+ public void testDecodeNonMatchingClientId() throws Exception {
+ UIComponent component = setupTestDecodeBehaviors("wrongId", "action");
+
+ //nothing should be called - clientId is not matched
+
+ facesEnvironment.replay();
+
+ RenderKitUtils.decodeBehaviors(facesContext, component);
+ }
+
+ @Test
+ public void testDecodeNoSubmittedBehavior() throws Exception {
+ UIComponent component = setupTestDecodeBehaviors(CLIENT_ID, null);
+
+ //nothing should be called - no behavior event information was submitted
+
+ facesEnvironment.replay();
+
+ RenderKitUtils.decodeBehaviors(facesContext, component);
+ }
+
+ @Test
+ public void testDecodeContextMenuBehaviors() throws Exception {
+ UIComponent component = setupTestDecodeBehaviors(CLIENT_ID, "contextmenu");
+
+ //nothing should be called - no context menu behaviors were created
+
+ facesEnvironment.replay();
+
+ RenderKitUtils.decodeBehaviors(facesContext, component);
+ }
+}
\ No newline at end of file
Modified: root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsTest.java
===================================================================
--- root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsTest.java 2010-02-26 05:41:07 UTC (rev 16500)
+++ root/framework/trunk/commons/src/test/java/org/richfaces/renderkit/RenderKitUtilsTest.java 2010-02-26 14:11:13 UTC (rev 16501)
@@ -21,39 +21,10 @@
*/
package org.richfaces.renderkit;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.same;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.behavior.ClientBehavior;
-import javax.faces.component.behavior.ClientBehaviorContext;
-import javax.faces.component.behavior.ClientBehaviorHint;
-import javax.faces.component.behavior.ClientBehaviorHolder;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.easymock.EasyMock;
-import org.jboss.test.faces.mock.FacesMock;
-import org.jboss.test.faces.mock.MockFacesEnvironment;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
/**
@@ -62,76 +33,6 @@
*/
public class RenderKitUtilsTest {
- /**
- *
- */
- private static final String CLIENT_ID = "submittedId";
-
- private MockFacesEnvironment facesEnvironment;
-
- private ResponseWriter responseWriter;
-
- private FacesContext facesContext;
-
- private ExternalContext externalContext;
-
- private Map<String, Object> componentAttributes;
-
- private Map<String, List<ClientBehavior>> behaviorsMap;
-
- private Map<String, ComponentAttribute> knownAttributes;
-
- private List<Object> createdMocks;
-
- @Before
- public void setUp() throws Exception {
- facesEnvironment = FacesMock.createMockEnvironment().withExternalContext();
-
- facesContext = facesEnvironment.getFacesContext();
- externalContext = facesEnvironment.getExternalContext();
-
- responseWriter = facesEnvironment.createMock(ResponseWriter.class);
- expect(facesContext.getResponseWriter()).andStubReturn(responseWriter);
- expect(responseWriter.getContentType()).andStubReturn("application/xhtml+xml");
-
- componentAttributes = new HashMap<String, Object>();
- behaviorsMap = new HashMap<String, List<ClientBehavior>>();
- knownAttributes = new TreeMap<String, ComponentAttribute>();
- createdMocks = new ArrayList<Object>();
- }
-
- @After
- public void tearDown() throws Exception {
- this.facesEnvironment = null;
- this.responseWriter = null;
- this.facesContext = null;
- this.externalContext = null;
- this.componentAttributes = null;
- this.behaviorsMap = null;
- this.knownAttributes = null;
- this.createdMocks = null;
- }
-
- private UIComponent createMockComponent() {
- UIComponent component = facesEnvironment.createMock(UIComponent.class);
- expect(component.getAttributes()).andStubReturn(componentAttributes);
- expect(component.getClientId(same(facesContext))).andStubReturn(CLIENT_ID);
- createdMocks.add(component);
- return component;
- }
-
- private ClientBehaviorHolder createMockClientBehaviorHolder() {
- UIComponent component = facesEnvironment.createMock(MockClientBehaviorHolder.class);
- expect(component.getClientId(same(facesContext))).andStubReturn(CLIENT_ID);
- expect(component.getAttributes()).andStubReturn(componentAttributes);
- ClientBehaviorHolder behaviorHolder = (ClientBehaviorHolder) component;
- expect(behaviorHolder.getClientBehaviors()).andStubReturn(behaviorsMap);
- expect(behaviorHolder.getEventNames()).andStubReturn(
- Arrays.asList("click", "action", "mousemove", "keypress", "blur", "contextmenu"));
- createdMocks.add(behaviorHolder);
- return behaviorHolder;
- }
-
@Test
public void testEscape() throws Exception {
assertEquals("", RenderKitUtils.escape(""));
@@ -206,271 +107,4 @@
assertFalse(RenderKitUtils.shouldRenderAttribute(Boolean.FALSE));
}
- @Test
- public void testRenderPassThroughAttributes() throws Exception {
- knownAttributes.put("disabled", new ComponentAttribute("disabled"));
- knownAttributes.put("checked", new ComponentAttribute("checked"));
- knownAttributes.put("style", new ComponentAttribute("style"));
- knownAttributes.put("src", new ComponentAttribute("src"));
- knownAttributes.put("lang", new ComponentAttribute("lang"));
- knownAttributes.put("class", new ComponentAttribute("class").setComponentAttributeName("styleClass"));
-
- componentAttributes.put("disabled", Boolean.TRUE);
- componentAttributes.put("checked", Boolean.FALSE);
- componentAttributes.put("style", "color:red");
- componentAttributes.put("src", "urn:abc");
- componentAttributes.put("facelets.Mark", 123);
- componentAttributes.put("lang", "ru");
- componentAttributes.put("styleClass", "rich-component");
-
- UIComponent component = createMockComponent();
-
- responseWriter.writeAttribute(eq("disabled"), eq(Boolean.TRUE), EasyMock.<String>isNull());
- // checked attribute shouldn't be rendered - it's 'false'
- responseWriter.writeAttribute(eq("style"), eq("color:red"), EasyMock.<String>isNull());
- responseWriter.writeURIAttribute(eq("src"), eq("urn:abc"), EasyMock.<String>isNull());
- // facelets.Mark shouldn't be rendered - it's unknown
- responseWriter.writeAttribute(eq("xml:lang"), eq("ru"), EasyMock.<String>isNull());
- responseWriter.writeAttribute(eq("class"), eq("rich-component"), EasyMock.<String>isNull());
-
- facesEnvironment.replay();
-
- RenderKitUtils.renderPassThroughAttributes(facesContext, component, knownAttributes);
-
- facesEnvironment.verify();
- }
-
- private ClientBehavior createClientBehavior(String handlerData, Set<ClientBehaviorHint> hints) {
- ClientBehavior behavior = facesEnvironment.createMock(ClientBehavior.class);
- expect(behavior.getScript(EasyMock.<ClientBehaviorContext> notNull())).andStubReturn(
- MessageFormat.format("prompt({0})", handlerData));
-
- expect(behavior.getHints()).andStubReturn(hints);
- createdMocks.add(behavior);
- return behavior;
- }
-
- @Test
- public void testBehaviors() throws Exception {
- knownAttributes.put("onclick", new ComponentAttribute("onclick")
- .setEventNames(new String[] { "click", "action" }));
- knownAttributes.put("onmousemove", new ComponentAttribute("onmousemove")
- .setEventNames(new String[] { "mousemove" }));
- knownAttributes.put("onkeypress", new ComponentAttribute("onkeypress")
- .setEventNames(new String[] { "keypress" }));
- knownAttributes.put("oncontextmenu", new ComponentAttribute("oncontextmenu")
- .setEventNames(new String[] { "contextmenu" }));
-
- componentAttributes.put("onkeypress", "alert(keypress)");
- componentAttributes.put("onmousemove", "alert(mousemove)");
- componentAttributes.put("onclick", "alert(click)");
-
- Set<ClientBehaviorHint> emptyHintsSet = EnumSet.noneOf(ClientBehaviorHint.class);
- Set<ClientBehaviorHint> submittingHintsSet = EnumSet.of(ClientBehaviorHint.SUBMITTING);
-
- ClientBehavior keypressBehavior = createClientBehavior("keypress", emptyHintsSet);
- ClientBehavior actionBehavior1 = createClientBehavior("action1", emptyHintsSet);
- ClientBehavior actionBehavior2 = createClientBehavior("action2", submittingHintsSet);
- ClientBehavior actionBehavior3 = createClientBehavior("action3", emptyHintsSet);
- ClientBehavior contextmenuBehavior = createClientBehavior("contextmenu", emptyHintsSet);
-
- behaviorsMap.put("keypress", Arrays.asList(keypressBehavior));
- behaviorsMap.put("action", Arrays.asList(actionBehavior1, actionBehavior2, actionBehavior3));
- behaviorsMap.put("contextmenu", Arrays.asList(contextmenuBehavior));
-
- ClientBehaviorHolder behaviorHolder = createMockClientBehaviorHolder();
- UIComponent component = (UIComponent) behaviorHolder;
-
- responseWriter.writeAttribute(eq("onkeypress"), eq("jsf.util.chain('alert(keypress)','prompt(keypress)')"),
- EasyMock.<String>isNull());
- responseWriter.writeAttribute(eq("onclick"),
- eq("jsf.util.chain('alert(click)','prompt(action1)','prompt(action2)')"), EasyMock.<String>isNull());
- responseWriter.writeAttribute(eq("onmousemove"), eq("alert(mousemove)"), EasyMock.<String>isNull());
- responseWriter.writeAttribute(eq("oncontextmenu"), eq("prompt(contextmenu)"), EasyMock.<String>isNull());
-
- facesEnvironment.replay();
-
- RenderKitUtils.renderPassThroughAttributes(facesContext, component, knownAttributes);
-
- facesEnvironment.verify();
- }
-
- private UIComponent setupBehaviorsTestForDisabledComponent() throws IOException {
- knownAttributes.put("style", new ComponentAttribute("style"));
- knownAttributes.put("onclick", new ComponentAttribute("onclick")
- .setEventNames(new String[] { "click", "action" }));
- knownAttributes.put("onmousemove", new ComponentAttribute("onmousemove")
- .setEventNames(new String[] { "mousemove" }));
-
- componentAttributes.put("onmousemove", "alert(mousemove)");
- componentAttributes.put("onclick", "alert(click)");
- componentAttributes.put("style", "color:green");
-
- Set<ClientBehaviorHint> emptyHintsSet = EnumSet.noneOf(ClientBehaviorHint.class);
-
- ClientBehavior actionBehavior1 = createClientBehavior("action1", emptyHintsSet);
- behaviorsMap.put("action", Arrays.asList(actionBehavior1));
-
- ClientBehaviorHolder behaviorHolder = createMockClientBehaviorHolder();
- UIComponent component = (UIComponent) behaviorHolder;
- return component;
- }
-
- @Test
- public void testBehaviorsForDisabledComponent() throws Exception {
- componentAttributes.put("disabled", Boolean.TRUE);
- UIComponent component = setupBehaviorsTestForDisabledComponent();
-
- responseWriter.writeAttribute(eq("style"), eq("color:green"), EasyMock.<String>isNull());
-
- facesEnvironment.replay();
-
- RenderKitUtils.renderPassThroughAttributes(facesContext, component, knownAttributes);
-
- facesEnvironment.verify();
- }
-
- @Test
- public void testBehaviorsForNonDisabledComponent() throws Exception {
- componentAttributes.put("disabled", Boolean.FALSE);
- UIComponent component = setupBehaviorsTestForDisabledComponent();
-
- responseWriter.writeAttribute(eq("onclick"), eq("jsf.util.chain('alert(click)','prompt(action1)')"),
- EasyMock.<String>isNull());
- responseWriter.writeAttribute(eq("onmousemove"),
- eq("alert(mousemove)"), EasyMock.<String>isNull());
- responseWriter.writeAttribute(eq("style"), eq("color:green"), EasyMock.<String>isNull());
-
- facesEnvironment.replay();
-
- RenderKitUtils.renderPassThroughAttributes(facesContext, component, knownAttributes);
-
- facesEnvironment.verify();
- }
-
- public void checkDisabled(Object attributeValue, boolean expectedValue) throws Exception {
- componentAttributes.put("disabled", attributeValue);
-
- UIComponent component = createMockComponent();
- facesEnvironment.replay();
- assertTrue(expectedValue == RenderKitUtils.isDisabled(component));
- facesEnvironment.verify();
- }
-
- @Test
- public void testIsDisabled() throws Exception {
- checkDisabled(Boolean.TRUE, true);
- }
-
- @Test
- public void testIsDisabledString() throws Exception {
- checkDisabled("true", true);
- }
-
- @Test
- public void testIsNonDisabled() throws Exception {
- checkDisabled(Boolean.FALSE, false);
- }
-
- @Test
- public void testIsNonDisabledString() throws Exception {
- checkDisabled("false", false);
- }
-
- @Test
- public void testIsNonDisabledNull() throws Exception {
- checkDisabled(null, false);
- }
-
- private UIComponent setupTestDecodeBehaviors(String behaviorSourceId, String behaviorEventName) throws Exception {
- ClientBehaviorHolder behaviorHolder = createMockClientBehaviorHolder();
- UIComponent component = (UIComponent) behaviorHolder;
-
- Map<String, String> requestParameterMap = new HashMap<String, String>();
- requestParameterMap.put(RenderKitUtils.BEHAVIOR_SOURCE_ID, behaviorSourceId);
- requestParameterMap.put(RenderKitUtils.BEHAVIOR_EVENT_NAME, behaviorEventName);
- expect(externalContext.getRequestParameterMap()).andStubReturn(requestParameterMap);
-
- ClientBehavior actionBehavior = createClientBehavior("action1", EnumSet.of(ClientBehaviorHint.SUBMITTING));
- ClientBehavior actionBehavior1 = createClientBehavior("action2", EnumSet.of(ClientBehaviorHint.SUBMITTING));
- behaviorsMap.put("action", Arrays.asList(actionBehavior, actionBehavior1));
-
- ClientBehavior blurBehavior = createClientBehavior("blur1", EnumSet.of(ClientBehaviorHint.SUBMITTING));
- behaviorsMap.put("blur", Arrays.asList(blurBehavior));
-
- return component;
- }
-
- @Test
- public void testDecodeActionBehaviors() throws Exception {
- UIComponent component = setupTestDecodeBehaviors(CLIENT_ID, "action");
-
- List<ClientBehavior> behaviors = behaviorsMap.get("action");
- for (ClientBehavior clientBehavior : behaviors) {
- clientBehavior.decode(same(facesContext), same(component));
- expectLastCall();
- }
-
- facesEnvironment.replay();
-
- RenderKitUtils.decodeBehaviors(facesContext, component);
-
- facesEnvironment.verify();
- }
-
- @Test
- public void testDecodeBlurBehaviors() throws Exception {
- UIComponent component = setupTestDecodeBehaviors(CLIENT_ID, "blur");
-
- List<ClientBehavior> behaviors = behaviorsMap.get("blur");
- for (ClientBehavior clientBehavior : behaviors) {
- clientBehavior.decode(same(facesContext), same(component));
- expectLastCall();
- }
-
- facesEnvironment.replay();
-
- RenderKitUtils.decodeBehaviors(facesContext, component);
-
- facesEnvironment.verify();
- }
-
- @Test
- public void testDecodeNonMatchingClientId() throws Exception {
- UIComponent component = setupTestDecodeBehaviors("wrongId", "action");
-
- //nothing should be called - clientId is not matched
-
- facesEnvironment.replay();
-
- RenderKitUtils.decodeBehaviors(facesContext, component);
-
- facesEnvironment.verify();
- }
-
- @Test
- public void testDecodeNoSubmittedBehavior() throws Exception {
- UIComponent component = setupTestDecodeBehaviors(CLIENT_ID, null);
-
- //nothing should be called - no behavior event information was submitted
-
- facesEnvironment.replay();
-
- RenderKitUtils.decodeBehaviors(facesContext, component);
-
- facesEnvironment.verify();
- }
-
- @Test
- public void testDecodeContextMenuBehaviors() throws Exception {
- UIComponent component = setupTestDecodeBehaviors(CLIENT_ID, "contextmenu");
-
- //nothing should be called - no context menu behaviors were created
-
- facesEnvironment.replay();
-
- RenderKitUtils.decodeBehaviors(facesContext, component);
-
- facesEnvironment.verify();
- }
}
\ No newline at end of file
Modified: root/framework/trunk/pom.xml
===================================================================
--- root/framework/trunk/pom.xml 2010-02-26 05:41:07 UTC (rev 16500)
+++ root/framework/trunk/pom.xml 2010-02-26 14:11:13 UTC (rev 16501)
@@ -46,12 +46,12 @@
<dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>htmlunit-client</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-mock</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
Modified: root/ui/trunk/version-matrix/pom.xml
===================================================================
--- root/ui/trunk/version-matrix/pom.xml 2010-02-26 05:41:07 UTC (rev 16500)
+++ root/ui/trunk/version-matrix/pom.xml 2010-02-26 14:11:13 UTC (rev 16501)
@@ -105,12 +105,12 @@
<dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>htmlunit-client</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-mock</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
14 years, 10 months
JBoss Rich Faces SVN: r16500 - in root/docs/trunk/Component_Reference/en-US: images and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-02-26 00:41:07 -0500 (Fri, 26 Feb 2010)
New Revision: 16500
Added:
root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jcommandButton-a4jcommandButton.png
root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jcommandLink-a4jcommandLink.png
root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jloadBundle-Add_a4jloadBundle_to_the_JSP_page.png
root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jloadBundle-Create_resource_bundles.png
Modified:
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Actions.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
Log:
Added screenshots for some components (RF-8417)
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Actions.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Actions.xml 2010-02-25 20:43:50 UTC (rev 16499)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Actions.xml 2010-02-26 05:41:07 UTC (rev 16500)
@@ -163,6 +163,19 @@
</para>
</listitem>
</itemizedlist>
+ <figure id="figu-Component_Reference-a4jcommandButton-a4jcommandButton">
+ <title><sgmltag><a4j:commandButton></sgmltag></title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-a4jcommandButton-a4jcommandButton.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ A typical <sgmltag><a4j:commandButton></sgmltag> component.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
<para>
The <sgmltag><a4j:commandButton></sgmltag> is similar to the JavaServer Faces (<acronym>JSF</acronym>) component <sgmltag><h:commandButton></sgmltag>, but additionally includes Ajax support. When the command button is clicked it generates an Ajax form submit, and when a response is received the command button can be dynamically rendered.
</para>
@@ -201,6 +214,19 @@
</para>
</listitem>
</itemizedlist>
+ <figure id="figu-Component_Reference-a4jcommandLink-a4jcommandLink">
+ <title><sgmltag><a4j:commandLink></sgmltag></title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-a4jcommandLink-a4jcommandLink.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ A typical <sgmltag><a4j:commandLink></sgmltag> component.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
<para>
The <sgmltag><a4j:commandLink></sgmltag> is similar to the JavaServer Faces (<acronym>JSF</acronym>) component <sgmltag><h:commandLink></sgmltag>, but additionally includes Ajax support. When the command link is clicked it generates an Ajax form submit, and when a response is received the command link can be dynamically rendered.
</para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2010-02-25 20:43:50 UTC (rev 16499)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2010-02-26 05:41:07 UTC (rev 16500)
@@ -45,6 +45,16 @@
<para>
String resource bundles are contained in files with a <filename class="extension">.properties</filename> extension. The files consist of a list of entries, each with a unique name and a corresponding value. A seperate file is required for each language. Append the filename with the locale identifier (<literal>en</literal> for English, for example).
</para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-a4jloadBundle-Create_resource_bundles.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ Resource bundles for English (<literal>en</literal>), German (<literal>de</literal>), and Italian (<literal>it</literal>). A single entry (<literal>greeting</literal>) has been localized for each bundle.
+ </para>
+ </textobject>
+ </mediaobject>
</step>
<step id="step-Component_Reference-a4jloadBundle_example-Register_bundles_in_Faces_configuration_file">
<title>Register bundles in Faces configuration file</title>
@@ -75,6 +85,16 @@
<programlisting language="XML" role="XML">
<xi:include href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-a4jloadBundle-Add_a4jloadBundle_to_the_JSP_page.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ The output text displayed on a page. It can be changed by clicking the command link for either German, English, or Italian.
+ </para>
+ </textobject>
+ </mediaobject>
</step>
</procedure>
Added: root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jcommandButton-a4jcommandButton.png
===================================================================
(Binary files differ)
Property changes on: root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jcommandButton-a4jcommandButton.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jcommandLink-a4jcommandLink.png
===================================================================
(Binary files differ)
Property changes on: root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jcommandLink-a4jcommandLink.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jloadBundle-Add_a4jloadBundle_to_the_JSP_page.png
===================================================================
(Binary files differ)
Property changes on: root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jloadBundle-Add_a4jloadBundle_to_the_JSP_page.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jloadBundle-Create_resource_bundles.png
===================================================================
(Binary files differ)
Property changes on: root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jloadBundle-Create_resource_bundles.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 10 months
JBoss Rich Faces SVN: r16498 - in root/framework/trunk: impl/src/test/java/org/richfaces/model and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-02-25 13:58:25 -0500 (Thu, 25 Feb 2010)
New Revision: 16498
Added:
root/framework/trunk/api/src/main/java/org/richfaces/model/Field.java
root/framework/trunk/api/src/main/java/org/richfaces/model/Filter.java
root/framework/trunk/api/src/main/java/org/richfaces/model/FilterField.java
root/framework/trunk/api/src/main/java/org/richfaces/model/LocaleAware.java
root/framework/trunk/api/src/main/java/org/richfaces/model/Modifiable.java
root/framework/trunk/api/src/main/java/org/richfaces/model/ModifiableState.java
root/framework/trunk/api/src/main/java/org/richfaces/model/SortField.java
root/framework/trunk/impl/src/test/java/org/richfaces/model/ModifiableModel.java
root/framework/trunk/impl/src/test/java/org/richfaces/model/ModifiableStateDefaultImpl.java
Log:
RF-8118 RF-8119
Added: root/framework/trunk/api/src/main/java/org/richfaces/model/Field.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/Field.java (rev 0)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/Field.java 2010-02-25 18:58:25 UTC (rev 16498)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.model;
+
+import javax.el.ValueExpression;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public abstract class Field {
+
+ private ValueExpression expression;
+
+ public Field(ValueExpression expression) {
+ this.expression = expression;
+ }
+
+ protected ValueExpression getExpression() {
+ return expression;
+ }
+}
Added: root/framework/trunk/api/src/main/java/org/richfaces/model/Filter.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/Filter.java (rev 0)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/Filter.java 2010-02-25 18:58:25 UTC (rev 16498)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.model;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public interface Filter<T> {
+
+ boolean accept(T t);
+}
Added: root/framework/trunk/api/src/main/java/org/richfaces/model/FilterField.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/FilterField.java (rev 0)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/FilterField.java 2010-02-25 18:58:25 UTC (rev 16498)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.model;
+
+import javax.el.ValueExpression;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class FilterField extends Field{
+
+ private Filter<?> filter;
+
+ private String filterValue;
+
+ public FilterField(ValueExpression filterExpression, Filter<?> filter, String filterValue) {
+ super(filterExpression);
+ this.filter = filter;
+ this.filterValue = filterValue;
+ }
+
+ public ValueExpression getFilterExpression() {
+ return getExpression();
+ }
+
+ public Filter<?> getFilter() {
+ return filter;
+ }
+
+ public String getFilterValue() {
+ return filterValue;
+ }
+}
Added: root/framework/trunk/api/src/main/java/org/richfaces/model/LocaleAware.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/LocaleAware.java (rev 0)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/LocaleAware.java 2010-02-25 18:58:25 UTC (rev 16498)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.model;
+
+import java.util.Locale;
+
+/**
+ * Models that are based on locale-dependent operations should implement this interface
+ *
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public interface LocaleAware {
+
+ Locale getLocale();
+
+ void setLocale(Locale locale);
+}
Added: root/framework/trunk/api/src/main/java/org/richfaces/model/Modifiable.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/Modifiable.java (rev 0)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/Modifiable.java 2010-02-25 18:58:25 UTC (rev 16498)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.model;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public interface Modifiable {
+
+ void modify(ModifiableState state);
+}
Added: root/framework/trunk/api/src/main/java/org/richfaces/model/ModifiableState.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/ModifiableState.java (rev 0)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/ModifiableState.java 2010-02-25 18:58:25 UTC (rev 16498)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.model;
+
+import java.util.List;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public interface ModifiableState {
+
+ List<FilterField> getFilterFields();
+
+ List<SortField> getSortFields();
+}
Added: root/framework/trunk/api/src/main/java/org/richfaces/model/SortField.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/SortField.java (rev 0)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/SortField.java 2010-02-25 18:58:25 UTC (rev 16498)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.model;
+
+import java.util.Comparator;
+
+import javax.el.ValueExpression;
+import javax.swing.SortOrder;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class SortField extends Field {
+
+ private Comparator<?> comparator;
+
+ private SortOrder order;
+
+ public SortField(ValueExpression sortBy, Comparator<?> comparator, SortOrder order) {
+ super(sortBy);
+ this.comparator = comparator;
+ this.order = order;
+ }
+
+ public ValueExpression getSortBy() {
+ return getExpression();
+ }
+
+ public Comparator<?> getComparator() {
+ return comparator;
+ }
+
+ public SortOrder getSortOrder() {
+ return order;
+ }
+}
Added: root/framework/trunk/impl/src/test/java/org/richfaces/model/ModifiableModel.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/richfaces/model/ModifiableModel.java (rev 0)
+++ root/framework/trunk/impl/src/test/java/org/richfaces/model/ModifiableModel.java 2010-02-25 18:58:25 UTC (rev 16498)
@@ -0,0 +1,381 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.model;
+
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.model.DataModelListener;
+import javax.swing.SortOrder;
+
+import org.ajax4jsf.model.DataVisitResult;
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+import org.ajax4jsf.model.SequenceRange;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class ModifiableModel extends ExtendedDataModel<Object> implements Modifiable, LocaleAware {
+
+ protected FacesContext context;
+
+ protected ELContext elContext;
+
+ protected Map<String, Object> requestMap;
+
+ protected ModifiableState state;
+
+ protected List<Object> rowKeys;
+
+ protected ExtendedDataModel<?> originalModel;
+
+ protected String var;
+
+ protected String filterVar;
+
+ protected Locale locale;
+
+ private Comparator<? super String> stringComparator;
+
+ public ModifiableModel(ExtendedDataModel<?> originalModel, String var, String filterVar) {
+ this(FacesContext.getCurrentInstance(), originalModel, var, filterVar);
+ }
+
+ public ModifiableModel(FacesContext context, ExtendedDataModel<?> originalModel, String var, String filterVar) {
+ this.context = context;
+ elContext = context.getELContext();
+ requestMap = context.getExternalContext().getRequestMap();
+ this.originalModel = originalModel;
+ this.var = var;
+ this.filterVar = filterVar;
+ }
+
+ @Override
+ public void addDataModelListener(DataModelListener listener) {
+ originalModel.addDataModelListener(listener);
+ }
+
+ @Override
+ public DataModelListener[] getDataModelListeners() {
+ return originalModel.getDataModelListeners();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.model.ExtendedDataModel#getRowKey()
+ */
+ @Override
+ public Object getRowKey() {
+ return originalModel.getRowKey();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.model.ExtendedDataModel#setRowKey(java.lang.Object)
+ */
+ @Override
+ public void setRowKey(Object key) {
+ originalModel.setRowKey(key);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.model.ExtendedDataModel#walk(javax.faces.context.FacesContext, org.ajax4jsf.model.DataVisitor,
+ * org.ajax4jsf.model.Range, java.lang.Object)
+ */
+ @Override
+ public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) {
+ final SequenceRange seqRange = (SequenceRange) range;
+ int rows = seqRange.getRows();
+ int rowCount = getRowCount();
+ int currentRow = seqRange.getFirstRow();
+ if (rows > 0) {
+ rows += currentRow;
+ rows = Math.min(rows, rowCount);
+ } else {
+ rows = rowCount;
+ }
+ for (; currentRow < rows; currentRow++) {
+ visitor.process(context, rowKeys.get(currentRow), argument);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getRowCount()
+ */
+ @Override
+ public int getRowCount() {
+ if (rowKeys == null) {
+ return -1;
+ } else {
+ return rowKeys.size();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getRowData()
+ */
+ @Override
+ public Object getRowData() {
+ return originalModel.getRowData();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getRowIndex()
+ */
+ @Override
+ public int getRowIndex() {
+ return rowKeys.indexOf(originalModel.getRowKey());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getWrappedData()
+ */
+ @Override
+ public Object getWrappedData() {
+ return originalModel.getWrappedData();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#isRowAvailable()
+ */
+ @Override
+ public boolean isRowAvailable() {
+ return originalModel.isRowAvailable();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#setRowIndex(int)
+ */
+ @Override
+ public void setRowIndex(int rowIndex) {
+ Object originalKey = null;
+ if (rowIndex >= 0 && rowIndex < rowKeys.size()) {
+ originalKey = rowKeys.get(rowIndex);
+ }
+ originalModel.setRowKey(originalKey);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#setWrappedData(java.lang.Object)
+ */
+ @Override
+ public void setWrappedData(Object data) {
+ originalModel.setWrappedData(data);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.model.Modifiable#modify(org.richfaces.model.ModifiableState)
+ */
+ public void modify(ModifiableState state) {
+ this.state = state;
+ int rowCount = originalModel.getRowCount();
+
+ if (rowCount > 0) {
+ rowKeys = new ArrayList<Object>(rowCount);
+ } else {
+ rowKeys = new ArrayList<Object>();
+ }
+ Object rowKey = originalModel.getRowKey();
+ originalModel.walk(context, new DataVisitor() {
+ public DataVisitResult process(FacesContext context, Object rowKey, Object argument) {
+ originalModel.setRowKey(rowKey);
+ if (originalModel.isRowAvailable()) {
+ rowKeys.add(rowKey);
+ }
+ return DataVisitResult.CONTINUE;
+ }
+ }, new SequenceRange(0, -1), null);
+ if (this.state != null) {
+ filter();
+ sort();
+ }
+ originalModel.setRowKey(rowKey);
+ }
+
+ protected void filter() {
+ List<FilterField> filterFields = state.getFilterFields();
+ if (filterFields != null && !filterFields.isEmpty()) {
+ List<Object> filteredCollection = new ArrayList<Object>();
+ for (Object rowKey : rowKeys) {
+ if (accept(rowKey)) {
+ filteredCollection.add(rowKey);
+ }
+ }
+ rowKeys = filteredCollection;
+ }
+ }
+
+ protected void sort() {
+ List<SortField> sortFields = state.getSortFields();
+ if (sortFields != null && !sortFields.isEmpty()) {
+ Collections.sort(rowKeys, new Comparator<Object>() {
+ public int compare(Object rowKey1, Object rowKey2) {
+ return ModifiableModel.this.compare(rowKey1, rowKey2);
+ }
+ });
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected boolean accept(Object rowKey) {
+ originalModel.setRowKey(rowKey);
+ Object object = originalModel.getRowData();
+ updateVar(var, object);
+ for (FilterField filterField : state.getFilterFields()) {
+ Filter filter = filterField.getFilter();
+ if (filter != null) {
+ return filter.accept(object);
+ } else {
+ ValueExpression filterExpression = filterField.getFilterExpression();
+ if (filterExpression != null) {
+ updateVar(filterVar, filterField.getFilterValue());
+ if (Boolean.FALSE.equals(filterExpression.getValue(elContext))) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected int compare(Object rowKey1, Object rowKey2) {
+ originalModel.setRowKey(rowKey1);
+ Object object1 = originalModel.getRowData();
+ originalModel.setRowKey(rowKey2);
+ Object object2 = originalModel.getRowData();
+ int result = 0;
+ for (Iterator<SortField> iterator = state.getSortFields().iterator(); iterator.hasNext() && result == 0;) {
+ SortField sortField = iterator.next();
+ SortOrder sortOrder = sortField.getSortOrder();
+ if (sortOrder != null && !SortOrder.UNSORTED.equals(sortOrder)) {
+ Comparator comparator = sortField.getComparator();
+ if (comparator != null) {
+ result = comparator.compare(object1, object2);
+ } else {
+ ValueExpression sortBy = sortField.getSortBy();
+ if (sortBy != null) {
+ updateVar(var, object1);
+ Object value1 = sortBy.getValue(elContext);
+ updateVar(var, object2);
+ Object value2 = sortBy.getValue(elContext);
+ result = compareSortByValues(value1, value2);
+ }
+ }
+ if (SortOrder.DESCENDING.equals(sortOrder)) {
+ result = -result;
+ }
+ }
+ }
+ return 0;
+ }
+
+ @SuppressWarnings("unchecked")
+ private int compareSortByValues(Object value1, Object value2) {
+ int result = 0;
+ if (value1 instanceof String && value2 instanceof String) {
+ if (stringComparator == null) {
+ stringComparator = createStringComparator();
+ }
+ result = stringComparator.compare(((String) value1).trim(), ((String) value2).trim());
+ } else if (value1 instanceof Comparable<?>) {
+ result = ((Comparable) value1).compareTo(value2);
+ } else if (value1 == null && value2 != null) {
+ result = -1;
+ } else if (value2 == null && value1 != null) {
+ result = 1;
+ }
+ return result;
+ }
+
+ private Comparator<? super String> createStringComparator() {
+ Comparator<? super String> comparator = null;
+ if (locale != null) {
+ comparator = Collator.getInstance(locale);
+ } else {
+ comparator = new Comparator<String>() {
+ public int compare(String o1, String o2) {
+ return o1.compareToIgnoreCase(o2);
+ }
+ };
+ }
+ return comparator;
+ }
+
+ private void updateVar(String var, Object value) {
+ if (var != null && var.length() > 0) {
+ requestMap.put(var, value);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.model.LocaleAware#getLocale()
+ */
+ public Locale getLocale() {
+ return locale;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.model.LocaleAware#setLocale(java.util.Locale)
+ */
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+}
Added: root/framework/trunk/impl/src/test/java/org/richfaces/model/ModifiableStateDefaultImpl.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/richfaces/model/ModifiableStateDefaultImpl.java (rev 0)
+++ root/framework/trunk/impl/src/test/java/org/richfaces/model/ModifiableStateDefaultImpl.java 2010-02-25 18:58:25 UTC (rev 16498)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.model;
+
+import java.util.List;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class ModifiableStateDefaultImpl implements ModifiableState {
+
+ private List<FilterField> filterFields;
+
+ private List<SortField> sortFields;
+
+ public ModifiableStateDefaultImpl(List<FilterField> filterFields, List<SortField> sortFields) {
+ this.filterFields = filterFields;
+ this.sortFields = sortFields;
+ }
+
+ public List<FilterField> getFilterFields() {
+ return filterFields;
+ }
+
+ public List<SortField> getSortFields() {
+ return sortFields;
+ }
+}
14 years, 10 months
JBoss Rich Faces SVN: r16497 - root/framework/trunk.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-02-25 13:08:11 -0500 (Thu, 25 Feb 2010)
New Revision: 16497
Modified:
root/framework/trunk/pom.xml
Log:
fix checkstyle for sonar
Modified: root/framework/trunk/pom.xml
===================================================================
--- root/framework/trunk/pom.xml 2010-02-25 16:07:00 UTC (rev 16496)
+++ root/framework/trunk/pom.xml 2010-02-25 18:08:11 UTC (rev 16497)
@@ -94,39 +94,6 @@
</dependency>
</dependencies>
- <!--<build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.3</version>
-
- <dependencies>
- <dependency>
- <groupId>org.richfaces</groupId>
- <artifactId>checkstyle</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <executions>
- <execution>
- <id>richfaces-checkstyle-report</id>
- <configuration>
- <configLocation>richfaces-checkstyle/richfaces-checkstyle.xml</configLocation>
- <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
- </configuration>
-
- <phase>process-sources</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>-->
-
<reporting>
<plugins>
<plugin>
@@ -181,6 +148,51 @@
</clover.license.path>
</properties>
</profile>
+ <profile>
+ <id>checkstyle</id>
+ <!--
+ It is a clever way to skip checkstyle for a sonar.
+ If you want skip checkstyle add "fast" parametr (means add "-Dfast" in command line)
+ -->
+ <activation>
+ <property>
+ <name>!fast</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.3</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>richfaces-checkstyle-report</id>
+ <configuration>
+ <configLocation>richfaces-checkstyle/richfaces-checkstyle.xml</configLocation>
+ <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
+ </configuration>
+
+ <phase>process-sources</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
</profiles>
</project>
14 years, 10 months
JBoss Rich Faces SVN: r16496 - root/framework/trunk.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-02-25 11:07:00 -0500 (Thu, 25 Feb 2010)
New Revision: 16496
Modified:
root/framework/trunk/pom.xml
Log:
test checkstyle fjr sonar
Modified: root/framework/trunk/pom.xml
===================================================================
--- root/framework/trunk/pom.xml 2010-02-25 14:10:38 UTC (rev 16495)
+++ root/framework/trunk/pom.xml 2010-02-25 16:07:00 UTC (rev 16496)
@@ -94,7 +94,7 @@
</dependency>
</dependencies>
- <build>
+ <!--<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -125,7 +125,7 @@
</executions>
</plugin>
</plugins>
- </build>
+ </build>-->
<reporting>
<plugins>
@@ -182,4 +182,5 @@
</properties>
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
+
14 years, 10 months
JBoss Rich Faces SVN: r16495 - management/design-4x/dataScroller.
by richfaces-svn-commits@lists.jboss.org
Author: admitriev
Date: 2010-02-25 09:10:38 -0500 (Thu, 25 Feb 2010)
New Revision: 16495
Modified:
management/design-4x/dataScroller/dataScroller.html
Log:
Modified: management/design-4x/dataScroller/dataScroller.html
===================================================================
--- management/design-4x/dataScroller/dataScroller.html 2010-02-25 14:08:14 UTC (rev 16494)
+++ management/design-4x/dataScroller/dataScroller.html 2010-02-25 14:10:38 UTC (rev 16495)
@@ -5,7 +5,7 @@
<title>dataScroller markup</title>
<style>
-.ds_container{ display : inline-block; font-size : 11px/*generalSizeFont*/; padding : 1px; font-family : verdana/*generalFamilyFont*/; background : #ffffff/*background-color - tableBackgroundColor*/;}
+.ds_container{ white-space : nowrap; display : inline-block; font-size : 11px/*generalSizeFont*/; padding : 1px; font-family : verdana/*generalFamilyFont*/; background : #ffffff/*background-color - tableBackgroundColor*/;}
.ds_container_decor{ border : 1px solid #A6A6A6/*tableBorderColor*/;}
.ds_button{ cursor : pointer; padding : 2px 10px 3px 10px; border : 1px solid #A6A6A6/*tableBorderColor*/; display : inline-block; background : url(images/bg_btn.png) top left repeat-x #C0D1E7/*gradient - from headerGradientColor to headerBackgroundColor, background-color - headerBackgroundColor*/; font-size : 11px/*generalSizeFont*/; font-family : verdana/*generalFamilyFont*/; color : #000000/*generalTextColor*/;}
.ds_left{ margin-right : 1px;}
14 years, 10 months
JBoss Rich Faces SVN: r16494 - in management/design-4x: dataScroller and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: admitriev
Date: 2010-02-25 09:08:14 -0500 (Thu, 25 Feb 2010)
New Revision: 16494
Added:
management/design-4x/dataScroller/
management/design-4x/dataScroller/dataScroller.html
management/design-4x/dataScroller/images/
management/design-4x/dataScroller/images/bg_btn.png
management/design-4x/dataScroller/images/bg_field.png
Log:
Added: management/design-4x/dataScroller/dataScroller.html
===================================================================
--- management/design-4x/dataScroller/dataScroller.html (rev 0)
+++ management/design-4x/dataScroller/dataScroller.html 2010-02-25 14:08:14 UTC (rev 16494)
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
+
+<html>
+<head>
+ <title>dataScroller markup</title>
+<style>
+
+.ds_container{ display : inline-block; font-size : 11px/*generalSizeFont*/; padding : 1px; font-family : verdana/*generalFamilyFont*/; background : #ffffff/*background-color - tableBackgroundColor*/;}
+.ds_container_decor{ border : 1px solid #A6A6A6/*tableBorderColor*/;}
+.ds_button{ cursor : pointer; padding : 2px 10px 3px 10px; border : 1px solid #A6A6A6/*tableBorderColor*/; display : inline-block; background : url(images/bg_btn.png) top left repeat-x #C0D1E7/*gradient - from headerGradientColor to headerBackgroundColor, background-color - headerBackgroundColor*/; font-size : 11px/*generalSizeFont*/; font-family : verdana/*generalFamilyFont*/; color : #000000/*generalTextColor*/;}
+.ds_left{ margin-right : 1px;}
+.ds_right{ margin-left : 1px;}
+.ds_digital{ cursor : pointer; width : 2em; text-align : center; margin-left : 1px; margin-right : 1px; padding : 2px 2px 3px 2px; border : 1px solid transparent; border-top : 1px solid #A6A6A6/*tableBorderColor*/; background : url(images/bg_field.png) top left repeat-x/*gradient - from additionalBackgroundColor to tableBackgroundColor, background-color - tableBackgroundColor*/; display : inline-block; font-size : 11px/*generalSizeFont*/; font-family : verdana/*generalFamilyFont*/; color : #000000/*generalTextColor*/;}
+.ds_over{ border : 1px solid #A6A6A6/*tableBorderColor*/; background : url(images/bg_field.png) top left repeat-x #FFFFFF; /*gradient - from additionalBackgroundColor to tableBackgroundColor, background-color - tableBackgroundColor*/;}
+.ds_press{ border : 1px solid #A6A6A6/*tableBorderColor*/; background : #ECF3FA; /*background-color - additionalBackgroundColor*/;}
+.ds_current{ cursor : default; font-weight : bold; border : 1px solid transparent; border-bottom : 1px solid #A6A6A6/*tableBorderColor*/; background : none;}
+.ds_disabled{ color : #A6A6A6/*tableBorderColor*/; cursor : default;}
+
+</style>
+</head>
+
+<body style="margin : 30px">
+
+
+<span class="ds_container !ds_container_decor"><!-- Now decor is disabled !!! -->
+ <span class="ds_button ds_left ds_disabled">
+ ««
+ </span><span
+ class="ds_button ds_left ds_disabled">
+ «
+ </span><span
+ class="ds_digital" onmouseover="this.className='ds_digital ds_over'" onmouseout="this.className='ds_digital'" onmouseup="this.className='ds_digital ds_over'" onmousedown="this.className='ds_digital ds_press'">
+ 1
+ </span><span
+ class="ds_digital" onmouseover="this.className='ds_digital ds_over'" onmouseout="this.className='ds_digital'" onmouseup="this.className='ds_digital ds_over'" onmousedown="this.className='ds_digital ds_press'">
+ 2
+ </span><span
+ class="ds_digital" onmouseover="this.className='ds_digital ds_over'" onmouseout="this.className='ds_digital'" onmouseup="this.className='ds_digital ds_over'" onmousedown="this.className='ds_digital ds_press'">
+ 3
+ </span><span
+ class="ds_digital" onmouseover="this.className='ds_digital ds_over'" onmouseout="this.className='ds_digital'" onmouseup="this.className='ds_digital ds_over'" onmousedown="this.className='ds_digital ds_press'">
+ 4
+ </span><span
+ class="ds_digital ds_current">
+ 5
+ </span><span
+ class="ds_digital" onmouseover="this.className='ds_digital ds_over'" onmouseout="this.className='ds_digital'" onmouseup="this.className='ds_digital ds_over'" onmousedown="this.className='ds_digital ds_press'">
+ 6
+ </span><span
+ class="ds_digital" onmouseover="this.className='ds_digital ds_over'" onmouseout="this.className='ds_digital'" onmouseup="this.className='ds_digital ds_over'" onmousedown="this.className='ds_digital ds_press'">
+ 7
+ </span><span
+ class="ds_digital" onmouseover="this.className='ds_digital ds_over'" onmouseout="this.className='ds_digital'" onmouseup="this.className='ds_digital ds_over'" onmousedown="this.className='ds_digital ds_press'">
+ 8
+ </span><span
+ class="ds_digital ds_disabled">
+ 9
+ </span><span
+ class="ds_digital ds_disabled">
+ 10
+ </span><span
+ class="ds_button ds_right" onmousedown="this.className='ds_button ds_right ds_over'" onmouseup="this.className='ds_button ds_right'" onmouseout="this.className='ds_button ds_right'">
+ »
+ </span><span
+ class="ds_button ds_right" onmousedown="this.className='ds_button ds_right ds_over'" onmouseup="this.className='ds_button ds_right'" onmouseout="this.className='ds_button ds_right'">
+ »»
+ </span>
+</span>
+
+
+</body>
+</html>
Added: management/design-4x/dataScroller/images/bg_btn.png
===================================================================
(Binary files differ)
Property changes on: management/design-4x/dataScroller/images/bg_btn.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design-4x/dataScroller/images/bg_field.png
===================================================================
(Binary files differ)
Property changes on: management/design-4x/dataScroller/images/bg_field.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 10 months