JBoss Rich Faces SVN: r4248 - in branches/3.1.x/sandbox/ui/listShuttle/src/main: java/org/richfaces/component and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-25 22:05:55 -0500 (Sun, 25 Nov 2007)
New Revision: 4248
Added:
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
Modified:
branches/3.1.x/sandbox/ui/listShuttle/src/main/config/component/listShuttle.xml
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleRowKey.java
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java
branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
Log:
latest changes for listShuttle
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/config/component/listShuttle.xml
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/config/component/listShuttle.xml 2007-11-26 03:05:40 UTC (rev 4247)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/config/component/listShuttle.xml 2007-11-26 03:05:55 UTC (rev 4248)
@@ -37,11 +37,14 @@
<defaultvalue>"default"</defaultvalue>
</property>
-->
+ <property hidden="true" exist="true">
+ <name>value</name>
+ </property>
<property hidden="true" el="false">
<name>submittedValue</name>
</property>
<property hidden="true" el="false" exist="true">
- <name>submittedString</name>
+ <name>submittedStrings</name>
</property>
<property hidden="true" el="false">
<name>localValueSet</name>
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java 2007-11-26 03:05:40 UTC (rev 4247)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java 2007-11-26 03:05:55 UTC (rev 4248)
@@ -5,23 +5,35 @@
package org.richfaces.component;
import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
+import javax.faces.convert.ConverterException;
import javax.faces.el.MethodBinding;
import javax.faces.el.ValueBinding;
+import javax.faces.event.ValueChangeEvent;
import javax.faces.event.ValueChangeListener;
import javax.faces.model.DataModel;
+import org.apache.commons.collections.map.CompositeMap;
+import org.richfaces.component.UIOrderingBaseComponent.UpdateModelCommand;
import org.richfaces.component.UIOrderingList.SubmittedValue;
+import org.richfaces.component.UIOrderingList.ValueHolder;
import org.richfaces.model.ListShuttleDataModel;
import org.richfaces.model.ListShuttleRowKey;
-import org.richfaces.model.TranslatedSequenceDataModel;
/**
* JSF component class
@@ -39,41 +51,74 @@
*/
private static final long serialVersionUID = 5655312942714191981L;
//ListShuttleRowKey -> ListShuttleRowKey
- private Map translationTable = new LinkedHashMap();
+ private Map sourceTranslationTable = new LinkedHashMap();
+ private Map targetTranslationTable = new LinkedHashMap();
+
private Set selectedItems = new HashSet();
- private ListShuttleRowKey[] activeItems;
+ private List activeItems = new ArrayList();
- public SubmittedValue(String submittedString) {
+ public SubmittedValue(String[] submittedStrings) {
super();
- fromString(submittedString);
+
+ sourceListFromString(submittedStrings[0]);
+ targetListFromString(submittedStrings[1]);
}
+
+ private void convertAndStoreKey(String keyString, int i, boolean keySource) {
+ Matcher matcher = Pattern.compile("(s|t)(\\d+)(s?a?)").matcher(keyString);
+ matcher.matches();
+
+ try {
+ char c = matcher.group(1).charAt(0);
+ boolean source;
+
+ if (c == 's') {
+ source = true;
+ } else if (c == 't') {
+ source = false;
+ } else {
+ throw new IllegalArgumentException();
+ }
+
+ Integer key = Integer.valueOf(matcher.group(2));
+
+ ListShuttleRowKey orderKey = new ListShuttleRowKey(Integer.valueOf(i), keySource);
+ ListShuttleRowKey result = new ListShuttleRowKey(key, source);
+
+ Map translationMap = keySource ? sourceTranslationTable : targetTranslationTable;
+
+ translationMap.put(orderKey, result);
+
+ String group = matcher.group(3);
+ for (int j = 0; j < group.length(); j++) {
+ c = group.charAt(j);
+ if ('s' == c) {
+ selectedItems.add(orderKey);
+ } else if ('a' == c) {
+ activeItems.add(orderKey);
+ } else {
+ break ;
+ }
+
+ }
+ } catch (NumberFormatException e) {
+ // TODO: handle exception
+ }
+ }
- private void fromString(String string) {
-// String[] valueOrder = string.split(",");
-// permutationOrder = 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 {
-// permutationOrder[i] = Integer.valueOf(matcher.group(1)).intValue();
-// String group = matcher.group(2);
-// for (int j = 0; j < group.length(); j++) {
-// char c = group.charAt(j);
-// if ('s' == c) {
-// selectedItems.add(new Integer(permutationOrder[i]));
-// } else if ('a' == c) {
-// activeItem = new Integer(permutationOrder[i]);
-// } else {
-// break ;
-// }
-//
-// }
-// } catch (NumberFormatException e) {
-// // TODO: handle exception
-// }
-// }
+ private void targetListFromString(String string) {
+ String[] valueOrder = string.split(",");
+ for (int i = 0; i < valueOrder.length; i++) {
+ convertAndStoreKey(valueOrder[i], i, false);
+ }
}
+
+ private void sourceListFromString(String string) {
+ String[] valueOrder = string.split(",");
+ for (int i = 0; i < valueOrder.length; i++) {
+ convertAndStoreKey(valueOrder[i], i, true);
+ }
+ }
public String toString() {
StringBuffer result = new StringBuffer();
@@ -97,13 +142,30 @@
return result.toString();
}
- public Map getTranslationTable() {
- return translationTable;
+ public Map getSourceTranslationTable() {
+ return sourceTranslationTable;
}
+
+ public Map getTargetTranslationTable() {
+ return targetTranslationTable;
+ }
}
private transient SubmittedValue submittedValueHolder = null;
+ protected static final class ValueHolder implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2124352131407581704L;
+
+ private Object sourceValue;
+ private boolean sourceValueSet;
+
+ private Object targetValue;
+ private boolean targetValueSet;
+ }
+
private Object sourceValue;
private boolean sourceValueSet;
@@ -139,6 +201,7 @@
public void setSourceValue(Object sourceValue) {
this.sourceValue = sourceValue;
+ this.sourceValueSet = true;
}
public Object getLocalTargetValue() {
@@ -160,29 +223,47 @@
public void setTargetValue(Object targetValue) {
this.targetValue = targetValue;
+ this.targetValueSet = true;
}
- public String getSubmittedString() {
+ public String[] getSubmittedStrings() {
return null;
}
- public void setSubmittedString(String submittedString) {
-
+ public void setSubmittedStrings(String[] submittedStrings) {
+ //TODO check for parameters correlation
+ this.submittedValueHolder = new SubmittedValue(submittedStrings);
}
- public Object saveIterationSubmittedState() {
- return null;
+ protected Object saveIterationSubmittedState() {
+ return submittedValueHolder;
}
- public void restoreIterationSubmittedState(Object object) {
+ protected void restoreIterationSubmittedState(Object object) {
+ this.submittedValueHolder = (SubmittedValue) object;
}
- public Object saveIterationState() {
- return null;
- }
+ protected Object saveIterationState() {
+ ValueHolder holder = new ValueHolder();
- public void restoreIterationState(Object object) {
+ holder.sourceValue = sourceValue;
+ holder.sourceValueSet = sourceValueSet;
+
+ holder.targetValue = targetValue;
+ holder.targetValueSet = targetValueSet;
+
+ return holder;
}
+
+ protected void restoreIterationState(Object object) {
+ ValueHolder holder = (ValueHolder) object;
+
+ sourceValue = holder.sourceValue ;
+ sourceValueSet = holder.sourceValueSet;
+
+ targetValue = holder.targetValue;
+ targetValueSet = holder.targetValueSet;
+ }
public org.ajax4jsf.model.ExtendedDataModel createDataModel() {
DataModel sourceDataModel = createDataModel(getSourceValue());
@@ -190,7 +271,10 @@
if (isTranslatedRenderingState() || isTranslatedState()) {
return new ListShuttleDataModel(sourceDataModel, targetDataModel,
- isTranslatedState(), submittedValueHolder != null ? submittedValueHolder.translationTable : null);
+ isTranslatedState(),
+ submittedValueHolder != null ?
+ new CompositeMap(submittedValueHolder.sourceTranslationTable, submittedValueHolder.targetTranslationTable)
+ : null);
} else {
return new ListShuttleDataModel(sourceDataModel, targetDataModel, false, null);
}
@@ -219,4 +303,289 @@
ListShuttleDataModel dataModel = (ListShuttleDataModel) getExtendedDataModel();
return dataModel.isTarget();
}
+
+ public String getSourceSubmittedString() {
+ //TODO implement
+ return "";
+ }
+
+ public String getTargetSubmittedString() {
+ //TODO implement
+ return "";
+ }
+
+ private final UpdateModelCommand updateSourceCommand = new UpdateModelCommand() {
+
+ public void execute(FacesContext context) {
+ if (sourceValueSet) {
+ ValueBinding vb = getValueBinding("sourceValue");
+ if (vb != null) {
+ vb.setValue(context, sourceValue);
+ sourceValue = null;
+ sourceValueSet = false;
+ }
+ }
+ }
+
+ };
+
+ private final UpdateModelCommand updateTargetCommand = new UpdateModelCommand() {
+
+ public void execute(FacesContext context) {
+ if (targetValueSet) {
+ ValueBinding vb = getValueBinding("targetValue");
+ if (vb != null) {
+ vb.setValue(context, targetValue);
+ targetValue = null;
+ targetValueSet = false;
+ }
+ }
+ }
+
+ };
+
+ /**
+ * <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()) {
+ return;
+ }
+
+ updateModel(context, updateSourceCommand);
+ updateModel(context, updateTargetCommand);
+ }
+
+
+ // ------------------------------------------------------ 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
+ if (submittedValueHolder == null) {
+ return;
+ }
+
+ Object[] newValue = null;
+
+ try {
+ newValue = getConvertedValue(context);
+ }
+ catch (ConverterException ce) {
+ Object submittedValue = submittedValueHolder;
+ //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 rowKey = getRowKey();
+//
+// Set selectionSet = new HashSet();
+// Set selectedItems = submittedValueHolder.selectedItems;
+// for (Iterator iterator = selectedItems.iterator(); iterator
+// .hasNext();) {
+// setRowKey(context, iterator.next());
+// Object selectionItem = getRowData();
+//
+// selectionSet.add(selectionItem);
+// }
+//
+// setSelection(selectionSet);
+
+// if (submittedValueHolder.activeItem != null) {
+// setRowKey(context, submittedValueHolder.activeItem);
+// Object activeItem = getRowData();
+//
+// setActiveItem(activeItem);
+// } else {
+// setActiveItem(null);
+// }
+
+ Object previousSource = getSourceValue();
+ Object previousTarget = getTargetValue();
+ setSourceValue(newValue[0]);
+ setTargetValue(newValue[1]);
+ setTranslatedState();
+ //setSubmittedValue(null);
+ if (compareValues(previousSource, newValue[0]) || compareValues(previousTarget, newValue[1])) {
+ queueEvent(new ValueChangeEvent(this, new Object[]{previousSource,previousTarget}, newValue));
+ }
+
+ this.submittedValueHolder = null;
+
+ setRowKey(rowKey);
+ }
+ }
+
+ private interface DataAdder {
+ Object getContainer();
+ void add(Object object);
+ }
+
+ private class ListDataAdder implements DataAdder {
+ private List container;
+
+ public ListDataAdder(int size) {
+ container = new ArrayList(size);
+ }
+
+ public Object getContainer() {
+ return container;
+ }
+
+ public void add(Object object) {
+ container.add(object);
+ }
+ }
+
+ private class ArrayDataAdder implements DataAdder {
+ private int idx = 0;
+ private Object[] objects;
+
+ public ArrayDataAdder(Class objectClass, int size) {
+ this.objects = (Object[]) Array.newInstance(objectClass.getComponentType(),
+ size);
+ }
+
+ public void add(Object object) {
+ this.objects[idx++] = object;
+ }
+
+ public Object getContainer() {
+ return objects;
+ }
+ }
+
+ private DataAdder createDataAdder(Object object, int size) {
+ if (object instanceof List) {
+ return new ListDataAdder(size);
+ } else {
+ return new ArrayDataAdder(object.getClass(), size);
+ }
+ }
+
+ protected Object[] getConvertedValue(FacesContext context) throws ConverterException {
+// Object convertedValue = getSourceValue();
+// if (convertedValue == null) {
+// convertedValue = new Object[0];
+// }
+
+ if (submittedValueHolder != null) {
+ Object rowKey = getRowKey();
+
+ Map source = submittedValueHolder.sourceTranslationTable;
+ Map target = submittedValueHolder.targetTranslationTable;
+
+ DataAdder sourceValue = createDataAdder(getSourceValue(), source.size());
+ DataAdder targetValue = createDataAdder(getTargetValue(), target.size());
+
+ Iterator iterator = source.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+
+ setRowKey(context, entry.getValue());
+ sourceValue.add(getRowData());
+ }
+
+ iterator = target.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+
+ setRowKey(context, entry.getValue());
+ targetValue.add(getRowData());
+ }
+
+ setRowKey(rowKey);
+
+ return new Object[] {sourceValue.getContainer(), targetValue.getContainer()};
+ }
+
+ return null;
+ }
+
+ protected void resetDataModel() {
+ super.resetDataModel();
+
+ if (this.submittedValueHolder != null) {
+ setTranslatedRenderingState();
+ }
+ }
}
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleRowKey.java
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleRowKey.java 2007-11-26 03:05:40 UTC (rev 4247)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleRowKey.java 2007-11-26 03:05:55 UTC (rev 4248)
@@ -55,7 +55,7 @@
}
public String toString() {
- return rowKey.toString() + (source ? "y" : "n");
+ return (source ? "s" : "t") + rowKey.toString();
}
public ListShuttleRowKey(Object rowKey, boolean source) {
Added: branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java (rev 0)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java 2007-11-26 03:05:55 UTC (rev 4248)
@@ -0,0 +1,147 @@
+package org.richfaces.renderkit;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.UIOrderingBaseComponent;
+import org.richfaces.renderkit.html.images.ListShuttleIconCopy;
+import org.richfaces.renderkit.html.images.ListShuttleIconCopyAll;
+import org.richfaces.renderkit.html.images.ListShuttleIconCopyAllDisabled;
+import org.richfaces.renderkit.html.images.ListShuttleIconCopyDisabled;
+import org.richfaces.renderkit.html.images.ListShuttleIconRemove;
+import org.richfaces.renderkit.html.images.ListShuttleIconRemoveAll;
+import org.richfaces.renderkit.html.images.ListShuttleIconRemoveAllDisabled;
+import org.richfaces.renderkit.html.images.ListShuttleIconRemoveDisabled;
+
+public class ListShuttleControlsHelper {
+
+ private final static String FACET_COPY_ALL = "copyAllControl";
+
+ private final static String FACET_REMOVE_ALL = "removeAllControl";
+
+ private final static String FACET_COPY = "copyControl";
+
+ private final static String FACET_REMOVE = "removeControl";
+
+ private final static String FACET_DIS_COPY_ALL = FACET_COPY_ALL + "Disabled";
+
+ private final static String FACET_DIS_REMOVE_ALL = FACET_REMOVE_ALL + "Disabled";
+
+ private final static String FACET_DIS_COPY = FACET_COPY + "Disabled";
+
+ private final static String FACET_DIS_REMOVE = FACET_REMOVE + "Disabled";
+
+ public final static String FACET_CAPTION = "caption";
+
+ private final static String ATTRIBUTE_CE_ONCOPYALLCLICK = "oncopyallclick";
+
+ private final static String ATTRIBUTE_CE_ONREMOVECLICK = "onremoveclick";
+
+ private final static String ATTRIBUTE_CE_ONCOPYCLICK = "oncopyclick";
+
+ private final static String ATTRIBUTE_CE_ONREMOVEALLCLICK = "onremoveallclick";
+
+ public final static String ATTRIBUTE_CAPTION_LABEL = "captionLabel";
+
+ private final static String ATTRIBUTE_CLASS_COPY_ALL_CONTROL = FACET_COPY_ALL + "Class";
+
+ private final static String ATTRIBUTE_CLASS_REMOVE_ALL_CONTROL = FACET_REMOVE_ALL + "Class";
+
+ private final static String ATTRIBUTE_CLASS_REMOVE_CONTROL = FACET_REMOVE + "Class";
+
+ private final static String ATTRIBUTE_CLASS_COPY_CONTROL = FACET_COPY + "Class";
+
+ private final static String ATTRIBUTE_CLASS_DISABLED_CONTROL = "disabledControlClass";
+
+ private final static String DIS_CONTROL_ID_PREFIX = "dis";
+
+ private final static String CONTROL_ID_COPY_ALL = "copyAll";
+
+ private final static String CONTROL_ID_COPY = "copy";
+
+ private final static String CONTROL_ID_REMOVE = "remove";
+
+ private final static String CONTROL_ID_REMOVE_ALL = "removeAll";
+
+ private final static String DEFAULT_LABEL_COPY_ALL = "Copy all";
+ private final static String DEFAULT_LABEL_COPY = "Copy";
+ private final static String DEFAULT_LABEL_REMOVE = "Remove";
+ private final static String DEFAULT_LABEL_REMOVE_ALL = "Remove All";
+
+ private final static String ATTRIBUTE_CLASS_BUTTON = "ol_button";
+ private final static String ATTRIBUTE_CLASS_BUTTON_DISABLED = "ol_button_disabled";
+
+ protected static final OrderingComponentRendererBase.ControlsHelper[] HELPERS = new OrderingComponentRendererBase.ControlsHelper[] {
+ new OrderingComponentRendererBase.ControlsHelper("copyAll", "COPY_ALL_LABEL", DEFAULT_LABEL_COPY_ALL, ListShuttleIconCopyAll.class.getName(), FACET_COPY_ALL,
+ " rich-ordering-control-top", ATTRIBUTE_CLASS_COPY_ALL_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ CONTROL_ID_COPY_ALL, ATTRIBUTE_CE_ONCOPYALLCLICK, true) {
+
+ public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+ return list.isFastOrderControlsVisible();
+ }
+
+ },
+ new OrderingComponentRendererBase.ControlsHelper("disabledCopyAll", "COPY_ALL_LABEL", DEFAULT_LABEL_COPY_ALL, ListShuttleIconCopyAllDisabled.class.getName(), FACET_DIS_COPY_ALL,
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY_ALL), null, false) {
+
+ public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+ return list.isFastOrderControlsVisible();
+ }
+
+ },
+ new OrderingComponentRendererBase.ControlsHelper("copy", "COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopy.class.getName(), FACET_COPY,
+ " rich-ordering-control-up", ATTRIBUTE_CLASS_COPY_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ CONTROL_ID_COPY, ATTRIBUTE_CE_ONCOPYCLICK ,true) {
+
+ public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+ return list.isOrderControlsVisible();
+ }
+
+ },
+ new OrderingComponentRendererBase.ControlsHelper("disabledCopy", "COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopyDisabled.class.getName(), FACET_DIS_COPY,
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY), null, false) {
+
+ public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+ return list.isOrderControlsVisible();
+ }
+
+ },
+ new OrderingComponentRendererBase.ControlsHelper("remove", "REMOVE_LABEL", DEFAULT_LABEL_REMOVE, ListShuttleIconRemove.class.getName(), FACET_REMOVE,
+ " rich-ordering-control-down", ATTRIBUTE_CLASS_REMOVE_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ CONTROL_ID_REMOVE, ATTRIBUTE_CE_ONREMOVECLICK, true) {
+
+ public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+ return list.isOrderControlsVisible();
+ }
+
+ },
+ new OrderingComponentRendererBase.ControlsHelper("disabledRemove", "REMOVE_LABEL", DEFAULT_LABEL_REMOVE, ListShuttleIconRemoveDisabled.class.getName(), FACET_DIS_REMOVE,
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE), null, false) {
+
+ public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+ return list.isOrderControlsVisible();
+ }
+
+ },
+ new OrderingComponentRendererBase.ControlsHelper("removeAll", "REMOVE_ALL_LABEL", DEFAULT_LABEL_REMOVE_ALL, ListShuttleIconRemoveAll.class.getName(), FACET_REMOVE_ALL,
+ " rich-ordering-control-bottom", ATTRIBUTE_CLASS_REMOVE_ALL_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ CONTROL_ID_REMOVE_ALL, ATTRIBUTE_CE_ONREMOVEALLCLICK, true) {
+
+ public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+ return list.isFastOrderControlsVisible();
+ }
+
+ },
+ new OrderingComponentRendererBase.ControlsHelper("disabledRemoveAll", "REMOVE_ALL_LABEL", DEFAULT_LABEL_REMOVE_ALL, ListShuttleIconRemoveAllDisabled.class.getName(), FACET_DIS_REMOVE_ALL,
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE_ALL), null, false) {
+
+ public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
+ return list.isFastOrderControlsVisible();
+ }
+
+ }
+ };
+}
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java 2007-11-26 03:05:40 UTC (rev 4247)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java 2007-11-26 03:05:55 UTC (rev 4248)
@@ -18,7 +18,6 @@
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.UIListShuttle;
import org.richfaces.component.UIOrderingBaseComponent;
-import org.richfaces.component.UIOrderingList;
/**
* @author Nick Belaevski
@@ -30,7 +29,7 @@
public final static String FACET_TARGET_CAPTION = "targetCaption";
- protected static final OrderingComponentRendererBase.ControlsHelper[] SHUTTLE_HELPERS = OrderingComponentControlsHelper.HELPERS;
+ protected static final OrderingComponentRendererBase.ControlsHelper[] SHUTTLE_HELPERS = ListShuttleControlsHelper.HELPERS;
protected static final OrderingComponentRendererBase.ControlsHelper[] TL_HELPERS = OrderingComponentControlsHelper.HELPERS;
@@ -133,7 +132,7 @@
public void encodeTLControlsFacets(FacesContext context, UIOrderingBaseComponent component)
throws IOException {
- String clientId = component.getClientId(context) + "targetList";
+ String clientId = component.getClientId(context);
encodeControlsFacets(context, component, TL_HELPERS, clientId);
}
@@ -162,5 +161,16 @@
}
}
+ protected void doDecode(FacesContext context, UIComponent component) {
+ super.doDecode(context, component);
+
+ String clientId = component.getClientId(context);
+ Object object = context.getExternalContext().getRequestParameterValuesMap().get(clientId);
+ if (object != null) {
+ UIListShuttle listShuttle = (UIListShuttle) component;
+ String[] submittedValues = (String[]) object;
+ listShuttle.setSubmittedStrings(submittedValues);
+ }
+ }
}
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2007-11-26 03:05:40 UTC (rev 4247)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2007-11-26 03:05:55 UTC (rev 4248)
@@ -90,7 +90,7 @@
this.moveItem(sourceComponent, targetComponent, item);
}
this.controlListManager();
- this.sourceList.controlListManager();
+ this.targetList.controlListManager();
this.saveState();
}
},
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2007-11-26 03:05:40 UTC (rev 4247)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2007-11-26 03:05:55 UTC (rev 4248)
@@ -29,9 +29,10 @@
<table id="#{clientId}">
<tr>
<td>
- <div id="#{clientId}sourceList" x:passThruWithExclusions="id">
+ <input id="#{clientId}valueKeeper" type="hidden" name="#{clientId}" value="#{component.sourceSubmittedString}"/>
+ <input id="#{clientId}tlValueKeeper" type="hidden" name="#{clientId}" value="#{component.targetSubmittedString}"/>
+ <div>
<input id="#{clientId}focusKeeper" type="button" value="" style="width: 1px; position: absolute; left: -32767px;" name="focusKeeper"/>
- <input id="#{clientId}valueKeeper" type="hidden" name="#{clientId}" value="#{component.submittedString}"/>
<table id="#{clientId}table" cellpadding="0" cellspacing="0" class="ol_body">
<tbody>
@@ -63,19 +64,22 @@
</div>
</td>
<td>
- <a id="#{clientId}copy" href="#">copy</a><br/>
+ <div class="ol_button_layout">
+ <f:call name="encodeShuttleControlsFacets" />
+ </div>
+
+ <!-- a id="#{clientId}copy" href="#">copy</a><br/>
<a id="#{clientId}disCopy" href="#">dcopy</a><br/>
<a id="#{clientId}copyAll" href="#">copyAll</a><br/>
<a id="#{clientId}disCopyAll" href="#">dcopyAll</a><br/>
<a id="#{clientId}remove" href="#">remove</a><br/>
<a id="#{clientId}disRemove" href="#">dremove</a><br/>
<a id="#{clientId}removeAll" href="#">removeAll</a><br/>
- <a id="#{clientId}disRemoveAll" href="#">dremoveAll</a>
+ <a id="#{clientId}disRemoveAll" href="#">dremoveAll</a-->
</td>
<td>
- <div id="#{clientId}targetList" x:passThruWithExclusions="id">
+ <div>
<input id="#{clientId}tlFocusKeeper" type="button" value="" style="width: 1px; position: absolute; left: -32767px;" name="focusKeeper"/>
- <input id="#{clientId}tlValueKeeper" type="hidden" name="#{clientId}" value="#{component.submittedString}"/>
<table id="#{clientId}tlTable" cellpadding="0" cellspacing="0" class="ol_body">
<tbody>
@@ -126,9 +130,9 @@
document.body.className = "body";
function init() {
var cotrolsIdPrefix = [['up', 'disup'], ['down', 'disdown'], ['last', 'dislast'], ['first','disfirst']];
- var listShuttleCotrolsIdPrefix = [['copy', 'disCopy'], ['copyAll', 'disCopyAll'], ['remove', 'disRemove'], ['removeAll','disRemoveAll']];
- var listShuttle = new Richfaces.ListShuttle(new Richfaces.OrderingList('#{cId}targetList', '#{cId}tlInternal_tab', '#{cId}tlInternal_header_tab', '#{cId}tlFocusKeeper', '#{cId}tlValueKeeper', cotrolsIdPrefix, '#{cId}sortLabel', function() {#{component.attributes['onorderchanged']}}),
- new Richfaces.ListBase('#{cId}sourceList', '#{cId}internal_tab', '#{cId}internal_header_tab', '#{cId}focusKeeper', '#{cId}valueKeeper'),
+ var listShuttleCotrolsIdPrefix = [['copy', 'discopy'], ['copyAll', 'discopyAll'], ['remove', 'disremove'], ['removeAll','disremoveAll']];
+ var listShuttle = new Richfaces.ListShuttle(new Richfaces.OrderingList('#{cId}', '#{cId}tlInternal_tab', '#{cId}tlInternal_header_tab', '#{cId}tlFocusKeeper', '#{cId}tlValueKeeper', cotrolsIdPrefix, '#{cId}sortLabel', function() {#{component.attributes['onorderchanged']}}),
+ new Richfaces.ListBase('#{cId}', '#{cId}internal_tab', '#{cId}internal_header_tab', '#{cId}focusKeeper', '#{cId}valueKeeper'),
"#{cId}", listShuttleCotrolsIdPrefix);
var sourceLayoutManager = new LayoutManager('#{cId}internal_header_tab', '#{cId}internal_tab');
var targetLayoutManager = new LayoutManager('#{cId}tlInternal_header_tab', '#{cId}tlInternal_tab');
16 years, 5 months
JBoss Rich Faces SVN: r4247 - in branches/3.1.x/sandbox/samples/listShuttleDemo/src/main: webapp/pages and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-25 22:05:40 -0500 (Sun, 25 Nov 2007)
New Revision: 4247
Modified:
branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/ListShuttleDemoBean.java
branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/ListShuttleOptionItem.java
branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/pages/index.jsp
Log:
latest changes for listShuttle
Modified: branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/ListShuttleDemoBean.java
===================================================================
--- branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/ListShuttleDemoBean.java 2007-11-23 20:28:40 UTC (rev 4246)
+++ branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/ListShuttleDemoBean.java 2007-11-26 03:05:40 UTC (rev 4247)
@@ -37,6 +37,25 @@
}
public void setSource(ListShuttleOptionItem[] source) {
+ System.out.print("ListShuttleDemoBean.setSource() ");
+ if (source == null) {
+ System.out.println("null");
+ } else {
+ int iMax = source.length - 1;
+ if (iMax == -1) {
+ System.out.println("[]");
+ } else {
+ System.out.print('[');
+ for (int i = 0; i < iMax; i++) {
+ System.out.print(source[i]);
+ if (i != iMax - 1) {
+ System.out.print(", ");
+ }
+ }
+ System.out.println(']');
+ }
+ }
+
this.source = source;
}
@@ -45,6 +64,7 @@
}
public void setTarget(List target) {
+ System.out.println("ListShuttleDemoBean.setTarget() " + target);
this.target = target;
}
Modified: branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/ListShuttleOptionItem.java
===================================================================
--- branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/ListShuttleOptionItem.java 2007-11-23 20:28:40 UTC (rev 4246)
+++ branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/ListShuttleOptionItem.java 2007-11-26 03:05:40 UTC (rev 4247)
@@ -36,4 +36,7 @@
return this.getClass().getSimpleName() + " [" + name + "] by " + price;
}
+ public void action() {
+ System.out.println("ListShuttleOptionItem.action() " + this.toString());
+ }
}
Modified: branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/pages/index.jsp
===================================================================
--- branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/pages/index.jsp 2007-11-23 20:28:40 UTC (rev 4246)
+++ branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/pages/index.jsp 2007-11-26 03:05:40 UTC (rev 4247)
@@ -1,6 +1,8 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
+
<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/ui/listShuttle" prefix="ls" %>
<html>
@@ -9,10 +11,20 @@
</head>
<body>
<f:view>
+ <a4j:outputPanel ajaxRendered="true">
+ <h:messages />
+ </a4j:outputPanel>
+
<h:form>
<ls:listShuttle var="item" sourceValue="#{listShuttleDemoBean.source}" targetValue="#{listShuttleDemoBean.target}">
<h:column><h:outputText value="#{item.name}" /></h:column>
<h:column><h:outputText value="#{item.price}" /></h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Action Links" />
+ </f:facet>
+ <h:commandLink value="Server Action" action="#{item.action}" />
+ </h:column>
</ls:listShuttle>
16 years, 5 months
JBoss Rich Faces SVN: r4246 - trunk/docs/faq/en/src/main/docbook/module.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2007-11-23 15:28:40 -0500 (Fri, 23 Nov 2007)
New Revision: 4246
Modified:
trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
Log:
RF-391 - add 'How to get row selection in scrollableDataTable using one and multi-selection rows mode?' section
Modified: trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
===================================================================
--- trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2007-11-23 20:27:35 UTC (rev 4245)
+++ trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2007-11-23 20:28:40 UTC (rev 4246)
@@ -1137,4 +1137,68 @@
...
]]></programlisting>
</section>
+ <section id="RowSelectionInScrollableDataTable">
+ <?dbhtml filename="RowSelectionInScrollableDataTable.html"?>
+ <title>How to get row selection in scrollableDataTable using one and multi-selection rows mode?</title>
+ The <para><emphasis>
+ <property>"selection"</property>
+ </emphasis> attribute is a reference to object to the instace of <code>org.richfaces.model.selection.Selection</code> interface, containing current selection.</para>
+ <para>In order to get the row data in one and multi-selection rows mode you should use
+ the <emphasis><property>"selection"</property></emphasis> attribute and then work up the selection in particular way.</para>
+<programlisting role="XML"><![CDATA[...
+<rich:scrollableDataTable frozenColCount="1" height="400px"
+ width="700px" id="carList" rows="40" columnClasses="col"
+ value="#{dataTableScrollerBean.allCars}" var="category" sortMode="single"
+ selection="#{dataTableScrollerBean.selection}">
+
+ <rich:column id="make">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Make" />
+ </f:facet>
+ <h:outputText value="#{category.make}" />
+ </rich:column>
+ <rich:column id="model">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Model" />
+ </f:facet>
+ <h:outputText value="#{category.model}" />
+ </rich:column>
+ <rich:column id="price">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Price" />
+ </f:facet>
+ <h:outputText value="#{category.price}" />
+ </rich:column>
+
+</rich:scrollableDataTable>
+...
+]]></programlisting>
+ <para>In order to get data from <property>selection</property> you can create a managed bean like this one.</para>
+ <programlisting role="XML"><![CDATA[...
+public class DataTableScrollerBean {
+ private SimpleSelection selection = new SimpleSelection();
+ private ArrayList<DemoInventoryItem> selectedCars = new ArrayList<DemoInventoryItem>();
+
+ ...
+
+ public SimpleSelection getSelection() {
+ return selection;
+ }
+
+ public String takeSelection() {
+ getSelectedCars().clear();
+ Iterator<SimpleRowKey> iterator = getSelection().getKeys();
+ while (iterator.hasNext()){
+ SimpleRowKey key = iterator.next();
+ getSelectedCars().add(getAllCars().get(key.intValue()));
+ }
+ return null;
+ }
+
+ public ArrayList<DemoInventoryItem> getSelectedCars() {
+ return selectedCars;
+ }
+...
+]]></programlisting>
+ </section>
</chapter>
16 years, 5 months
JBoss Rich Faces SVN: r4245 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2007-11-23 15:27:35 -0500 (Fri, 23 Nov 2007)
New Revision: 4245
Modified:
trunk/docs/userguide/en/src/main/docbook/included/scrollableDataTable.xml
Log:
RF-391 - fix the Details of Usage of scrollableDataTable. Edit 'selection' attribute examples.
Modified: trunk/docs/userguide/en/src/main/docbook/included/scrollableDataTable.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/scrollableDataTable.xml 2007-11-23 18:51:30 UTC (rev 4244)
+++ trunk/docs/userguide/en/src/main/docbook/included/scrollableDataTable.xml 2007-11-23 20:27:35 UTC (rev 4245)
@@ -133,21 +133,62 @@
...
]]></programlisting>
<para>In order to get the row data when using <property>one and multi-selection rows mode</property> the access to the selected rows is required.</para>
- <para>In this case you can use the <emphasis><property>"selection"</property></emphasis> attribute. Simple code is placed below.</para>
+ <para>In this case you can use the <emphasis><property>"selection"</property></emphasis> attribute.
+ This attribute is a reference to object to the instace of <code>org.richfaces.model.selection.Selection</code> interface, containing current selection.</para>
+ It's only necessary to work up a selection in a particular way and to get data.
+Simple code is placed below.
+ <para><emphasis role="bold">Example:</emphasis></para>
<programlisting role="XML"><![CDATA[...
-<rich:scrollableDataTable value="#{bean.property1}" var="cur" selection="#{bean.selection}">
- <rich:column width="100px">
- <f:facet name="header" >
- <h:outputText value="State"/>
- </f:facet>
- <h:outputText value="#{cur.cell1}"/>
- <f:facet name="footer">
- <h:outputText value="State"/>
- </f:facet>
- </rich:column>
+<rich:scrollableDataTable frozenColCount="1" height="400px"
+ width="700px" id="carList" rows="40" columnClasses="col"
+ value="#{dataTableScrollerBean.allCars}" var="category" sortMode="single"
+ selection="#{dataTableScrollerBean.selection}">
+
+ <rich:column id="make">
+ <f:facet name="header"><h:outputText styleClass="headerText" value="Make" /></f:facet>
+ <h:outputText value="#{category.make}" />
+ </rich:column>
+ <rich:column id="model">
+ <f:facet name="header"><h:outputText styleClass="headerText" value="Model" /></f:facet>
+ <h:outputText value="#{category.model}" />
+ </rich:column>
+ <rich:column id="price">
+ <f:facet name="header"><h:outputText styleClass="headerText" value="Price" /></f:facet>
+ <h:outputText value="#{category.price}" />
+ </rich:column>
+
</rich:scrollableDataTable>
...
]]></programlisting>
+ <para>In order to build this application, you can create a managed bean like this one.
+ Function takeSelection() fills the array 'selectedCars': with the data, got from the <property>selection</property>.</para>
+ <para><emphasis role="bold">Example:</emphasis></para>
+ <programlisting role="XML"><![CDATA[...
+public class DataTableScrollerBean {
+ private SimpleSelection selection = new SimpleSelection();
+ private ArrayList<DemoInventoryItem> selectedCars = new ArrayList<DemoInventoryItem>();
+
+ ...
+
+ public SimpleSelection getSelection() {
+ return selection;
+ }
+
+ public String takeSelection() {
+ getSelectedCars().clear();
+ Iterator<SimpleRowKey> iterator = getSelection().getKeys();
+ while (iterator.hasNext()){
+ SimpleRowKey key = iterator.next();
+ getSelectedCars().add(getAllCars().get(key.intValue()));
+ }
+ return null;
+ }
+
+ public ArrayList<DemoInventoryItem> getSelectedCars() {
+ return selectedCars;
+ }
+...
+]]></programlisting>
<para>
Finally, the component has the following extra attributes for event processing on the client:
<itemizedlist>
16 years, 5 months
JBoss Rich Faces SVN: r4244 - in branches/3.1.x/samples/orderingListDemo/src/main: webapp/pages and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-11-23 13:51:30 -0500 (Fri, 23 Nov 2007)
New Revision: 4244
Modified:
branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
branches/3.1.x/samples/orderingListDemo/src/main/webapp/pages/index.jsp
Log:
Ordering list demo: some small fixes for effects.
Modified: branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
===================================================================
--- branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-23 18:30:52 UTC (rev 4243)
+++ branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-23 18:51:30 UTC (rev 4244)
@@ -15,8 +15,8 @@
private String controlsVerticalAlign = "center";
private String headerLabel = "headerLabel";
- private String ontopclick = "new Effect.Highlight('form:ontopclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});";
- private String onbottomclick = "new Effect.Highlight('form:onbottomclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});";
+ private String ontopclick = "new Effect.Highlight('form:ontopclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000', restorecolor: 'green'});";
+ private String onbottomclick = "new Effect.Highlight('form:onbottomclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000', restorecolor: 'green'});";
private boolean orderControlsVisible = true;
private boolean fastOrderControlsVisible = true;
Modified: branches/3.1.x/samples/orderingListDemo/src/main/webapp/pages/index.jsp
===================================================================
--- branches/3.1.x/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-23 18:30:52 UTC (rev 4243)
+++ branches/3.1.x/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-23 18:51:30 UTC (rev 4244)
@@ -53,10 +53,10 @@
ontopclick="#{demoBean.ontopclick}"
onbottomclick="#{demoBean.onbottomclick}"
- onorderchanged="new Effect.Highlight('form:onorderchangedDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
- ondownclick="new Effect.Highlight('form:ondownclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
- onheaderclick="new Effect.Highlight('form:onheaderclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
- onupclick="new Effect.Highlight('form:onupclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});" >
+ onorderchanged="new Effect.Highlight('form:onorderchangedDiv', {startcolor:'#FF0000', endcolor:'#FF0000', restorecolor: 'green'});"
+ ondownclick="new Effect.Highlight('form:ondownclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000', restorecolor: 'green'});"
+ onheaderclick="new Effect.Highlight('form:onheaderclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000', restorecolor: 'green'});"
+ onupclick="new Effect.Highlight('form:onupclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000', restorecolor: 'green'});" >
<h:column>
<f:facet name="header">
16 years, 5 months
JBoss Rich Faces SVN: r4243 - branches/3.1.x/ui/orderingList/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2007-11-23 13:30:52 -0500 (Fri, 23 Nov 2007)
New Revision: 4243
Modified:
branches/3.1.x/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
Log:
bug fixed : RF-1381
Modified: branches/3.1.x/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2007-11-23 17:56:09 UTC (rev 4242)
+++ branches/3.1.x/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2007-11-23 18:30:52 UTC (rev 4243)
@@ -63,8 +63,6 @@
</tr>
</tbody>
</table>
- <a id="#{clientId}sortLabel" href="#">Header</a>
-
<f:clientId var="cId"/>
<script type="text/javascript">
var clientId = '#{cId}';
16 years, 5 months
JBoss Rich Faces SVN: r4242 - branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2007-11-23 12:56:09 -0500 (Fri, 23 Nov 2007)
New Revision: 4242
Modified:
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
Log:
autoscroll fixed
Modified: branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2007-11-23 17:54:59 UTC (rev 4241)
+++ branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2007-11-23 17:56:09 UTC (rev 4242)
@@ -41,8 +41,6 @@
this.activeItem = null;
- this.shuttleTop = LayoutManager.getElemXY(this.shuttleTable).top;
-
$(contentTableId).observe("click", function(e) {this.onclickHandler(window.event || e)}.bindAsEventListener(this));
},
@@ -293,16 +291,19 @@
this.selectedItems.sort(this.compareByRowIndex);
var increment;
var scrollTop = this.shuttleTable.parentNode.scrollTop;
+
+ var shuttleTop = LayoutManager.getElemXY(this.shuttleTable.parentNode).top;
+
if (action == 'up' || action == 'first') {
var targetItemTop = LayoutManager.getElemXY(this.selectedItems[0]).top;
- increment = (targetItemTop - scrollTop) - this.shuttleTop;
+ increment = (targetItemTop - scrollTop) - shuttleTop;
if (increment < 0) {
this.shuttleTable.parentNode.scrollTop += increment;
}
} else if (action == 'down' || action == 'last') {
var item = this.selectedItems[this.selectedItems.length - 1];
- targetItemBottom = LayoutManager.getElemXY(this.selectedItems[this.selectedItems.length - 1]).top + item.offsetHeight;
- var increment = (targetItemBottom - scrollTop) - (this.shuttleTop + this.shuttleTable.parentNode.offsetHeight - LayoutManager.SCROLL_WIDTH);
+ var targetItemBottom = LayoutManager.getElemXY(this.selectedItems[this.selectedItems.length - 1]).top + item.offsetHeight;
+ var increment = (targetItemBottom - scrollTop) - (shuttleTop + this.shuttleTable.parentNode.clientHeight);
if (increment > 0) {
this.shuttleTable.parentNode.scrollTop += increment;
}
16 years, 5 months
JBoss Rich Faces SVN: r4241 - trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2007-11-23 12:54:59 -0500 (Fri, 23 Nov 2007)
New Revision: 4241
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml
Log:
http://jira.jboss.com/jira/browse/RF-1422
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml 2007-11-23 17:48:57 UTC (rev 4240)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml 2007-11-23 17:54:59 UTC (rev 4241)
@@ -37,19 +37,18 @@
<f:facet name="header"><h:outputText styleClass="headerText" value="Stock" /></f:facet>
<h:outputText value="#{category.stock}" />
</rich:column>
-
-
-
</rich:scrollableDataTable>
-
- <a4j:commandButton value="Take Selection" reRender="table" action="#{dataTableScrollerBean.takeSelection}" oncomplete="javascript:Richfaces.showModalPanel('panel');"/>
+ <rich:spacer height="20px"/>
+ <a4j:commandButton value="Show Current Selection" reRender="table"
+ action="#{dataTableScrollerBean.takeSelection}"
+ oncomplete="javascript:Richfaces.showModalPanel('panel');"/>
</h:form>
<rich:modalPanel id="panel" autosized="true">
<f:facet name="header">
<h:outputText value="Selected Rows"/>
</f:facet>
<f:facet name="controls">
- <a href="#" onclick="javascript:Richfaces.hideModalPanel('panel')">X</a>
+ <span style="cursor:pointer" onclick="javascript:Richfaces.hideModalPanel('panel')">X</span>
</f:facet>
<rich:dataTable value="#{dataTableScrollerBean.selectedCars}" var="sel" id="table">
<rich:column>
16 years, 5 months
JBoss Rich Faces SVN: r4240 - in trunk/samples/richfaces-demo/src/main: webapp/richfaces/scrollableDataTable/examples and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2007-11-23 12:48:57 -0500 (Fri, 23 Nov 2007)
New Revision: 4240
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java
trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml
Log:
http://jira.jboss.com/jira/browse/RF-1422
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java 2007-11-23 17:45:21 UTC (rev 4239)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java 2007-11-23 17:48:57 UTC (rev 4240)
@@ -4,13 +4,15 @@
package org.richfaces.datatablescroller;
import java.math.BigDecimal;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Iterator;
import java.util.List;
import java.util.Random;
import org.richfaces.demo.datafilterslider.DemoInventoryItem;
+import org.richfaces.model.ScrollableTableDataModel.SimpleRowKey;
+import org.richfaces.model.selection.SimpleSelection;
/**
* @author Nick Belaevski - nbelaevski(a)exadel.com
@@ -18,6 +20,8 @@
*
*/
public class DataTableScrollerBean {
+ private SimpleSelection selection = new SimpleSelection();
+ private ArrayList<DemoInventoryItem> selectedCars = new ArrayList<DemoInventoryItem>();
private static int DECIMALS = 1;
private static int ROUNDING_MODE = BigDecimal.ROUND_HALF_UP;
@@ -137,4 +141,32 @@
b[i] = (byte)rand('A', 'Z');
return new String(b);
}
+
+ public SimpleSelection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(SimpleSelection selection) {
+ System.out.println("Setting Started");
+ this.selection = selection;
+ System.out.println("Setting Complete");
+ }
+
+ public String takeSelection() {
+ getSelectedCars().clear();
+ Iterator<SimpleRowKey> iterator = getSelection().getKeys();
+ while (iterator.hasNext()){
+ SimpleRowKey key = iterator.next();
+ getSelectedCars().add(getAllCars().get(key.intValue()));
+ }
+ return null;
+ }
+
+ public ArrayList<DemoInventoryItem> getSelectedCars() {
+ return selectedCars;
+ }
+
+ public void setSelectedCars(ArrayList<DemoInventoryItem> selectedCars) {
+ this.selectedCars = selectedCars;
+ }
}
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml 2007-11-23 17:45:21 UTC (rev 4239)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml 2007-11-23 17:48:57 UTC (rev 4240)
@@ -10,7 +10,8 @@
<rich:spacer height="30" />
<rich:scrollableDataTable rowKeyVar="rkv" frozenColCount="1" height="400px"
width="700px" id="carList" rows="40" columnClasses="col"
- value="#{dataTableScrollerBean.allCars}" var="category" sortMode="single">
+ value="#{dataTableScrollerBean.allCars}" var="category" sortMode="single"
+ selection="#{dataTableScrollerBean.selection}">
<rich:column id="make">
<f:facet name="header"><h:outputText styleClass="headerText" value="Make" /></f:facet>
@@ -39,7 +40,38 @@
- </rich:scrollableDataTable>
+ </rich:scrollableDataTable>
+
+ <a4j:commandButton value="Take Selection" reRender="table" action="#{dataTableScrollerBean.takeSelection}" oncomplete="javascript:Richfaces.showModalPanel('panel');"/>
</h:form>
-
+ <rich:modalPanel id="panel" autosized="true">
+ <f:facet name="header">
+ <h:outputText value="Selected Rows"/>
+ </f:facet>
+ <f:facet name="controls">
+ <a href="#" onclick="javascript:Richfaces.hideModalPanel('panel')">X</a>
+ </f:facet>
+ <rich:dataTable value="#{dataTableScrollerBean.selectedCars}" var="sel" id="table">
+ <rich:column>
+ <f:facet name="header"><h:outputText value="Make" /></f:facet>
+ <h:outputText value="#{sel.make}" />
+ </rich:column>
+ <rich:column id="model">
+ <f:facet name="header"><h:outputText value="Model" /></f:facet>
+ <h:outputText value="#{sel.model}" />
+ </rich:column>
+ <rich:column id="price">
+ <f:facet name="header"><h:outputText value="Price" /></f:facet>
+ <h:outputText value="#{sel.price}" />
+ </rich:column>
+ <rich:column id="mileage">
+ <f:facet name="header"><h:outputText value="Mileage" /></f:facet>
+ <h:outputText value="#{sel.mileage}" />
+ </rich:column>
+ <rich:column id="stock">
+ <f:facet name="header"><h:outputText value="Stock" /></f:facet>
+ <h:outputText value="#{sel.stock}" />
+ </rich:column>
+ </rich:dataTable>
+ </rich:modalPanel>
</ui:composition>
\ No newline at end of file
16 years, 5 months
JBoss Rich Faces SVN: r4239 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2007-11-23 12:45:21 -0500 (Fri, 23 Nov 2007)
New Revision: 4239
Modified:
trunk/docs/userguide/en/src/main/docbook/included/dataFilterSlider.xml
Log:
RF-920 - add Look-and-Feel Customization section to the dataFilterSlider
Modified: trunk/docs/userguide/en/src/main/docbook/included/dataFilterSlider.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/dataFilterSlider.xml 2007-11-23 17:43:14 UTC (rev 4238)
+++ trunk/docs/userguide/en/src/main/docbook/included/dataFilterSlider.xml 2007-11-23 17:45:21 UTC (rev 4239)
@@ -1,6 +1,11 @@
<?xml version='1.0' encoding='UTF-8'?>
<section>
-
+ <sectioninfo>
+ <keywordset>
+ <keyword>rich:dataFilterSlider</keyword>
+ <keyword>HtmldataFilterSlider</keyword>
+ </keywordset>
+ </sectioninfo>
<table>
<title>Component identification parameters </title>
<tgroup cols="2">
@@ -120,6 +125,18 @@
defined.</para>
</section>
<section>
+ <title>Look-and-Feel Customization</title>
+ <para>The <emphasis role="bold">
+ <property><rich:dataFilterSlider></property>
+ </emphasis> component has no skin parameters and special <emphasis>
+ <property>style classes</property></emphasis>, as it consists of one element generated with a your method on the server. To
+ define some style properties such as an indent or a border, it's possible to use <emphasis>
+ <property>"style"</property>
+ </emphasis> and <emphasis>
+ <property>"styleClass"</property>
+ </emphasis> attributes on the component.</para>
+ </section>
+ <section>
<title>Relevant Resources Links</title>
<para>
<ulink
16 years, 5 months