JBoss Rich Faces SVN: r3744 - in trunk/sandbox/ui/orderingList/src/main: java/org/richfaces/component and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-04 23:26:31 -0500 (Sun, 04 Nov 2007)
New Revision: 3744
Added:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/ArrayUtil.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/MessageFactory.java
Modified:
trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js
trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
Log:
orderingList development boost
Modified: trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml 2007-11-05 04:26:21 UTC (rev 3743)
+++ trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml 2007-11-05 04:26:31 UTC (rev 3744)
@@ -132,5 +132,26 @@
</description>
<defaultvalue>true</defaultvalue>
</property>
+
+ <property hidden="true" el="false">
+ <name>submittedValue</name>
+ </property>
+ <property hidden="true" el="false">
+ <name>localValueSet</name>
+ </property>
+ <property hidden="true" el="false">
+ <name>valid</name>
+ </property>
+ <property elonly="true">
+ <name>validator</name>
+ <classname>javax.faces.el.MethodBinding</classname>
+ <methodargs>javax.faces.event.ValueChangeEvent</methodargs>
+ </property>
</component>
+
+ <listener>
+ <componentclass>javax.faces.component.EditableValueHolder</componentclass>
+ <eventclass>javax.faces.event.ValueChangeEvent</eventclass>
+ <name>valueChangeListener</name>
+ </listener>
</components>
Added: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/ArrayUtil.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/ArrayUtil.java (rev 0)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/ArrayUtil.java 2007-11-05 04:26:31 UTC (rev 3744)
@@ -0,0 +1,83 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 05.11.2007
+ *
+ * @since 3.2
+ */
+class ArrayUtil {
+
+ final static void copy(Object out, Object in, int[] indexes) {
+ if (in instanceof int[]) {
+ copy((int[])out, (int[])in, indexes);
+ } else if (in instanceof short[]) {
+ copy((short[])out, (short[])in, indexes);
+ } else if (in instanceof byte[]) {
+ copy((byte[])out, (byte[])in, indexes);
+ } else if (in instanceof boolean[]) {
+ copy((boolean[])out, (boolean[])in, indexes);
+ } else if (in instanceof char[]) {
+ copy((char[])out, (char[])in, indexes);
+ } else if (in instanceof float[]) {
+ copy((float[])out, (float[])in, indexes);
+ } else if (in instanceof double[]) {
+ copy((double[])out, (double[])in, indexes);
+ } else if (in instanceof long[]) {
+ copy((long[])out, (long[])in, indexes);
+ } else {
+ copy((Object[])out, (Object[])in, indexes);
+ }
+ }
+
+ final static void copy(Object[] out, Object[] in, int[] indexes) {
+ for (int i = 0; i < indexes.length; i++) {
+ out[i] = in[indexes[i]];
+ }
+ }
+ final static void copy(int[] out, int[] in, int[] indexes) {
+ for (int i = 0; i < indexes.length; i++) {
+ out[i] = in[indexes[i]];
+ }
+ }
+ final static void copy(short[] out, short[] in, int[] indexes) {
+ for (int i = 0; i < indexes.length; i++) {
+ out[i] = in[indexes[i]];
+ }
+ }
+ final static void copy(byte[] out, byte[] in, int[] indexes) {
+ for (int i = 0; i < indexes.length; i++) {
+ out[i] = in[indexes[i]];
+ }
+ }
+ final static void copy(boolean[] out, boolean[] in, int[] indexes) {
+ for (int i = 0; i < indexes.length; i++) {
+ out[i] = in[indexes[i]];
+ }
+ }
+ final static void copy(char[] out, char[] in, int[] indexes) {
+ for (int i = 0; i < indexes.length; i++) {
+ out[i] = in[indexes[i]];
+ }
+ }
+ final static void copy(float[] out, float[] in, int[] indexes) {
+ for (int i = 0; i < indexes.length; i++) {
+ out[i] = in[indexes[i]];
+ }
+ }
+ final static void copy(double[] out, double[] in, int[] indexes) {
+ for (int i = 0; i < indexes.length; i++) {
+ out[i] = in[indexes[i]];
+ }
+ }
+ final static void copy(long[] out, long[] in, int[] indexes) {
+ for (int i = 0; i < indexes.length; i++) {
+ out[i] = in[indexes[i]];
+ }
+ }
+}
Added: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/MessageFactory.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/MessageFactory.java (rev 0)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/MessageFactory.java 2007-11-05 04:26:31 UTC (rev 3744)
@@ -0,0 +1,22 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 05.11.2007
+ * @since 3.2
+ */
+public class MessageFactory {
+
+ public static FacesMessage getMessage(FacesContext context,
+ String conversionMessageId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-05 04:26:21 UTC (rev 3743)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-05 04:26:31 UTC (rev 3744)
@@ -1,9 +1,34 @@
package org.richfaces.component;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.ValueBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.event.ValueChangeListener;
+import javax.faces.model.DataModel;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
import org.ajax4jsf.component.UIDataAdaptor;
import org.ajax4jsf.model.DataComponentState;
@@ -14,33 +39,117 @@
import org.apache.commons.collections.iterators.EmptyIterator;
import org.apache.commons.collections.iterators.FilterIterator;
-public abstract class UIOrderingList extends UIDataAdaptor {
+public abstract class UIOrderingList extends UIDataAdaptor implements EditableValueHolder {
- private List synchronizedList;
-
- private List selectedItems;
-
- private Object activeItem;
-
public static final Predicate isColumn = new ColumnPredicate();
-
+
private static final class ColumnPredicate implements Predicate {
public boolean evaluate(Object input) {
return (input instanceof UIColumn || input instanceof Column);
}
}
-
- @Override
+
protected DataComponentState createComponentState() {
return new RepeatState();
}
- @Override
protected ExtendedDataModel createDataModel() {
- return new SequenceDataModel(super.getDataModel());
+ try {
+ insideCreateDataModel = true;
+
+ return new SequenceDataModel(super.getDataModel());
+ } finally {
+ insideCreateDataModel = false;
+ }
}
- @Override
+ private boolean insideCreateDataModel;
+
+ private DataModel getPermutatedDataModel(final DataModel dataModel) {
+
+ if (submittedValue == null) {
+ return dataModel;
+ } else {
+ return new DataModel() {
+
+ private int rowIndex = -1;
+ private int[] indexes;
+
+ {
+ String[] valueOrder = ((String) submittedValue).split(",");
+ for (int i = 0; i < valueOrder.length; i++) {
+ String[] currentOrder = valueOrder[i].split("d+");
+
+ try {
+ indexes[i] = Integer.valueOf(currentOrder[0]).intValue();
+ } catch (NumberFormatException e) {
+ // TODO: handle exception
+ }
+
+// Object currentItem = oldValues.get(itemIndex.intValue());
+// synchronizedList.add(currentItem);
+//
+// if (currentOrder.length > 1) {
+// Iterator it = Arrays.asList(currentOrder[1].toCharArray()).iterator();
+// while (it.hasNext()) {
+// Character marker = (Character) it.next();
+// if (ACTIVITY_MARKER.equals(marker)) {
+// activeItem = currentItem;
+// } else if (SELECTION_MARKER.equals(marker)) {
+// selectedItems.add(currentItem);
+// }
+// }
+// }
+ }
+ }
+
+ @Override
+ public int getRowCount() {
+ return dataModel.getRowCount();
+ }
+
+ @Override
+ public Object getRowData() {
+ return dataModel.getRowData();
+ }
+
+ @Override
+ public int getRowIndex() {
+ return rowIndex;
+ }
+
+ @Override
+ public Object getWrappedData() {
+ return dataModel.getWrappedData();
+ }
+
+ @Override
+ public boolean isRowAvailable() {
+ return dataModel.isRowAvailable();
+ }
+
+ @Override
+ public void setRowIndex(int rowIndex) {
+ if (rowIndex < -1) {
+ throw new IllegalArgumentException();
+ }
+
+ if (rowIndex < indexes.length) {
+ dataModel.setRowIndex(indexes[rowIndex]);
+ }
+
+ this.rowIndex = rowIndex;
+ }
+
+ @Override
+ public void setWrappedData(Object data) {
+ dataModel.setWrappedData(data);
+ }
+
+ };
+ }
+ }
+
protected Iterator dataChildren() {
if (getChildCount() != 0) {
return getChildren().iterator();
@@ -49,7 +158,6 @@
}
}
- @Override
protected Iterator fixedChildren() {
if (getFacetCount() != 0) {
return getFacets().values().iterator();
@@ -58,31 +166,699 @@
}
}
- public List getSynchronizedList() {
- return synchronizedList;
+ public Iterator columns() {
+ return new FilterIterator(getChildren().iterator(), isColumn);
}
- public void setSynchronizedList(List synchronizedList) {
- this.synchronizedList = synchronizedList;
+ private List validators = null;
+ private MethodBinding validator;
+
+ private Object value;
+ private boolean localValueSet;
+
+ private Object submittedValue;
+
+ public void restoreState(FacesContext faces, Object object) {
+ Object[] state = (Object[]) object;
+ super.restoreState(faces, state[0]);
+ validators = (List) restoreAttachedState(faces, state[1]);
+ validator = (MethodBinding) restoreAttachedState(faces, state[2]);
+ value = state[3];
+ localValueSet = ((Boolean) state[4]).booleanValue();
}
- public List getSelectedItems() {
- return selectedItems;
+ public Object saveState(FacesContext faces) {
+ Object[] state = new Object[5];
+ state[0] = super.saveState(faces);
+ state[1] = saveAttachedState(faces, validators);
+ state[2] = saveAttachedState(faces, validator);
+ state[3] = value;
+ state[4] = localValueSet ? Boolean.TRUE : Boolean.FALSE;
+
+ return state;
}
- public void setSelectedItems(List selectedItems) {
- this.selectedItems = selectedItems;
+ public void addValidator(Validator validator) {
+ if (validator == null) {
+ throw new NullPointerException();
+ }
+
+ if (validators == null) {
+ validators = new ArrayList();
+ }
+
+ validators.add(validator);
}
- public Object getActiveItem() {
- return activeItem;
+ public void addValueChangeListener(ValueChangeListener listener) {
+ addFacesListener(listener);
}
- public void setActiveItem(Object activeItem) {
- this.activeItem = activeItem;
+ public MethodBinding getValidator() {
+ return validator;
}
+
+ public Validator[] getValidators() {
+ if (validators == null) {
+ return new Validator[0];
+ } else {
+ return (Validator[]) validators.toArray(new Validator[validators.size()]);
+ }
+ }
+
+ public abstract MethodBinding getValueChangeListener();
+
+ public ValueChangeListener[] getValueChangeListeners() {
+ return (ValueChangeListener[]) getFacesListeners(ValueChangeListener.class);
+ }
+
+ public abstract boolean isImmediate();
+
+ public boolean isLocalValueSet() {
+ return localValueSet;
+ }
+
+ public void setLocalValueSet(boolean localValueSet) {
+ this.localValueSet = localValueSet;
+ }
+
+ public abstract boolean isRequired();
+
+ public abstract boolean isValid();
+
+ public void removeValidator(Validator validator) {
+ if (validators != null) {
+ validators.remove(validator);
+ }
+ }
+
+ public void removeValueChangeListener(ValueChangeListener listener) {
+ removeFacesListener(listener);
+ }
- public Iterator columns() {
- return new FilterIterator(getChildren().iterator(), isColumn);
+ public Object getSubmittedValue() {
+ return submittedValue;
}
+
+ public void setSubmittedValue(Object submittedValue) {
+ this.submittedValue = submittedValue;
+ }
+
+ public abstract void setImmediate(boolean immediate);
+
+ public abstract void setRequired(boolean required);
+
+ public abstract void setValid(boolean valid);
+
+ public void setValidator(MethodBinding validatorBinding) {
+ this.validator = validatorBinding;
+ }
+
+ public abstract void setValueChangeListener(MethodBinding valueChangeMethod);
+
+ public abstract Converter getConverter();
+
+ public abstract void setConverter(Converter converter);
+
+
+ public Object getLocalValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ setLocalValueSet(true);
+ }
+
+ private Object getComponentValue() {
+ if (this.value != null) {
+ return (this.value);
+ }
+ ValueBinding ve = getValueBinding("value");
+ if (ve != null) {
+ return (ve.getValue(getFacesContext()));
+ } else {
+ return (null);
+ }
+ }
+
+ public Object getValue() {
+ if (insideCreateDataModel) {
+ if (submittedValue != null) {
+ return getConvertedValue();
+ }
+ }
+
+ return getComponentValue();
+ }
+
+
+ /**
+ * <p>Specialized decode behavior on top of that provided by the
+ * superclass. In addition to the standard
+ * <code>processDecodes</code> behavior inherited from {@link
+ * UIComponentBase}, calls <code>validate()</code> if the the
+ * <code>immediate</code> property is true; if the component is
+ * invalid afterwards or a <code>RuntimeException</code> is thrown,
+ * calls {@link FacesContext#renderResponse}. </p>
+ * @exception NullPointerException {@inheritDoc}
+ */
+ public void processDecodes(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Skip processing if our rendered flag is false
+ if (!isRendered()) {
+ return;
+ }
+
+ super.processDecodes(context);
+
+ if (isImmediate()) {
+ executeValidate(context);
+ }
+ }
+
+ /**
+ * <p>In addition to the standard <code>processValidators</code> behavior
+ * inherited from {@link UIComponentBase}, calls <code>validate()</code>
+ * if the <code>immediate</code> property is false (which is the
+ * default); if the component is invalid afterwards, calls
+ * {@link FacesContext#renderResponse}.
+ * If a <code>RuntimeException</code> is thrown during
+ * validation processing, calls {@link FacesContext#renderResponse}
+ * and re-throw the exception.
+ * </p>
+ * @exception NullPointerException {@inheritDoc}
+ */
+ public void processValidators(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Skip processing if our rendered flag is false
+ if (!isRendered()) {
+ return;
+ }
+
+ super.processValidators(context);
+ if (!isImmediate()) {
+ executeValidate(context);
+ }
+ }
+
+ /**
+ * <p>In addition to the standard <code>processUpdates</code> behavior
+ * inherited from {@link UIComponentBase}, calls
+ * <code>updateModel()</code>.
+ * If the component is invalid afterwards, calls
+ * {@link FacesContext#renderResponse}.
+ * If a <code>RuntimeException</code> is thrown during
+ * update processing, calls {@link FacesContext#renderResponse}
+ * and re-throw the exception.
+ * </p>
+ * @exception NullPointerException {@inheritDoc}
+ */
+ public void processUpdates(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Skip processing if our rendered flag is false
+ if (!isRendered()) {
+ return;
+ }
+
+ super.processUpdates(context);
+
+ try {
+ updateModel(context);
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+ }
+
+ if (!isValid()) {
+ context.renderResponse();
+ }
+ }
+
+ /**
+ * @exception NullPointerException {@inheritDoc}
+ */
+ public void decode(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Force validity back to "true"
+ setValid(true);
+ super.decode(context);
+ }
+
+ /**
+ * <p>In addition to to the default {@link UIComponent#broadcast}
+ * processing, pass the {@link ValueChangeEvent} being broadcast to the
+ * method referenced by <code>valueChangeListener</code> (if any).</p>
+ *
+ * @param event {@link FacesEvent} to be broadcast
+ *
+ * @exception AbortProcessingException Signal the JavaServer Faces
+ * implementation that no further processing on the current event
+ * should be performed
+ * @exception IllegalArgumentException if the implementation class
+ * of this {@link FacesEvent} is not supported by this component
+ * @exception NullPointerException if <code>event</code> is
+ * <code>null</code>
+ */
+ public void broadcast(FacesEvent event)
+ throws AbortProcessingException {
+
+ // Perform standard superclass processing
+ super.broadcast(event);
+
+ if (event instanceof ValueChangeEvent) {
+ MethodBinding method = getValueChangeListener();
+ if (method != null) {
+ FacesContext context = getFacesContext();
+ method.invoke(context, new Object[] { event });
+ }
+ }
+
+ }
+
+
+ /**
+ * <p>Perform the following algorithm to update the model data
+ * associated with this {@link UIInput}, if any, as appropriate.</p>
+ * <ul>
+ * <li>If the <code>valid</code> property of this component is
+ * <code>false</code>, take no further action.</li>
+ * <li>If the <code>localValueSet</code> property of this component is
+ * <code>false</code>, take no further action.</li>
+ * <li>If no {@link ValueBinding} for <code>value</code> exists,
+ * take no further action.</li>
+ * <li>Call <code>setValue()</code> method of the {@link ValueBinding}
+ * to update the value that the {@link ValueBinding} points at.</li>
+ * <li>If the <code>setValue()</code> method returns successfully:
+ * <ul>
+ * <li>Clear the local value of this {@link UIInput}.</li>
+ * <li>Set the <code>localValueSet</code> property of this
+ * {@link UIInput} to false.</li>
+ * </ul></li>
+ * <li>If the <code>setValue()</code> method call fails:
+ * <ul>
+ * <li>Enqueue an error message by calling <code>addMessage()</code>
+ * on the specified {@link FacesContext} instance.</li>
+ * <li>Set the <code>valid</code> property of this {@link UIInput}
+ * to <code>false</code>.</li>
+ * </ul></li>
+ * </ul>
+ *
+ * @param context {@link FacesContext} for the request we are processing
+ *
+ * @exception NullPointerException if <code>context</code>
+ * is <code>null</code>
+ */
+ public void updateModel(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ if (!isValid() || !isLocalValueSet()) {
+ return;
+ }
+
+ ValueBinding vb = getValueBinding("value");
+ if (vb != null) {
+ try {
+ vb.setValue(context, getLocalValue());
+ setValue(null);
+ setLocalValueSet(false);
+ return;
+ } catch (EvaluationException e) {
+ String messageStr = e.getMessage();
+ FacesMessage message = null;
+ if (null == messageStr) {
+ message =
+ MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
+ }
+ else {
+ message = new FacesMessage(messageStr);
+ }
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ setValid(false);
+ }
+ catch (FacesException e) {
+ FacesMessage message =
+ MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ setValid(false);
+ } catch (IllegalArgumentException e) {
+ FacesMessage message =
+ MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ setValid(false);
+ } catch (Exception e) {
+ FacesMessage message =
+ MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ setValid(false);
+ }
+ }
+ }
+
+
+ // ------------------------------------------------------ Validation Methods
+
+
+ /**
+ * <p>Perform the following algorithm to validate the local value of
+ * this {@link UIInput}.</p>
+ * <ul>
+ * <li>Retrieve the submitted value with <code>getSubmittedValue()</code>.
+ * If this returns null, exit without further processing. (This
+ * indicates that no value was submitted for this component.)</li>
+ *
+ * <li> Convert the submitted value into a "local value" of the
+ * appropriate data type by calling {@link #getConvertedValue}.</li>
+ *
+ * <li>Validate the property by calling {@link #validateValue}.</li>
+ *
+ * <li>If the <code>valid</code> property of this component is still
+ * <code>true</code>, retrieve the previous value of the component
+ * (with <code>getValue()</code>), store the new local value using
+ * <code>setValue()</code>, and reset the submitted value to
+ * null. If the local value is different from
+ * the previous value of this component, fire a
+ * {@link ValueChangeEvent} to be broadcast to all interested
+ * listeners.</li>
+ * </ul>
+ *
+ * <p>Application components implementing {@link UIInput} that wish to
+ * perform validation with logic embedded in the component should perform
+ * their own correctness checks, and then call the
+ * <code>super.validate()</code> method to perform the standard
+ * processing described above.</p>
+ *
+ * @param context The {@link FacesContext} for the current request
+ *
+ * @exception NullPointerException if <code>context</code>
+ * is null
+ */
+ public void validate(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Submitted value == null means "the component was not submitted
+ // at all"; validation should not continue
+ Object submittedValue = getSubmittedValue();
+ if (submittedValue == null) {
+ return;
+ }
+
+ Object newValue = null;
+
+ try {
+ newValue = getConvertedValue();
+ }
+ catch (ConverterException ce) {
+ addConversionErrorMessage(context, ce, submittedValue);
+ setValid(false);
+ }
+
+ validateValue(context, newValue);
+
+ // If our value is valid, store the new value, erase the
+ // "submitted" value, and emit a ValueChangeEvent if appropriate
+ if (isValid()) {
+ Object previous = getValue();
+ setValue(newValue);
+ setSubmittedValue(null);
+ if (compareValues(previous, newValue)) {
+ queueEvent(new ValueChangeEvent(this, previous, newValue));
+ }
+ }
+
+ }
+
+ protected Object getConvertedValue() throws ConverterException {
+ if (submittedValue instanceof String) {
+ Object componentValue = getComponentValue();
+ if (componentValue == null) {
+ return Collections.EMPTY_LIST;
+ }
+
+ String[] valueOrder = ((String) submittedValue).split(",");
+ int[] indexes = new int[valueOrder.length];
+ for (int i = 0; i < valueOrder.length; i++) {
+ Matcher matcher = Pattern.compile("(\\d+)(s)?(a)?").matcher(valueOrder[i]);
+ matcher.matches();
+
+ try {
+ indexes[i] = Integer.valueOf(matcher.group(1)).intValue();
+ } catch (NumberFormatException e) {
+ // TODO: handle exception
+ }
+
+// Object currentItem = oldValues.get(itemIndex.intValue());
+// synchronizedList.add(currentItem);
+//
+// if (currentOrder.length > 1) {
+// Iterator it = Arrays.asList(currentOrder[1].toCharArray()).iterator();
+// while (it.hasNext()) {
+// Character marker = (Character) it.next();
+// if (ACTIVITY_MARKER.equals(marker)) {
+// activeItem = currentItem;
+// } else if (SELECTION_MARKER.equals(marker)) {
+// selectedItems.add(currentItem);
+// }
+// }
+// }
+ }
+
+ if (componentValue instanceof List) {
+ List list = (List) componentValue;
+ ArrayList arrayList = new ArrayList(list.size());
+ for (int i = 0; i < indexes.length; i++) {
+ int j = indexes[i];
+ arrayList.add(list.get(j));
+ }
+ submittedValue = arrayList;
+ } else {
+ submittedValue = Array.newInstance(componentValue.getClass().getComponentType(),
+ Array.getLength(componentValue));
+ ArrayUtil.copy(submittedValue,
+ componentValue, indexes);
+ }
+ }
+
+ return submittedValue;
+ }
+
+ /**
+ *
+ * <p>Set the "valid" property according to the below algorithm.</p>
+ *
+ * <ul>
+ *
+ * <li>If the <code>valid</code> property on this component is still
+ * <code>true</code>, and the <code>required</code> property is also
+ * true, ensure that the local value is not empty (where "empty" is
+ * defined as <code>null</code> or a zero-length String. If the local
+ * value is empty:
+ * <ul>
+ * <li>Enqueue an appropriate error message by calling the
+ * <code>addMessage()</code> method on the <code>FacesContext</code>
+ * instance for the current request.</li>
+ * <li>Set the <code>valid</code> property on this component to
+ * <code>false</code>.</li>
+ * </ul></li>
+ * <li>If the <code>valid</code> property on this component is still
+ * <code>true</code>, and the local value is not empty, call the
+ * <code>validate()</code> method of each {@link Validator}
+ * registered for this {@link UIInput}, followed by the method
+ * pointed at by the <code>validatorBinding</code> property (if any).
+ * If any of these validators or the method throws a
+ * {@link ValidatorException}, catch the exception, add
+ * its message (if any) to the {@link FacesContext}, and set
+ * the <code>valid</code> property of this component to false.</li>
+ *
+ * </ul>
+ *
+ */
+
+ protected void validateValue(FacesContext context, Object newValue) {
+ // If our value is valid, enforce the required property if present
+ if (isValid() && isRequired() && isEmpty(newValue)) {
+ FacesMessage message =
+ MessageFactory.getMessage(context, UIInput.REQUIRED_MESSAGE_ID);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ setValid(false);
+ }
+
+ // If our value is valid and not empty, call all validators
+ if (isValid() && !isEmpty(newValue)) {
+ if (this.validators != null) {
+ Iterator validators = this.validators.iterator();
+ while (validators.hasNext()) {
+ Validator validator = (Validator) validators.next();
+ try {
+ validator.validate(context, this, newValue);
+ }
+ catch (ValidatorException ve) {
+ // If the validator throws an exception, we're
+ // invalid, and we need to add a message
+ setValid(false);
+ FacesMessage message = ve.getFacesMessage();
+ if (message != null) {
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ }
+ }
+ }
+ }
+ if (validator != null) {
+ try {
+ validator.invoke(context,
+ new Object[] { context, this, newValue});
+ }
+ catch (EvaluationException ee) {
+ if (ee.getCause() instanceof ValidatorException) {
+ ValidatorException ve =
+ (ValidatorException) ee.getCause();
+
+ // If the validator throws an exception, we're
+ // invalid, and we need to add a message
+ setValid(false);
+ FacesMessage message = ve.getFacesMessage();
+ if (message != null) {
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ }
+ } else {
+ // Otherwise, rethrow the EvaluationException
+ throw ee;
+ }
+ }
+ }
+ }
+ }
+
+
+
+ /**
+ * <p>Return <code>true</code> if the new value is different from the
+ * previous value.</p>
+ *
+ * @param previous old value of this component (if any)
+ * @param value new value of this component (if any)
+ */
+ protected boolean compareValues(Object previous, Object value) {
+
+ if (previous == null) {
+ return (value != null);
+ } else if (value == null) {
+ return (true);
+ } else {
+ return (!(previous.equals(value)));
+ }
+
+ }
+
+
+ /**
+ * Executes validation logic.
+ */
+ private void executeValidate(FacesContext context) {
+ try {
+ validate(context);
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+ }
+
+ if (!isValid()) {
+ context.renderResponse();
+ }
+ }
+
+ private boolean isEmpty(Object value) {
+
+ if (value == null) {
+ return (true);
+ } else if ((value instanceof String) &&
+ (((String) value).length() < 1)) {
+ return (true);
+ } else if (value.getClass().isArray()) {
+ if (0 == java.lang.reflect.Array.getLength(value)) {
+ return (true);
+ }
+ }
+ else if (value instanceof List) {
+ if (0 == ((List) value).size()) {
+ return (true);
+ }
+ }
+ return (false);
+ }
+
+
+ private Converter getConverterWithType(FacesContext context) {
+ Converter converter = getConverter();
+ if (converter != null) {
+ return converter;
+ }
+
+ ValueBinding valueBinding = getValueBinding("value");
+ if (valueBinding == null) {
+ return null;
+ }
+
+ Class converterType = valueBinding.getType(context);
+ // if converterType is null, String, or Object, assume
+ // no conversion is needed
+ if (converterType == null ||
+ converterType == String.class ||
+ converterType == Object.class) {
+ return null;
+ }
+
+ // if getType returns a type for which we support a default
+ // conversion, acquire an appropriate converter instance.
+ try {
+ Application application = context.getApplication();
+ return application.createConverter(converterType);
+ } catch (Exception e) {
+ return (null);
+ }
+ }
+
+ private void addConversionErrorMessage(FacesContext context,
+ ConverterException ce, Object value) {
+ FacesMessage message = ce.getFacesMessage();
+ if (message == null) {
+ message = MessageFactory.getMessage(context,
+ UIInput.CONVERSION_MESSAGE_ID);
+ if (message.getDetail() == null) {
+ message.setDetail(ce.getMessage());
+ }
+ }
+
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ }
}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-05 04:26:21 UTC (rev 3743)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-05 04:26:31 UTC (rev 3744)
@@ -21,8 +21,6 @@
public abstract class OrderingListRendererBase extends AbstractRowsRenderer {
- private final static String VALUE_ORDER_ID_PREFIX = "valueKeeper";
-
private final static Character ACTIVITY_MARKER = 'a';
private final static Character SELECTION_MARKER = 's';
@@ -109,7 +107,6 @@
}
}
- @Override
public void encodeOneRow(FacesContext context, TableHolder holder)
throws IOException {
@@ -145,12 +142,10 @@
Map requestParameterMap = context.getExternalContext()
.getRequestParameterMap();
- String valueOrder = (String) requestParameterMap.get(clientId.concat(VALUE_ORDER_ID_PREFIX));
+ String valueOrder = (String) requestParameterMap.get(clientId);
- if (valueOrder != null) {
- String[] valueOrderAr = valueOrder.split(ITEM_SEPARATOR);
- List oldValues = (List) orderingList.getValue();
- valuesSynchronization(valueOrderAr, oldValues);
+ if (valueOrder != null && valueOrder.length() != 0) {
+ orderingList.setSubmittedValue(valueOrder);
}
}
Modified: trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js 2007-11-05 04:26:21 UTC (rev 3743)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js 2007-11-05 04:26:31 UTC (rev 3744)
@@ -20,6 +20,8 @@
LayoutManager.prototype.widthSynchronization = function() {
var contentCells = this.contentTable.tBodies[0].rows[0].cells;
+ if (!this.headerTable || !this.headerTable.tHead)
+ return ;
var headerCells = this.headerTable.tHead.rows[0].cells;
var width;
for (var i = 0; i < contentCells.length; i++) {
Modified: trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-05 04:26:21 UTC (rev 3743)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-05 04:26:31 UTC (rev 3744)
@@ -123,6 +123,11 @@
}
}
+ this.shuttleItems = new Array();
+ for (var i = 0; i < rows.length; i++) {
+ this.shuttleItems.push(rows[i].item);
+ }
+
this.saveState();
}
}
Modified: trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js 2007-11-05 04:26:21 UTC (rev 3743)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js 2007-11-05 04:26:31 UTC (rev 3744)
@@ -1,6 +1,7 @@
SelectItem = function(label, id, selected, node) {
this._label = label;
this._node = node;
+ this._node.item = this;
this._id = id;
this._selected = selected;
}
\ No newline at end of file
Modified: trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2007-11-05 04:26:21 UTC (rev 3743)
+++ trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2007-11-05 04:26:31 UTC (rev 3744)
@@ -32,7 +32,7 @@
<div id="#{clientId}" onclick="Shuttle.setFocus('#{clientId}focusKeeper')">
<input id="#{clientId}focusKeeper" type="button" value="" style="position: absolute; left: -32767;" name="focusKeeper"/>
- <input id="#{clientId}valueKeeper" type="hidden" name="valueKeeper" value=""/>
+ <input id="#{clientId}valueKeeper" type="hidden" name="#{clientId}" value=""/>
<table id="#{clientId}table" cellpadding="0" cellspacing="0" class="ol_body">
<tr>
17 years, 1 month
JBoss Rich Faces SVN: r3743 - trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-04 23:26:21 -0500 (Sun, 04 Nov 2007)
New Revision: 3743
Modified:
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
Log:
orderingList development boost
Modified: trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java 2007-11-02 22:37:25 UTC (rev 3742)
+++ trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java 2007-11-05 04:26:21 UTC (rev 3743)
@@ -1,7 +1,5 @@
package org.richfaces;
-import java.lang.reflect.Method;
-
import javax.faces.context.FacesContext;
public class OptionItem {
@@ -29,4 +27,9 @@
return null;
}
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName() + " [" + name + "] by " + price;
+ }
}
Modified: trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-02 22:37:25 UTC (rev 3742)
+++ trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-05 04:26:21 UTC (rev 3743)
@@ -27,6 +27,10 @@
}
}
+ public void setItems(List<OptionItem> items) {
+ this.items = items;
+ }
+
public List<OptionItem> getItems() {
return items;
}
17 years, 1 month
JBoss Rich Faces SVN: r3742 - in trunk/samples/seamPortletEar: ear and 13 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-11-02 18:37:25 -0400 (Fri, 02 Nov 2007)
New Revision: 3742
Added:
trunk/samples/seamPortletEar/ear/
trunk/samples/seamPortletEar/ear/pom.xml
trunk/samples/seamPortletEar/ear/src/
trunk/samples/seamPortletEar/seamBooking/
trunk/samples/seamPortletEar/seamBooking/pom.xml
trunk/samples/seamPortletEar/seamBooking/src/
trunk/samples/seamPortletEar/seamBooking/src/main/
trunk/samples/seamPortletEar/seamBooking/src/main/java/
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Authenticator.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/AuthenticatorAction.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Booking.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/BookingList.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/BookingListAction.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/ChangePassword.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/ChangePasswordAction.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Hotel.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelBooking.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelBookingAction.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelSearching.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelSearchingAction.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Register.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/RegisterAction.java
trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/User.java
trunk/samples/seamPortletEar/seamBooking/src/main/resources/
trunk/samples/seamPortletEar/seamBooking/src/main/resources/META-INF/
trunk/samples/seamPortletEar/seamBooking/src/main/resources/META-INF/ejb-jar.xml
trunk/samples/seamPortletEar/seamBooking/src/main/resources/META-INF/persistence.xml
trunk/samples/seamPortletEar/seamBooking/src/main/resources/booking1-ds.xml
trunk/samples/seamPortletEar/seamBooking/src/main/resources/components.properties
trunk/samples/seamPortletEar/seamBooking/src/main/resources/import.sql
trunk/samples/seamPortletEar/seamBooking/src/main/resources/messages.properties
trunk/samples/seamPortletEar/seamBooking/src/main/resources/seam.properties
Modified:
trunk/samples/seamPortletEar/pom.xml
trunk/samples/seamPortletEar/seamBookingPortlet/pom.xml
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/components.xml
Log:
convert seam portlet sample to EAR
Added: trunk/samples/seamPortletEar/ear/pom.xml
===================================================================
--- trunk/samples/seamPortletEar/ear/pom.xml (rev 0)
+++ trunk/samples/seamPortletEar/ear/pom.xml 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,80 @@
+<?xml version="1.0"?><project>
+ <parent>
+ <artifactId>seamPortletEar</artifactId>
+ <groupId>org.richfaces.samples</groupId>
+ <version>3.2.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.samples.seamPortletEar</groupId>
+ <artifactId>portletEar</artifactId>
+ <packaging>ear</packaging>
+ <name>Seam Portlet Ear</name>
+ <version>3.2.0-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.samples.seamPortletEar</groupId>
+ <artifactId>seamBooking</artifactId>
+ <type>ejb</type>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.samples.seamPortletEar</groupId>
+ <artifactId>seamBookingPortlet</artifactId>
+ <type>war</type>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>seamEAR</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-ear-plugin</artifactId>
+ <configuration>
+ <defaultLibBundleDir>lib</defaultLibBundleDir>
+ <modules>
+ <jarModule>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <includeInApplicationXml>
+ true
+ </includeInApplicationXml>
+ <bundleDir>/</bundleDir>
+ </jarModule>
+ <ejbModule>
+ <groupId>
+ org.richfaces.samples.seamPortletEar
+ </groupId>
+ <artifactId>seamBooking</artifactId>
+ <bundleDir>/</bundleDir>
+ </ejbModule>
+ <jarModule>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-api</artifactId>
+ <includeInApplicationXml>
+ true
+ </includeInApplicationXml>
+ <bundleDir>/</bundleDir>
+ </jarModule>
+ </modules>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ -->
+ <!--
+ <jboss>
+ <version>4.2</version>
+ <loader-repository>
+ seam.jboss.org:loader=seamEAR
+ </loader-repository>
+ </jboss>
+ -->
+ <version>5</version>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Property changes on: trunk/samples/seamPortletEar/ear/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Modified: trunk/samples/seamPortletEar/pom.xml
===================================================================
--- trunk/samples/seamPortletEar/pom.xml 2007-11-02 21:06:30 UTC (rev 3741)
+++ trunk/samples/seamPortletEar/pom.xml 2007-11-02 22:37:25 UTC (rev 3742)
@@ -1,7 +1,5 @@
-<?xml version="1.0"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!--
<parent>
<artifactId>samples</artifactId>
@@ -15,13 +13,16 @@
<artifactId>seamPortletEar</artifactId>
<packaging>pom</packaging>
<name>seam EAR portlet project</name>
+ <properties>
+ <seam>2.0.1.SNAPSHOT</seam>
+ </properties>
<modules>
- <module>projects</module>
- <module>primary-source</module>
- <module>wars</module>
- <module>ejbs</module>
- <module>ear</module>
- </modules>
+ <module>seamBookingPortlet</module>
+<!-- <module>seamBooking</module>
+ <module>ear</module> -->
+ <module>ear</module>
+ <module>seamBooking</module>
+ </modules>
<build>
<pluginManagement>
<plugins>
@@ -54,29 +55,55 @@
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>
- org.richfaces.samples.seamEAR.projects
- </groupId>
- <artifactId>logging</artifactId>
+ <groupId>org.richfaces.samples.seamPortletEar</groupId>
+ <artifactId>seamBookingPortlet</artifactId>
<version>3.2.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.samples.seamEAR</groupId>
- <artifactId>primary-source</artifactId>
- <version>3.2.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.samples.seamEAR.wars</groupId>
- <artifactId>seamWebapp</artifactId>
- <version>3.2.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
- <groupId>org.richfaces.samples.seamEAR</groupId>
- <artifactId>ejbs</artifactId>
+ <groupId>org.richfaces.samples.seamPortletEar</groupId>
+ <artifactId>seamBooking</artifactId>
<version>3.2.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>3.0.0.GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.3.0.ga</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>3.3.1.ga</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${seam}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui</artifactId>
+ <version>${seam}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ioc</artifactId>
+ <version>${seam}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-debug</artifactId>
+ <version>${seam}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
-</project>
+</project>
\ No newline at end of file
Added: trunk/samples/seamPortletEar/seamBooking/pom.xml
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/pom.xml (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/pom.xml 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,88 @@
+<?xml version="1.0"?><project>
+ <parent>
+ <artifactId>seamPortletEar</artifactId>
+ <groupId>org.richfaces.samples</groupId>
+ <version>3.2.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.samples.seamPortletEar</groupId>
+ <artifactId>seamBooking</artifactId>
+ <name>seamBooking</name>
+ <packaging>ejb</packaging>
+ <version>3.2.0-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2_05</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-api</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.ejb</groupId>
+ <artifactId>ejb-api</artifactId>
+ <version>3.0</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-commons-annotations</artifactId>
+ <version>3.3.0.ga</version>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.2.0.ga</version>
+ <optional>true</optional>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>seamBooking</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-ejb-plugin</artifactId>
+ <configuration>
+ <ejbVersion>3.0</ejbVersion>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Property changes on: trunk/samples/seamPortletEar/seamBooking/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Authenticator.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Authenticator.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Authenticator.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,9 @@
+package org.jboss.seam.example.booking;
+
+import javax.ejb.Local;
+
+@Local
+public interface Authenticator
+{
+ boolean authenticate();
+}
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Authenticator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/AuthenticatorAction.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/AuthenticatorAction.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/AuthenticatorAction.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,40 @@
+package org.jboss.seam.example.booking;
+
+import static org.jboss.seam.ScopeType.SESSION;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+
+@Stateless
+@Name("authenticator")
+public class AuthenticatorAction implements Authenticator
+{
+ @PersistenceContext
+ private EntityManager em;
+
+ @Out(required=false, scope = SESSION)
+ private User user;
+
+ public boolean authenticate()
+ {
+ List results = em.createQuery("select u from User u where u.username=#{identity.username} and u.password=#{identity.password}")
+ .getResultList();
+
+ if ( results.size()==0 )
+ {
+ return false;
+ }
+ else
+ {
+ user = (User) results.get(0);
+ return true;
+ }
+ }
+
+}
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/AuthenticatorAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Booking.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Booking.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Booking.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,190 @@
+//$Id: Booking.java,v 1.15 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.util.Date;
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotNull;
+import org.hibernate.validator.Pattern;
+import org.jboss.seam.annotations.Name;
+
+@Entity
+@Name("booking")
+public class Booking implements Serializable
+{
+ private Long id;
+ private User user;
+ private Hotel hotel;
+ private Date checkinDate;
+ private Date checkoutDate;
+ private String creditCard;
+ private String creditCardName;
+ private int creditCardExpiryMonth;
+ private int creditCardExpiryYear;
+ private boolean smoking;
+ private int beds;
+
+ public Booking() {}
+
+ public Booking(Hotel hotel, User user)
+ {
+ this.hotel = hotel;
+ this.user = user;
+ }
+
+ @Transient
+ public BigDecimal getTotal()
+ {
+ return hotel.getPrice().multiply( new BigDecimal( getNights() ) );
+ }
+
+ @Transient
+ public int getNights()
+ {
+ return (int) ( checkoutDate.getTime() - checkinDate.getTime() ) / 1000 / 60 / 60 / 24;
+ }
+
+ @Id @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @NotNull
+ @Basic @Temporal(TemporalType.DATE)
+ public Date getCheckinDate()
+ {
+ return checkinDate;
+ }
+ public void setCheckinDate(Date datetime)
+ {
+ this.checkinDate = datetime;
+ }
+
+ @ManyToOne @NotNull
+ public Hotel getHotel()
+ {
+ return hotel;
+ }
+ public void setHotel(Hotel hotel)
+ {
+ this.hotel = hotel;
+ }
+
+ @ManyToOne @NotNull
+ public User getUser()
+ {
+ return user;
+ }
+ public void setUser(User user)
+ {
+ this.user = user;
+ }
+
+ @Basic @Temporal(TemporalType.DATE)
+ @NotNull
+ public Date getCheckoutDate()
+ {
+ return checkoutDate;
+ }
+ public void setCheckoutDate(Date checkoutDate)
+ {
+ this.checkoutDate = checkoutDate;
+ }
+
+ @NotNull(message="Credit card number is required")
+ @Length(min=16, max=16, message="Credit card number must 16 digits long")
+ @Pattern(regex="^\\d*$", message="Credit card number must be numeric")
+ public String getCreditCard()
+ {
+ return creditCard;
+ }
+
+ public void setCreditCard(String creditCard)
+ {
+ this.creditCard = creditCard;
+ }
+
+ @Transient
+ public String getDescription()
+ {
+ DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
+ return hotel==null ? null : hotel.getName() +
+ ", " + df.format( getCheckinDate() ) +
+ " to " + df.format( getCheckoutDate() );
+ }
+
+ public boolean isSmoking()
+ {
+ return smoking;
+ }
+
+ public void setSmoking(boolean smoking)
+ {
+ this.smoking = smoking;
+ }
+
+ public int getBeds()
+ {
+ return beds;
+ }
+
+ public void setBeds(int beds)
+ {
+ this.beds = beds;
+ }
+ @NotNull(message="Credit card name is required")
+ @Length(min=3, max=70, message="Credit card name is required")
+ public String getCreditCardName()
+ {
+ return creditCardName;
+ }
+
+ public void setCreditCardName(String creditCardName)
+ {
+ this.creditCardName = creditCardName;
+ }
+
+ public int getCreditCardExpiryMonth()
+ {
+ return creditCardExpiryMonth;
+ }
+
+ public void setCreditCardExpiryMonth(int creditCardExpiryMonth)
+ {
+ this.creditCardExpiryMonth = creditCardExpiryMonth;
+ }
+
+ public int getCreditCardExpiryYear()
+ {
+ return creditCardExpiryYear;
+ }
+
+ public void setCreditCardExpiryYear(int creditCardExpiryYear)
+ {
+ this.creditCardExpiryYear = creditCardExpiryYear;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Booking(" + user + ","+ hotel + ")";
+ }
+
+}
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Booking.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/BookingList.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/BookingList.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/BookingList.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,13 @@
+//$Id: BookingList.java,v 1.7 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import javax.ejb.Local;
+
+@Local
+public interface BookingList
+{
+ public void getBookings();
+ public Booking getBooking();
+ public void cancel();
+ public void destroy();
+}
\ No newline at end of file
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/BookingList.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/BookingListAction.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/BookingListAction.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/BookingListAction.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,76 @@
+//$Id: BookingListAction.java,v 1.23 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
+import static org.jboss.seam.ScopeType.SESSION;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.datamodel.DataModel;
+import org.jboss.seam.annotations.datamodel.DataModelSelection;
+import org.jboss.seam.annotations.security.Restrict;
+import org.jboss.seam.faces.FacesMessages;
+import org.jboss.seam.log.Log;
+
+@Stateful
+@Scope(SESSION)
+@Name("bookingList")
+@Restrict("#{identity.loggedIn}")
+@TransactionAttribute(REQUIRES_NEW)
+public class BookingListAction implements BookingList, Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ @PersistenceContext
+ private EntityManager em;
+
+ @In
+ private User user;
+
+ @DataModel
+ private List<Booking> bookings;
+ @DataModelSelection
+ private Booking booking;
+
+ @Logger
+ private Log log;
+
+ @Factory
+ @Observer("bookingConfirmed")
+ public void getBookings()
+ {
+ bookings = em.createQuery("select b from Booking b where b.user.username = :username order by b.checkinDate")
+ .setParameter("username", user.getUsername())
+ .getResultList();
+ }
+
+ public void cancel()
+ {
+ log.info("Cancel booking: #{bookingList.booking.id} for #{user.username}");
+ Booking cancelled = em.find(Booking.class, booking.getId());
+ if (cancelled!=null) em.remove( cancelled );
+ getBookings();
+ FacesMessages.instance().add("Booking cancelled for confirmation number #{bookingList.booking.id}");
+ }
+
+ public Booking getBooking()
+ {
+ return booking;
+ }
+
+ @Remove
+ public void destroy() {}
+}
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/BookingListAction.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/ChangePassword.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/ChangePassword.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/ChangePassword.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,16 @@
+//$Id: ChangePassword.java,v 1.5 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import javax.ejb.Local;
+
+@Local
+public interface ChangePassword
+{
+ public void changePassword();
+ public boolean isChanged();
+
+ public String getVerify();
+ public void setVerify(String verify);
+
+ public void destroy();
+}
\ No newline at end of file
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/ChangePassword.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/ChangePasswordAction.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/ChangePasswordAction.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/ChangePasswordAction.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,73 @@
+//$Id: ChangePasswordAction.java,v 1.22 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import static org.jboss.seam.ScopeType.EVENT;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.security.Restrict;
+import org.jboss.seam.faces.FacesMessages;
+
+@Stateful
+@Scope(EVENT)
+@Name("changePassword")
+@Restrict("#{identity.loggedIn}")
+public class ChangePasswordAction implements ChangePassword
+{
+ @In @Out
+ private User user;
+
+ @PersistenceContext
+ private EntityManager em;
+
+ private String verify;
+
+ private boolean changed;
+
+ @In
+ private FacesMessages facesMessages;
+
+ public void changePassword()
+ {
+ if ( user.getPassword().equals(verify) )
+ {
+ user = em.merge(user);
+ facesMessages.add("Password updated");
+ changed = true;
+ }
+ else
+ {
+ facesMessages.addToControl("verify", "Re-enter new password");
+ revertUser();
+ verify=null;
+ }
+ }
+
+ public boolean isChanged()
+ {
+ return changed;
+ }
+
+ private void revertUser()
+ {
+ user = em.find(User.class, user.getUsername());
+ }
+ public String getVerify()
+ {
+ return verify;
+ }
+ public void setVerify(String verify)
+ {
+ this.verify = verify;
+ }
+
+ @Remove
+ public void destroy() {}
+}
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/ChangePasswordAction.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Hotel.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Hotel.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Hotel.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,114 @@
+//$Id: Hotel.java,v 1.13 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotNull;
+import org.jboss.seam.annotations.Name;
+
+@Entity
+@Name("hotel")
+public class Hotel implements Serializable
+{
+ private Long id;
+ private String name;
+ private String address;
+ private String city;
+ private String state;
+ private String zip;
+ private String country;
+ private BigDecimal price;
+
+ @Id @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @Length(max=50) @NotNull
+ public String getName()
+ {
+ return name;
+ }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @Length(max=100) @NotNull
+ public String getAddress()
+ {
+ return address;
+ }
+ public void setAddress(String address)
+ {
+ this.address = address;
+ }
+
+ @Length(max=40) @NotNull
+ public String getCity()
+ {
+ return city;
+ }
+ public void setCity(String city)
+ {
+ this.city = city;
+ }
+
+ @Length(min=4, max=6) @NotNull
+ public String getZip()
+ {
+ return zip;
+ }
+ public void setZip(String zip)
+ {
+ this.zip = zip;
+ }
+
+ @Length(min=2, max=10) @NotNull
+ public String getState()
+ {
+ return state;
+ }
+ public void setState(String state)
+ {
+ this.state = state;
+ }
+
+ @Length(min=2, max=40) @NotNull
+ public String getCountry()
+ {
+ return country;
+ }
+ public void setCountry(String country)
+ {
+ this.country = country;
+ }
+
+ @Column(precision=6, scale=2)
+ public BigDecimal getPrice()
+ {
+ return price;
+ }
+ public void setPrice(BigDecimal price)
+ {
+ this.price = price;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Hotel(" + name + "," + address + "," + city + "," + zip + ")";
+ }
+}
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Hotel.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelBooking.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelBooking.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelBooking.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,22 @@
+//$Id: HotelBooking.java,v 1.14 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import javax.ejb.Local;
+
+@Local
+public interface HotelBooking
+{
+ public void selectHotel(Hotel selectedHotel);
+
+ public void bookHotel();
+
+ public void setBookingDetails();
+ public boolean isBookingValid();
+
+ public void confirm();
+
+ public void cancel();
+
+ public void destroy();
+
+}
\ No newline at end of file
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelBooking.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelBookingAction.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelBookingAction.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelBookingAction.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,108 @@
+//$Id: HotelBookingAction.java,v 1.53 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import static javax.persistence.PersistenceContextType.EXTENDED;
+
+import java.util.Calendar;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.seam.annotations.Begin;
+import org.jboss.seam.annotations.End;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.security.Restrict;
+import org.jboss.seam.core.Events;
+import org.jboss.seam.faces.FacesMessages;
+import org.jboss.seam.log.Log;
+
+@Stateful
+@Name("hotelBooking")
+@Restrict("#{identity.loggedIn}")
+public class HotelBookingAction implements HotelBooking
+{
+
+ @PersistenceContext(type=EXTENDED)
+ private EntityManager em;
+
+ @In
+ private User user;
+
+ @In(required=false) @Out
+ private Hotel hotel;
+
+ @In(required=false)
+ @Out(required=false)
+ private Booking booking;
+
+ @In
+ private FacesMessages facesMessages;
+
+ @In
+ private Events events;
+
+ @Logger
+ private Log log;
+
+ private boolean bookingValid;
+
+ @Begin
+ public void selectHotel(Hotel selectedHotel)
+ {
+ hotel = em.merge(selectedHotel);
+ }
+
+ public void bookHotel()
+ {
+ booking = new Booking(hotel, user);
+ Calendar calendar = Calendar.getInstance();
+ booking.setCheckinDate( calendar.getTime() );
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
+ booking.setCheckoutDate( calendar.getTime() );
+ }
+
+ public void setBookingDetails()
+ {
+ Calendar calendar = Calendar.getInstance();
+ calendar.add(Calendar.DAY_OF_MONTH, -1);
+ if ( booking.getCheckinDate().before( calendar.getTime() ) )
+ {
+ facesMessages.addToControl("checkinDate", "Check in date must be a future date");
+ bookingValid=false;
+ }
+ else if ( !booking.getCheckinDate().before( booking.getCheckoutDate() ) )
+ {
+ facesMessages.addToControl("checkoutDate", "Check out date must be later than check in date");
+ bookingValid=false;
+ }
+ else
+ {
+ bookingValid=true;
+ }
+ }
+
+ public boolean isBookingValid()
+ {
+ return bookingValid;
+ }
+
+ @End
+ public void confirm()
+ {
+ em.persist(booking);
+ facesMessages.add("Thank you, #{user.name}, your confimation number for #{hotel.name} is #{booking.id}");
+ log.info("New booking: #{booking.id} for #{user.username}");
+ events.raiseTransactionSuccessEvent("bookingConfirmed");
+ }
+
+ @End
+ public void cancel() {}
+
+ @Remove
+ public void destroy() {}
+}
\ No newline at end of file
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelBookingAction.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelSearching.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelSearching.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelSearching.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,23 @@
+//$Id: HotelSearching.java,v 1.12 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import javax.ejb.Local;
+
+@Local
+public interface HotelSearching
+{
+ public int getPageSize();
+ public void setPageSize(int pageSize);
+
+ public String getSearchString();
+ public void setSearchString(String searchString);
+
+ public String getSearchPattern();
+
+ public void find();
+ public void nextPage();
+ public boolean isNextPageAvailable();
+
+ public void destroy();
+
+}
\ No newline at end of file
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelSearching.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelSearchingAction.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelSearchingAction.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelSearchingAction.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,86 @@
+//$Id: HotelSearchingAction.java,v 1.20 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import java.util.List;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.datamodel.DataModel;
+import org.jboss.seam.annotations.security.Restrict;
+
+@Stateful
+@Name("hotelSearch")
+(a)Scope(ScopeType.SESSION)
+@Restrict("#{identity.loggedIn}")
+public class HotelSearchingAction implements HotelSearching
+{
+
+ @PersistenceContext
+ private EntityManager em;
+
+ private String searchString;
+ private int pageSize = 10;
+ private int page;
+
+ @DataModel
+ private List<Hotel> hotels;
+
+ public void find()
+ {
+ page = 0;
+ queryHotels();
+ }
+ public void nextPage()
+ {
+ page++;
+ queryHotels();
+ }
+
+ private void queryHotels()
+ {
+ hotels = em.createQuery("select h from Hotel h where lower(h.name) like #{pattern} or lower(h.city) like #{pattern} or lower(h.zip) like #{pattern} or lower(h.address) like #{pattern}")
+ .setMaxResults(pageSize)
+ .setFirstResult( page * pageSize )
+ .getResultList();
+ }
+
+ public boolean isNextPageAvailable()
+ {
+ return hotels!=null && hotels.size()==pageSize;
+ }
+
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(int pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ @Factory(value="pattern", scope=ScopeType.EVENT)
+ public String getSearchPattern()
+ {
+ return searchString==null ?
+ "%" : '%' + searchString.toLowerCase().replace('*', '%') + '%';
+ }
+
+ public String getSearchString()
+ {
+ return searchString;
+ }
+
+ public void setSearchString(String searchString)
+ {
+ this.searchString = searchString;
+ }
+
+ @Remove
+ public void destroy() {}
+}
\ No newline at end of file
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/HotelSearchingAction.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Register.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Register.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Register.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,16 @@
+//$Id: Register.java,v 1.5 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import javax.ejb.Local;
+
+@Local
+public interface Register
+{
+ public void register();
+ public void invalid();
+ public String getVerify();
+ public void setVerify(String verify);
+ public boolean isRegistered();
+
+ public void destroy();
+}
\ No newline at end of file
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/Register.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/RegisterAction.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/RegisterAction.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/RegisterAction.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,80 @@
+//$Id: RegisterAction.java,v 1.23 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import static org.jboss.seam.ScopeType.EVENT;
+
+import java.util.List;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.faces.FacesMessages;
+
+@Stateful
+@Scope(EVENT)
+@Name("register")
+public class RegisterAction implements Register
+{
+ @In
+ private User user;
+
+ @PersistenceContext
+ private EntityManager em;
+
+ @In
+ private FacesMessages facesMessages;
+
+ private String verify;
+
+ private boolean registered;
+
+ public void register()
+ {
+ if ( user.getPassword().equals(verify) )
+ {
+ List existing = em.createQuery("select u.username from User u where u.username=#{user.username}")
+ .getResultList();
+ if (existing.size()==0)
+ {
+ em.persist(user);
+ facesMessages.add("Successfully registered as #{user.username}");
+ registered = true;
+ }
+ else
+ {
+ facesMessages.addToControl("username", "Username #{user.username} already exists");
+ }
+ }
+ else
+ {
+ facesMessages.addToControl("verify", "Re-enter your password");
+ verify=null;
+ }
+ }
+
+ public void invalid()
+ {
+ facesMessages.add("Please try again");
+ }
+
+ public boolean isRegistered()
+ {
+ return registered;
+ }
+ public String getVerify()
+ {
+ return verify;
+ }
+ public void setVerify(String verify)
+ {
+ this.verify = verify;
+ }
+
+ @Remove
+ public void destroy() {}
+}
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/RegisterAction.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/User.java
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/User.java (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/User.java 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,76 @@
+//$Id: User.java,v 1.8 2007/06/27 00:06:49 gavin Exp $
+package org.jboss.seam.example.booking;
+
+import static org.jboss.seam.ScopeType.SESSION;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotNull;
+import org.hibernate.validator.Pattern;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+@Entity
+@Name("user")
+@Scope(SESSION)
+@Table(name="Customer")
+public class User implements Serializable
+{
+ private String username;
+ private String password;
+ private String name;
+
+ public User(String name, String password, String username)
+ {
+ this.name = name;
+ this.password = password;
+ this.username = username;
+ }
+
+ public User() {}
+
+ @NotNull
+ @Length(max=100)
+ public String getName()
+ {
+ return name;
+ }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @NotNull
+ @Length(min=5, max=15)
+ public String getPassword()
+ {
+ return password;
+ }
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ @Id
+ @Length(min=4, max=15)
+ @Pattern(regex="^\\w*$", message="not a valid username")
+ public String getUsername()
+ {
+ return username;
+ }
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "User(" + username + ")";
+ }
+}
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/java/org/jboss/seam/example/booking/User.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/resources/META-INF/ejb-jar.xml
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/resources/META-INF/ejb-jar.xml (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/resources/META-INF/ejb-jar.xml 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+
+</ejb-jar>
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/resources/META-INF/ejb-jar.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/resources/META-INF/persistence.xml
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/resources/META-INF/persistence.xml (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/resources/META-INF/persistence.xml 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ <persistence-unit name="bookingDatabase">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:/bookingPortletDatasource</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <!-- These are the default for JBoss EJB3, but not for HEM: -->
+ <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
+ <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
+ </properties>
+ </persistence-unit>
+</persistence>
\ No newline at end of file
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/resources/META-INF/persistence.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/resources/booking1-ds.xml
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/resources/booking1-ds.xml (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/resources/booking1-ds.xml 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE datasources
+ PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
+
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>bookingPortletDatasource</jndi-name>
+ <connection-url>jdbc:hsqldb:.</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </local-tx-datasource>
+</datasources>
+
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/resources/booking1-ds.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added: trunk/samples/seamPortletEar/seamBooking/src/main/resources/components.properties
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/resources/components.properties (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/resources/components.properties 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1 @@
+jndiPattern #{ejbName}/local
\ No newline at end of file
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/resources/components.properties
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: trunk/samples/seamPortletEar/seamBooking/src/main/resources/import.sql
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/resources/import.sql (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/resources/import.sql 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,22 @@
+insert into Customer (username, password, name) values ('gavin', 'foobar', 'Gavin King')
+insert into Customer (username, password, name) values ('demo', 'demo', 'Demo User')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (1, 120, 'Marriott Courtyard', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (2, 180, 'Doubletree', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (3, 450, 'W Hotel', 'Union Square, Manhattan', 'NY', 'NY', '10011', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (4, 450, 'W Hotel', 'Lexington Ave, Manhattan', 'NY', 'NY', '10011', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (5, 250, 'Hotel Rouge', '1315 16th Street NW', 'Washington', 'DC', '20036', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (6, 300, '70 Park Avenue Hotel', '70 Park Avenue', 'NY', 'NY', '10011', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (8, 300, 'Conrad Miami', '1395 Brickell Ave', 'Miami', 'FL', '33131', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (9, 80, 'Sea Horse Inn', '2106 N Clairemont Ave', 'Eau Claire', 'WI', '54703', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (10, 90, 'Super 8 Eau Claire Campus Area', '1151 W Macarthur Ave', 'Eau Claire', 'WI', '54701', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (11, 160, 'Marriot Downtown', '55 Fourth Street', 'San Francisco', 'CA', '94103', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (12, 200, 'Hilton Diagonal Mar', 'Passeig del Taulat 262-264', 'Barcelona', 'Catalunya', '08019', 'Spain')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (13, 210, 'Hilton Tel Aviv', 'Independence Park', 'Tel Aviv', '', '63405', 'Israel')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (14, 240, 'InterContinental Tokyo Bay', 'Takeshiba Pier', 'Tokyo', '', '105', 'Japan')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (15, 130, 'Hotel Beaulac', ' Esplanade L�opold-Robert 2', 'Neuchatel', '', '2000', 'Switzerland')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (16, 140, 'Conrad Treasury Place', 'William & George Streets', 'Brisbane', 'QLD', '4001', 'Australia')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (17, 230, 'Ritz Carlton', '1228 Sherbrooke St', 'West Montreal', 'Quebec', 'H3G1H6', 'Canada')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (18, 460, 'Ritz Carlton', 'Peachtree Rd, Buckhead', 'Atlanta', 'GA', '30326', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (19, 220, 'Swissotel', '68 Market Street', 'Sydney', 'NSW', '2000', 'Australia')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (20, 250, 'Meli� White House', 'Albany Street', 'Regents Park London', '', 'NW13UP', 'Great Britain')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (21, 210, 'Hotel Allegro', '171 West Randolph Street', 'Chicago', 'IL', '60601', 'USA')
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/resources/import.sql
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/samples/seamPortletEar/seamBooking/src/main/resources/messages.properties
===================================================================
--- trunk/samples/seamPortletEar/seamBooking/src/main/resources/messages.properties (rev 0)
+++ trunk/samples/seamPortletEar/seamBooking/src/main/resources/messages.properties 2007-11-02 22:37:25 UTC (rev 3742)
@@ -0,0 +1,50 @@
+javax.faces.component.UIInput.CONVERSION=value could not be converted to the expected type
+javax.faces.component.UIInput.REQUIRED=value is required
+javax.faces.component.UIInput.REQUIRED_detail=value is required
+javax.faces.component.UIInput.UPDATE=an error occurred when processing your submitted information
+javax.faces.component.UISelectOne.INVALID=value is not valid
+javax.faces.component.UISelectMany.INVALID=value is not valid
+
+javax.faces.converter.BigDecimalConverter.DECIMAL=value must be a number
+javax.faces.converter.BigDecimalConverter.DECIMAL_detail=value must be a signed decimal number consisting of zero or more digits, optionally followed by a decimal point and fraction, eg. {1}
+javax.faces.converter.BigIntegerConverter.BIGINTEGER=value must be a number
+javax.faces.converter.BigIntegerConverter.BIGINTEGER_detail=value must be a signed integer number consisting of zero or more digits
+javax.faces.converter.BooleanConverter.BOOLEAN=value must be true or false
+javax.faces.converter.BooleanConverter.BOOLEAN_detail=value must be true or false (any value other than true will evaluate to false)
+javax.faces.converter.ByteConverter.BYTE=value must be a number between 0 and 255
+javax.faces.converter.ByteConverter.BYTE_detail=value must be a number between 0 and 255
+javax.faces.converter.CharacterConverter.CHARACTER=value must be a character
+javax.faces.converter.CharacterConverter.CHARACTER_detail=value must be a valid ASCII character
+javax.faces.convert.DateTimeConverter.CONVERSION value must be a datetime
+javax.faces.convert.DateTimeConverter.CONVERSION_detail value must be a datetime
+javax.faces.converter.DateTimeConverter.DATE=value must be a date
+javax.faces.converter.DateTimeConverter.DATE_detail=value must be a date, eg. {1}
+javax.faces.converter.DateTimeConverter.TIME=value must be a time
+javax.faces.converter.DateTimeConverter.TIME_detail=value must be a time, eg. {1}
+javax.faces.converter.DateTimeConverter.DATETIME=value must be a date and time
+javax.faces.converter.DateTimeConverter.DATETIME_detail=value must be a date and time, eg. {1}
+javax.faces.converter.DateTimeConverter.PATTERN_TYPE=a pattern or type attribute must be specified to convert the value
+javax.faces.converter.DoubleConverter.DOUBLE=value must be a number
+javax.faces.converter.DoubleConverter.DOUBLE_detail=value must be a number between 4.9E-324 and 1.7976931348623157E308
+javax.faces.converter.EnumConverter.ENUM=value must be convertible to an enum
+javax.faces.converter.EnumConverter.ENUM_detail=value must be convertible to an enum or from the enum that contains the constant {1}
+javax.faces.converter.EnumConverter.ENUM_NO_CLASS=value must be convertible to an enum or from the enum, but no enum class provided
+javax.faces.converter.EnumConverter.ENUM_NO_CLASS_detail=value must be convertible to an enum or from the enum, but no enum class provided
+javax.faces.converter.FloatConverter.FLOAT=value must be a number
+javax.faces.converter.FloatConverter.FLOAT_detail=value must be a number between 1.4E-45 and 3.4028235E38
+javax.faces.converter.IntegerConverter.INTEGER=value must be a number
+javax.faces.converter.IntegerConverter.INTEGER_detail=value must be a number between -2147483648 and 2147483647
+javax.faces.converter.LongConverter.LONG=value must be a number
+javax.faces.converter.LongConverter.LONG_detail=must be a number between -9223372036854775808 and 9223372036854775807
+javax.faces.converter.NumberConverter.CURRENCY=value must be a currency amount
+javax.faces.converter.NumberConverter.CURRENCY_detail=value must be a currency amount, eg. {1}
+javax.faces.converter.NumberConverter.PERCENT=value must be a percentage amount
+javax.faces.converter.NumberConverter.PERCENT_detail=value must be a percentage amount, eg. {1}
+javax.faces.converter.NumberConverter.NUMBER=value must be a number
+javax.faces.converter.NumberConverter.NUMBER_detail=value must be a number
+javax.faces.converter.NumberConverter.PATTERN=value must be a number
+javax.faces.converter.NumberConverter.PATTERN_detail=value must be a number
+javax.faces.converter.ShortConverter.SHORT=value must be a number
+javax.faces.converter.ShortConverter.SHORT_detail=value must be a number between -32768 and 32767
+
+
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/resources/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/samples/seamPortletEar/seamBooking/src/main/resources/seam.properties
===================================================================
Property changes on: trunk/samples/seamPortletEar/seamBooking/src/main/resources/seam.properties
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/pom.xml
===================================================================
--- trunk/samples/seamPortletEar/seamBookingPortlet/pom.xml 2007-11-02 21:06:30 UTC (rev 3741)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/pom.xml 2007-11-02 22:37:25 UTC (rev 3742)
@@ -3,15 +3,12 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>samples</artifactId>
- <groupId>org.richfaces</groupId>
+ <artifactId>seamPortletEar</artifactId>
+ <groupId>org.richfaces.samples</groupId>
<version>3.2.0-SNAPSHOT</version>
</parent>
- <properties>
- <seam>2.0.0.GA</seam>
- </properties>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.samples</groupId>
+ <groupId>org.richfaces.samples.seamPortletEar</groupId>
<artifactId>seamBookingPortlet</artifactId>
<packaging>war</packaging>
<name>seamBookingPortlet Maven Webapp</name>
@@ -82,22 +79,19 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
- <version>${seam}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-ui</artifactId>
- <version>${seam}</version>
</dependency>
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-ioc</artifactId>
- <version>${seam}</version>
</dependency>
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-debug</artifactId>
- <version>${seam}</version>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
@@ -126,6 +120,12 @@
<version>3.2.0-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-api</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.2_05</version>
@@ -144,11 +144,5 @@
<scope>provided</scope>
</dependency>
</dependencies>
- <repositories>
- <repository>
- <id>repository.jboss.com</id>
- <url>http://repository.jboss.com/maven2</url>
- </repository>
- </repositories>
</project>
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/components.xml
===================================================================
--- trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/components.xml 2007-11-02 21:06:30 UTC (rev 3741)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/components.xml 2007-11-02 22:37:25 UTC (rev 3742)
@@ -1,39 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.com/products/seam/components"
- xmlns:core="http://jboss.com/products/seam/core"
- xmlns:security="http://jboss.com/products/seam/security"
- xmlns:persistence="http://jboss.com/products/seam/persistence"
- xmlns:transaction="http://jboss.com/products/seam/transaction"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
- http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
+ xmlns:core="http://jboss.com/products/seam/core"
+ xmlns:security="http://jboss.com/products/seam/security"
+ xmlns:transaction="http://jboss.com/products/seam/transaction"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ 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.0.xsd
http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
- <core:init jndi-pattern="seamBookingPortlet/#{ejbName}/local"
- debug="true" />
+ <core:init jndi-pattern="seamEAR/#{ejbName}/local" debug="true"/>
- <core:manager conversation-timeout="120000"
- concurrent-request-timeout="500" conversation-id-parameter="cid" />
- <!-- Use the Seam-started PU or look it up from JNDI if running in Embeddable JBoss -->
- <persistence:entity-manager-factory installed="true"
- name="bookingEntityManagerFactory"
- persistence-unit-name="bookingDatabase"/>
-
- <persistence:managed-persistence-context name="entityManager"
- auto-create="true"
- entity-manager-factory="#{bookingEntityManagerFactory}"
- persistence-unit-jndi-name="java:/entityManagerFactories/bookingDatabase">
- </persistence:managed-persistence-context>
-
- <!-- Enabled in embeddable JBoss container -->
- <!--<transaction:ejb-transaction installed="false" />
- -->
- <transaction:ejb-transaction />
-
-
- <security:identity
- authenticate-method="#{authenticator.authenticate}" />
+ <core:manager conversation-timeout="120000"
+ concurrent-request-timeout="500"
+ conversation-id-parameter="cid"/>
+ <transaction:ejb-transaction/>
+
+ <security:identity authenticate-method="#{authenticator.authenticate}"/>
+
</components>
17 years, 2 months
JBoss Rich Faces SVN: r3741 - in trunk/samples: seamPortletEar and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-11-02 17:06:30 -0400 (Fri, 02 Nov 2007)
New Revision: 3741
Added:
trunk/samples/seamPortletEar/seamBookingPortlet/
Removed:
trunk/samples/seamBookingPortlet/
Modified:
trunk/samples/seamPortletEar/seamBookingPortlet/pom.xml
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/java/org/jboss/seam/example/booking/Booking.java
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/java/org/jboss/seam/example/booking/Hotel.java
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/java/org/jboss/seam/example/booking/User.java
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/resources/META-INF/persistence.xml
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/resources/components.properties
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/components.xml
Log:
convert seam portlet sample to EAR
Copied: trunk/samples/seamPortletEar/seamBookingPortlet (from rev 3725, trunk/samples/seamBookingPortlet)
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/pom.xml
===================================================================
--- trunk/samples/seamBookingPortlet/pom.xml 2007-11-02 15:43:03 UTC (rev 3725)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/pom.xml 2007-11-02 21:06:30 UTC (rev 3741)
@@ -7,6 +7,9 @@
<groupId>org.richfaces</groupId>
<version>3.2.0-SNAPSHOT</version>
</parent>
+ <properties>
+ <seam>2.0.0.GA</seam>
+ </properties>
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces.samples</groupId>
<artifactId>seamBookingPortlet</artifactId>
@@ -79,22 +82,22 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
- <version>2.0.1.SNAPSHOT</version>
+ <version>${seam}</version>
</dependency>
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-ui</artifactId>
- <version>2.0.1.SNAPSHOT</version>
+ <version>${seam}</version>
</dependency>
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-ioc</artifactId>
- <version>2.0.1.SNAPSHOT</version>
+ <version>${seam}</version>
</dependency>
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-debug</artifactId>
- <version>2.0.1.SNAPSHOT</version>
+ <version>${seam}</version>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/java/org/jboss/seam/example/booking/Booking.java
===================================================================
--- trunk/samples/seamBookingPortlet/src/main/java/org/jboss/seam/example/booking/Booking.java 2007-11-02 15:43:03 UTC (rev 3725)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/java/org/jboss/seam/example/booking/Booking.java 2007-11-02 21:06:30 UTC (rev 3741)
@@ -7,7 +7,6 @@
import java.util.Date;
import javax.persistence.Basic;
-import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
@@ -20,7 +19,6 @@
import org.hibernate.validator.Pattern;
import org.jboss.seam.annotations.Name;
-@Entity
@Name("booking")
public class Booking implements Serializable
{
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/java/org/jboss/seam/example/booking/Hotel.java
===================================================================
--- trunk/samples/seamBookingPortlet/src/main/java/org/jboss/seam/example/booking/Hotel.java 2007-11-02 15:43:03 UTC (rev 3725)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/java/org/jboss/seam/example/booking/Hotel.java 2007-11-02 21:06:30 UTC (rev 3741)
@@ -13,7 +13,6 @@
import org.hibernate.validator.NotNull;
import org.jboss.seam.annotations.Name;
-@Entity
@Name("hotel")
public class Hotel implements Serializable
{
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/java/org/jboss/seam/example/booking/User.java
===================================================================
--- trunk/samples/seamBookingPortlet/src/main/java/org/jboss/seam/example/booking/User.java 2007-11-02 15:43:03 UTC (rev 3725)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/java/org/jboss/seam/example/booking/User.java 2007-11-02 21:06:30 UTC (rev 3741)
@@ -15,7 +15,6 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-@Entity
@Name("user")
@Scope(SESSION)
@Table(name="Customer")
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/resources/META-INF/persistence.xml
===================================================================
--- trunk/samples/seamBookingPortlet/src/main/resources/META-INF/persistence.xml 2007-11-02 15:43:03 UTC (rev 3725)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/resources/META-INF/persistence.xml 2007-11-02 21:06:30 UTC (rev 3741)
@@ -1,17 +1,24 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
- version="1.0">
- <persistence-unit name="bookingDatabase">
- <provider>org.hibernate.ejb.HibernatePersistence</provider>
- <jta-data-source>java:/bookingDatasource</jta-data-source>
- <properties>
- <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
- <property name="hibernate.show_sql" value="true"/>
- <!-- These are the default for JBoss EJB3, but not for HEM: -->
- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
- <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
- </properties>
- </persistence-unit>
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ <persistence-unit name="bookingDatabase" transaction-type="JTA">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:/bookingDatasource</jta-data-source>
+ <properties>
+ <property name="hibernate.dialect"
+ value="org.hibernate.dialect.HSQLDialect" />
+ <!-- Logging -->
+ <property name="hibernate.use_sql_comments" value="true" />
+ <property name="hibernate.format_sql" value="false" />
+ <property name="hibernate.hbm2ddl.auto" value="create-drop" />
+ <property name="hibernate.show_sql" value="true" />
+ <!-- These are the default for JBoss EJB3, but not for HEM: -->
+ <property name="hibernate.cache.provider_class"
+ value="org.hibernate.cache.HashtableCacheProvider" />
+ <property name="hibernate.transaction.manager_lookup_class"
+ value="org.hibernate.transaction.JBossTransactionManagerLookup" />
+ </properties>
+ </persistence-unit>
</persistence>
\ No newline at end of file
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/resources/components.properties
===================================================================
--- trunk/samples/seamBookingPortlet/src/main/resources/components.properties 2007-11-02 15:43:03 UTC (rev 3725)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/resources/components.properties 2007-11-02 21:06:30 UTC (rev 3741)
@@ -1 +0,0 @@
-jndiPattern #{ejbName}/local
\ No newline at end of file
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/components.xml
===================================================================
--- trunk/samples/seamBookingPortlet/src/main/webapp/WEB-INF/components.xml 2007-11-02 15:43:03 UTC (rev 3725)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/components.xml 2007-11-02 21:06:30 UTC (rev 3741)
@@ -2,9 +2,11 @@
<components xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core"
xmlns:security="http://jboss.com/products/seam/security"
+ xmlns:persistence="http://jboss.com/products/seam/persistence"
xmlns:transaction="http://jboss.com/products/seam/transaction"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
+ http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd
http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
@@ -13,15 +15,24 @@
debug="true" />
<core:manager conversation-timeout="120000"
- concurrent-request-timeout="500" conversation-id-parameter="cid" /><!--
+ concurrent-request-timeout="500" conversation-id-parameter="cid" />
+ <!-- Use the Seam-started PU or look it up from JNDI if running in Embeddable JBoss -->
+ <persistence:entity-manager-factory installed="true"
+ name="bookingEntityManagerFactory"
+ persistence-unit-name="bookingDatabase"/>
- <persistence:managed-persistence-context auto-create="true" name="entityManager">
- <persistence:persistence-unit-jndi-name>java:/blogEntityManagerFactory</persistence:persistence-unit-jndi-name>
- </persistence:managed-persistence-context>
+ <persistence:managed-persistence-context name="entityManager"
+ auto-create="true"
+ entity-manager-factory="#{bookingEntityManagerFactory}"
+ persistence-unit-jndi-name="java:/entityManagerFactories/bookingDatabase">
+ </persistence:managed-persistence-context>
+ <!-- Enabled in embeddable JBoss container -->
+ <!--<transaction:ejb-transaction installed="false" />
-->
- <transaction:ejb-transaction />
-
+ <transaction:ejb-transaction />
+
+
<security:identity
authenticate-method="#{authenticator.authenticate}" />
17 years, 2 months
JBoss Rich Faces SVN: r3740 - in trunk/samples: seamPortletEar and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-11-02 17:05:12 -0400 (Fri, 02 Nov 2007)
New Revision: 3740
Added:
trunk/samples/seamPortletEar/
trunk/samples/seamPortletEar/pom.xml
Log:
convert seam portlet sample to EAR
Added: trunk/samples/seamPortletEar/pom.xml
===================================================================
--- trunk/samples/seamPortletEar/pom.xml (rev 0)
+++ trunk/samples/seamPortletEar/pom.xml 2007-11-02 21:05:12 UTC (rev 3740)
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <!--
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.2.0-SNAPSHOT</version>
+ </parent>
+ -->
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.samples</groupId>
+ <version>3.2.0-SNAPSHOT</version>
+ <artifactId>seamPortletEar</artifactId>
+ <packaging>pom</packaging>
+ <name>seam EAR portlet project</name>
+ <modules>
+ <module>projects</module>
+ <module>primary-source</module>
+ <module>wars</module>
+ <module>ejbs</module>
+ <module>ear</module>
+ </modules>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <repositories>
+ <repository>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <id>repository.jboss.com</id>
+ <name>Jboss Repository for Maven</name>
+ <url>http://repository.jboss.com/maven2/</url>
+ <layout>default</layout>
+ </repository>
+ </repositories>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>
+ org.richfaces.samples.seamEAR.projects
+ </groupId>
+ <artifactId>logging</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.samples.seamEAR</groupId>
+ <artifactId>primary-source</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.samples.seamEAR.wars</groupId>
+ <artifactId>seamWebapp</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.samples.seamEAR</groupId>
+ <artifactId>ejbs</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <type>ejb</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
Property changes on: trunk/samples/seamPortletEar/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
17 years, 2 months
JBoss Rich Faces SVN: r3739 - trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-11-02 15:17:54 -0400 (Fri, 02 Nov 2007)
New Revision: 3739
Modified:
trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
Log:
Demo application for ordering list component.
Modified: trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-02 18:30:54 UTC (rev 3738)
+++ trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-02 19:17:54 UTC (rev 3739)
@@ -28,25 +28,30 @@
controlsVerticalAlign="#{demoBean.controlsVerticalAlign}"
orderControlsVisible="#{demoBean.orderControlsVisible}"
fastOrderControlsVisible="#{demoBean.fastOrderControlsVisible}" >
- <f:facet name="header">
- <h:column>
+
+ <h:column>
+ <f:facet name="header">
<h:outputText value="Name" />
- </h:column>
- <h:column>
- <h:outputText value="Price" />
- </h:column>
- </f:facet>
- <h:column>
+ </f:facet>
<h:outputText value="#{item.name}" />
</h:column>
<h:column>
+ <f:facet name="header">
+ <h:outputText value="Price" />
+ </f:facet>
<h:outputText value="#{item.price}" />
</h:column>
<h:column>
+ <f:facet name="header">
+ <h:outputText value="Ajax Action" />
+ </f:facet>
<a4j:commandButton value="Ajax Action" reRender="actionResult"
action="#{item.action}" />
</h:column>
<h:column>
+ <f:facet name="header">
+ <h:outputText value="Server Action" />
+ </f:facet>
<h:commandLink value="Server Action" action="#{item.action}" />
</h:column>
</ol:orderingList>
17 years, 2 months
JBoss Rich Faces SVN: r3738 - trunk/sandbox/samples/columnsDemo.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-11-02 14:30:54 -0400 (Fri, 02 Nov 2007)
New Revision: 3738
Modified:
trunk/sandbox/samples/columnsDemo/pom.xml
Log:
small fix
Modified: trunk/sandbox/samples/columnsDemo/pom.xml
===================================================================
--- trunk/sandbox/samples/columnsDemo/pom.xml 2007-11-02 18:28:12 UTC (rev 3737)
+++ trunk/sandbox/samples/columnsDemo/pom.xml 2007-11-02 18:30:54 UTC (rev 3738)
@@ -6,7 +6,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces.sandbox.samples</groupId>
- <artifactId>colunmsDemo</artifactId>
+ <artifactId>columnsDemo</artifactId>
<packaging>war</packaging>
<name>columnsDemo Maven Webapp</name>
<version>3.2.0-SNAPSHOT</version>
17 years, 2 months
JBoss Rich Faces SVN: r3737 - trunk/sandbox/samples/columnsDemo.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-11-02 14:28:12 -0400 (Fri, 02 Nov 2007)
New Revision: 3737
Modified:
trunk/sandbox/samples/columnsDemo/pom.xml
Log:
small fix
Modified: trunk/sandbox/samples/columnsDemo/pom.xml
===================================================================
--- trunk/sandbox/samples/columnsDemo/pom.xml 2007-11-02 18:08:26 UTC (rev 3736)
+++ trunk/sandbox/samples/columnsDemo/pom.xml 2007-11-02 18:28:12 UTC (rev 3737)
@@ -33,7 +33,7 @@
</dependency>
</dependencies>
<build>
- <finalName>colunmsDemo</finalName>
+ <finalName>columnsDemo</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
17 years, 2 months
JBoss Rich Faces SVN: r3736 - in trunk/sandbox/ui/orderingList/src/main: resources/org/richfaces/renderkit/html/css and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2007-11-02 14:08:26 -0400 (Fri, 02 Nov 2007)
New Revision: 3736
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js
Log:
Synchronization of tables
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-02 18:05:17 UTC (rev 3735)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-02 18:08:26 UTC (rev 3736)
@@ -12,14 +12,11 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.component.SequenceDataAdaptor;
import org.ajax4jsf.component.UIDataAdaptor;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.iterators.FilterIterator;
import org.richfaces.component.Column;
-import org.richfaces.component.Row;
-import org.richfaces.component.UIDataTable;
import org.richfaces.component.UIOrderingList;
public abstract class OrderingListRendererBase extends AbstractRowsRenderer {
@@ -84,9 +81,9 @@
writer.endElement("thead");
}
- protected void encodeHeaderFacets(FacesContext context,
- ResponseWriter writer, Iterator headers, String skinCellClass,
- String headerClass, String facetName, String element)
+ protected void encodeHeaderFacets(FacesContext context, ResponseWriter writer,
+ Iterator headers, String skinCellClass,
+ String headerClass, String facetName, String element)
throws IOException {
while (headers.hasNext()) {
UIComponent column = (UIComponent) headers.next();
@@ -98,13 +95,16 @@
skinCellClass = "ol_endcol rich-table-subheadercell";
}
encodeStyleClass(writer, null, skinCellClass, headerClass, columnHeaderClass);
- writer.writeAttribute("scope", "col", null);
getUtils().encodeAttribute(context, column, "colspan");
+ writer.startElement("div", column);
+ writer.writeAttribute("style", "overflow:hidden;white-space: nowrap;", null);
+
UIComponent facet = column.getFacet(facetName);
if (facet != null) {
renderChild(context, facet);
}
+ writer.endElement("div");
writer.endElement(element);
}
}
Modified: trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-02 18:05:17 UTC (rev 3735)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-02 18:08:26 UTC (rev 3736)
@@ -81,10 +81,12 @@
border-bottom : 1px solid #bfbfc0;
border-right : 1px solid #bfbfc0;
padding : 2px;
+ white-space: nowrap;
}
#internal_header_tab .ol_endcol {
border-right : 0px;
+ white-space: nowrap;
}
#internal_tab {
@@ -93,6 +95,7 @@
#internal_tab .ol_endcol {
border-right : 0px;
+ white-space: nowrap;
}
#internal_tab td {
@@ -102,6 +105,7 @@
border-bottom : 1px solid #bfbfc0;
border-right : 1px solid #bfbfc0;
padding : 2px;
+ white-space: nowrap;
}
Modified: trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js 2007-11-02 18:05:17 UTC (rev 3735)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js 2007-11-02 18:08:26 UTC (rev 3736)
@@ -1,18 +1,41 @@
LayoutManager = function(headerId, contentId) {
this.headerTable = document.getElementById(headerId);
this.contentTable = document.getElementById(contentId);
+ this.headerDiv = this.headerTable.parentNode;
+ this.contentDiv = this.contentTable.parentNode;
+
+ var obj = this;
+ if (window.attachEvent) {
+ this.contentDiv.attachEvent("onscroll", function() {obj.scrollHandler(obj)});
+ } else {
+ this.contentDiv.addEventListener("scroll", function() {obj.scrollHandler(obj)}, true);
+ }
+
}
-LayoutManager.scrollWidth = 17;
+LayoutManager.SCROLL_WIDTH = 17;
+LayoutManager.STYLE_CONTENTTD_BORDER = 1;
+LayoutManager.STYLE_CONTENTTD_PADDING = 4;
+
LayoutManager.prototype.widthSynchronization = function() {
var contentCells = this.contentTable.tBodies[0].rows[0].cells;
var headerCells = this.headerTable.tHead.rows[0].cells;
+ var width;
for (var i = 0; i < contentCells.length; i++) {
+ width = contentCells[i].offsetWidth - LayoutManager.STYLE_CONTENTTD_BORDER - LayoutManager.STYLE_CONTENTTD_PADDING;
if (i == contentCells.length - 1) {
- headerCells[i].style.width = contentCells[i].offsetWidth + LayoutManager.scrollWidth;
+ width = width + LayoutManager.SCROLL_WIDTH;
+ headerCells[i].firstChild.style.width = width;
+ headerCells[i].style.width = width;
} else {
- headerCells[i].style.width = contentCells[i].offsetWidth;
+ headerCells[i].firstChild.style.width = width;
+ headerCells[i].style.width = width;
}
}
+ this.headerTable.style.width = this.contentTable.offsetWidth + LayoutManager.SCROLL_WIDTH;
+}
+
+LayoutManager.prototype.scrollHandler = function(obj) {
+ obj.headerDiv.scrollLeft = obj.contentDiv.scrollLeft;
}
\ No newline at end of file
17 years, 2 months
JBoss Rich Faces SVN: r3734 - in trunk: ui/calendar/src/main/resources/org/richfaces/renderkit/html/css and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2007-11-02 13:32:31 -0400 (Fri, 02 Nov 2007)
New Revision: 3734
Modified:
trunk/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
RF-1092
calendar refactoring:
-removed main div
-implemented cellWidth & cellHeight support in js-file
-added div insertion in day cells when user define dayListMarkup
Modified: trunk/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp
===================================================================
--- trunk/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp 2007-11-02 17:23:52 UTC (rev 3733)
+++ trunk/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp 2007-11-02 17:32:31 UTC (rev 3734)
@@ -38,6 +38,9 @@
</h:panelGrid>
<br />
<br />
+ <calendar:calendar/>
+ <calendar:calendar cellWidth="5" cellHeight="5"/>
+ <calendar:calendar cellWidth="40" cellHeight="40"/>
<calendar:calendar
id="calendar"
dataModel="#{calendarDataModel}"
@@ -61,6 +64,8 @@
buttonClass="bc"
horizontalOffset="3"
verticalOffset="3"
+ cellHeight="50"
+ cellWidth="50"
mode="ajax">
<f:facet name="optionalHeader">
<h:outputText value="optionalHeader Facet" />
@@ -69,7 +74,7 @@
<h:outputText value="optionalFooter Facet" />
</f:facet>
- <f:facet name="weekDay"><f:verbatim><span style="padding: 2px; font-size: 10px" >{weekDayLabel + weekDayLabelShort}</span></f:verbatim></f:facet>
+ <f:facet name="weekDay"><f:verbatim><span style="padding: 2px; font-size: 10px" >{weekDayLabelShort}</span></f:verbatim></f:facet>
<f:validator validatorId="org.richfaces.CalendarValidator" />
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2007-11-02 17:23:52 UTC (rev 3733)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2007-11-02 17:32:31 UTC (rev 3734)
@@ -26,8 +26,6 @@
}
.rich-calendar-cell-div{
- width : 100%;
- height : 100%;
overflow: hidden;
}
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-11-02 17:23:52 UTC (rev 3733)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-11-02 17:32:31 UTC (rev 3734)
@@ -437,7 +437,15 @@
if (!this.params.datePattern) thisparams.datePattern = "MMM d, y";
// markups initialization
- if (!this.params.dayListMarkup) this.params.dayListMarkup = CalendarView.dayList;
+ if (!this.params.dayListMarkup)
+ {
+ this.params.dayListMarkup = CalendarView.dayList;
+ this.customDayListMarkup = false;
+ }
+ else
+ {
+ this.customDayListMarkup = true;
+ }
if (!this.params.weekNumberMarkup) this.params.weekNumberMarkup = CalendarView.weekNumber;
if (!this.params.weekDayMarkup) this.params.weekDayMarkup = CalendarView.weekDay;
if (!this.params.headerMarkup) this.params.headerMarkup = CalendarView.header;
@@ -483,9 +491,6 @@
this.selectedDateCellId = null;
this.selectedDateCellColor = "";
- var obj=$(id);
- var span=$(this.POPUP_ID);
-
var popupStyles = "";
this.isVisible = true;
if (this.params.popup==true)
@@ -552,19 +557,21 @@
// day cells creation
for (var i=0;i<7;i++)
{
- styleClass = bottomStyleClass+"rich-cell-size rich-calendar-cell";
+ styleClass = bottomStyleClass+(!this.params.dayCellClass ? "rich-calendar-cell-size" : (!this.customDayListMarkup ? this.params.dayCellClass : ""))+" rich-calendar-cell";
if (i==this.firstWeekendDayNumber || i==this.secondWeekendDayNumber) styleClass+=" rich-calendar-holly";
if (i==6) styleClass+=" rich-right-cell";
- htmlTextWeek+='<td class="'+styleClass+'" id="'+this.DATE_ELEMENT_ID+p+'"></td>';
+ htmlTextWeek+='<td class="'+styleClass+'" id="'+this.DATE_ELEMENT_ID+p+'">'+(this.customDayListMarkup ? '<div class="rich-calendar-cell-div'+(this.params.dayCellClass ? ' '+this.params.dayCellClass : '')+'"></div>' : '')+'</td>';
p++;
}
htmlTextWeek+='</tr>';
}
//obj.innerHTML = htmlTextIFrame+htmlTextHeader+htmlHeaderOptional+htmlControlsHeader+htmlTextWeekDayBar+htmlTextWeek+htmlControlsFooter+htmlFooterOptional+htmlTextFooter;
+ var span=$(this.POPUP_ID);
new Insertion.After(span,htmlTextIFrame+htmlTextHeader+htmlHeaderOptional+htmlControlsHeader+htmlTextWeekDayBar+htmlTextWeek+htmlControlsFooter+htmlFooterOptional+htmlTextFooter);
// set content
+ var obj=$(id);
obj.component = this;
obj.richfacesComponent="richfaces:calendar";
@@ -581,6 +588,7 @@
Event.observe(this.INPUT_DATE_ID, "click", handler, false);
}
}
+
},
doCollapse: function() {
@@ -651,7 +659,7 @@
{
this.selectDate(baseInput.value);
}
-
+
/*this.setPopupEvents(e);
this.setPopupEvents(base);*/
@@ -988,6 +996,7 @@
},
render:function() {
+
this.todayDate = new Date();
var currentYear = this.getCurrentYear();
@@ -1109,6 +1118,7 @@
}
var weekdaycounter = this.params.firstWeekDay;
+ var contentElement = null;
while (element)
{
@@ -1134,7 +1144,9 @@
if (styleclass) dataobj.customStyleClass += " " + styleclass;
}
- element.innerHTML = this.evaluateMarkup(this.params.dayListMarkup, dataobj );
+ contentElement = (this.customDayListMarkup ? element.firstChild : element);
+ contentElement.innerHTML = this.evaluateMarkup(this.params.dayListMarkup, dataobj );
+
if (weekdaycounter==6) weekdaycounter=0; else weekdaycounter++;
// class styles
@@ -1188,10 +1200,11 @@
element=element.nextSibling;
}
}
+
//alert(new Date().getTime()-_d.getTime());
- // hack for IE 6.0 //fix 1072
- if (Richfaces.browser.isIE6)
+ // hack for IE 6.0 //fix 1072 // TODO check this bug again
+ /*if (Richfaces.browser.isIE6)
{
var element = $(this.id);
if (element)
@@ -1199,7 +1212,8 @@
element.style.width = "0px";
element.style.height = "0px";
}
- }
+ }*/
+
},
renderHeader: function()
{
@@ -1538,7 +1552,7 @@
]
)];
-CalendarView.dayList = [new E('div',{'style':'overflow:hidden;width:100%;height:100%;'},[new ET(function (context) { return context.day})])];
+CalendarView.dayList = [new ET(function (context) { return context.day})];
CalendarView.weekNumber = [new ET(function (context) { return context.weekNumber})];
CalendarView.weekDay = [new ET(function (context) { return context.weekDayLabelShort})];
17 years, 2 months