JBoss Rich Faces SVN: r3816 - in trunk/ui/panelmenu/src: main/templates/org/richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-11-08 07:21:58 -0500 (Thu, 08 Nov 2007)
New Revision: 3816
Modified:
trunk/ui/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx
trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
trunk/ui/panelmenu/src/test/java/org/richfaces/component/PanelMenuComponentTest.java
Log:
http://jira.jboss.com/jira/browse/RF-1311
Modified: trunk/ui/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
===================================================================
--- trunk/ui/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js 2007-11-08 11:59:37 UTC (rev 3815)
+++ trunk/ui/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js 2007-11-08 12:21:58 UTC (rev 3816)
@@ -49,7 +49,7 @@
this.hoveredStyles = hoveredStyles;
this.hoveredClasses = hoveredClasses;
- this.tdhider = $("tdhide"+ids.myId);
+ this.tdhider = $(ids.myId);
this.tablehider = $("tablehide"+ids.myId);
this.haveDynamicIcon = haveDynamicIcon;
if (this.haveDynamicIcon==true)
@@ -74,7 +74,7 @@
this.selected = false;
}
this.clientId = ids.myId;
- this.obj = $("tdhide" + ids.myId);
+ this.obj = $(ids.myId);
this.leftIcon = $('leftIcon' + ids.myId);
this.rightIcon = $('rightIcon' + ids.myId);
this.labelArea = $('icon' + ids.myId);
Modified: trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx
===================================================================
--- trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx 2007-11-08 11:59:37 UTC (rev 3815)
+++ trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx 2007-11-08 12:21:58 UTC (rev 3816)
@@ -13,7 +13,7 @@
<f:clientid var="clientId"/>
- <div id="tdhide#{clientId}" style="#{this:getHideStyle(context, component)}"
+ <div id="#{clientId}" style="#{this:getHideStyle(context, component)}"
class="#{this:getDivClass(context, component)}" >
<jsp:scriptlet>
<![CDATA[
Modified: trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
===================================================================
--- trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx 2007-11-08 11:59:37 UTC (rev 3815)
+++ trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx 2007-11-08 12:21:58 UTC (rev 3816)
@@ -13,7 +13,7 @@
<f:clientid var="clientId"/>
- <div id="tdhide#{clientId}" style="#{this:getHideStyle(context, component)}" >
+ <div id="#{clientId}" style="#{this:getHideStyle(context, component)}" >
<table cellspacing="0" cellpadding="0" border="0"
id="tablehide#{clientId}"
class="dr-pmenu-item rich-pmenu-item #{this:getFullStyleClass( context, component )} "
Modified: trunk/ui/panelmenu/src/test/java/org/richfaces/component/PanelMenuComponentTest.java
===================================================================
--- trunk/ui/panelmenu/src/test/java/org/richfaces/component/PanelMenuComponentTest.java 2007-11-08 11:59:37 UTC (rev 3815)
+++ trunk/ui/panelmenu/src/test/java/org/richfaces/component/PanelMenuComponentTest.java 2007-11-08 12:21:58 UTC (rev 3816)
@@ -68,6 +68,8 @@
javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
javaScripts.add("org/richfaces/renderkit/html/scripts/utils.js");
javaScripts.add("org/richfaces/renderkit/html/scripts/panelMenu.js");
+ javaScripts.add("org/ajax4jsf/javascript/scripts/form.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/form.js");
}
/**
@@ -197,7 +199,7 @@
assertNotNull(div);
assertEquals("div", div.getNodeName());
- HtmlElement firstGroupDiv = page.getHtmlElementById("tdhide" + group1.getClientId(facesContext));
+ HtmlElement firstGroupDiv = page.getHtmlElementById(group1.getClientId(facesContext));
assertNotNull(firstGroupDiv);
assertEquals("div", firstGroupDiv.getNodeName());
@@ -214,7 +216,7 @@
assertTrue(styleClass.contains("rich-pmenu-disabled-element"));
assertTrue(styleClass.contains("dr-pmenu-disabled-element"));
- HtmlElement subGroupDiv = page.getHtmlElementById("tdhide" + group3.getClientId(facesContext));
+ HtmlElement subGroupDiv = page.getHtmlElementById(group3.getClientId(facesContext));
assertNotNull(subGroupDiv);
assertEquals("div", subGroupDiv.getNodeName());
18 years, 6 months
JBoss Rich Faces SVN: r3815 - in branches/3.1.x/ui/panelmenu/src/main: templates/org/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-11-08 06:59:37 -0500 (Thu, 08 Nov 2007)
New Revision: 3815
Modified:
branches/3.1.x/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
branches/3.1.x/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
branches/3.1.x/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
branches/3.1.x/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx
branches/3.1.x/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
Log:
RF-1307, RF-1279
Modified: branches/3.1.x/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
--- branches/3.1.x/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2007-11-08 11:16:33 UTC (rev 3814)
+++ branches/3.1.x/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2007-11-08 11:59:37 UTC (rev 3815)
@@ -241,6 +241,15 @@
return false;
}
+ public String getSelectedClass(FacesContext context, UIComponent component){
+ StringBuffer selectedClass = null;
+ if(isSelected(context, component)){
+ selectedClass= new StringBuffer();
+ selectedClass.append(UIPanelMenu.DEFAULT_SELECTED_CLASS).append(" ").append(UIPanelMenu.USER_DEFINED_SELECTED_CLASS);
+ }
+ return selectedClass != null ? selectedClass.toString() : "";
+ }
+
public String getLabelClass(FacesContext context, UIComponent component) {
UIPanelMenuGroup group = (UIPanelMenuGroup)component;
UIPanelMenu parentMenu = findMenu(group);
@@ -250,21 +259,31 @@
resClass.append("rich-pmenu-group-self-label rich-pmenu-top-group-self-label");
} else resClass.append("rich-pmenu-group-self-label");
}
- if(isSelected(context, component)){
- resClass.append(" ").append(UIPanelMenu.DEFAULT_SELECTED_CLASS).append(" ").append(UIPanelMenu.USER_DEFINED_SELECTED_CLASS);
- }
+
return resClass.toString();
}
- public String getIconClass(FacesContext context, UIComponent component) {
- UIPanelMenuGroup group = (UIPanelMenuGroup)component;
- UIPanelMenu parentMenu = findMenu(group);
+ public String getIconClass(FacesContext context, UIComponent component, String align) {
+ UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+ UIPanelMenu parentMenu = findMenu(group);
+ String iconClass = "";
+
if(!group.isDisabled() && !parentMenu.isDisabled()){
+ String iconClassAttr = ((UIPanelMenuGroup)component).getIconClass();
if(isTopLevel(component)){
- return "rich-pmenu-group-self-icon rich-pmenu-top-group-self-icon";
- } else return "rich-pmenu-group-self-icon";
+ if(align.equals(parentMenu.getIconGroupTopPosition())){
+ iconClass = "rich-pmenu-group-self-icon rich-pmenu-top-group-self-icon";
+ }
+ }
+
+ if(align.equals(parentMenu.getIconGroupPosition())){
+ if(iconClassAttr != null){
+ iconClass = iconClass.equals("") ? ("rich-pmenu-group-self-icon " + iconClassAttr): (iconClass + " " + iconClassAttr);
+ }
+ }
}
- return "";
+
+ return iconClass;
}
public String getDivClass(FacesContext context, UIComponent component) {
Modified: branches/3.1.x/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
--- branches/3.1.x/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2007-11-08 11:16:33 UTC (rev 3814)
+++ branches/3.1.x/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2007-11-08 11:59:37 UTC (rev 3815)
@@ -179,15 +179,28 @@
return resClass.toString();
}
- public String getIconClass(FacesContext context, UIComponent component) {
+ public String getIconClass(FacesContext context, UIComponent component, String align) {
UIPanelMenuItem item = (UIPanelMenuItem)component;
UIPanelMenu parentMenu = findMenu(item);
+ String iconClass = "";
+
if(!item.isDisabled() && !parentMenu.isDisabled()){
+ String iconClassAttr = ((UIPanelMenuItem)component).getIconClass();
+
if(isTopLevel(component)){
- return "rich-pmenu-item-icon rich-pmenu-top-item-icon";
- } else return "rich-pmenu-item-icon";
+ if(align.equals(parentMenu.getIconItemTopPosition())){
+ iconClass = "rich-pmenu-item-icon rich-pmenu-top-item-icon";
+ }
+ }
+
+ if(align.equals(parentMenu.getIconItemPosition())){
+ if(iconClassAttr != null){
+ iconClass = iconClass.equals("") ? ("rich-pmenu-item-icon " + iconClassAttr):(iconClass + " " + iconClassAttr);
+ }
+ }
}
- return "";
+
+ return iconClass;
}
public boolean isSelected(FacesContext context, UIComponent component){
Modified: branches/3.1.x/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
--- branches/3.1.x/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2007-11-08 11:16:33 UTC (rev 3814)
+++ branches/3.1.x/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2007-11-08 11:59:37 UTC (rev 3815)
@@ -36,7 +36,6 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.Messages;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
@@ -50,6 +49,7 @@
/* (non-Javadoc)
* @see org.ajax4jsf.framework.renderer.RendererBase#getComponentClass()
*/
+
protected Class getComponentClass() {
return UIComponent.class;
}
@@ -70,18 +70,16 @@
UIParameter param = (UIParameter)child;
String name = param.getName();
- if (null == name) {
- throw new IllegalArgumentException(Messages.getMessage(
- Messages.UNNAMED_PARAMETER_ERROR, component.getClientId(context)));
+ if (name != null) {
+ Object value = param.getValue();
+ buff.append("params[");
+ buff.append(ScriptUtils.toScript(name));
+ buff.append("] = ");
+ buff.append(ScriptUtils.toScript(value));
+ buff.append(";");
+ params.add(buff.toString());
}
-
- Object value = param.getValue();
- buff.append("params[");
- buff.append(ScriptUtils.toScript(name));
- buff.append("] = ");
- buff.append(ScriptUtils.toScript(value));
- buff.append(";");
- params.add(buff.toString());
+
}
}
Modified: branches/3.1.x/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx
===================================================================
--- branches/3.1.x/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx 2007-11-08 11:16:33 UTC (rev 3814)
+++ branches/3.1.x/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx 2007-11-08 11:59:37 UTC (rev 3815)
@@ -27,8 +27,8 @@
<f:call name="utils.encodePassThru" />
- <tr>
- <td class="dr-pmenu-nowrap">
+ <tr class="#{this:getSelectedClass( context, component )}">
+ <td class="dr-pmenu-nowrap #{this:getIconClass( context, component,'left')}">
<f:call name="insertSpacerImages" />
<f:call name="insertImage">
<f:parameter value="left" />
@@ -42,7 +42,7 @@
value="" />
<f:call name="insertLabel"/>
</td>
- <td>
+ <td class="#{this:getIconClass( context, component,'right')}">
<f:call name="insertImage">
<f:parameter value="right" />
</f:call>
Modified: branches/3.1.x/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
===================================================================
--- branches/3.1.x/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx 2007-11-08 11:16:33 UTC (rev 3814)
+++ branches/3.1.x/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx 2007-11-08 11:59:37 UTC (rev 3815)
@@ -25,7 +25,7 @@
<tr>
<f:call name="utils.encodeId"/>
- <td class="dr-pmenu-nowrap">
+ <td class="dr-pmenu-nowrap #{this:getIconClass( context, component,'left')}">
<f:call name="insertSpacerImages" />
<f:call name="insertImage">
<f:parameter value="left" />
@@ -38,7 +38,7 @@
<f:call name="renderChildren" />
</vcp:body>
</td>
- <td>
+ <td class="#{this:getIconClass( context, component,'right')}">
<f:call name="insertImage">
<f:parameter value="right" />
</f:call>
18 years, 6 months
JBoss Rich Faces SVN: r3814 - branches/3.1.x/ui/dataTable/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-11-08 06:16:33 -0500 (Thu, 08 Nov 2007)
New Revision: 3814
Modified:
branches/3.1.x/ui/dataTable/src/main/templates/org/richfaces/htmlDataTable.jspx
Log:
http://jira.jboss.com/jira/browse/RF-1263
Modified: branches/3.1.x/ui/dataTable/src/main/templates/org/richfaces/htmlDataTable.jspx
===================================================================
--- branches/3.1.x/ui/dataTable/src/main/templates/org/richfaces/htmlDataTable.jspx 2007-11-07 21:30:06 UTC (rev 3813)
+++ branches/3.1.x/ui/dataTable/src/main/templates/org/richfaces/htmlDataTable.jspx 2007-11-08 11:16:33 UTC (rev 3814)
@@ -19,7 +19,7 @@
class="dr-table rich-table #{component.attributes['styleClass']}"
>
<f:call name="utils.encodePassThruWithExclusions">
- <f:parameter value="value,name,type,id,class" />
+ <f:parameter value="value,name,type,id,class,rows" />
</f:call>
<f:call name="encodeTableStructure"/>
<tbody>
18 years, 6 months
JBoss Rich Faces SVN: r3813 - in trunk/sandbox/ui/orderingList/src/main: java/org/richfaces/renderkit and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-07 16:30:06 -0500 (Wed, 07 Nov 2007)
New Revision: 3813
Added:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/TranslatedSequenceDataModel.java
Modified:
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/OrderingList.js
trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
Log:
OrderingList development boost - server-side code implemented
Added: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/TranslatedSequenceDataModel.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/TranslatedSequenceDataModel.java (rev 0)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/TranslatedSequenceDataModel.java 2007-11-07 21:30:06 UTC (rev 3813)
@@ -0,0 +1,105 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.DataModel;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.Range;
+import org.ajax4jsf.model.SequenceDataModel;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 07.11.2007
+ *
+ */
+public class TranslatedSequenceDataModel extends SequenceDataModel {
+
+ protected static final class TranslatedRowKey {
+ private Integer key;
+ private String asString;
+
+ public TranslatedRowKey(Integer key, String asString) {
+ super();
+ this.key = key;
+ this.asString = asString;
+ }
+
+ public Integer getKey() {
+ return key;
+ }
+
+ public String getAsString() {
+ return asString;
+ }
+
+ public String toString() {
+ return getAsString();
+ }
+ };
+
+ private int[] translationTable;
+ private boolean translatedModel;
+
+ private Object rowKey;
+
+ public TranslatedSequenceDataModel(DataModel wrapped,
+ boolean translatedModel, int[] translationTable) {
+ super(wrapped);
+ this.translatedModel = translatedModel;
+ this.translationTable = translationTable;
+ }
+
+ public TranslatedSequenceDataModel(DataModel wrapped) {
+ super(wrapped);
+ }
+
+ private int translate(int i) {
+ if (translationTable != null) {
+ return translationTable[i];
+ } else {
+ return i;
+ }
+ }
+
+ public Object getRowKey() {
+ return rowKey;
+ }
+
+ public void setRowKey(Object key) {
+ this.rowKey = key;
+
+ if (key instanceof TranslatedRowKey) {
+ super.setRowKey(((TranslatedRowKey) key).getKey());
+ } else {
+ if (this.translatedModel) {
+ if (rowKey != null) {
+ int iKey = ((Integer) key).intValue();
+ super.setRowKey(new Integer(translate(iKey)));
+ } else {
+ super.setRowKey(null);
+ }
+ } else {
+ super.setRowKey(key);
+ }
+ }
+ }
+
+ public void walk(FacesContext context, DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+
+ for (int i = 0; i < getRowCount(); i++) {
+ if (this.translatedModel) {
+ visitor.process(context, new TranslatedRowKey(
+ new Integer(i), String.valueOf(translate(i))), argument);
+ } else {
+ visitor.process(context, new Integer(translate(i)), argument);
+ }
+ }
+ }
+}
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-07 17:05:59 UTC (rev 3812)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-07 21:30:06 UTC (rev 3813)
@@ -3,8 +3,10 @@
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -26,21 +28,93 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.event.ValueChangeListener;
+import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import org.ajax4jsf.component.UIDataAdaptor;
+import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.model.DataComponentState;
import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.RepeatState;
-import org.ajax4jsf.model.SequenceDataModel;
import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.iterators.EmptyIterator;
import org.apache.commons.collections.iterators.FilterIterator;
public abstract class UIOrderingList extends UIDataAdaptor implements EditableValueHolder {
+ protected static class EditableState {
+ private boolean isTranslated = false;
+
+ //setting this flag to true means we should reorder elements
+ private boolean translatedRendering = false;
+ }
+
+ public static final class SubmittedValue {
+ private int[] permutationOrder;
+ private Set selectedItems = new HashSet();
+ private int activeItem;
+
+ public SubmittedValue(String submittedString) {
+ super();
+ fromString(submittedString);
+ }
+
+ 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(i));
+ } else if ('a' == c) {
+ activeItem = i;
+ } else {
+ break ;
+ }
+
+ }
+ } catch (NumberFormatException e) {
+ // TODO: handle exception
+ }
+ }
+ }
+
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < permutationOrder.length; i++) {
+ result.append(permutationOrder[i]);
+
+ if (selectedItems.contains(new Integer(i))) {
+ result.append('s');
+ }
+
+ if (activeItem == i) {
+ result.append('a');
+ }
+
+ if (i < permutationOrder.length - 1) {
+ result.append(',');
+ }
+ }
+ return result.toString();
+ }
+
+ public int[] getPermutationOrder() {
+ return permutationOrder;
+ }
+
+ }
+
public static final Predicate isColumn = new ColumnPredicate();
private static final class ColumnPredicate implements Predicate {
@@ -53,100 +127,24 @@
return new RepeatState();
}
+ protected DataModel getDataModel(Object current) {
+ if (current == null) {
+ return new ListDataModel(Collections.EMPTY_LIST);
+ } else if (current instanceof List) {
+ return new ListDataModel((List) current);
+ } else if (Object[].class.isAssignableFrom(current.getClass())) {
+ //TODO scalar
+ return new ArrayDataModel((Object[]) current);
+ }
+ throw new IllegalArgumentException();
+ }
+
protected ExtendedDataModel createDataModel() {
- try {
- insideCreateDataModel = true;
-
- return new SequenceDataModel(super.getDataModel());
- } finally {
- insideCreateDataModel = false;
- }
- }
-
- private boolean insideCreateDataModel;
-
- private DataModel getPermutatedDataModel(final DataModel dataModel) {
-
- if (submittedValue == null) {
- return dataModel;
+ DataModel dataModel = super.getDataModel();
+ if (editableState.translatedRendering || editableState.isTranslated) {
+ return new TranslatedSequenceDataModel(dataModel, editableState.isTranslated, submittedValueHolder != null ? submittedValueHolder.permutationOrder : null);
} 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);
- }
-
- };
+ return new TranslatedSequenceDataModel(dataModel, false, null);
}
}
@@ -176,7 +174,8 @@
private Object value;
private boolean localValueSet;
- private Object submittedValue;
+ private SubmittedValue submittedValueHolder = null;
+ private EditableState editableState = new EditableState();
public void restoreState(FacesContext faces, Object object) {
Object[] state = (Object[]) object;
@@ -256,12 +255,29 @@
removeFacesListener(listener);
}
+
+ public Object getSubmittedValueAsString() {
+ return submittedValueHolder;
+ }
+
public Object getSubmittedValue() {
- return submittedValue;
+ return new Object[] { submittedValueHolder, editableState };
}
+ public void setSubmittedString(String submittedString) {
+ this.submittedValueHolder = new SubmittedValue(submittedString);
+ }
+
public void setSubmittedValue(Object submittedValue) {
- this.submittedValue = submittedValue;
+ if (submittedValue != null) {
+ Object[] values = (Object[]) submittedValue;
+
+ this.submittedValueHolder = (SubmittedValue) values[0];
+ this.editableState = (EditableState) values[1];
+ } else {
+ this.submittedValueHolder = null;
+ this.editableState = null;
+ }
}
public abstract void setImmediate(boolean immediate);
@@ -286,11 +302,12 @@
}
public void setValue(Object value) {
+ super.setValue(value);
this.value = value;
setLocalValueSet(true);
}
- private Object getComponentValue() {
+ public Object getValue() {
if (this.value != null) {
return (this.value);
}
@@ -301,16 +318,6 @@
return (null);
}
}
-
- public Object getValue() {
- if (insideCreateDataModel) {
- if (submittedValue != null) {
- return getConvertedValue();
- }
- }
-
- return getComponentValue();
- }
/**
@@ -606,7 +613,9 @@
if (isValid()) {
Object previous = getValue();
setValue(newValue);
- setSubmittedValue(null);
+ this.submittedValueHolder = null;
+ this.editableState.isTranslated = true;
+ //setSubmittedValue(null);
if (compareValues(previous, newValue)) {
queueEvent(new ValueChangeEvent(this, previous, newValue));
}
@@ -615,59 +624,46 @@
}
protected Object getConvertedValue() throws ConverterException {
- if (submittedValue instanceof String) {
- Object componentValue = getComponentValue();
- if (componentValue == null) {
- return Collections.EMPTY_LIST;
- }
+ Object convertedValue = getValue();
+ if (convertedValue == null) {
+ convertedValue = Collections.EMPTY_LIST;
+ }
+
+ if (submittedValueHolder != null) {
+ Object savedValue = convertedValue;
- 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;
+ int[] indexes = submittedValueHolder.permutationOrder;
+
+ if (savedValue instanceof List) {
+ List list = (List) savedValue;
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;
+ convertedValue = arrayList;
} else {
- submittedValue = Array.newInstance(componentValue.getClass().getComponentType(),
- Array.getLength(componentValue));
- ArrayUtil.copy(submittedValue,
- componentValue, indexes);
+ convertedValue = Array.newInstance(savedValue.getClass().getComponentType(),
+ Array.getLength(savedValue));
+ ArrayUtil.copy(convertedValue,
+ savedValue, indexes);
}
+
+ //submittedValueHolder.newValue = convertedValue;
}
- return submittedValue;
+ return convertedValue;
}
+ @Override
+ protected void resetDataModel() {
+ super.resetDataModel();
+
+ if (this.submittedValueHolder != null) {
+ this.editableState.translatedRendering = true;
+ }
+ }
+
/**
*
* <p>Set the "valid" property according to the below algorithm.</p>
@@ -861,4 +857,16 @@
message.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage(getClientId(context), message);
}
+
+ public String getElementsOrder() {
+ Object order = null;
+
+ if (this.editableState.translatedRendering) {
+ if (this.submittedValueHolder != null) {
+ order = this.submittedValueHolder.permutationOrder;
+ }
+ }
+
+ return ScriptUtils.toScript(order);
+ }
}
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-07 17:05:59 UTC (rev 3812)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-07 21:30:06 UTC (rev 3813)
@@ -145,7 +145,7 @@
String valueOrder = (String) requestParameterMap.get(clientId);
if (valueOrder != null && valueOrder.length() != 0) {
- orderingList.setSubmittedValue(valueOrder);
+ orderingList.setSubmittedString(valueOrder);
}
}
@@ -182,4 +182,5 @@
}
}
}
+
}
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-07 17:05:59 UTC (rev 3812)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-07 21:30:06 UTC (rev 3813)
@@ -18,14 +18,14 @@
}
Shuttle = function(containerId, contentTableId, headerTableId, focusKeeperId, valueKeeperId,
- upControlId, downControlId, firstControlId, lastControlId, onclickControlId) {
+ upControlId, downControlId, firstControlId, lastControlId, onclickControlId, ordering) {
this.container = document.getElementById(containerId);
this.shuttleTable = document.getElementById(contentTableId);
this.shuttleTbody = this.shuttleTable.tBodies[0];
this.items = null;
this.selectedItems = new Array();
- this.retrieveShuttleItems();
+ this.retrieveShuttleItems(ordering);
this.shuttle = null;
this.sortOrder = Shuttle.ASC;
@@ -72,13 +72,13 @@
this.shuttleTop = LayoutManager.getElemXY(this.shuttleTable).top;
}
-Shuttle.prototype.retrieveShuttleItems = function() {
+Shuttle.prototype.retrieveShuttleItems = function(ordering) {
var rows = this.shuttleTbody.rows;
this.shuttleItems = new Array();
var obj = this;
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
- this.shuttleItems[i] = new SelectItem(null, i, false, row);
+ this.shuttleItems[i] = new SelectItem(null, ordering ? ordering[i] : i, false, row);
}
}
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-07 17:05:59 UTC (rev 3812)
+++ trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2007-11-07 21:30:06 UTC (rev 3813)
@@ -16,9 +16,9 @@
</h:scripts>
<f:clientId var="clientId"/>
- <div id="#{clientId}" onclick="Shuttle.setFocus('#{clientId}focusKeeper')">
+ <div id="#{clientId}" onclick="Shuttle.setFocus('#{clientId}focusKeeper')" x:passThruWithExclusions="id,onclick">
<input id="#{clientId}focusKeeper" type="button" value="" style="position: absolute; left: -32767;" name="focusKeeper"/>
- <input id="#{clientId}valueKeeper" type="hidden" name="#{clientId}" value=""/>
+ <input id="#{clientId}valueKeeper" type="hidden" name="#{clientId}" value="#{component.submittedValueAsString}"/>
<table id="#{clientId}table" cellpadding="0" cellspacing="0" class="ol_body">
<tr>
@@ -61,7 +61,7 @@
document.body.className = "body";
function init() {
- var shuttle = new Shuttle('#{cId}', '#{cId}internal_tab', '#{cId}internal_header_tab', '#{cId}focusKeeper', '#{cId}valueKeeper','#{cId}up', '#{cId}down', '#{cId}first', '#{cId}last', '#{cId}sortLabel');
+ var shuttle = new Shuttle('#{cId}', '#{cId}internal_tab', '#{cId}internal_header_tab', '#{cId}focusKeeper', '#{cId}valueKeeper','#{cId}up', '#{cId}down', '#{cId}first', '#{cId}last', '#{cId}sortLabel', #{component.elementsOrder});
var layoutManager = new LayoutManager('#{clientId}internal_header_tab', '#{clientId}internal_tab');
layoutManager.widthSynchronization();
}
18 years, 6 months
JBoss Rich Faces SVN: r3812 - trunk.
by richfaces-svn-commits@lists.jboss.org
Author: SergeySmirnov
Date: 2007-11-07 12:05:59 -0500 (Wed, 07 Nov 2007)
New Revision: 3812
Added:
trunk/third/
Log:
temp folder
18 years, 6 months
JBoss Rich Faces SVN: r3810 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2007-11-06 15:42:29 -0500 (Tue, 06 Nov 2007)
New Revision: 3810
Added:
trunk/docs/userguide/en/src/main/docbook/included/orderingList.desc.xml
Log:
Added: trunk/docs/userguide/en/src/main/docbook/included/orderingList.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/orderingList.desc.xml (rev 0)
+++ trunk/docs/userguide/en/src/main/docbook/included/orderingList.desc.xml 2007-11-06 20:42:29 UTC (rev 3810)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<section>
+ <sectioninfo>
+ <keywordset>
+ <keyword>orderingList</keyword>
+ </keywordset>
+ </sectioninfo>
+ <section>
+ <title>Description</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref=""/>
+ </imageobject>
+ </mediaobject>
+ <para>An <property>ordering list</property> is a component for ordering items in a list. This component provides possibilities to reorder a list and sort it on the client side.</para>
+ </section>
+<section>
+ <title>Key Features</title>
+ <itemizedlist>
+ <listitem>Skinnable <property>ordering list</property> and child items</listitem>
+ <listitem>Customizable component layout (captions, headers, list items and ordering control set)</listitem>
+ <listitem>Disabled/enabled ordering controls</listitem>
+ <listitem>Multiple selection in the <property>ordering list</property></listitem>
+ <listitem>Possibility to manage selection from
+ <itemizedlist>
+ <listitem>Keyboard</listitem>
+ <listitem>Server side</listitem>
+ </itemizedlist>
+ </listitem>
+ <listitem>Possibility to drag and drop items to the required position</listitem>
+ </itemizedlist>
+</section>
+</section>
+
\ No newline at end of file
18 years, 6 months
JBoss Rich Faces SVN: r3809 - trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2007-11-06 15:38:43 -0500 (Tue, 06 Nov 2007)
New Revision: 3809
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
Log:
corrected scrolling
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-06 20:12:16 UTC (rev 3808)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-06 20:38:43 UTC (rev 3809)
@@ -111,7 +111,7 @@
this.rebuild();
}
-Shuttle.prototype.moveSelectedItems = function(action) {
+Shuttle.prototype.moveSelectedItems = function(action, event) {
var rows = this.shuttleTbody.rows;
var item;
if (this.selectedItems.length > 0) {
@@ -146,7 +146,6 @@
}
}
- this.autoScrolling(action);
this.shuttleItems = new Array();
for (var i = 0; i < rows.length; i++) {
this.shuttleItems.push(rows[i].item);
@@ -219,8 +218,8 @@
Shuttle.prototype.onkeydownHandler = function(event) {
var action = null;
switch (event.keyCode) {
- case 34 : this.moveSelectedItems('last'); break; //page down
- case 33 : this.moveSelectedItems('first'); break; //page up
+ case 34 : action = 'last'; this.moveSelectedItems(action); break; //page down
+ case 33 : action = 'first'; this.moveSelectedItems(action); break; //page up
case 38 : //up arrow
action = 'up';
if (event.ctrlKey) {
@@ -239,23 +238,29 @@
break;
case 65 : // Ctrl + A
if (event.ctrlKey) {
- this.selectAll();
- if (event.stopPropagation) {
- event.preventDefault();
- event.stopPropagation();
- } else {
- event.cancelBubble = true;
- }
+ this.selectAll();
+ Shuttle.stopPropogation(event);
}
this.activeItem.className = Shuttle.ACTIVE_ITEM_CLASS;
this.saveState();
break;
case 32 : this.invertSelection(event); break; //blank
}
- if (action != null) this.autoScrolling(action);
+ if (action != null)
+ this.autoScrolling(action, event);
this.saveState();
}
+Shuttle.stopPropogation = function(event) {
+ if (event.stopPropagation) {
+ event.preventDefault();
+ event.stopPropagation();
+ } else {
+ event.cancelBubble = true;
+ event.returnValue = false;
+ }
+}
+
Shuttle.prototype.invertSelection = function(event) {
var eventItem = this.activeItem;
var eventShuttleItem = this.getSelectItemByNode(eventItem);
@@ -387,7 +392,7 @@
return null;
}
-Shuttle.prototype.autoScrolling = function(action) {
+Shuttle.prototype.autoScrolling = function(action, event) {
this.selectedItems.sort(this.compareByRowIndex);
var targetItemTop;
if (action == 'up' || action == 'first') {
@@ -400,6 +405,7 @@
var increment = targetItemTop - (this.shuttleTop + this.shuttleTable.parentNode.offsetHeight - LayoutManager.SCROLL_WIDTH);
this.shuttleTable.parentNode.scrollTop = increment;
}
+ Shuttle.stopPropogation(event);
}
/*Shuttle.prototype.init = function() {
18 years, 6 months
JBoss Rich Faces SVN: r3808 - trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2007-11-06 15:12:16 -0500 (Tue, 06 Nov 2007)
New Revision: 3808
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
Log:
fixed bug for IE
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-06 19:51:39 UTC (rev 3807)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-06 20:12:16 UTC (rev 3808)
@@ -1,5 +1,14 @@
Array.prototype.remove = function(object) {
-
+ if (!this.indexOf) {
+ this.indexOf = function(obj){
+ for(var i=0; i < this.length; i++){
+ if(this[i]==obj){
+ return i;
+ }
+ }
+ return -1;
+ }
+ }
var index = this.indexOf(object, 0, this.length);
if (index == 0) {
this.shift();
18 years, 6 months
JBoss Rich Faces SVN: r3807 - in trunk/sandbox/ui/orderingList/src/main: templates/org/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2007-11-06 14:51:39 -0500 (Tue, 06 Nov 2007)
New Revision: 3807
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/OrderingList.js
trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
Log:
dataList scrolling
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-06 19:27:54 UTC (rev 3806)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/LayoutManager.js 2007-11-06 19:51:39 UTC (rev 3807)
@@ -44,4 +44,15 @@
LayoutManager.isIE = function() {
return (/MSIE/.test(navigator.userAgent) && !window.opera);
+}
+
+LayoutManager.getElemXY = function(elem) {
+ var x = elem.offsetLeft;
+ var y = elem.offsetTop;
+
+ for (var parent = elem.offsetParent; parent; parent = parent.offsetParent) {
+ x += parent.offsetLeft;
+ y += parent.offsetTop;
+ }
+ return {left: x, top: y};
}
\ No newline at end of file
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-06 19:27:54 UTC (rev 3806)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-06 19:51:39 UTC (rev 3807)
@@ -26,6 +26,7 @@
this.focusKeeper = document.getElementById(focusKeeperId);
this.valueKeeper = document.getElementById(valueKeeperId);
+ this.shuttleTop = null;
var obj = this;
this.focusKeeper.onkeydown = function(e) {
obj.onkeydownHandler(window.event || e);
@@ -59,6 +60,7 @@
document.getElementById(firstControlId).onclick = function() {obj.moveSelectedItems('first');};
document.getElementById(lastControlId).onclick = function() {obj.moveSelectedItems('last');};
document.getElementById(contentTableId).onclick = function(e) {obj.onclickHandler(window.event || e);};
+ this.shuttleTop = LayoutManager.getElemXY(this.shuttleTable).top;
}
Shuttle.prototype.retrieveShuttleItems = function() {
@@ -135,6 +137,7 @@
}
}
+ this.autoScrolling(action);
this.shuttleItems = new Array();
for (var i = 0; i < rows.length; i++) {
this.shuttleItems.push(rows[i].item);
@@ -205,21 +208,24 @@
}
Shuttle.prototype.onkeydownHandler = function(event) {
+ var action = null;
switch (event.keyCode) {
case 34 : this.moveSelectedItems('last'); break; //page down
case 33 : this.moveSelectedItems('first'); break; //page up
case 38 : //up arrow
+ action = 'up';
if (event.ctrlKey) {
- this.moveSelectedItems('up');
+ this.moveSelectedItems(action);
} else {
- this.moveActiveItem('up');
+ this.moveActiveItem(action);
}
break;
case 40 : //down arrow
+ action = 'down';
if (event.ctrlKey) {
- this.moveSelectedItems('down');
+ this.moveSelectedItems(action);
} else {
- this.moveActiveItem('down');
+ this.moveActiveItem(action);
}
break;
case 65 : // Ctrl + A
@@ -237,6 +243,7 @@
break;
case 32 : this.invertSelection(event); break; //blank
}
+ if (action != null) this.autoScrolling(action);
this.saveState();
}
@@ -371,6 +378,21 @@
return null;
}
+Shuttle.prototype.autoScrolling = function(action) {
+ this.selectedItems.sort(this.compareByRowIndex);
+ var targetItemTop;
+ if (action == 'up' || action == 'first') {
+ targetItemTop = LayoutManager.getElemXY(this.selectedItems[0]).top;
+ var increment = targetItemTop - this.shuttleTop;
+ this.shuttleTable.parentNode.scrollTop = increment;
+ } else if (action == 'down' || action == 'last') {
+ var item = this.selectedItems[this.selectedItems.length - 1];
+ targetItemTop = LayoutManager.getElemXY(this.selectedItems[this.selectedItems.length - 1]).top + item.offsetHeight;
+ var increment = targetItemTop - (this.shuttleTop + this.shuttleTable.parentNode.offsetHeight - LayoutManager.SCROLL_WIDTH);
+ this.shuttleTable.parentNode.scrollTop = increment;
+ }
+}
+
/*Shuttle.prototype.init = function() {
this.shuttle = this.shuttleTbody;
this.addList(this.shuttleItems);
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-06 19:27:54 UTC (rev 3806)
+++ trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2007-11-06 19:51:39 UTC (rev 3807)
@@ -52,18 +52,19 @@
<f:clientId var="cId"/>
<script type="text/javascript">
var clientId = '#{cId}';
- if (window.attachEvent) {
+ /*if (window.attachEvent) {
window.attachEvent("onload", init);
} else {
window.addEventListener("load", init, false);
- }
+ }*/
document.body.onselectstart = function() {return false;};
document.body.className = "body";
- var shuttle = new Shuttle('#{cId}', '#{cId}internal_tab', '#{cId}internal_header_tab', '#{cId}focusKeeper', '#{cId}valueKeeper','#{cId}up', '#{cId}down', '#{cId}first', '#{cId}last', '#{cId}sortLabel');
function init() {
+ var shuttle = new Shuttle('#{cId}', '#{cId}internal_tab', '#{cId}internal_header_tab', '#{cId}focusKeeper', '#{cId}valueKeeper','#{cId}up', '#{cId}down', '#{cId}first', '#{cId}last', '#{cId}sortLabel');
var layoutManager = new LayoutManager('#{clientId}internal_header_tab', '#{clientId}internal_tab');
layoutManager.widthSynchronization();
- }
+ }
+ setTimeout(init, 0);
</script>
</f:root>
\ No newline at end of file
18 years, 6 months
JBoss Rich Faces SVN: r3806 - trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-11-06 14:27:54 -0500 (Tue, 06 Nov 2007)
New Revision: 3806
Modified:
trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
Log:
Demo application for ordering list component. ( http://jira.jboss.com/jira/browse/RF-1191 ).
Modified: trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-06 19:21:15 UTC (rev 3805)
+++ trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-06 19:27:54 UTC (rev 3806)
@@ -125,7 +125,7 @@
<a4j:commandButton reRender="repeat" value="Rerender a4j:repeat" />
<h:panelGrid columns="3" >
<a4j:repeat value="#{bean.lists}" var="list" id="repeat">
- <%--ol:orderingList value="#{list.items}" var="item" >
+ <ol:orderingList value="#{list.items}" var="item" >
<h:column>
<f:facet name="header">
<h:outputText value="Name" />
@@ -151,7 +151,7 @@
</f:facet>
<h:commandLink value="Server Action" action="#{item.action}" />
</h:column>
- </ol:orderingList--%>
+ </ol:orderingList>
</a4j:repeat>
</h:panelGrid>
<a4j:log popup="false" />
18 years, 6 months