JBoss Ajax4JSF SVN: r47 - branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-03-30 20:27:58 -0400 (Fri, 30 Mar 2007)
New Revision: 47
Added:
branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/SerializableDataModel.java
branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/UISelector.java
Modified:
branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/AjaxDataEncoder.java
branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/DataComponentState.java
branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/DataVisitor.java
branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/ExtendedDataModel.java
branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/Range.java
branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/RepeatState.java
branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/SequenceDataModel.java
branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/SequenceRange.java
branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java
branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/UIRepeat.java
Log:
Fix Issue http://jira.jboss.com/jira/browse/AJSF-11 in 1.0 branch
Modified: branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/AjaxDataEncoder.java
===================================================================
--- branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/AjaxDataEncoder.java 2007-03-30 17:44:16 UTC (rev 46)
+++ branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/AjaxDataEncoder.java 2007-03-31 00:27:58 UTC (rev 47)
@@ -1,7 +1,7 @@
/**
* License Agreement.
*
- * Ajax4jsf 1.0 - Natural Ajax for Java Server Faces (JSF)
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*
Modified: branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/DataComponentState.java
===================================================================
--- branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/DataComponentState.java 2007-03-30 17:44:16 UTC (rev 46)
+++ branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/DataComponentState.java 2007-03-31 00:27:58 UTC (rev 47)
@@ -1,7 +1,7 @@
/**
* License Agreement.
*
- * Ajax4jsf 1.0 - Natural Ajax for Java Server Faces (JSF)
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*
@@ -32,7 +32,7 @@
* @author shura
*
*/
-public interface DataComponentState extends StateHolder {
+public interface DataComponentState {
/**
* Build used data objects range for iteration.
Modified: branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/DataVisitor.java
===================================================================
--- branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/DataVisitor.java 2007-03-30 17:44:16 UTC (rev 46)
+++ branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/DataVisitor.java 2007-03-31 00:27:58 UTC (rev 47)
@@ -1,7 +1,7 @@
/**
* License Agreement.
*
- * Ajax4jsf 1.0 - Natural Ajax for Java Server Faces (JSF)
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*
Modified: branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/ExtendedDataModel.java
===================================================================
--- branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/ExtendedDataModel.java 2007-03-30 17:44:16 UTC (rev 46)
+++ branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/ExtendedDataModel.java 2007-03-31 00:27:58 UTC (rev 47)
@@ -1,7 +1,7 @@
/**
* License Agreement.
*
- * Ajax4jsf 1.0 - Natural Ajax for Java Server Faces (JSF)
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*
@@ -57,7 +57,7 @@
* for example - to avoid requests to database until all data is validated.
* @return
*/
- public ExtendedDataModel getSerializableModel(Range range){
+ public SerializableDataModel getSerializableModel(Range range){
// By default, model not serializable.
return null;
}
Modified: branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/Range.java
===================================================================
--- branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/Range.java 2007-03-30 17:44:16 UTC (rev 46)
+++ branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/Range.java 2007-03-31 00:27:58 UTC (rev 47)
@@ -1,7 +1,7 @@
/**
* License Agreement.
*
- * Ajax4jsf 1.0 - Natural Ajax for Java Server Faces (JSF)
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*
Modified: branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/RepeatState.java
===================================================================
--- branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/RepeatState.java 2007-03-30 17:44:16 UTC (rev 46)
+++ branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/RepeatState.java 2007-03-31 00:27:58 UTC (rev 47)
@@ -1,7 +1,7 @@
/**
* License Agreement.
*
- * Ajax4jsf 1.0 - Natural Ajax for Java Server Faces (JSF)
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*
@@ -29,13 +29,17 @@
* @author shura
*
*/
-public class RepeatState implements DataComponentState {
+public class RepeatState implements DataComponentState,Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5552520123654180445L;
+
private int _rows = -1;
private int _first = 0;
- private boolean _transient = true;
/**
* @return the first
@@ -73,37 +77,5 @@
return new SequenceRange(getFirst(),getRows());
}
- /* (non-Javadoc)
- * @see javax.faces.component.StateHolder#isTransient()
- */
- public boolean isTransient() {
- return this._transient;
- }
- /* (non-Javadoc)
- * @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object)
- */
- public void restoreState(FacesContext context, Object state) {
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext)
- */
- public Object saveState(FacesContext context) {
- return null;
- }
-
- private static final class State implements Serializable{
- private int first;
- private int rows;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.StateHolder#setTransient(boolean)
- */
- public void setTransient(boolean newTransientValue) {
- this._transient = newTransientValue;
-
- }
-
}
Modified: branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/SequenceDataModel.java
===================================================================
--- branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/SequenceDataModel.java 2007-03-30 17:44:16 UTC (rev 46)
+++ branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/SequenceDataModel.java 2007-03-31 00:27:58 UTC (rev 47)
@@ -1,7 +1,7 @@
/**
* License Agreement.
*
- * Ajax4jsf 1.0 - Natural Ajax for Java Server Faces (JSF)
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*
@@ -32,14 +32,14 @@
*/
public class SequenceDataModel extends ExtendedDataModel {
- DataModel wrapped;
+ private DataModel wrappedModel;
/**
* @param wrapped
*/
public SequenceDataModel(DataModel wrapped) {
super();
- this.wrapped = wrapped;
+ this.wrappedModel = wrapped;
}
/* (non-Javadoc)
@@ -83,7 +83,7 @@
public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) throws IOException {
final SequenceRange seqRange = (SequenceRange) range;
int rows = seqRange.getRows();
- int rowCount = wrapped.getRowCount();
+ int rowCount = wrappedModel.getRowCount();
int currentRow = seqRange.getFirstRow();
if(rows > 0){
rows += currentRow;
@@ -96,8 +96,8 @@
rows = -1;
}
while (rows < 0 || currentRow < rows) {
- wrapped.setRowIndex(currentRow);
- if(wrapped.isRowAvailable()){
+ wrappedModel.setRowIndex(currentRow);
+ if(wrappedModel.isRowAvailable()){
visitor.process(context, new Integer(currentRow), argument);
} else {
break;
@@ -111,30 +111,23 @@
* @see org.ajax4jsf.ajax.repeat.ExtendedDataModel#getRowKey()
*/
public Object getRowKey() {
- int index = wrapped.getRowIndex();
+ int index = wrappedModel.getRowIndex();
if(index<0){
return null;
}
return new Integer(index);
}
- /* (non-Javadoc)
- * @see org.ajax4jsf.ajax.repeat.ExtendedDataModel#getSerializableModel(org.ajax4jsf.ajax.repeat.Range)
- */
- public ExtendedDataModel getSerializableModel(Range range) {
- // By default data not serializable
- return null;
- }
/* (non-Javadoc)
* @see org.ajax4jsf.ajax.repeat.ExtendedDataModel#setRowKey(java.lang.Object)
*/
public void setRowKey(Object key) {
if(null == key){
- wrapped.setRowIndex(-1);
+ wrappedModel.setRowIndex(-1);
} else {
Integer index = (Integer) key;
- wrapped.setRowIndex(index.intValue());
+ wrappedModel.setRowIndex(index.intValue());
}
}
@@ -143,7 +136,7 @@
*/
public int getRowCount() {
// TODO Auto-generated method stub
- return wrapped.getRowCount();
+ return wrappedModel.getRowCount();
}
/* (non-Javadoc)
@@ -151,7 +144,7 @@
*/
public Object getRowData() {
// TODO Auto-generated method stub
- return wrapped.getRowData();
+ return wrappedModel.getRowData();
}
/* (non-Javadoc)
@@ -159,7 +152,7 @@
*/
public int getRowIndex() {
// TODO Auto-generated method stub
- return wrapped.getRowIndex();
+ return wrappedModel.getRowIndex();
}
/* (non-Javadoc)
@@ -167,7 +160,7 @@
*/
public Object getWrappedData() {
// TODO Auto-generated method stub
- return wrapped.getWrappedData();
+ return wrappedModel.getWrappedData();
}
/* (non-Javadoc)
@@ -175,21 +168,35 @@
*/
public boolean isRowAvailable() {
// TODO Auto-generated method stub
- return wrapped.isRowAvailable();
+ return wrappedModel.isRowAvailable();
}
/* (non-Javadoc)
* @see javax.faces.model.DataModel#setRowIndex(int)
*/
public void setRowIndex(int rowIndex) {
- wrapped.setRowIndex(rowIndex);
+ wrappedModel.setRowIndex(rowIndex);
}
/* (non-Javadoc)
* @see javax.faces.model.DataModel#setWrappedData(java.lang.Object)
*/
public void setWrappedData(Object data) {
- wrapped.setWrappedData(data);
+ wrappedModel.setWrappedData(data);
}
+ /**
+ * @return the wrappedModel
+ */
+ protected DataModel getWrappedModel() {
+ return this.wrappedModel;
+ }
+
+ /**
+ * @param wrappedModel the wrappedModel to set
+ */
+ protected void setWrappedModel(DataModel wrappedModel) {
+ this.wrappedModel = wrappedModel;
+ }
+
}
Modified: branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/SequenceRange.java
===================================================================
--- branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/SequenceRange.java 2007-03-30 17:44:16 UTC (rev 46)
+++ branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/SequenceRange.java 2007-03-31 00:27:58 UTC (rev 47)
@@ -1,7 +1,7 @@
/**
* License Agreement.
*
- * Ajax4jsf 1.0 - Natural Ajax for Java Server Faces (JSF)
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*
Added: branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/SerializableDataModel.java
===================================================================
--- branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/SerializableDataModel.java (rev 0)
+++ branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/SerializableDataModel.java 2007-03-31 00:27:58 UTC (rev 47)
@@ -0,0 +1,39 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.ajax4jsf.ajax.repeat;
+
+import java.io.Serializable;
+
+/**
+ * Serializable version of {@link ExtendedDataModel}, for save lightweight version of data
+ *
+ * @author shura
+ *
+ */
+public abstract class SerializableDataModel extends ExtendedDataModel implements Serializable {
+
+ /**
+ * Method called after update all model values. For example, developer can update
+ * database with new values of modified rows.
+ */
+ public abstract void update();
+}
Modified: branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java
===================================================================
--- branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java 2007-03-30 17:44:16 UTC (rev 46)
+++ branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java 2007-03-31 00:27:58 UTC (rev 47)
@@ -1,7 +1,7 @@
/**
* License Agreement.
*
- * Ajax4jsf 1.0 - Natural Ajax for Java Server Faces (JSF)
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*
@@ -34,6 +34,7 @@
import javax.faces.application.FacesMessage;
import javax.faces.component.EditableValueHolder;
import javax.faces.component.NamingContainer;
+import javax.faces.component.StateHolder;
import javax.faces.component.UIComponent;
import javax.faces.component.UIData;
import javax.faces.context.FacesContext;
@@ -49,6 +50,8 @@
import org.ajax4jsf.framework.ajax.AjaxEvent;
import org.ajax4jsf.framework.renderer.AjaxChildrenRenderer;
+import com.sun.org.apache.bcel.internal.generic.GETSTATIC;
+
/**
* Base class for iterable components, like dataTable, Tomahawk dataList,
* Facelets repeat, tree etc., with support for partial rendering on AJAX
@@ -59,6 +62,11 @@
*/
public abstract class UIDataAdaptor extends UIData implements AjaxDataEncoder {
+ /**
+ *
+ */
+ public static final String COMPONENT_STATE_ATTRIBUTE = "componentState";
+
public final static DataModel EMPTY_MODEL = new ListDataModel(
Collections.EMPTY_LIST);
@@ -73,7 +81,7 @@
public void process(FacesContext context, Object rowKey, Object argument)
throws IOException {
- setRowKey(context,rowKey);
+ setRowKey(context, rowKey);
Iterator childIterator = dataChildren();
while (childIterator.hasNext()) {
UIComponent component = (UIComponent) childIterator.next();
@@ -126,19 +134,19 @@
* Base client id's of this component, for wich invoked encode... methods.
* Component will save state and serialisable models for this keys only.
*/
- private transient Set _encoded;
+ private Set _encoded;
/**
* Storage for data model instances with different client id's of this
* component. In case of child for UIData component, this map will keep data
* models for different iterations between phases.
*/
- private transient Map _modelsMap = new HashMap();
+ private Map _modelsMap = new HashMap();
/**
* Reference for curent data model
*/
- private transient ExtendedDataModel _currentModel = null;
+ private ExtendedDataModel _currentModel = null;
/**
* States of this component for diferent iterations, same as for models.
@@ -148,13 +156,15 @@
/**
* Reference for current component state.
*/
- private transient DataComponentState _currentState = null;
+ private DataComponentState _currentState = null;
/**
* Name of EL variable for current component state.
*/
- private String _varState;
+ private String _stateVar;
+ private String _rowKeyVar;
+
/**
* Key for current value in model.
*/
@@ -170,18 +180,33 @@
*
* @return the varState
*/
- public String getVarState() {
- return _varState;
+ public String getStateVar() {
+ return _stateVar;
}
/**
* @param varStatus
* the varStatus to set
*/
- public void setVarState(String varStatus) {
- this._varState = varStatus;
+ public void setStateVar(String varStatus) {
+ this._stateVar = varStatus;
}
+ /**
+ * @return the rowKeyVar
+ */
+ public String getRowKeyVar() {
+ return this._rowKeyVar;
+ }
+
+ /**
+ * @param rowKeyVar
+ * the rowKeyVar to set
+ */
+ public void setRowKeyVar(String rowKeyVar) {
+ this._rowKeyVar = rowKeyVar;
+ }
+
/*
* (non-Javadoc)
*
@@ -253,18 +278,22 @@
return this._rowKey;
}
- public void setRowKey(Object key){
+ public void setRowKey(Object key) {
setRowKey(FacesContext.getCurrentInstance(), key);
}
+
/**
* Setup current roy by key. Perform same functionality as
* {@link UIData#setRowIndex(int)}, but for key object - it may be not only
* row number in sequence data, but, for example - path to current node in
* tree.
- * @param faces - current FacesContext
- * @param key new key value.
+ *
+ * @param faces -
+ * current FacesContext
+ * @param key
+ * new key value.
*/
- public void setRowKey(FacesContext faces,Object key) {
+ public void setRowKey(FacesContext faces, Object key) {
ExtendedDataModel localModel = getExtendedDataModel();
// save child state
this.saveChildState(faces);
@@ -349,7 +378,7 @@
/**
* Instance of default renderer in ajax responses.
*/
- private transient AjaxChildrenRenderer _childrenRenderer = null;
+ private AjaxChildrenRenderer _childrenRenderer = null;
/**
* getter for simple {@link AjaxChildrenRenderer} instance in case of ajax
@@ -389,23 +418,52 @@
* Setup EL variable for different iteration. Value of row data and
* component state will be put into request scope attributes with names
* given by "var" and "varState" bean properties.
- * @param faces current faces context
+ *
+ * @param faces
+ * current faces context
* @param localModel
* @param rowSelected
*/
- protected void setupVariable(FacesContext faces, DataModel localModel, boolean rowSelected) {
- String var = getVar();
+ protected void setupVariable(FacesContext faces, DataModel localModel,
+ boolean rowSelected) {
+ Map attrs = faces.getExternalContext().getRequestMap();
+ if (rowSelected && isRowAvailable()) {
+ // Current row data.
+ setupVariable(getVar(), attrs, localModel.getRowData());
+ // Component state variable.
+ setupVariable(getStateVar(), attrs, getComponentState());
+ // Row key Data variable.
+ setupVariable(getRowKeyVar(), attrs, getRowKey());
+
+ } else {
+ removeVariable(getVar(), attrs);
+ removeVariable(getStateVar(), attrs);
+ removeVariable(getRowKeyVar(), attrs);
+ }
+ }
+
+ /**
+ * @param var
+ * @param attrs
+ * @param rowData
+ */
+ private void setupVariable(String var, Map attrs, Object rowData) {
if (var != null) {
- Map attrs = faces.getExternalContext().getRequestMap();
- if (rowSelected && isRowAvailable()) {
- attrs.put(getVar(), localModel.getRowData());
- } else {
- attrs.remove(var);
- }
+ attrs.put(var, rowData);
}
}
/**
+ * @param var
+ * @param attrs
+ * @param rowData
+ */
+ private void removeVariable(String var, Map attrs) {
+ if (var != null) {
+ attrs.remove(var);
+ }
+ }
+ /**
* Reset data model. this method must be called twice per request - before
* decode phase and before component encoding.
*/
@@ -460,7 +518,7 @@
*
* @param state
*/
- protected void setComponentState(DataComponentState state) {
+ public void setComponentState(DataComponentState state) {
this._currentState = state;
this._statesMap.put(getBaseClientId(getFacesContext()),
this._currentState);
@@ -470,17 +528,37 @@
* @return current state of this component.
*/
public DataComponentState getComponentState() {
+ DataComponentState state = null;
if (this._currentState == null) {
- String baseClientId = getBaseClientId(getFacesContext());
- DataComponentState state = (DataComponentState) this._statesMap
- .get(baseClientId);
- if (null == state) {
- state = createComponentState();
- this._statesMap.put(baseClientId, state);
+ // Check for binding state to user bean.
+ ValueBinding valueBinding = getValueBinding(UIDataAdaptor.COMPONENT_STATE_ATTRIBUTE);
+ FacesContext facesContext = getFacesContext();
+ if (null != valueBinding) {
+ state = (DataComponentState) valueBinding
+ .getValue(facesContext);
+ if (null == state) {
+ // Create default state
+ state = createComponentState();
+ if (!valueBinding.isReadOnly(facesContext)) {
+ // Store created state in user bean.
+ valueBinding.setValue(facesContext, state);
+ }
+ }
+ } else {
+ // Check for stored state in map for parent iterations
+ String baseClientId = getBaseClientId(facesContext);
+ state = (DataComponentState) this._statesMap.get(baseClientId);
+ if (null == state) {
+ // Create default component state
+ state = createComponentState();
+ this._statesMap.put(baseClientId, state);
+ }
+ this._currentState = state;
}
- this._currentState = state;
+ } else {
+ state = this._currentState;
}
- return this._currentState;
+ return state;
}
/**
@@ -497,7 +575,8 @@
StringBuffer id = new StringBuffer(getBaseClientId(faces));
Object rowKey = getRowKey();
if (rowKey != null) {
- id.append(NamingContainer.SEPARATOR_CHAR).append(rowKey.toString());
+ id.append(NamingContainer.SEPARATOR_CHAR).append(
+ rowKey.toString());
}
Renderer renderer;
if (null != (renderer = getRenderer(faces))) {
@@ -571,7 +650,7 @@
}
}
- private transient Object origValue;
+ private Object origValue;
/**
* Save current state of data variable.
@@ -580,14 +659,17 @@
captureOrigValue(FacesContext.getCurrentInstance());
}
- /**
+ /**
* Save current state of data variable.
- * @param faces current faces context
+ *
+ * @param faces
+ * current faces context
*/
public void captureOrigValue(FacesContext faces) {
- if (getVar() != null) {
+ String var = getVar();
+ if (var != null) {
Map attrs = faces.getExternalContext().getRequestMap();
- this.origValue = attrs.get(getVar());
+ this.origValue = attrs.get(var);
}
}
@@ -597,17 +679,21 @@
public void restoreOrigValue() {
restoreOrigValue(FacesContext.getCurrentInstance());
}
+
/**
* Restore value of data variable after processing phase.
- * @param faces current faces context
+ *
+ * @param faces
+ * current faces context
*/
public void restoreOrigValue(FacesContext faces) {
- if (getVar() != null) {
+ String var = getVar();
+ if (var != null) {
Map attrs = faces.getExternalContext().getRequestMap();
if (this.origValue != null) {
- attrs.put(getVar(), this.origValue);
+ attrs.put(var, this.origValue);
} else {
- attrs.remove(getVar());
+ attrs.remove(var);
}
}
}
@@ -615,7 +701,7 @@
/**
* Saved values of {@link EditableValueHolder} fields per iterations.
*/
- private transient Map childState;
+ private Map childState;
/**
* @param faces
@@ -638,7 +724,8 @@
/**
* Save values of {@link EditableValueHolder} fields before change current
* row.
- * @param faces
+ *
+ * @param faces
*/
protected void saveChildState(FacesContext faces) {
@@ -684,7 +771,8 @@
/**
* Restore values of {@link EditableValueHolder} fields after change current
* row.
- * @param faces
+ *
+ * @param faces
*/
protected void restoreChildState(FacesContext faces) {
@@ -702,7 +790,7 @@
* @param faces
* @param c
* @param childState
- *
+ *
*/
private void restoreChildState(FacesContext faces, UIComponent c,
Map childState) {
@@ -768,11 +856,12 @@
Object argument) {
// stop if not rendered
- if (!this.isRendered())
+ if (!this.isRendered()) {
return;
+ }
// reset rowIndex
this.captureOrigValue(faces);
- this.setRowKey(faces,null);
+ this.setRowKey(faces, null);
try {
Iterator fixedChildren = fixedChildren();
while (fixedChildren.hasNext()) {
@@ -784,7 +873,7 @@
} catch (Exception e) {
throw new FacesException(e);
} finally {
- this.setRowKey(faces,null);
+ this.setRowKey(faces, null);
this.restoreOrigValue(faces);
}
}
@@ -823,7 +912,7 @@
* Reset per-request fields in component.
*
* @param faces
- *
+ *
*/
protected void resetComponent(FacesContext faces) {
// resetDataModel();
@@ -837,6 +926,13 @@
if (!this.isRendered())
return;
this.iterate(faces, updateVisitor, argument);
+ ExtendedDataModel dataModel = getExtendedDataModel();
+ // If no validation errors, update values for serializable model,
+ // restored from view.
+ if (dataModel instanceof SerializableDataModel && (!keepSaved(faces))) {
+ SerializableDataModel serializableModel = (SerializableDataModel) dataModel;
+ serializableModel.update();
+ }
}
public void processUpdates(FacesContext faces) {
@@ -943,7 +1039,7 @@
}
public void populate(EditableValueHolder evh) {
- this.value = evh.getValue();
+ this.value = evh.getLocalValue();
this.valid = evh.isValid();
this.submittedValue = evh.getSubmittedValue();
this.localValueSet = evh.isLocalValueSet();
@@ -991,12 +1087,12 @@
Object oldRowKey = getRowKey();
FacesContext faces = FacesContext.getCurrentInstance();
captureOrigValue(faces);
- setRowKey(faces,revent.getKey());
+ setRowKey(faces, revent.getKey());
FacesEvent rowEvent = revent.getTarget();
rowEvent.getComponent().broadcast(rowEvent);
// For Ajax events, keep row value.
if (!(rowEvent instanceof AjaxEvent)) {
- setRowKey(faces,oldRowKey);
+ setRowKey(faces, oldRowKey);
restoreOrigValue(faces);
}
return;
@@ -1101,9 +1197,17 @@
*/
private static final long serialVersionUID = 9037454770537726418L;
+ /**
+ * Flag setted to true if componentState implements StateHolder
+ */
+ private boolean stateInHolder = false;
+
+ /**
+ * Serializable componentState or
+ */
private Object componentState;
- private ExtendedDataModel model;
+ private SerializableDataModel model;
}
public void restoreState(FacesContext faces, Object object) {
@@ -1118,8 +1222,16 @@
.hasNext();) {
Map.Entry stateEntry = (Map.Entry) iter.next();
PerIdState idState = (PerIdState) stateEntry.getValue();
- DataComponentState compState = createComponentState();
- compState.restoreState(faces, idState.componentState);
+ DataComponentState compState;
+ if (idState.stateInHolder) {
+ // TODO - change RichFaces Tree component, for remove reference
+ // to component from state.
+ compState = createComponentState();
+ ((StateHolder) compState).restoreState(faces,
+ idState.componentState);
+ } else {
+ compState = (DataComponentState) idState.componentState;
+ }
Object key = stateEntry.getKey();
this._statesMap.put(key, compState);
this._modelsMap.put(key, idState.model);
@@ -1130,6 +1242,7 @@
DataState state = new DataState();
state.superState = super.saveState(faces);
state.ajaxKeys = this._ajaxKeys;
+ Set encodedIds = getEncodedIds();
// Save all states of component and data model for all valies of
// clientId, encoded in this request.
for (Iterator iter = this._statesMap.entrySet().iterator(); iter
@@ -1137,13 +1250,24 @@
Map.Entry stateEntry = (Map.Entry) iter.next();
DataComponentState dataComponentState = ((DataComponentState) stateEntry
.getValue());
- Set encodedIds = getEncodedIds();
Object stateKey = stateEntry.getKey();
if (encodedIds.isEmpty() || encodedIds.contains(stateKey)) {
PerIdState idState = new PerIdState();
idState.model = getExtendedDataModel().getSerializableModel(
dataComponentState.getRange());
- idState.componentState = dataComponentState.saveState(faces);
+ // Save component state , depended if implemented interfaces.
+ if (null == dataComponentState) {
+ idState.componentState = null;
+ } else if (dataComponentState instanceof Serializable) {
+ idState.componentState = dataComponentState;
+ } else if (dataComponentState instanceof StateHolder) {
+ // TODO - change RichFaces Tree component, for remove
+ // reference to component from state.
+ // Change this code to reference for saveAttachedState.
+ idState.componentState = ((StateHolder) dataComponentState)
+ .saveState(faces);
+ idState.stateInHolder = true;
+ }
if (null != idState.model || null != idState.componentState) {
state.componentStates.put(stateKey, idState);
}
Modified: branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/UIRepeat.java
===================================================================
--- branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/UIRepeat.java 2007-03-30 17:44:16 UTC (rev 46)
+++ branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/UIRepeat.java 2007-03-31 00:27:58 UTC (rev 47)
@@ -1,7 +1,7 @@
/**
* License Agreement.
*
- * Ajax4jsf 1.0 - Natural Ajax for Java Server Faces (JSF)
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*
@@ -26,6 +26,7 @@
import java.util.Iterator;
import java.util.List;
+import javax.faces.context.FacesContext;
import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
@@ -41,22 +42,32 @@
* @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#createComponentState()
*/
protected DataComponentState createComponentState() {
- // TODO Auto-generated method stub
- return new RepeatState(){
- public int getFirst() {
- return UIRepeat.this.getFirst();
+ // Create component state based on this instance.
+ return new DataComponentState(){
+
+ public Range getRange() {
+ return new SequenceRange(getFirst(),getRows());
}
- public int getRows() {
- return UIRepeat.this.getRows();
+
+ public boolean isTransient() {
+ // TODO Auto-generated method stub
+ return false;
}
-
- public void setFirst(int first) {
- UIRepeat.this.setFirst(first);
+
+ public void restoreState(FacesContext arg0, Object arg1) {
+ // TODO Auto-generated method stub
+
}
-
- public void setRows(int rows) {
- UIRepeat.this.setRows(rows);
+
+ public Object saveState(FacesContext arg0) {
+ // TODO Auto-generated method stub
+ return null;
}
+
+ public void setTransient(boolean arg0) {
+ // TODO Auto-generated method stub
+
+ }
};
}
@@ -65,8 +76,7 @@
* @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#createDataModel()
*/
protected ExtendedDataModel createDataModel() {
- // TODO Auto-generated method stub
- return new SequenceDataModel(getDataModel());
+ return (ExtendedDataModel) getDataModel();
}
protected DataModel getDataModel(){
@@ -75,19 +85,21 @@
Object current = getValue();
DataModel model;
if (current == null) {
- model = new ListDataModel(Collections.EMPTY_LIST);
+ model = new SequenceDataModel(new ListDataModel(Collections.EMPTY_LIST));
+ } else if (current instanceof ExtendedDataModel) {
+ model = (DataModel) current;
} else if (current instanceof DataModel) {
- model = (DataModel) current;
+ model = new SequenceDataModel((DataModel) current);
} else if (current instanceof List) {
- model = new ListDataModel((List) current);
+ model = new SequenceDataModel(new ListDataModel((List) current));
} else if (Object[].class.isAssignableFrom(current.getClass())) {
- model = new ArrayDataModel((Object[]) current);
+ model = new SequenceDataModel(new ArrayDataModel((Object[]) current));
} else if (current instanceof ResultSet) {
- model = new ResultSetDataModel((ResultSet) current);
+ model = new SequenceDataModel(new ResultSetDataModel((ResultSet) current));
// } else if (current instanceof Result) {
// model = new ResultDataModel((Result) current);
} else {
- model = new ScalarDataModel(current);
+ model = new SequenceDataModel(new ScalarDataModel(current));
}
return (model);
}
Added: branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/UISelector.java
===================================================================
--- branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/UISelector.java (rev 0)
+++ branches/version_1_0_7/src/framework/java/org/ajax4jsf/ajax/repeat/UISelector.java 2007-03-31 00:27:58 UTC (rev 47)
@@ -0,0 +1,114 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.ajax4jsf.ajax.repeat;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.framework.renderer.AjaxChildrenRenderer;
+import org.apache.commons.beanutils.PropertyUtils;
+
+/**
+ * Base class for component, performed AJAX encoding on selected values in
+ * iterable components ( UIData, trees etc )
+ *
+ * @author shura
+ *
+ */
+public abstract class UISelector extends UIComponentBase implements
+ AjaxDataEncoder {
+
+ private static final AjaxChildrenRenderer childrenRenderer = new AjaxChildrenRenderer() {
+
+ protected Class getComponentClass() {
+ return UISelector.class;
+ }
+
+ };
+
+ /**
+ * Name of serRow ( or simple ) method for setup current value in iterable
+ * component
+ *
+ * @parameter
+ * @return the acceptClass
+ */
+ public abstract String getIterationProperty();
+
+ /**
+ * @param newSelectMethod
+ * the value to set
+ */
+ public abstract void setIterationProperty(String newSelectMethod);
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxChildrenEncoder#encodeAjaxChild(javax.faces.context.FacesContext,
+ * java.lang.String, java.util.Set, java.util.Set)
+ */
+ public void encodeAjaxChild(FacesContext context, String path, Set ids,
+ Set renderedAreas) throws IOException {
+ if (getChildCount() != 1) {
+ throw new FacesException(
+ "Selector component must have one, and only one, child");
+ }
+ UIComponent child = (UIComponent) getChildren().get(0);
+ Set ajaxKeys = getAjaxKeys();
+ if (null != ajaxKeys) {
+ String iterationProperty = getIterationProperty();
+ try {
+ Object savedKey = PropertyUtils.getProperty(child,
+ iterationProperty);
+ for (Iterator iter = ajaxKeys.iterator(); iter.hasNext();) {
+ Object key = (Object) iter.next();
+ PropertyUtils.setProperty(child, iterationProperty, key);
+ if (true) {
+ childrenRenderer.encodeAjaxChild(context, this, path,
+ ids, renderedAreas);
+ }
+
+ }
+ PropertyUtils.setProperty(child, iterationProperty, savedKey);
+
+ } catch (IllegalAccessException e) {
+ throw new FacesException(
+ "Illegal access to iteration selection property "+iterationProperty+" on component "+child.getClientId(context),e);
+ } catch (InvocationTargetException e) {
+ throw new FacesException(
+ "Error in iteration selection property "+iterationProperty+" on component "+child.getClientId(context),e.getCause());
+ } catch (NoSuchMethodException e) {
+ throw new FacesException(
+ "No iteration selection property "+iterationProperty+" on component "+child.getClientId(context),e);
+ }
+ }
+
+ }
+
+}
17 years, 9 months
JBoss Ajax4JSF SVN: r45 - trunk.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-03-29 22:19:54 -0400 (Thu, 29 Mar 2007)
New Revision: 45
Modified:
trunk/pom.xml
Log:
move clover instrumentation to separate profile
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2007-03-30 01:56:34 UTC (rev 44)
+++ trunk/pom.xml 2007-03-30 02:19:54 UTC (rev 45)
@@ -78,8 +78,8 @@
<url>${snapshotRepository}</url>
</snapshotRepository>
<site>
- <id>ajax4jsf-site</id>
- <url>ajax4jsf/</url>
+ <id>ajax4jsf-site</id>
+ <url>ajax4jsf/</url>
</site>
</distributionManagement>
<repositories>
@@ -98,28 +98,6 @@
<layout>legacy</layout>
</repository>
</repositories>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clover-plugin</artifactId>
- <configuration>
- <includesAllSourceRoots>true</includesAllSourceRoots>
- <licenseLocation>${cloverLicense}</licenseLocation>
- <jdk>1.5</jdk>
- </configuration>
- <executions>
- <execution>
- <phase>verify</phase>
- <goals>
- <goal>instrument</goal>
- <goal>aggregate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
<scm>
<connection>
@@ -180,22 +158,14 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clover-plugin</artifactId><!--
- <configuration>
- <licenseLocation>${cloverLicense}</licenseLocation>
- <jdk>1.5</jdk>
- </configuration>
- --></plugin>
</plugins>
</reporting>
- <ciManagement>
- <notifiers></notifiers>
- <system>cruisecontrol</system>
+ <ciManagement>
+ <notifiers></notifiers>
+ <system>cruisecontrol</system>
</ciManagement>
-
+
<modules>
<module>framework</module>
<module>test</module>
@@ -293,6 +263,50 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>clover</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clover-plugin</artifactId>
+ <configuration>
+ <includesAllSourceRoots>
+ true
+ </includesAllSourceRoots>
+ <licenseLocation>
+ ${cloverLicense}
+ </licenseLocation>
+ <jdk>1.5</jdk>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>verify</phase>
+ <goals>
+ <goal>instrument</goal>
+ <goal>aggregate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clover-plugin</artifactId>
+ <!--
+ <configuration>
+ <licenseLocation>${cloverLicense}</licenseLocation>
+ <jdk>1.5</jdk>
+ </configuration>
+ -->
+ </plugin>
+ </plugins>
+ </reporting>
+ </profile>
</profiles>
<!--module>samples</module-->
</project>
\ No newline at end of file
17 years, 9 months
JBoss Ajax4JSF SVN: r44 - in trunk: cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo and 2 other directories.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-03-29 21:56:34 -0400 (Thu, 29 Mar 2007)
New Revision: 44
Modified:
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CompileMojo.java
trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/xmlfilter/nekko/NekkoParser.java
trunk/pom.xml
trunk/test/pom.xml
Log:
Fix call cdk:assembly goals from forked builds ( aka assembly:assembly )
Setup build for a clover reports.
Modified: trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2007-03-29 01:55:10 UTC (rev 43)
+++ trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2007-03-30 01:56:34 UTC (rev 44)
@@ -45,6 +45,7 @@
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
+import org.apache.maven.model.Parent;
import org.apache.maven.model.Resource;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
@@ -82,6 +83,7 @@
public class AssemblyLibraryMojo extends AbstractCDKMojo {
private static final String TEMPLATES_PREFIX = "/templates/";
+
private static final String TEMPLATES12_PREFIX = "/templates12/";
private static final String FACES_CONFIG_TEMPLATE = "faces-config.vm";
@@ -140,7 +142,6 @@
* The reactor projects.
*
* @parameter expression="${project.parent}"
- * @required
* @readonly
*/
private MavenProject parentProject;
@@ -176,14 +177,17 @@
* @parameter
*/
private String templates;
+
/**
* @parameter
*/
- private String includeTld="META-INF/*.tld";
+ private String includeTld = "META-INF/*.tld";
+
/**
* @parameter
*/
- private String includeTaglib="META-INF/*.taglib.xml";
+ private String includeTaglib = "META-INF/*.taglib.xml";
+
/**
*
*/
@@ -197,11 +201,35 @@
* @see org.apache.maven.plugin.Mojo#execute()
*/
public void execute() throws MojoExecutionException, MojoFailureException {
- // populateReactorProjects();
+ // Parent project not set for a custom lifecycles. Try to load artifact.
+ if (null == parentProject || null == parentProject.getFile()) {
+ Parent parentModel = project.getModel().getParent();
+ if (null != parentModel) {
+ String relativePath = parentModel.getRelativePath();
+ File parentPom = new File(project.getFile().getAbsoluteFile().getParentFile(), relativePath);
+ if (parentPom.isDirectory()) {
+ parentPom = new File(parentPom, "pom.xml");
+ }
+ if (parentPom.exists()) {
+ try {
+ parentProject = mavenProjectBuilder.build(parentPom,
+ localRepository, null);
+ } catch (ProjectBuildingException e) {
+ throw new MojoFailureException("Error get parent project for a components library");
+ }
+ } else {
+ throw new MojoFailureException("Parent project pom file not found for a components library");
+ }
+ }else {
+ throw new MojoFailureException("Components library project must have parent pom with components modules");
+ }
+
+ }
if (null != parentProject) {
this.checkLibraryConfig();
- if(null == templates){
- templates = Library.JSF12.equals(library.getJsfVersion())?TEMPLATES12_PREFIX:TEMPLATES_PREFIX;
+ if (null == templates) {
+ templates = Library.JSF12.equals(library.getJsfVersion()) ? TEMPLATES12_PREFIX
+ : TEMPLATES_PREFIX;
}
Model generatedProject;
try {
@@ -261,7 +289,8 @@
}
}
// Remove modules projects from dependencise
- Set<String> unwanted = new HashSet<String>(projectsDependencies.size());
+ Set<String> unwanted = new HashSet<String>(projectsDependencies
+ .size());
for (Iterator iter = models.iterator(); iter.hasNext();) {
Model model = (Model) iter.next();
for (Iterator iterator = projectsDependencies.values()
@@ -273,8 +302,7 @@
getLog().debug(
"Remove dependency of library module "
+ dependency.getManagementKey());
- unwanted.add(dependency
- .getManagementKey());
+ unwanted.add(dependency.getManagementKey());
}
}
// Got module and unpack it to target directory.
@@ -294,15 +322,25 @@
projectsDependencies.values());
writePom(generatedProject);
mergeFacesConfig(models);
- File resourcesConfig = new File(outputDirectory,"META-INF/resources-config.xml");
- mergeXML(models, "META-INF/resources-config.xml", RESOURCES_CONFIG_TEMPLATE, null, new VelocityContext(),resourcesConfig);
- File tld = new File(outputDirectory,"META-INF/"+library.getTaglib().getShortName()
- + ".tld");
- mergeXML(models, includeTld, TLD_TEMPLATE, "/taglib/tag | /taglib/listener", new VelocityContext(),tld);
- File taglib = new File(outputDirectory,"META-INF/"+library.getTaglib().getShortName()
- + ".taglib.xml");
- mergeXML(models, includeTaglib, TAGLIB_TEMPLATE, "/facelet-taglib/tag | /facelet-taglib/function", new VelocityContext(),taglib);
+ File resourcesConfig = new File(outputDirectory,
+ "META-INF/resources-config.xml");
+ mergeXML(models, "META-INF/resources-config.xml",
+ RESOURCES_CONFIG_TEMPLATE, null, new VelocityContext(),
+ resourcesConfig);
+ File tld = new File(outputDirectory, "META-INF/"
+ + library.getTaglib().getShortName() + ".tld");
+ mergeXML(models, includeTld, TLD_TEMPLATE,
+ "/taglib/tag | /taglib/listener", new VelocityContext(),
+ tld);
+ File taglib = new File(outputDirectory, "META-INF/"
+ + library.getTaglib().getShortName() + ".taglib.xml");
+ mergeXML(models, includeTaglib, TAGLIB_TEMPLATE,
+ "/facelet-taglib/tag | /facelet-taglib/function",
+ new VelocityContext(), taglib);
+ }else {
+ throw new MojoFailureException("Components library project must have parent pom with components modules");
}
+
}
/**
@@ -354,8 +392,8 @@
context.put("library", library);
context.put("renderkits", Arrays.asList(library.getRenderkits()));
try {
- writeParsedTemplate(templates+FACES_CONFIG_TEMPLATE, context, new File(
- outputDirectory, "META-INF/faces-config.xml"));
+ writeParsedTemplate(templates + FACES_CONFIG_TEMPLATE, context,
+ new File(outputDirectory, "META-INF/faces-config.xml"));
} catch (Exception e) {
throw new MojoExecutionException(
"Error to process faces-config template", e);
@@ -373,30 +411,30 @@
* name of velocity template for result file.
* @param commonXpath -
* XPath expression fof common part of result file.
- * @param context - Velocity context for template processing.
+ * @param context -
+ * Velocity context for template processing.
* @throws MojoExecutionException
*/
private void mergeXML(List models, String filename, String templateName,
- String commonXpath, VelocityContext context,File target)
+ String commonXpath, VelocityContext context, File target)
throws MojoExecutionException {
StringBuffer content = new StringBuffer();
List<XMLBody> xmls = new ArrayList<XMLBody>(models.size());
String[] split = filename.split(",");
for (Iterator iter = models.iterator(); iter.hasNext();) {
Model model = (Model) iter.next();
- File moduleDir = new File(buildDirectory, model
- .getArtifactId());
+ File moduleDir = new File(buildDirectory, model.getArtifactId());
DirectoryScanner ds = new DirectoryScanner();
- ds.setFollowSymlinks( true );
- ds.setBasedir( moduleDir );
- ds.setIncludes(split);
- ds.addDefaultExcludes();
- ds.scan();
- String[] files = ds.getIncludedFiles();
- for (int i=0; i<files.length;i++) {
- File moduleFacesConfig = new File(moduleDir,files[i]);
+ ds.setFollowSymlinks(true);
+ ds.setBasedir(moduleDir);
+ ds.setIncludes(split);
+ ds.addDefaultExcludes();
+ ds.scan();
+ String[] files = ds.getIncludedFiles();
+ for (int i = 0; i < files.length; i++) {
+ File moduleFacesConfig = new File(moduleDir, files[i]);
getLog().info(
- "Process "+files[i]+" for module "
+ "Process " + files[i] + " for module "
+ model.getArtifactId());
XMLBody configBody = new XMLBody();
try {
@@ -423,7 +461,7 @@
context.put("models", models);
context.put("xmls", xmls);
try {
- writeParsedTemplate(templates+templateName, context, target);
+ writeParsedTemplate(templates + templateName, context, target);
} catch (Exception e) {
throw new MojoExecutionException("Error to process template "
+ templateName + " for files " + filename, e);
Modified: trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CompileMojo.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CompileMojo.java 2007-03-29 01:55:10 UTC (rev 43)
+++ trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CompileMojo.java 2007-03-30 01:56:34 UTC (rev 44)
@@ -21,83 +21,276 @@
package org.ajax4jsf.builder.mojo;
+import java.beans.PropertyDescriptor;
+import java.io.File;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Parent;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.archiver.manager.ArchiverManager;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.context.Context;
import org.codehaus.plexus.context.ContextException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
/**
- * Compile all xml templates, matched given pattern to Java classes. Sources will be created in
- * {@link AbstractCDKMojo#outputJavaDirectory}
+ * Compile all xml templates, matched given pattern to Java classes. Sources
+ * will be created in {@link AbstractCDKMojo#outputJavaDirectory}
+ *
* @goal compile
* @requiresDependencyResolution compile
* @phase generate-sources
* @author shura
- *
+ *
*/
public class CompileMojo extends AbstractCDKMojo implements Contextualizable {
-
-
+
/**
+ * Project executed by first compile lifecycle.
+ *
+ * @parameter expression="${executedProject}"
+ * @readonly
+ */
+ private MavenProject executedProject;
+
+ /**
+ * The reactor projects.
+ *
+ * @parameter expression="${project.parent}"
+ * @readonly
+ */
+ private MavenProject parentProject;
+ /**
* @parameter default-value=${project.groupId}
*/
private String defaultPackage;
-
+
/**
- * A list of inclusion filters for the compiler. By default, include all files
- * in templates directory.
+ * A list of inclusion filters for the compiler. By default, include all
+ * files in templates directory.
+ *
* @parameter
*/
private String[] includes;
-
-
+
/**
* A list of exclusion filters for the compiler. None by default.
+ *
* @parameter
*/
private String[] excludes;
+ /**
+ * The local repository.
+ *
+ * @parameter expression="${localRepository}"
+ */
+ private ArtifactRepository localRepository;
+
+ /**
+ * To look up Archiver/UnArchiver implementations
+ *
+ * @component
+ */
+ private ArchiverManager archiverManager;
+
+ /**
+ * Project builder
+ *
+ * @component
+ */
+ private MavenProjectBuilder mavenProjectBuilder;
private PlexusContainer container;
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.maven.plugin.Mojo#execute()
*/
public void execute() throws MojoExecutionException, MojoFailureException {
-
-// VelocityTemplates.init();
+
+ // VelocityTemplates.init();
try {
- List components = container.lookupList("org.ajax4jsf.templatecompiler.elements.ElementsFactory");
+ List components = container
+ .lookupList("org.ajax4jsf.templatecompiler.elements.ElementsFactory");
for (Iterator iter = components.iterator(); iter.hasNext();) {
- Object element = iter.next();
+ Object element = iter.next();
System.out.println(element.getClass().getName());
-
+
}
System.out.println("Components Map");
- Map componentsMap = container.lookupMap("org.ajax4jsf.templatecompiler.elements.ElementsFactory");
- for (Iterator iter = componentsMap.entrySet().iterator(); iter.hasNext();) {
+ Map componentsMap = container
+ .lookupMap("org.ajax4jsf.templatecompiler.elements.ElementsFactory");
+ for (Iterator iter = componentsMap.entrySet().iterator(); iter
+ .hasNext();) {
Map.Entry element = (Map.Entry) iter.next();
- System.out.println(element.getKey()+":"+element.getValue().getClass().getName());
+ System.out.println(element.getKey() + ":"
+ + element.getValue().getClass().getName());
}
} catch (ComponentLookupException e) {
- throw new MojoExecutionException("Error lookup ElementFactory components");
+ throw new MojoExecutionException(
+ "Error lookup ElementFactory components");
}
-
+ Parent parentModel = project.getModel().getParent();
+ if (null != parentModel) {
+ String relativePath = parentModel.getRelativePath();
+ File parentPom = new File(project.getFile().getParentFile(), relativePath);
+ if (parentPom.isDirectory()) {
+ parentPom = new File(parentPom, "pom.xml");
+ }
+ if (parentPom.exists()) {
+ try {
+ parentProject = mavenProjectBuilder.build(parentPom,
+ localRepository, null);
+ } catch (ProjectBuildingException e) {
+ throw new MojoExecutionException("Error get parent project for a components library",e);
+ }
+ } else {
+ throw new MojoFailureException("Parent project pom file "+parentPom.getAbsolutePath()+" is not found for a components library");
+ }
+ }else {
+ throw new MojoFailureException("Components library project must have parent pom with components modules");
+ }
+ getLog().info("Parent Project object :\n" + toLog(parentProject) + "\n");
+ getLog().info("Project object :\n" + toLog(project) + "\n");
+ getLog().info("Project object Model :\n" + toLog(project.getModel()) + "\n");
+ getLog().info("Project object Parent Model :\n" + toLog(project.getModel().getParent()) + "\n");
+
+ getLog().info(
+ "Executed Project object :\n" + toLog(executedProject) + "\n");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable#contextualize(org.codehaus.plexus.context.Context)
*/
public void contextualize(Context context) throws ContextException {
- this.container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
-
+ this.container = (PlexusContainer) context
+ .get(PlexusConstants.PLEXUS_KEY);
+
}
+ private void logBean(Object bean) {
+ StringBuffer content = new StringBuffer();
+ }
+
+ /**
+ * Convert any Java Object to JavaScript representation ( as possible ).
+ *
+ * @param obj
+ * @return
+ * @throws MojoExecutionException
+ */
+ public String toLog(Object obj) throws MojoExecutionException {
+ if (null == obj) {
+ return "null";
+ } else if (obj.getClass().isArray()) {
+ StringBuffer ret = new StringBuffer("[");
+ boolean first = true;
+ for (int i = 0; i < Array.getLength(obj); i++) {
+ Object element = Array.get(obj, i);
+ if (!first) {
+ ret.append(',');
+ }
+ ret.append(toLog(element));
+ first = false;
+ }
+ return ret.append("]\n").toString();
+ } else if (obj instanceof Collection) {
+ // Collections put as JavaScript array.
+ Collection collection = (Collection) obj;
+ StringBuffer ret = new StringBuffer("[");
+ boolean first = true;
+ for (Iterator iter = collection.iterator(); iter.hasNext();) {
+ Object element = iter.next();
+ if (!first) {
+ ret.append(',');
+ }
+ ret.append(toLog(element));
+ first = false;
+ }
+ return ret.append("]\n").toString();
+ } else if (obj instanceof Map) {
+ // Maps put as JavaScript hash.
+ Map map = (Map) obj;
+
+ StringBuffer ret = new StringBuffer("{");
+ boolean first = true;
+ for (Iterator iter = map.keySet().iterator(); iter.hasNext();) {
+ Object key = (Object) iter.next();
+ if (!first) {
+ ret.append(',');
+ }
+ ret.append(key);
+ ret.append(":");
+ ret.append(toLog(map.get(key)));
+ first = false;
+ }
+ return ret.append("}\n").toString();
+ } else if (obj instanceof Number || obj instanceof Boolean) {
+ // numbers and boolean put as-is, without conversion
+ return obj.toString();
+ } else if (obj instanceof String) {
+ // all other put as encoded strings.
+ StringBuffer ret = new StringBuffer();
+ addEncodedString(ret, obj);
+ return ret.append("\n").toString();
+ }
+ // All other objects threaded as Java Beans.
+ try {
+ StringBuffer ret = new StringBuffer("{");
+ PropertyDescriptor[] propertyDescriptors = PropertyUtils
+ .getPropertyDescriptors(obj);
+ boolean first = true;
+ for (int i = 0; i < propertyDescriptors.length; i++) {
+ PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
+ String key = propertyDescriptor.getName();
+ if ("class".equals(key)
+ || propertyDescriptor.getReadMethod() == null) {
+ continue;
+ }
+ if (!first) {
+ ret.append(",\n\t");
+ }
+ addEncodedString(ret, key);
+ ret.append(":");
+ try {
+ ret.append(String.valueOf(PropertyUtils.getProperty(obj,
+ key)));
+
+ } catch (InvocationTargetException e) {
+ ret.append("Not ACCESIBLE");
+ }// ret.append(toLog(PropertyUtils.getProperty(obj, key)));
+ first = false;
+ }
+ return ret.append("}\n").toString();
+ } catch (Exception e) {
+ throw new MojoExecutionException(
+ "Error in conversion Java Object to String", e);
+ }
+ }
+
+ public void addEncodedString(StringBuffer buff, Object obj) {
+ buff.append("'");
+ buff.append(obj);
+ buff.append("'");
+
+ }
+
}
Modified: trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/xmlfilter/nekko/NekkoParser.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/xmlfilter/nekko/NekkoParser.java 2007-03-29 01:55:10 UTC (rev 43)
+++ trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/xmlfilter/nekko/NekkoParser.java 2007-03-30 01:56:34 UTC (rev 44)
@@ -108,7 +108,7 @@
*/
public NekkoParser() {
_parser=new HtmlSAXParser(getHtmlConfig());
- Properties properties = OutputPropertiesFactory.getDefaultMethodProperties(Method.XML);
+ Properties properties = OutputPropertiesFactory.getDefaultMethodProperties(Method.XHTML);
// properties.put("encoding",_encoding);
_serializer = SerializerFactory.getSerializer(properties);
// serializer.setOutputStream(output);
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2007-03-29 01:55:10 UTC (rev 43)
+++ trunk/pom.xml 2007-03-30 01:56:34 UTC (rev 44)
@@ -8,6 +8,9 @@
<version>1.1.1-SNAPSHOT</version>
<name>Ajax for Java Server faces core project</name>
<url>http://labs.jboss.com/jbossajax4jsf</url>
+ <properties>
+ <maven.test.failure.ignore>true</maven.test.failure.ignore>
+ </properties>
<licenses>
<license>
<name>LGPL 2.1</name>
@@ -107,7 +110,7 @@
</configuration>
<executions>
<execution>
- <phase>pre-site</phase>
+ <phase>verify</phase>
<goals>
<goal>instrument</goal>
<goal>aggregate</goal>
Modified: trunk/test/pom.xml
===================================================================
--- trunk/test/pom.xml 2007-03-29 01:55:10 UTC (rev 43)
+++ trunk/test/pom.xml 2007-03-30 01:56:34 UTC (rev 44)
@@ -47,7 +47,6 @@
<groupId>htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>1.10</version>
- <optional>true</optional>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
17 years, 9 months
JBoss Ajax4JSF SVN: r43 - trunk.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-03-28 21:55:10 -0400 (Wed, 28 Mar 2007)
New Revision: 43
Removed:
trunk/clover-ajax4jsf.license
Modified:
trunk/pom.xml
Log:
continue to work for generate a clover report
Deleted: trunk/clover-ajax4jsf.license
===================================================================
--- trunk/clover-ajax4jsf.license 2007-03-28 16:58:21 UTC (rev 42)
+++ trunk/clover-ajax4jsf.license 2007-03-29 01:55:10 UTC (rev 43)
@@ -1,171 +0,0 @@
-Product: Clover
-License: Open Source License, 0.x, 1.x
-Issued: Mon Mar 26 2007 20:24:17 CDT
-Expiry: Never
-Maintenance Expiry: Never
-Key: 7b72fdd0d1bf4b0116f2a3654
-Name: Igor Shabalov
-Org: Ajax4JSF
-Certificate: AAACOm+Ow8B7/zEbxOMqqKwwrdpP+a1COmJGHco7sCNLjHkHnajPF+dQW
-Ct12PMy0uml0s9xuus5wKngJ9OFk5/FZgYzdyIG5/rxEgRevOoLO7uYjZoEp059S/t8IW4
-hxEw+b9xUNP0x1tTqSsgUP6fqSYilMajaHYGuRD9iV3LeP7hwWulpXY3hz2ejSSpQT+7bM
-tH0v8rJd+6JcPek5yeW48vFqmQcNTIjE6KX9A4BTquuX3mq38vMR/YcLRjjMHlEPcZSK3K
-Tb2TsN5On4VrMEjbo1k2Oriv70FvTikk3aRdd/xz8P0DqMAfv9IBVvU0qFGzP5C+L6rnDy
-Xrpwn7Wv+smi8bFyb0qPDhzLhTuu+5rG0K661h574HJ1lPzESsVp3l1KSW5TjJ+hHU3/XG
-f47gLg0Zos6xYhqxir81IlsFJMHIeY94vuVpG7zpdjfCCSvRcIBFgt/Vm7Ort1N5h/60mx
-r7sO8Xqn9K9fwpaZikH7732AANCtuALAPrd3MZJ7xE6Bf5Oeg0t1kwoeM92JfExgsL9T9M
-FI7qWKoOpLK/PWZX2VyRkRh3PNbIkT+U9FLXoike6TXISbM70ZqHupNTcLrWIJ9S7oDfT4
-dPTriQMP39sE+2muAwYWbyuX2TswMvOUOsRJxLjJXQLO8cCGHGObSHqcfz34VmHAyjywyq
-HqTy+0U6W5UgzaB4gzm3uNkrieU3U5okSqxhjVTPbr3OysOWUpnjzxDXNv+t62f3Fm45gD
-igmBibE3oVyPxsTJqvoJwFQRh4hr+memdg/jlt2rRKBZcM5+/L3sjjg+HYD3dzSsFFw3KL
-DwUvn75LyVAvQlAKcVOIujTPJIA8hCPvBHcprR9w90wAUNoV08WzjKhIK4XP6YW7nbVdVc
-jQM/cTQnY/EFoFU1kliyyixXDcKVMkevWroevlX
-License Agreement: CLOVER VERSION 1 (ONE) SOFTWARE LICENSE AGREEMENT
-
-1. Licenses and Software
-
-Cenqua Pty Ltd, an Australian Proprietary Limited Company ("CENQUA")
-hereby grants to the purchaser (the "LICENSEE") a limited, revocable,
-worldwide, non-exclusive, nontransferable, non-sublicensable license
-to use the Clover version 1 (one) software (the "Software"),
-including any minor upgrades thereof during the Term (hereinafter
-defined) up to, but not including the next major version of the
-Software. The licensee shall not, or knowingly allow others to,
-reverse engineer, decompile, disassemble, modify, adapt, create
-derivative works from or otherwise attempt to derive source code from
-the Software provided. And, in accordance with the terms and
-conditions of this Software License Agreement (the "Agreement"), the
-Software shall be used solely by the licensed users in accordance
-with the following edition specific conditions:
-
-a) Server Edition
-
-A Server Edition license entitles the Licensee to execute one
-instance of Clover Server Edition on one (1) machine for the purposes
-of instrumententing source code and generating reports. There are no
-limitations on the use of the instrumented source code or generated
-reports produced by Server Edition.
-
-b) Workstation Edition
-
-A Workstation Edition license entitles the licensee to use Clover
-Workstation Edition on one (1) machine by one (1) individual end
-user. Workstation Edition does not permit the generation of reports
-for distribution.
-
-c) Team Edition
-
-A Team Edition license entitles the licensee to use Clover Team
-edition on any number of machines solely by the licensed number of
-users. Reports generated by Clover Team Edition are strictly for use
-only by the licensed number of individual end users.
-
-2. License Fee
-
-In exchange for the License(s), the Licensee shall pay to CENQUA a
-one-time, up front, non-refundable license fee. At the sole
-discretion of CENQUA this fee will be waived for non-commercial
-projects. Notwithstanding the Licensee's payment of the License Fee,
-CENQUA reserves the right to terminate the License if CENQUA
-discovers that the Licensee and/or the Licensee's use of the Software
-is in breach of this Agreement.
-
-3. Proprietary Rights
-
-CENQUA will retain all right, title and interest in and to the
-Software, all copies thereof, and CENQUA website(s), software, and
-other intellectual property, including, but not limited to, ownership
-of all copyrights, look and feel, trademark rights, design rights,
-trade secret rights and any and all other intellectual property and
-other proprietary rights therein. The Licensee will not directly or
-indirectly obtain or attempt to obtain at any time, any right, title
-or interest by registration or otherwise in or to the trademarks,
-
-service marks, copyrights, trade names, symbols, logos or
-designations or other intellectual property rights owned or used by
-CENQUA. All technical manuals or other information provided by CENQUA
-to the Licensee shall be the sole property of CENQUA.
-
-4. Term and Termination
-
-Subject to the other provisions hereof, this Agreement shall commence
-upon the Licensee's opting into this Agreement and continue until the
-Licensee discontinues use of the Software or the Agreement terminates
-automatically upon the Licensee's breach of any term or condition of
-this Agreement (the "Term"). Upon any such termination, the Licensee
-will delete the Software immediately.
-
-5. Copying & Transfer
-
-The Licensee may copy the Software for back-up purposes only. The
-
-Licensee may not assign or otherwise transfer the Software to any
-third party.
-
-6. Specific Disclaimer of Warranty and Limitation of Liability
-
-THE SOFTWARE IS PROVIDED WITHOUT WARRANTY OF ANY KIND. CENQUA
-DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT NOT
-LIMITED TO THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE. CENQUA WILL NOT BE LIABLE FOR ANY DAMAGES
-ASSOCIATED WITH THE SOFTWARE, INCLUDING, WITHOUT LIMITATION,
-ORDINARY, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OF ANY KIND,
-INCLUDING BUT NOT LIMITED TO DAMAGES RELATING TO LOST DATA OR LOST
-PROFITS, EVEN IF CENQUA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-7. Warranties and Representations
-
-Licensee Indemnification. CENQUA agrees to indemnify, defend and hold
-the Licensee harmless from and against any and all liabilities,
-damages, losses, claims, costs, and expenses (including reasonable
-legal fees) arising out of or resulting from the Software or the use
-thereof infringing upon, misappropriating or violating any patents,
-copyrights, trademarks, or trade secret rights or other proprietary
-rights of persons, firms or entities who are not parties to this
-Agreement.
-
-CENQUA Indemnification. The Licensee warrants and represents that the
-Licensee's actions with regard to the Software will be in compliance
-with all applicable laws; and the Licensee agrees to indemnify,
-defend, and hold CENQUA harmless from and against any and all
-liabilities, damages, losses, claims, costs, and expenses (including
-reasonable legal fees) arising out of or resulting from the
-Licensee's failure to observe the use restrictions set forth herein.
-
-8. Publicity
-
-The Licensee grants permission for CENQUA to use Licensee's name
-solely in customer lists. CENQUA shall not, without prior consent in
-writing, use the Licensee's name, or that of its affiliates, in any
-form with the specific exception of customer lists. CENQUA agrees to
-remove Licensee's name from any and all materials within 7 days if
-notified by the Licensee in writing.
-
-9. Governing Law
-
-This Agreement shall be governed by the laws of New South Wales,
-Australia.
-
-10.Independent Contractors
-
-The parties are independent contractors with respect to each other,
-and nothing in this Agreement shall be construed as creating an
-employer-employee relationship, a partnership, agency relationship or
-a joint venture between the parties.
-
-11. Assignment
-
-This Agreement is not assignable or transferable by the Licensee.
-CENQUA in its sole discretion may transfer a license to a third party
-at the written request of the Licensee.
-
-12. Entire Agreement
-
-This Agreement constitutes the entire agreement between the parties
-concerning the Licensee's use of the Software. This Agreement
-supersedes any prior verbal understanding between the parties and any
-Licensee purchase order or other ordering document, regardless of
-whether such document is received by CENQUA before or after execution
-of this Agreement. This Agreement may be amended only in writing by
-CENQUA.
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2007-03-28 16:58:21 UTC (rev 42)
+++ trunk/pom.xml 2007-03-29 01:55:10 UTC (rev 43)
@@ -101,7 +101,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clover-plugin</artifactId>
<configuration>
- <licenseLocation>clover-ajax4jsf.license</licenseLocation>
+ <includesAllSourceRoots>true</includesAllSourceRoots>
+ <licenseLocation>${cloverLicense}</licenseLocation>
<jdk>1.5</jdk>
</configuration>
<executions>
@@ -178,12 +179,12 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clover-plugin</artifactId>
+ <artifactId>maven-clover-plugin</artifactId><!--
<configuration>
- <licenseLocation>clover-ajax4jsf.license</licenseLocation>
+ <licenseLocation>${cloverLicense}</licenseLocation>
<jdk>1.5</jdk>
</configuration>
- </plugin>
+ --></plugin>
</plugins>
</reporting>
17 years, 9 months
JBoss Ajax4JSF SVN: r42 - in trunk: cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources and 1 other directory.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-03-28 12:58:21 -0400 (Wed, 28 Mar 2007)
New Revision: 42
Added:
trunk/clover-ajax4jsf.license
Modified:
trunk/cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/pom.xml
trunk/pom.xml
Log:
Setup clover report generation
Modified: trunk/cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/pom.xml
===================================================================
--- trunk/cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/pom.xml 2007-03-26 20:04:39 UTC (rev 41)
+++ trunk/cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/pom.xml 2007-03-28 16:58:21 UTC (rev 42)
@@ -4,6 +4,7 @@
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
+ <name>${artifactId}</name>
<build>
<plugins>
<plugin>
Added: trunk/clover-ajax4jsf.license
===================================================================
--- trunk/clover-ajax4jsf.license (rev 0)
+++ trunk/clover-ajax4jsf.license 2007-03-28 16:58:21 UTC (rev 42)
@@ -0,0 +1,171 @@
+Product: Clover
+License: Open Source License, 0.x, 1.x
+Issued: Mon Mar 26 2007 20:24:17 CDT
+Expiry: Never
+Maintenance Expiry: Never
+Key: 7b72fdd0d1bf4b0116f2a3654
+Name: Igor Shabalov
+Org: Ajax4JSF
+Certificate: AAACOm+Ow8B7/zEbxOMqqKwwrdpP+a1COmJGHco7sCNLjHkHnajPF+dQW
+Ct12PMy0uml0s9xuus5wKngJ9OFk5/FZgYzdyIG5/rxEgRevOoLO7uYjZoEp059S/t8IW4
+hxEw+b9xUNP0x1tTqSsgUP6fqSYilMajaHYGuRD9iV3LeP7hwWulpXY3hz2ejSSpQT+7bM
+tH0v8rJd+6JcPek5yeW48vFqmQcNTIjE6KX9A4BTquuX3mq38vMR/YcLRjjMHlEPcZSK3K
+Tb2TsN5On4VrMEjbo1k2Oriv70FvTikk3aRdd/xz8P0DqMAfv9IBVvU0qFGzP5C+L6rnDy
+Xrpwn7Wv+smi8bFyb0qPDhzLhTuu+5rG0K661h574HJ1lPzESsVp3l1KSW5TjJ+hHU3/XG
+f47gLg0Zos6xYhqxir81IlsFJMHIeY94vuVpG7zpdjfCCSvRcIBFgt/Vm7Ort1N5h/60mx
+r7sO8Xqn9K9fwpaZikH7732AANCtuALAPrd3MZJ7xE6Bf5Oeg0t1kwoeM92JfExgsL9T9M
+FI7qWKoOpLK/PWZX2VyRkRh3PNbIkT+U9FLXoike6TXISbM70ZqHupNTcLrWIJ9S7oDfT4
+dPTriQMP39sE+2muAwYWbyuX2TswMvOUOsRJxLjJXQLO8cCGHGObSHqcfz34VmHAyjywyq
+HqTy+0U6W5UgzaB4gzm3uNkrieU3U5okSqxhjVTPbr3OysOWUpnjzxDXNv+t62f3Fm45gD
+igmBibE3oVyPxsTJqvoJwFQRh4hr+memdg/jlt2rRKBZcM5+/L3sjjg+HYD3dzSsFFw3KL
+DwUvn75LyVAvQlAKcVOIujTPJIA8hCPvBHcprR9w90wAUNoV08WzjKhIK4XP6YW7nbVdVc
+jQM/cTQnY/EFoFU1kliyyixXDcKVMkevWroevlX
+License Agreement: CLOVER VERSION 1 (ONE) SOFTWARE LICENSE AGREEMENT
+
+1. Licenses and Software
+
+Cenqua Pty Ltd, an Australian Proprietary Limited Company ("CENQUA")
+hereby grants to the purchaser (the "LICENSEE") a limited, revocable,
+worldwide, non-exclusive, nontransferable, non-sublicensable license
+to use the Clover version 1 (one) software (the "Software"),
+including any minor upgrades thereof during the Term (hereinafter
+defined) up to, but not including the next major version of the
+Software. The licensee shall not, or knowingly allow others to,
+reverse engineer, decompile, disassemble, modify, adapt, create
+derivative works from or otherwise attempt to derive source code from
+the Software provided. And, in accordance with the terms and
+conditions of this Software License Agreement (the "Agreement"), the
+Software shall be used solely by the licensed users in accordance
+with the following edition specific conditions:
+
+a) Server Edition
+
+A Server Edition license entitles the Licensee to execute one
+instance of Clover Server Edition on one (1) machine for the purposes
+of instrumententing source code and generating reports. There are no
+limitations on the use of the instrumented source code or generated
+reports produced by Server Edition.
+
+b) Workstation Edition
+
+A Workstation Edition license entitles the licensee to use Clover
+Workstation Edition on one (1) machine by one (1) individual end
+user. Workstation Edition does not permit the generation of reports
+for distribution.
+
+c) Team Edition
+
+A Team Edition license entitles the licensee to use Clover Team
+edition on any number of machines solely by the licensed number of
+users. Reports generated by Clover Team Edition are strictly for use
+only by the licensed number of individual end users.
+
+2. License Fee
+
+In exchange for the License(s), the Licensee shall pay to CENQUA a
+one-time, up front, non-refundable license fee. At the sole
+discretion of CENQUA this fee will be waived for non-commercial
+projects. Notwithstanding the Licensee's payment of the License Fee,
+CENQUA reserves the right to terminate the License if CENQUA
+discovers that the Licensee and/or the Licensee's use of the Software
+is in breach of this Agreement.
+
+3. Proprietary Rights
+
+CENQUA will retain all right, title and interest in and to the
+Software, all copies thereof, and CENQUA website(s), software, and
+other intellectual property, including, but not limited to, ownership
+of all copyrights, look and feel, trademark rights, design rights,
+trade secret rights and any and all other intellectual property and
+other proprietary rights therein. The Licensee will not directly or
+indirectly obtain or attempt to obtain at any time, any right, title
+or interest by registration or otherwise in or to the trademarks,
+
+service marks, copyrights, trade names, symbols, logos or
+designations or other intellectual property rights owned or used by
+CENQUA. All technical manuals or other information provided by CENQUA
+to the Licensee shall be the sole property of CENQUA.
+
+4. Term and Termination
+
+Subject to the other provisions hereof, this Agreement shall commence
+upon the Licensee's opting into this Agreement and continue until the
+Licensee discontinues use of the Software or the Agreement terminates
+automatically upon the Licensee's breach of any term or condition of
+this Agreement (the "Term"). Upon any such termination, the Licensee
+will delete the Software immediately.
+
+5. Copying & Transfer
+
+The Licensee may copy the Software for back-up purposes only. The
+
+Licensee may not assign or otherwise transfer the Software to any
+third party.
+
+6. Specific Disclaimer of Warranty and Limitation of Liability
+
+THE SOFTWARE IS PROVIDED WITHOUT WARRANTY OF ANY KIND. CENQUA
+DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT NOT
+LIMITED TO THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE. CENQUA WILL NOT BE LIABLE FOR ANY DAMAGES
+ASSOCIATED WITH THE SOFTWARE, INCLUDING, WITHOUT LIMITATION,
+ORDINARY, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+INCLUDING BUT NOT LIMITED TO DAMAGES RELATING TO LOST DATA OR LOST
+PROFITS, EVEN IF CENQUA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+7. Warranties and Representations
+
+Licensee Indemnification. CENQUA agrees to indemnify, defend and hold
+the Licensee harmless from and against any and all liabilities,
+damages, losses, claims, costs, and expenses (including reasonable
+legal fees) arising out of or resulting from the Software or the use
+thereof infringing upon, misappropriating or violating any patents,
+copyrights, trademarks, or trade secret rights or other proprietary
+rights of persons, firms or entities who are not parties to this
+Agreement.
+
+CENQUA Indemnification. The Licensee warrants and represents that the
+Licensee's actions with regard to the Software will be in compliance
+with all applicable laws; and the Licensee agrees to indemnify,
+defend, and hold CENQUA harmless from and against any and all
+liabilities, damages, losses, claims, costs, and expenses (including
+reasonable legal fees) arising out of or resulting from the
+Licensee's failure to observe the use restrictions set forth herein.
+
+8. Publicity
+
+The Licensee grants permission for CENQUA to use Licensee's name
+solely in customer lists. CENQUA shall not, without prior consent in
+writing, use the Licensee's name, or that of its affiliates, in any
+form with the specific exception of customer lists. CENQUA agrees to
+remove Licensee's name from any and all materials within 7 days if
+notified by the Licensee in writing.
+
+9. Governing Law
+
+This Agreement shall be governed by the laws of New South Wales,
+Australia.
+
+10.Independent Contractors
+
+The parties are independent contractors with respect to each other,
+and nothing in this Agreement shall be construed as creating an
+employer-employee relationship, a partnership, agency relationship or
+a joint venture between the parties.
+
+11. Assignment
+
+This Agreement is not assignable or transferable by the Licensee.
+CENQUA in its sole discretion may transfer a license to a third party
+at the written request of the Licensee.
+
+12. Entire Agreement
+
+This Agreement constitutes the entire agreement between the parties
+concerning the Licensee's use of the Software. This Agreement
+supersedes any prior verbal understanding between the parties and any
+Licensee purchase order or other ordering document, regardless of
+whether such document is received by CENQUA before or after execution
+of this Agreement. This Agreement may be amended only in writing by
+CENQUA.
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2007-03-26 20:04:39 UTC (rev 41)
+++ trunk/pom.xml 2007-03-28 16:58:21 UTC (rev 42)
@@ -1,4 +1,6 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.ajax4jsf</groupId>
<artifactId>master</artifactId>
@@ -12,8 +14,7 @@
<url>http://www.gnu.org/licenses/lgpl.html</url>
<distribution>repo</distribution>
<comments>
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1
+ GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
</comments>
</license>
</licenses>
@@ -60,17 +61,23 @@
</developer>
</developers>
<distributionManagement>
- <downloadUrl>http://labs.jboss.com/portal/jbossajax4jsf/downloads</downloadUrl>
- <repository>
- <id>release-repository</id>
- <uniqueVersion>false</uniqueVersion>
- <url>${releaseRepository}</url>
- </repository>
- <snapshotRepository>
- <id>snap-repository</id>
- <uniqueVersion>true</uniqueVersion>
- <url>${snapshotRepository}</url>
- </snapshotRepository>
+ <downloadUrl>
+ http://labs.jboss.com/portal/jbossajax4jsf/downloads
+ </downloadUrl>
+ <repository>
+ <id>release-repository</id>
+ <uniqueVersion>false</uniqueVersion>
+ <url>${releaseRepository}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snap-repository</id>
+ <uniqueVersion>true</uniqueVersion>
+ <url>${snapshotRepository}</url>
+ </snapshotRepository>
+ <site>
+ <id>ajax4jsf-site</id>
+ <url>ajax4jsf/</url>
+ </site>
</distributionManagement>
<repositories>
<repository>
@@ -89,13 +96,36 @@
</repository>
</repositories>
<build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clover-plugin</artifactId>
+ <configuration>
+ <licenseLocation>clover-ajax4jsf.license</licenseLocation>
+ <jdk>1.5</jdk>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>pre-site</phase>
+ <goals>
+ <goal>instrument</goal>
+ <goal>aggregate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
</build>
-
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/ajax4jsf/</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/ajax4jsf/</developerConnection>
- <url>http://anonsvn.jboss.org/repos/ajax4jsf/</url>
- </scm>
+
+ <scm>
+ <connection>
+ scm:svn:http://anonsvn.jboss.org/repos/ajax4jsf/trunk/
+ </connection>
+ <developerConnection>
+ scm:svn:https://svn.jboss.org/repos/ajax4jsf/trunk/
+ </developerConnection>
+ <url>http://anonsvn.jboss.org/repos/ajax4jsf/trunk/</url>
+ </scm>
<!--
-->
<reporting>
@@ -146,9 +176,22 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clover-plugin</artifactId>
+ <configuration>
+ <licenseLocation>clover-ajax4jsf.license</licenseLocation>
+ <jdk>1.5</jdk>
+ </configuration>
+ </plugin>
</plugins>
</reporting>
+ <ciManagement>
+ <notifiers></notifiers>
+ <system>cruisecontrol</system>
+ </ciManagement>
+
<modules>
<module>framework</module>
<module>test</module>
@@ -199,7 +242,9 @@
</manifest>
<manifestEntries>
<mode>development</mode>
- <Build-Number>${buildNumber}</Build-Number>
+ <Build-Number>
+ ${buildNumber}
+ </Build-Number>
</manifestEntries>
</archive>
</configuration>
17 years, 9 months
JBoss Ajax4JSF SVN: r41 - in trunk: cdk/maven-cdk-plugin/src/main/resources/component and 1 other directories.
by ajax4jsf-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-03-26 16:04:39 -0400 (Mon, 26 Mar 2007)
New Revision: 41
Modified:
trunk/cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/src/main/templates/_compName.jspx
trunk/cdk/maven-cdk-plugin/src/main/resources/component/template.jspx
trunk/samples/cdk/src/main/templates/test.jspx
Log:
Extra name="#{clientId}" attributes removed from DIVs
Modified: trunk/cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/src/main/templates/_compName.jspx
===================================================================
--- trunk/cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/src/main/templates/_compName.jspx 2007-03-20 18:43:39 UTC (rev 40)
+++ trunk/cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/src/main/templates/_compName.jspx 2007-03-26 20:04:39 UTC (rev 41)
@@ -11,7 +11,6 @@
>
<f:clientid var="clientId"/>
<div id="#{clientId}"
- name="#{clientId}"
x:passThruWithExclusions="value,name,type,id"
>
</div>
Modified: trunk/cdk/maven-cdk-plugin/src/main/resources/component/template.jspx
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/resources/component/template.jspx 2007-03-20 18:43:39 UTC (rev 40)
+++ trunk/cdk/maven-cdk-plugin/src/main/resources/component/template.jspx 2007-03-26 20:04:39 UTC (rev 41)
@@ -11,7 +11,6 @@
>
<f:clientid var="clientId"/>
<div id="#{clientId}"
- name="#{clientId}"
x:passThruWithExclusions="value,name,type,id"
>
</div>
Modified: trunk/samples/cdk/src/main/templates/test.jspx
===================================================================
--- trunk/samples/cdk/src/main/templates/test.jspx 2007-03-20 18:43:39 UTC (rev 40)
+++ trunk/samples/cdk/src/main/templates/test.jspx 2007-03-26 20:04:39 UTC (rev 41)
@@ -13,7 +13,6 @@
<jsp:directive.page import="javax.faces.context.FacesContext,javax.faces.component.UIComponent"/>
<f:clientid var="clientId"/>
<div id="#{clientId}"
- name="#{clientId}"
type="#{component.attributes['type']}"
x:passThruWithExclusions="value,name,type,id"
>
17 years, 9 months
JBoss Ajax4JSF SVN: r40 - trunk/framework/src/main/javascript/dnd.
by ajax4jsf-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-03-20 14:43:39 -0400 (Tue, 20 Mar 2007)
New Revision: 40
Modified:
trunk/framework/src/main/javascript/dnd/dnd.js
Log:
onupdatedrag(event) callback handling added
Modified: trunk/framework/src/main/javascript/dnd/dnd.js
===================================================================
--- trunk/framework/src/main/javascript/dnd/dnd.js 2007-03-15 20:07:42 UTC (rev 39)
+++ trunk/framework/src/main/javascript/dnd/dnd.js 2007-03-20 18:43:39 UTC (rev 40)
@@ -48,10 +48,13 @@
updateDrag: function(event) {
var drag = window.drag;
- var x = Event.pointerX(event);
- var y = Event.pointerY(event);
- drag.indicator.position(x + 5, y + 14);
- Event.stop(event);
+
+ if (!drag.source.onupdatedrag || (drag.source.onupdatedrag(event) != false)) {
+ var x = Event.pointerX(event);
+ var y = Event.pointerY(event);
+ drag.indicator.position(x + 5, y + 14);
+ Event.stop(event);
+ }
},
initialized : false,
17 years, 9 months
JBoss Ajax4JSF SVN: r39 - trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-03-15 16:07:42 -0400 (Thu, 15 Mar 2007)
New Revision: 39
Modified:
trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java
Log:
Fix AJSF-11 bug, for incorrect save/restore localValue property of inputs inside a4j:repeat
Modified: trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java 2007-03-15 16:06:28 UTC (rev 38)
+++ trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java 2007-03-15 20:07:42 UTC (rev 39)
@@ -1039,7 +1039,7 @@
}
public void populate(EditableValueHolder evh) {
- this.value = evh.getValue();
+ this.value = evh.getLocalValue();
this.valid = evh.isValid();
this.submittedValue = evh.getSubmittedValue();
this.localValueSet = evh.isLocalValueSet();
17 years, 9 months
JBoss Ajax4JSF SVN: r38 - trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-03-15 12:06:28 -0400 (Thu, 15 Mar 2007)
New Revision: 38
Modified:
trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java
Log:
Fix setup row variable method with check is a data availible.
Modified: trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java 2007-03-14 23:37:35 UTC (rev 37)
+++ trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java 2007-03-15 16:06:28 UTC (rev 38)
@@ -162,7 +162,7 @@
* Name of EL variable for current component state.
*/
private String _stateVar;
-
+
private String _rowKeyVar;
/**
@@ -200,7 +200,8 @@
}
/**
- * @param rowKeyVar the rowKeyVar to set
+ * @param rowKeyVar
+ * the rowKeyVar to set
*/
public void setRowKeyVar(String rowKeyVar) {
this._rowKeyVar = rowKeyVar;
@@ -426,33 +427,43 @@
protected void setupVariable(FacesContext faces, DataModel localModel,
boolean rowSelected) {
Map attrs = faces.getExternalContext().getRequestMap();
- boolean rowAvailable = isRowAvailable();
- // Current row data.
- setupOrRemoveVariable(rowSelected, getVar(), attrs, rowAvailable, localModel.getRowData());
- // Component state variable.
- setupOrRemoveVariable(rowSelected, getStateVar(), attrs, rowAvailable, getComponentState());
- // Row key Data variable.
- setupOrRemoveVariable(rowSelected, getRowKeyVar(), attrs, rowAvailable, getRowKey());
+ if (rowSelected && isRowAvailable()) {
+ // Current row data.
+ setupVariable(getVar(), attrs, localModel.getRowData());
+ // Component state variable.
+ setupVariable(getStateVar(), attrs, getComponentState());
+ // Row key Data variable.
+ setupVariable(getRowKeyVar(), attrs, getRowKey());
+
+ } else {
+ removeVariable(getVar(), attrs);
+ removeVariable(getStateVar(), attrs);
+ removeVariable(getRowKeyVar(), attrs);
+ }
}
/**
- * @param rowSelected
* @param var
* @param attrs
- * @param rowAvailable
* @param rowData
*/
- private void setupOrRemoveVariable(boolean rowSelected, String var, Map attrs, boolean rowAvailable, Object rowData) {
+ private void setupVariable(String var, Map attrs, Object rowData) {
if (var != null) {
- if (rowSelected && rowAvailable) {
- attrs.put(var, rowData);
- } else {
- attrs.remove(var);
- }
+ attrs.put(var, rowData);
}
}
/**
+ * @param var
+ * @param attrs
+ * @param rowData
+ */
+ private void removeVariable(String var, Map attrs) {
+ if (var != null) {
+ attrs.remove(var);
+ }
+ }
+ /**
* Reset data model. this method must be called twice per request - before
* decode phase and before component encoding.
*/
@@ -916,7 +927,8 @@
return;
this.iterate(faces, updateVisitor, argument);
ExtendedDataModel dataModel = getExtendedDataModel();
- // If no validation errors, update values for serializable model, restored from view.
+ // If no validation errors, update values for serializable model,
+ // restored from view.
if (dataModel instanceof SerializableDataModel && (!keepSaved(faces))) {
SerializableDataModel serializableModel = (SerializableDataModel) dataModel;
serializableModel.update();
@@ -1184,7 +1196,7 @@
*
*/
private static final long serialVersionUID = 9037454770537726418L;
-
+
/**
* Flag setted to true if componentState implements StateHolder
*/
@@ -1212,9 +1224,11 @@
PerIdState idState = (PerIdState) stateEntry.getValue();
DataComponentState compState;
if (idState.stateInHolder) {
- // TODO - change RichFaces Tree component, for remove reference to component from state.
+ // TODO - change RichFaces Tree component, for remove reference
+ // to component from state.
compState = createComponentState();
- ((StateHolder)compState).restoreState(faces, idState.componentState);
+ ((StateHolder) compState).restoreState(faces,
+ idState.componentState);
} else {
compState = (DataComponentState) idState.componentState;
}
@@ -1242,14 +1256,16 @@
idState.model = getExtendedDataModel().getSerializableModel(
dataComponentState.getRange());
// Save component state , depended if implemented interfaces.
- if(null == dataComponentState){
+ if (null == dataComponentState) {
idState.componentState = null;
- } else if (dataComponentState instanceof Serializable ){
+ } else if (dataComponentState instanceof Serializable) {
idState.componentState = dataComponentState;
- } else if(dataComponentState instanceof StateHolder) {
- // TODO - change RichFaces Tree component, for remove reference to component from state.
+ } else if (dataComponentState instanceof StateHolder) {
+ // TODO - change RichFaces Tree component, for remove
+ // reference to component from state.
// Change this code to reference for saveAttachedState.
- idState.componentState = ((StateHolder)dataComponentState).saveState(faces);
+ idState.componentState = ((StateHolder) dataComponentState)
+ .saveState(faces);
idState.stateInHolder = true;
}
if (null != idState.model || null != idState.componentState) {
17 years, 9 months
JBoss Ajax4JSF SVN: r36 - trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-03-14 10:44:06 -0400 (Wed, 14 Mar 2007)
New Revision: 36
Modified:
trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/SequenceDataModel.java
trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java
Log:
Resolved AJSF-5 and RF-4 , name for EL-variable with current row index can be set by rowKeyVar
attribute
Modified: trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/SequenceDataModel.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/SequenceDataModel.java 2007-03-13 18:11:49 UTC (rev 35)
+++ trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/SequenceDataModel.java 2007-03-14 14:44:06 UTC (rev 36)
@@ -32,14 +32,14 @@
*/
public class SequenceDataModel extends ExtendedDataModel {
- DataModel wrapped;
+ private DataModel wrappedModel;
/**
* @param wrapped
*/
public SequenceDataModel(DataModel wrapped) {
super();
- this.wrapped = wrapped;
+ this.wrappedModel = wrapped;
}
/* (non-Javadoc)
@@ -83,7 +83,7 @@
public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) throws IOException {
final SequenceRange seqRange = (SequenceRange) range;
int rows = seqRange.getRows();
- int rowCount = wrapped.getRowCount();
+ int rowCount = wrappedModel.getRowCount();
int currentRow = seqRange.getFirstRow();
if(rows > 0){
rows += currentRow;
@@ -96,8 +96,8 @@
rows = -1;
}
while (rows < 0 || currentRow < rows) {
- wrapped.setRowIndex(currentRow);
- if(wrapped.isRowAvailable()){
+ wrappedModel.setRowIndex(currentRow);
+ if(wrappedModel.isRowAvailable()){
visitor.process(context, new Integer(currentRow), argument);
} else {
break;
@@ -111,7 +111,7 @@
* @see org.ajax4jsf.ajax.repeat.ExtendedDataModel#getRowKey()
*/
public Object getRowKey() {
- int index = wrapped.getRowIndex();
+ int index = wrappedModel.getRowIndex();
if(index<0){
return null;
}
@@ -124,10 +124,10 @@
*/
public void setRowKey(Object key) {
if(null == key){
- wrapped.setRowIndex(-1);
+ wrappedModel.setRowIndex(-1);
} else {
Integer index = (Integer) key;
- wrapped.setRowIndex(index.intValue());
+ wrappedModel.setRowIndex(index.intValue());
}
}
@@ -136,7 +136,7 @@
*/
public int getRowCount() {
// TODO Auto-generated method stub
- return wrapped.getRowCount();
+ return wrappedModel.getRowCount();
}
/* (non-Javadoc)
@@ -144,7 +144,7 @@
*/
public Object getRowData() {
// TODO Auto-generated method stub
- return wrapped.getRowData();
+ return wrappedModel.getRowData();
}
/* (non-Javadoc)
@@ -152,7 +152,7 @@
*/
public int getRowIndex() {
// TODO Auto-generated method stub
- return wrapped.getRowIndex();
+ return wrappedModel.getRowIndex();
}
/* (non-Javadoc)
@@ -160,7 +160,7 @@
*/
public Object getWrappedData() {
// TODO Auto-generated method stub
- return wrapped.getWrappedData();
+ return wrappedModel.getWrappedData();
}
/* (non-Javadoc)
@@ -168,21 +168,35 @@
*/
public boolean isRowAvailable() {
// TODO Auto-generated method stub
- return wrapped.isRowAvailable();
+ return wrappedModel.isRowAvailable();
}
/* (non-Javadoc)
* @see javax.faces.model.DataModel#setRowIndex(int)
*/
public void setRowIndex(int rowIndex) {
- wrapped.setRowIndex(rowIndex);
+ wrappedModel.setRowIndex(rowIndex);
}
/* (non-Javadoc)
* @see javax.faces.model.DataModel#setWrappedData(java.lang.Object)
*/
public void setWrappedData(Object data) {
- wrapped.setWrappedData(data);
+ wrappedModel.setWrappedData(data);
}
+ /**
+ * @return the wrappedModel
+ */
+ protected DataModel getWrappedModel() {
+ return this.wrappedModel;
+ }
+
+ /**
+ * @param wrappedModel the wrappedModel to set
+ */
+ protected void setWrappedModel(DataModel wrappedModel) {
+ this.wrappedModel = wrappedModel;
+ }
+
}
Modified: trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java 2007-03-13 18:11:49 UTC (rev 35)
+++ trunk/framework/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java 2007-03-14 14:44:06 UTC (rev 36)
@@ -161,7 +161,9 @@
/**
* Name of EL variable for current component state.
*/
- private String _varState;
+ private String _stateVar;
+
+ private String _rowKeyVar;
/**
* Key for current value in model.
@@ -178,18 +180,32 @@
*
* @return the varState
*/
- public String getVarState() {
- return _varState;
+ public String getStateVar() {
+ return _stateVar;
}
/**
* @param varStatus
* the varStatus to set
*/
- public void setVarState(String varStatus) {
- this._varState = varStatus;
+ public void setStateVar(String varStatus) {
+ this._stateVar = varStatus;
}
+ /**
+ * @return the rowKeyVar
+ */
+ public String getRowKeyVar() {
+ return this._rowKeyVar;
+ }
+
+ /**
+ * @param rowKeyVar the rowKeyVar to set
+ */
+ public void setRowKeyVar(String rowKeyVar) {
+ this._rowKeyVar = rowKeyVar;
+ }
+
/*
* (non-Javadoc)
*
@@ -409,23 +425,31 @@
*/
protected void setupVariable(FacesContext faces, DataModel localModel,
boolean rowSelected) {
- String var = getVar();
Map attrs = faces.getExternalContext().getRequestMap();
- String varState = getVarState();
+ boolean rowAvailable = isRowAvailable();
+ // Current row data.
+ setupOrRemoveVariable(rowSelected, getVar(), attrs, rowAvailable, localModel.getRowData());
+ // Component state variable.
+ setupOrRemoveVariable(rowSelected, getStateVar(), attrs, rowAvailable, getComponentState());
+ // Row key Data variable.
+ setupOrRemoveVariable(rowSelected, getRowKeyVar(), attrs, rowAvailable, getRowKey());
+ }
+
+ /**
+ * @param rowSelected
+ * @param var
+ * @param attrs
+ * @param rowAvailable
+ * @param rowData
+ */
+ private void setupOrRemoveVariable(boolean rowSelected, String var, Map attrs, boolean rowAvailable, Object rowData) {
if (var != null) {
- if (rowSelected && isRowAvailable()) {
- attrs.put(var, localModel.getRowData());
+ if (rowSelected && rowAvailable) {
+ attrs.put(var, rowData);
} else {
attrs.remove(var);
}
}
- if (varState != null) {
- if (rowSelected && isRowAvailable()) {
- attrs.put(varState, getComponentState());
- } else {
- attrs.remove(varState);
- }
- }
}
/**
17 years, 9 months