Seam SVN: r10248 - in trunk/src: test/unit/org/jboss/seam/test/unit and 1 other directory.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-31 03:26:12 -0400 (Tue, 31 Mar 2009)
New Revision: 10248
Modified:
trunk/src/main/org/jboss/seam/framework/EntityQuery.java
trunk/src/main/org/jboss/seam/framework/Query.java
trunk/src/test/unit/org/jboss/seam/test/unit/QueryTest.java
trunk/src/test/unit/org/jboss/seam/test/unit/testng.xml
Log:
JBSEAM-3032
Modified: trunk/src/main/org/jboss/seam/framework/EntityQuery.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/EntityQuery.java 2009-03-31 04:56:03 UTC (rev 10247)
+++ trunk/src/main/org/jboss/seam/framework/EntityQuery.java 2009-03-31 07:26:12 UTC (rev 10248)
@@ -11,6 +11,8 @@
import org.jboss.seam.persistence.QueryParser;
import org.jboss.seam.transaction.Transaction;
+import org.jboss.seam.util.Reflections;
+
/**
* A Query object for JPA.
*
@@ -38,6 +40,11 @@
{
throw new IllegalStateException("entityManager is null");
}
+
+ Object delegate = getEntityManager().getDelegate();
+ if (!(Reflections.isClassAvailable("org.hibernate.Session") && delegate instanceof org.hibernate.Session)) {
+ setUseCompliantCountQuerySubject(true);
+ }
}
@Override
Modified: trunk/src/main/org/jboss/seam/framework/Query.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/Query.java 2009-03-31 04:56:03 UTC (rev 10247)
+++ trunk/src/main/org/jboss/seam/framework/Query.java 2009-03-31 07:26:12 UTC (rev 10248)
@@ -28,7 +28,7 @@
public abstract class Query<T, E>
extends PersistenceController<T> //TODO: extend MutableController!
{
- private static final Pattern SUBJECT_PATTERN = Pattern.compile("^select (\\w+(\\.\\w+)*)\\s+from", Pattern.CASE_INSENSITIVE);
+ private static final Pattern SUBJECT_PATTERN = Pattern.compile("^select (\\w+((\\s+|\\.)\\w+)*)\\s+from", Pattern.CASE_INSENSITIVE);
private static final Pattern FROM_PATTERN = Pattern.compile("(^|\\s)(from)\\s", Pattern.CASE_INSENSITIVE);
private static final Pattern WHERE_PATTERN = Pattern.compile("\\s(where)\\s", Pattern.CASE_INSENSITIVE);
private static final Pattern ORDER_PATTERN = Pattern.compile("\\s(order)(\\s)+by\\s", Pattern.CASE_INSENSITIVE);
@@ -48,6 +48,7 @@
private String groupBy;
+ private boolean useCompliantCountQuerySubject = false;
private DataModel dataModel;
private String parsedEjbql;
@@ -292,13 +293,15 @@
int whereLoc = whereMatcher.find() ? whereMatcher.start(1) : orderLoc;
String subject = "*";
- // TODO to be JPA-compliant, we need to make this query like "select count(u) from User u"
+ // to be JPA-compliant, we need to make this query like "select count(u) from User u"
// however, Hibernate produces queries some databases cannot run when the primary key is composite
-// Matcher subjectMatcher = SUBJECT_PATTERN.matcher(ejbql);
-// if ( subjectMatcher.find() )
-// {
-// subject = subjectMatcher.group(1);
-// }
+ if (useCompliantCountQuerySubject) {
+ Matcher subjectMatcher = SUBJECT_PATTERN.matcher(ejbql);
+ if ( subjectMatcher.find() )
+ {
+ subject = subjectMatcher.group(1);
+ }
+ }
return new StringBuilder(ejbql.length() + 15).append("select count(").append(subject).append(") ").
append(ejbql.substring(fromLoc, whereLoc).replace("join fetch", "join")).
@@ -567,4 +570,12 @@
}
}
+ protected boolean isUseCompliantCountQuerySubject() {
+ return useCompliantCountQuerySubject;
+ }
+
+ protected void setUseCompliantCountQuerySubject(boolean useCompliantCountQuerySubject) {
+ this.useCompliantCountQuerySubject = useCompliantCountQuerySubject;
+ }
+
}
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/QueryTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/QueryTest.java 2009-03-31 04:56:03 UTC (rev 10247)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/QueryTest.java 2009-03-31 07:26:12 UTC (rev 10248)
@@ -41,6 +41,11 @@
query.parseEjbql();
// TODO this should eventually become count(v.person)
assertEquals(query.getCountEjbql(), "select count(*) from Vehicle v left join v.person");
+
+ query = new CompliantUnitQuery();
+ query.setEjbql("select p from Person p");
+ query.parseEjbql();
+ assertEquals(query.getCountEjbql(), "select count(p) from Person p");
}
class UnitQuery extends EntityQuery {
@@ -64,4 +69,12 @@
}
}
+
+ class CompliantUnitQuery extends UnitQuery {
+
+ public CompliantUnitQuery() {
+ setUseCompliantCountQuerySubject(true);
+ }
+
+ }
}
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/testng.xml
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/testng.xml 2009-03-31 04:56:03 UTC (rev 10247)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/testng.xml 2009-03-31 07:26:12 UTC (rev 10248)
@@ -56,6 +56,7 @@
<test name="Seam Unit Tests: Framework">
<classes>
<class name="org.jboss.seam.test.unit.HomeTest" />
+ <class name="org.jboss.seam.test.unit.QueryTest" />
</classes>
</test>
15 years, 8 months
Seam SVN: r10247 - in trunk: src/main/org/jboss/seam/faces and 1 other directory.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-31 00:56:03 -0400 (Tue, 31 Mar 2009)
New Revision: 10247
Added:
trunk/src/main/org/jboss/seam/faces/DateConverter.java
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Components.xml
trunk/doc/Seam_Reference_Guide/en-US/Events.xml
trunk/doc/Seam_Reference_Guide/en-US/I18n.xml
trunk/doc/Seam_Reference_Guide/en-US/Tutorial.xml
Log:
JBSEAM-3551
Modified: trunk/doc/Seam_Reference_Guide/en-US/Components.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Components.xml 2009-03-31 03:58:24 UTC (rev 10246)
+++ trunk/doc/Seam_Reference_Guide/en-US/Components.xml 2009-03-31 04:56:03 UTC (rev 10247)
@@ -55,15 +55,41 @@
</para>
</section>
-
+
<section>
- <title>Utility components</title>
+ <title>JSF-related components</title>
<para>
- These components are merely useful.
+ The following set of components are provided to supplement JSF.
</para>
-
- <variablelist>
+
+ <variablelist>
<varlistentry>
+ <term><literal>org.jboss.seam.faces.dateConverter</literal></term>
+ <listitem>
+ <para>
+ Provides a default JSF converter for properties of type
+ <literal>java.util.Date</literal>.
+ </para>
+
+ <para>
+ This converter is automatically registered with JSF. It
+ is provided to save a developer from having to specify
+ a DateTimeConverter on an input field or page
+ parameter. By default, it assumes the type to be a date
+ (as opposed to a time or date plus time) and uses the
+ short input style adjusted to the Locale of the user.
+ For Locale.US, the input pattern is mm/DD/yy. However,
+ to comply with Y2K, the year is changed from two digits
+ to four (e.g., mm/DD/yyyy).
+ </para>
+ <para>
+ It's possible to override the input pattern globally
+ using component configuration. Consult the JavaDoc for
+ this class to see examples.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><literal>org.jboss.seam.faces.facesMessages</literal></term>
<listitem>
<para>
@@ -166,6 +192,21 @@
</para>
</listitem>
</varlistentry>
+ </variablelist>
+
+ <para>
+ These components are installed when the class <literal>javax.faces.context.FacesContext</literal>
+ is available on the classpath.
+ </para>
+ </section>
+
+ <section>
+ <title>Utility components</title>
+ <para>
+ These components are merely useful.
+ </para>
+
+ <variablelist>
<varlistentry>
<term><literal>org.jboss.seam.core.events</literal></term>
<listitem>
Modified: trunk/doc/Seam_Reference_Guide/en-US/Events.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Events.xml 2009-03-31 03:58:24 UTC (rev 10246)
+++ trunk/doc/Seam_Reference_Guide/en-US/Events.xml 2009-03-31 04:56:03 UTC (rev 10247)
@@ -431,7 +431,8 @@
<para>
Even better, model-based Hibernate validator annotations are automatically
- recognized and validated.
+ recognized and validated. Seam also provides a default date converter to
+ convert a string parameter value to a date and back.
</para>
<para>
Modified: trunk/doc/Seam_Reference_Guide/en-US/I18n.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/I18n.xml 2009-03-31 03:58:24 UTC (rev 10246)
+++ trunk/doc/Seam_Reference_Guide/en-US/I18n.xml 2009-03-31 04:56:03 UTC (rev 10247)
@@ -336,6 +336,11 @@
the Seam timezone. In addition, Seam provides the <literal>
<s:convertDateTime></literal> tag which always performs conversions
in the Seam timezone.</para>
+
+ <para>Seam also provides a default date converter to convert a string value
+ to a date. This saves you from having to specify a converter on input fields
+ that are simply capturing a date. The pattern is selected according the
+ the user's locale and the time zone is selected as described above.</para>
</section>
<section>
Modified: trunk/doc/Seam_Reference_Guide/en-US/Tutorial.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Tutorial.xml 2009-03-31 03:58:24 UTC (rev 10246)
+++ trunk/doc/Seam_Reference_Guide/en-US/Tutorial.xml 2009-03-31 04:56:03 UTC (rev 10247)
@@ -1437,6 +1437,8 @@
</h:inputText>
</h:column>]]></programlisting>
+ <note>Seam provides a default JSF date converter for converting a string to a date (no time).
+ Thus, the converter is not necessary for the field bound to <literal>#{task.dueDate}</literal>.</note>
<para> This button ends the task by calling the action method annotated <literal>@StartTask
@EndTask</literal>. It passes the task id to Seam as a request parameter: </para>
Added: trunk/src/main/org/jboss/seam/faces/DateConverter.java
===================================================================
--- trunk/src/main/org/jboss/seam/faces/DateConverter.java (rev 0)
+++ trunk/src/main/org/jboss/seam/faces/DateConverter.java 2009-03-31 04:56:03 UTC (rev 10247)
@@ -0,0 +1,120 @@
+package org.jboss.seam.faces;
+
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.ConverterException;
+
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.faces.Converter;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.log.Log;
+import org.jboss.seam.log.Logging;
+
+/**
+ * Provides a default JSF converter for properties of type java.util.Date.
+ *
+ * <p>This converter is provided to save a developer from having to specify
+ * a DateTimeConverter on an input field or page parameter. By default, it
+ * assumes the type to be a date (as opposed to a time or date plus time) and
+ * uses the short input style adjusted to the Locale of the user. For Locale.US,
+ * the input pattern is mm/DD/yy. However, to comply with Y2K, the year is changed
+ * from two digits to four (e.g., mm/DD/yyyy).</p>
+ * <p>It's possible to override the input pattern globally using component configuration.
+ * Here is an example of changing the style to both and setting the date and
+ * time style to medium.</p>
+ * <pre>
+ * org.jboss.seam.faces.dateConverter.type=both
+ * org.jboss.seam.faces.dateConverter.dateStyle=medium
+ * org.jboss.seam.faces.dateConverter.timeStyle=medium
+ * </pre>
+ * <p>Alternatively, a fixed pattern can be specified.</p>
+ * <pre>
+ * org.jboss.seam.faces.dateConverter.pattern=yyyy-mm-DD
+ * </pre>
+ *
+ * @author Dan Allen
+ */
+@Converter(forClass = Date.class)
+@Name("org.jboss.seam.faces.dateConverter")
+@Install(precedence = BUILT_IN, classDependencies = "javax.faces.context.FacesContext")
+@BypassInterceptors
+public class DateConverter extends javax.faces.convert.DateTimeConverter {
+
+ private Log log = Logging.getLog(DateConverter.class);
+
+ private static final String TYPE_DATE = "date";
+ private static final String STYLE_SHORT = "short";
+ private static final String TWO_DIGIT_YEAR_PATTERN = "yy";
+ private static final String FOUR_DIGIT_YEAR_PATTERN = "yyyy";
+
+ // constructor is used to initialize converter to allow these values to be overridden using component properties
+ public DateConverter() {
+ super();
+ setType(TYPE_DATE);
+ setDateStyle(STYLE_SHORT);
+ setTimeStyle(STYLE_SHORT); // default in case developer overrides type to be time or both
+ }
+
+ @Create
+ public void create() {
+ // TODO make this work if using "both" for type; requires more analysis of time style
+ if (TYPE_DATE.equals(getType()) && STYLE_SHORT.equals(getDateStyle()) && getPattern() == null) {
+ // attempt to make the pattern Y2K compliant, which it isn't by default
+ DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, getLocale());
+ if (dateFormat instanceof SimpleDateFormat) {
+ setPattern(((SimpleDateFormat) dateFormat).toPattern().replace(TWO_DIGIT_YEAR_PATTERN, FOUR_DIGIT_YEAR_PATTERN));
+ }
+ }
+ // required since the superclass may access the fields directly
+ setTimeZone(getTimeZone());
+ setLocale(getLocale());
+ }
+
+ @Override
+ public TimeZone getTimeZone() {
+ if (Contexts.isApplicationContextActive()) {
+ return org.jboss.seam.international.TimeZone.instance();
+ } else {
+ // we don't want to use JSF's braindead default (maybe in JSF 2)
+ return TimeZone.getDefault();
+ }
+ }
+
+ @Override
+ public Locale getLocale() {
+ if (Contexts.isApplicationContextActive()) {
+ return org.jboss.seam.international.Locale.instance();
+ } else {
+ return super.getLocale();
+ }
+ }
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component,
+ String value) throws ConverterException {
+ if (log.isDebugEnabled()) {
+ log.debug("Converting string '#0' to date for clientId '#1' using Seam's built-in JSF date converter", value, component.getClientId(context));
+ }
+ return super.getAsObject(context, component, value);
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) throws ConverterException {
+ if (log.isDebugEnabled()) {
+ log.debug("Converting date '#0' to string for clientId '#1' using Seam's built-in JSF date converter", value, component.getClientId(context));
+ }
+ return super.getAsString(context, component, value);
+ }
+}
15 years, 8 months
Seam SVN: r10246 - trunk/ui/src/main/config/component.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-30 23:58:24 -0400 (Mon, 30 Mar 2009)
New Revision: 10246
Modified:
trunk/ui/src/main/config/component/formattedTextValidator.xml
Log:
fix missing validator id for FormattedTextValidator
Modified: trunk/ui/src/main/config/component/formattedTextValidator.xml
===================================================================
--- trunk/ui/src/main/config/component/formattedTextValidator.xml 2009-03-31 02:08:23 UTC (rev 10245)
+++ trunk/ui/src/main/config/component/formattedTextValidator.xml 2009-03-31 03:58:24 UTC (rev 10246)
@@ -2,7 +2,7 @@
<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://jboss.org/jbossrichfaces/component-config.dtd" >
<components>
<validator generate="false">
- <name>org.jboss.seam.ui.FormattedTextValidator</name>
+ <id>org.jboss.seam.ui.FormattedTextValidator</id>
<classname>org.jboss.seam.ui.validator.FormattedTextValidator</classname>
<description>
<![CDATA[Validate Seam Text input]]>
15 years, 8 months
Seam SVN: r10245 - branches/community/Seam_2_0/seam-gen/src.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-30 22:08:23 -0400 (Mon, 30 Mar 2009)
New Revision: 10245
Modified:
branches/community/Seam_2_0/seam-gen/src/EntityHome.java.ftl
Log:
JBSEAM-994 quick fix
Modified: branches/community/Seam_2_0/seam-gen/src/EntityHome.java.ftl
===================================================================
--- branches/community/Seam_2_0/seam-gen/src/EntityHome.java.ftl 2009-03-31 02:07:05 UTC (rev 10244)
+++ branches/community/Seam_2_0/seam-gen/src/EntityHome.java.ftl 2009-03-31 02:08:23 UTC (rev 10245)
@@ -7,13 +7,17 @@
public class ${entityName}Home extends ${pojo.importType("org.jboss.seam.framework.EntityHome")}<${entityName}>
{
+<#assign parentHomeNames = []>
<#foreach property in pojo.allPropertiesIterator>
<#if util.isToOne(property)>
<#assign parentPojo = c2j.getPOJOClass(cfg.getClassMapping(property.value.referencedEntityName))>
<#assign parentHomeName = util.lower(parentPojo.shortName) + "Home">
+<#if !parentHomeNames?seq_contains(parentHomeName)><#-- This doesn't fix the functionality, just allows compilation to work -->
+<#assign parentHomeNames = parentHomeNames + [parentHomeName]>
@${pojo.importType("org.jboss.seam.annotations.In")}(create=true)
<#if parentPojo.packageName!="">${pojo.importType("${parentPojo.packageName}.${parentPojo.shortName}")}<#else>${parentPojo.shortName}</#if>Home ${parentHomeName};
</#if>
+</#if>
</#foreach>
<#assign idName = entityName + util.upper(pojo.identifierProperty.name)>
15 years, 8 months
Seam SVN: r10244 - trunk/seam-gen/src.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-30 22:07:05 -0400 (Mon, 30 Mar 2009)
New Revision: 10244
Modified:
trunk/seam-gen/src/EntityHome.java.ftl
Log:
JBSEAM-994 quick fix
Modified: trunk/seam-gen/src/EntityHome.java.ftl
===================================================================
--- trunk/seam-gen/src/EntityHome.java.ftl 2009-03-31 01:29:17 UTC (rev 10243)
+++ trunk/seam-gen/src/EntityHome.java.ftl 2009-03-31 02:07:05 UTC (rev 10244)
@@ -8,13 +8,17 @@
public class ${entityName}Home extends ${pojo.importType("org.jboss.seam.framework.EntityHome")}<${entityName}>
{
+<#assign parentHomeNames = []>
<#foreach property in pojo.allPropertiesIterator>
<#if isToOne(property)>
<#assign parentPojo = c2j.getPOJOClass(cfg.getClassMapping(property.value.referencedEntityName))>
<#assign parentHomeName = parentPojo.shortName?uncap_first + "Home">
+<#if !parentHomeNames?seq_contains(parentHomeName)><#-- This doesn't fix the functionality, just allows compilation to work -->
+<#assign parentHomeNames = parentHomeNames + [parentHomeName]>
@${pojo.importType("org.jboss.seam.annotations.In")}(create=true)
<#if parentPojo.packageName!="">${pojo.importType("${parentPojo.packageName}.${parentPojo.shortName}")}<#else>${parentPojo.shortName}</#if>Home ${parentHomeName};
</#if>
+</#if>
</#foreach>
<#assign idName = entityName + pojo.identifierProperty.name?cap_first>
15 years, 8 months
Seam SVN: r10243 - branches/community/Seam_2_0/seam-gen/src.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-30 21:29:17 -0400 (Mon, 30 Mar 2009)
New Revision: 10243
Modified:
branches/community/Seam_2_0/seam-gen/src/EntityHome.java.ftl
Log:
JBSEAM-3278
Modified: branches/community/Seam_2_0/seam-gen/src/EntityHome.java.ftl
===================================================================
--- branches/community/Seam_2_0/seam-gen/src/EntityHome.java.ftl 2009-03-31 01:21:01 UTC (rev 10242)
+++ branches/community/Seam_2_0/seam-gen/src/EntityHome.java.ftl 2009-03-31 01:29:17 UTC (rev 10243)
@@ -12,7 +12,7 @@
<#assign parentPojo = c2j.getPOJOClass(cfg.getClassMapping(property.value.referencedEntityName))>
<#assign parentHomeName = util.lower(parentPojo.shortName) + "Home">
@${pojo.importType("org.jboss.seam.annotations.In")}(create=true)
- ${parentPojo.shortName}Home ${parentHomeName};
+ <#if parentPojo.packageName!="">${pojo.importType("${parentPojo.packageName}.${parentPojo.shortName}")}<#else>${parentPojo.shortName}</#if>Home ${parentHomeName};
</#if>
</#foreach>
@@ -105,7 +105,7 @@
<#assign getter = pojo.getGetterSignature(property)>
<#if c2h.isOneToManyCollection(property)>
<#assign childPojo = c2j.getPOJOClass(property.value.element.associatedClass)>
- public ${pojo.importType("java.util.List")}<${childPojo.shortName}> ${getter}() {
+ public ${pojo.importType("java.util.List")}<<#if childPojo.packageName!="">${pojo.importType("${childPojo.packageName}.${childPojo.shortName}")}<#else>${childPojo.shortName}</#if>> ${getter}() {
return getInstance() == null ?
null : new ${pojo.importType("java.util.ArrayList")}<${childPojo.shortName}>( getInstance().${getter}() );
}
15 years, 8 months
Seam SVN: r10242 - trunk/seam-gen/src.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-30 21:21:01 -0400 (Mon, 30 Mar 2009)
New Revision: 10242
Modified:
trunk/seam-gen/src/EntityHome.java.ftl
trunk/seam-gen/src/EntityList.java.ftl
Log:
JBSEAM-3278
Modified: trunk/seam-gen/src/EntityHome.java.ftl
===================================================================
--- trunk/seam-gen/src/EntityHome.java.ftl 2009-03-30 22:11:04 UTC (rev 10241)
+++ trunk/seam-gen/src/EntityHome.java.ftl 2009-03-31 01:21:01 UTC (rev 10242)
@@ -13,7 +13,7 @@
<#assign parentPojo = c2j.getPOJOClass(cfg.getClassMapping(property.value.referencedEntityName))>
<#assign parentHomeName = parentPojo.shortName?uncap_first + "Home">
@${pojo.importType("org.jboss.seam.annotations.In")}(create=true)
- ${parentPojo.shortName}Home ${parentHomeName};
+ <#if parentPojo.packageName!="">${pojo.importType("${parentPojo.packageName}.${parentPojo.shortName}")}<#else>${parentPojo.shortName}</#if>Home ${parentHomeName};
</#if>
</#foreach>
@@ -113,7 +113,7 @@
<#assign getter = pojo.getGetterSignature(property)>
<#if c2h.isOneToManyCollection(property)>
<#assign childPojo = c2j.getPOJOClass(property.value.element.associatedClass)>
- public ${pojo.importType("java.util.List")}<${childPojo.shortName}> ${getter}() {
+ public ${pojo.importType("java.util.List")}<<#if childPojo.packageName!="">${pojo.importType("${childPojo.packageName}.${childPojo.shortName}")}<#else>${childPojo.shortName}</#if>> ${getter}() {
return getInstance() == null ?
null : new ${pojo.importType("java.util.ArrayList")}<${childPojo.shortName}>( getInstance().${getter}() );
}
@@ -124,7 +124,7 @@
</#assign>
<#if pojo.packageName != "">
-import ${pojo.packageName}.*;
+import ${pojo.packageName}.*;<#-- This import is necessary because we're using a different package than Hibernate Tools expects -->
</#if>
${pojo.generateImports()}
${classbody}
Modified: trunk/seam-gen/src/EntityList.java.ftl
===================================================================
--- trunk/seam-gen/src/EntityList.java.ftl 2009-03-30 22:11:04 UTC (rev 10241)
+++ trunk/seam-gen/src/EntityList.java.ftl 2009-03-31 01:21:01 UTC (rev 10242)
@@ -5,7 +5,7 @@
package ${actionPackage};
<#if pojo.packageName != "">
-import ${pojo.packageName}.*;
+import ${pojo.packageName}.*;<#-- This import is necessary because we're using a different package than Hibernate Tools expects -->
</#if>
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
15 years, 8 months
Seam SVN: r10241 - trunk/seam-gen/ivy.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-03-30 18:11:04 -0400 (Mon, 30 Mar 2009)
New Revision: 10241
Modified:
trunk/seam-gen/ivy/ivy.xml
Log:
update drools dependencies
Modified: trunk/seam-gen/ivy/ivy.xml
===================================================================
--- trunk/seam-gen/ivy/ivy.xml 2009-03-30 22:03:44 UTC (rev 10240)
+++ trunk/seam-gen/ivy/ivy.xml 2009-03-30 22:11:04 UTC (rev 10241)
@@ -47,13 +47,16 @@
<dependency org="net.sourceforge.jexcelapi" name="jxl" rev="2.6.8-seam">
<artifact name="jxl" type="jar"/>
</dependency>
- <dependency org="org.antlr" name="antlr-runtime" rev="3.0">
+ <dependency org="org.antlr" name="antlr-runtime" rev="3.1.1">
<artifact name="antlr-runtime" type="jar"/>
</dependency>
- <dependency org="org.drools" name="drools-compiler" rev="4.0.7">
+ <dependency org="org.drools" name="drools-api" rev="5.0.0.CR1">
+ <artifact name="drools-api" type="jar"/>
+ </dependency>
+ <dependency org="org.drools" name="drools-compiler" rev="5.0.0.CR1">
<artifact name="drools-compiler" type="jar"/>
</dependency>
- <dependency org="org.drools" name="drools-core" rev="4.0.7">
+ <dependency org="org.drools" name="drools-core" rev="5.0.0.CR1">
<artifact name="drools-core" type="jar"/>
</dependency>
<dependency org="org.eclipse.jdt" name="core" rev="3.2.3.v_686_R32x">
@@ -111,8 +114,8 @@
<dependency org="org.jbpm" name="jbpm-jpdl" rev="3.2.2">
<artifact name="jbpm-jpdl" type="jar"/>
</dependency>
- <dependency org="org.mvel" name="mvel" rev="1.3.1-java1.5">
- <artifact name="mvel" type="jar"/>
+ <dependency org="org.mvel" name="mvel2" rev="2.0.8pre1">
+ <artifact name="mvel2" type="jar"/>
</dependency>
<dependency org="org.richfaces.framework" name="richfaces-api" rev="${richfaces.version}">
<artifact name="richfaces-api" type="jar"/>
15 years, 8 months
Seam SVN: r10240 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-03-30 18:03:44 -0400 (Mon, 30 Mar 2009)
New Revision: 10240
Modified:
trunk/src/main/org/jboss/seam/Component.java
Log:
another debug line - woops
Modified: trunk/src/main/org/jboss/seam/Component.java
===================================================================
--- trunk/src/main/org/jboss/seam/Component.java 2009-03-30 21:30:15 UTC (rev 10239)
+++ trunk/src/main/org/jboss/seam/Component.java 2009-03-30 22:03:44 UTC (rev 10240)
@@ -1435,10 +1435,6 @@
protected Object instantiateJavaBean() throws Exception
{
- if (name.equals("slowpoke")) {
- System.out.println("!instantiate " + name);
- }
-
Object bean = getBeanClass().newInstance();
if (interceptionEnabled) {
15 years, 8 months
Seam SVN: r10239 - trunk/src/pdf/org/jboss/seam/pdf/ui.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-03-30 17:30:15 -0400 (Mon, 30 Mar 2009)
New Revision: 10239
Modified:
trunk/src/pdf/org/jboss/seam/pdf/ui/UIChart.java
Log:
cleanup
Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIChart.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIChart.java 2009-03-30 19:39:14 UTC (rev 10238)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIChart.java 2009-03-30 21:30:15 UTC (rev 10239)
@@ -28,422 +28,378 @@
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.AsianFontMapper;
-public abstract class UIChart extends ITextComponent
-{
- private Image image = null;
- private JFreeChart chart = null;
-
- private byte[] imageData;
+public abstract class UIChart extends ITextComponent {
+ private Image image = null;
+ private JFreeChart chart = null;
- private int height = 300;
- private int width = 400;
+ private byte[] imageData;
- private boolean legend;
- private boolean is3D = false;
-
- private String title;
- private String borderBackgroundPaint;
- private String borderPaint;
- private String borderStroke;
- private boolean borderVisible = true;
+ private int height = 300;
+ private int width = 400;
- private String plotBackgroundPaint;
- private Float plotBackgroundAlpha;
- private Float plotForegroundAlpha;
- private String plotOutlineStroke;
- private String plotOutlinePaint;
+ private boolean legend;
+ private boolean is3D = false;
- protected Dataset dataset;
-
-
+ private String title;
+ private String borderBackgroundPaint;
+ private String borderPaint;
+ private String borderStroke;
+ private boolean borderVisible = true;
- public void setTitle(String title) {
- this.title = title;
- }
+ private String plotBackgroundPaint;
+ private Float plotBackgroundAlpha;
+ private Float plotForegroundAlpha;
+ private String plotOutlineStroke;
+ private String plotOutlinePaint;
- public String getTitle() {
- return (String) valueBinding("title", title);
- }
+ protected Dataset dataset;
- public void setHeight(int height)
- {
- this.height = height;
- }
+ public void setTitle(String title) {
+ this.title = title;
+ }
- public int getHeight()
- {
- return (Integer) valueBinding(FacesContext.getCurrentInstance(), "height", height);
- }
+ public String getTitle() {
+ return (String) valueBinding("title", title);
+ }
- public void setWidth(int width)
- {
- this.width = width;
- }
+ public void setHeight(int height) {
+ this.height = height;
+ }
- public int getWidth()
- {
- return (Integer) valueBinding(FacesContext.getCurrentInstance(), "width", width);
- }
-
- public void setLegend(boolean legend) {
- this.legend = legend;
- }
+ public int getHeight() {
+ return (Integer) valueBinding(FacesContext.getCurrentInstance(),
+ "height", height);
+ }
- public boolean getLegend() {
- return (Boolean) valueBinding("legend", legend);
- }
+ public void setWidth(int width) {
+ this.width = width;
+ }
- public void setIs3D(boolean is3D) {
- this.is3D = true;
- }
+ public int getWidth() {
+ return (Integer) valueBinding(FacesContext.getCurrentInstance(),
+ "width", width);
+ }
- public boolean getIs3D() {
- return (Boolean) valueBinding("is3D", is3D);
- }
+ public void setLegend(boolean legend) {
+ this.legend = legend;
+ }
+ public boolean getLegend() {
+ return (Boolean) valueBinding("legend", legend);
+ }
- public void setBorderBackgroundPaint(String backgroundPaint)
- {
- this.borderBackgroundPaint = backgroundPaint;
- }
+ public void setIs3D(boolean is3D) {
+ this.is3D = true;
+ }
- public String getBorderBackgroundPaint()
- {
- return (String) valueBinding(FacesContext.getCurrentInstance(), "borderBackgroundPaint", borderBackgroundPaint);
- }
+ public boolean getIs3D() {
+ return (Boolean) valueBinding("is3D", is3D);
+ }
- public void setBorderPaint(String borderPaint)
- {
- this.borderPaint = borderPaint;
- }
+ public void setBorderBackgroundPaint(String backgroundPaint) {
+ this.borderBackgroundPaint = backgroundPaint;
+ }
- public String getBorderPaint()
- {
- return (String) valueBinding(FacesContext.getCurrentInstance(), "borderPaint", borderPaint);
- }
+ public String getBorderBackgroundPaint() {
+ return (String) valueBinding(FacesContext.getCurrentInstance(),
+ "borderBackgroundPaint", borderBackgroundPaint);
+ }
- public void setBorderStroke(String borderStroke)
- {
- this.borderStroke = borderStroke;
- }
+ public void setBorderPaint(String borderPaint) {
+ this.borderPaint = borderPaint;
+ }
- public String getBorderStroke()
- {
- return (String) valueBinding(FacesContext.getCurrentInstance(), "borderStroke", borderStroke);
- }
+ public String getBorderPaint() {
+ return (String) valueBinding(FacesContext.getCurrentInstance(),
+ "borderPaint", borderPaint);
+ }
- public void setBorderVisible(boolean borderVisible)
- {
- this.borderVisible = borderVisible;
- }
+ public void setBorderStroke(String borderStroke) {
+ this.borderStroke = borderStroke;
+ }
- public boolean getBorderVisible()
- {
- return (Boolean) valueBinding(FacesContext.getCurrentInstance(), "borderVisible", borderVisible);
- }
+ public String getBorderStroke() {
+ return (String) valueBinding(FacesContext.getCurrentInstance(),
+ "borderStroke", borderStroke);
+ }
- public void setPlotBackgroundAlpha(Float plotBackgroundAlpha)
- {
- this.plotBackgroundAlpha = plotBackgroundAlpha;
- }
+ public void setBorderVisible(boolean borderVisible) {
+ this.borderVisible = borderVisible;
+ }
- public Float getPlotBackgroundAlpha()
- {
- return (Float) valueBinding(FacesContext.getCurrentInstance(), "plotBackgroundAlpha", plotBackgroundAlpha);
- }
+ public boolean getBorderVisible() {
+ return (Boolean) valueBinding(FacesContext.getCurrentInstance(),
+ "borderVisible", borderVisible);
+ }
- public void setPlotBackgroundPaint(String plotBackgroundPaint)
- {
- this.plotBackgroundPaint = plotBackgroundPaint;
- }
+ public void setPlotBackgroundAlpha(Float plotBackgroundAlpha) {
+ this.plotBackgroundAlpha = plotBackgroundAlpha;
+ }
- public String getPlotBackgroundPaint()
- {
- return (String) valueBinding(FacesContext.getCurrentInstance(), "plotBackgroundPaint", plotBackgroundPaint);
- }
+ public Float getPlotBackgroundAlpha() {
+ return (Float) valueBinding(FacesContext.getCurrentInstance(),
+ "plotBackgroundAlpha", plotBackgroundAlpha);
+ }
- public void setPlotForegroundAlpha(Float plotForegroundAlpha)
- {
- this.plotForegroundAlpha = plotForegroundAlpha;
- }
+ public void setPlotBackgroundPaint(String plotBackgroundPaint) {
+ this.plotBackgroundPaint = plotBackgroundPaint;
+ }
- public Float getPlotForegroundAlpha()
- {
- return (Float) valueBinding(FacesContext.getCurrentInstance(), "plotForegroundAlpha", plotForegroundAlpha);
- }
+ public String getPlotBackgroundPaint() {
+ return (String) valueBinding(FacesContext.getCurrentInstance(),
+ "plotBackgroundPaint", plotBackgroundPaint);
+ }
- public void setPlotOutlinePaint(String plotOutlinePaint)
- {
- this.plotOutlinePaint = plotOutlinePaint;
- }
+ public void setPlotForegroundAlpha(Float plotForegroundAlpha) {
+ this.plotForegroundAlpha = plotForegroundAlpha;
+ }
- public String getPlotOutlinePaint()
- {
- return (String) valueBinding(FacesContext.getCurrentInstance(), "plotOutlinePaint", plotOutlinePaint);
- }
+ public Float getPlotForegroundAlpha() {
+ return (Float) valueBinding(FacesContext.getCurrentInstance(),
+ "plotForegroundAlpha", plotForegroundAlpha);
+ }
- public void setPlotOutlineStroke(String plotOutlineStroke)
- {
- this.plotOutlineStroke = plotOutlineStroke;
- }
+ public void setPlotOutlinePaint(String plotOutlinePaint) {
+ this.plotOutlinePaint = plotOutlinePaint;
+ }
- public String getPlotOutlineStroke()
- {
- return (String) valueBinding(FacesContext.getCurrentInstance(), "plotOutlineStroke", plotOutlineStroke);
- }
+ public String getPlotOutlinePaint() {
+ return (String) valueBinding(FacesContext.getCurrentInstance(),
+ "plotOutlinePaint", plotOutlinePaint);
+ }
- public void setDataset(Dataset dataset) {
+ public void setPlotOutlineStroke(String plotOutlineStroke) {
+ this.plotOutlineStroke = plotOutlineStroke;
+ }
+
+ public String getPlotOutlineStroke() {
+ return (String) valueBinding(FacesContext.getCurrentInstance(),
+ "plotOutlineStroke", plotOutlineStroke);
+ }
+
+ public void setDataset(Dataset dataset) {
this.dataset = dataset;
- }
+ }
- public Dataset getDataset() {
- return (Dataset) valueBinding(FacesContext.getCurrentInstance(), "dataset", dataset);
- }
-
- @Override
- public void restoreState(FacesContext context, Object state)
- {
- Object[] values = (Object[]) state;
- super.restoreState(context, values[0]);
+ public Dataset getDataset() {
+ return (Dataset) valueBinding(FacesContext.getCurrentInstance(),
+ "dataset", dataset);
+ }
- height = (Integer) values[1];
- width = (Integer) values[2];
- borderBackgroundPaint = (String) values[3];
- borderPaint = (String) values[4];
- borderStroke = (String) values[5];
- borderVisible = (Boolean) values[6];
- plotBackgroundPaint = (String) values[7];
- plotBackgroundAlpha = (Float) values[8];
- plotForegroundAlpha = (Float) values[9];
- plotOutlineStroke = (String) values[10];
- plotOutlinePaint = (String) values[11];
- title = (String) values[12];
- is3D = (Boolean) values[13];
- legend = (Boolean) values[14];
- }
+ @Override
+ public void restoreState(FacesContext context, Object state) {
+ Object[] values = (Object[]) state;
+ super.restoreState(context, values[0]);
- @Override
- public Object saveState(FacesContext context)
- {
- Object[] values = new Object[15];
+ height = (Integer) values[1];
+ width = (Integer) values[2];
+ borderBackgroundPaint = (String) values[3];
+ borderPaint = (String) values[4];
+ borderStroke = (String) values[5];
+ borderVisible = (Boolean) values[6];
+ plotBackgroundPaint = (String) values[7];
+ plotBackgroundAlpha = (Float) values[8];
+ plotForegroundAlpha = (Float) values[9];
+ plotOutlineStroke = (String) values[10];
+ plotOutlinePaint = (String) values[11];
+ title = (String) values[12];
+ is3D = (Boolean) values[13];
+ legend = (Boolean) values[14];
+ }
- values[0] = super.saveState(context);
- values[1] = height;
- values[2] = width;
- values[3] = borderBackgroundPaint;
- values[4] = borderPaint;
- values[5] = borderStroke;
- values[6] = borderVisible;
- values[7] = plotBackgroundPaint;
- values[8] = plotBackgroundAlpha;
- values[9] = plotForegroundAlpha;
- values[10] = plotOutlineStroke;
- values[11] = plotOutlinePaint;
- values[12] = title;
- values[13] = is3D;
- values[14] = legend;
-
- return values;
- }
+ @Override
+ public Object saveState(FacesContext context) {
+ Object[] values = new Object[15];
- public static Paint findColor(String name)
- {
- if (name == null || name.length() == 0)
- {
- return null;
- }
- UIComponent component = FacesContext.getCurrentInstance().getViewRoot().findComponent(name);
+ values[0] = super.saveState(context);
+ values[1] = height;
+ values[2] = width;
+ values[3] = borderBackgroundPaint;
+ values[4] = borderPaint;
+ values[5] = borderStroke;
+ values[6] = borderVisible;
+ values[7] = plotBackgroundPaint;
+ values[8] = plotBackgroundAlpha;
+ values[9] = plotForegroundAlpha;
+ values[10] = plotOutlineStroke;
+ values[11] = plotOutlinePaint;
+ values[12] = title;
+ values[13] = is3D;
+ values[14] = legend;
- if (component != null)
- {
- if (component instanceof UIColor)
- {
- return ((UIColor) component).getPaint();
- }
- else
- {
- throw new RuntimeException();
- }
- }
+ return values;
+ }
- return ITextUtils.colorValue(name);
- }
+ public static Paint findColor(String name) {
+ if (name == null || name.length() == 0) {
+ return null;
+ }
+ UIComponent component = FacesContext.getCurrentInstance().getViewRoot()
+ .findComponent(name);
- public static Stroke findStroke(String id)
- {
- if (id == null || id.length() == 0)
- {
- return null;
- }
+ if (component != null) {
+ if (component instanceof UIColor) {
+ return ((UIColor) component).getPaint();
+ } else {
+ throw new RuntimeException();
+ }
+ }
- UIComponent component = FacesContext.getCurrentInstance().getViewRoot().findComponent(id);
+ return ITextUtils.colorValue(name);
+ }
- if (component instanceof UIStroke)
- {
- return ((UIStroke) component).getStroke();
- }
- else
- {
- throw new RuntimeException();
+ public static Stroke findStroke(String id) {
+ if (id == null || id.length() == 0) {
+ return null;
+ }
- }
- }
+ UIComponent component = FacesContext.getCurrentInstance().getViewRoot()
+ .findComponent(id);
- public abstract JFreeChart createChart(FacesContext context);
+ if (component instanceof UIStroke) {
+ return ((UIStroke) component).getStroke();
+ } else {
+ throw new RuntimeException();
- public JFreeChart getChart()
- {
- return chart;
- }
+ }
+ }
- @Override
- public void createITextObject(FacesContext context)
- {
+ public abstract JFreeChart createChart(FacesContext context);
- if (getBorderBackgroundPaint() != null)
- {
- chart.setBackgroundPaint(findColor(getBorderBackgroundPaint()));
- }
+ public JFreeChart getChart() {
+ return chart;
+ }
- if (getBorderPaint() != null)
- {
- chart.setBorderPaint(findColor(getBorderPaint()));
- }
+ @Override
+ public void createITextObject(FacesContext context) {
- if (getBorderStroke() != null)
- {
- chart.setBorderStroke(findStroke(getBorderStroke()));
- }
+ if (getBorderBackgroundPaint() != null) {
+ chart.setBackgroundPaint(findColor(getBorderBackgroundPaint()));
+ }
- chart.setBorderVisible(getBorderVisible());
+ if (getBorderPaint() != null) {
+ chart.setBorderPaint(findColor(getBorderPaint()));
+ }
- configurePlot(chart.getPlot());
+ if (getBorderStroke() != null) {
+ chart.setBorderStroke(findStroke(getBorderStroke()));
+ }
- try
- {
- UIDocument doc = (UIDocument) findITextParent(getParent(), UIDocument.class);
- if (doc != null) {
- PdfWriter writer = (PdfWriter) doc.getWriter();
- PdfContentByte cb = writer.getDirectContent();
- PdfTemplate tp = cb.createTemplate(getWidth(), getHeight());
+ chart.setBorderVisible(getBorderVisible());
+ configurePlot(chart.getPlot());
- UIFont font = (UIFont) findITextParent(this, UIFont.class);
+ try {
+ UIDocument doc = (UIDocument) findITextParent(getParent(),
+ UIDocument.class);
+ if (doc != null) {
+ PdfWriter writer = (PdfWriter) doc.getWriter();
+ PdfContentByte cb = writer.getDirectContent();
+ PdfTemplate tp = cb.createTemplate(getWidth(), getHeight());
- DefaultFontMapper fontMapper;
- if (font == null) {
- fontMapper = new DefaultFontMapper();
- } else {
- fontMapper = new AsianFontMapper(font.getName(), font.getEncoding());
- }
+ UIFont font = (UIFont) findITextParent(this, UIFont.class);
- Graphics2D g2 = tp.createGraphics(getWidth(), getHeight(), fontMapper);
- chart.draw(g2, new Rectangle2D.Double(0, 0, getWidth(), getHeight()));
- g2.dispose();
+ DefaultFontMapper fontMapper;
+ if (font == null) {
+ fontMapper = new DefaultFontMapper();
+ } else {
+ fontMapper = new AsianFontMapper(font.getName(), font.getEncoding());
+ }
- image = new ImgTemplate(tp);
- } else {
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- ChartUtilities.writeChartAsJPEG(stream, chart, getWidth(), getHeight());
+ Graphics2D g2 = tp.createGraphics(getWidth(), getHeight(), fontMapper);
+ chart.draw(g2, new Rectangle2D.Double(0, 0, getWidth(), getHeight()));
+ g2.dispose();
- imageData = stream.toByteArray();
- stream.close();
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
+ image = new ImgTemplate(tp);
+ } else {
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ ChartUtilities.writeChartAsJPEG(stream, chart, getWidth(),
+ getHeight());
- public void configurePlot(Plot plot)
- {
- if (getPlotBackgroundAlpha() != null)
- {
- plot.setBackgroundAlpha(getPlotBackgroundAlpha());
- }
- if (getPlotForegroundAlpha() != null)
- {
- plot.setForegroundAlpha(getPlotForegroundAlpha());
- }
- if (getPlotBackgroundPaint() != null)
- {
- plot.setBackgroundPaint(findColor(getPlotBackgroundPaint()));
- }
- if (getPlotOutlinePaint() != null)
- {
- plot.setOutlinePaint(findColor(getPlotOutlinePaint()));
- }
- if (getPlotOutlineStroke() != null)
- {
- plot.setOutlineStroke(findStroke(getPlotOutlineStroke()));
- }
- }
+ imageData = stream.toByteArray();
+ stream.close();
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
- public PlotOrientation plotOrientation(String orientation)
- {
- if (orientation != null && orientation.equalsIgnoreCase("horizontal"))
- {
- return PlotOrientation.HORIZONTAL;
- }
- else
- {
- return PlotOrientation.VERTICAL;
- }
- }
+ public void configurePlot(Plot plot) {
+ if (getPlotBackgroundAlpha() != null) {
+ plot.setBackgroundAlpha(getPlotBackgroundAlpha());
+ }
+ if (getPlotForegroundAlpha() != null) {
+ plot.setForegroundAlpha(getPlotForegroundAlpha());
+ }
+ if (getPlotBackgroundPaint() != null) {
+ plot.setBackgroundPaint(findColor(getPlotBackgroundPaint()));
+ }
+ if (getPlotOutlinePaint() != null) {
+ plot.setOutlinePaint(findColor(getPlotOutlinePaint()));
+ }
+ if (getPlotOutlineStroke() != null) {
+ plot.setOutlineStroke(findStroke(getPlotOutlineStroke()));
+ }
+ }
- @Override
- public void encodeBegin(FacesContext context) throws IOException
- {
- dataset = getDataset();
- // bypass super to avoid createITextObject() before the chart is ready
- if (dataset == null) {
- dataset = createDataset();
- }
- chart = createChart(context);
- }
+ public PlotOrientation plotOrientation(String orientation) {
+ if (orientation != null && orientation.equalsIgnoreCase("horizontal")) {
+ return PlotOrientation.HORIZONTAL;
+ } else {
+ return PlotOrientation.VERTICAL;
+ }
+ }
- @Override
- public void encodeEnd(FacesContext context) throws IOException
- {
- // call create here so that we'll have a valid chart
- createITextObject(context);
+ @Override
+ public void encodeBegin(FacesContext context) throws IOException {
+ dataset = getDataset();
+ // bypass super to avoid createITextObject() before the chart is ready
+ if (dataset == null) {
+ dataset = createDataset();
+ }
+ chart = createChart(context);
+ }
- if (imageData != null)
- {
- ResponseWriter response = context.getResponseWriter();
- response.startElement("img", null);
- GraphicImageStore store = GraphicImageStore.instance();
- String key = store.put(new ImageWrapper(imageData, Type.IMAGE_JPEG));
- String url = context.getExternalContext().getRequestContextPath() + GraphicImageResource.GRAPHIC_IMAGE_RESOURCE_PATH + "/" + key + Type.IMAGE_JPEG.getExtension();
+ @Override
+ public void encodeEnd(FacesContext context) throws IOException {
+ // call create here so that we'll have a valid chart
+ createITextObject(context);
- response.writeAttribute("src", url, null);
+ if (imageData != null) {
+ ResponseWriter response = context.getResponseWriter();
+ response.startElement("img", null);
+ GraphicImageStore store = GraphicImageStore.instance();
+ String key = store.put(new ImageWrapper(imageData, Type.IMAGE_JPEG));
+ String url = context.getExternalContext().getRequestContextPath()
+ + GraphicImageResource.GRAPHIC_IMAGE_RESOURCE_PATH + "/"
+ + key + Type.IMAGE_JPEG.getExtension();
- response.writeAttribute("height", getHeight(), null);
- response.writeAttribute("width", getWidth(), null);
+ response.writeAttribute("src", url, null);
- response.endElement("img");
- }
+ response.writeAttribute("height", getHeight(), null);
+ response.writeAttribute("width", getWidth(), null);
- super.encodeEnd(context);
- }
+ response.endElement("img");
+ }
- @Override
- public Object getITextObject()
- {
- return image;
- }
+ super.encodeEnd(context);
+ }
- @Override
- public void handleAdd(Object arg0)
- {
- throw new RuntimeException("No children allowed");
- }
+ @Override
+ public Object getITextObject() {
+ return image;
+ }
- @Override
- public void removeITextObject()
- {
- image = null;
- chart = null;
- }
+ @Override
+ public void handleAdd(Object arg0) {
+ throw new RuntimeException("No children allowed");
+ }
- public abstract Dataset createDataset();
+ @Override
+ public void removeITextObject() {
+ image = null;
+ chart = null;
+ }
+
+ public abstract Dataset createDataset();
}
15 years, 8 months