JBoss Rich Faces SVN: r16221 - in root/framework/trunk: impl/src/main/java/org/ajax4jsf/renderkit and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-12-29 11:53:57 -0500 (Tue, 29 Dec 2009)
New Revision: 16221
Added:
root/framework/trunk/impl/src/test/java/org/richfaces/component/DataAdaptorTestCase.java
root/framework/trunk/impl/src/test/java/org/richfaces/component/MockDataAdaptor.java
root/framework/trunk/impl/src/test/java/org/richfaces/component/MockDataAdaptorComponentState.java
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceDataModel.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/HandlersChain.java
root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java
root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
root/framework/trunk/test-base/
Log:
Fixes & refactoring for:
- UIDataAdaptor and related code
- PartialViewContextImpl
JUnit tests for UIDataAdaptor
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceDataModel.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceDataModel.java 2009-12-29 16:52:35 UTC (rev 16220)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/model/SequenceDataModel.java 2009-12-29 16:53:57 UTC (rev 16221)
@@ -30,13 +30,14 @@
* @author shura
*
*/
-public class SequenceDataModel extends ExtendedDataModel {
- private DataModel wrappedModel;
+public class SequenceDataModel<E> extends ExtendedDataModel<E> {
+
+ private DataModel<E> wrappedModel;
/**
* @param wrapped
*/
- public SequenceDataModel(DataModel wrapped) {
+ public SequenceDataModel(DataModel<E> wrapped) {
super();
this.wrappedModel = wrapped;
}
@@ -160,7 +161,7 @@
* (non-Javadoc)
* @see javax.faces.model.DataModel#getRowData()
*/
- public Object getRowData() {
+ public E getRowData() {
// TODO Auto-generated method stub
return wrappedModel.getRowData();
@@ -215,14 +216,14 @@
/**
* @return the wrappedModel
*/
- protected DataModel getWrappedModel() {
+ protected DataModel<E> getWrappedModel() {
return this.wrappedModel;
}
/**
* @param wrappedModel the wrappedModel to set
*/
- protected void setWrappedModel(DataModel wrappedModel) {
+ protected void setWrappedModel(DataModel<E> wrappedModel) {
this.wrappedModel = wrappedModel;
}
}
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/HandlersChain.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/HandlersChain.java 2009-12-29 16:52:35 UTC (rev 16220)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/HandlersChain.java 2009-12-29 16:53:57 UTC (rev 16221)
@@ -116,17 +116,17 @@
addInlineHandlerAsValue(context, (String) component.getAttributes().get(attributeName));
}
- public void addBehaviors(FacesContext context, String evantName) {
- addBehaviors(context, evantName, null);
+ public void addBehaviors(FacesContext context, String domEventName) {
+ addBehaviors(context, domEventName, null);
}
- public void addBehaviors(FacesContext context, String evantName, String defaultEventName) {
- String name = evantName;
- List<ClientBehavior> behaviorsList = getBehaviorsList(evantName);
+ public void addBehaviors(FacesContext context, String domEventName, String logicalEventName) {
+ String name = domEventName;
+ List<ClientBehavior> behaviorsList = getBehaviorsList(domEventName);
- if ((behaviorsList == null) && (defaultEventName != null)) {
- behaviorsList = getBehaviorsList(defaultEventName);
- name = defaultEventName;
+ if ((behaviorsList == null) && (logicalEventName != null)) {
+ behaviorsList = getBehaviorsList(logicalEventName);
+ name = logicalEventName;
}
if (behaviorsList == null) {
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java 2009-12-29 16:52:35 UTC (rev 16220)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/component/UIDataAdaptor.java 2009-12-29 16:53:57 UTC (rev 16221)
@@ -22,16 +22,15 @@
package org.richfaces.component;
-import org.ajax4jsf.component.AjaxDataEncoder;
-import org.ajax4jsf.component.IterationStateHolder;
-import org.ajax4jsf.model.DataComponentState;
-import org.ajax4jsf.model.DataVisitResult;
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.Range;
-import org.ajax4jsf.model.SerializableDataModel;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import java.io.IOException;
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
import javax.el.ValueExpression;
import javax.faces.FacesException;
@@ -58,16 +57,18 @@
import javax.faces.event.BehaviorEvent;
import javax.faces.event.FacesEvent;
import javax.faces.render.Renderer;
-import java.io.IOException;
-import java.io.Serializable;
-import java.text.MessageFormat;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
+import org.ajax4jsf.component.AjaxDataEncoder;
+import org.ajax4jsf.component.IterationStateHolder;
+import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.DataVisitResult;
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+import org.ajax4jsf.model.SerializableDataModel;
+import org.richfaces.log.RichfacesLogger;
+import org.slf4j.Logger;
+
/**
* Base class for iterable components, like dataTable, Tomahawk dataList,
* Facelets repeat, tree etc., with support for partial rendering on AJAX
@@ -505,7 +506,7 @@
getStateHelper().put(PropertyKeys.stateVar, stateVar);
}
- // TODO - review and probably remove
+ //XXX - review and probably remove - useful method, should be left
public int getRowCount() {
return getExtendedDataModel().getRowCount();
}
@@ -631,6 +632,7 @@
// Store converter for a invokeOnComponents call.
if (null != rowKeyConverter) {
+ //TODO - review
setRowKeyConverter(rowKeyConverter);
}
}
@@ -1005,6 +1007,7 @@
// Call for a child component - try to detect row key
// baseId.length() + 1 expression skips SEPARATOR_CHAR
+ //TODO - convertKeyString
String rowKeyString = extractKeySegment(context, clientId.substring(baseId.length() + 1));
if (rowKeyString != null) {
@@ -1012,6 +1015,7 @@
if (null != keyConverter) {
try {
+ //TODO: review
newRowKey = keyConverter.getAsObject(context, this, rowKeyString);
} catch (ConverterException e) {
@@ -1050,28 +1054,6 @@
return found;
}
- // Performs pre-phase initialization before visiting children
- // (if necessary).
- // TODO - do we need this?
- private void preVisitChildren(VisitContext visitContext) {
-
-// // If EXECUTE_LIFECYCLE hint is set, we need to do
-// // lifecycle-related initialization before visiting children
-// if (visitContext.getHints().contains(VisitHint.EXECUTE_LIFECYCLE)) {
-// FacesContext facesContext = visitContext.getFacesContext();
-// PhaseId phaseId = facesContext.getCurrentPhaseId();
-//
-// if (phaseId == PhaseId.APPLY_REQUEST_VALUES)
-// preDecode(facesContext);
-// else if (phaseId == PhaseId.PROCESS_VALIDATIONS)
-// preValidate(facesContext);
-// else if (phaseId == PhaseId.UPDATE_MODEL_VALUES)
-// preUpdate(facesContext);
-// else if (phaseId == PhaseId.RENDER_RESPONSE)
-// preEncode(facesContext);
-// }
- }
-
// Tests whether we need to visit our children as part of
// a tree visit
private boolean doVisitChildren(VisitContext context) {
@@ -1200,6 +1182,7 @@
* @param substring
* @return
*/
+ //TODO review!
protected String extractKeySegment(FacesContext context, String substring) {
return null;
}
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2009-12-29 16:52:35 UTC (rev 16220)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2009-12-29 16:53:57 UTC (rev 16221)
@@ -204,7 +204,8 @@
try {
processComponents(viewRoot, phaseId, ids, facesContext);
} catch (Exception e) {
- // RELEASE_PENDING LOG EXCEPTION
+ //TODO log exception
+ e.printStackTrace();
}
// If we have just finished APPLY_REQUEST_VALUES phase, install the
@@ -250,6 +251,7 @@
writer.endDocument();
} catch (IOException ex) {
+ ex.printStackTrace();
//TODO - review?
this.cleanupAfterView();
} catch (RuntimeException ex) {
Added: root/framework/trunk/impl/src/test/java/org/richfaces/component/DataAdaptorTestCase.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/richfaces/component/DataAdaptorTestCase.java (rev 0)
+++ root/framework/trunk/impl/src/test/java/org/richfaces/component/DataAdaptorTestCase.java 2009-12-29 16:53:57 UTC (rev 16221)
@@ -0,0 +1,503 @@
+/*
+ * 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.component;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.faces.component.ContextCallback;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UINamingContainer;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitHint;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PhaseId;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.event.ValueChangeListener;
+import javax.faces.model.ListDataModel;
+
+import org.ajax4jsf.component.IterationStateHolder;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.SequenceDataModel;
+import org.jboss.test.faces.AbstractFacesTest;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class DataAdaptorTestCase extends AbstractFacesTest {
+
+ private static final String VAR_NAME = "item";
+
+ private static class TestCallback {
+
+ private int value;
+
+ public void handle() {
+
+ }
+
+ public void reset() {
+ value = 0;
+ }
+
+ public int getAndIncrement() {
+ return value++;
+ }
+
+ public int get() {
+ return value;
+ }
+ }
+
+ private MockDataAdaptor mockDataAdaptor;
+
+ private List<String> data;
+
+ private ExtendedDataModel<String> createDataModel() {
+ return new SequenceDataModel<String>(new ListDataModel<String>(new ArrayList<String>(data)));
+ }
+
+ private Object getVarValue() {
+ return facesContext.getApplication().evaluateExpressionGet(facesContext,
+ MessageFormat.format("#'{'{0}'}'", VAR_NAME), Object.class);
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ data = Arrays.asList("a", "b", "c", "d");
+
+ setupFacesRequest();
+
+ mockDataAdaptor = new MockDataAdaptor();
+ mockDataAdaptor.setDataModel(createDataModel());
+ mockDataAdaptor.setVar(VAR_NAME);
+
+ facesContext.getViewRoot().getChildren().add(mockDataAdaptor);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ data = null;
+ mockDataAdaptor = null;
+ }
+
+ private void resetCallbacks(TestCallback... callbacks) {
+ for (TestCallback callback : callbacks) {
+ callback.reset();
+ assertEquals(0, callback.get());
+ }
+ }
+
+ private UIComponent createCallbackComponent(final TestCallback callback) throws Exception {
+ return new HtmlOutputText() {
+
+ private void notifyCallbacks() {
+ callback.handle();
+ }
+
+ @Override
+ public void processDecodes(FacesContext context) {
+ super.processDecodes(context);
+ notifyCallbacks();
+ }
+
+ @Override
+ public void processValidators(FacesContext context) {
+ super.processValidators(context);
+ notifyCallbacks();
+ }
+
+ @Override
+ public void processUpdates(FacesContext context) {
+ super.processUpdates(context);
+ notifyCallbacks();
+ }
+ };
+ }
+
+ public void testProcessChildren() throws Exception {
+
+ TestCallback childCallback = new TestCallback() {
+ @Override
+ public void handle() {
+ assertEquals(getVarValue(), data.get(getAndIncrement()));
+ }
+ };
+ UIComponent child = createCallbackComponent(childCallback);
+ child.setId("child");
+
+ TestCallback facetCallback = new TestCallback() {
+ @Override
+ public void handle() {
+ assertEquals(getVarValue(), data.get(getAndIncrement()));
+ }
+ };
+ UIComponent facet = createCallbackComponent(facetCallback);
+ child.getFacets().put("f", facet);
+ facet.setId("facet");
+
+ TestCallback immediateFacetCallback = new TestCallback() {
+ @Override
+ public void handle() {
+ getAndIncrement();
+ assertNull(getVarValue());
+ }
+ };
+ UIComponent immediateFacet = createCallbackComponent(immediateFacetCallback);
+ immediateFacet.setId("immediateFacet");
+
+ mockDataAdaptor.getChildren().add(child);
+ mockDataAdaptor.getFacets().put("facet", immediateFacet);
+
+ mockDataAdaptor.processDecodes(facesContext);
+
+ assertEquals(data.size(), facetCallback.get());
+ assertEquals(data.size(), childCallback.get());
+ assertEquals(1, immediateFacetCallback.get());
+
+ resetCallbacks(childCallback, facetCallback, immediateFacetCallback);
+
+ mockDataAdaptor.processValidators(facesContext);
+
+ assertEquals(data.size(), facetCallback.get());
+ assertEquals(data.size(), childCallback.get());
+ assertEquals(1, immediateFacetCallback.get());
+
+ resetCallbacks(childCallback, facetCallback, immediateFacetCallback);
+
+ mockDataAdaptor.processUpdates(facesContext);
+
+ assertEquals(data.size(), facetCallback.get());
+ assertEquals(data.size(), childCallback.get());
+ assertEquals(1, immediateFacetCallback.get());
+
+ resetCallbacks(childCallback, facetCallback, immediateFacetCallback);
+ }
+
+ public void testSaveRestoreChildrenState() throws Exception {
+ HtmlForm form = new HtmlForm();
+ HtmlInputText input = new HtmlInputText();
+ IterationStateHolderComponent stateHolder = new IterationStateHolderComponent();
+
+ List<UIComponent> children = mockDataAdaptor.getChildren();
+ children.add(form);
+ form.getChildren().add(input);
+ form.getFacets().put("facet", stateHolder);
+
+ mockDataAdaptor.setRowKey(Integer.valueOf(0));
+
+ assertFalse(form.isSubmitted());
+ assertNull(input.getSubmittedValue());
+ assertNull(input.getLocalValue());
+ assertTrue(input.isValid());
+ assertFalse(input.isLocalValueSet());
+ assertNull(stateHolder.getIterationState());
+
+ form.setSubmitted(true);
+ input.setSubmittedValue("user input");
+ input.setValue("component value");
+ input.setValid(false);
+ input.setLocalValueSet(true);
+ stateHolder.setIterationState("state");
+
+ mockDataAdaptor.setRowKey(Integer.valueOf(1));
+
+ assertFalse(form.isSubmitted());
+ assertNull(input.getSubmittedValue());
+ assertNull(input.getLocalValue());
+ assertTrue(input.isValid());
+ assertFalse(input.isLocalValueSet());
+ assertNull(stateHolder.getIterationState());
+
+ input.setSubmittedValue("another input from user");
+ input.setValue("123");
+ assertTrue(input.isLocalValueSet());
+ stateHolder.setIterationState("456");
+
+ mockDataAdaptor.setRowKey(Integer.valueOf(0));
+ assertTrue(form.isSubmitted());
+ assertEquals("user input", input.getSubmittedValue());
+ assertEquals("component value", input.getLocalValue());
+ assertFalse(input.isValid());
+ assertTrue(input.isLocalValueSet());
+ assertEquals("state", stateHolder.getIterationState());
+
+ mockDataAdaptor.setRowKey(Integer.valueOf(1));
+ assertFalse(form.isSubmitted());
+ assertEquals("another input from user", input.getSubmittedValue());
+ assertEquals("123", input.getLocalValue());
+ assertTrue(input.isValid());
+ assertTrue(input.isLocalValueSet());
+ assertEquals("456", stateHolder.getIterationState());
+
+ mockDataAdaptor.setRowKey(null);
+ assertFalse(form.isSubmitted());
+ assertNull(input.getSubmittedValue());
+ assertNull(input.getLocalValue());
+ assertTrue(input.isValid());
+ assertFalse(input.isLocalValueSet());
+ assertNull(stateHolder.getIterationState());
+ }
+
+ public void testSaveRestoreChildrenStateNestedDataAdaptors() throws Exception {
+ MockDataAdaptor childAdaptor = new MockDataAdaptor();
+ childAdaptor.setDataModel(createDataModel());
+
+ HtmlInputText input = new HtmlInputText();
+
+ mockDataAdaptor.getChildren().add(childAdaptor);
+ childAdaptor.getChildren().add(input);
+
+ Integer rowKey = Integer.valueOf(2);
+ Integer childKey = Integer.valueOf(1);
+
+ mockDataAdaptor.setRowKey(rowKey);
+ childAdaptor.setRowKey(childKey);
+
+ assertNull(input.getSubmittedValue());
+ assertNull(input.getLocalValue());
+ assertTrue(input.isValid());
+ assertFalse(input.isLocalValueSet());
+
+ input.setSubmittedValue("submittedValue");
+ input.setValue("value");
+
+ childAdaptor.setRowKey(null);
+ mockDataAdaptor.setRowKey(Integer.valueOf(3));
+ childAdaptor.setRowKey(Integer.valueOf(0));
+
+ assertNull(input.getSubmittedValue());
+ assertNull(input.getLocalValue());
+ assertFalse(input.isLocalValueSet());
+
+ childAdaptor.setRowKey(null);
+ mockDataAdaptor.setRowKey(rowKey);
+ childAdaptor.setRowKey(childKey);
+
+ assertEquals("submittedValue", input.getSubmittedValue());
+ assertEquals("value", input.getLocalValue());
+ assertTrue(input.isValid());
+ assertTrue(input.isLocalValueSet());
+ }
+
+ public void testEventsQueueing() throws Exception {
+ HtmlInputText input = new HtmlInputText();
+
+ final TestCallback testCallback = new TestCallback();
+ input.addValueChangeListener(new ValueChangeListener() {
+
+ public void processValueChange(ValueChangeEvent event) throws AbortProcessingException {
+ testCallback.getAndIncrement();
+ assertEquals(data.get(1), getVarValue());
+ }
+ });
+
+ mockDataAdaptor.getChildren().add(input);
+ mockDataAdaptor.setRowKey(Integer.valueOf(1));
+ assertEquals(data.get(1), getVarValue());
+
+ new ValueChangeEvent(input, null, "testValue").queue();
+ mockDataAdaptor.setRowKey(null);
+
+ facesContext.getViewRoot().broadcastEvents(facesContext, PhaseId.PROCESS_VALIDATIONS);
+ assertEquals(1, testCallback.get());
+ }
+
+ public void testInvokeOnComponent() throws Exception {
+ final HtmlInputText facet = new HtmlInputText();
+ final HtmlInputText child = new HtmlInputText();
+
+ mockDataAdaptor.getFacets().put("facet", facet);
+ mockDataAdaptor.getChildren().add(child);
+
+ mockDataAdaptor.setId("_data");
+ facet.setId("_facet");
+ child.setId("_child");
+
+ boolean invocationResult;
+ final TestCallback callback = new TestCallback();
+ invocationResult = mockDataAdaptor.invokeOnComponent(facesContext, "_data", new ContextCallback() {
+
+ public void invokeContextCallback(FacesContext context, UIComponent target) {
+ callback.getAndIncrement();
+ assertEquals(mockDataAdaptor, target);
+ assertEquals("_data", target.getClientId());
+ }
+ });
+
+ assertTrue(invocationResult);
+ assertEquals(1, callback.get());
+ callback.reset();
+
+ final char separatorChar = UINamingContainer.getSeparatorChar(facesContext);
+ invocationResult = mockDataAdaptor.invokeOnComponent(facesContext, "_data" + separatorChar + "_facet",
+ new ContextCallback() {
+
+ public void invokeContextCallback(FacesContext context, UIComponent target) {
+ callback.getAndIncrement();
+ assertEquals(facet, target);
+ assertEquals("_data" + separatorChar + "_facet", target.getClientId());
+ }
+ });
+
+ assertTrue(invocationResult);
+ assertEquals(1, callback.get());
+ callback.reset();
+
+ invocationResult = mockDataAdaptor.invokeOnComponent(facesContext, "_data" + separatorChar + "2"
+ + separatorChar + "_child", new ContextCallback() {
+
+ public void invokeContextCallback(FacesContext context, UIComponent target) {
+ callback.getAndIncrement();
+ assertEquals(child, target);
+ assertEquals(data.get(2), getVarValue());
+ assertEquals("_data" + separatorChar + "2" + separatorChar + "_child", target.getClientId());
+ }
+ });
+
+ assertTrue(invocationResult);
+ assertEquals(1, callback.get());
+ callback.reset();
+
+ invocationResult = mockDataAdaptor.invokeOnComponent(facesContext, "_data" + separatorChar + "100"
+ + separatorChar + "_child", new ContextCallback() {
+
+ public void invokeContextCallback(FacesContext context, UIComponent target) {
+ fail();
+ }
+ });
+ assertFalse(invocationResult);
+
+ invocationResult = mockDataAdaptor.invokeOnComponent(facesContext, "_data" + separatorChar
+ + "nonExistentComponent", new ContextCallback() {
+
+ public void invokeContextCallback(FacesContext context, UIComponent target) {
+ fail();
+ }
+ });
+ assertFalse(invocationResult);
+ }
+
+ public void testVisitChildren() throws Exception {
+ final HtmlInputText facet = new HtmlInputText();
+ final HtmlInputText child = new HtmlInputText();
+
+ mockDataAdaptor.getFacets().put("facet", facet);
+ mockDataAdaptor.getChildren().add(child);
+
+ mockDataAdaptor.setId("_data");
+ facet.setId("_facet");
+ child.setId("_child");
+
+ VisitContext fullVisitContext = VisitContext.createVisitContext(facesContext);
+
+ final char separatorChar = UINamingContainer.getSeparatorChar(facesContext);
+ final Set<String> idsToVisit = new HashSet<String>();
+ idsToVisit.add("_data" + separatorChar + "_facet");
+ idsToVisit.add("_data" + separatorChar + "0" + separatorChar + "_child");
+ idsToVisit.add("_data" + separatorChar + "2" + separatorChar + "_child");
+
+ VisitContext partialVisitContext = VisitContext.createVisitContext(facesContext, idsToVisit, EnumSet
+ .of(VisitHint.SKIP_UNRENDERED));
+
+ final TestCallback callback = new TestCallback();
+ mockDataAdaptor.visitTree(fullVisitContext, new VisitCallback() {
+
+ public VisitResult visit(VisitContext context, UIComponent target) {
+ callback.getAndIncrement();
+ assertNotNull(target);
+
+ return VisitResult.ACCEPT;
+ }
+ });
+
+ assertEquals(1 /* adaptor itself */+ 1 /* facet */+ data.size(), callback.get());
+
+ callback.reset();
+
+ mockDataAdaptor.visitTree(partialVisitContext, new VisitCallback() {
+
+ public VisitResult visit(VisitContext context, UIComponent target) {
+ callback.getAndIncrement();
+ assertNotNull(target);
+ assertTrue(idsToVisit.contains(target.getClientId()));
+ return VisitResult.ACCEPT;
+ }
+ });
+
+ assertEquals(idsToVisit.size(), callback.get());
+
+ callback.reset();
+
+ mockDataAdaptor.visitTree(fullVisitContext, new VisitCallback() {
+
+ public VisitResult visit(VisitContext context, UIComponent target) {
+ callback.getAndIncrement();
+
+ if (child.equals(target)
+ && child.getClientId().equals("_data" + separatorChar + "1" + separatorChar + "_child")) {
+ return VisitResult.COMPLETE;
+ }
+
+ return VisitResult.ACCEPT;
+ }
+ });
+
+ assertEquals(1 /* data adaptor */+ 1 /* facet */+ 2 /* [0..1] children */, callback.get());
+ }
+}
+
+class IterationStateHolderComponent extends UIComponentBase implements IterationStateHolder {
+
+ private Object iterationState;
+
+ @Override
+ public String getFamily() {
+ return "test.Component";
+ }
+
+ public Object getIterationState() {
+ return iterationState;
+ }
+
+ public void setIterationState(Object state) {
+ iterationState = state;
+ }
+
+}
Added: root/framework/trunk/impl/src/test/java/org/richfaces/component/MockDataAdaptor.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/richfaces/component/MockDataAdaptor.java (rev 0)
+++ root/framework/trunk/impl/src/test/java/org/richfaces/component/MockDataAdaptor.java 2009-12-29 16:53:57 UTC (rev 16221)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.component;
+
+import javax.faces.component.UINamingContainer;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.ExtendedDataModel;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class MockDataAdaptor extends UIDataAdaptor {
+
+ private ExtendedDataModel<?> dataModel;
+
+ @Override
+ protected DataComponentState createComponentState() {
+ return new MockDataAdaptorComponentState();
+ }
+
+ @Override
+ protected ExtendedDataModel<?> createExtendedDataModel() {
+ return dataModel;
+ }
+
+ public ExtendedDataModel<?> getDataModel() {
+ return dataModel;
+ }
+
+ public void setDataModel(ExtendedDataModel<?> dataModel) {
+ this.dataModel = dataModel;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.UIDataAdaptor#getRowKeyConverter()
+ */
+ @Override
+ public Converter getRowKeyConverter() {
+ // TODO Auto-generated method stub
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ return facesContext.getApplication().createConverter(Integer.class);
+ }
+
+ @Override
+ protected String extractKeySegment(FacesContext context, String substring) {
+ char separatorChar = UINamingContainer.getSeparatorChar(context);
+ int separatorIdx = substring.indexOf(separatorChar);
+ if (separatorIdx >= 0) {
+ return substring.substring(0, separatorIdx);
+ } else {
+ return substring;
+ }
+ }
+}
Added: root/framework/trunk/impl/src/test/java/org/richfaces/component/MockDataAdaptorComponentState.java
===================================================================
--- root/framework/trunk/impl/src/test/java/org/richfaces/component/MockDataAdaptorComponentState.java (rev 0)
+++ root/framework/trunk/impl/src/test/java/org/richfaces/component/MockDataAdaptorComponentState.java 2009-12-29 16:53:57 UTC (rev 16221)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.component;
+
+import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.Range;
+import org.ajax4jsf.model.SequenceRange;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class MockDataAdaptorComponentState implements DataComponentState {
+
+ private Range range = new SequenceRange(0, -1);
+
+ public Range getRange() {
+ return range;
+ }
+}
Property changes on: root/framework/trunk/test-base
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
.classpath
.clover
+ target
.settings
.project
.classpath
.clover
bin
15 years
JBoss Rich Faces SVN: r16220 - root/checkstyle.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-12-29 11:52:35 -0500 (Tue, 29 Dec 2009)
New Revision: 16220
Modified:
root/checkstyle/
Log:
Service files svn:ignored
Property changes on: root/checkstyle
___________________________________________________________________
Name: svn:ignore
+ target
.classpath
.project
15 years
JBoss Rich Faces SVN: r16219 - in root/cdk/trunk: plugins/generator and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-12-29 11:51:45 -0500 (Tue, 29 Dec 2009)
New Revision: 16219
Modified:
root/cdk/trunk/plugins/generator/pom.xml
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/types/TypesFactory.java
root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
root/cdk/trunk/pom.xml
Log:
CDK:
- Added comments to TypesFactory
- Build failures due to missing com.sun.*jaxb dependencies and checkstyle errors fixed
Modified: root/cdk/trunk/plugins/generator/pom.xml
===================================================================
--- root/cdk/trunk/plugins/generator/pom.xml 2009-12-29 13:00:55 UTC (rev 16218)
+++ root/cdk/trunk/plugins/generator/pom.xml 2009-12-29 16:51:45 UTC (rev 16219)
@@ -120,17 +120,17 @@
<artifactId>xinclude</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.2</version>
- </dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>2.2</version>
- </dependency>
<dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.2-SNAPSHOT</version>
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/types/TypesFactory.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/types/TypesFactory.java 2009-12-29 13:00:55 UTC (rev 16218)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/parser/el/types/TypesFactory.java 2009-12-29 16:51:45 UTC (rev 16219)
@@ -135,7 +135,11 @@
for (String guessPackage : GUESS_PACKAGES) {
String guessTypeName = guessPackage + "." + className;
try {
- return Class.forName(guessTypeName, true, classLoader);
+ //while by default initialize = true for Class.forName(String) method
+ //initialize = false used here prevents loading of dependencies that
+ //are accessible only in runtime, e.g. static log initializer from API
+ //depends on the concrete logger implementation provided in runtime only
+ return Class.forName(guessTypeName, false, classLoader);
} catch (ClassNotFoundException e) {
// ignore
} catch (LinkageError e) {
@@ -150,7 +154,8 @@
Class<?> result = PRIMITIVE_CLASSES_MAP.get(className);
if (result == null) {
try {
- result = Class.forName(className, true, classLoader);
+ //initialize = false here for the same reason as already mentioned for the previous load block
+ result = Class.forName(className, false, classLoader);
} catch (LinkageError e) {
String errorMessage = MessageFormat.format("Class {0} couldn''t be loaded because of: {1}", className,
e.getMessage());
Modified: root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy 2009-12-29 13:00:55 UTC (rev 16218)
+++ root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy 2009-12-29 16:51:45 UTC (rev 16219)
@@ -57,6 +57,11 @@
outputFile.createNewFile();
XSSchemaSet schemaSet = parse(sourceSchemaFileName);
+
+ if (schemaSet == null) {
+ fail("Unknown error parsing schema file");
+ }
+
SchemaProcessor schemaProcessor = new SchemaProcessor(schemaSet, targetNamespaceParam);
schemaProcessor.buildModel();
schemaProcessor.serializeModel(new FileOutputStream(outputFileName));
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2009-12-29 13:00:55 UTC (rev 16218)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2009-12-29 16:51:45 UTC (rev 16219)
@@ -274,7 +274,7 @@
assertEquals(1, processor.numOfComponents);
}
- private static abstract class TestProcessor extends CdkProcessor {
+ private abstract static class TestProcessor extends CdkProcessor {
protected int numOfComponents;
public TestProcessor() {
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2009-12-29 13:00:55 UTC (rev 16218)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2009-12-29 16:51:45 UTC (rev 16219)
@@ -35,7 +35,6 @@
import org.richfaces.cdk.CdkContextBase;
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.CdkWorker;
-import org.richfaces.cdk.LibraryBuilder;
import org.richfaces.cdk.LoggerFactory;
import org.richfaces.cdk.ModelBuilder;
import org.richfaces.cdk.ModelValidator;
Modified: root/cdk/trunk/pom.xml
===================================================================
--- root/cdk/trunk/pom.xml 2009-12-29 13:00:55 UTC (rev 16218)
+++ root/cdk/trunk/pom.xml 2009-12-29 16:51:45 UTC (rev 16219)
@@ -38,7 +38,9 @@
<repositories>
<repository>
- <releases/>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
15 years
JBoss Rich Faces SVN: r16218 - branches/community/3.3.X/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-12-29 08:00:55 -0500 (Tue, 29 Dec 2009)
New Revision: 16218
Modified:
branches/community/3.3.X/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/RichTableMenuRenderer.java
Log:
ExtendedDataTable duplicate Id exception
https://jira.jboss.org/jira/browse/RF-8223
Modified: branches/community/3.3.X/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/RichTableMenuRenderer.java
===================================================================
--- branches/community/3.3.X/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/RichTableMenuRenderer.java 2009-12-29 01:12:41 UTC (rev 16217)
+++ branches/community/3.3.X/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/RichTableMenuRenderer.java 2009-12-29 13:00:55 UTC (rev 16218)
@@ -257,7 +257,7 @@
.createComponent(UIMenuItem.COMPONENT_TYPE);
menuItem.setSubmitMode("none");
- menuItem.setId("group");
+ menuItem.setId(getId("group"));
String actionScript = null;
StringBuilder actionScriptBuilder = new StringBuilder();
boolean isGroupingColumn = column.getId().equalsIgnoreCase(
15 years
JBoss Rich Faces SVN: r16217 - in root/cdk/trunk/plugins/generator: src/main/java/org/richfaces/cdk/apt and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-12-28 20:12:41 -0500 (Mon, 28 Dec 2009)
New Revision: 16217
Modified:
root/cdk/trunk/plugins/generator/pom.xml
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Behavior.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorRenderer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Component.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Converter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroup.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Event.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Facet.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Listener.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Mergeable.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelCollection.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RenderKit.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Renderer.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Validator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigNamespacePreffixMapper.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AttributeBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/DescriptionGroupBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RenderKitBean.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererBean.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ModelBean.java
Log:
set proper order of faces-config elements.
Modified: root/cdk/trunk/plugins/generator/pom.xml
===================================================================
--- root/cdk/trunk/plugins/generator/pom.xml 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/pom.xml 2009-12-29 01:12:41 UTC (rev 16217)
@@ -120,13 +120,16 @@
<artifactId>xinclude</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
- <!--
- <dependency> <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId> <version>2.1</version>
- </dependency> <dependency> <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId> <version>2.1.10</version>
- </dependency>
- -->
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.2</version>
+ </dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -33,6 +33,7 @@
import javax.faces.event.FacesEvent;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.MirroredTypeException;
import javax.lang.model.type.MirroredTypesException;
import javax.lang.model.type.TypeMirror;
@@ -232,9 +233,10 @@
} catch (MirroredTypesException mirror) {
for (TypeMirror eventType : mirror.getTypeMirrors()) {
component.addEvent(eventType.toString());
-
// TODO - check does component already implement eventSource interface
}
+ } catch (MirroredTypeException mirror) {
+ component.addEvent(mirror.getTypeMirror().toString());
}
}
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Behavior.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Behavior.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Behavior.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -72,6 +72,12 @@
return visitor.visit(this, param);
}
+ @Override
+ public boolean same(Behavior other) {
+ return null != getType() && getType().equals(other.getType());
+ }
+
+
public static final class Type extends Key {
public Type(String name) {
super(name);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorRenderer.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorRenderer.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/BehaviorRenderer.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -87,6 +87,18 @@
return visitor.visit(this, param);
}
+ @Override
+ public boolean same(BehaviorRenderer other) {
+ if(null != getType() && null != other.getType()){
+ // Both types not null, compare them.
+ return getType().equals(other.getType());
+ }
+ // one or both types are null, compare classes.
+ if(null != getRendererClass() && getRendererClass().equals(other.getRendererClass())){
+ return true;
+ }
+ return false;
+ }
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Component.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Component.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Component.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -103,6 +103,18 @@
ComponentLibrary.merge(this, otherComponent);
}
+ @Override
+ public boolean same(Component other) {
+ if(null != getType() && null != other.getType()){
+ // Both types not null, compare them.
+ return getType().equals(other.getType());
+ }
+ // one or both types are null, compare classes.
+ if(null != getComponentClass() && getComponentClass().equals(other.getComponentClass())){
+ return true;
+ }
+ return false;
+ }
/**
* <p class="changed_added_4_0"></p>
* @param type the type to set
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Converter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Converter.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Converter.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -64,6 +64,12 @@
public void merge(Converter other) {
}
+ @Override
+ public boolean same(Converter other) {
+ return null != getType() && getType().equals(other.getType());
+ }
+
+
public static final class Type extends Key {
public Type(String name) {
super(name);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroup.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroup.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroup.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -69,7 +69,7 @@
*
* @author asmirnov(a)exadel.com
*/
- @XmlType(name = "icon-type", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ @XmlType(name = "iconType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,propOrder={"smallIcon","largeIcon"})
public static final class Icon {
private String largeIcon;
private String smallIcon;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Event.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Event.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Event.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -136,4 +136,10 @@
public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
return visitor.visit(this, param);
}
+
+ @Override
+ public boolean same(Event other) {
+ return null != getType() && getType().equals(other.getType());
+ }
+
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Facet.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Facet.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Facet.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -68,4 +68,9 @@
public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
return visitor.visit(this, param);
}
+
+ @Override
+ public boolean same(Facet other) {
+ return equals(other);
+ }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Listener.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Listener.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Listener.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -73,6 +73,12 @@
// TODO Auto-generated method stub
}
+
+ @Override
+ public boolean same(Listener other) {
+ return equals(other);
+ }
+
public static final class Type extends Key {
public Type(String name) {
super(name);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Mergeable.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Mergeable.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Mergeable.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -1,5 +1,17 @@
package org.richfaces.cdk.model;
public interface Mergeable<T> {
+ /**
+ * <p class="changed_added_4_0">Merge values from other object.</p>
+ * @param other
+ */
public void merge(T other);
+
+ /**
+ * <p class="changed_added_4_0">Compare object with other. For example, JSF component with same type or
+ * class is the same component.</p>
+ * @param other
+ * @return
+ */
+ public boolean same(T other);
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelCollection.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelCollection.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ModelCollection.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.model;
import java.util.Collection;
@@ -38,18 +36,18 @@
/**
* <p class="changed_added_4_0">
- * Base class for all model collections.
+ * Base class for all model collections. This collection use {@link Mergeable#same(Object)} method instead of equals
+ * to lookup objects in the {@link #contains(Object)} and {@link #remove(Object)} methods. In addition, it merges same objects instead of replace in the {@link #add(ModelElement)} method.
* </p>
- *
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
-public class ModelCollection<E extends ModelElement<? super E>>
- implements Collection<E>, Visitable {
+public class ModelCollection<E extends ModelElement<? super E>> implements Collection<E>, Visitable {
private final List<E> elements = Lists.newArrayList();
- public static <T extends ModelElement<? super T>> ModelCollection<T> create(){
+ public static <T extends ModelElement<? super T>> ModelCollection<T> create() {
return new ModelCollection<T>();
}
@@ -66,7 +64,15 @@
@Override
public boolean add(E e) {
- // TODO - merge instead of add ???
+ if(null == e){
+ throw new NullPointerException();
+ }
+ for (E element : elements) {
+ if (element.same(e)) {
+ element.merge(e);
+ return false;
+ }
+ }
return elements.add(e);
}
@@ -89,8 +95,13 @@
@SuppressWarnings("unchecked")
@Override
public boolean contains(Object o) {
- if (o instanceof ModelElement<?>) {
- return elements.contains(o);
+ if (null != o) {
+ Class<? extends Object> clazz = o.getClass();
+ for (E element : elements) {
+ if (clazz.isInstance(element) && element.same((E) o)) {
+ return true;
+ }
+ }
}
return false;
}
@@ -112,7 +123,17 @@
@Override
public boolean remove(Object o) {
- return elements.remove(o);
+ if (null != o) {
+ Class<? extends Object> clazz = o.getClass();
+ for (E element : elements) {
+ if (clazz.isInstance(element) && element.same((E) o)) {
+ elements.remove(element);
+ return true;
+ }
+ }
+
+ }
+ return false;
}
@Override
@@ -157,5 +178,4 @@
return result;
}
-
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -270,4 +270,9 @@
public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
return visitor.visit(this, param);
}
+
+ @Override
+ public boolean same(Property other) {
+ return this == other;
+ }
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RenderKit.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RenderKit.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/RenderKit.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -97,6 +97,12 @@
}
+ @Override
+ public boolean same(RenderKit other) {
+ return null != getRenderKitClass() && getRenderKitClass().equals(other.getRenderKitClass());
+ }
+
+
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Renderer.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Renderer.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Renderer.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -179,6 +179,23 @@
ComponentLibrary.merge(this, other);
}
+ @Override
+ public boolean same(Renderer other) {
+ if(null != getType() && null != other.getType()){
+ // compare families ?
+ if(null != getFamily() && null != other.getFamily() && !getFamily().equals(other.getFamily())){
+ return false;
+ }
+ // Both types not null, compare them.
+ return getType().equals(other.getType());
+ }
+ // one or both types are null, compare classes.
+ if(null != getRendererClass()&& getRendererClass().equals(other.getRendererClass())){
+ return true;
+ }
+ return false;
+ }
+
/**
* <p class="changed_added_4_0">Key for lookup renderer in the model.</p>
* @author asmirnov(a)exadel.com
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Validator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Validator.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Validator.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -74,6 +74,12 @@
// TODO Auto-generated method stub
}
+
+ @Override
+ public boolean same(Validator other) {
+ return null != getType() && getType().equals(other.getType());
+ }
+
public static final class Type extends Key {
public Type(String name) {
super(name);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigNamespacePreffixMapper.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigNamespacePreffixMapper.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigNamespacePreffixMapper.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -25,14 +25,14 @@
import org.richfaces.cdk.model.ComponentLibrary;
-/*import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;*/
+import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
/**
* <p class="changed_added_4_0"></p>
*
* @author asmirnov(a)exadel.com
*/
-public class FacesConfigNamespacePreffixMapper /* extends NamespacePrefixMapper */ {
+public class FacesConfigNamespacePreffixMapper extends NamespacePrefixMapper {
/*
* (non-Javadoc)
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -204,7 +204,7 @@
if (null != schemaLocation) {
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocation);
-// marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", PREFFIX_MAPPER);
+ marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", PREFFIX_MAPPER);
}
marshaller.marshal(model, output);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AttributeBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AttributeBean.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/AttributeBean.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -24,6 +24,8 @@
package org.richfaces.cdk.xmlconfig.model;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentLibrary;
@@ -33,6 +35,8 @@
*
* @author asmirnov(a)exadel.com
*/
+@XmlType(name="faces-config-attributeType",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE,
+ propOrder={"key","type","defaultValue","suggestedValue","extension"})
public class AttributeBean extends PropertyBase {
/**
@@ -40,21 +44,18 @@
*
* @return the name
*/
- @XmlElement(name = "attribute-name", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public String getName() {
+ @XmlElement(name = "attribute-name", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,required=true)
+ public String getKey() {
return super.getKey();
}
-
- public void setName(String name) {
- super.setKey(name);
- }
/**
* <p class="changed_added_4_0"></p>
*
* @return the type
*/
- @XmlElement(name = "attribute-class", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ @XmlElement(name = "attribute-class", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,required=true)
+ @XmlJavaTypeAdapter(ClassAdapter.class)
public ClassDescription getType() {
return super.getType();
}
@@ -66,6 +67,29 @@
}
@Override
+ @XmlElement(name = "default-value", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getDefaultValue() {
+ return super.getDefaultValue();
+ }
+
+ @Override
+ public void setDefaultValue(String defaultValue) {
+ super.setDefaultValue(defaultValue);
+ }
+
+ @Override
+ @XmlElement(name = "suggested-value", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getSuggestedValue() {
+ return super.getSuggestedValue();
+ }
+
+
+ @Override
+ public void setSuggestedValue(String suggestedValue) {
+ super.setSuggestedValue(suggestedValue);
+ }
+
+ @Override
@XmlElement(name = "attribute-extension", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
public PropertyExtension getExtension() {
return super.getExtension();
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -42,7 +42,9 @@
*
* @author asmirnov(a)exadel.com
*/
-@XmlType(name = "faces-config-componentType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+@XmlType(name = "faces-config-componentType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
+ propOrder={"type", "componentClass", "facets",
+ "attributes", "extension"})
@XmlJavaTypeAdapter(ComponentAdapter.class)
public class ComponentBean extends ExtensibleBean<ComponentBean.ComponentExtension> {
private List<PropertyBase> attributes = Lists.newArrayList();
@@ -55,7 +57,7 @@
*
* @return the type
*/
- @XmlElement(name = "component-type", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ @XmlElement(name = "component-type", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,required=true)
public String getType() {
return type;
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/DescriptionGroupBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/DescriptionGroupBean.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/DescriptionGroupBean.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -1,10 +1,13 @@
package org.richfaces.cdk.xmlconfig.model;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.DescriptionGroup;
+@XmlType(name="descriptionType",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE,
+ propOrder={"description","displayname","icon"})
public class DescriptionGroupBean implements DescriptionGroup {
private String description;
private String displayname;
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -28,6 +28,7 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.richfaces.cdk.model.Component;
@@ -44,13 +45,18 @@
* @author asmirnov(a)exadel.com
*/
@XmlRootElement(name = "faces-config", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+@XmlType(name="faces-configType",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE)
public class FacesConfigBean implements Extensible<FacesConfigBean.FacesConfigExtension> {
@XmlElement(name = "component", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
@XmlJavaTypeAdapter(ComponentAdapter.class)
private List<Component> components = Lists.newArrayList();
@XmlElement(name = "render-kit", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
private List<RenderKitBean> renderKits = Lists.newArrayList();
+ @XmlAttribute
private String version = "2.0";
+ @XmlAttribute(name="metadata-complete")
+ private boolean metadataComplete;
+ @XmlElement(name = "faces-config-extension", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
private FacesConfigExtension extension;
/**
@@ -58,7 +64,6 @@
*
* @return the version
*/
- @XmlAttribute
public String getVersion() {
return version;
}
@@ -74,6 +79,22 @@
/**
* <p class="changed_added_4_0"></p>
+ * @return the metadataComplete
+ */
+ public boolean isMetadataComplete() {
+ return this.metadataComplete;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param metadataComplete the metadataComplete to set
+ */
+ public void setMetadataComplete(boolean metadataComplete) {
+ this.metadataComplete = metadataComplete;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
*
* @return the components
*/
@@ -113,7 +134,6 @@
*
* @return the extension
*/
- @XmlElement(name = "faces-config-extension", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
public FacesConfigExtension getExtension() {
return extension;
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBase.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBase.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -72,7 +72,6 @@
*
* @return the type
*/
- @XmlJavaTypeAdapter(ClassAdapter.class)
public ClassDescription getType() {
return type;
}
@@ -91,7 +90,6 @@
*
* @return the defaultValue
*/
- @XmlElement(name = "default-value", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
public String getDefaultValue() {
return defaultValue;
}
@@ -110,7 +108,6 @@
*
* @return the suggestedValue
*/
- @XmlElement(name = "suggested-value", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
public String getSuggestedValue() {
return suggestedValue;
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBean.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/PropertyBean.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -24,6 +24,8 @@
package org.richfaces.cdk.xmlconfig.model;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentLibrary;
@@ -33,6 +35,8 @@
*
* @author asmirnov(a)exadel.com
*/
+@XmlType(name="faces-config-propertyType",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE,
+ propOrder={"key","type","defaultValue","suggestedValue","extension"})
public class PropertyBean extends PropertyBase {
/**
@@ -56,6 +60,7 @@
* @return the type
*/
@XmlElement(name = "property-class", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ @XmlJavaTypeAdapter(ClassAdapter.class)
public ClassDescription getType() {
return super.getType();
}
@@ -67,6 +72,29 @@
}
@Override
+ @XmlElement(name = "default-value", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getDefaultValue() {
+ return super.getDefaultValue();
+ }
+
+ @Override
+ public void setDefaultValue(String defaultValue) {
+ super.setDefaultValue(defaultValue);
+ }
+
+ @Override
+ @XmlElement(name = "suggested-value", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getSuggestedValue() {
+ return super.getSuggestedValue();
+ }
+
+
+ @Override
+ public void setSuggestedValue(String suggestedValue) {
+ super.setSuggestedValue(suggestedValue);
+ }
+
+ @Override
@XmlElement(name = "property-extension", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
public PropertyExtension getExtension() {
return super.getExtension();
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RenderKitBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RenderKitBean.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RenderKitBean.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -27,6 +27,7 @@
import javax.faces.render.RenderKitFactory;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.richfaces.cdk.model.BehaviorRenderer;
@@ -44,6 +45,8 @@
*
* @author asmirnov(a)exadel.com
*/
+@XmlType(name="faces-config-render-kitType",namespace=ComponentLibrary.FACES_CONFIG_NAMESPACE,
+ propOrder={"key","renderkitClass","renderers","behaviorRenderers","extension"})
public class RenderKitBean extends ExtensibleBean<RenderKitBean.RenderKitExtension> implements MapEntry<RenderKit.Id> {
private List<Renderer> renderers = Lists.newArrayList();
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererBean.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererBean.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -43,7 +43,8 @@
*
* @author asmirnov(a)exadel.com
*/
-@XmlType(name = "faces-config-rendererType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+@XmlType(name = "faces-config-rendererType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
+ propOrder={"family","type","rendererClass",/*"facet",*/"attributes","extension"})
public class RendererBean extends
ExtensibleBean<RendererBean.RendererExtension> {
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ModelBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ModelBean.java 2009-12-29 01:12:10 UTC (rev 16216)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/model/ModelBean.java 2009-12-29 01:12:41 UTC (rev 16217)
@@ -147,6 +147,10 @@
return (R) visitor.visit(this, param);
}
+ @Override
+ public boolean same(ModelBean other) {
+ return null != getType() && getType().equals(other.getType());
+ }
@SuppressWarnings("serial")
public static final class Type extends Key {
15 years
JBoss Rich Faces SVN: r16216 - in root/cdk/trunk/plugins/maven-cdk-plugin/src/it: annotated-component/src/main/java/org/richfaces/cdk/test and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-12-28 20:12:10 -0500 (Mon, 28 Dec 2009)
New Revision: 16216
Added:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestEvent.java
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/it/xml-configured-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
Log:
set proper order of faces-config elements.
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-12-29 01:11:58 UTC (rev 16215)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-12-29 01:12:10 UTC (rev 16216)
@@ -19,15 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.ajax4jsf.renderkit;
-
import java.io.IOException;
-
import java.lang.reflect.Array;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
@@ -44,22 +39,19 @@
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
-import javax.faces.component.UIParameter;
import javax.faces.component.UIViewRoot;
import javax.faces.component.ValueHolder;
-import javax.faces.component.behavior.ClientBehaviorContext.Parameter;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.convert.Converter;
/**
- * Util class for common render operations - render passthru html attributes,
- * iterate over child components etc.
- *
+ * Util class for common render operations - render passthru html attributes, iterate over child components etc.
+ *
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.6 $ $Date: 2007/02/08 19:07:16 $
- *
+ *
*/
public class RendererUtils {
public static final String DUMMY_FORM_ID = ":_form";
@@ -90,6 +82,7 @@
/**
* Use this method to get singleton instance of RendererUtils
+ *
* @return singleton instance
*/
public static RendererUtils getInstance() {
@@ -98,7 +91,7 @@
/**
* Encode id attribute with clientId component property
- *
+ *
* @param context
* @param component
* @throws IOException
@@ -109,7 +102,7 @@
/**
* Encode clientId to custom attribute ( for example, to control name )
- *
+ *
* @param context
* @param component
* @param attribute
@@ -127,14 +120,13 @@
if (null != clientId) {
context.getResponseWriter().writeAttribute(attribute, clientId,
- (String) getComponentAttributeName(attribute));
+ (String) getComponentAttributeName(attribute));
}
}
/**
- * Encode id attribute with clientId component property. Encoded only if id
- * not auto generated.
- *
+ * Encode id attribute with clientId component property. Encoded only if id not auto generated.
+ *
* @param context
* @param component
* @throws IOException
@@ -142,32 +134,29 @@
public void encodeCustomId(FacesContext context, UIComponent component) throws IOException {
if ((component.getId() != null) && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) {
context.getResponseWriter().writeAttribute(HTML.ID_ATTRIBUTE, component.getClientId(context),
- HTML.ID_ATTRIBUTE);
+ HTML.ID_ATTRIBUTE);
}
}
public Map<String, Object> createParametersMap(FacesContext context, UIComponent component) {
Map<String, Object> parameters = new LinkedHashMap<String, Object>();
-
return parameters;
}
private void encodeBehaviors(FacesContext context, ClientBehaviorHolder behaviorHolder,
- String defaultHtmlEventName, String[] attributesExclusions)
- throws IOException {
+ String defaultHtmlEventName, String[] attributesExclusions) throws IOException {
}
/**
* Encode common pass-thru html attributes.
- *
+ *
* @param context
* @param component
* @throws IOException
*/
- public void encodePassThru(FacesContext context, UIComponent component, String defaultHtmlEvent)
- throws IOException {
+ public void encodePassThru(FacesContext context, UIComponent component, String defaultHtmlEvent) throws IOException {
encodeAttributesFromArray(context, component, HTML.PASS_THRU);
@@ -182,15 +171,15 @@
/**
* Encode pass-through attributes except specified ones
- *
+ *
* @param context
* @param component
* @param exclusions
* @throws IOException
*/
public void encodePassThruWithExclusions(FacesContext context, UIComponent component, String exclusions,
- String defaultHtmlEvent) throws IOException {
-
+ String defaultHtmlEvent) throws IOException {
+
if (null != exclusions) {
String[] exclusionsArray = exclusions.split(",");
@@ -199,8 +188,8 @@
}
public void encodePassThruWithExclusionsArray(FacesContext context, UIComponent component, String[] exclusions,
- String defaultHtmlEvent) throws IOException {
-
+ String defaultHtmlEvent) throws IOException {
+
ResponseWriter writer = context.getResponseWriter();
Map<String, Object> attributes = component.getAttributes();
@@ -230,16 +219,15 @@
}
/**
- * Encode one pass-thru attribute, with plain/boolean/url value, got from
- * properly component attribute.
- *
+ * Encode one pass-thru attribute, with plain/boolean/url value, got from properly component attribute.
+ *
* @param context
* @param writer
* @param attribute
* @throws IOException
*/
public void encodePassThruAttribute(FacesContext context, Map<String, Object> attributes, ResponseWriter writer,
- String attribute) throws IOException {
+ String attribute) throws IOException {
Object value = attributeValue(attribute, attributes.get(getComponentAttributeName(attribute)));
@@ -257,7 +245,7 @@
public void encodeAttributesFromArray(FacesContext context, UIComponent component, String[] attrs)
throws IOException {
-
+
ResponseWriter writer = context.getResponseWriter();
Map<String, Object> attributes = component.getAttributes();
@@ -270,7 +258,7 @@
/**
* Encode attributes given by comma-separated string list.
- *
+ *
* @param context
* current JSF context
* @param component
@@ -292,12 +280,12 @@
* @param component
* @param property
* @param attributeName
- *
+ *
* @throws IOException
*/
public void encodeAttribute(FacesContext context, UIComponent component, Object property, String attributeName)
throws IOException {
-
+
ResponseWriter writer = context.getResponseWriter();
Object value = component.getAttributes().get(property);
@@ -311,14 +299,14 @@
}
public void writeText(ResponseWriter writer, Object value, String property) throws IOException {
- if (value != null) {
- writer.writeText(value, property);
- }
+ if (value != null) {
+ writer.writeText(value, property);
+ }
}
-
+
/**
* Write html-attribute
- *
+ *
* @param writer
* @param attribute
* @param value
@@ -331,15 +319,14 @@
}
/**
- * @return true if and only if the argument <code>attributeVal</code> is
- * an instance of a wrapper for a primitive type and its value is
- * equal to the default value for that type as given in the spec.
+ * @return true if and only if the argument <code>attributeVal</code> is an instance of a wrapper for a primitive
+ * type and its value is equal to the default value for that type as given in the spec.
*/
public boolean shouldRenderAttribute(Object attributeVal) {
if (null == attributeVal) {
return false;
} else if ((attributeVal instanceof Boolean)
- && ((Boolean) attributeVal).booleanValue() == Boolean.FALSE.booleanValue()) {
+ && ((Boolean) attributeVal).booleanValue() == Boolean.FALSE.booleanValue()) {
return false;
} else if (attributeVal.toString().length() == 0) {
return false;
@@ -361,12 +348,11 @@
}
/**
- * Test for valid value of property. by default, for non-setted properties
- * with Java primitive types of JSF component return appropriate MIN_VALUE .
- *
- * @param property -
- * value of property returned from
- * {@link UIComponent#getAttributes()}
+ * Test for valid value of property. by default, for non-setted properties with Java primitive types of JSF
+ * component return appropriate MIN_VALUE .
+ *
+ * @param property
+ * - value of property returned from {@link UIComponent#getAttributes()}
* @return true for setted property, false otherthise.
*/
public boolean isValidProperty(Object property) {
@@ -392,15 +378,15 @@
}
/**
- * Checks if the argument passed in is empty or not.
- * Object is empty if it is: <br />
- * - <code>null<code><br />
+ * Checks if the argument passed in is empty or not. Object is empty if it is: <br />
+ * - <code>null<code><br />
* - zero-length string<br />
* - empty collection<br />
* - empty map<br />
* - zero-length array<br />
- *
- * @param o object to check for emptiness
+ *
+ * @param o
+ * object to check for emptiness
* @since 3.3.2
* @return <code>true</code> if the argument is empty, <code>false</code> otherwise
*/
@@ -430,7 +416,7 @@
/**
* Convert HTML attribute name to component property name.
- *
+ *
* @param key
* @return
*/
@@ -445,10 +431,9 @@
}
/**
- * Convert attribute value to proper object. For known html boolean
- * attributes return name for true value, otherthise - null. For non-boolean
- * attributes return same value.
- *
+ * Convert attribute value to proper object. For known html boolean attributes return name for true value,
+ * otherthise - null. For non-boolean attributes return same value.
+ *
* @param name
* attribute name.
* @param value
@@ -472,12 +457,11 @@
/**
* Get boolean value of logical attribute
- *
+ *
* @param component
* @param name
* attribute name
- * @return true if attribute is equals Boolean.TRUE or String "true" , false
- * otherwise.
+ * @return true if attribute is equals Boolean.TRUE or String "true" , false otherwise.
*/
public boolean isBooleanAttribute(UIComponent component, String name) {
Object attrValue = component.getAttributes().get(name);
@@ -495,9 +479,8 @@
}
/**
- * Return converted value for {@link javax.faces.component.ValueHolder} as
- * String, perform nessesary convertions.
- *
+ * Return converted value for {@link javax.faces.component.ValueHolder} as String, perform nessesary convertions.
+ *
* @param context
* @param component
* @return
@@ -523,10 +506,9 @@
}
/**
- * Convert any object value to string. If component instance of
- * {@link ValueHolder } got {@link Converter} for formatting. If not,
- * attempt to use converter based on value type.
- *
+ * Convert any object value to string. If component instance of {@link ValueHolder } got {@link Converter} for
+ * formatting. If not, attempt to use converter based on value type.
+ *
* @param context
* @param component
* @return
@@ -570,9 +552,9 @@
/**
* formats given value to
- *
+ *
* @param value
- *
+ *
* @return
*/
public String encodePctOrPx(String value) {
@@ -585,7 +567,7 @@
/**
* Find nested form for given component
- *
+ *
* @param component
* @return nested <code>UIForm</code> component, or <code>null</code>
*/
@@ -636,7 +618,7 @@
*/
public void encodeBeginForm(FacesContext context, UIComponent component, ResponseWriter writer, String clientId)
throws IOException {
-
+
String actionURL = getActionUrl(context);
String encodeActionURL = context.getExternalContext().encodeActionURL(actionURL);
@@ -685,7 +667,7 @@
/**
* Simplified version of {@link encodeId}
- *
+ *
* @param context
* @param component
* @return client id of current component
@@ -705,7 +687,7 @@
/**
* Wtrie JavaScript with start/end elements and type.
- *
+ *
* @param context
* @param component
* @param script
@@ -727,15 +709,15 @@
* @return
*/
private static boolean checkKeyword(Collection<String> ids, String keyword) {
- if (ids.contains(keyword)) {
- if (ids.size() != 1) {
- //TODO log
- }
-
- return true;
- }
-
- return false;
+ if (ids.contains(keyword)) {
+ if (ids.size() != 1) {
+ // TODO log
+ }
+
+ return true;
+ }
+
+ return false;
}
/**
@@ -745,14 +727,12 @@
* @since 4.0
* @return
*/
- public Collection<String> findComponentsFor(FacesContext context, UIComponent component,
- Collection<String> shortIds) {
+ public Collection<String> findComponentsFor(FacesContext context, UIComponent component, Collection<String> shortIds) {
// TODO - implement
// TODO add support for @*
Set<String> result = new LinkedHashSet<String>(shortIds.size());
-
return result;
}
@@ -793,9 +773,10 @@
/**
* If target component contains generated id and for doesn't, correct for id
+ *
* @param forAttr
* @param component
- *
+ *
*/
public String correctForIdReference(String forAttr, UIComponent component) {
int contains = forAttr.indexOf(UIViewRoot.UNIQUE_ID_PREFIX);
@@ -815,7 +796,7 @@
private UIComponent findUIComponentBelow(UIComponent root, String id) {
UIComponent target = null;
- for (Iterator<UIComponent> iter = root.getFacetsAndChildren(); iter.hasNext(); ) {
+ for (Iterator<UIComponent> iter = root.getFacetsAndChildren(); iter.hasNext();) {
UIComponent child = (UIComponent) iter.next();
if (child instanceof NamingContainer) {
@@ -842,15 +823,15 @@
public static void writeEventHandlerFunction(FacesContext context, UIComponent component, String eventName)
throws IOException {
-
+
}
/**
* Common HTML elements and attributes names.
- *
+ *
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.6 $ $Date: 2007/02/08 19:07:16 $
- *
+ *
*/
public interface HTML {
public static final String ACCEPT_ATTRIBUTE = "accept";
@@ -931,29 +912,23 @@
"accesskey", "alt", "cols", "height", "lang", "longdesc", "maxlength", "rows", "size", "tabindex", "title",
"width", "dir", "rules", "frame", "border", "cellspacing", "cellpadding", "summary", "bgcolor", "usemap",
"enctype", "accept-charset", "accept", "target", "charset", "coords", "hreflang", "rel", "rev", "shape",
- "disabled", "readonly", "ismap", "align"
- };
+ "disabled", "readonly", "ismap", "align" };
/**
* HTML attributes allowed boolean-values only
*/
- public static final String[] PASS_THRU_BOOLEAN = {
- "disabled", "declare", "readonly", "compact", "ismap", "selected", "checked", "nowrap", "noresize",
- "nohref", "noshade", "multiple"
- };
- public static final String[] PASS_THRU_EVENTS = {
- "onblur", "onchange", "onclick", "ondblclick", "onfocus", "onkeydown", "onkeypress", "onkeyup", "onload",
- "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onreset", "onselect", "onsubmit",
- "onunload"
- };
- public static final String[] PASS_THRU_STYLES = {"style", "class", };
+ public static final String[] PASS_THRU_BOOLEAN = { "disabled", "declare", "readonly", "compact", "ismap",
+ "selected", "checked", "nowrap", "noresize", "nohref", "noshade", "multiple" };
+ public static final String[] PASS_THRU_EVENTS = { "onblur", "onchange", "onclick", "ondblclick", "onfocus",
+ "onkeydown", "onkeypress", "onkeyup", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover",
+ "onmouseup", "onreset", "onselect", "onsubmit", "onunload" };
+ public static final String[] PASS_THRU_STYLES = { "style", "class", };
/**
* all HTML attributes with URI value.
*/
- public static final String[] PASS_THRU_URI = {
- "usemap", "background", "codebase", "cite", "data", "classid", "href", "longdesc", "profile", "src"
- };
+ public static final String[] PASS_THRU_URI = { "usemap", "background", "codebase", "cite", "data", "classid",
+ "href", "longdesc", "profile", "src" };
public static final String READONLY_ATTRIBUTE = "readonly";
public static final String REL_ATTR = "rel";
public static final String REV_ATTR = "rev";
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2009-12-29 01:11:58 UTC (rev 16215)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2009-12-29 01:12:10 UTC (rev 16216)
@@ -21,28 +21,32 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+package org.richfaces.cdk.test.component;
+import java.util.List;
-package org.richfaces.cdk.test.component;
+import javax.faces.component.UIComponentBase;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.Component;
import org.richfaces.cdk.annotations.Family;
+import org.richfaces.cdk.annotations.Fires;
import org.richfaces.cdk.annotations.Generate;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.test.event.TestEvent;
-import java.util.List;
-
-import javax.faces.component.UIComponentBase;
-import javax.faces.component.ValueHolder;
-
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@Component("org.richfaces.cdk.test.TestComponent")
@Generate("org.richfaces.cdk.test.UITestComponent")
@Family("org.richfaces.cdk.test.Test")
+(a)Fires(TestEvent.class)
+@Tag(name = "test")
public abstract class AbstractTestComponent extends UIComponentBase {
@Attribute
private int foo;
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java 2009-12-29 01:11:58 UTC (rev 16215)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/UITestCommand.java 2009-12-29 01:12:10 UTC (rev 16216)
@@ -21,12 +21,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.test.component;
import javax.el.MethodExpression;
-
import javax.faces.component.ActionSource2;
import javax.faces.component.FacesComponent;
import javax.faces.component.UIComponentBase;
@@ -34,16 +31,19 @@
import javax.faces.event.ActionListener;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
@FacesComponent("cdk.TestCommand")
public class UITestCommand extends UIComponentBase implements ActionSource2 {
private static final String COMPONENT_FAMILY = "cdk.TestFamily";
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.UIComponent#getFamily()
*/
@Override
@@ -52,7 +52,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#addActionListener(javax.faces.event.ActionListener)
*/
public void addActionListener(ActionListener listener) {
@@ -61,7 +62,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#getAction()
*/
public MethodBinding getAction() {
@@ -71,7 +73,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#getActionListener()
*/
public MethodBinding getActionListener() {
@@ -81,7 +84,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#getActionListeners()
*/
public ActionListener[] getActionListeners() {
@@ -91,7 +95,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#isImmediate()
*/
public boolean isImmediate() {
@@ -101,7 +106,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#removeActionListener(javax.faces.event.ActionListener)
*/
public void removeActionListener(ActionListener listener) {
@@ -110,7 +116,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#setAction(javax.faces.el.MethodBinding)
*/
public void setAction(MethodBinding action) {
@@ -119,7 +126,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#setActionListener(javax.faces.el.MethodBinding)
*/
public void setActionListener(MethodBinding actionListener) {
@@ -133,7 +141,8 @@
}
/*
- * (non-Javadoc)
+ * (non-Javadoc)
+ *
* @see javax.faces.component.ActionSource#setImmediate(boolean)
*/
public void setImmediate(boolean immediate) {
Added: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestEvent.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestEvent.java (rev 0)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestEvent.java 2009-12-29 01:12:10 UTC (rev 16216)
@@ -0,0 +1,77 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.test.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class TestEvent extends FacesEvent {
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ */
+ private static final long serialVersionUID = -2659567077711540715L;
+
+ /**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @param component
+ */
+ public TestEvent(UIComponent component) {
+ super(component);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+ @Override
+ public void processListener(FacesListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Property changes on: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestEvent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/it/xml-configured-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/it/xml-configured-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-12-29 01:11:58 UTC (rev 16215)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/it/xml-configured-component/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2009-12-29 01:12:10 UTC (rev 16216)
@@ -19,15 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.ajax4jsf.renderkit;
-
import java.io.IOException;
-
import java.lang.reflect.Array;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
@@ -44,22 +39,19 @@
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
-import javax.faces.component.UIParameter;
import javax.faces.component.UIViewRoot;
import javax.faces.component.ValueHolder;
-import javax.faces.component.behavior.ClientBehaviorContext.Parameter;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.convert.Converter;
/**
- * Util class for common render operations - render passthru html attributes,
- * iterate over child components etc.
- *
+ * Util class for common render operations - render passthru html attributes, iterate over child components etc.
+ *
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.6 $ $Date: 2007/02/08 19:07:16 $
- *
+ *
*/
public class RendererUtils {
public static final String DUMMY_FORM_ID = ":_form";
@@ -90,6 +82,7 @@
/**
* Use this method to get singleton instance of RendererUtils
+ *
* @return singleton instance
*/
public static RendererUtils getInstance() {
@@ -98,7 +91,7 @@
/**
* Encode id attribute with clientId component property
- *
+ *
* @param context
* @param component
* @throws IOException
@@ -109,7 +102,7 @@
/**
* Encode clientId to custom attribute ( for example, to control name )
- *
+ *
* @param context
* @param component
* @param attribute
@@ -127,14 +120,13 @@
if (null != clientId) {
context.getResponseWriter().writeAttribute(attribute, clientId,
- (String) getComponentAttributeName(attribute));
+ (String) getComponentAttributeName(attribute));
}
}
/**
- * Encode id attribute with clientId component property. Encoded only if id
- * not auto generated.
- *
+ * Encode id attribute with clientId component property. Encoded only if id not auto generated.
+ *
* @param context
* @param component
* @throws IOException
@@ -142,32 +134,29 @@
public void encodeCustomId(FacesContext context, UIComponent component) throws IOException {
if ((component.getId() != null) && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) {
context.getResponseWriter().writeAttribute(HTML.ID_ATTRIBUTE, component.getClientId(context),
- HTML.ID_ATTRIBUTE);
+ HTML.ID_ATTRIBUTE);
}
}
public Map<String, Object> createParametersMap(FacesContext context, UIComponent component) {
Map<String, Object> parameters = new LinkedHashMap<String, Object>();
-
return parameters;
}
private void encodeBehaviors(FacesContext context, ClientBehaviorHolder behaviorHolder,
- String defaultHtmlEventName, String[] attributesExclusions)
- throws IOException {
+ String defaultHtmlEventName, String[] attributesExclusions) throws IOException {
}
/**
* Encode common pass-thru html attributes.
- *
+ *
* @param context
* @param component
* @throws IOException
*/
- public void encodePassThru(FacesContext context, UIComponent component, String defaultHtmlEvent)
- throws IOException {
+ public void encodePassThru(FacesContext context, UIComponent component, String defaultHtmlEvent) throws IOException {
encodeAttributesFromArray(context, component, HTML.PASS_THRU);
@@ -182,15 +171,15 @@
/**
* Encode pass-through attributes except specified ones
- *
+ *
* @param context
* @param component
* @param exclusions
* @throws IOException
*/
public void encodePassThruWithExclusions(FacesContext context, UIComponent component, String exclusions,
- String defaultHtmlEvent) throws IOException {
-
+ String defaultHtmlEvent) throws IOException {
+
if (null != exclusions) {
String[] exclusionsArray = exclusions.split(",");
@@ -199,8 +188,8 @@
}
public void encodePassThruWithExclusionsArray(FacesContext context, UIComponent component, String[] exclusions,
- String defaultHtmlEvent) throws IOException {
-
+ String defaultHtmlEvent) throws IOException {
+
ResponseWriter writer = context.getResponseWriter();
Map<String, Object> attributes = component.getAttributes();
@@ -230,16 +219,15 @@
}
/**
- * Encode one pass-thru attribute, with plain/boolean/url value, got from
- * properly component attribute.
- *
+ * Encode one pass-thru attribute, with plain/boolean/url value, got from properly component attribute.
+ *
* @param context
* @param writer
* @param attribute
* @throws IOException
*/
public void encodePassThruAttribute(FacesContext context, Map<String, Object> attributes, ResponseWriter writer,
- String attribute) throws IOException {
+ String attribute) throws IOException {
Object value = attributeValue(attribute, attributes.get(getComponentAttributeName(attribute)));
@@ -257,7 +245,7 @@
public void encodeAttributesFromArray(FacesContext context, UIComponent component, String[] attrs)
throws IOException {
-
+
ResponseWriter writer = context.getResponseWriter();
Map<String, Object> attributes = component.getAttributes();
@@ -270,7 +258,7 @@
/**
* Encode attributes given by comma-separated string list.
- *
+ *
* @param context
* current JSF context
* @param component
@@ -292,12 +280,12 @@
* @param component
* @param property
* @param attributeName
- *
+ *
* @throws IOException
*/
public void encodeAttribute(FacesContext context, UIComponent component, Object property, String attributeName)
throws IOException {
-
+
ResponseWriter writer = context.getResponseWriter();
Object value = component.getAttributes().get(property);
@@ -311,14 +299,14 @@
}
public void writeText(ResponseWriter writer, Object value, String property) throws IOException {
- if (value != null) {
- writer.writeText(value, property);
- }
+ if (value != null) {
+ writer.writeText(value, property);
+ }
}
-
+
/**
* Write html-attribute
- *
+ *
* @param writer
* @param attribute
* @param value
@@ -331,15 +319,14 @@
}
/**
- * @return true if and only if the argument <code>attributeVal</code> is
- * an instance of a wrapper for a primitive type and its value is
- * equal to the default value for that type as given in the spec.
+ * @return true if and only if the argument <code>attributeVal</code> is an instance of a wrapper for a primitive
+ * type and its value is equal to the default value for that type as given in the spec.
*/
public boolean shouldRenderAttribute(Object attributeVal) {
if (null == attributeVal) {
return false;
} else if ((attributeVal instanceof Boolean)
- && ((Boolean) attributeVal).booleanValue() == Boolean.FALSE.booleanValue()) {
+ && ((Boolean) attributeVal).booleanValue() == Boolean.FALSE.booleanValue()) {
return false;
} else if (attributeVal.toString().length() == 0) {
return false;
@@ -361,12 +348,11 @@
}
/**
- * Test for valid value of property. by default, for non-setted properties
- * with Java primitive types of JSF component return appropriate MIN_VALUE .
- *
- * @param property -
- * value of property returned from
- * {@link UIComponent#getAttributes()}
+ * Test for valid value of property. by default, for non-setted properties with Java primitive types of JSF
+ * component return appropriate MIN_VALUE .
+ *
+ * @param property
+ * - value of property returned from {@link UIComponent#getAttributes()}
* @return true for setted property, false otherthise.
*/
public boolean isValidProperty(Object property) {
@@ -392,15 +378,15 @@
}
/**
- * Checks if the argument passed in is empty or not.
- * Object is empty if it is: <br />
- * - <code>null<code><br />
+ * Checks if the argument passed in is empty or not. Object is empty if it is: <br />
+ * - <code>null<code><br />
* - zero-length string<br />
* - empty collection<br />
* - empty map<br />
* - zero-length array<br />
- *
- * @param o object to check for emptiness
+ *
+ * @param o
+ * object to check for emptiness
* @since 3.3.2
* @return <code>true</code> if the argument is empty, <code>false</code> otherwise
*/
@@ -430,7 +416,7 @@
/**
* Convert HTML attribute name to component property name.
- *
+ *
* @param key
* @return
*/
@@ -445,10 +431,9 @@
}
/**
- * Convert attribute value to proper object. For known html boolean
- * attributes return name for true value, otherthise - null. For non-boolean
- * attributes return same value.
- *
+ * Convert attribute value to proper object. For known html boolean attributes return name for true value,
+ * otherthise - null. For non-boolean attributes return same value.
+ *
* @param name
* attribute name.
* @param value
@@ -472,12 +457,11 @@
/**
* Get boolean value of logical attribute
- *
+ *
* @param component
* @param name
* attribute name
- * @return true if attribute is equals Boolean.TRUE or String "true" , false
- * otherwise.
+ * @return true if attribute is equals Boolean.TRUE or String "true" , false otherwise.
*/
public boolean isBooleanAttribute(UIComponent component, String name) {
Object attrValue = component.getAttributes().get(name);
@@ -495,9 +479,8 @@
}
/**
- * Return converted value for {@link javax.faces.component.ValueHolder} as
- * String, perform nessesary convertions.
- *
+ * Return converted value for {@link javax.faces.component.ValueHolder} as String, perform nessesary convertions.
+ *
* @param context
* @param component
* @return
@@ -523,10 +506,9 @@
}
/**
- * Convert any object value to string. If component instance of
- * {@link ValueHolder } got {@link Converter} for formatting. If not,
- * attempt to use converter based on value type.
- *
+ * Convert any object value to string. If component instance of {@link ValueHolder } got {@link Converter} for
+ * formatting. If not, attempt to use converter based on value type.
+ *
* @param context
* @param component
* @return
@@ -570,9 +552,9 @@
/**
* formats given value to
- *
+ *
* @param value
- *
+ *
* @return
*/
public String encodePctOrPx(String value) {
@@ -585,7 +567,7 @@
/**
* Find nested form for given component
- *
+ *
* @param component
* @return nested <code>UIForm</code> component, or <code>null</code>
*/
@@ -636,7 +618,7 @@
*/
public void encodeBeginForm(FacesContext context, UIComponent component, ResponseWriter writer, String clientId)
throws IOException {
-
+
String actionURL = getActionUrl(context);
String encodeActionURL = context.getExternalContext().encodeActionURL(actionURL);
@@ -685,7 +667,7 @@
/**
* Simplified version of {@link encodeId}
- *
+ *
* @param context
* @param component
* @return client id of current component
@@ -705,7 +687,7 @@
/**
* Wtrie JavaScript with start/end elements and type.
- *
+ *
* @param context
* @param component
* @param script
@@ -727,15 +709,15 @@
* @return
*/
private static boolean checkKeyword(Collection<String> ids, String keyword) {
- if (ids.contains(keyword)) {
- if (ids.size() != 1) {
- //TODO log
- }
-
- return true;
- }
-
- return false;
+ if (ids.contains(keyword)) {
+ if (ids.size() != 1) {
+ // TODO log
+ }
+
+ return true;
+ }
+
+ return false;
}
/**
@@ -745,14 +727,12 @@
* @since 4.0
* @return
*/
- public Collection<String> findComponentsFor(FacesContext context, UIComponent component,
- Collection<String> shortIds) {
+ public Collection<String> findComponentsFor(FacesContext context, UIComponent component, Collection<String> shortIds) {
// TODO - implement
// TODO add support for @*
Set<String> result = new LinkedHashSet<String>(shortIds.size());
-
return result;
}
@@ -793,9 +773,10 @@
/**
* If target component contains generated id and for doesn't, correct for id
+ *
* @param forAttr
* @param component
- *
+ *
*/
public String correctForIdReference(String forAttr, UIComponent component) {
int contains = forAttr.indexOf(UIViewRoot.UNIQUE_ID_PREFIX);
@@ -815,7 +796,7 @@
private UIComponent findUIComponentBelow(UIComponent root, String id) {
UIComponent target = null;
- for (Iterator<UIComponent> iter = root.getFacetsAndChildren(); iter.hasNext(); ) {
+ for (Iterator<UIComponent> iter = root.getFacetsAndChildren(); iter.hasNext();) {
UIComponent child = (UIComponent) iter.next();
if (child instanceof NamingContainer) {
@@ -842,15 +823,15 @@
public static void writeEventHandlerFunction(FacesContext context, UIComponent component, String eventName)
throws IOException {
-
+
}
/**
* Common HTML elements and attributes names.
- *
+ *
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.6 $ $Date: 2007/02/08 19:07:16 $
- *
+ *
*/
public interface HTML {
public static final String ACCEPT_ATTRIBUTE = "accept";
@@ -931,29 +912,23 @@
"accesskey", "alt", "cols", "height", "lang", "longdesc", "maxlength", "rows", "size", "tabindex", "title",
"width", "dir", "rules", "frame", "border", "cellspacing", "cellpadding", "summary", "bgcolor", "usemap",
"enctype", "accept-charset", "accept", "target", "charset", "coords", "hreflang", "rel", "rev", "shape",
- "disabled", "readonly", "ismap", "align"
- };
+ "disabled", "readonly", "ismap", "align" };
/**
* HTML attributes allowed boolean-values only
*/
- public static final String[] PASS_THRU_BOOLEAN = {
- "disabled", "declare", "readonly", "compact", "ismap", "selected", "checked", "nowrap", "noresize",
- "nohref", "noshade", "multiple"
- };
- public static final String[] PASS_THRU_EVENTS = {
- "onblur", "onchange", "onclick", "ondblclick", "onfocus", "onkeydown", "onkeypress", "onkeyup", "onload",
- "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onreset", "onselect", "onsubmit",
- "onunload"
- };
- public static final String[] PASS_THRU_STYLES = {"style", "class", };
+ public static final String[] PASS_THRU_BOOLEAN = { "disabled", "declare", "readonly", "compact", "ismap",
+ "selected", "checked", "nowrap", "noresize", "nohref", "noshade", "multiple" };
+ public static final String[] PASS_THRU_EVENTS = { "onblur", "onchange", "onclick", "ondblclick", "onfocus",
+ "onkeydown", "onkeypress", "onkeyup", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover",
+ "onmouseup", "onreset", "onselect", "onsubmit", "onunload" };
+ public static final String[] PASS_THRU_STYLES = { "style", "class", };
/**
* all HTML attributes with URI value.
*/
- public static final String[] PASS_THRU_URI = {
- "usemap", "background", "codebase", "cite", "data", "classid", "href", "longdesc", "profile", "src"
- };
+ public static final String[] PASS_THRU_URI = { "usemap", "background", "codebase", "cite", "data", "classid",
+ "href", "longdesc", "profile", "src" };
public static final String READONLY_ATTRIBUTE = "readonly";
public static final String REL_ATTR = "rel";
public static final String REV_ATTR = "rev";
15 years
JBoss Rich Faces SVN: r16215 - root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-12-28 20:11:58 -0500 (Mon, 28 Dec 2009)
New Revision: 16215
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Renderer.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Tag.java
Log:
set proper order of faces-config elements.
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Renderer.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Renderer.java 2009-12-28 22:46:45 UTC (rev 16214)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Renderer.java 2009-12-29 01:11:58 UTC (rev 16215)
@@ -50,7 +50,7 @@
*
* @return JSF <em>renderer-type</em>.
*/
- public String type() default "";
+ public String value() default "";
}
Modified: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Tag.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Tag.java 2009-12-28 22:46:45 UTC (rev 16214)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Tag.java 2009-12-29 01:11:58 UTC (rev 16215)
@@ -23,16 +23,22 @@
package org.richfaces.cdk.annotations;
+import java.io.IOException;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
+
/**
* <p class="changed_added_4_0">
* </p>
- *
+ *
* @author asmirnov(a)exadel.com
*/
@Retention(RetentionPolicy.CLASS)
@@ -46,25 +52,28 @@
* <p class="changed_added_4_0">
* Name of the JSF tag that creates target component.
* </p>
- *
+ *
* @return tag name.
*/
public String name();
- /**
- * <p class="changed_added_4_0">The value of this annotation attribute defines JSF renderer that will be
- * associated with component.</p>
- *
- * @return
- */
- public Renderer renderer();
+ public Class<? extends TagHandler> handler() default DEFAULT.class;
/**
- * <p class="changed_added_4_0">Taglib url in which generated tag will be defined. By default CDK uses url
- * defined in the built project.</p>
- *
- * @return
+ * Used in {@link Tag} to signal that tag uses the default handler.
*/
- public String taglib() default "";
+ static final class DEFAULT extends TagHandler {
+
+ public DEFAULT(TagConfig config) {
+ super(config);
+ }
+
+ @Override
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
+ // do nothing
+ }
+
+ }
+
}
15 years
JBoss Rich Faces SVN: r16214 - in root/ui-sandbox/trunk/components/tables: ui/src/main/java/org/richfaces/component and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-12-28 17:46:45 -0500 (Mon, 28 Dec 2009)
New Revision: 16214
Modified:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Column.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/Expandable.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumnGroup.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIToggleControl.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlToggleControl.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/state/DataTableState.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/state/SubTableState.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/event/ToggleEvent.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/event/ToggleListener.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/SortingFilteringVisualModel.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRowsRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ToggleControlRendererBase.java
Log:
Code review results committed
Modified: root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Column.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Column.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Column.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -37,8 +37,8 @@
* The column allows data sorting
* @return
*/
+ //TODO nick - deprecate this?
public abstract boolean isSortable();
-
public abstract void setSortable(boolean sortable);
/**
@@ -47,6 +47,7 @@
* EL-expression is evaluated on every data row
* @param sortExpression
*/
+ //TODO nick - use ValueExpression
public abstract void setSortExpression(String sortExpression);
public abstract String getSortExpression();
@@ -55,12 +56,17 @@
*
* @param sortOrder
*/
+ //TODO nick - use annotation from Swing?
public abstract void setSortOrder(Ordering sortOrder);
public abstract Ordering getSortOrder();
+
+ //TODO nick - "filterExpression" is missing
+ //TODO nick - "selfSorted" is missing
public abstract void setFilterMethod(MethodExpression methodExpression);
public abstract MethodExpression getFilterMethod();
+ //TODO nick - make this java.lang.Object. Use case: Long or Enum used as filtering criteria
public abstract void setFilterValue(String filterValue);
public abstract String getFilterValue();
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/Expandable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/Expandable.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/Expandable.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -4,8 +4,10 @@
import org.richfaces.event.ToggleListener;
+//TODO nick - move to API
public interface Expandable {
+ //TODO nick - setExpanded()
public boolean isExpanded();
public void addToggleListener(ToggleListener listener);
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -14,6 +14,7 @@
public abstract void setColspan(int colspan);
+ //TODO nick - implement in the proper way
public Ordering getSortOrder() {
return null;
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumnGroup.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumnGroup.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumnGroup.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -61,6 +61,7 @@
return;
}
+ //TODO nick - implement in the proper way
visitor.process(context, null, argument);
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -66,6 +66,7 @@
model = new DataTableVisualModelImpl();
if ((modelExpression != null) && (!modelExpression.isReadOnly(elContext))) {
+ //TODO nick - handle ELException
modelExpression.setValue(elContext, model);
}
}
@@ -76,7 +77,9 @@
if(model.getSortingFilteringVisualModel() == null) {
model.setSortingFilteringVisualModel(initSortingFilteringVisualModel());
- }
+ } else {
+ //TODO nick - init SortingFilteringVisualModel from model
+ }
}
dataTableState.setVisualModel(model);
@@ -121,6 +124,7 @@
return getFacet("caption");
}
+ //TODO nick - move methods that work with CSS classes into renderer
public String getTableSkinClass() {
return "rich-table";
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -141,6 +141,7 @@
public DataTableState getParentState() {
DataTableState dataTableState = null;
+ //TODO nick - walk by parents until UIDataTable is found or no parent exists
UIComponent component = getParent();
if (component instanceof UIDataTable) {
UIDataTable dataTable = (UIDataTable) component;
@@ -160,6 +161,7 @@
DataTableState parentState = getParentState();
if (parentState != null) {
+ //TODO nick - use getClientId(FacesContext)
state = parentState.getChildState(getClientId());
}
@@ -179,6 +181,7 @@
}
public void setToggleListener(MethodExpression toggleExpression) {
+ //TODO nick - use addToggleListener() & MethodExpression wrapper in tag
getStateHelper().put(PropertyKeys.toggleExpression, toggleExpression);
}
@@ -188,7 +191,10 @@
@Override
public void queueEvent(FacesEvent event) {
+ //TODO nick - what if event comes from the nested subTable?
if (event instanceof ToggleEvent) {
+ //TODO nick - why Ajax is processing at special phase?
+ //TODO nick - "immediate" support?
if(getSwichType().equals(SWITCH_TYPE_AJAX)) {
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
} else {
@@ -218,6 +224,7 @@
UIToggleControl toggle = (UIToggleControl)toggleEvent.getSource();
// toggle.addExecuteId((String)getAttributes().get("clientId"));
+ //TODO nick - replace with getClientId(FacesContext)
toggle.addRenderId((String)getAttributes().get("clientId"));
}
}
@@ -244,6 +251,7 @@
return COMPONENT_FAMILY;
}
+ //TODO nick - these methods are renderer-specific, should be moved to renderer-related code
@Override
public String getRowSkinClass() {
return "rich-subtable-row";
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIToggleControl.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIToggleControl.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIToggleControl.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -63,6 +63,7 @@
}
public void addExecuteId(String id){
+ //TODO nick - if user has provided collection in bean it shouldn't be modified by the component - create a copy
getExecute().add(id);
}
@@ -76,6 +77,7 @@
}
public void addRenderId(String id){
+ //TODO nick - if user has provided collection in bean it shouldn't be modified by the component - create a copy
getRender().add(id);
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlToggleControl.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlToggleControl.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlToggleControl.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -2,5 +2,6 @@
import org.richfaces.component.UIToggleControl;
+//TODO nick - behavior support
public class HtmlToggleControl extends UIToggleControl {
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/state/DataTableState.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/state/DataTableState.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/state/DataTableState.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -47,9 +47,11 @@
return this.rows;
}
+ //TODO nick - save/restore first/rows/visualModel
public void restoreState(FacesContext context, Object state) {
Object[] newState = (Object[]) state;
if (newState != null) {
+ //TODO nick - do we need to support SubTableState that are StateHolder?
subTableStates = (Map<String, SubTableState>) newState[0];
}
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/state/SubTableState.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/state/SubTableState.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/state/SubTableState.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -54,6 +54,7 @@
this.model = model;
}
+ //TODO nick - do we need to support SubTableVisualModel that are StateHolder?
public void restoreState(FacesContext context, Object state) {
Object[] currentState = (Object[]) state;
this.model = (SubTableVisualModel) currentState[0];
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/event/ToggleEvent.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/event/ToggleEvent.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/event/ToggleEvent.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -8,6 +8,7 @@
* @author Anton Belevich
*
*/
+//TODO nick - move to api
public class ToggleEvent extends FacesEvent {
private static final long serialVersionUID = 2916560585918250885L;
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/event/ToggleListener.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/event/ToggleListener.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/event/ToggleListener.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -6,6 +6,7 @@
* @author Anton Belevich
*
*/
+//TODO nick - move to api
public interface ToggleListener extends FacesListener {
public void processToggle(ToggleEvent event);
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/SortingFilteringVisualModel.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/SortingFilteringVisualModel.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/SortingFilteringVisualModel.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -4,6 +4,7 @@
public interface SortingFilteringVisualModel {
+ //TODO nick - make this Enum
public String getSortMode();
public void setSortMode(String sortMode);
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -32,6 +32,7 @@
boolean result = false;
while (columns.hasNext() && !result) {
UIComponent component = columns.next();
+ //TODO nick - only rendered facets should be handled
result = (component.isRendered() && null != component.getFacet(facetName));
}
return result;
@@ -232,6 +233,7 @@
}
+ //TODO nick - use org.richfaces.component.util.HtmlUtil.concatClasses(String...)
protected String mergeStyleClasses(String classAttribibute, String skinClass, UIComponent component) {
String styleClass = null;
String resultClass = skinClass;
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRowsRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRowsRenderer.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRowsRenderer.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -129,6 +129,7 @@
context.getAttributes().put(key, value);
}
+ //TODO nick - nested tables will not work correct
protected void saveRowStyles(FacesContext context, String firstRowClass, String rowClass, String cellClass) {
put(context, FIRST_ROW_CLASS_KEY, firstRowClass);
put(context, ROW_CLASS_KEY, rowClass);
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ToggleControlRendererBase.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ToggleControlRendererBase.java 2009-12-28 14:55:14 UTC (rev 16213)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ToggleControlRendererBase.java 2009-12-28 22:46:45 UTC (rev 16214)
@@ -80,6 +80,7 @@
UIToggleControl toggleControl = (UIToggleControl) component;
UISubTable subTable = findComponent(context, toggleControl);
+ //TODO nick - remove the next line
subTable.getAttributes().get("expanded");
if (subTable != null) {
ResponseWriter writer = context.getResponseWriter();
@@ -131,6 +132,8 @@
writer.writeAttribute(eventName, script, null);
}
+ //TODO nick - if image is empty, then no tag should be encoded
+ //TODO nick - "alt" attribute is required for <IMG>
if (image != null && image.trim().length() > 0) {
writer.writeAttribute(HTML.SRC_ATTRIBUTE, image, null);
}
15 years
JBoss Rich Faces SVN: r16213 - root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-12-28 09:55:14 -0500 (Mon, 28 Dec 2009)
New Revision: 16213
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
Log:
RF-7868
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2009-12-28 06:51:50 UTC (rev 16212)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2009-12-28 14:55:14 UTC (rev 16213)
@@ -60,10 +60,16 @@
var updateLayout = function() {
var offsetWidth = frozenHeaderPartElement ? frozenHeaderPartElement.offsetWidth : 0;
- normalPartStyle.width = element.clientWidth - offsetWidth + "px";
- var delta = scrollElement.firstChild.offsetHeight - scrollElement.clientHeight;
- if (delta) {
- scrollElement.style.height = scrollElement.offsetHeight + delta;
+ var width = Math.max(0, element.clientWidth - offsetWidth);
+ if (width) {
+ normalPartStyle.width = width + "px";
+ normalPartStyle.display = "";
+ var delta = scrollElement.firstChild.offsetHeight - scrollElement.clientHeight;
+ if (delta) {
+ scrollElement.style.height = scrollElement.offsetHeight + delta;
+ }
+ } else {
+ normalPartStyle.display = "none";
}
var height = element.clientHeight;
var el = element.firstChild;
@@ -129,6 +135,7 @@
var drag = function(event) {
dragElement.style.left = Math.max(resizeData.left + MIN_WIDTH, event.clientX);
+ return false;
};
var beginResize = function(event) {
var parts = this.id.split(":");
15 years
JBoss Rich Faces SVN: r16212 - in root/cdk/trunk/plugins: maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-12-28 01:51:50 -0500 (Mon, 28 Dec 2009)
New Revision: 16212
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
Log:
Move generation to APT
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2009-12-24 18:51:04 UTC (rev 16211)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2009-12-28 06:51:50 UTC (rev 16212)
@@ -39,6 +39,7 @@
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.CdkWorker;
+import org.richfaces.cdk.ModelValidator;
import org.richfaces.cdk.StandardOutputs;
import org.richfaces.cdk.StandardSources;
import org.richfaces.cdk.CdkContext.OutputType;
@@ -99,6 +100,7 @@
// parse non-java sources
getContext().getBuilderFor(StandardSources.FACES_CONFIGS).build();
getContext().getBuilderFor(StandardSources.RENDERER_TEMPLATES).build();
+ getContext().getWorker(ModelValidator.class).verify(getContext().getLibrary());
} else if(!getContext().getErrors().iterator().hasNext()){
// processing over, generate files.
for (OutputType type : StandardOutputs.values()) {
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2009-12-24 18:51:04 UTC (rev 16211)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2009-12-28 06:51:50 UTC (rev 16212)
@@ -37,12 +37,14 @@
import org.richfaces.cdk.CdkWorker;
import org.richfaces.cdk.LibraryBuilder;
import org.richfaces.cdk.LoggerFactory;
+import org.richfaces.cdk.ModelBuilder;
import org.richfaces.cdk.ModelValidator;
import org.richfaces.cdk.NamingConventions;
import org.richfaces.cdk.RichFacesConventions;
import org.richfaces.cdk.StandardOutputFolders;
import org.richfaces.cdk.StandardSources;
import org.richfaces.cdk.ValidatorImpl;
+import org.richfaces.cdk.apt.AptBuilder;
import java.io.File;
import java.net.MalformedURLException;
@@ -287,7 +289,8 @@
try {
// Build JSF library.
- LibraryBuilder builder = LibraryBuilder.createInstance(context);
+// LibraryBuilder builder = LibraryBuilder.createInstance(context);
+ ModelBuilder builder = context.getWorker(AptBuilder.class);
builder.build();
// Tell project about generated files.
15 years