JBoss Rich Faces SVN: r8496 - in trunk/ui/columns/src/main: java/org/richfaces/taglib and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-05-08 09:20:32 -0400 (Thu, 08 May 2008)
New Revision: 8496
Added:
trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag2.java
Modified:
trunk/ui/columns/src/main/config/component/columns.xml
Log:
RF-3358
Modified: trunk/ui/columns/src/main/config/component/columns.xml
===================================================================
--- trunk/ui/columns/src/main/config/component/columns.xml 2008-05-08 12:57:21 UTC (rev 8495)
+++ trunk/ui/columns/src/main/config/component/columns.xml 2008-05-08 13:20:32 UTC (rev 8496)
@@ -16,7 +16,7 @@
<tag generate="false">
<name>columns</name>
<classname>
- org.richfaces.taglib.ColumnsTag
+ org.richfaces.taglib.ColumnsTag2
</classname>
<test/>
</tag>
Added: trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag2.java
===================================================================
--- trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag2.java (rev 0)
+++ trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag2.java 2008-05-08 13:20:32 UTC (rev 8496)
@@ -0,0 +1,992 @@
+package org.richfaces.taglib;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.FunctionMapper;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.webapp.UIComponentClassicTagBase;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.IterationTag;
+
+import org.richfaces.component.UIColumn;
+import org.richfaces.iterator.ForEachIterator;
+import org.richfaces.iterator.SimpleForEachIterator;
+import org.richfaces.renderkit.CellRenderer;
+
+@SuppressWarnings("unused")
+public class ColumnsTag2 extends UIComponentClassicTagBase implements
+ IterationTag {
+
+ /** Data table */
+ private UIComponent dataTable;
+
+ /** Prefix before id to be assigned for column */
+ private static final String COLUMN_ID_PREFIX = "rf";
+
+ /** Flag indicates if columns are already created */
+ private boolean created = false;
+
+ /** Current column counter */
+ private Integer index = -1;
+
+ /** Iterator for columns's tag value attribute */
+ protected ForEachIterator items; // our 'digested' items
+
+ /** Value attribute value */
+ protected Object rawItems; // our 'raw' items
+
+ /** End attribute - defines count of column if value attr hasn't been defined */
+ private ValueExpression __columns;
+
+ /** Begin attribute - defines the first iteration item */
+ private ValueExpression __begin;
+
+ /** Begin attribute - defines the last iteration item */
+ private ValueExpression __end;
+
+ /** Index attr - defines page variable for current column counter */
+ private ValueExpression _index;
+
+ /** Var attr - defines page variable for current item */
+ private String indexId;
+
+ /** Integer value of end attr. */
+ private Integer columns;
+
+ /** Integer value of begin attr. */
+ private Integer begin;
+
+ /** Integer value of end attr. */
+ private Integer end;
+
+ /** String value of var attr */
+ private String itemId = null;
+
+ /** Expression for var item */
+ private IteratedExpression iteratedExpression;
+
+ /** Column incrementer */
+ private Integer counter = 0;
+
+ /**
+ * style CSS style(s) is/are to be applied when this component is rendered
+ */
+ private ValueExpression _style;
+
+ /*
+ * sortBy Attribute defines a bean property which is used for sorting of a
+ * column
+ */
+ private ValueExpression _sortBy;
+
+ /**
+ * sortOrder SortOrder is an enumeration of the possible sort orderings.
+ */
+ private ValueExpression _sortOrder;
+
+ /**
+ * value The current value for this component
+ */
+ private ValueExpression __value;
+
+ /**
+ * var A request-scope attribute via which the data object for the current
+ * row will be used when iterating
+ */
+ private ValueExpression __var;
+
+ /**
+ * breakBefore if "true" next column begins from the first row
+ */
+ private ValueExpression _breakBefore;
+
+ /**
+ * colspan Corresponds to the HTML colspan attribute
+ */
+ private ValueExpression _colspan;
+
+ /**
+ * Dir attr
+ */
+ private ValueExpression _dir;
+
+ /*
+ * filterDefaultLabel
+ *
+ */
+ private ValueExpression _filterDefaultLabel;
+
+ /**
+ * comparator
+ *
+ */
+ private ValueExpression _comparator;
+
+ /*
+ * filterEvent Event for filter input that forces the filtration (default =
+ * onchange)
+ */
+ private ValueExpression _filterEvent;
+
+ /*
+ * filterExpression Attribute defines a bean property which is used for
+ * filtering of a column
+ */
+ private ValueExpression _filterExpression;
+
+ /*
+ * filterMethod
+ *
+ */
+ private MethodExpression _filterMethod;
+
+ /*
+ * filterValue
+ *
+ */
+ private ValueExpression _filterValue;
+
+ /*
+ * filterBy
+ *
+ */
+ private ValueExpression _filterBy;
+
+ /**
+ * footerClass Space-separated list of CSS style class(es) that are be
+ * applied to any footer generated for this table
+ */
+ private ValueExpression _footerClass;
+
+ /**
+ * headerClass Space-separated list of CSS style class(es) that are be
+ * applied to any header generated for this table
+ */
+ private ValueExpression _headerClass;
+
+ /**
+ * rowspan Corresponds to the HTML rowspan attribute
+ */
+ private ValueExpression _rowspan;
+
+ /**
+ * selfSorted
+ *
+ */
+ private ValueExpression _selfSorted;
+
+ /**
+ * sortable Boolean attribute. If "true" it's possible to sort the column
+ * content after click on the header. Default value is "true"
+ */
+ private ValueExpression _sortable;
+
+ /**
+ * sortExpression Attribute defines a bean property which is used for
+ * sorting of a column
+ */
+ private ValueExpression _sortExpression;
+
+ /**
+ * styleClass Corresponds to the HTML class attribute
+ */
+ private ValueExpression _styleClass;
+
+ /*
+ * width Attribute defines width of column. Default value is "100px".
+ */
+ private ValueExpression _width;
+
+ /**
+ * SortOrder is an enumeration of the possible sort orderings. Setter for
+ * sortOrder
+ *
+ * @param sortOrder -
+ * new value
+ */
+ public void setSortOrder(ValueExpression __sortOrder) {
+ this._sortOrder = __sortOrder;
+ }
+
+ /**
+ * Attribute defines a bean property which is used for sorting of a column
+ * Setter for sortBy
+ *
+ * @param sortBy -
+ * new value
+ */
+ public void setSortBy(ValueExpression __sortBy) {
+ this._sortBy = __sortBy;
+ }
+
+ /**
+ * CSS style(s) is/are to be applied when this component is rendered Setter
+ * for style
+ *
+ * @param style -
+ * new value
+ */
+ public void setStyle(ValueExpression __style) {
+ this._style = __style;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentClassicTagBase#doStartTag()
+ */
+ @Override
+ public int doStartTag() throws JspException {
+
+ prepare();
+
+ if (hasNext()) {
+ next();
+ exposeVariables();
+ super.doStartTag();
+ } else {
+ return SKIP_BODY;
+ }
+
+ return EVAL_BODY_BUFFERED;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentClassicTagBase#doAfterBody()
+ */
+ @Override
+ public int doAfterBody() throws JspException {
+ try {
+ if (hasNext()) {
+ super.doAfterBody();
+ super.doEndTag();
+ next();
+ exposeVariables();
+ super.doStartTag();
+ return EVAL_BODY_AGAIN;
+ } else {
+ super.doAfterBody();
+ exposeVariables();
+ return EVAL_BODY_INCLUDE;
+ }
+
+ } catch (Exception e) {
+ throw new JspException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentClassicTagBase#doEndTag()
+ */
+ @Override
+ public int doEndTag() throws JspException {
+ if (!atFirst()) {
+ return super.doEndTag();
+ }
+ return EVAL_PAGE;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentClassicTagBase#doInitBody()
+ */
+ @Override
+ public void doInitBody() throws JspException {
+
+ }
+
+ @Override
+ protected UIComponent createComponent(FacesContext context, String newId)
+ throws JspException {
+ UIComponent c = getFacesContext().getApplication().createComponent(
+ getComponentType());
+ c.setId(generateColumnId());
+ c.setTransient(false);
+ setProperties(c);
+ return c;
+ }
+
+ @Override
+ protected boolean hasBinding() {
+ return false;
+ }
+
+ @Override
+ protected void setProperties(UIComponent component) {
+ ELContext elContext = getContext(pageContext.getELContext());
+
+ Field[] fields = this.getClass().getDeclaredFields();
+ for (Field field : fields) {
+ try {
+ Object o = field.get(this);
+ if ((o != null) && (o instanceof ValueExpression)) {
+ String fieldName = field.getName();
+ if (fieldName != null && fieldName.startsWith("_")) {
+ String attributeName = fieldName.replace("_", "");
+ ValueExpression ex = (ValueExpression) o;
+ ex = createValueExpression(elContext, ex);
+ component.setValueExpression(attributeName, ex);
+ }
+
+ }
+ } catch (Exception e) {
+ continue;
+ }
+ }
+ }
+
+ /**
+ * Creates value expression to be out into column
+ *
+ * @param context
+ * @param orig
+ * @return
+ */
+ private ValueExpression createValueExpression(ELContext context,
+ ValueExpression orig) {
+ ValueExpression vexpr = getFacesContext().getApplication()
+ .getExpressionFactory().createValueExpression(context,
+ orig.getExpressionString(), orig.getExpectedType());
+ return vexpr;
+ }
+
+ /**
+ * Deletes dynamic rich columns created before
+ */
+ private void deleteRichColumns() {
+ List<UIComponent> children = dataTable.getChildren();
+ Iterator<UIComponent> it = children.iterator();
+ List<UIComponent> forDelete = new ArrayList<UIComponent>();
+ Integer i = 0;
+ while (it.hasNext()) {
+ UIComponent child = it.next();
+ String id = child.getId();
+ if (id != null && id.startsWith(COLUMN_ID_PREFIX)) {
+ forDelete.add(child);
+ }
+ i++;
+ }
+ it = forDelete.iterator();
+ while (it.hasNext()) {
+ UIComponent elem = it.next();
+ children.remove(elem);
+ }
+ }
+
+ /**
+ * Method prepares all we need for starting of tag rendering
+ *
+ * @throws JspTagException
+ */
+ private void prepare() throws JspTagException {
+ dataTable = getParentUIComponentClassicTagBase(pageContext)
+ .getComponentInstance();
+ created = (dataTable.getChildCount() > 0);
+
+ if (created) {
+ deleteRichColumns();
+ }
+
+ initVariables();
+
+ // produce the right sort of ForEachIterator
+ if (__value != null) {
+ // If this is a deferred expression, make a note and get
+ // the 'items' instance.
+ if (__value instanceof ValueExpression) {
+ rawItems = __value.getValue(pageContext.getELContext());
+ }
+ // extract an iterator over the 'items' we've got
+ items = SimpleForEachIterator
+ .supportedTypeForEachIterator(rawItems);
+ } else {
+ // no 'items', so use 'begin' and 'end'
+ items = SimpleForEachIterator.beginEndForEachIterator(columns - 1);
+ }
+
+ correctFirst();
+
+ /*
+ * ResultSet no more supported in <c:forEach> // step must be 1 when
+ * ResultSet is passed in if (rawItems instanceof ResultSet && step !=
+ * 1) throw new JspTagException(
+ * Resources.getMessage("FOREACH_STEP_NO_RESULTSET"));
+ */
+
+ }
+
+ /**
+ * Extracts tags attributes values
+ */
+ private void initVariables() {
+ initColumnsCount();
+ initIndex();
+ initVar();
+ initBegin();
+ initEnd();
+ }
+
+ private void initItarationId() {
+ setJspId(getJspId()); // We need it twice!
+ setJspId(getJspId());
+ }
+
+ /**
+ * Extracts integer value from end attr
+ */
+ private void initColumnsCount() {
+ if (__columns != null) {
+ if (__columns instanceof ValueExpression)
+ try {
+ String t = (String) __columns.getValue(getELContext());
+ columns = Integer.parseInt(t);
+ if (columns < 0) {
+ columns = 0; // If end is negative set up zero
+ }
+ } catch (Exception e) {
+ columns = 0;
+ }
+ } else {
+ columns = 0;
+ }
+ }
+
+ /**
+ * Extracts string value from var attr
+ */
+ private void initVar() {
+ if (__var != null) {
+ try {
+ itemId = (String) __var.getValue(getELContext());
+ } catch (ClassCastException e) {
+ itemId = null;
+ }
+
+ }
+ }
+
+ /**
+ * Extracts string value from index attr
+ */
+ private void initIndex() {
+ if (_index != null) {
+ try {
+ indexId = (String) _index.getValue(getELContext());
+ } catch (ClassCastException e) {
+ indexId = null;
+ }
+
+ }
+ }
+
+ /**
+ * Extracts string value from index attr
+ */
+ private void initBegin() {
+ begin = 0;
+ if (__begin != null) {
+ try {
+ String t = (String) __begin.getValue(getELContext());
+ begin = Integer.parseInt(t);
+ begin--; // correct begin value
+ if (begin < 0) {
+ begin = 0;
+ }
+ } catch (ClassCastException e) {
+ begin = 0;
+ }
+
+ }
+ }
+
+ /**
+ * Extracts string value from index attr
+ */
+ private void initEnd() {
+ end = 0;
+ if (__end != null) {
+ try {
+ String t = (String) __end.getValue(getELContext());
+ end = Integer.parseInt(t);
+ if (end < 0) {
+ end = 0;
+ }
+ } catch (ClassCastException e) {
+ end = 0;
+ }
+
+ }
+ }
+
+ /**
+ * Inits first iteration item
+ */
+ private void correctFirst() {
+ try {
+ if (items != null) {
+ if (begin > 0 && (index < (begin - 1))) {
+ while ((index < (begin - 1)) && hasNext()) {
+ next();
+ }
+ }
+ }
+ } catch (Exception e) {
+ // TODO: handle exception
+ }
+ }
+
+ /**
+ * Return true if we didn't complete column's count
+ *
+ * @return
+ * @throws JspTagException
+ */
+ private boolean hasNext() throws JspTagException {
+ if (end != 0) {
+ return (index < (end - 1)) ? items.hasNext() : false;
+ } else {
+ return items.hasNext();
+ }
+ }
+
+ /**
+ * Iterate to next column
+ *
+ * @return
+ * @throws JspTagException
+ */
+ private Object next() throws JspTagException {
+ Object o = items.next();
+ initItarationId();
+ index++;
+ return o;
+ }
+
+ /**
+ * Returns true if this is the first loop of columns tag
+ *
+ * @return
+ */
+ private boolean atFirst() {
+ return (index == begin - 1);
+ }
+
+ private String generateColumnId() {
+ return COLUMN_ID_PREFIX + Integer.toString(index);
+ }
+
+ /**
+ * Create custom context with VariableMapper override.
+ *
+ * @param context
+ * @return
+ */
+ private ELContext getContext(final ELContext cont) {
+ return new ELContext() {
+
+ @Override
+ public ELResolver getELResolver() {
+ // TODO Auto-generated method stub
+ return cont.getELResolver();
+ }
+
+ @Override
+ public FunctionMapper getFunctionMapper() {
+ // TODO Auto-generated method stub
+ return cont.getFunctionMapper();
+ }
+
+ @Override
+ public VariableMapper getVariableMapper() {
+ return new VariableMapper() {
+
+ @Override
+ public ValueExpression resolveVariable(String variable) {
+ // TODO Auto-generated method stub
+ if (variable.equals(itemId)) {
+ return new IndexedValueExpression(__value, index);
+ } else if (variable.equals(indexId)) {
+ return new IteratedIndexExpression(index);
+ }
+ return cont.getVariableMapper().resolveVariable(
+ variable);
+ }
+
+ @Override
+ public ValueExpression setVariable(String variable,
+ ValueExpression expression) {
+ // TODO Auto-generated method stub
+ return cont.getVariableMapper().setVariable(variable,
+ expression);
+ }
+
+ };
+ }
+
+ };
+ }
+
+ @Override
+ public String getComponentType() {
+ return UIColumn.COMPONENT_TYPE;
+ }
+
+ @Override
+ public String getRendererType() {
+
+ return CellRenderer.class.getName();
+ }
+
+ /**
+ * Sets page request variables
+ *
+ * @throws JspTagException
+ */
+ private void exposeVariables() throws JspTagException {
+
+ /*
+ * We need to support null items returned from next(); we do this simply
+ * by passing such non-items through to the scoped variable as
+ * effectively 'null' (that is, by calling removeAttribute()).
+ *
+ * Also, just to be defensive, we handle the case of a null 'status'
+ * object as well.
+ *
+ * We call getCurrent() and getLoopStatus() (instead of just using
+ * 'item' and 'status') to bridge to subclasses correctly. A subclass
+ * can override getCurrent() or getLoopStatus() but still depend on our
+ * doStartTag() and doAfterBody(), which call this method
+ * (exposeVariables()), to expose 'item' and 'status' correctly.
+ */
+
+ // Set up var variable
+ if (itemId != null) {
+ if (index == null)
+ pageContext.removeAttribute(itemId, PageContext.PAGE_SCOPE);
+ else if (__value != null) {
+ VariableMapper vm = pageContext.getELContext()
+ .getVariableMapper();
+ if (vm != null) {
+ ValueExpression ve = getVarExpression(__value);
+ vm.setVariable(itemId, ve);
+ }
+ } else
+ pageContext.setAttribute(itemId, index);
+ }
+
+ // Set up index variable
+
+ if (indexId != null) {
+ if (index == null)
+ pageContext.removeAttribute(indexId, PageContext.PAGE_SCOPE);
+ else {
+ IteratedIndexExpression indexExpression = new IteratedIndexExpression(
+ index - begin);
+ VariableMapper vm = pageContext.getELContext()
+ .getVariableMapper();
+ if (vm != null) {
+ vm.setVariable(indexId, indexExpression);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Return expression for page variables
+ *
+ * @param expr
+ * @return
+ */
+ private ValueExpression getVarExpression(ValueExpression expr) {
+ Object o = expr.getValue(pageContext.getELContext());
+ if (o.getClass().isArray() || o instanceof List) {
+ return new IndexedValueExpression(__value, index);
+ }
+
+ if (o instanceof Collection || o instanceof Iterator
+ || o instanceof Enumeration || o instanceof Map
+ || o instanceof String) {
+
+ if (iteratedExpression == null) {
+ iteratedExpression = new IteratedExpression(__value, getDelims());
+ }
+ return new IteratedValueExpression(iteratedExpression, index);
+ }
+
+ throw new ELException("FOREACH_BAD_ITEMS");
+ }
+
+ /*
+ * Get the delimiter for string tokens. Used only for constructing the
+ * deferred expression for it.
+ */
+ protected String getDelims() {
+ return ",";
+ }
+
+ /**
+ * @param end
+ * the end to set
+ */
+ public void setEnd(ValueExpression end) {
+ this.__end = end;
+ }
+
+ /**
+ * @param begin
+ * the begin to set
+ */
+ public void setBegin(ValueExpression begin) {
+ this.__begin = begin;
+ }
+
+ /**
+ * @param columns
+ * the columns to set
+ */
+ public void setColumns(ValueExpression columns) {
+ this.__columns = columns;
+ }
+
+ /**
+ * @param index
+ * the index to set
+ */
+ public void setIndex(ValueExpression index) {
+ this._index = index;
+ }
+
+ /**
+ * The current value for this component Setter for value
+ *
+ * @param value -
+ * new value
+ */
+ public void setValue(ValueExpression __value) {
+ this.__value = __value;
+ }
+
+ /**
+ * A request-scope attribute via which the data object for the current row
+ * will be used when iterating Setter for var
+ *
+ * @param var -
+ * new value
+ */
+ public void setVar(ValueExpression __var) {
+ this.__var = __var;
+ }
+
+ /**
+ * Corresponds to the HTML colspan attribute Setter for colspan
+ *
+ * @param colspan -
+ * new value
+ */
+ public void setColspan(ValueExpression __colspan) {
+ this._colspan = __colspan;
+ }
+
+ /**
+ * Corresponds to the HTML class attribute Setter for styleClass
+ *
+ * @param styleClass -
+ * new value
+ */
+ public void setStyleClass(ValueExpression __styleClass) {
+ this._styleClass = __styleClass;
+ }
+
+ /**
+ * Attribute defines width of column. Default value is "100px". Setter for
+ * width
+ *
+ * @param width -
+ * new value
+ */
+ public void setWidth(ValueExpression __width) {
+ this._width = __width;
+ }
+
+ /**
+ * if "true" next column begins from the first row Setter for breakBefore
+ *
+ * @param breakBefore -
+ * new value
+ */
+ public void setBreakBefore(ValueExpression __breakBefore) {
+ this._breakBefore = __breakBefore;
+ }
+
+ /**
+ *
+ * Setter for comparator
+ *
+ * @param comparator -
+ * new value
+ */
+ public void setComparator(ValueExpression __comparator) {
+ this._comparator = __comparator;
+ }
+
+ /**
+ * Sets dir attr
+ *
+ * @param dir
+ */
+ public void setDir(ValueExpression dir) {
+ _dir = dir;
+ }
+
+ /**
+ *
+ * Setter for filterBy
+ *
+ * @param filterBy -
+ * new value
+ */
+ public void setFilterBy(ValueExpression __filterBy) {
+ this._filterBy = __filterBy;
+ }
+
+ /**
+ *
+ * Setter for filterDefaultLabel
+ *
+ * @param filterDefaultLabel -
+ * new value
+ */
+ public void setFilterDefaultLabel(ValueExpression __filterDefaultLabel) {
+ this._filterDefaultLabel = __filterDefaultLabel;
+ }
+
+ /**
+ * Event for filter input that forces the filtration (default = onchange)
+ * Setter for filterEvent
+ *
+ * @param filterEvent -
+ * new value
+ */
+ public void setFilterEvent(ValueExpression __filterEvent) {
+ this._filterEvent = __filterEvent;
+ }
+
+ /**
+ * Attribute defines a bean property which is used for filtering of a column
+ * Setter for filterExpression
+ *
+ * @param filterExpression -
+ * new value
+ */
+ public void setFilterExpression(ValueExpression __filterExpression) {
+ this._filterExpression = __filterExpression;
+ }
+
+ /**
+ *
+ * Setter for filterMethod
+ *
+ * @param filterMethod -
+ * new value
+ */
+ public void setFilterMethod(MethodExpression __filterMethod) {
+ this._filterMethod = __filterMethod;
+ }
+
+ /**
+ *
+ * Setter for filterValue
+ *
+ * @param filterValue -
+ * new value
+ */
+ public void setFilterValue(ValueExpression __filterValue) {
+ this._filterValue = __filterValue;
+ }
+
+ /**
+ * Space-separated list of CSS style class(es) that are be applied to any
+ * footer generated for this table Setter for footerClass
+ *
+ * @param footerClass -
+ * new value
+ */
+ public void setFooterClass(ValueExpression __footerClass) {
+ this._footerClass = __footerClass;
+ }
+
+ /**
+ * Space-separated list of CSS style class(es) that are be applied to any
+ * header generated for this table Setter for headerClass
+ *
+ * @param headerClass -
+ * new value
+ */
+ public void setHeaderClass(ValueExpression __headerClass) {
+ this._headerClass = __headerClass;
+ }
+
+ /**
+ * Corresponds to the HTML rowspan attribute Setter for rowspan
+ *
+ * @param rowspan -
+ * new value
+ */
+ public void setRowspan(ValueExpression __rowspan) {
+ this._rowspan = __rowspan;
+ }
+
+ /**
+ *
+ * Setter for selfSorted
+ *
+ * @param selfSorted -
+ * new value
+ */
+ public void setSelfSorted(ValueExpression __selfSorted) {
+ this._selfSorted = __selfSorted;
+ }
+
+ /**
+ * Boolean attribute. If "true" it's possible to sort the column content
+ * after click on the header. Default value is "true" Setter for sortable
+ *
+ * @param sortable -
+ * new value
+ */
+ public void setSortable(ValueExpression __sortable) {
+ this._sortable = __sortable;
+ }
+
+ /**
+ * Attribute defines a bean property which is used for sorting of a column
+ * Setter for sortExpression
+ *
+ * @param sortExpression -
+ * new value
+ */
+ public void setSortExpression(ValueExpression __sortExpression) {
+ this._sortExpression = __sortExpression;
+ }
+}
16 years, 8 months
JBoss Rich Faces SVN: r8495 - trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-05-08 08:57:21 -0400 (Thu, 08 May 2008)
New Revision: 8495
Modified:
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
Log:
http://jira.jboss.com/jira/browse/RF-3324
Modified: trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
===================================================================
--- trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-05-08 12:55:25 UTC (rev 8494)
+++ trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-05-08 12:57:21 UTC (rev 8495)
@@ -125,16 +125,15 @@
},
listMousedownHandler : function(e) {
- if (Prototype.Browser.IE) {
- if (!this.comboList.getEventItem(e)) {
- this.clickOnScroll = true;
- }
- this.comboList.isList = true;
- } else if (Prototype.Browser.Gecko) {
+ //TODO:fix it
+ if (Prototype.Browser.Gecko) {
if (this.comboList.getEventItem(e)) {
this.comboList.isList = true;
}
} else {
+ if (!this.comboList.getEventItem(e)) {
+ this.clickOnScroll = true;
+ }
this.comboList.isList = true;
}
},
16 years, 8 months
JBoss Rich Faces SVN: r8494 - trunk/test-applications/facelets/src/main/webapp/Panel.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2008-05-08 08:55:25 -0400 (Thu, 08 May 2008)
New Revision: 8494
Modified:
trunk/test-applications/facelets/src/main/webapp/Panel/Panel.xhtml
Log:
Modified: trunk/test-applications/facelets/src/main/webapp/Panel/Panel.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Panel/Panel.xhtml 2008-05-08 12:46:32 UTC (rev 8493)
+++ trunk/test-applications/facelets/src/main/webapp/Panel/Panel.xhtml 2008-05-08 12:55:25 UTC (rev 8494)
@@ -15,8 +15,7 @@
<h:panelGroup>
<h:form>
- <rich:panel z
- onmouseover="document.getElementById(this.id+'_header').style.background='#60BA01';document.getElementById(this.id+'_body').style.background='#F4FFF8'"
+ <rich:panel onmouseover="document.getElementById(this.id+'_header').style.background='#60BA01';document.getElementById(this.id+'_body').style.background='#F4FFF8'"
onmouseout="document.getElementById(this.id+'_header').style.background='#4C9600';document.getElementById(this.id+'_body').style.background='#E4FFC8'"
style="width:200px;" headerClass="hea2" bodyClass="bo3">
<f:facet name="header">
16 years, 8 months
JBoss Rich Faces SVN: r8493 - in trunk/test-applications/seleniumTest/src: main/webapp/pages/inputNumberSpinner and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-05-08 08:46:32 -0400 (Thu, 08 May 2008)
New Revision: 8493
Added:
trunk/test-applications/seleniumTest/src/main/webapp/pages/inputNumberSpinner/
trunk/test-applications/seleniumTest/src/main/webapp/pages/inputNumberSpinner/inputNumberSpinnerTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java
Log:
inputNumberSpinner component test
Added: trunk/test-applications/seleniumTest/src/main/webapp/pages/inputNumberSpinner/inputNumberSpinnerTest.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/seleniumTest/src/main/webapp/pages/inputNumberSpinner/inputNumberSpinnerTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java 2008-05-08 12:46:32 UTC (rev 8493)
@@ -0,0 +1,91 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.ajax4jsf.test.base.Templates;
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+
+public class InputNumberSpinnerTest extends SeleniumTestBase {
+
+ public InputNumberSpinnerTest() {
+ super("http", "localhost", "8080");
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeTest
+ @Parameters( { "browser" })
+ public void startSelenium(String browser) {
+ super.startSelenium(browser);
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterTest
+ public void stopSelenium() {
+ super.stopSelenium();
+ }
+
+ @Test
+ public void testInputNumberSpinnerComponent() throws Exception {
+ _testInputNumberSpinnerComponent(Templates.SIMPLE);
+ //it looks as if the spinner does not work inside rich:dataTable
+ //_testInputNumberSpinnerComponent(Templates.DATATABLE);
+ }
+
+ private void _testInputNumberSpinnerComponent(Templates template) {
+ renderPage("/faces/pages/inputNumberSpinner/inputNumberSpinnerTest.xhtml", template);
+
+ writeStatus("check whether the spinner is invariant with respect to pair of sequential opposite operations");
+
+ //start value = 20
+ String before = getSpinnerValue();
+ clickUp();
+ clickDown();
+ String after = getSpinnerValue();
+ Assert.assertEquals(before, after);
+ Assert.assertEquals(after, "20");
+
+ writeStatus("check upper bound and cycling");
+
+ clickUp(); //+10
+ clickUp(); //+10
+ clickUp(); //+10
+ clickUp(); //+10
+ clickUp(); //+10
+ Assert.assertEquals(getSpinnerValue(), "10");
+
+ writeStatus("check lower bound and cycling");
+
+ clickDown(); //-10
+ Assert.assertEquals(getSpinnerValue(), "0");
+ clickDown(); //-10
+ Assert.assertEquals(getSpinnerValue(), "50");
+ clickDown(); //-10
+ Assert.assertEquals(getSpinnerValue(), "40");
+ }
+
+ private void clickUp() {
+ String id = getParentId() + "_form:" + "spinnerButtons";
+ selenium.fireEvent("dom=selenium.browserbot.getCurrentWindow().$('" + id + "').down('tbody').down('tr', 0).down('td').down('input')", "mousedown");
+ selenium.fireEvent("dom=selenium.browserbot.getCurrentWindow().$('" + id + "').down('tbody').down('tr', 0).down('td').down('input')", "mouseup");
+ }
+
+ private void clickDown() {
+ String id = getParentId() + "_form:" + "spinnerButtons";
+ selenium.fireEvent("dom=selenium.browserbot.getCurrentWindow().$('" + id + "').down('tbody').down('tr', 1).down('td').down('input')", "mousedown");
+ selenium.fireEvent("dom=selenium.browserbot.getCurrentWindow().$('" + id + "').down('tbody').down('tr', 1).down('td').down('input')", "mouseup");
+ }
+
+ private String getSpinnerValue() {
+ String id = getParentId() + "_form:" + "spinnerEdit";
+ return runScript("$('" + id + "').down('input').value");
+ }
+
+}
Property changes on: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
16 years, 8 months
JBoss Rich Faces SVN: r8492 - trunk/ui/modal-panel/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-05-08 06:26:14 -0400 (Thu, 08 May 2008)
New Revision: 8492
Modified:
trunk/ui/modal-panel/src/main/config/component/modalPanel.xml
Log:
http://jira.jboss.com/jira/browse/RF-3294
Fixed. The correct info was added to the guide.
Modified: trunk/ui/modal-panel/src/main/config/component/modalPanel.xml
===================================================================
--- trunk/ui/modal-panel/src/main/config/component/modalPanel.xml 2008-05-08 10:10:54 UTC (rev 8491)
+++ trunk/ui/modal-panel/src/main/config/component/modalPanel.xml 2008-05-08 10:26:14 UTC (rev 8492)
@@ -49,26 +49,26 @@
<property>
<name>width</name>
<classname>int</classname>
- <description> Attribute defines width of component. Default value is "-1". </description>
- <defaultvalue>-1</defaultvalue>
+ <description> Attribute defines width of component. Default value is "300". </description>
+ <defaultvalue>300</defaultvalue>
</property>
<property>
<name>height</name>
<classname>int</classname>
- <description>Attribute defines height of component. Default value is "-1". </description>
- <defaultvalue>-1</defaultvalue>
+ <description>Attribute defines height of component. Default value is "200". </description>
+ <defaultvalue>200</defaultvalue>
</property>
<property>
<name>minWidth</name>
<classname>int</classname>
- <description> Attribute defines min width of component. Default value is "-1". </description>
- <defaultvalue>-1</defaultvalue>
+ <description> Attribute defines min width of component. Default value is "10". If the value is less then 10, a "IllegalArgumentException" exception is thrown.</description>
+ <defaultvalue>10</defaultvalue>
</property>
<property>
<name>minHeight</name>
<classname>int</classname>
- <description> Attribute defines min height of component. Default value is "-1". </description>
- <defaultvalue>-1</defaultvalue>
+ <description> Attribute defines min height of component. Default value is "10". If the value is less then 10, a "IllegalArgumentException" exception is thrown. </description>
+ <defaultvalue>10</defaultvalue>
</property>
<property>
<name>left</name>
16 years, 8 months
JBoss Rich Faces SVN: r8491 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-05-08 06:10:54 -0400 (Thu, 08 May 2008)
New Revision: 8491
Modified:
trunk/docs/userguide/en/src/main/docbook/included/scrollableDataTable.xml
Log:
http://jira.jboss.com/jira/browse/RF-2329
Some errors were corrected.
Modified: trunk/docs/userguide/en/src/main/docbook/included/scrollableDataTable.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/scrollableDataTable.xml 2008-05-08 10:10:00 UTC (rev 8490)
+++ trunk/docs/userguide/en/src/main/docbook/included/scrollableDataTable.xml 2008-05-08 10:10:54 UTC (rev 8491)
@@ -131,8 +131,8 @@
<para>This attribute is a reference to object to the instace of
<property>org.richfaces.model.selection.Selection</property> interface, containing current
collection of objects selected by you.</para>
- <para>In the following example when you submits the form current collection of objects selected
- by you is placed in the object's property. Then on complete action the <emphasis role="bold">
+ <para>In the following example when you submit the form, current collection of the selected objects
+ is placed in the object's property. Then on complete action the <emphasis role="bold">
<property><rich:modalPanel></property>
</emphasis> with selected data is shown.</para>
<para>
16 years, 8 months
JBoss Rich Faces SVN: r8490 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-05-08 06:10:00 -0400 (Thu, 08 May 2008)
New Revision: 8490
Modified:
trunk/docs/userguide/en/src/main/docbook/included/inplaceSelect.xml
Log:
http://jira.jboss.com/jira/browse/RF-3362
Info about editOnTab is deleted
Modified: trunk/docs/userguide/en/src/main/docbook/included/inplaceSelect.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/inplaceSelect.xml 2008-05-08 06:20:06 UTC (rev 8489)
+++ trunk/docs/userguide/en/src/main/docbook/included/inplaceSelect.xml 2008-05-08 10:10:00 UTC (rev 8490)
@@ -400,8 +400,7 @@
<para>
The <emphasis role="bold"><property><rich:inplaceSelect></property></emphasis> component supports standard
<emphasis><property>"tabindex"</property></emphasis> attribute.
- When the component gets focus and the <emphasis><property>"editOnTab"</property></emphasis> attribute is "true"
- the <property>edit</property> mode is activated and drop-down list is opened.
+ When the component gets focus the <property>edit</property> mode is activated and drop-down list is opened.
</para>
<para>
The
16 years, 8 months
JBoss Rich Faces SVN: r8489 - trunk/test-applications/jsp/src/main/webapp/pages/RichMenu.
by richfaces-svn-commits@lists.jboss.org
Author: ayanul
Date: 2008-05-08 02:20:06 -0400 (Thu, 08 May 2008)
New Revision: 8489
Modified:
trunk/test-applications/jsp/src/main/webapp/pages/RichMenu/RichMenu.jsp
Log:
Modified: trunk/test-applications/jsp/src/main/webapp/pages/RichMenu/RichMenu.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/pages/RichMenu/RichMenu.jsp 2008-05-08 00:29:45 UTC (rev 8488)
+++ trunk/test-applications/jsp/src/main/webapp/pages/RichMenu/RichMenu.jsp 2008-05-08 06:20:06 UTC (rev 8489)
@@ -4,12 +4,8 @@
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="richMenuSubviewID">
- <h:panelGrid columns="6" border="1">
+ <h:panelGrid columns="5" border="1">
<h:panelGrid columns="2">
- <h:outputText value="a4j:log"></h:outputText>
- <h:selectBooleanCheckbox value="#{option.log}" onchange="submit();"></h:selectBooleanCheckbox>
- </h:panelGrid>
- <h:panelGrid columns="2">
<h:outputText value="h" />
<h:outputText value="a4j" />
<h:commandButton value="submit" style="width : 85px; height : 21px;"></h:commandButton>
@@ -17,7 +13,10 @@
<h:commandButton value="immediate" immediate="true" style="width : 85px; height : 21px;"></h:commandButton>
<a4j:commandButton value="immediate" immediate="true" reRender="richGridID" style="width : 85px; height : 21px;"></a4j:commandButton>
</h:panelGrid>
- <h:panelGrid columns="1">
+ <h:panelGrid columns="2">
+ <h:outputLabel for="a4jLodID" value="a4j:log"></h:outputLabel>
+ <h:selectBooleanCheckbox id="a4jLodID" value="#{option.log}" onchange="submit();"></h:selectBooleanCheckbox>
+
<a4j:status id="a4jStatusID" startText="WORK!" startStyle="color: red;" stopText="a4j:status"></a4j:status>
</h:panelGrid>
<h:panelGrid columns="1">
16 years, 8 months
JBoss Rich Faces SVN: r8488 - in trunk: framework/impl/src/main/java/org/ajax4jsf/webapp and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-05-07 20:29:45 -0400 (Wed, 07 May 2008)
New Revision: 8488
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java
trunk/ui/assembly/pom.xml
Log:
Start progress on http://jira.jboss.com/jira/browse/RF-3344
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2008-05-07 23:01:54 UTC (rev 8487)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2008-05-08 00:29:45 UTC (rev 8488)
@@ -404,7 +404,7 @@
contentLength);
}
long expired = getExpired(context);
- if (expired == Long.MIN_VALUE ) {
+ if (expired < 0 ) {
expired = DEFAULT_EXPIRE;
}
context.setDateHeader("Expires", System.currentTimeMillis()
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java 2008-05-07 23:01:54 UTC (rev 8487)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java 2008-05-08 00:29:45 UTC (rev 8488)
@@ -108,7 +108,18 @@
* @param response
*/
public void sendHeaders(HttpServletResponse response) {
- for (Iterator<Entry<String, Object>> iter = headers.entrySet().iterator(); iter.hasNext();) {
+ // set real content-length.
+ // / if (null != content) {
+ int realContentLength = 0;
+ if (filledOutputStream) {
+ if (null != content && content.length > 0) {
+ realContentLength = content.length;
+ } else if (null != outputStream && outputStream.getLength() > 0) {
+ realContentLength = outputStream.getLength();
+ }
+ } // TODO - calculate content-lenght for writer ?
+ for (Iterator<Entry<String, Object>> iter = headers.entrySet()
+ .iterator(); iter.hasNext();) {
Entry<String, Object> element = iter.next();
String header = (String) element.getKey();
Object headerValue = element.getValue();
@@ -118,25 +129,27 @@
response.setDateHeader(header, time.longValue());
} else if (headerValue instanceof Integer) {
Integer value = (Integer) headerValue;
- response.setIntHeader(header, value.intValue());
+ // Check real content length.
+ if ( !(realContentLength > 0
+ && "Content-Length".equals(header))) {
+ response.setIntHeader(header, value.intValue());
+ }
} else {
- response.setHeader(header, (String) headerValue);
+ // Don't send "chunked" transfer-encoding type with real content-length
+ if (!(realContentLength > 0
+ && "Transfer-Encoding".equals(header) && "chunked"
+ .equals(headerValue))) {
+ response.setHeader(header, (String) headerValue);
+ }
}
} catch (Exception e) {
_log.error("Error set response header " + header + "for value "
+ headerValue, e);
}
- // set real content-length.
- // / if (null != content) {
- if (filledOutputStream) {
- if (null != content && content.length > 0) {
- response.setIntHeader("Content-Length", content.length);
- } else if (null != outputStream && outputStream.getLength() > 0) {
- response.setIntHeader("Content-Length", outputStream
- .getLength());
- }
- } // TODO - calculate content-lenght for writer ?
+ if(realContentLength > 0){
+ response.setIntHeader("Content-Length", realContentLength);
+ }
if (null != contentType) {
response.setContentType(this.contentType);
}
Modified: trunk/ui/assembly/pom.xml
===================================================================
--- trunk/ui/assembly/pom.xml 2008-05-07 23:01:54 UTC (rev 8487)
+++ trunk/ui/assembly/pom.xml 2008-05-08 00:29:45 UTC (rev 8488)
@@ -21,6 +21,7 @@
<description>RichFaces components</description>
<taglibs>
<taglib>
+ <tlibVersion>3.2.1</tlibVersion>
<shortName>richfaces</shortName>
<taglib>richfaces</taglib>
<uri>
@@ -32,6 +33,7 @@
<excludeModules>core</excludeModules>
</taglib>
<taglib>
+ <tlibVersion>3.2.1</tlibVersion>
<shortName>rich</shortName>
<taglib>rich</taglib>
<uri>http://richfaces.org/rich</uri>
@@ -39,6 +41,7 @@
<excludeModules>core</excludeModules>
</taglib>
<taglib>
+ <tlibVersion>3.2.1</tlibVersion>
<shortName>a4j</shortName>
<taglib>ajax4jsf</taglib>
<uri>http://richfaces.org/a4j</uri>
@@ -46,6 +49,7 @@
<includeModules>core</includeModules>
</taglib>
<taglib>
+ <tlibVersion>3.2.1</tlibVersion>
<shortName>ajax</shortName>
<taglib>a4j</taglib>
<uri>
16 years, 8 months
JBoss Rich Faces SVN: r8487 - trunk/samples.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-05-07 19:01:54 -0400 (Wed, 07 May 2008)
New Revision: 8487
Modified:
trunk/samples/pom.xml
Log:
Added proper compiler level for MyFaces profile
Modified: trunk/samples/pom.xml
===================================================================
--- trunk/samples/pom.xml 2008-05-07 19:13:40 UTC (rev 8486)
+++ trunk/samples/pom.xml 2008-05-07 23:01:54 UTC (rev 8487)
@@ -364,7 +364,17 @@
<tomahawk>1.1.6</tomahawk>
</properties>
<build>
- <plugins />
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
<dependencies>
<dependency>
16 years, 8 months