JBoss Rich Faces SVN: r14765 - branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-01 15:09:20 -0400 (Wed, 01 Jul 2009)
New Revision: 14765
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/TestResource2.java
Log:
Resources: refactoring
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/TestResource2.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/TestResource2.java 2009-07-01 14:47:30 UTC (rev 14764)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/TestResource2.java 2009-07-01 19:09:20 UTC (rev 14765)
@@ -16,7 +16,6 @@
import javax.faces.context.FacesContext;
import javax.imageio.ImageIO;
-import org.ajax4jsf.resource.ResourceImpl;
import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.Zipper2;
import org.richfaces.skin.Skin;
15 years, 6 months
JBoss Rich Faces SVN: r14764 - in branches/community/3.3.X/samples/richfaces-demo: src/main/java/org/richfaces/demo/modifiableModel and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-01 10:47:30 -0400 (Wed, 01 Jul 2009)
New Revision: 14764
Added:
branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/BaseModifiableHibernateDataModel.java
Modified:
branches/community/3.3.X/samples/richfaces-demo/pom.xml
branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/HibernateBean.java
branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/HibernateDataModel.java
branches/community/3.3.X/samples/richfaces-demo/src/main/resources/JIRA.csv
branches/community/3.3.X/samples/richfaces-demo/src/main/resources/hibernate.cfg.xml
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/WEB-INF/components.xml
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/examples/modifiableModel.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-7061
Modified: branches/community/3.3.X/samples/richfaces-demo/pom.xml
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/pom.xml 2009-07-01 13:48:53 UTC (rev 14763)
+++ branches/community/3.3.X/samples/richfaces-demo/pom.xml 2009-07-01 14:47:30 UTC (rev 14764)
@@ -390,6 +390,11 @@
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.3.0.ga</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.6.ga</version>
Added: branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/BaseModifiableHibernateDataModel.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/BaseModifiableHibernateDataModel.java (rev 0)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/BaseModifiableHibernateDataModel.java 2009-07-01 14:47:30 UTC (rev 14764)
@@ -0,0 +1,187 @@
+package org.richfaces.demo.modifiableModel;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.el.ELException;
+import javax.el.Expression;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+import org.ajax4jsf.model.SequenceRange;
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.criterion.MatchMode;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+import org.richfaces.model.ExtendedFilterField;
+import org.richfaces.model.FilterField;
+import org.richfaces.model.Modifiable;
+import org.richfaces.model.Ordering;
+import org.richfaces.model.SortField2;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.2
+ */
+public abstract class BaseModifiableHibernateDataModel<T> extends ExtendedDataModel implements Modifiable {
+
+ private Class<T> entityClass;
+
+ public BaseModifiableHibernateDataModel(Class<T> entityClass) {
+ super();
+ this.entityClass = entityClass;
+ }
+
+ private T dataItem;
+
+ private SequenceRange cachedRange;
+
+ private List<T> cachedItems;
+
+ private List<FilterField> filterFields;
+
+ private List<SortField2> sortFields;
+
+ private static boolean areEqualRanges(SequenceRange range1, SequenceRange range2) {
+ if (range1 == null || range2 == null) {
+ return range1 == null && range2 == null;
+ } else {
+ return range1.getFirstRow() == range2.getFirstRow() && range1.getRows() == range2.getRows();
+ }
+ }
+
+ private Criteria createCriteria() {
+ return getSession().createCriteria(entityClass);
+ }
+
+ private void appendFilters(FacesContext context, Criteria criteria) {
+ if (filterFields != null) {
+ for (FilterField filterField : filterFields) {
+ String propertyName = getPropertyName(context, filterField.getExpression());
+
+ String filterValue = ((ExtendedFilterField) filterField).getFilterValue();
+ if (filterValue != null && filterValue.length() != 0) {
+ criteria.add(Restrictions.like(propertyName,
+ filterValue,
+ MatchMode.ANYWHERE).ignoreCase());
+ }
+ }
+ }
+ }
+
+ private void appendSorts(FacesContext context, Criteria criteria) {
+ if (sortFields != null) {
+ for (SortField2 sortField : sortFields) {
+ Ordering ordering = sortField.getOrdering();
+
+ if (Ordering.ASCENDING.equals(ordering) || Ordering.DESCENDING.equals(ordering)) {
+ String propertyName = getPropertyName(context, sortField.getExpression());
+
+ Order order = Ordering.ASCENDING.equals(ordering) ?
+ Order.asc(propertyName) : Order.desc(propertyName);
+
+ criteria.addOrder(order.ignoreCase());
+ }
+ }
+ }
+ }
+
+ private String getPropertyName(FacesContext facesContext, Expression expression) {
+ try {
+ return (String) ((ValueExpression) expression).getValue(facesContext.getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public Object getRowKey() {
+ return dataItem;
+ }
+
+ @Override
+ public void setRowKey(Object key) {
+ this.dataItem = entityClass.cast(key);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void walk(FacesContext facesContext, DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+
+ SequenceRange sequenceRange = (SequenceRange) range;
+
+ if (this.cachedItems == null || !areEqualRanges(this.cachedRange, sequenceRange)) {
+ Criteria criteria = createCriteria();
+ appendFilters(facesContext, criteria);
+ appendSorts(facesContext, criteria);
+
+ if (sequenceRange != null) {
+ int first = sequenceRange.getFirstRow();
+ int rows = sequenceRange.getRows();
+
+ criteria.setFirstResult(first);
+ if (rows > 0) {
+ criteria.setMaxResults(rows);
+ }
+ }
+
+ this.cachedRange = sequenceRange;
+ this.cachedItems = criteria.list();
+ }
+
+ for (T item: this.cachedItems) {
+ visitor.process(facesContext, item, argument);
+ }
+ }
+
+ @Override
+ public int getRowCount() {
+ Criteria criteria = createCriteria();
+ appendFilters(FacesContext.getCurrentInstance(), criteria);
+ return (Integer) criteria.list().size();
+ }
+
+ @Override
+ public Object getRowData() {
+ return this.dataItem;
+ }
+
+ @Override
+ public int getRowIndex() {
+ return -1;
+ }
+
+ @Override
+ public Object getWrappedData() {
+ return null;
+ }
+
+ @Override
+ public boolean isRowAvailable() {
+ return (this.dataItem != null);
+ }
+
+ @Override
+ public void setRowIndex(int rowIndex) {
+ }
+
+ @Override
+ public void setWrappedData(Object data) {
+ }
+
+ public void modify(List<FilterField> filterFields, List<SortField2> sortFields) {
+ this.filterFields = filterFields;
+ this.sortFields = sortFields;
+
+ this.cachedItems = null;
+ this.cachedRange = null;
+ }
+
+ protected abstract Session getSession();
+}
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/HibernateBean.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/HibernateBean.java 2009-07-01 13:48:53 UTC (rev 14763)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/HibernateBean.java 2009-07-01 14:47:30 UTC (rev 14764)
@@ -8,27 +8,36 @@
import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
import javax.faces.FacesException;
-import org.hibernate.SessionFactory;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.classic.Session;
-import org.richfaces.model.SortOrder;
+import org.hibernate.Session;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Startup;
+import org.jboss.seam.log.Log;
/**
- * @author mikalaj
- *
+ * @author Nick Belaevski
+ * @since 3.3.1
*/
+(a)Scope(ScopeType.APPLICATION)
+@Startup
+@Name("hibernateBean")
public class HibernateBean {
- private SessionFactory factory;
+ @Logger
+ private Log log;
+ @In
+ private Session hibernateSession;
+
private static final String[] CSV_FIELDS = {
- "issueType", "key", "summary",
- "assignee", "fixVersion", "reporter", "priority", "status",
+ "key", "summary", "assignee", "fixVersion", "reporter", "priority", "status",
"resolution", "created", "updated"
};
@@ -55,14 +64,8 @@
}
}
- public HibernateBean() {
- Configuration configuration = new Configuration();
- configuration.addResource("dataItem.hbm.xml");
- configuration.configure();
-
- factory = configuration.buildSessionFactory();
- Session session = factory.openSession();
-
+ @Create
+ public void fillDatabase() {
BufferedReader reader = null;
try {
reader = new BufferedReader(
@@ -78,40 +81,29 @@
try {
CSV_FIELDS_SETTERS[i].invoke(dataItem, split[i]);
} catch (IllegalArgumentException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ log.error(e.getMessage(), e);
} catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ log.error(e.getMessage(), e);
} catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ log.error(e.getMessage(), e);
}
}
- session.persist(dataItem);
+ hibernateSession.persist(dataItem);
}
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ log.error(e.getMessage(), e);
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ log.error(e.getMessage(), e);
}
}
-
- session.flush();
- session.close();
+ hibernateSession.flush();
}
-
- public SessionFactory getSessionFactory() {
- return factory;
- }
-
+
}
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/HibernateDataModel.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/HibernateDataModel.java 2009-07-01 13:48:53 UTC (rev 14763)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/modifiableModel/HibernateDataModel.java 2009-07-01 14:47:30 UTC (rev 14764)
@@ -1,234 +1,30 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
package org.richfaces.demo.modifiableModel;
-import java.io.IOException;
-import java.util.List;
-import javax.annotation.PreDestroy;
-import javax.el.ELException;
-import javax.el.Expression;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.Range;
-import org.ajax4jsf.model.SequenceRange;
-import org.hibernate.Criteria;
import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.criterion.MatchMode;
-import org.hibernate.criterion.Order;
-import org.hibernate.criterion.Restrictions;
-import org.richfaces.model.ExtendedFilterField;
-import org.richfaces.model.FilterField;
-import org.richfaces.model.Modifiable;
-import org.richfaces.model.Ordering;
-import org.richfaces.model.SortField2;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
/**
* @author Nick Belaevski
- * @since 3.3.1
+ * @since 3.3.2
*/
-public class HibernateDataModel extends ExtendedDataModel implements Modifiable {
+(a)Scope(ScopeType.STATELESS)
+@Name("hibernateDataModel")
+public class HibernateDataModel extends BaseModifiableHibernateDataModel<DataItem> {
- private SessionFactory sessionFactory;
-
- public void setSessionFactory(SessionFactory sessionFactory) {
- this.sessionFactory = sessionFactory;
- }
+ @In
+ private Session hibernateSession;
- private Session session;
-
- protected Session getSession() {
- if (session == null) {
- session = sessionFactory.openSession();
- }
-
- return session;
+ public HibernateDataModel() {
+ super(DataItem.class);
}
-
- @PreDestroy
- public void destroy() {
- if (session != null) {
- session.close();
- }
- }
-
- private Long rowKey;
-
- private DataItem dataItem;
-
- private SequenceRange cachedRange;
-
- private List<DataItem> cachedItems;
- private List<FilterField> filterFields;
-
- private List<SortField2> sortFields;
-
- private static boolean areEqualRanges(SequenceRange range1, SequenceRange range2) {
- if (range1 == null || range2 == null) {
- return range1 == null && range2 == null;
- } else {
- return range1.getFirstRow() == range2.getFirstRow() && range1.getRows() == range2.getRows();
- }
- }
-
- private Criteria createCriteria() {
- return getSession().createCriteria(DataItem.class);
- }
-
- private void appendFilters(FacesContext context, Criteria criteria) {
- if (filterFields != null) {
- for (FilterField filterField : filterFields) {
- String propertyName = getPropertyName(context, filterField.getExpression());
-
- String filterValue = ((ExtendedFilterField) filterField).getFilterValue();
- if (filterValue != null && filterValue.length() != 0) {
- criteria.add(Restrictions.like(propertyName,
- filterValue,
- MatchMode.ANYWHERE).ignoreCase());
- }
- }
- }
- }
-
- private void appendSorts(FacesContext context, Criteria criteria) {
- if (sortFields != null) {
- for (SortField2 sortField : sortFields) {
- Ordering ordering = sortField.getOrdering();
-
- if (Ordering.ASCENDING.equals(ordering) || Ordering.DESCENDING.equals(ordering)) {
- String propertyName = getPropertyName(context, sortField.getExpression());
-
- Order order = Ordering.ASCENDING.equals(ordering) ?
- Order.asc(propertyName) : Order.desc(propertyName);
-
- criteria.addOrder(order.ignoreCase());
- }
- }
- }
- }
-
- private String getPropertyName(FacesContext facesContext, Expression expression) {
- try {
- return (String) ((ValueExpression) expression).getValue(facesContext.getELContext());
- } catch (ELException e) {
- throw new FacesException(e.getMessage(), e);
- }
- }
-
@Override
- public Object getRowKey() {
- return rowKey;
+ protected Session getSession() {
+ return hibernateSession;
}
- @Override
- public void setRowKey(Object key) {
- this.rowKey = (Long) key;
- this.dataItem = null;
-
- if (this.rowKey != null) {
- this.dataItem = (DataItem) session.load(DataItem.class, this.rowKey);
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void walk(FacesContext facesContext, DataVisitor visitor, Range range,
- Object argument) throws IOException {
-
- SequenceRange sequenceRange = (SequenceRange) range;
-
- if (this.cachedItems == null || !areEqualRanges(this.cachedRange, sequenceRange)) {
- Criteria criteria = createCriteria();
- appendFilters(facesContext, criteria);
- appendSorts(facesContext, criteria);
-
- if (sequenceRange != null) {
- int first = sequenceRange.getFirstRow();
- int rows = sequenceRange.getRows();
-
- criteria.setFirstResult(first);
- if (rows > 0) {
- criteria.setMaxResults(rows);
- }
- }
-
- this.cachedRange = sequenceRange;
- this.cachedItems = criteria.list();
- }
-
- //System.out.println(getRowCount());
-
- for (DataItem item: cachedItems) {
- visitor.process(facesContext, item.getId(), argument);
- }
- }
-
- @Override
- public int getRowCount() {
- Criteria criteria = createCriteria();
- appendFilters(FacesContext.getCurrentInstance(), criteria);
- return (Integer) criteria.list().size();
- }
-
- @Override
- public Object getRowData() {
- return this.dataItem;
- }
-
- @Override
- public int getRowIndex() {
- return -1;
- }
-
- @Override
- public Object getWrappedData() {
- return null;
- }
-
- @Override
- public boolean isRowAvailable() {
- return (this.dataItem != null);
- }
-
- @Override
- public void setRowIndex(int rowIndex) {
- }
-
- @Override
- public void setWrappedData(Object data) {
- }
-
- public void modify(List<FilterField> filterFields, List<SortField2> sortFields) {
- this.filterFields = filterFields;
- this.sortFields = sortFields;
-
- this.cachedItems = null;
- this.cachedRange = null;
- }
-
}
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/resources/JIRA.csv
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/resources/JIRA.csv 2009-07-01 13:48:53 UTC (rev 14763)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/resources/JIRA.csv 2009-07-01 14:47:30 UTC (rev 14764)
@@ -1,25 +1,25 @@
-Bug;RF-6338;PanelMenu does not work in 3.3.1.SNAPSHOT;Alex Kolonitsky;03.03.2001;Alexander Dubovsky;Critical;Open;UNRESOLVED;23/Feb/09 06:17 AM;24/Feb/09 11:59 AM;;;;;1
-Bug;RF-3686;listShuttle and s:entityConverter;Alex Kolonitsky;03.03.2001;Marcell Barbacena;Major;Open;UNRESOLVED;11/Jun/08 05:51 PM;17/Feb/09 10:06 AM;;;;;0
-Bug;RF-6278;ScriptUtils: toScript() fails with java.sql.* types;Alex Kolonitsky;03.03.2001;Nick Belaevski;Major;Open;UNRESOLVED;20/Feb/09 06:47 PM;24/Feb/09 12:07 PM;;;;;0
-Bug;RF-5671;Panel Menu. selectedChild problems;Alex Kolonitsky;03.03.2001;Ilya Shaikovsky;Major;Open;UNRESOLVED;13/Jan/09 05:26 AM;24/Feb/09 08:43 PM;;;;;0
-Bug;RF-6155;Column: rendered attribute handled wrong;Alexander Smirnov;03.03.2001;Nick Belaevski;Major;Open;UNRESOLVED;13/Feb/09 10:36 AM;13/Feb/09 10:36 AM;;;;;1
-Bug;RF-6040;Columns: component does not work without value attribute defined;Andrei Markavtsov;03.03.2001;Andrei Markavtsov;Critical;Open;UNRESOLVED;06/Feb/09 04:57 AM;06/Feb/09 09:28 AM;;;;;0
-Bug;RF-6031;columns: allow to use few columns and to use columns together with static column components within the one table .;Andrei Markavtsov;03.03.2001;Ilya Shaikovsky;Major;Open;UNRESOLVED;04/Feb/09 09:05 AM;05/Feb/09 08:40 AM;;;;;0
-Bug;RF-5960;FileUpload sends id parameter to server on each upload.;Andrei Markavtsov;03.03.2001;Andrei Markavtsov;Major;Open;UNRESOLVED;29/Jan/09 05:57 AM;11/Feb/09 10:58 AM;;;;;1
-Bug;RF-6266;FileUpload: AJAX polling problems;Andrei Markavtsov;03.03.2001;Nick Belaevski;Major;Open;UNRESOLVED;19/Feb/09 12:16 PM;24/Feb/09 11:56 AM;;;;;0
-Bug;RF-6143;inplaceSelect: is not expanded in FF;Anton Belevich;03.03.2001;Tsikhon Kuprevich;Critical;Open;UNRESOLVED;11/Feb/09 09:29 AM;12/Feb/09 06:58 AM;;;;;0
-Bug;RF-5735;InplaceInput: input is possible after pressing green (OK) control icon under FF2-3, Safari;Anton Belevich;03.03.2001;Alexander Dubovsky;Major;Open;UNRESOLVED;14/Jan/09 08:05 AM;15/Jan/09 05:20 AM;;;;;0
-Bug;RF-5717;editor: special characters escapement problem;Anton Belevich;03.03.2001;Ilya Shaikovsky;Major;Reopened;UNRESOLVED;13/Jan/09 10:15 AM;15/Jan/09 11:34 AM;;;;;1
-Bug;RF-5790;Editor: converter error if use nesting formatting.;Anton Belevich;03.03.2001;Alexander Dubovsky;Major;Open;UNRESOLVED;19/Jan/09 08:34 AM;20/Jan/09 10:42 AM;;;;;1
-Bug;RF-5825;Editor: convertion failed in case past formatted text in editor.;Anton Belevich;03.03.2001;Alexander Dubovsky;Major;Open;UNRESOLVED;19/Jan/09 09:20 AM;20/Jan/09 11:36 AM;;;;;0
-Bug;RF-5209;Calendar: currentDateChangeListener does not trigger;Anton Belevich;03.03.2001;Andrei Markavtsov;Major;Reopened;UNRESOLVED;03/Dec/08 10:02 AM;10/Feb/09 06:04 AM;;;14400;14400;0
-Bug;RF-5265;Calendar does not switch the current month/year properlly if 'preLoadDateRangeStart' & 'preLoadDateRangeEnd' attributes defined in ajax mode;Anton Belevich;03.03.2001;Andrei Markavtsov;Major;Open;UNRESOLVED;05/Dec/08 12:01 PM;10/Feb/09 06:05 AM;;;;;0
-Bug;RF-6141;ComboBox: Style, styleClass and events attributes wasn't encoded on highest-level html-element of this component..;Anton Belevich;03.03.2001;Konstantin Mishin;Major;Open;UNRESOLVED;11/Feb/09 08:45 AM;11/Feb/09 06:55 PM;;;;;0
-Bug;RF-6142;inplaceSelect: symbols are encoded in output;Anton Belevich;03.03.2001;Tsikhon Kuprevich;Major;Open;UNRESOLVED;11/Feb/09 09:22 AM;11/Feb/09 06:55 PM;;;;;0
-Bug;RF-6000;liveDemo: dropDownMenu bottom example. The 'class' attribute is incorrect for the tag h:panelGrid;Ilya Shaikovsky;03.03.2001;Tsikhon Kuprevich;Major;Open;UNRESOLVED;02/Feb/09 04:52 AM;05/Feb/09 03:05 PM;;;;;0
-Bug;RF-5999;liveDemo: dropDownMenu: remove 'border' attribute from the spacer tag in the top code example;Ilya Shaikovsky;03.03.2001;Tsikhon Kuprevich;Major;Open;UNRESOLVED;02/Feb/09 04:43 AM;05/Feb/09 03:05 PM;;;;;0
-Bug;RF-6018;panelMenu: Attribute iconCollapsedTopPosition invalid for tag panelMenu (demo);Ilya Shaikovsky;03.03.2001;Inna Shchibrya;Major;Open;UNRESOLVED;03/Feb/09 10:16 AM;05/Feb/09 03:05 PM;;;;;0
-Bug;RF-5780;DataScroller: incorrect page name in richfaces-demo;Ilya Shaikovsky;03.03.2001;Alexander Dubovsky;Minor;Open;UNRESOLVED;19/Jan/09 08:04 AM;05/Feb/09 06:22 PM;;;;;0
-Bug;RF-6263;Demo: There is rich:dataList insted of rich:dataOrderedList on dataOrderedList page.;Ilya Shaikovsky;03.03.2001;Konstantin Mishin;Minor;Open;UNRESOLVED;19/Feb/09 09:17 AM;24/Feb/09 11:53 AM;;;;;0
-Bug;RF-5764;demosite: preview state mark on extended table to be removed.;Ilya Shaikovsky;03.03.2001;Ilya Shaikovsky;Trivial;Open;UNRESOLVED;16/Jan/09 04:22 AM;16/Jan/09 04:22 AM;;;;;0
-Bug;RF-5638;DragListener/dropListener do not have 'type' attribute;Nick Belaevski;03.03.2001;Alexandr Levkovsky;Major;Open;UNRESOLVED;10/Jan/09 10:37 AM;09/Feb/09 06:27 PM;;;;;0
+RF-6338;PanelMenu does not work in 3.3.1.SNAPSHOT;Alex Kolonitsky;03.03.2001;Alexander Dubovsky;Critical;Open;UNRESOLVED;23/Feb/09 06:17 AM;24/Feb/09 11:59 AM;;;;;1
+RF-3686;listShuttle and s:entityConverter;Alex Kolonitsky;03.03.2001;Marcell Barbacena;Major;Open;UNRESOLVED;11/Jun/08 05:51 PM;17/Feb/09 10:06 AM;;;;;0
+RF-6278;ScriptUtils: toScript() fails with java.sql.* types;Alex Kolonitsky;03.03.2001;Nick Belaevski;Major;Open;UNRESOLVED;20/Feb/09 06:47 PM;24/Feb/09 12:07 PM;;;;;0
+RF-5671;Panel Menu. selectedChild problems;Alex Kolonitsky;03.03.2001;Ilya Shaikovsky;Major;Open;UNRESOLVED;13/Jan/09 05:26 AM;24/Feb/09 08:43 PM;;;;;0
+RF-6155;Column: rendered attribute handled wrong;Alexander Smirnov;03.03.2001;Nick Belaevski;Major;Open;UNRESOLVED;13/Feb/09 10:36 AM;13/Feb/09 10:36 AM;;;;;1
+RF-6040;Columns: component does not work without value attribute defined;Andrei Markavtsov;03.03.2001;Andrei Markavtsov;Critical;Open;UNRESOLVED;06/Feb/09 04:57 AM;06/Feb/09 09:28 AM;;;;;0
+RF-6031;columns: allow to use few columns and to use columns together with static column components within the one table .;Andrei Markavtsov;03.03.2001;Ilya Shaikovsky;Major;Open;UNRESOLVED;04/Feb/09 09:05 AM;05/Feb/09 08:40 AM;;;;;0
+RF-5960;FileUpload sends id parameter to server on each upload.;Andrei Markavtsov;03.03.2001;Andrei Markavtsov;Major;Open;UNRESOLVED;29/Jan/09 05:57 AM;11/Feb/09 10:58 AM;;;;;1
+RF-6266;FileUpload: AJAX polling problems;Andrei Markavtsov;03.03.2001;Nick Belaevski;Major;Open;UNRESOLVED;19/Feb/09 12:16 PM;24/Feb/09 11:56 AM;;;;;0
+RF-6143;inplaceSelect: is not expanded in FF;Anton Belevich;03.03.2001;Tsikhon Kuprevich;Critical;Open;UNRESOLVED;11/Feb/09 09:29 AM;12/Feb/09 06:58 AM;;;;;0
+RF-5735;InplaceInput: input is possible after pressing green (OK) control icon under FF2-3, Safari;Anton Belevich;03.03.2001;Alexander Dubovsky;Major;Open;UNRESOLVED;14/Jan/09 08:05 AM;15/Jan/09 05:20 AM;;;;;0
+RF-5717;editor: special characters escapement problem;Anton Belevich;03.03.2001;Ilya Shaikovsky;Major;Reopened;UNRESOLVED;13/Jan/09 10:15 AM;15/Jan/09 11:34 AM;;;;;1
+RF-5790;Editor: converter error if use nesting formatting.;Anton Belevich;03.03.2001;Alexander Dubovsky;Major;Open;UNRESOLVED;19/Jan/09 08:34 AM;20/Jan/09 10:42 AM;;;;;1
+RF-5825;Editor: convertion failed in case past formatted text in editor.;Anton Belevich;03.03.2001;Alexander Dubovsky;Major;Open;UNRESOLVED;19/Jan/09 09:20 AM;20/Jan/09 11:36 AM;;;;;0
+RF-5209;Calendar: currentDateChangeListener does not trigger;Anton Belevich;03.03.2001;Andrei Markavtsov;Major;Reopened;UNRESOLVED;03/Dec/08 10:02 AM;10/Feb/09 06:04 AM;;;14400;14400;0
+RF-5265;Calendar does not switch the current month/year properlly if 'preLoadDateRangeStart' & 'preLoadDateRangeEnd' attributes defined in ajax mode;Anton Belevich;03.03.2001;Andrei Markavtsov;Major;Open;UNRESOLVED;05/Dec/08 12:01 PM;10/Feb/09 06:05 AM;;;;;0
+RF-6141;ComboBox: Style, styleClass and events attributes wasn't encoded on highest-level html-element of this component..;Anton Belevich;03.03.2001;Konstantin Mishin;Major;Open;UNRESOLVED;11/Feb/09 08:45 AM;11/Feb/09 06:55 PM;;;;;0
+RF-6142;inplaceSelect: symbols are encoded in output;Anton Belevich;03.03.2001;Tsikhon Kuprevich;Major;Open;UNRESOLVED;11/Feb/09 09:22 AM;11/Feb/09 06:55 PM;;;;;0
+RF-6000;liveDemo: dropDownMenu bottom example. The 'class' attribute is incorrect for the tag h:panelGrid;Ilya Shaikovsky;03.03.2001;Tsikhon Kuprevich;Major;Open;UNRESOLVED;02/Feb/09 04:52 AM;05/Feb/09 03:05 PM;;;;;0
+RF-5999;liveDemo: dropDownMenu: remove 'border' attribute from the spacer tag in the top code example;Ilya Shaikovsky;03.03.2001;Tsikhon Kuprevich;Major;Open;UNRESOLVED;02/Feb/09 04:43 AM;05/Feb/09 03:05 PM;;;;;0
+RF-6018;panelMenu: Attribute iconCollapsedTopPosition invalid for tag panelMenu (demo);Ilya Shaikovsky;03.03.2001;Inna Shchibrya;Major;Open;UNRESOLVED;03/Feb/09 10:16 AM;05/Feb/09 03:05 PM;;;;;0
+RF-5780;DataScroller: incorrect page name in richfaces-demo;Ilya Shaikovsky;03.03.2001;Alexander Dubovsky;Minor;Open;UNRESOLVED;19/Jan/09 08:04 AM;05/Feb/09 06:22 PM;;;;;0
+RF-6263;Demo: There is rich:dataList insted of rich:dataOrderedList on dataOrderedList page.;Ilya Shaikovsky;03.03.2001;Konstantin Mishin;Minor;Open;UNRESOLVED;19/Feb/09 09:17 AM;24/Feb/09 11:53 AM;;;;;0
+RF-5764;demosite: preview state mark on extended table to be removed.;Ilya Shaikovsky;03.03.2001;Ilya Shaikovsky;Trivial;Open;UNRESOLVED;16/Jan/09 04:22 AM;16/Jan/09 04:22 AM;;;;;0
+RF-5638;DragListener/dropListener do not have 'type' attribute;Nick Belaevski;03.03.2001;Alexandr Levkovsky;Major;Open;UNRESOLVED;10/Jan/09 10:37 AM;09/Feb/09 06:27 PM;;;;;0
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/resources/hibernate.cfg.xml
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/resources/hibernate.cfg.xml 2009-07-01 13:48:53 UTC (rev 14763)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/resources/hibernate.cfg.xml 2009-07-01 14:47:30 UTC (rev 14764)
@@ -13,5 +13,7 @@
<property name="show_sql">false</property>
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="hibernate.hbm2ddl.auto">create</property>
+
+ <mapping resource="dataItem.hbm.xml" />
</session-factory>
</hibernate-configuration>
\ No newline at end of file
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/WEB-INF/components.xml 2009-07-01 13:48:53 UTC (rev 14763)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/WEB-INF/components.xml 2009-07-01 14:47:30 UTC (rev 14764)
@@ -1,16 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.com/products/seam/components"
- xmlns:core="http://jboss.com/products/seam/core"
- xmlns:persistence="http://jboss.com/products/seam/persistence"
- xmlns:drools="http://jboss.com/products/seam/drools"
- xmlns:bpm="http://jboss.com/products/seam/bpm"
- xmlns:security="http://jboss.com/products/seam/security"
- xmlns:mail="http://jboss.com/products/seam/mail"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:pdf="http://jboss.com/products/seam/pdf"
- xmlns:transaction="http://jboss.com/products/seam/transaction"
- xsi:schemaLocation=
- "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
+ xmlns:core="http://jboss.com/products/seam/core" xmlns:persistence="http://jboss.com/products/seam/persistence"
+ xmlns:drools="http://jboss.com/products/seam/drools" xmlns:bpm="http://jboss.com/products/seam/bpm"
+ xmlns:security="http://jboss.com/products/seam/security" xmlns:mail="http://jboss.com/products/seam/mail"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pdf="http://jboss.com/products/seam/pdf"
+ xmlns:transaction="http://jboss.com/products/seam/transaction"
+ xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.0.xsd
http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.0.xsd
@@ -18,12 +13,20 @@
http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
- <core:init debug="false" transaction-management-enabled="false"/>
- <transaction:no-transaction/>
- <core:manager concurrent-request-timeout="500"
- conversation-timeout="120000"
- conversation-id-parameter="cid"
- parent-conversation-id-parameter="pid"/>
-
-
+ <core:init debug="false" transaction-management-enabled="true" />
+
+ <persistence:hibernate-session-factory
+ name="hibernateSessionFactory" />
+
+ <persistence:managed-hibernate-session
+ name="hibernateSession" auto-create="true" session-factory="#{hibernateSessionFactory}" />
+
+ <transaction:hibernateTransaction session="#{hibernateSession}" />
+
+ <core:manager concurrent-request-timeout="500"
+ conversation-timeout="120000" conversation-id-parameter="cid"
+ parent-conversation-id-parameter="pid" />
+
+ <component class="org.jboss.seam.ui.HibernateEntityLoader" />
+
</components>
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2009-07-01 13:48:53 UTC (rev 14763)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2009-07-01 14:47:30 UTC (rev 14764)
@@ -11,25 +11,11 @@
<converter-class>org.richfaces.demo.orderingList.SongConverter</converter-class>
</converter>
<managed-bean>
- <managed-bean-name>hibernateBean</managed-bean-name>
- <managed-bean-class>org.richfaces.demo.modifiableModel.HibernateBean</managed-bean-class>
- <managed-bean-scope>application</managed-bean-scope>
- </managed-bean>
- <managed-bean>
<managed-bean-name>dataTableStateHolder</managed-bean-name>
<managed-bean-class>org.richfaces.demo.modifiableModel.DatatableStateHolder</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
- <managed-bean-name>hibernateDataModel</managed-bean-name>
- <managed-bean-class>org.richfaces.demo.modifiableModel.HibernateDataModel</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- <managed-property>
- <property-name>sessionFactory</property-name>
- <value>#{hibernateBean.sessionFactory}</value>
- </managed-property>
- </managed-bean>
- <managed-bean>
<managed-bean-name>tabsBean</managed-bean-name>
<managed-bean-class>org.richfaces.demo.tab.TabsBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/examples/modifiableModel.xhtml
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/examples/modifiableModel.xhtml 2009-07-01 13:48:53 UTC (rev 14763)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/dataTable/examples/modifiableModel.xhtml 2009-07-01 14:47:30 UTC (rev 14764)
@@ -13,7 +13,7 @@
<a4j:queue requestDelay="100" />
<rich:messages />
<rich:dataTable value="#{hibernateDataModel}" var="row" rows="10"
- rowKeyConverter="javax.faces.Long" reRender="datascroller" width="650"
+ rowKeyConverter="org.jboss.seam.ui.EntityConverter" reRender="datascroller" width="650"
rendered="#{componentNavigator.currentComponent.activeTab == 'modifiableDataModel'}">
<rich:columns value="#{hibernateBean.csvFields}" var="field"
sortBy="#{field}" filterBy="#{field}" filterEvent="onkeyup"
15 years, 6 months
JBoss Rich Faces SVN: r14763 - branches/community/3.3.X/test-applications/richfaces-docs.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-07-01 09:48:53 -0400 (Wed, 01 Jul 2009)
New Revision: 14763
Modified:
branches/community/3.3.X/test-applications/richfaces-docs/readme.txt
Log:
-Dwtpverion to -Dwtpversion
Modified: branches/community/3.3.X/test-applications/richfaces-docs/readme.txt
===================================================================
--- branches/community/3.3.X/test-applications/richfaces-docs/readme.txt 2009-07-01 13:39:37 UTC (rev 14762)
+++ branches/community/3.3.X/test-applications/richfaces-docs/readme.txt 2009-07-01 13:48:53 UTC (rev 14763)
@@ -1,4 +1,4 @@
This is a test application for RichFaces doc team
Running
-mvn clean install eclipse:eclipse -Dwtpverion=2.0
\ No newline at end of file
+mvn clean install eclipse:eclipse -Dwtpversion=2.0
\ No newline at end of file
15 years, 6 months
JBoss Rich Faces SVN: r14762 - in branches/community/3.3.X/test-applications/richfaces-docs/src/main: webapp/WEB-INF and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-07-01 09:39:37 -0400 (Wed, 01 Jul 2009)
New Revision: 14762
Added:
branches/community/3.3.X/test-applications/richfaces-docs/src/main/java/org/docs/richfaces/MediaBean.java
branches/community/3.3.X/test-applications/richfaces-docs/src/main/java/org/docs/richfaces/MediaData.java
branches/community/3.3.X/test-applications/richfaces-docs/src/main/java/org/docs/richfaces/Support.java
branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/a4j/media.xhtml
branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/a4j/support.xhtml
Modified:
branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/WEB-INF/faces-config.xml
branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/layout/mainMenu.xhtml
branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/stylesheet/theme.css
Log:
https://jira.jboss.org/jira/browse/RF-7340 - a4j:support is reviewed
Added: branches/community/3.3.X/test-applications/richfaces-docs/src/main/java/org/docs/richfaces/MediaBean.java
===================================================================
--- branches/community/3.3.X/test-applications/richfaces-docs/src/main/java/org/docs/richfaces/MediaBean.java (rev 0)
+++ branches/community/3.3.X/test-applications/richfaces-docs/src/main/java/org/docs/richfaces/MediaBean.java 2009-07-01 13:39:37 UTC (rev 14762)
@@ -0,0 +1,28 @@
+package org.docs.richfaces;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Random;
+import javax.imageio.ImageIO;
+
+public class MediaBean {
+ public void paint(OutputStream out, Object data) throws IOException{
+ Integer high = 9999;
+ Integer low = 1000;
+ Random generator = new Random();
+ Integer digits = generator.nextInt(high - low + 1) + low;
+ if (data instanceof MediaData) {
+ MediaData paintData = (MediaData) data;
+ BufferedImage img = new BufferedImage(paintData.getWidth(),paintData.getHeight(),BufferedImage.TYPE_INT_RGB);
+ Graphics2D graphics2D = img.createGraphics();
+ graphics2D.setBackground(paintData.getBackground());
+ graphics2D.setColor(paintData.getDrawColor());
+ graphics2D.clearRect(0,0,paintData.getWidth(),paintData.getHeight());
+ graphics2D.setFont(paintData.getFont());
+ graphics2D.drawString(digits.toString(), 20, 35);
+ ImageIO.write(img,"png",out);
+ }
+ }
+}
Added: branches/community/3.3.X/test-applications/richfaces-docs/src/main/java/org/docs/richfaces/MediaData.java
===================================================================
--- branches/community/3.3.X/test-applications/richfaces-docs/src/main/java/org/docs/richfaces/MediaData.java (rev 0)
+++ branches/community/3.3.X/test-applications/richfaces-docs/src/main/java/org/docs/richfaces/MediaData.java 2009-07-01 13:39:37 UTC (rev 14762)
@@ -0,0 +1,48 @@
+package org.docs.richfaces;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.io.Serializable;
+
+public class MediaData implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+ Integer Width=110;
+ Integer Height=50;
+ Color Background=new Color(190, 214, 248);
+ Color DrawColor=new Color(0,0,0);
+ Font font = new Font("Serif", Font.TRUETYPE_FONT, 30);
+
+ public Font getFont() {
+ return font;
+ }
+ public void setFont(Font font) {
+ this.font = font;
+ }
+ public MediaData() {
+ }
+ public Color getBackground() {
+ return Background;
+ }
+ public void setBackground(Color background) {
+ Background = background;
+ }
+ public Color getDrawColor() {
+ return DrawColor;
+ }
+ public void setDrawColor(Color drawColor) {
+ DrawColor = drawColor;
+ }
+ public Integer getHeight() {
+ return Height;
+ }
+ public void setHeight(Integer height) {
+ Height = height;
+ }
+ public Integer getWidth() {
+ return Width;
+ }
+ public void setWidth(Integer width) {
+ Width = width;
+ }
+}
Added: branches/community/3.3.X/test-applications/richfaces-docs/src/main/java/org/docs/richfaces/Support.java
===================================================================
--- branches/community/3.3.X/test-applications/richfaces-docs/src/main/java/org/docs/richfaces/Support.java (rev 0)
+++ branches/community/3.3.X/test-applications/richfaces-docs/src/main/java/org/docs/richfaces/Support.java 2009-07-01 13:39:37 UTC (rev 14762)
@@ -0,0 +1,23 @@
+package org.docs.richfaces;
+
+import java.io.File;
+
+public class Support {
+ String text = new String();
+ String items = new String();
+ public String getItems() {
+ return items;
+ }
+
+ public void setItems(String items) {
+ this.items = items;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+}
Modified: branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/WEB-INF/faces-config.xml 2009-07-01 13:23:23 UTC (rev 14761)
+++ branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/WEB-INF/faces-config.xml 2009-07-01 13:39:37 UTC (rev 14762)
@@ -43,6 +43,21 @@
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>support</managed-bean-name>
+ <managed-bean-class>org.docs.richfaces.Support</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>media</managed-bean-name>
+ <managed-bean-class>org.docs.richfaces.MediaBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>mediaData</managed-bean-name>
+ <managed-bean-class>org.docs.richfaces.MediaData</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>skin</managed-bean-name>
<managed-bean-class>org.docs.richfaces.util.Skin</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
Added: branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/a4j/media.xhtml
===================================================================
--- branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/a4j/media.xhtml (rev 0)
+++ branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/a4j/media.xhtml 2009-07-01 13:39:37 UTC (rev 14762)
@@ -0,0 +1,19 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich"
+ template="../layout/template.xhtml"
+ xmlns:a4j="http://richfaces.org/a4j">
+
+ <ui:define name="body">
+ <rich:panel>
+ <a4j:mediaOutput element="img" cacheable="false" session="true"
+ createContent="#{media.paint}" value="#{mediaData}"
+ mimeType="image/jpeg" />
+ </rich:panel>
+ </ui:define>
+</ui:composition>
Added: branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/a4j/support.xhtml
===================================================================
--- branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/a4j/support.xhtml (rev 0)
+++ branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/a4j/support.xhtml 2009-07-01 13:39:37 UTC (rev 14762)
@@ -0,0 +1,41 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich"
+ template="../layout/template.xhtml"
+ xmlns:a4j="http://richfaces.org/a4j">
+ <ui:define name="body">
+ <rich:panel>
+ <f:facet name="header">a4j:support - common usage</f:facet>
+ <h:outputText value="Simple Repeater" />
+ <h:form prependId="false">
+ <h:inputText value="#{support.text}" required="true">
+ <a4j:support event="onkeyup" reRender="repeater" />
+ </h:inputText>
+ <br />
+ <h:outputText id="repeater" value="#{support.text}" />
+ </h:form>
+ </rich:panel>
+
+ <rich:panel>
+ <f:facet name="header">a4j:support - "onsubmit" and "oncomplete" attributes</f:facet>
+ <h:form>
+ <h:outputText value="Select the item you want to store:" />
+ <h:selectOneMenu value="#{support.items}">
+ <f:selectItem itemValue="First Item" itemLabel="First Item" />
+ <f:selectItem itemValue=" Second Item" itemLabel="Second Item" />
+ <f:selectItem itemValue=" Third Item" itemLabel="Third Item" />
+ <a4j:support event="onblur" reRender="itemsStored"
+ onsubmit="if(!confirm('Are you sure to change the option ?')) {form.reset(); return false;}"
+ oncomplete="alert('Value succesfully stored')" />
+ </h:selectOneMenu>
+ <br />
+ <h:outputText id="itemsStored" value="Stored item: #{support.items}" />
+ </h:form>
+ </rich:panel>
+ </ui:define>
+</ui:composition>
Modified: branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/layout/mainMenu.xhtml
===================================================================
--- branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/layout/mainMenu.xhtml 2009-07-01 13:23:23 UTC (rev 14761)
+++ branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/layout/mainMenu.xhtml 2009-07-01 13:39:37 UTC (rev 14762)
@@ -79,11 +79,18 @@
<rich:panelMenuGroup label="A4J Components" id="group2" value="#{menuState.menu['group2']}">
<rich:panelMenuItem actionListener="#{menuBean.select}" mode="server">
-<h:outputLink value="#{facesContext.externalContext.requestContextPath}/a4j/queue.xhtml" >a4j:queue</h:outputLink>
+ <h:outputLink value="#{facesContext.externalContext.requestContextPath}/a4j/queue.xhtml" >a4j:queue</h:outputLink>
</rich:panelMenuItem>
+<rich:panelMenuItem actionListener="#{menuBean.select}" mode="server">
+ <h:outputLink value="#{facesContext.externalContext.requestContextPath}/a4j/support.xhtml" >a4j:support</h:outputLink>
+</rich:panelMenuItem>
+<rich:panelMenuItem actionListener="#{menuBean.select}" mode="server">
+ <h:outputLink value="#{facesContext.externalContext.requestContextPath}/a4j/media.xhtml" >a4j:mediaOutput</h:outputLink>
+</rich:panelMenuItem>
+
</rich:panelMenuGroup>
<rich:panelMenuGroup label="Framework" id="group3" value="#{menuState.menu['group3']}">
Modified: branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/stylesheet/theme.css
===================================================================
--- branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/stylesheet/theme.css 2009-07-01 13:23:23 UTC (rev 14761)
+++ branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/stylesheet/theme.css 2009-07-01 13:39:37 UTC (rev 14762)
@@ -151,3 +151,7 @@
.rich-page-sidebar{float:left;width:23.076923em;*width:22.500563em;}
.rich-page-body{margin-left:24.076923em;*marginleft:23.475563em;}
.rich-page-body{float:none;width:auto;}
+
+.rich-panel{
+ margin-bottom: 20px;
+}
15 years, 6 months
JBoss Rich Faces SVN: r14761 - branches/community/3.3.X/examples/photoalbum.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2009-07-01 09:23:23 -0400 (Wed, 01 Jul 2009)
New Revision: 14761
Modified:
branches/community/3.3.X/examples/photoalbum/readme.txt
Log:
Modified: branches/community/3.3.X/examples/photoalbum/readme.txt
===================================================================
--- branches/community/3.3.X/examples/photoalbum/readme.txt 2009-07-01 13:22:24 UTC (rev 14760)
+++ branches/community/3.3.X/examples/photoalbum/readme.txt 2009-07-01 13:23:23 UTC (rev 14761)
@@ -33,7 +33,7 @@
To make sure the project is built successfully you need to have a SVN client installed on your local machine, for example Subversion. To launch the application use the instructions given above.
In order to explore, run and deploy the application in Eclipse IDE build it with the
- mvn clean install eclipse:clean eclipse:eclipse eclipse:eclipse
+ mvn clean install eclipse:clean eclipse:eclipse
command and import the project to the IDE. More details you can find in the JBoss Server Manager Reference Guide (http://download.jboss.org/jbosstools/nightly-docs/en/as/html/index.html)
15 years, 6 months
JBoss Rich Faces SVN: r14760 - branches/community/3.3.X/examples/photoalbum/source.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2009-07-01 09:22:24 -0400 (Wed, 01 Jul 2009)
New Revision: 14760
Modified:
branches/community/3.3.X/examples/photoalbum/source/readme.txt
Log:
Modified: branches/community/3.3.X/examples/photoalbum/source/readme.txt
===================================================================
--- branches/community/3.3.X/examples/photoalbum/source/readme.txt 2009-07-01 12:53:20 UTC (rev 14759)
+++ branches/community/3.3.X/examples/photoalbum/source/readme.txt 2009-07-01 13:22:24 UTC (rev 14760)
@@ -34,7 +34,7 @@
To make sure the project is built successfully you need to have a SVN client installed on your local machine, for example Subversion. To launch the application use the instructions given above.
In order to explore, run and deploy the application in Eclipse IDE build it with the
- mvn clean install eclipse:clean eclipse:eclipse eclipse:eclipse
+ mvn clean install eclipse:clean eclipse:eclipse
command and import the project to the IDE. More details you can find in the JBoss Server Manager Reference Guide (http://download.jboss.org/jbosstools/nightly-docs/en/as/html/index.html)
15 years, 6 months
JBoss Rich Faces SVN: r14759 - branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-01 08:53:20 -0400 (Wed, 01 Jul 2009)
New Revision: 14759
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceWrapper.java
Log:
Unused methods removed
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceWrapper.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceWrapper.java 2009-07-01 12:48:44 UTC (rev 14758)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceWrapper.java 2009-07-01 12:53:20 UTC (rev 14759)
@@ -30,7 +30,6 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.resource.ResourceContext;
/**
* @author Nick Belaevski
@@ -85,15 +84,4 @@
throw new UnsupportedOperationException();
}
- public void sendHeaders(ResourceContext context) throws IOException {
- this.resource.sendHeaders(context);
- }
-
- public void send(ResourceContext context) throws IOException {
- this.resource.send(context);
- }
-
- public boolean isCacheable(ResourceContext context) {
- return this.resource.isCacheable(context);
- }
}
15 years, 6 months
JBoss Rich Faces SVN: r14758 - in branches/jsf2.0/framework/impl/src/main/java/org: richfaces/resource and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-01 08:48:44 -0400 (Wed, 01 Jul 2009)
New Revision: 14758
Added:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceCodec.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceCodecAware.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceImpl.java
Removed:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodec.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodecAware.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceImpl.java
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/DefaultResourceCodec.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
Log:
Resources: refactoring
Deleted: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodec.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodec.java 2009-07-01 12:45:49 UTC (rev 14757)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodec.java 2009-07-01 12:48:44 UTC (rev 14758)
@@ -1,17 +0,0 @@
-/**
- *
- */
-package org.ajax4jsf.resource;
-
-/**
- * @author Nick Belaevski
- * @since 4.0
- */
-public interface ResourceCodec {
-
- public String encodeResource(String resourceName, Object resourceData);
-
- public String decodeResourceName(String resourceKey);
-
- public Object decodeResourceData(String resourceKey);
-}
Deleted: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodecAware.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodecAware.java 2009-07-01 12:45:49 UTC (rev 14757)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodecAware.java 2009-07-01 12:48:44 UTC (rev 14758)
@@ -1,14 +0,0 @@
-/**
- *
- */
-package org.ajax4jsf.resource;
-
-/**
- * @author Nick Belaevski
- * @since 4.0
- */
-public interface ResourceCodecAware {
-
- public void setResourceCodec(ResourceCodec codec);
-
-}
Deleted: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceImpl.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceImpl.java 2009-07-01 12:45:49 UTC (rev 14757)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceImpl.java 2009-07-01 12:48:44 UTC (rev 14758)
@@ -1,326 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.resource;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.faces.FacesException;
-import javax.faces.application.Resource;
-import javax.faces.component.StateHolder;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.resource.ResourceHandlerImpl;
-import org.richfaces.util.Util;
-
-/**
- * @author Nick Belaevski
- * @since 4.0
- */
-public abstract class ResourceImpl extends Resource implements ResourceCodecAware {
-
- public static final String URL_PROTOCOL = "jsfResource";
-
- private boolean cacheable = true;
-
- private Date lastModified = null;
-
- private boolean useLocalLastModified = false;
-
- private ResourceCodec resourceCodec;
-
- /**
- * @param resourceContext current {@link ResourceContext}
- * @return Returns the contentLength.
- */
- protected int getContentLength(FacesContext context) {
- return -1;
- }
-
- /**
- * @param resourceContext current {@link ResourceContext}
- * @return Returns the expired.
- */
- protected long getExpired(FacesContext context) {
- return 0;
- }
-
- /**
- * @param resourceContext current {@link ResourceContext}
- * @return Returns the lastModified.
- */
- protected Date getLastModified(FacesContext context) {
- if (lastModified == null && !useLocalLastModified) {
- useLocalLastModified = true;
-
- Class<? extends ResourceImpl> thisClass = getClass();
- ClassLoader classLoader = thisClass.getClassLoader();
- if (classLoader == null) {
- classLoader = ClassLoader.getSystemClassLoader();
- }
-
- if (classLoader != null) {
- URL classResource = classLoader.getResource(thisClass.getName().replace('.', '/') + ".class");
- URLConnection connection;
- try {
- connection = classResource.openConnection();
- long classLastModifiedDate = connection.getLastModified();
- if (classLastModifiedDate > 0) {
- lastModified = new Date(classLastModifiedDate);
- }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
-
- return lastModified;
- }
-
- /**
- * @param resourceContext current {@link ResourceContext}
- * @return Returns the cacheable.
- */
- public boolean isCacheable(FacesContext context) {
- return cacheable;
- }
-
- /**
- * @param resourceContext current {@link ResourceContext}
- * @return Returns the mimeType.
- */
- public abstract String getContentType(FacesContext context);
-
- public String getEntityTag(FacesContext context) {
- int contentLength = getContentLength(context);
- Date lastModified = getLastModified(context);
-
- if (contentLength != -1 && lastModified != null) {
- return contentLength + "-" + lastModified.getTime();
- } else {
- return null;
- }
- }
-
- @Override
- public abstract InputStream getInputStream();
-
- public String getVersion() {
- return null;
- }
-
- @Override
- public String getRequestPath() {
- FacesContext context = FacesContext.getCurrentInstance();
-
- Object resourceData = null;
- if (this instanceof StateHolder) {
- StateHolder stateHolder = (StateHolder) this;
- if (!stateHolder.isTransient()) {
- resourceData = stateHolder.saveState(context);
- }
- }
-
- String resourceUri = ResourceHandlerImpl.RICHFACES_RESOURCE_IDENTIFIER +
- resourceCodec.encodeResource(getResourceName(), resourceData);
-
- String url = Util.encodeResourceURL(context, resourceUri);
-
- String version = getVersion();
- if (version != null && version.length() > 0) {
- url += "?v=" + version;
- }
-
- return url;
- }
-
- private boolean isResourceRequest() {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- return (facesContext.getApplication().getResourceHandler().isResourceRequest(facesContext));
- }
-
- @Override
- public Map<String, String> getResponseHeaders() {
- Map<String, String> headers = new HashMap<String, String>();
- FacesContext facesContext = FacesContext.getCurrentInstance();
-
- if (isResourceRequest()) {
- int contentLength = getContentLength(facesContext);
- if (contentLength != -1) {
- headers.put("Content-Length", String.valueOf(contentLength));
- }
-
- String contentType = getContentType();
- if (contentType != null) {
- //TODO add content-encoding?
- headers.put("Content-Type", contentType);
- }
-
- Date lastModified = getLastModified(facesContext);
- if (lastModified != null) {
- headers.put("Last-Modified", Util.formatHttpDate(lastModified));
- }
-
- boolean cacheable = isCacheable(facesContext);
-
- if (cacheable) {
- long expires = getExpired(facesContext);
- if (expires <= 0) {
- expires = InternetResource.DEFAULT_EXPIRE;
- }
-
- String entityTag = getEntityTag(facesContext);
- if (entityTag != null) {
- headers.put("ETag", "W/\"" + entityTag + "\"");
- }
-
- headers.put("Expires", Util.formatHttpDate(expires + System.currentTimeMillis()));
- headers.put("Cache-Control", "max-age=" + expires / 1000L);
- } else {
- headers.put("Expires", "0");
- headers.put("Cache-Control", "max-age=0, no-store, no-cache");
- headers.put("Pragma", "no-cache");
- }
- }
-
- return headers;
- }
-
- @Override
- public URL getURL() {
- // TODO Auto-generated method stub
- try {
- return new URL(URL_PROTOCOL, null, -1, getResourceName(), new URLStreamHandler() {
-
- @Override
- protected URLConnection openConnection(URL u) throws IOException {
- final FacesContext facesContext = FacesContext.getCurrentInstance();
-
- return new URLConnection(u) {
-
- @Override
- public void connect() throws IOException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public int getContentLength() {
- return ResourceImpl.this.getContentLength(facesContext);
- }
-
- @Override
- public String getContentType() {
- return ResourceImpl.this.getContentType(facesContext);
- }
-
- @Override
- public long getExpiration() {
- return ResourceImpl.this.getExpired(facesContext);
- }
-
- @Override
- public long getLastModified() {
- Date date = ResourceImpl.this.getLastModified(facesContext);
- if (date != null) {
- return date.getTime();
- } else {
- return 0;
- }
- }
-
- @Override
- public InputStream getInputStream() throws IOException {
- return ResourceImpl.this.getInputStream();
- }
- };
- }
- });
- } catch (MalformedURLException e) {
- throw new FacesException(e.getLocalizedMessage(), e);
- }
- }
-
- private static final Pattern ETAG_PATTERN = Pattern.compile("(?:W/)?\"([^\"]+)\"(?:,\\s*)?");
-
- private boolean userCopyIsStale(FacesContext context) {
- Date serverLastModified = getLastModified(context);
- if (serverLastModified == null) {
- return true;
- }
-
- String headerValue = context.getExternalContext().getRequestHeaderMap().get("If-Modified-Since");
- Date clientLastModified = Util.parseHttpDate(headerValue);
- if (clientLastModified == null) {
- return true;
- }
-
- // 1000 ms due to round
- // modification
- // time to seconds.
- long serverLastModifiedTime = serverLastModified.getTime() - 1000;
-
- return serverLastModifiedTime > clientLastModified.getTime();
- }
-
- @Override
- public boolean userAgentNeedsUpdate(FacesContext context) {
- if (!isCacheable(context)) {
- return true;
- }
-
- ExternalContext externalContext = context.getExternalContext();
- Map<String, String> requestHeaderMap = externalContext.getRequestHeaderMap();
-
- String ifNoneMatch = requestHeaderMap.get("If-None-Match");
- if (ifNoneMatch != null) {
- Matcher eTagMatcher = ETAG_PATTERN.matcher(ifNoneMatch);
- while (eTagMatcher.find()) {
- String eTag = eTagMatcher.group(1);
-
- if (eTag.equals(getEntityTag(context))) {
- return userCopyIsStale(context);
- }
- }
-
- return true;
- }
-
- return userCopyIsStale(context);
- }
-
- public void setResourceCodec(ResourceCodec codec) {
- this.resourceCodec = codec;
- }
-}
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/DefaultResourceCodec.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/DefaultResourceCodec.java 2009-07-01 12:45:49 UTC (rev 14757)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/DefaultResourceCodec.java 2009-07-01 12:48:44 UTC (rev 14758)
@@ -3,7 +3,6 @@
*/
package org.richfaces.resource;
-import org.ajax4jsf.resource.ResourceCodec;
import org.richfaces.util.Util;
class DefaultResourceCodec implements ResourceCodec {
Added: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceCodec.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceCodec.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceCodec.java 2009-07-01 12:48:44 UTC (rev 14758)
@@ -0,0 +1,17 @@
+/**
+ *
+ */
+package org.richfaces.resource;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public interface ResourceCodec {
+
+ public String encodeResource(String resourceName, Object resourceData);
+
+ public String decodeResourceName(String resourceKey);
+
+ public Object decodeResourceData(String resourceKey);
+}
Added: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceCodecAware.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceCodecAware.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceCodecAware.java 2009-07-01 12:48:44 UTC (rev 14758)
@@ -0,0 +1,14 @@
+/**
+ *
+ */
+package org.richfaces.resource;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public interface ResourceCodecAware {
+
+ public void setResourceCodec(ResourceCodec codec);
+
+}
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2009-07-01 12:45:49 UTC (rev 14757)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2009-07-01 12:48:44 UTC (rev 14758)
@@ -35,8 +35,6 @@
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletResponse;
-import org.ajax4jsf.resource.ResourceCodec;
-import org.ajax4jsf.resource.ResourceCodecAware;
import org.richfaces.util.Util;
import org.richfaces.util.RequestStateManager.BooleanRequestStateVariable;
Added: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceImpl.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceImpl.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceImpl.java 2009-07-01 12:48:44 UTC (rev 14758)
@@ -0,0 +1,327 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.faces.FacesException;
+import javax.faces.application.Resource;
+import javax.faces.component.StateHolder;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.InternetResource;
+import org.ajax4jsf.resource.ResourceContext;
+import org.richfaces.util.Util;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public abstract class ResourceImpl extends Resource implements ResourceCodecAware {
+
+ public static final String URL_PROTOCOL = "jsfResource";
+
+ private boolean cacheable = true;
+
+ private Date lastModified = null;
+
+ private boolean useLocalLastModified = false;
+
+ private ResourceCodec resourceCodec;
+
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the contentLength.
+ */
+ protected int getContentLength(FacesContext context) {
+ return -1;
+ }
+
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the expired.
+ */
+ protected long getExpired(FacesContext context) {
+ return 0;
+ }
+
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the lastModified.
+ */
+ protected Date getLastModified(FacesContext context) {
+ if (lastModified == null && !useLocalLastModified) {
+ useLocalLastModified = true;
+
+ Class<? extends ResourceImpl> thisClass = getClass();
+ ClassLoader classLoader = thisClass.getClassLoader();
+ if (classLoader == null) {
+ classLoader = ClassLoader.getSystemClassLoader();
+ }
+
+ if (classLoader != null) {
+ URL classResource = classLoader.getResource(thisClass.getName().replace('.', '/') + ".class");
+ URLConnection connection;
+ try {
+ connection = classResource.openConnection();
+ long classLastModifiedDate = connection.getLastModified();
+ if (classLastModifiedDate > 0) {
+ lastModified = new Date(classLastModifiedDate);
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+ return lastModified;
+ }
+
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the cacheable.
+ */
+ public boolean isCacheable(FacesContext context) {
+ return cacheable;
+ }
+
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the mimeType.
+ */
+ public abstract String getContentType(FacesContext context);
+
+ public String getEntityTag(FacesContext context) {
+ int contentLength = getContentLength(context);
+ Date lastModified = getLastModified(context);
+
+ if (contentLength != -1 && lastModified != null) {
+ return contentLength + "-" + lastModified.getTime();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public abstract InputStream getInputStream();
+
+ public String getVersion() {
+ return null;
+ }
+
+ @Override
+ public String getRequestPath() {
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ Object resourceData = null;
+ if (this instanceof StateHolder) {
+ StateHolder stateHolder = (StateHolder) this;
+ if (!stateHolder.isTransient()) {
+ resourceData = stateHolder.saveState(context);
+ }
+ }
+
+ String resourceUri = ResourceHandlerImpl.RICHFACES_RESOURCE_IDENTIFIER +
+ resourceCodec.encodeResource(getResourceName(), resourceData);
+
+ String url = Util.encodeResourceURL(context, resourceUri);
+
+ String version = getVersion();
+ if (version != null && version.length() > 0) {
+ url += "?v=" + version;
+ }
+
+ return url;
+ }
+
+ private boolean isResourceRequest() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ return (facesContext.getApplication().getResourceHandler().isResourceRequest(facesContext));
+ }
+
+ @Override
+ public Map<String, String> getResponseHeaders() {
+ Map<String, String> headers = new HashMap<String, String>();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ if (isResourceRequest()) {
+ int contentLength = getContentLength(facesContext);
+ if (contentLength != -1) {
+ headers.put("Content-Length", String.valueOf(contentLength));
+ }
+
+ String contentType = getContentType();
+ if (contentType != null) {
+ //TODO add content-encoding?
+ headers.put("Content-Type", contentType);
+ }
+
+ Date lastModified = getLastModified(facesContext);
+ if (lastModified != null) {
+ headers.put("Last-Modified", Util.formatHttpDate(lastModified));
+ }
+
+ boolean cacheable = isCacheable(facesContext);
+
+ if (cacheable) {
+ long expires = getExpired(facesContext);
+ if (expires <= 0) {
+ expires = InternetResource.DEFAULT_EXPIRE;
+ }
+
+ String entityTag = getEntityTag(facesContext);
+ if (entityTag != null) {
+ headers.put("ETag", "W/\"" + entityTag + "\"");
+ }
+
+ headers.put("Expires", Util.formatHttpDate(expires + System.currentTimeMillis()));
+ headers.put("Cache-Control", "max-age=" + expires / 1000L);
+ } else {
+ headers.put("Expires", "0");
+ headers.put("Cache-Control", "max-age=0, no-store, no-cache");
+ headers.put("Pragma", "no-cache");
+ }
+ }
+
+ return headers;
+ }
+
+ @Override
+ public URL getURL() {
+ // TODO Auto-generated method stub
+ try {
+ return new URL(URL_PROTOCOL, null, -1, getResourceName(), new URLStreamHandler() {
+
+ @Override
+ protected URLConnection openConnection(URL u) throws IOException {
+ final FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ return new URLConnection(u) {
+
+ @Override
+ public void connect() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int getContentLength() {
+ return ResourceImpl.this.getContentLength(facesContext);
+ }
+
+ @Override
+ public String getContentType() {
+ return ResourceImpl.this.getContentType(facesContext);
+ }
+
+ @Override
+ public long getExpiration() {
+ return ResourceImpl.this.getExpired(facesContext);
+ }
+
+ @Override
+ public long getLastModified() {
+ Date date = ResourceImpl.this.getLastModified(facesContext);
+ if (date != null) {
+ return date.getTime();
+ } else {
+ return 0;
+ }
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return ResourceImpl.this.getInputStream();
+ }
+ };
+ }
+ });
+ } catch (MalformedURLException e) {
+ throw new FacesException(e.getLocalizedMessage(), e);
+ }
+ }
+
+ private static final Pattern ETAG_PATTERN = Pattern.compile("(?:W/)?\"([^\"]+)\"(?:,\\s*)?");
+
+ private boolean userCopyIsStale(FacesContext context) {
+ Date serverLastModified = getLastModified(context);
+ if (serverLastModified == null) {
+ return true;
+ }
+
+ String headerValue = context.getExternalContext().getRequestHeaderMap().get("If-Modified-Since");
+ Date clientLastModified = Util.parseHttpDate(headerValue);
+ if (clientLastModified == null) {
+ return true;
+ }
+
+ // 1000 ms due to round
+ // modification
+ // time to seconds.
+ long serverLastModifiedTime = serverLastModified.getTime() - 1000;
+
+ return serverLastModifiedTime > clientLastModified.getTime();
+ }
+
+ @Override
+ public boolean userAgentNeedsUpdate(FacesContext context) {
+ if (!isCacheable(context)) {
+ return true;
+ }
+
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, String> requestHeaderMap = externalContext.getRequestHeaderMap();
+
+ String ifNoneMatch = requestHeaderMap.get("If-None-Match");
+ if (ifNoneMatch != null) {
+ Matcher eTagMatcher = ETAG_PATTERN.matcher(ifNoneMatch);
+ while (eTagMatcher.find()) {
+ String eTag = eTagMatcher.group(1);
+
+ if (eTag.equals(getEntityTag(context))) {
+ return userCopyIsStale(context);
+ }
+ }
+
+ return true;
+ }
+
+ return userCopyIsStale(context);
+ }
+
+ public void setResourceCodec(ResourceCodec codec) {
+ this.resourceCodec = codec;
+ }
+}
15 years, 6 months
JBoss Rich Faces SVN: r14757 - branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-01 08:45:49 -0400 (Wed, 01 Jul 2009)
New Revision: 14757
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceHandlerImpl.java
Log:
LegacyResourceHandlerImpl refactored
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceHandlerImpl.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceHandlerImpl.java 2009-07-01 10:36:19 UTC (rev 14756)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceHandlerImpl.java 2009-07-01 12:45:49 UTC (rev 14757)
@@ -100,21 +100,21 @@
}
}
- public boolean isResourceRequest(FacesContext context) {
- if (defaultHandler.isResourceRequest(context)) {
- return true;
- } else {
- Boolean resourceRequest = BooleanRequestStateVariable.LEGACY_RESOURCE_REQUEST.get(context);
- if (resourceRequest == null) {
- String resourceName = getResourceKey(context);
- //TODO handle exclusions
- resourceRequest = resourceName != null ? Boolean.TRUE : Boolean.FALSE;
- BooleanRequestStateVariable.LEGACY_RESOURCE_REQUEST.set(context, resourceRequest);
- }
-
- return resourceRequest.booleanValue();
+ protected boolean isThisHandlerResourceRequest(FacesContext context) {
+ Boolean resourceRequest = BooleanRequestStateVariable.LEGACY_RESOURCE_REQUEST.get(context);
+ if (resourceRequest == null) {
+ String resourceName = getResourceKey(context);
+ //TODO handle exclusions
+ resourceRequest = resourceName != null ? Boolean.TRUE : Boolean.FALSE;
+ BooleanRequestStateVariable.LEGACY_RESOURCE_REQUEST.set(context, resourceRequest);
}
+
+ return resourceRequest.booleanValue();
}
+
+ public boolean isResourceRequest(FacesContext context) {
+ return isThisHandlerResourceRequest(context) || defaultHandler.isResourceRequest(context);
+ }
private Date getIfModifiedSince(ExternalContext externalContext) {
@@ -136,10 +136,7 @@
}
public void handleResourceRequest(FacesContext context) throws IOException {
- if (defaultHandler.isResourceRequest(context)) {
- defaultHandler.handleResourceRequest(context);
- } else {
-
+ if (isThisHandlerResourceRequest(context)) {
String resourceKey = getResourceKey(context);
InternetResourceBuilder resourceBuilder = InternetResourceBuilder.getInstance();
@@ -203,6 +200,8 @@
//TODO
context.getExternalContext().setResponseStatus(HttpServletResponse.SC_NOT_FOUND);
}
+ } else {
+ defaultHandler.handleResourceRequest(context);
}
}
15 years, 6 months
JBoss Rich Faces SVN: r14756 - in branches/jsf2.0/framework/impl/src/main/java/org/richfaces: util and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-07-01 06:36:19 -0400 (Wed, 01 Jul 2009)
New Revision: 14756
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/Util.java
Log:
Resources: handler refactoring
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2009-07-01 10:34:51 UTC (rev 14755)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2009-07-01 10:36:19 UTC (rev 14756)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
@@ -76,21 +77,21 @@
}
}
- public boolean isResourceRequest(FacesContext context) {
- if (defaultHandler.isResourceRequest(context)) {
- return true;
- } else {
- Boolean resourceRequest = BooleanRequestStateVariable.RESOURCE_REQUEST.get(context);
- if (resourceRequest == null) {
- String resourceName = getResourceKey(context);
- //TODO handle exclusions
- resourceRequest = resourceName != null ? Boolean.TRUE : Boolean.FALSE;
- BooleanRequestStateVariable.RESOURCE_REQUEST.set(context, resourceRequest);
- }
+ protected boolean isThisHandlerResourceRequest(FacesContext context) {
+ Boolean resourceRequest = BooleanRequestStateVariable.RESOURCE_REQUEST.get(context);
+ if (resourceRequest == null) {
+ String resourceName = getResourceKey(context);
+ //TODO handle exclusions
+ resourceRequest = resourceName != null ? Boolean.TRUE : Boolean.FALSE;
+ BooleanRequestStateVariable.RESOURCE_REQUEST.set(context, resourceRequest);
+ }
- return resourceRequest.booleanValue();
- }
+ return resourceRequest.booleanValue();
}
+
+ public boolean isResourceRequest(FacesContext context) {
+ return isThisHandlerResourceRequest(context) || defaultHandler.isResourceRequest(context);
+ }
private void sendNotModified(FacesContext context) {
context.getExternalContext().setResponseStatus(HttpServletResponse.SC_NOT_MODIFIED);
@@ -101,9 +102,7 @@
}
public void handleResourceRequest(FacesContext context) throws IOException {
- if (defaultHandler.isResourceRequest(context)) {
- defaultHandler.handleResourceRequest(context);
- } else {
+ if (isThisHandlerResourceRequest(context)) {
String resourceKey = getResourceKey(context);
if (resourceKey == null) {
@@ -131,24 +130,31 @@
stateHolder.restoreState(context, resourceCodec.decodeResourceData(resourceKey));
}
- Map<String, String> headers = resource.getResponseHeaders();
-
if (resource.userAgentNeedsUpdate(context)) {
+ Map<String, String> headers = resource.getResponseHeaders();
for (Entry<String, String> headerEntry : headers.entrySet()) {
- externalContext.setResponseHeader(headerEntry.getKey(), headerEntry.getValue());
+ String headerName = headerEntry.getKey();
+ String headerValue = headerEntry.getValue();
+
+ //TODO should external context handles this itself?
+ if ("content-length".equals(headerName.toLowerCase(Locale.US))) {
+ try {
+ externalContext.setResponseContentLength(Integer.parseInt(headerValue));
+ } catch (NumberFormatException e) {
+ // TODO: handle exception
+ }
+ } else if ("content-type".equals(headerName.toLowerCase(Locale.US))) {
+ externalContext.setResponseContentType(headerValue);
+ } else {
+ externalContext.setResponseHeader(headerName, headerValue);
+ }
}
InputStream is = resource.getInputStream();
OutputStream os = externalContext.getResponseOutputStream();
try {
- byte[] bs = new byte[8192];
- int read;
-
- while ((read = is.read(bs)) > 0) {
- os.write(bs, 0, read);
- }
-
+ Util.copyStreamContent(is, os);
} finally {
if (is != null) {
try {
@@ -164,6 +170,8 @@
} else {
sendNotModified(context);
}
+ } else {
+ defaultHandler.handleResourceRequest(context);
}
}
@@ -176,7 +184,7 @@
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
if (contextClassLoader != null) {
try {
- Class<?> resourceClass = contextClassLoader.loadClass(resourceName);
+ Class<?> resourceClass = Class.forName(resourceName, true, contextClassLoader);
if (Resource.class.isAssignableFrom(resourceClass)) {
resource = (Resource) resourceClass.newInstance();
resource.setResourceName(resourceName);
@@ -187,7 +195,6 @@
}
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
- e1.printStackTrace();
} catch (InstantiationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/Util.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/Util.java 2009-07-01 10:34:51 UTC (rev 14755)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/Util.java 2009-07-01 10:36:19 UTC (rev 14756)
@@ -44,10 +44,16 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.OutputStream;
import java.io.StreamCorruptedException;
import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
import java.text.Format;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -77,11 +83,13 @@
/* HTTP Date format required by the HTTP/1.1 RFC */
private static final String RFC1123_DATE_PATTERN = "EEE, dd MMM yyyy HH:mm:ss zzz";
- private static final SimpleDateFormat RFC1123_DATE_FORMATTER =
- new SimpleDateFormat(RFC1123_DATE_PATTERN, Locale.US);
+ private static final SimpleDateFormat RFC1123_DATE_FORMATTER;
static {
- RFC1123_DATE_FORMATTER.setTimeZone(TimeZone.getTimeZone("GMT"));
+ SimpleDateFormat format = new SimpleDateFormat(RFC1123_DATE_PATTERN, Locale.US);
+ format.setTimeZone(TimeZone.getTimeZone("GMT"));
+
+ RFC1123_DATE_FORMATTER = format;
}
public static String getMappingForRequest(FacesContext context) {
@@ -318,4 +326,24 @@
return resourceName;
}
+
+ public static void copyStreamContent(InputStream is, OutputStream os) throws IOException {
+ ReadableByteChannel inChannel = Channels.newChannel(is);
+ WritableByteChannel outChannel = Channels.newChannel(os);
+
+ //TODO make this configurable
+ ByteBuffer buffer = ByteBuffer.allocate(8192);
+ int read;
+
+ while ((read = inChannel.read(buffer)) > 0) {
+ buffer.rewind();
+ buffer.limit(read);
+
+ while (read > 0) {
+ read -= outChannel.write(buffer);
+ }
+
+ buffer.clear();
+ }
+ }
}
15 years, 6 months