JBoss Rich Faces SVN: r4309 - branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2007-11-28 08:28:08 -0500 (Wed, 28 Nov 2007)
New Revision: 4309
Modified:
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
Log:
css styles was corrected
Modified: branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-28 09:53:30 UTC (rev 4308)
+++ branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-28 13:28:08 UTC (rev 4309)
@@ -151,6 +151,15 @@
white-space: nowrap;
}
+.rich-ordering-list-cell-selected, rich-ordering-list-cell-selected * {
+ padding : 2px;
+ white-space: nowrap;
+}
+
+.rich-ordering-list-cell-active, .rich-ordering-list-cell-active * {
+
+}
+
.rich-ordering-list-ds {
-moz-user-select: -moz-none;
}
@@ -259,6 +268,17 @@
<u:style name="font-size" skin="generalSizeFont" />
</u:selector>
+ <u:selector name=".rich-ordering-list-cell-selected, .rich-ordering-list-cell-selected *">
+ <u:style name="color" skin="generalTextColor"/>
+ <u:style name="font-family" skin="generalFamilyFont" />
+ <u:style name="font-size" skin="generalSizeFont" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-cell-active, .rich-ordering-list-cell-active *">
+ <u:style name="font-size" skin="generalSizeFont" />
+ <u:style name="font-family" skin="generalFamilyFont" />
+ </u:selector>
+
<u:selector name=".rich-ordering-control-disabled">
<u:style name="border-color" skin="panelBorderColor" />
</u:selector>
17 years, 1 month
JBoss Rich Faces SVN: r4308 - trunk/ui/dataTable/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: akushunin
Date: 2007-11-28 04:53:30 -0500 (Wed, 28 Nov 2007)
New Revision: 4308
Modified:
trunk/ui/dataTable/src/main/config/component/dataList.xml
Log:
RF-1419/RF-1418 set hidden to true for corresponding properties.
Modified: trunk/ui/dataTable/src/main/config/component/dataList.xml
===================================================================
--- trunk/ui/dataTable/src/main/config/component/dataList.xml 2007-11-28 03:24:08 UTC (rev 4307)
+++ trunk/ui/dataTable/src/main/config/component/dataList.xml 2007-11-28 09:53:30 UTC (rev 4308)
@@ -210,6 +210,15 @@
<classname>org.ajax4jsf.model.DataComponentState</classname>
<description>It defines EL-binding for a component state for saving or redefinition</description>
</property>
+ <property hidden="true">
+ <name>footerClass</name>
+ <classname>java.lang.String</classname>
+ </property>
+
+ <property hidden="true">
+ <name>headerClass</name>
+ <classname>java.lang.String</classname>
+ </property>
</component>
17 years, 1 month
JBoss Rich Faces SVN: r4307 - in branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces: model and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-27 22:24:08 -0500 (Tue, 27 Nov 2007)
New Revision: 4307
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/model/ListShuttleRowKey.java
Log:
abstract submitted value class created
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-28 03:24:01 UTC (rev 4306)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java 2007-11-28 03:24:08 UTC (rev 4307)
@@ -10,13 +10,12 @@
import java.util.ArrayList;
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.regex.Matcher;
import java.util.regex.Pattern;
+import javax.faces.FacesException;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.convert.ConverterException;
@@ -40,8 +39,8 @@
public static final String COMPONENT_FAMILY = "org.richfaces.ListShuttle";
- protected static final class SubmittedValue implements Serializable {
- private static final Pattern ITEM_PATTERN = Pattern.compile("(s|t)(\\d+)(s?a?)");
+ protected static final class SubmittedValue extends OrderingBaseAbstractSubmittedValue {
+ private static final Pattern KEY_STRING_PATTERN = Pattern.compile("(s?\\d+)(s?a?)");
/**
*
*/
@@ -50,95 +49,23 @@
private Map sourceTranslationTable = null;
private Map targetTranslationTable = null;
- private Set selectedItems = new HashSet();
- private List activeItems = new ArrayList();
-
+ private transient boolean source;
+
public SubmittedValue(String[] submittedStrings) {
super();
- sourceListFromString(submittedStrings[0]);
- targetListFromString(submittedStrings[1]);
+ source = true;
+ sourceTranslationTable = asMap(submittedStrings[0]);
+ source = false;
+ targetTranslationTable = asMap(submittedStrings[1]);
}
- private Map convertAndStoreKey(String string, boolean keySource) {
- String[] valueOrder = string.split(",");
- Map map = new LinkedHashMap();
-
- for (int i = 0; i < valueOrder.length; i++) {
- Matcher matcher = ITEM_PATTERN.matcher(valueOrder[i]);
- 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 oldKey = new ListShuttleRowKey(key, source, keySource);
-
- ListShuttleRowKey newKey = new ListShuttleRowKey(Integer.valueOf(i), keySource);
-
- map.put(oldKey, newKey);
-
- String group = matcher.group(3);
- for (int j = 0; j < group.length(); j++) {
- c = group.charAt(j);
- if ('s' == c) {
- selectedItems.add(oldKey);
- } else if ('a' == c) {
- activeItems.add(newKey);
- } else {
- break ;
- }
-
- }
- } catch (NumberFormatException e) {
- // TODO: handle exception
- }
- }
-
- return map;
+ public String toTargetString() {
+ return asString(targetTranslationTable);
}
-
- private void targetListFromString(String string) {
- if (string != null && string.length() != 0) {
- targetTranslationTable = convertAndStoreKey(string, false);
- }
- }
-
- private void sourceListFromString(String string) {
- if (string != null && string.length() != 0) {
- sourceTranslationTable = convertAndStoreKey(string, true);
- }
- }
- public String toString() {
- StringBuffer result = new StringBuffer();
-// for (int i = 0; i < permutationOrder.length; i++) {
-// result.append(permutationOrder[i]);
-//
-// Integer key = new Integer(i);
-//
-// if (selectedItems.contains(key)) {
-// result.append('s');
-// }
-//
-// if (key.equals(activeItem)) {
-// result.append('a');
-// }
-//
-// if (i < permutationOrder.length - 1) {
-// result.append(',');
-// }
-// }
- return result.toString();
+ public String toSourceString() {
+ return asString(sourceTranslationTable);
}
public Map getSourceTranslationTable() {
@@ -148,8 +75,43 @@
public Map getTargetTranslationTable() {
return targetTranslationTable;
}
+
+ protected Object createNewKey(int i) {
+ return new ListShuttleRowKey(new Integer(i), source);
+ }
+
+ protected Object createOldKey(String keyString) {
+ char c = keyString.charAt(0);
+ boolean sourceKey = false;
+ Integer integer;
+
+ try {
+ if (c == 's') {
+ sourceKey = true;
+ integer = new Integer(keyString.substring(1));
+ } else {
+ integer = new Integer(keyString);
+ }
+ } catch (NumberFormatException e) {
+ throw new FacesException(new IllegalArgumentException());
+ }
+
+ return new ListShuttleRowKey(integer, sourceKey, source);
+ }
+
+ protected Pattern getKeyStringPattern() {
+ return KEY_STRING_PATTERN;
+ }
}
+ public String getSourceSubmittedString() {
+ return submittedValueHolder != null ? submittedValueHolder.toSourceString() : "";
+ }
+
+ public String getTargetSubmittedString() {
+ return submittedValueHolder != null ? submittedValueHolder.toTargetString() : "";
+ }
+
private transient Map sourceTranslationTable;
private transient Map targetTranslationTable;
@@ -333,16 +295,6 @@
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) {
@@ -488,7 +440,7 @@
// "submitted" value, and emit a ValueChangeEvent if appropriate
if (isValid()) {
Set selectionSet = new HashSet();
- Set selectedItems = submittedValueHolder.selectedItems;
+ Set selectedItems = submittedValueHolder.getSelection();
for (Iterator iterator = selectedItems.iterator(); iterator
.hasNext();) {
setRowKey(context, iterator.next());
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-28 03:24:01 UTC (rev 4306)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleRowKey.java 2007-11-28 03:24:08 UTC (rev 4307)
@@ -61,7 +61,7 @@
}
public String toString() {
- return (source ? "s" : "t") + rowKey.toString();
+ return (source ? "s" : "") + rowKey.toString();
}
public ListShuttleRowKey(Object rowKey, boolean source) {
17 years, 1 month
JBoss Rich Faces SVN: r4306 - in branches/3.1.x/ui/orderingList/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-27 22:24:01 -0500 (Tue, 27 Nov 2007)
New Revision: 4306
Added:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/OrderingBaseAbstractSubmittedValue.java
Modified:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
Log:
abstract submitted value class created
Added: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/OrderingBaseAbstractSubmittedValue.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/OrderingBaseAbstractSubmittedValue.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/OrderingBaseAbstractSubmittedValue.java 2007-11-28 03:24:01 UTC (rev 4306)
@@ -0,0 +1,108 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+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.FacesException;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+abstract class OrderingBaseAbstractSubmittedValue implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6779511867226722256L;
+
+ private Set selection = new HashSet();
+
+ private Set activeItems = new HashSet();
+
+ protected abstract Object createOldKey(String keyString);
+
+ protected abstract Object createNewKey(int i);
+
+ protected abstract Pattern getKeyStringPattern();
+
+ protected Set getActiveItems() {
+ return activeItems;
+ }
+
+ protected Set getSelection() {
+ return selection;
+ }
+
+ protected Map asMap(String string) {
+ if (string != null && string.length() != 0) {
+ String[] valueOrder = string.split(",");
+ Map translationMap = new LinkedHashMap(valueOrder.length);
+ for (int i = 0; i < valueOrder.length; i++) {
+ Matcher matcher = getKeyStringPattern().matcher(valueOrder[i]);
+ if (matcher.matches()) {
+ Object oldKey = createOldKey(matcher.group(1));
+ Object newKey = createNewKey(i);
+ translationMap.put(oldKey, newKey);
+ String group = matcher.group(2);
+ for (int j = 0; j < group.length(); j++) {
+ char c = group.charAt(j);
+ if ('s' == c) {
+ selection.add(oldKey);
+ } else if ('a' == c) {
+ activeItems.add(oldKey);
+ } else {
+ break ;
+ }
+ }
+ } else {
+ throw new FacesException(new IllegalArgumentException());
+ }
+ }
+
+ return translationMap;
+ } else {
+
+ return null;
+ }
+ }
+
+ protected String asString(Map map) {
+ if (map != null) {
+ StringBuffer result = new StringBuffer();
+ Iterator iterator = map.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+
+ Object key = entry.getKey();
+
+ result.append(key);
+ if (selection.contains(key)) {
+ result.append('s');
+ }
+
+ if (activeItems.contains(key)) {
+ result.append('a');
+ }
+
+ if (iterator.hasNext()) {
+ result.append(',');
+ }
+ }
+ return result.toString();
+ } else {
+ return "";
+ }
+ }
+
+}
Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-28 02:27:28 UTC (rev 4305)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-28 03:24:01 UTC (rev 4306)
@@ -1,19 +1,15 @@
package org.richfaces.component;
import java.io.IOException;
-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.FacesException;
@@ -35,7 +31,6 @@
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
-import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
import org.richfaces.model.TranslatedSequenceDataModel;
@@ -44,73 +39,45 @@
private transient Map permutationOrder;
- protected static final class SubmittedValue implements Serializable {
+ protected static final class SubmittedValue extends OrderingBaseAbstractSubmittedValue {
+ private static final Pattern KEY_STRING_PATTERN = Pattern.compile("(\\d+)(s?a?)");
+
/**
*
*/
private static final long serialVersionUID = 5860506816451180551L;
private Map permutationOrder;
- private Set selectedItems = new HashSet();
- private Integer activeItem;
public SubmittedValue(String submittedString) {
super();
- fromString(submittedString);
- }
- private void fromString(String string) {
- String[] valueOrder = string.split(",");
- permutationOrder = new LinkedHashMap(valueOrder.length);
- for (int i = 0; i < valueOrder.length; i++) {
- Matcher matcher = Pattern.compile("(\\d+)(s?a?)").matcher(valueOrder[i]);
- matcher.matches();
+ permutationOrder = asMap(submittedString);
- try {
- Integer oldKey = Integer.valueOf(matcher.group(1));
- Integer newKey = new Integer(i);
- permutationOrder.put(oldKey, newKey);
- String group = matcher.group(2);
- for (int j = 0; j < group.length(); j++) {
- char c = group.charAt(j);
- if ('s' == c) {
- selectedItems.add(oldKey);
- } else if ('a' == c) {
- activeItem = oldKey;
- } else {
- break ;
- }
-
- }
- } catch (NumberFormatException e) {
- throw new FacesException(e.getLocalizedMessage(), e);
- }
+ if (getActiveItems().size() > 1) {
+ throw new FacesException(new IllegalArgumentException());
}
}
public String toString() {
- StringBuffer result = new StringBuffer();
- Iterator iterator = permutationOrder.entrySet().iterator();
- while (iterator.hasNext()) {
- Entry entry = (Entry) iterator.next();
+ return asString(permutationOrder);
+ }
- Object key = entry.getKey();
+ protected Object createNewKey(int i) {
+ return new Integer(i);
+ }
- result.append(key);
- if (selectedItems.contains(key)) {
- result.append('s');
- }
-
- if (key.equals(activeItem)) {
- result.append('a');
- }
-
- if (iterator.hasNext()) {
- result.append(',');
- }
+ protected Object createOldKey(String keyString) {
+ try {
+ return new Integer(keyString);
+ } catch (NumberFormatException e) {
+ throw new FacesException(e.getLocalizedMessage(), e);
}
- return result.toString();
}
+ protected Pattern getKeyStringPattern() {
+ return KEY_STRING_PATTERN;
+ }
+
}
public interface ItemState {
@@ -121,13 +88,13 @@
private final class SubmittedItemState implements ItemState {
public boolean isActive() {
- return submittedValueHolder.activeItem != null &&
- submittedValueHolder.activeItem.equals(getTranslatedRowKey());
+ Set activeItems = submittedValueHolder.getActiveItems();
+ return activeItems != null && activeItems.contains(getTranslatedRowKey());
}
public boolean isSelected() {
- return submittedValueHolder.selectedItems != null &&
- submittedValueHolder.selectedItems.contains(getTranslatedRowKey());
+ Set selection = submittedValueHolder.getSelection();
+ return selection != null && selection.contains(getTranslatedRowKey());
}
}
@@ -443,7 +410,7 @@
// "submitted" value, and emit a ValueChangeEvent if appropriate
if (isValid()) {
Set selectionSet = new HashSet();
- Set selectedItems = submittedValueHolder.selectedItems;
+ Set selectedItems = submittedValueHolder.getSelection();
for (Iterator iterator = selectedItems.iterator(); iterator
.hasNext();) {
setRowKey(context, iterator.next());
@@ -454,8 +421,9 @@
setSelection(selectionSet);
- if (submittedValueHolder.activeItem != null) {
- setRowKey(context, submittedValueHolder.activeItem);
+ Set activeItems = submittedValueHolder.getActiveItems();
+ if (!activeItems.isEmpty()) {
+ setRowKey(context, activeItems.iterator().next());
Object activeItem = getRowData();
setActiveItem(activeItem);
@@ -638,18 +606,6 @@
return ((TranslatedSequenceDataModel) getExtendedDataModel()).getTranslatedRowKey();
}
- public String getElementsOrder() {
- Object order = null;
-
- if (isTranslatedRenderingState()) {
- if (this.submittedValueHolder != null) {
- order = this.submittedValueHolder.permutationOrder;
- }
- }
-
- return ScriptUtils.toScript(order);
- }
-
public ItemState getItemState() {
if (submittedValueHolder != null) {
return new SubmittedItemState();
Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2007-11-28 02:27:28 UTC (rev 4305)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2007-11-28 03:24:01 UTC (rev 4306)
@@ -17,7 +17,6 @@
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.UIOrderingBaseComponent;
-import org.richfaces.component.UIOrderingList;
/**
* @author Nick Belaevski
17 years, 1 month
JBoss Rich Faces SVN: r4305 - in branches/3.1.x/samples/orderingListDemo/src/main: webapp/pages and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-27 21:27:28 -0500 (Tue, 27 Nov 2007)
New Revision: 4305
Added:
branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/UIEventsBouncer.java
Modified:
branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java
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:
latest changes for orderingList & listShuttle
Modified: branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java 2007-11-28 02:27:22 UTC (rev 4304)
+++ branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java 2007-11-28 02:27:28 UTC (rev 4305)
@@ -28,12 +28,7 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-import javax.faces.event.PhaseId;
-import org.richfaces.component.UIOrderingList;
/**
* @author $Autor$
@@ -45,103 +40,6 @@
"First", "Second", "Third", "Fourth"
};
- public static final class UIEventsOutput extends UIOutput {
- final class Event extends FacesEvent {
-
- /**
- *
- */
- private static final long serialVersionUID = -1390611902280951049L;
-
- private Object value;
-
- private String clientId;
-
- public Event(UIComponent component, Object value, String clientId, PhaseId phaseId) {
- super(component);
-
- this.value = value;
- this.clientId = clientId;
-
- setPhaseId(phaseId);
- }
-
- public boolean isAppropriateListener(FacesListener listener) {
- return false;
- }
-
- public void processListener(FacesListener listener) {
- throw new UnsupportedOperationException();
- }
-
- public Object getValue() {
- return value;
- }
-
- public String getClientId() {
- return clientId;
- }
- }
-
- private UIOrderingList getList() {
- UIComponent component = getParent();
- while (component != null && !(component instanceof UIOrderingList)) {
- component = component.getParent();
- }
-
- return (UIOrderingList) component;
- }
-
- private void queueEvent(PhaseId phaseId) {
- UIOrderingList list = getList();
- if (list.isRowAvailable()) {
- new Event(this, list.getRowData(),
- getList().getClientId(FacesContext.getCurrentInstance()), phaseId).queue();
- }
- }
-
- public void processDecodes(FacesContext context) {
- super.processDecodes(context);
-
- queueEvent(PhaseId.PROCESS_VALIDATIONS);
- queueEvent(PhaseId.UPDATE_MODEL_VALUES);
- queueEvent(PhaseId.INVOKE_APPLICATION);
- }
-
- public void processUpdates(FacesContext context) {
- super.processUpdates(context);
-
- queueEvent(PhaseId.INVOKE_APPLICATION);
- }
-
- public void processValidators(FacesContext context) {
- super.processValidators(context);
-
- queueEvent(PhaseId.UPDATE_MODEL_VALUES);
- queueEvent(PhaseId.INVOKE_APPLICATION);
- }
-
- public void broadcast(FacesEvent event)
- throws AbortProcessingException {
- if (event instanceof Event) {
- String cid = getList().getClientId(FacesContext.getCurrentInstance());
- if (!cid.equals(((Event) event).getClientId())) {
- System.out.println(cid + " !!! " + ((Event) event).getClientId());
- }
-
- UIOrderingList list = getList();
- if (list.isRowAvailable()) {
- Object rd = list.getRowData();
- if (!rd.equals(((Event) event).getValue())) {
- System.out.println(rd + " !!! " + ((Event) event).getValue());
- }
- }
- } else {
- super.broadcast(event);
- }
- }
- }
-
public Bean() {
for (int i = 0; i < 3; i++) {
lists.add(new OrderingListDemoBean());
@@ -170,7 +68,7 @@
if (eventsBouncer == null) {
FacesContext facesContext = FacesContext.getCurrentInstance();
UIComponent output = facesContext.getApplication().createComponent(UIOutput.COMPONENT_TYPE);
- UIOutput o = new UIEventsOutput();
+ UIOutput o = new UIEventsBouncer();
o.getAttributes().put("escape", Boolean.FALSE);
output.getChildren().add(o);
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-28 02:27:22 UTC (rev 4304)
+++ branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-28 02:27:28 UTC (rev 4305)
@@ -13,7 +13,7 @@
private String controlsType = "link";
private String controlsHorizontalAlign = "right";
private String controlsVerticalAlign = "center";
- private String headerLabel = "headerLabel";
+ private String captionLabel = "Caption";
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'});";
@@ -59,12 +59,12 @@
this.controlsVerticalAlign = controlsVerticalAlign;
}
- public String getHeaderLabel() {
- return headerLabel;
+ public String getCaptionLabel() {
+ return captionLabel;
}
- public void setHeaderLabel(String headerLabel) {
- this.headerLabel = headerLabel;
+ public void setCaptionLabel(String captionLabel) {
+ this.captionLabel = captionLabel;
}
public boolean isOrderControlsVisible() {
Added: branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/UIEventsBouncer.java
===================================================================
--- branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/UIEventsBouncer.java (rev 0)
+++ branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/UIEventsBouncer.java 2007-11-28 02:27:28 UTC (rev 4305)
@@ -0,0 +1,119 @@
+/**
+ *
+ */
+package org.richfaces;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.event.PhaseId;
+
+import org.ajax4jsf.component.UIDataAdaptor;
+import org.richfaces.component.UIOrderingList;
+
+public final class UIEventsBouncer extends UIOutput {
+ final class Event extends FacesEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1390611902280951049L;
+
+ private Object value;
+
+ private String clientId;
+
+ public Event(UIComponent component, Object value, String clientId, PhaseId phaseId) {
+ super(component);
+
+ this.value = value;
+ this.clientId = clientId;
+
+ setPhaseId(phaseId);
+ }
+
+ public boolean isAppropriateListener(FacesListener listener) {
+ return false;
+ }
+
+ public void processListener(FacesListener listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+ }
+
+ private UIDataAdaptor getList() {
+ UIComponent component = getParent();
+ while (component != null && !(component instanceof UIDataAdaptor)) {
+ component = component.getParent();
+ }
+
+ return (UIDataAdaptor) component;
+ }
+
+ private void queueEvent(PhaseId phaseId) {
+ UIDataAdaptor list = getList();
+ if (list.isRowAvailable()) {
+ new Event(this, list.getRowData(),
+ getList().getClientId(FacesContext.getCurrentInstance()), phaseId).queue();
+ }
+ }
+
+ public void processDecodes(FacesContext context) {
+ super.processDecodes(context);
+
+ queueEvent(PhaseId.PROCESS_VALIDATIONS);
+ queueEvent(PhaseId.UPDATE_MODEL_VALUES);
+ queueEvent(PhaseId.INVOKE_APPLICATION);
+ }
+
+ public void processUpdates(FacesContext context) {
+ super.processUpdates(context);
+
+ queueEvent(PhaseId.INVOKE_APPLICATION);
+ }
+
+ public void processValidators(FacesContext context) {
+ super.processValidators(context);
+
+ queueEvent(PhaseId.UPDATE_MODEL_VALUES);
+ queueEvent(PhaseId.INVOKE_APPLICATION);
+ }
+
+ public void broadcast(FacesEvent event)
+ throws AbortProcessingException {
+ if (event instanceof Event) {
+ String cid = getList().getClientId(FacesContext.getCurrentInstance());
+ if (!cid.equals(((Event) event).getClientId())) {
+ System.out.println(cid + " !!! " + ((Event) event).getClientId());
+ FacesMessage message = new FacesMessage("Client ids mismatch: " + cid + " !!! " + ((Event) event).getClientId());
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ FacesContext.getCurrentInstance().addMessage(cid, message);
+ }
+
+ UIDataAdaptor list = getList();
+ if (list.isRowAvailable()) {
+ Object rd = list.getRowData();
+ if (!rd.equals(((Event) event).getValue())) {
+ System.out.println(rd + " !!! " + ((Event) event).getValue());
+ FacesMessage message = new FacesMessage("Data mismatch: " + rd + " !!! " + ((Event) event).getValue());
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ FacesContext.getCurrentInstance().addMessage(cid, message);
+ }
+ }
+ } else {
+ super.broadcast(event);
+ }
+ }
+}
\ No newline at end of file
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-28 02:27:22 UTC (rev 4304)
+++ branches/3.1.x/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-28 02:27:28 UTC (rev 4305)
@@ -41,7 +41,7 @@
<h:panelGroup>
<ol:orderingList id="orderingList1"
value="#{demoBean.items}" var="item"
- headerLabel="#{demoBean.headerLabel}"
+ captionLabel="#{demoBean.captionLabel}"
controlsType="#{demoBean.controlsType}"
controlsHorizontalAlign="#{demoBean.controlsHorizontalAlign}"
controlsVerticalAlign="#{demoBean.controlsVerticalAlign}"
@@ -113,8 +113,8 @@
<h:outputText value="Item Clicked: " />
<h:outputText value="#{demoBean.actionResult}" id="actionResult" />
- <h:outputText value="Header Label" />
- <h:inputText value="#{demoBean.headerLabel}" >
+ <h:outputText value="Caption Label" />
+ <h:inputText value="#{demoBean.captionLabel}" >
<a4j:support event="onchange" reRender="orderingList1" />
</h:inputText>
@@ -165,8 +165,6 @@
<a4j:support event="onchange" reRender="orderingList1" />
</h:inputText>
- <h:commandButton value="Submit" />
- <h:commandButton value="Submit immediate" immediate="true" />
</h:panelGrid>
</h:panelGroup>
<h:panelGroup>
@@ -181,6 +179,8 @@
</ol:orderingList>
</h:panelGroup>
</h:panelGrid>
+ <h:commandButton value="Submit" />
+ <h:commandButton value="Submit immediate" immediate="true" />
<h3>Ordering lists within a4j:repeat</h3>
<a4j:commandButton reRender="repeat" value="Rerender a4j:repeat" />
<h:commandButton value="Clear list" action="#{demoBean.clear}"></h:commandButton>
17 years, 1 month
JBoss Rich Faces SVN: r4304 - in branches/3.1.x/sandbox/ui/listShuttle/src/main: java/org/richfaces/model and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-27 21:27:22 -0500 (Tue, 27 Nov 2007)
New Revision: 4304
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/model/ListShuttleDataModel.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/css/listShuttle.xcss
Log:
latest changes for orderingList & listShuttle
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-28 02:27:14 UTC (rev 4303)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java 2007-11-28 02:27:22 UTC (rev 4304)
@@ -4,6 +4,7 @@
package org.richfaces.component;
+import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.ArrayList;
@@ -13,7 +14,6 @@
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;
@@ -26,7 +26,7 @@
import javax.faces.event.ValueChangeListener;
import javax.faces.model.DataModel;
-import org.apache.commons.collections.map.CompositeMap;
+import org.ajax4jsf.model.DataVisitor;
import org.richfaces.model.ListShuttleDataModel;
import org.richfaces.model.ListShuttleRowKey;
@@ -47,8 +47,8 @@
*/
private static final long serialVersionUID = 5655312942714191981L;
//ListShuttleRowKey -> ListShuttleRowKey
- private Map sourceTranslationTable = new LinkedHashMap();
- private Map targetTranslationTable = new LinkedHashMap();
+ private Map sourceTranslationTable = null;
+ private Map targetTranslationTable = null;
private Set selectedItems = new HashSet();
private List activeItems = new ArrayList();
@@ -60,59 +60,62 @@
targetListFromString(submittedStrings[1]);
}
- private void convertAndStoreKey(String keyString, int i, boolean keySource) {
- Matcher matcher = ITEM_PATTERN.matcher(keyString);
- matcher.matches();
+ private Map convertAndStoreKey(String string, boolean keySource) {
+ String[] valueOrder = string.split(",");
+ Map map = new LinkedHashMap();
- 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 ;
+ for (int i = 0; i < valueOrder.length; i++) {
+ Matcher matcher = ITEM_PATTERN.matcher(valueOrder[i]);
+ 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 oldKey = new ListShuttleRowKey(key, source, keySource);
+
+ ListShuttleRowKey newKey = new ListShuttleRowKey(Integer.valueOf(i), keySource);
+
+ map.put(oldKey, newKey);
+
+ String group = matcher.group(3);
+ for (int j = 0; j < group.length(); j++) {
+ c = group.charAt(j);
+ if ('s' == c) {
+ selectedItems.add(oldKey);
+ } else if ('a' == c) {
+ activeItems.add(newKey);
+ } else {
+ break ;
+ }
+
}
-
+ } catch (NumberFormatException e) {
+ // TODO: handle exception
}
- } catch (NumberFormatException e) {
- // TODO: handle exception
- }
+ }
+
+ return map;
}
private void targetListFromString(String string) {
- String[] valueOrder = string.split(",");
- for (int i = 0; i < valueOrder.length; i++) {
- convertAndStoreKey(valueOrder[i], i, false);
+ if (string != null && string.length() != 0) {
+ targetTranslationTable = convertAndStoreKey(string, false);
}
}
private void sourceListFromString(String string) {
- String[] valueOrder = string.split(",");
- for (int i = 0; i < valueOrder.length; i++) {
- convertAndStoreKey(valueOrder[i], i, true);
+ if (string != null && string.length() != 0) {
+ sourceTranslationTable = convertAndStoreKey(string, true);
}
}
@@ -147,6 +150,9 @@
}
}
+ private transient Map sourceTranslationTable;
+ private transient Map targetTranslationTable;
+
private transient SubmittedValue submittedValueHolder = null;
protected static final class ValueHolder implements Serializable {
@@ -160,6 +166,9 @@
private Object targetValue;
private boolean targetValueSet;
+
+ private Map sourceTranslationTable;
+ private Map targetTranslationTable;
}
private Object sourceValue;
@@ -256,6 +265,9 @@
holder.targetValue = targetValue;
holder.targetValueSet = targetValueSet;
+ holder.sourceTranslationTable = sourceTranslationTable;
+ holder.targetTranslationTable = targetTranslationTable;
+
return holder;
}
@@ -268,6 +280,8 @@
targetValue = holder.targetValue;
targetValueSet = holder.targetValueSet;
+ sourceTranslationTable = holder.sourceTranslationTable;
+ targetTranslationTable = holder.targetTranslationTable;
}
public org.ajax4jsf.model.ExtendedDataModel createDataModel() {
@@ -281,6 +295,9 @@
if (submittedValueHolder != null) {
sourceTranslationTable = submittedValueHolder.sourceTranslationTable;
targetTranslationTable = submittedValueHolder.targetTranslationTable;
+ } else {
+ sourceTranslationTable = this.sourceTranslationTable;
+ targetTranslationTable = this.targetTranslationTable;
}
return new ListShuttleDataModel(sourceDataModel, targetDataModel,
@@ -470,8 +487,6 @@
// 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
@@ -495,17 +510,21 @@
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.sourceTranslationTable = this.submittedValueHolder.sourceTranslationTable;
+ this.targetTranslationTable = this.submittedValueHolder.targetTranslationTable;
+
this.submittedValueHolder = null;
- setRowKey(rowKey);
}
}
@@ -515,13 +534,14 @@
}
private class ListDataAdder implements DataAdder {
- private List container;
+ private ArrayList container;
public ListDataAdder(int size) {
container = new ArrayList(size);
}
public Object getContainer() {
+ container.trimToSize();
return container;
}
@@ -565,31 +585,56 @@
if (submittedValueHolder != null) {
Object rowKey = getRowKey();
- Map source = submittedValueHolder.sourceTranslationTable;
- Map target = submittedValueHolder.targetTranslationTable;
+ Object oldSourceValue = getSourceValue();
+ Object newSourceValue = oldSourceValue;
+
+ Object oldTargetValue = getTargetValue();
+ Object newTargetValue = oldTargetValue;
- DataAdder sourceValue = createDataAdder(getSourceValue(), source.size());
- DataAdder targetValue = createDataAdder(getTargetValue(), target.size());
+ final ListShuttleDataModel listShuttleDataModel = (ListShuttleDataModel) getExtendedDataModel();
- Iterator iterator = source.entrySet().iterator();
- while (iterator.hasNext()) {
- Entry entry = (Entry) iterator.next();
+ listShuttleDataModel.setSourceTranslationTable(submittedValueHolder.getSourceTranslationTable());
+ listShuttleDataModel.setTargetTranslationTable(submittedValueHolder.getTargetTranslationTable());
- setRowKey(context, entry.getValue());
- sourceValue.add(getRowData());
- }
+ try {
+ if (listShuttleDataModel.needSourceTranslation()) {
+ final DataAdder sourceValueAdder = createDataAdder(oldSourceValue, listShuttleDataModel.getSourceRowCount());
+ listShuttleDataModel.walkSource(context, new DataVisitor() {
- iterator = target.entrySet().iterator();
- while (iterator.hasNext()) {
- Entry entry = (Entry) iterator.next();
-
- setRowKey(context, entry.getValue());
- targetValue.add(getRowData());
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ setRowKey(rowKey);
+ sourceValueAdder.add(getRowData());
+ }
+
+ }, null, null);
+
+ newSourceValue = sourceValueAdder.getContainer();
+ }
+
+ if (listShuttleDataModel.needTargetTranslation()) {
+ final DataAdder targetValueAdder = createDataAdder(oldTargetValue, listShuttleDataModel.getTargetRowCount());
+ listShuttleDataModel.walkTarget(context, new DataVisitor() {
+
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ setRowKey(rowKey);
+ targetValueAdder.add(getRowData());
+ }
+
+ }, null, null);
+
+ newTargetValue = targetValueAdder.getContainer();
+ }
+
+ setRowKey(rowKey);
+ } catch (IOException e) {
+ throw new ConverterException(e.getLocalizedMessage(), e);
}
- setRowKey(rowKey);
-
- return new Object[] {sourceValue.getContainer(), targetValue.getContainer()};
+ return new Object[] {newSourceValue, newTargetValue};
}
return null;
@@ -598,6 +643,9 @@
protected void resetDataModel() {
super.resetDataModel();
+ this.sourceTranslationTable = null;
+ this.targetTranslationTable = null;
+
if (this.submittedValueHolder != null) {
setTranslatedRenderingState();
}
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleDataModel.java
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleDataModel.java 2007-11-28 02:27:14 UTC (rev 4303)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleDataModel.java 2007-11-28 02:27:22 UTC (rev 4304)
@@ -16,7 +16,6 @@
import org.ajax4jsf.model.Range;
import org.ajax4jsf.model.SequenceDataModel;
import org.ajax4jsf.model.SequenceRange;
-import org.apache.commons.collections.map.CompositeMap;
/**
* @author Nick Belaevski
@@ -26,10 +25,10 @@
private Object rowKey;
- private Boolean useSource = null;
-
+ private Boolean useSourceFacade = null;
+ private Boolean useSourceModel = null;
+
private boolean translatedModel;
- private Map translationTable;
private SequenceDataModel sourceModel;
private SequenceDataModel targetModel;
@@ -61,30 +60,6 @@
}
};
- protected static final class MovedRowKey {
- private Object rowKey;
-
- private boolean sourceKey;
-
- public MovedRowKey(Object key, boolean sourceKey) {
- super();
- this.rowKey = key;
- this.sourceKey = sourceKey;
- }
-
- public Object getRowKey() {
- return rowKey;
- }
-
- public boolean isSourceKey() {
- return sourceKey;
- }
-
- public String toString() {
- return rowKey.toString();
- }
- };
-
/* (non-Javadoc)
* @see org.ajax4jsf.model.ExtendedDataModel#getRowKey()
*/
@@ -93,30 +68,40 @@
}
private Object translate(Object key) {
- if (translationTable != null && key != null) {
- return translationTable.get(key);
+ if (key != null) {
+ if (sourceTranslationTable != null && sourceTranslationTable.containsKey(key)) {
+ return sourceTranslationTable.get(key);
+ } else if (targetTranslationTable != null && targetTranslationTable.containsKey(key)) {
+ return targetTranslationTable.get(key);
+ } else {
+ return key;
+ }
} else {
return key;
}
}
-
+
private void setShuttleRowKey(ListShuttleRowKey shuttleRowKey) {
Object sourceKey = null;
Object targetKey = null;
- Boolean useSource = null;
-
+ Boolean useSourceFacade = null;
+ Boolean useSourceModel = null;
+
if (shuttleRowKey != null) {
if (shuttleRowKey.isSource()) {
sourceKey = shuttleRowKey.getRowKey();
- useSource = Boolean.TRUE;
+ useSourceModel = Boolean.TRUE;
} else {
targetKey = shuttleRowKey.getRowKey();
- useSource = Boolean.FALSE;
+ useSourceModel = Boolean.FALSE;
}
+
+ useSourceFacade = (shuttleRowKey.isFacadeSource() ? Boolean.TRUE : Boolean.FALSE);
}
- this.useSource = useSource;
-
+ this.useSourceFacade = useSourceFacade;
+ this.useSourceModel = useSourceModel;
+
this.sourceModel.setRowKey(sourceKey);
this.targetModel.setRowKey(targetKey);
}
@@ -130,12 +115,6 @@
if (key instanceof TranslatedRowKey) {
ListShuttleRowKey shuttleRowKey = (ListShuttleRowKey) ((TranslatedRowKey) key).getRowKey();
setShuttleRowKey(shuttleRowKey);
- } else if (key instanceof MovedRowKey) {
- MovedRowKey mrk = (MovedRowKey) key;
- setRowKey(mrk.getRowKey());
- if (!this.translatedModel) {
- useSource = Boolean.valueOf(mrk.isSourceKey());
- }
} else {
if (this.translatedModel) {
if (rowKey != null) {
@@ -155,75 +134,85 @@
this.translatedModel = translatedModel;
this.sourceTranslationTable = sourceTranslationTable;
this.targetTranslationTable = targetTranslationTable;
- if (sourceTranslationTable != null && targetTranslationTable != null) {
- this.translationTable = new CompositeMap(sourceTranslationTable, targetTranslationTable);
- }
this.sourceModel = new org.ajax4jsf.model.SequenceDataModel(source);
this.targetModel = new org.ajax4jsf.model.SequenceDataModel(target);
}
- /* (non-Javadoc)
- * @see org.ajax4jsf.model.ExtendedDataModel#walk(javax.faces.context.FacesContext, org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range, java.lang.Object)
- */
- public void walk(final FacesContext context, final DataVisitor visitor, Range range,
- Object argument) throws IOException {
+ private void walkModel(final FacesContext context, final DataVisitor visitor, Range range,
+ Object argument, final boolean source) throws IOException {
- if (translationTable != null) {
- //TODO is it ordered?
- Iterator translations = this.translationTable.entrySet().iterator();
- while (translations.hasNext()) {
- Entry translation = (Entry) translations.next();
- ListShuttleRowKey translatedKey = (ListShuttleRowKey) translation.getKey();
- ListShuttleRowKey sourceKey = (ListShuttleRowKey) translation.getValue();
-
- if (translatedModel) {
- visitor.process(context, new TranslatedRowKey(
- translatedKey, String.valueOf(sourceKey)), argument);
- } else {
- visitor.process(context, new MovedRowKey(sourceKey, sourceTranslationTable.containsKey(translatedKey)),
- argument);
- }
- }
- } else {
- this.sourceModel.walk(context, new DataVisitor() {
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
+ ExtendedDataModel dataModel = source ? this.sourceModel : this.targetModel;
- ListShuttleRowKey shuttleRowKey = new ListShuttleRowKey(rowKey, true);
+ dataModel.walk(context, new DataVisitor() {
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ ListShuttleRowKey shuttleRowKey = new ListShuttleRowKey(rowKey, source);
Object translatedShuttleRowKey = translate(shuttleRowKey);
-
+
if (translatedModel) {
visitor.process(context, new TranslatedRowKey(
shuttleRowKey, String.valueOf(translatedShuttleRowKey)), argument);
} else {
- visitor.process(context, new MovedRowKey(translatedShuttleRowKey, true), argument);
+ visitor.process(context, translatedShuttleRowKey, argument);
}
}
- }, new SequenceRange(0, -1), argument);
+ }, new SequenceRange(0, -1), argument);
+ }
- this.targetModel.walk(context, new DataVisitor(){
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
+ private void walkMap(final FacesContext context, final DataVisitor visitor, Range range,
+ Object argument, Map translationMap) throws IOException {
- ListShuttleRowKey shuttleRowKey = new ListShuttleRowKey(rowKey, false);
- Object translatedShuttleRowKey = translate(shuttleRowKey);
+ Iterator translations = translationMap.entrySet().iterator();
+ while (translations.hasNext()) {
+ Entry translation = (Entry) translations.next();
+ ListShuttleRowKey sourceKey = (ListShuttleRowKey) translation.getKey();
+ ListShuttleRowKey translatedKey = (ListShuttleRowKey) translation.getValue();
- if (translatedModel) {
- visitor.process(context, new TranslatedRowKey(
- shuttleRowKey, String.valueOf(translatedShuttleRowKey)), argument);
- } else {
- visitor.process(context, new MovedRowKey(translatedShuttleRowKey, false), argument);
- }
- }
- }, new SequenceRange(0, -1), argument);
+ if (translatedModel) {
+ visitor.process(context, new TranslatedRowKey(
+ translatedKey, String.valueOf(sourceKey)), argument);
+ } else {
+ visitor.process(context, sourceKey, argument);
+ }
}
}
+ public void walkSource(final FacesContext context, final DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+
+ if (this.sourceTranslationTable != null) {
+ this.walkMap(context, visitor, range, argument, this.sourceTranslationTable);
+ } else {
+ this.walkModel(context, visitor, range, argument, true);
+ }
+ }
+
+ public void walkTarget(final FacesContext context, final DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+
+ if (this.targetTranslationTable != null) {
+ this.walkMap(context, visitor, range, argument, this.targetTranslationTable);
+ } else {
+ this.walkModel(context, visitor, range, argument, false);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.model.ExtendedDataModel#walk(javax.faces.context.FacesContext, org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range, java.lang.Object)
+ */
+ public void walk(final FacesContext context, final DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+
+ walkSource(context, visitor, range, argument);
+ walkTarget(context, visitor, range, argument);
+ }
+
public Object getTranslatedRowKey() {
return this.translate(getRowKey());
}
-
+
/* (non-Javadoc)
* @see javax.faces.model.DataModel#getRowCount()
*/
@@ -235,10 +224,10 @@
* @see javax.faces.model.DataModel#getRowData()
*/
public Object getRowData() {
- if (sourceModel.isRowAvailable()) {
+ if (isSourceModel()) {
return sourceModel.getRowData();
- } else if (targetModel.isRowAvailable()) {
- return targetModel.getRowData();
+ } else if (isTargetModel()) {
+ return targetModel.getRowData();
} else {
return null;
}
@@ -263,7 +252,13 @@
* @see javax.faces.model.DataModel#isRowAvailable()
*/
public boolean isRowAvailable() {
- return sourceModel.isRowAvailable() || targetModel.isRowAvailable();
+ if (isSourceModel()) {
+ return sourceModel.isRowAvailable();
+ } else if (isTargetModel()) {
+ return targetModel.isRowAvailable();
+ } else {
+ return false;
+ }
}
/* (non-Javadoc)
@@ -279,12 +274,52 @@
// TODO Auto-generated method stub
}
+
+ public boolean needSourceTranslation() {
+ return sourceTranslationTable != null;
+ }
+
+ public boolean needTargetTranslation() {
+ return targetTranslationTable != null;
+ }
+ public int getSourceRowCount() {
+ if (sourceTranslationTable != null) {
+ return sourceTranslationTable.size();
+ } else {
+ return sourceModel.getRowCount();
+ }
+ }
+
+ public int getTargetRowCount() {
+ if (targetTranslationTable != null) {
+ return targetTranslationTable.size();
+ } else {
+ return targetModel.getRowCount();
+ }
+ }
+
+ protected boolean isSourceModel() {
+ return Boolean.TRUE.equals(useSourceModel);
+ }
+
+ protected boolean isTargetModel() {
+ return Boolean.FALSE.equals(useSourceModel);
+ }
+
public boolean isSource() {
- return Boolean.TRUE.equals(useSource);
+ return Boolean.TRUE.equals(useSourceFacade);
}
public boolean isTarget() {
- return Boolean.FALSE.equals(useSource);
+ return Boolean.FALSE.equals(useSourceFacade);
}
+
+ public void setSourceTranslationTable(Map sourceTranslationTable) {
+ this.sourceTranslationTable = sourceTranslationTable;
+ }
+
+ public void setTargetTranslationTable(Map targetTranslationTable) {
+ this.targetTranslationTable = targetTranslationTable;
+ }
}
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-28 02:27:14 UTC (rev 4303)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/model/ListShuttleRowKey.java 2007-11-28 02:27:22 UTC (rev 4304)
@@ -18,12 +18,18 @@
private boolean source;
+ private boolean facadeSource;
+
private Object rowKey;
public boolean isSource() {
return source;
}
+ public boolean isFacadeSource() {
+ return facadeSource;
+ }
+
public Object getRowKey() {
return rowKey;
}
@@ -62,5 +68,13 @@
super();
this.rowKey = rowKey;
this.source = source;
+ this.facadeSource = source;
}
+
+ public ListShuttleRowKey(Object rowKey, boolean source, boolean facadeSource) {
+ super();
+ this.rowKey = rowKey;
+ this.source = source;
+ this.facadeSource = facadeSource;
+ }
}
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-28 02:27:14 UTC (rev 4303)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java 2007-11-28 02:27:22 UTC (rev 4304)
@@ -245,7 +245,7 @@
Object object = context.getExternalContext().getRequestParameterValuesMap().get(clientId);
if (object != null) {
String[] submittedValues = (String[]) object;
- if (submittedValues.length == 2 && !isEmpty(submittedValues[0]) && !isEmpty(submittedValues[1])) {
+ if (submittedValues.length == 2 && (!isEmpty(submittedValues[0]) || !isEmpty(submittedValues[1]))) {
UIListShuttle listShuttle = (UIListShuttle) component;
listShuttle.setSubmittedStrings(submittedValues);
}
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss 2007-11-28 02:27:14 UTC (rev 4303)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss 2007-11-28 02:27:22 UTC (rev 4304)
@@ -180,4 +180,311 @@
</u:style>
<u:style name="background-color" skin="additionalBackgroundColor" />
</u:selector>
+
+
+
+<!-- Ordering List copied -->
+
+<f:verbatim><![CDATA[
+
+.rich-ordering-control-disabled {
+ border : 1px solid;
+ margin-bottom : 3px;
+}
+
+.rich-ordering-control-top {
+ border : 1px solid;
+ margin-bottom : 3px;
+}
+
+.rich-ordering-control-bottom {
+ border : 1px solid;
+ margin-bottom : 3px;
+}
+
+.rich-ordering-control-up {
+ border : 1px solid;
+ margin-bottom : 3px;
+}
+
+.rich-ordering-control-down {
+ border : 1px solid;
+ margin-bottom : 3px;
+}
+
+.rich-ordering-list-button {
+ background : top left repeat-x;
+ cursor : pointer;
+ padding : 2px;
+}
+
+.rich-ordering-list-button-disabled {
+ background : top left repeat-x;
+ padding : 2px;
+}
+
+.rich-ordering-list-button-light {
+ background : top left repeat-x;
+ border-style: solid;
+ cursor : pointer;
+ padding: 1px;
+}
+
+/*
+.rich-ordering-list-button-dis {
+ border : 1px solid #bfbfc0;
+ margin-bottom : 3px;
+ padding : 1px
+}
+*/
+
+.rich-ordering-list-button-press {
+ background : top left repeat-x;
+ border-style: solid;
+ padding : 2px 0px 0px 2px;
+}
+
+.rich-ordering-list-button-valign {
+ vertical-align : middle;
+}
+
+.rich-ordering-list-button-layout {
+ padding : 15px 8px 15px 0px;
+}
+
+.rich-ordering-list-button-content {
+ padding : 0px 4px 0px 1px;
+ text-align : left;
+ white-space: nowrap;
+}
+
+.rich-ordering-list-button-content img {
+ margin-right: 2px;
+ vertical-align: middle;
+}
+
+.rich-ordering-list-caption {
+ height: 8px;
+ padding : 3px 3px 3px 8px
+}
+
+.rich-ordering-list-body {
+ border : 0px solid;
+}
+
+.rich-ordering-list-output {
+ border : 1px solid;
+ margin : 0px 8px 8px 8px;
+ background: none repeat scroll 0% 50%;
+}
+
+.rich-ordering-list-content {
+ overflow: auto;
+}
+
+.rich-ordering-list-header {
+ overflow: hidden;
+ height: 18px;
+}
+
+.rich-ordering-list-items {
+ background : repeat scroll left top;
+ width: 100%;
+}
+
+.rich-ordering-list-active {
+ background : repeat scroll left top;
+ width: 100%;
+}
+
+.rich-ordering-list-disabled {
+ background : repeat scroll left top;
+ width: 100%;
+}
+
+.rich-ordering-list-row-active {
+ background : transparent none repeat-x scroll left top;
+ width: 100%;
+}
+
+.rich-ordering-list-row-selected {
+ background : transparent none repeat-x scroll left top;
+ width: 100%;
+}
+
+.rich-ordering-list-table-header-cell {
+ background : none top left repeat-x;
+ border-style: solid;
+ padding : 2px;
+}
+
+.rich-ordering-list-table-header-cell-end {
+ border-right : 0px;
+ white-space: nowrap;
+}
+
+.rich-ordering-list-cell-end {
+ border-right : 0px;
+ white-space: nowrap;
+}
+
+.rich-ordering-list-cell {
+ padding : 2px;
+ white-space: nowrap;
+}
+
+.rich-ordering-list-ds {
+ -moz-user-select: -moz-none;
+}
+
+.rich-ordering-list-fk {
+ width: 1px;
+ position: absolute;
+ left: -32767px;
+}
+
+.rich-ordering-list-ds input {
+ -moz-user-select: text;
+}
+]]>
+</f:verbatim>
+
+<u:selector name=".rich-ordering-list-button">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient" />
+ </u:style>
+ <u:style name="background-color" skin="tabBackgroundColor" />
+ <u:style name="color" skin="generalTextColor"/>
+ <u:style name="font-family" skin="headerFamilyFont"/>
+ <u:style name="font-size" skin="headerSizeFont"/>
+</u:selector>
+
+<u:selector name=".rich-ordering-list-button-disabled">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient" />
+ </u:style>
+ <u:style name="background-color" skin="tabBackgroundColor" />
+ <u:style name="color" skin="tabDisabledTextColor"/>
+ <u:style name="font-family" skin="headerFamilyFont"/>
+ <u:style name="font-size" skin="headerSizeFont"/>
+</u:selector>
+
+ <u:selector name=".rich-ordering-list-button-light">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient" />
+ </u:style>
+ <u:style name="background-color" skin="tabBackgroundColor" />
+ <u:style name="border-color" skin="tableBorderColor" />
+ <u:style name="border-width" skin="tableBorderWidth" />
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="color" skin="generalTextColor"/>
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-button-press">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListClickedGradient" />
+ </u:style>
+ <u:style name="background-color" skin="generalBackgroundColor" />
+ <u:style name="border-color" skin="tableBorderColor" />
+ <u:style name="border-width" skin="tableBorderWidth" />
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="color" skin="generalTextColor"/>
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-table-header-cell">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient" />
+ </u:style>
+ <u:style name="background-color" skin="headerBackgroundColor" />
+ <u:style name="color" skin="headerTextColor" />
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="font-weight" skin="headerWeightFont" />
+ <u:style name="border-width" skin="tableBorderWidth" />
+ <u:style name="border-top-color" skin="subBorderColor" />
+ <u:style name="border-bottom-color" skin="tableBorderColor" />
+ <u:style name="border-right-color" skin="tableBorderColor" />
+ <u:style name="border-left-color" skin="panelBorderColor" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-table-header-cell-end">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient" />
+ </u:style>
+ <u:style name="background-color" skin="headerBackgroundColor" />
+ <u:style name="color" skin="headerTextColor" />
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="font-weight" skin="headerWeightFont" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-cell-end">
+ <u:style name="font-family" skin="generalFamilyFont" />
+ <u:style name="font-size" skin="generalSizeFont" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-items">
+ <u:style name="background-color" skin="generalBackgroundColor" />
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-output">
+ <u:style name="background-color" skin="generalBackgroundColor" />
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-cell, .rich-ordering-list-cell *">
+ <u:style name="color" skin="generalTextColor"/>
+ <u:style name="font-family" skin="generalFamilyFont" />
+ <u:style name="font-size" skin="generalSizeFont" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-control-disabled">
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+ <u:selector name=".rich-ordering-control-top">
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+ <u:selector name=".rich-ordering-control-bottom">
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+ <u:selector name=".rich-ordering-control-up">
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+ <u:selector name=".rich-ordering-control-down">
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-button-content">
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-caption">
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="font-weight" skin="headerWeightFont" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-row-active">
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="font-weight" skin="headerWeightFont" />
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListSelectGradient" />
+ </u:style>
+ <u:style name="background-color" skin="headerGradientColor" />
+ </u:selector>
+
+ <u:selector name=".rich-ordering-list-row-selected">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListSelectGradient" />
+ </u:style>
+ <u:style name="background-color" skin="headerGradientColor" />
+ </u:selector>
+}
+
+
</f:template>
\ No newline at end of file
17 years, 1 month
JBoss Rich Faces SVN: r4303 - in branches/3.1.x/sandbox/samples/listShuttleDemo/src/main: webapp/WEB-INF and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-27 21:27:14 -0500 (Tue, 27 Nov 2007)
New Revision: 4303
Added:
branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/ListShuttleDemoRequestBean.java
branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/UIEventsBouncer.java
Modified:
branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/WEB-INF/faces-config.xml
branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/pages/index.jsp
Log:
latest changes for orderingList & listShuttle
Added: branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/ListShuttleDemoRequestBean.java
===================================================================
--- branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/ListShuttleDemoRequestBean.java (rev 0)
+++ branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/ListShuttleDemoRequestBean.java 2007-11-28 02:27:14 UTC (rev 4303)
@@ -0,0 +1,29 @@
+package org.richfaces;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+
+public class ListShuttleDemoRequestBean {
+
+ private UIComponent eventsBouncer;
+
+ public UIComponent getEventsBouncer() {
+ if (eventsBouncer == null) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIComponent output = facesContext.getApplication().createComponent(UIOutput.COMPONENT_TYPE);
+ UIOutput o = new UIEventsBouncer();
+
+ o.getAttributes().put("escape", Boolean.FALSE);
+ output.getChildren().add(o);
+
+ eventsBouncer = output;
+ }
+
+ return eventsBouncer;
+ }
+
+ public void setEventsBouncer(UIComponent component) {
+ this.eventsBouncer = component;
+ }
+}
Added: branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/UIEventsBouncer.java
===================================================================
--- branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/UIEventsBouncer.java (rev 0)
+++ branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/java/org/richfaces/UIEventsBouncer.java 2007-11-28 02:27:14 UTC (rev 4303)
@@ -0,0 +1,119 @@
+/**
+ *
+ */
+package org.richfaces;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.event.PhaseId;
+
+import org.ajax4jsf.component.UIDataAdaptor;
+import org.richfaces.component.UIOrderingList;
+
+public final class UIEventsBouncer extends UIOutput {
+ final class Event extends FacesEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1390611902280951049L;
+
+ private Object value;
+
+ private String clientId;
+
+ public Event(UIComponent component, Object value, String clientId, PhaseId phaseId) {
+ super(component);
+
+ this.value = value;
+ this.clientId = clientId;
+
+ setPhaseId(phaseId);
+ }
+
+ public boolean isAppropriateListener(FacesListener listener) {
+ return false;
+ }
+
+ public void processListener(FacesListener listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+ }
+
+ private UIDataAdaptor getList() {
+ UIComponent component = getParent();
+ while (component != null && !(component instanceof UIDataAdaptor)) {
+ component = component.getParent();
+ }
+
+ return (UIDataAdaptor) component;
+ }
+
+ private void queueEvent(PhaseId phaseId) {
+ UIDataAdaptor list = getList();
+ if (list.isRowAvailable()) {
+ new Event(this, list.getRowData(),
+ getList().getClientId(FacesContext.getCurrentInstance()), phaseId).queue();
+ }
+ }
+
+ public void processDecodes(FacesContext context) {
+ super.processDecodes(context);
+
+ queueEvent(PhaseId.PROCESS_VALIDATIONS);
+ queueEvent(PhaseId.UPDATE_MODEL_VALUES);
+ queueEvent(PhaseId.INVOKE_APPLICATION);
+ }
+
+ public void processUpdates(FacesContext context) {
+ super.processUpdates(context);
+
+ queueEvent(PhaseId.INVOKE_APPLICATION);
+ }
+
+ public void processValidators(FacesContext context) {
+ super.processValidators(context);
+
+ queueEvent(PhaseId.UPDATE_MODEL_VALUES);
+ queueEvent(PhaseId.INVOKE_APPLICATION);
+ }
+
+ public void broadcast(FacesEvent event)
+ throws AbortProcessingException {
+ if (event instanceof Event) {
+ String cid = getList().getClientId(FacesContext.getCurrentInstance());
+ if (!cid.equals(((Event) event).getClientId())) {
+ System.out.println(cid + " !!! " + ((Event) event).getClientId());
+ FacesMessage message = new FacesMessage("Client ids mismatch: " + cid + " !!! " + ((Event) event).getClientId());
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ FacesContext.getCurrentInstance().addMessage(cid, message);
+ }
+
+ UIDataAdaptor list = getList();
+ if (list.isRowAvailable()) {
+ Object rd = list.getRowData();
+ if (!rd.equals(((Event) event).getValue())) {
+ System.out.println(rd + " !!! " + ((Event) event).getValue());
+ FacesMessage message = new FacesMessage("Data mismatch: " + rd + " !!! " + ((Event) event).getValue());
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ FacesContext.getCurrentInstance().addMessage(cid, message);
+ }
+ }
+ } else {
+ super.broadcast(event);
+ }
+ }
+}
\ No newline at end of file
Modified: branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/WEB-INF/faces-config.xml 2007-11-28 02:27:04 UTC (rev 4302)
+++ branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/WEB-INF/faces-config.xml 2007-11-28 02:27:14 UTC (rev 4303)
@@ -7,4 +7,10 @@
<managed-bean-class>org.richfaces.ListShuttleDemoBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>listShuttleDemoRequestBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.ListShuttleDemoRequestBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
</faces-config>
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-28 02:27:04 UTC (rev 4302)
+++ branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/pages/index.jsp 2007-11-28 02:27:14 UTC (rev 4303)
@@ -24,6 +24,8 @@
<h:outputText value="Action Links" />
</f:facet>
<h:commandLink value="Server Action" action="#{item.action}" />
+
+ <h:outputText binding="#{listShuttleDemoRequestBean.eventsBouncer}" />
</h:column>
</ls:listShuttle>
17 years, 1 month
JBoss Rich Faces SVN: r4302 - in branches/3.1.x/ui/orderingList/src/main: java/org/richfaces/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-27 21:27:04 -0500 (Tue, 27 Nov 2007)
New Revision: 4302
Modified:
branches/3.1.x/ui/orderingList/src/main/config/component/orderinglist.xml
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/TranslatedSequenceDataModel.java
Log:
latest changes for orderingList & listShuttle
Modified: branches/3.1.x/ui/orderingList/src/main/config/component/orderinglist.xml
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/config/component/orderinglist.xml 2007-11-28 00:50:15 UTC (rev 4301)
+++ branches/3.1.x/ui/orderingList/src/main/config/component/orderinglist.xml 2007-11-28 02:27:04 UTC (rev 4302)
@@ -101,14 +101,6 @@
<defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
- <name>headerLabel</name>
- <classname>java.lang.String</classname>
- <description>
- Defines text, which is placed inside a header.
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
<name>controlsType</name>
<classname>java.lang.String</classname>
<description>
@@ -286,6 +278,22 @@
<description>HTML: a script expression; </description>
<defaultvalue><![CDATA[""]]></defaultvalue>
</property>
+
+ <property hidden="true">
+ <name>header</name>
+ </property>
+ <property hidden="true">
+ <name>footer</name>
+ </property>
+ <property hidden="true">
+ <name>first</name>
+ </property>
+ <property hidden="true">
+ <name>rowIndex</name>
+ </property>
+ <property hidden="true">
+ <name>rowCount</name>
+ </property>
</component>
<listener>
Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-28 00:50:15 UTC (rev 4301)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-28 02:27:04 UTC (rev 4302)
@@ -1,5 +1,6 @@
package org.richfaces.component;
+import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.ArrayList;
@@ -7,8 +8,11 @@
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;
@@ -32,102 +36,105 @@
import javax.faces.validator.ValidatorException;
import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
import org.richfaces.model.TranslatedSequenceDataModel;
public abstract class UIOrderingList extends UIOrderingBaseComponent {
+ private transient Map permutationOrder;
+
protected static final class SubmittedValue implements Serializable {
/**
*
*/
private static final long serialVersionUID = 5860506816451180551L;
- private int[] permutationOrder;
+ private Map permutationOrder;
private Set selectedItems = new HashSet();
private Integer 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++) {
+ String[] valueOrder = string.split(",");
+ permutationOrder = new LinkedHashMap(valueOrder.length);
+ for (int i = 0; i < valueOrder.length; i++) {
+ Matcher matcher = Pattern.compile("(\\d+)(s?a?)").matcher(valueOrder[i]);
+ matcher.matches();
+
+ try {
+ Integer oldKey = Integer.valueOf(matcher.group(1));
+ Integer newKey = new Integer(i);
+ permutationOrder.put(oldKey, newKey);
+ 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]));
+ if ('s' == c) {
+ selectedItems.add(oldKey);
} else if ('a' == c) {
- activeItem = new Integer(permutationOrder[i]);
+ activeItem = oldKey;
} else {
break ;
}
-
+
}
- } catch (NumberFormatException e) {
- throw new FacesException(e.getLocalizedMessage(), e);
+ } catch (NumberFormatException e) {
+ throw new FacesException(e.getLocalizedMessage(), e);
}
- }
+ }
}
-
+
public String toString() {
StringBuffer result = new StringBuffer();
- for (int i = 0; i < permutationOrder.length; i++) {
- result.append(permutationOrder[i]);
+ Iterator iterator = permutationOrder.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
- Integer key = new Integer(permutationOrder[i]);
-
+ Object key = entry.getKey();
+
+ result.append(key);
if (selectedItems.contains(key)) {
result.append('s');
}
-
+
if (key.equals(activeItem)) {
result.append('a');
}
- if (i < permutationOrder.length - 1) {
- result.append(',');
- }
+ if (iterator.hasNext()) {
+ result.append(',');
+ }
}
return result.toString();
}
- public int[] getPermutationOrder() {
- return permutationOrder;
- }
-
}
-
+
public interface ItemState {
public boolean isSelected();
public boolean isActive();
}
-
+
private final class SubmittedItemState implements ItemState {
-
+
public boolean isActive() {
return submittedValueHolder.activeItem != null &&
- submittedValueHolder.activeItem.equals(getTranslatedRowKey());
+ submittedValueHolder.activeItem.equals(getTranslatedRowKey());
}
public boolean isSelected() {
return submittedValueHolder.selectedItems != null &&
- submittedValueHolder.selectedItems.contains(getTranslatedRowKey());
+ submittedValueHolder.selectedItems.contains(getTranslatedRowKey());
}
}
-
+
private final class ModelItemState implements ItemState {
private Collection selectedItems;
private Object activeItem;
-
+
public ModelItemState(Collection selectedItems, Object activeItem) {
super();
this.selectedItems = selectedItems;
@@ -137,24 +144,24 @@
public boolean isSelected() {
return selectedItems != null && selectedItems.contains(getRowData());
}
-
+
public boolean isActive() {
return activeItem != null && activeItem.equals(getRowData());
}
}
-
+
protected ExtendedDataModel createDataModel() {
DataModel dataModel = createDataModel(getValue());
-
+
if (isTranslatedRenderingState() || isTranslatedState()) {
- return new TranslatedSequenceDataModel(dataModel, isTranslatedState(), submittedValueHolder != null ? submittedValueHolder.permutationOrder : null);
+ return new TranslatedSequenceDataModel(dataModel, isTranslatedState(), submittedValueHolder != null ? submittedValueHolder.permutationOrder : this.permutationOrder);
} else {
return new TranslatedSequenceDataModel(dataModel, false, null);
}
}
private transient SubmittedValue submittedValueHolder = null;
-
+
public void addValueChangeListener(ValueChangeListener listener) {
addFacesListener(listener);
}
@@ -176,16 +183,16 @@
public void removeValueChangeListener(ValueChangeListener listener) {
removeFacesListener(listener);
}
-
-
+
+
public String getSubmittedString() {
return submittedValueHolder != null ? submittedValueHolder.toString() : "";
}
-
+
public void setSubmittedString(String submittedString) {
this.submittedValueHolder = new SubmittedValue(submittedString);
}
-
+
protected Object saveIterationSubmittedState() {
return submittedValueHolder;
}
@@ -193,14 +200,15 @@
protected void restoreIterationSubmittedState(Object object) {
this.submittedValueHolder = (SubmittedValue) object;
}
-
+
protected Object saveIterationState() {
- return null;
+ return permutationOrder;
}
-
+
protected void restoreIterationState(Object object) {
+ this.permutationOrder = (Map) object;
}
-
+
public abstract void setImmediate(boolean immediate);
public abstract void setRequired(boolean required);
@@ -320,7 +328,7 @@
}
}
-
+
/**
* <p>Perform the following algorithm to update the model data
* associated with this {@link UIInput}, if any, as appropriate.</p>
@@ -421,7 +429,7 @@
Object newValue = null;
try {
- newValue = getConvertedValue();
+ newValue = getConvertedValue(context);
}
catch (ConverterException ce) {
Object submittedValue = submittedValueHolder;
@@ -434,18 +442,16 @@
// 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();) {
+ .hasNext();) {
setRowKey(context, iterator.next());
Object selectionItem = getRowData();
-
+
selectionSet.add(selectionItem);
}
-
+
setSelection(selectionSet);
if (submittedValueHolder.activeItem != null) {
@@ -456,7 +462,7 @@
} else {
setActiveItem(null);
}
-
+
Object previous = getValue();
setValue(newValue);
setTranslatedState();
@@ -465,57 +471,79 @@
queueEvent(new ValueChangeEvent(this, previous, newValue));
}
+ this.permutationOrder = this.submittedValueHolder.permutationOrder;
this.submittedValueHolder = null;
-
- setRowKey(rowKey);
}
}
- protected Object getConvertedValue() throws ConverterException {
+ protected Object getConvertedValue(FacesContext context) throws ConverterException {
Object convertedValue = getValue();
if (convertedValue == null) {
convertedValue = Collections.EMPTY_LIST;
}
-
+
if (submittedValueHolder != null) {
Object savedValue = convertedValue;
-
- 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));
+
+ //int[] indexes = submittedValueHolder.permutationOrder;
+
+ TranslatedSequenceDataModel dataModel = (TranslatedSequenceDataModel) getExtendedDataModel();
+ dataModel.setTranslationTable(submittedValueHolder.permutationOrder);
+
+ try {
+ if (savedValue instanceof List) {
+ List list = (List) savedValue;
+ final ArrayList arrayList = new ArrayList(list.size());
+
+ walk(context, new DataVisitor() {
+
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ setRowKey(rowKey);
+ arrayList.add(getRowData());
+ }
+
+ }, null);
+
+ convertedValue = arrayList;
+ } else {
+ final Object[] convertedValueArray = (Object[]) Array.newInstance(savedValue.getClass().getComponentType(),
+ Array.getLength(savedValue));
+
+ walk(context, new DataVisitor() {
+ private int counter = 0;
+
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ setRowKey(rowKey);
+ convertedValueArray[counter++] = getRowData();
+ }
+
+ }, null);
+
+ convertedValue = convertedValueArray;
}
- convertedValue = arrayList;
- } else {
- Object[] savedValueArray = (Object[]) savedValue;
- Object[] convertedValueArray = (Object[]) Array.newInstance(savedValue.getClass().getComponentType(),
- Array.getLength(savedValue));
- convertedValue = convertedValueArray;
-
- for (int i = 0; i < indexes.length; i++) {
- convertedValueArray[i] = savedValueArray[indexes[i]];
- }
+ } catch (IOException e) {
+ throw new ConverterException(e.getLocalizedMessage(), e);
}
-
- //submittedValueHolder.newValue = convertedValue;
}
-
+
return convertedValue;
}
protected void resetDataModel() {
super.resetDataModel();
+ this.permutationOrder = null;
+
if (this.submittedValueHolder != null) {
setTranslatedRenderingState();
}
}
-
+
/**
*
* <p>Set the "valid" property according to the below algorithm.</p>
@@ -609,10 +637,10 @@
public Object getTranslatedRowKey() {
return ((TranslatedSequenceDataModel) getExtendedDataModel()).getTranslatedRowKey();
}
-
+
public String getElementsOrder() {
Object order = null;
-
+
if (isTranslatedRenderingState()) {
if (this.submittedValueHolder != null) {
order = this.submittedValueHolder.permutationOrder;
@@ -621,7 +649,7 @@
return ScriptUtils.toScript(order);
}
-
+
public ItemState getItemState() {
if (submittedValueHolder != null) {
return new SubmittedItemState();
@@ -629,22 +657,22 @@
return new ModelItemState(getSelection(), getActiveItem());
}
}
-
+
/*public abstract boolean isOrderControlsVisible();
public abstract void setOrderControlsVisible(boolean visible);
-
+
public abstract boolean isFastOrderControlsVisible();
public abstract void setFastOrderControlsVisible(boolean visible);*/
-
+
public abstract String getControlsType();
public abstract void setControlsType(String type);
-
+
public abstract int getListWidth();
-
+
public abstract void setListWidth(int listWidth);
-
+
public abstract int getListHeight();
-
+
public abstract void setListHeight(int listHeight);
}
Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/TranslatedSequenceDataModel.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/TranslatedSequenceDataModel.java 2007-11-28 00:50:15 UTC (rev 4301)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/model/TranslatedSequenceDataModel.java 2007-11-28 02:27:04 UTC (rev 4302)
@@ -4,6 +4,9 @@
package org.richfaces.model;
import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
import javax.faces.context.FacesContext;
import javax.faces.model.DataModel;
@@ -21,16 +24,16 @@
public class TranslatedSequenceDataModel extends SequenceDataModel {
protected static final class TranslatedRowKey {
- private Integer key;
+ private Object key;
private String asString;
- public TranslatedRowKey(Integer key, String asString) {
+ public TranslatedRowKey(Object key, String asString) {
super();
this.key = key;
this.asString = asString;
}
- public Integer getKey() {
+ public Object getKey() {
return key;
}
@@ -43,13 +46,13 @@
}
};
- private int[] translationTable;
+ private Map translationTable;
private boolean translatedModel;
private Object rowKey;
public TranslatedSequenceDataModel(DataModel wrapped,
- boolean translatedModel, int[] translationTable) {
+ boolean translatedModel, Map translationTable) {
super(wrapped);
this.translatedModel = translatedModel;
this.translationTable = translationTable;
@@ -59,11 +62,11 @@
super(wrapped);
}
- private int translate(int i) {
+ private Object translate(Object key) {
if (translationTable != null) {
- return translationTable[i];
+ return translationTable.get(key);
} else {
- return i;
+ return key;
}
}
@@ -83,8 +86,7 @@
} else {
if (this.translatedModel) {
if (rowKey != null) {
- int iKey = ((Integer) key).intValue();
- super.setRowKey(new Integer(translate(iKey)));
+ super.setRowKey(translate(key));
} else {
super.setRowKey(null);
}
@@ -97,13 +99,32 @@
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);
+ if (this.translationTable != null) {
+ Iterator iterator = this.translationTable.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+
+ if (this.translatedModel) {
+ visitor.process(context, new TranslatedRowKey(
+ entry.getValue(), String.valueOf(entry.getKey())), argument);
+ } else {
+ visitor.process(context, entry.getKey(), argument);
+ }
}
+ } else {
+ for (int i = 0; i < getRowCount(); i++) {
+ if (this.translatedModel) {
+ Integer key = new Integer(i);
+ visitor.process(context, new TranslatedRowKey(
+ translate(key), String.valueOf(key)), argument);
+ } else {
+ visitor.process(context, new Integer(i), argument);
+ }
+ }
}
}
+
+ public void setTranslationTable(Map translationTable) {
+ this.translationTable = translationTable;
+ }
}
17 years, 1 month
JBoss Rich Faces SVN: r4301 - in trunk: extensions/portlet/src/main/java/org/ajax4jsf/portlet/context and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-11-27 19:50:15 -0500 (Tue, 27 Nov 2007)
New Revision: 4301
Added:
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/master.css
Modified:
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/ContextAttributesMap.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/ContextMap.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/PortletContextImpl.java
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/jboss-portlet.xml
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/conversations.xhtml
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/screen.css
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/trailblazer_main.css
Log:
Fix some issues with Seam portlet sample
Modified: trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java
===================================================================
--- trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java 2007-11-27 20:24:22 UTC (rev 4300)
+++ trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java 2007-11-28 00:50:15 UTC (rev 4301)
@@ -148,8 +148,9 @@
AjaxContext ajaxContext = AjaxContext
.getCurrentInstance(facesContext);
Map commonAjaxParameters = ajaxContext.getCommonAjaxParameters();
+ String actionURL = facesContext.getApplication().getViewHandler().getActionURL(facesContext, facesContext.getViewRoot().getViewId());
commonAjaxParameters.put(AbstractExternalContext.ACTION__PARAMETER,
- response.createActionURL().toString());
+ facesContext.getExternalContext().encodeActionURL(actionURL));
commonAjaxParameters.put(
AbstractExternalContext.PORTLET_MODE_PARAMETER, request
.getPortletMode().toString());
Modified: trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/ContextAttributesMap.java
===================================================================
--- trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/ContextAttributesMap.java 2007-11-27 20:24:22 UTC (rev 4300)
+++ trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/ContextAttributesMap.java 2007-11-28 00:50:15 UTC (rev 4301)
@@ -18,6 +18,13 @@
return getAttribute(key.toString());
}
+ public boolean containsKey(Object key) {
+ if (null == key) {
+ throw new NullPointerException();
+ }
+ return null != getAttribute(key.toString());
+ }
+
public Object put(Object key, Object value) {
if (null == key) {
throw new NullPointerException();
Modified: trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/ContextMap.java
===================================================================
--- trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/ContextMap.java 2007-11-27 20:24:22 UTC (rev 4300)
+++ trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/ContextMap.java 2007-11-28 00:50:15 UTC (rev 4301)
@@ -23,6 +23,7 @@
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Collection;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
@@ -44,7 +45,10 @@
*
*/
abstract class ContextMap extends AbstractMap {
+
private transient volatile Set keySet;
+
+ private transient volatile Set entrySet;
/*
*
@@ -56,14 +60,41 @@
*
*/
public Set entrySet() {
- Set entries = new HashSet();
- for (Enumeration e = getEnumeration(); e.hasMoreElements();) {
- String paramName = (String) e.nextElement();
- if (isValidParameter(paramName)) {
- entries.add(new Entry(paramName, get(paramName)));
- }
+ if(this.entrySet == null){
+ this.entrySet = new AbstractSet<Entry>(){
+
+ @Override
+ public Iterator<org.ajax4jsf.portlet.context.ContextMap.Entry> iterator() {
+ return new Iterator<Entry>(){
+
+ private Enumeration enumeration = getEnumeration();
+
+ public boolean hasNext() {
+ return enumeration.hasMoreElements();
+ }
+
+ public org.ajax4jsf.portlet.context.ContextMap.Entry next() {
+ Object key = enumeration.nextElement();
+ return new Entry(key, get(key));
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+ }
+
+ @Override
+ public int size() {
+ return ContextMap.this.size();
+ }
+
+
+ };
}
- return entries;
+
+ return this.entrySet;
}
protected boolean isValidParameter(String paramName) {
@@ -78,14 +109,7 @@
}
public int size() {
- Enumeration enumeration = getEnumeration();
- int size = 0;
- while (enumeration.hasMoreElements()) {
- enumeration.nextElement();
- size++;
- }
- ;
- return size;
+ return ContextMap.this.size();
}
};
}
@@ -152,28 +176,6 @@
throw new UnsupportedOperationException();
}
- public int hashCode() {
- return ((this.key == null ? 0 : this.key.hashCode()) ^ (this.value == null ? 0
- : this.value.hashCode()));
- }
-
- public boolean equals(Object obj) {
- if ((obj == null) || !(obj instanceof Map.Entry)) {
- return false;
- }
- Map.Entry input = (Map.Entry) obj;
- Object inputKey = input.getKey();
- Object inputValue = input.getValue();
- if ((inputKey == this.key)
- || ((inputKey != null) && inputKey.equals(this.key))) {
- if ((inputValue == this.value)
- || ((inputValue != null) && inputValue
- .equals(this.value))) {
- return true;
- }
- }
- return false;
- }
}
public boolean equals(Object obj) {
@@ -182,4 +184,18 @@
}
return super.equals(obj);
}
+
+ /**
+ * @return
+ */
+ public int size() {
+ Enumeration enumeration = getEnumeration();
+ int size = 0;
+ while (enumeration.hasMoreElements()) {
+ enumeration.nextElement();
+ size++;
+ }
+ ;
+ return size;
+ }
}
\ No newline at end of file
Modified: trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/PortletContextImpl.java
===================================================================
--- trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/PortletContextImpl.java 2007-11-27 20:24:22 UTC (rev 4300)
+++ trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/PortletContextImpl.java 2007-11-28 00:50:15 UTC (rev 4301)
@@ -30,6 +30,7 @@
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.portlet.faces.Bridge;
import org.ajax4jsf.webapp.WebXml;
@@ -306,6 +307,9 @@
if (null == url) {
throw new NullPointerException("Path to redirect is null");
}
- ((ActionResponse) getResponse()).sendRedirect(url);
+ PortalActionURL actionURL = new PortalActionURL(url);
+ if(url.startsWith("#") || (!actionURL.isInContext(getRequestContextPath())) || "true".equalsIgnoreCase(actionURL.getParameter(Bridge.DIRECT_LINK))){
+ ((ActionResponse) getResponse()).sendRedirect(url);
+ }
}
}
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/jboss-portlet.xml 2007-11-27 20:24:22 UTC (rev 4300)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/jboss-portlet.xml 2007-11-28 00:50:15 UTC (rev 4301)
@@ -5,5 +5,8 @@
"http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd"><portlet-app>
<portlet>
<portlet-name>seamBookingPortlet</portlet-name>
+ <header-content>
+ <link rel="stylesheet" type="text/css" href="/css/screen.css" media="screen"/>
+ </header-content>
</portlet>
</portlet-app>
\ No newline at end of file
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/conversations.xhtml
===================================================================
--- trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/conversations.xhtml 2007-11-27 20:24:22 UTC (rev 4300)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/conversations.xhtml 2007-11-28 00:50:15 UTC (rev 4301)
@@ -3,12 +3,14 @@
xmlns:c="http://java.sun.com/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
- xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
xmlns:s="http://jboss.com/products/seam/taglib">
- <div>
+ <a4j:outputPanel ajaxRendered="true">
<div class="section">
- <h1><h:outputText rendered="#{not empty conversationList}" value="Workspaces"/></h1>
+ <h1><h:outputText value="Workspaces"/></h1>
</div>
<div class="section">
@@ -32,5 +34,5 @@
</h:form>
</div>
- </div>
+ </a4j:outputPanel>
</ui:composition>
\ No newline at end of file
Added: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/master.css
===================================================================
--- trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/master.css (rev 0)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/master.css 2007-11-28 00:50:15 UTC (rev 4301)
@@ -0,0 +1,147 @@
+body {
+ font: normal 12px Lucida Sans, Trebuchet, tahoma, sans-serif;
+}
+
+.align-center {
+ text-align: center;
+}
+
+.align-left {
+ text-align: left;
+}
+
+.align-center-margin {
+ margin: 0 auto 0 auto;
+}
+
+.float-left {
+ float: left;
+}
+
+.float-right {
+ float: right;
+}
+
+.align-left {
+ text-align: left;
+}
+
+.align-right {
+ text-align: right;
+}
+
+.half-width {
+ width: 49%;
+}
+
+.quarter-width {
+ width: 24.9%;
+}
+
+.three-quarter-width {
+ width: 74.9%;
+}
+
+.full-width {
+ width: 100%;
+}
+
+.third-width {
+ width: 32.9%;
+}
+
+.two-third-width {
+ width: 65.5%;
+}
+
+.tenpx-top-bottom {
+ margin: 10px 0 10px 0;
+}
+
+.relative {
+ position:relative
+}
+
+.absolute{
+ position:absolute
+}
+
+p.white-padded{
+ color:#fff;
+ padding:5px;
+}
+
+.clear {
+ clear: both;
+}
+
+img {
+ margin: 0;
+ padding: 0;
+ border: 0;
+}
+
+ div,
+ form,
+ ul,
+ li{
+ margin: 0;
+ padding: 0;
+}
+
+ul{
+
+}
+
+/*--------------------------------Decoration*/
+
+h2 {
+ font-size: 1.9em;
+ color: #fff;
+ margin: 0;
+ padding: 0;
+}
+
+h3 {
+ font-size: 1.0em;
+ color: #fff;
+ margin: 0;
+ padding: 0;
+}
+
+a {
+ color: #e1d77e;
+}
+
+p {
+ margin: 0;
+ padding: 0;
+}
+
+.white-border {
+ border: 1px solid #fff;
+}
+
+.bold-black {
+ font-size: 1.0em;
+ color: #000;
+}
+
+.yellow {
+ background-color:#FFFF00;
+}
+
+.blue {
+ background-color:#3333CC;
+}
+
+.green {
+ background-color:#009933;
+}
+
+.white {
+ background-color:#fff;
+}
+
+/*---------------------------Main layout*/
+
Property changes on: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/master.css
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/screen.css
===================================================================
--- trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/screen.css 2007-11-27 20:24:22 UTC (rev 4300)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/screen.css 2007-11-28 00:50:15 UTC (rev 4301)
@@ -1,274 +1,274 @@
-/* Setup defaults since variable in browsers
------------------------------------------------ */
-body, div, span, dd, dt, dl, img, ul, ol, li, p, h1, h2, h3, h4, h5, form, hr, fieldset {
- margin: 0;
- padding: 0;
-}
-/* Element Defaults
------------------------------------------------ */
-html {
- height: 100%;
- background-color: #DBD4C6;
-}
-img {
- border: 0;
-}
-body {
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: small;
- line-height: 1.25em;
- color: #362F2D;
- position: relative;
- width: 760px;
- height: 100%;
- margin-left: auto;
- margin-right: auto;
-}
-.label {
- font-weight: bold;
- color: #5E5147;
-}
-input {
- border: 1px solid #C3BBB6;
- padding: 4px;
- margin: 5px 0;
- background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
-}
-select {
- border: 1px solid #C3BBB6;
- padding: 4px;
- margin: 5px 0;
- background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
-}
-ol, ul {
- margin: 10px 0px 10px 6px;
-}
-li {
- margin: 10px 12px;
-}
-fieldset {
- border: 0;
-}
-/* Layout
------------------------------------------------ */
-#document {
- padding: 0 1px;
- background: #fff url(../img/bg.gif) 0 0 repeat-y;
- float: left;
- border-bottom: 1px solid #C3BBB6;
-}
-#header {
- float: left;
- width: 758px;
- height: 46px;
- background: url(../img/hdr.bg.gif) 0 0 repeat-x;
-}
-#container {
- float: left;
- width: 758px;
- background: url(../img/hdr.bar.jpg) 0 0 repeat-x;
-}
-#sidebar {
- float: left;
- width: 190px;
- margin-top: 96px;
- padding: 20px 10px 0 10px;
- background: url(../img/sdb.bg.gif) 0 0 no-repeat;
-}
-#content {
- float: left;
- width: 548px;
- margin-top: 75px;
- padding-top: 5px;
- background: #fff url(../img/cnt.bg.gif) 0 0 repeat-x;
-}
-#footer {
- clear: both;
- margin-top: 40px;
- float: left;
- padding: 20px;
- border-top: 1px solid #C3BBB6;
- background-color: #fff;
- width: 718px;
- text-align: right;
-}
-/* General
------------------------------------------------ */
-input[type="submit"], input[type="button"] {
- font-weight: bold;
- color: #fff;
- border: 1px solid #5D1414;
- height: 26px;
- background: #fff url(../img/btn.bg.gif) 0 0 repeat-x;
- border-style: none;
-}
-.center {
- text-align: center;
-}
-.entry {
- clear: both;
- padding-top: 10px;
-}
-.entry .label {
- float: left;
- padding-right: 5px;
- font-weight: bold;
- width: 150px;
- text-align: right;
-}
-.entry .output {
- float: right;
- width: 360px;
- padding-top: 10px;
- text-align: left;
-}
-.entry .input {
- float: right;
- width: 360px;
- text-align: left;
-}
-.entry .error {
- float: right;
- width: 360px;
- text-align: left;
-}
-/* Sidebar
------------------------------------------------ */
-.notes {
- text-align: center;
- font-size: small;
-}
-.errors {
- font-size: small;
- font-weight: bold;
- text-align: center;
- color: #600;
-}
-.errors div {
- text-align: left;
-}
-.errors span {
- text-align: left;
-}
-.errors input {
- border: 1px solid #600;
-}
-.errors ul {
- list-style: none;
-}
-.buttonBox {
- text-align: center;
- padding: 5px 0;
- clear: both;
-}
-#sidebar p {
- font-size: small;
- color: #8B7869;
- line-height: 150%;
- padding-bottom: 10px;
-}
-#sidebar li {
- font-size: small;
- color: #8B7869;
-}
-#sidebar h1 {
- line-height: normal;
- font-weight: bold;
- font-size: small;
-}
-/*
-#sidebar p:hover {
- color: #362F2D;
-}
-*/
-/* Content
------------------------------------------------ */
-#content .section {
- float: left;
- width: 518px;
- padding: 15px 15px 0 15px;
-}
-#content .section h1 {
- font-family: "Trebuchet MS", Arial, sans-serif;
- line-height: normal;
- font-weight: normal;
- font-size: large;
-}
-#content .section p {
- line-height: 150%;
- padding: 10px 0;
- font-size: small;
-}
-#content table {
- width: 100%;
- border: 1px solid #D2C9C4;
- border-collapse: collapse;
-}
-#content table caption {
- padding-bottom: 6px;
- text-align: left;
- font-weight: bold;
-}
-#content table thead th {
- border-left: 1px solid #D2C9C4;
- background: #fff url(../img/th.bg.gif) 0 100% repeat-x;
- border-bottom: 1px solid #D2C9C4;
- padding: 6px;
- text-align: left;
- font-size: small;
-}
-#content table tbody td {
- border-left: 1px solid #E4DBD5;
- padding: 4px;
- border-bottom: 1px solid #D2C9C4;
- font-size: small;
-}
-#content dt {
- font-weight: bold;
- float: left;
- width: 33%;
-}
-#content dd {
- padding-left: 10px;
- float: left;
- width: 66%;
-}
-#content table.radio {
- border: 0px;
-}
-#content table.radio tbody tr td {
- border: 0px;
- border-left: 0px;
- border-bottom: 0px;
-}
-/* Header
------------------------------------------------ */
-#title {
- float: left;
- padding: 1px 0 6px 15px;
-}
-#status {
- color: #C7B299;
- float: right;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-weight: bold;
- font-size: x-small;
- text-align: right;
- padding-top: 14px;
- padding-right: 15px;
-}
-#status a {
- color: #C7B299;
- text-decoration: none;
-}
-/* Homepage Modifications
------------------------------------------------ */
-#pgHome #container {
- background: url(../img/hdr.ad.jpg) 0 0 repeat-x;
-}
-#pgHome #sidebar {
- margin-top: 207px;
-}
-#pgHome #content {
- margin-top: 183px;
-}
+/* Setup defaults since variable in browsers
+----------------------------------------------- */
+#document body, #document div, #document span, #document dd, #document dt, #document dl, #document img, #document ul, #document ol, #document li, #document p, #document h1, #document h2, #document h3, #document h4, #document h5, #document form, #document hr, #document fieldset {
+ margin: 0;
+ padding: 0;
+}
+/* Element Defaults
+----------------------------------------------- */
+div#content-container html {
+ height: 100%;
+ background-color: #DBD4C6;
+}
+#document img {
+ border: 0;
+}
+#pgHome {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: small;
+ line-height: 1.25em;
+ color: #362F2D;
+ position: relative;
+ width: 760px;
+ height: 100%;
+ margin-left: auto;
+ margin-right: auto;
+}
+#document .label {
+ font-weight: bold;
+ color: #5E5147;
+}
+#document input {
+ border: 1px solid #C3BBB6;
+ padding: 4px;
+ margin: 5px 0;
+ background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
+}
+#document select {
+ border: 1px solid #C3BBB6;
+ padding: 4px;
+ margin: 5px 0;
+ background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
+}
+#document ol, #document ul {
+ margin: 10px 0px 10px 6px;
+}
+#document li {
+ margin: 10px 12px;
+}
+#document fieldset {
+ border: 0;
+}
+/* Layout
+----------------------------------------------- */
+#document {
+ padding: 0 1px;
+ background: #fff url(../img/bg.gif) 0 0 repeat-y;
+ float: left;
+ border-bottom: 1px solid #C3BBB6;
+}
+#document #header {
+ float: left;
+ width: 758px;
+ height: 46px;
+ background: url(../img/hdr.bg.gif) 0 0 repeat-x;
+}
+#document #container {
+ float: left;
+ width: 758px;
+ background: url(../img/hdr.bar.jpg) 0 0 repeat-x;
+}
+#document #sidebar {
+ float: left;
+ width: 190px;
+ margin-top: 96px;
+ padding: 20px 10px 0 10px;
+ background: url(../img/sdb.bg.gif) 0 0 no-repeat;
+}
+#document #content {
+ float: left;
+ width: 548px;
+ margin-top: 75px;
+ padding-top: 5px;
+ background: #fff url(../img/cnt.bg.gif) 0 0 repeat-x;
+}
+#document #footer {
+ clear: both;
+ margin-top: 40px;
+ float: left;
+ padding: 20px;
+ border-top: 1px solid #C3BBB6;
+ background-color: #fff;
+ width: 718px;
+ text-align: right;
+}
+/* General
+----------------------------------------------- */
+#document input[type="submit"], #document input[type="button"] {
+ font-weight: bold;
+ color: #fff;
+ border: 1px solid #5D1414;
+ height: 26px;
+ background: #fff url(../img/btn.bg.gif) 0 0 repeat-x;
+ border-style: none;
+}
+#document .center {
+ text-align: center;
+}
+#document .entry {
+ clear: both;
+ padding-top: 10px;
+}
+#document .entry .label {
+ float: left;
+ padding-right: 5px;
+ font-weight: bold;
+ width: 150px;
+ text-align: right;
+}
+#document .entry .output {
+ float: right;
+ width: 360px;
+ padding-top: 10px;
+ text-align: left;
+}
+#document .entry .input {
+ float: right;
+ width: 360px;
+ text-align: left;
+}
+#document .entry .error {
+ float: right;
+ width: 360px;
+ text-align: left;
+}
+/* Sidebar
+----------------------------------------------- */
+#document .notes {
+ text-align: center;
+ font-size: small;
+}
+#document .errors {
+ font-size: small;
+ font-weight: bold;
+ text-align: center;
+ color: #600;
+}
+#document .errors div {
+ text-align: left;
+}
+#document .errors span {
+ text-align: left;
+}
+#document .errors input {
+ border: 1px solid #600;
+}
+#document .errors ul {
+ list-style: none;
+}
+#document .buttonBox {
+ text-align: center;
+ padding: 5px 0;
+ clear: both;
+}
+#document #sidebar p {
+ font-size: small;
+ color: #8B7869;
+ line-height: 150%;
+ padding-bottom: 10px;
+}
+#document #sidebar li {
+ font-size: small;
+ color: #8B7869;
+}
+#document #sidebar h1 {
+ line-height: normal;
+ font-weight: bold;
+ font-size: small;
+}
+/*
+#sidebar p:hover {
+ color: #362F2D;
+}
+*/
+/* Content
+----------------------------------------------- */
+#document #content .section {
+ float: left;
+ width: 518px;
+ padding: 15px 15px 0 15px;
+}
+#document #content .section h1 {
+ font-family: "Trebuchet MS", Arial, sans-serif;
+ line-height: normal;
+ font-weight: normal;
+ font-size: large;
+}
+#document #content .section p {
+ line-height: 150%;
+ padding: 10px 0;
+ font-size: small;
+}
+#document #content table {
+ width: 100%;
+ border: 1px solid #D2C9C4;
+ border-collapse: collapse;
+}
+#document #content table caption {
+ padding-bottom: 6px;
+ text-align: left;
+ font-weight: bold;
+}
+#document #content table thead th {
+ border-left: 1px solid #D2C9C4;
+ background: #fff url(../img/th.bg.gif) 0 100% repeat-x;
+ border-bottom: 1px solid #D2C9C4;
+ padding: 6px;
+ text-align: left;
+ font-size: small;
+}
+#document #content table tbody td {
+ border-left: 1px solid #E4DBD5;
+ padding: 4px;
+ border-bottom: 1px solid #D2C9C4;
+ font-size: small;
+}
+#document #content dt {
+ font-weight: bold;
+ float: left;
+ width: 33%;
+}
+#document #content dd {
+ padding-left: 10px;
+ float: left;
+ width: 66%;
+}
+#document #content table.radio {
+ border: 0px;
+}
+#document #content table.radio tbody tr td {
+ border: 0px;
+ border-left: 0px;
+ border-bottom: 0px;
+}
+/* Header
+----------------------------------------------- */
+#document #title {
+ float: left;
+ padding: 1px 0 6px 15px;
+}
+#document #status {
+ color: #C7B299;
+ float: right;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-weight: bold;
+ font-size: x-small;
+ text-align: right;
+ padding-top: 14px;
+ padding-right: 15px;
+}
+#document #status a {
+ color: #C7B299;
+ text-decoration: none;
+}
+/* Homepage Modifications
+----------------------------------------------- */
+#pgHome #container {
+ background: url(../img/hdr.ad.jpg) 0 0 repeat-x;
+}
+#pgHome #sidebar {
+ margin-top: 207px;
+}
+#pgHome #content {
+ margin-top: 183px;
+}
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/trailblazer_main.css
===================================================================
--- trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/trailblazer_main.css 2007-11-27 20:24:22 UTC (rev 4300)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/css/trailblazer_main.css 2007-11-28 00:50:15 UTC (rev 4301)
@@ -1,148 +1,148 @@
-* {
- margin: 0px;
- padding: 0px;
- border: none;
-}
-
-body {
- font: 1em verdana, arial, sans-serif;
- background: #CCCCCC;
-}
-
-div#main {
- margin-left: 0px;
- width: 751px;
- background: #ecefdf;
-}
-
-div#top,div#pictures{
-}
-
-div#pictures img {
- float:left;
-}
-
-img#head1 {
- margin-right: 3px;
-}
-
-img#head2 {
- margin-right: 4px;
-}
-
-div.trail {
- clear:both;
- margin-left: 50px;
- margin-top: 0px;
- margin-right: 50px
-}
-
-div.foot {
- margin-left: 50px;
- margin-right: 50px;
- margin-top: 50px;
- text-align: center;
- font-size: .5em;
- height: 36px;
-}
-
-div.trail h1 {
- margin-top: -30px;
- margin-left: -50px;
- font-size: 1.2em;
- font-weight: bold;
- padding-left: .4em;
-}
-
-div.trail h2 {
- float: left;
- font-size: 1em;
- font-weight: bold;
- padding-left: .4em;
-}
-
-div.trail h3 {
- float: left;
- font-size: .8em;
- font-weight: bold;
- margin-left: -1.4em;
- margin-bottom: 1em;
-}
-
-
-div.trail p {
- clear: both;
- margin-top: 20px;
- font-size: .8em;
- text-decoration: none;
-}
-
-div#next_trail {
- margin-left: 36px;
-}
-
-div.numbox {
- border: thin solid black;
- margin-left: -.8em;
- float: left;
- background: #ffffff;
- padding: .2em .35em .3em;
- font-style: normal;
- font-weight: bold;
- font-size: 1.4em;
-}
-
-div.figure {
- text-align: center;
- font-size: .6em;
- margin-top: 30px;
-}
-
-div.figure img {
- display: block;
- margin-right: auto;
- margin-left: auto;
-}
-
-code {
- font: 1.1em "Courier New", Courier, mono;
-}
-
-code.block {
- white-space: pre;
- font: 10pt "Courier New", Courier, mono;
- display: block;
- border-style: dashed;
- border-width: thin;
- padding: .5em;
- background: #ffffff;
- margin: 20px;
-}
-
-div.foot_image {
- float: left;
- height: 86px;
-}
-
-a:active {
- color : #666666;
- text-decoration: none;
-}
-
-a:hover {
- color : #000000;
- background-color : #D6E0FE;
- text-decoration: none;
-}
-
-a:link {
- color : #005EB6;
- text-decoration: none;
-}
-
-a:visited {
- color : #888888;
- text-decoration: none;
-}
-
-
+* {
+ margin: 0px;
+ padding: 0px;
+ border: none;
+}
+
+body {
+ font: 1em verdana, arial, sans-serif;
+ background: #CCCCCC;
+}
+
+div#main {
+ margin-left: 0px;
+ width: 751px;
+ background: #ecefdf;
+}
+
+div#top,div#pictures{
+}
+
+div#pictures img {
+ float:left;
+}
+
+img#head1 {
+ margin-right: 3px;
+}
+
+img#head2 {
+ margin-right: 4px;
+}
+
+div.trail {
+ clear:both;
+ margin-left: 50px;
+ margin-top: 0px;
+ margin-right: 50px
+}
+
+div.foot {
+ margin-left: 50px;
+ margin-right: 50px;
+ margin-top: 50px;
+ text-align: center;
+ font-size: .5em;
+ height: 36px;
+}
+
+div.trail h1 {
+ margin-top: -30px;
+ margin-left: -50px;
+ font-size: 1.2em;
+ font-weight: bold;
+ padding-left: .4em;
+}
+
+div.trail h2 {
+ float: left;
+ font-size: 1em;
+ font-weight: bold;
+ padding-left: .4em;
+}
+
+div.trail h3 {
+ float: left;
+ font-size: .8em;
+ font-weight: bold;
+ margin-left: -1.4em;
+ margin-bottom: 1em;
+}
+
+
+div.trail p {
+ clear: both;
+ margin-top: 20px;
+ font-size: .8em;
+ text-decoration: none;
+}
+
+div#next_trail {
+ margin-left: 36px;
+}
+
+div.numbox {
+ border: thin solid black;
+ margin-left: -.8em;
+ float: left;
+ background: #ffffff;
+ padding: .2em .35em .3em;
+ font-style: normal;
+ font-weight: bold;
+ font-size: 1.4em;
+}
+
+div.figure {
+ text-align: center;
+ font-size: .6em;
+ margin-top: 30px;
+}
+
+div.figure img {
+ display: block;
+ margin-right: auto;
+ margin-left: auto;
+}
+
+code {
+ font: 1.1em "Courier New", Courier, mono;
+}
+
+code.block {
+ white-space: pre;
+ font: 10pt "Courier New", Courier, mono;
+ display: block;
+ border-style: dashed;
+ border-width: thin;
+ padding: .5em;
+ background: #ffffff;
+ margin: 20px;
+}
+
+div.foot_image {
+ float: left;
+ height: 86px;
+}
+
+a:active {
+ color : #666666;
+ text-decoration: none;
+}
+
+a:hover {
+ color : #000000;
+ background-color : #D6E0FE;
+ text-decoration: none;
+}
+
+a:link {
+ color : #005EB6;
+ text-decoration: none;
+}
+
+a:visited {
+ color : #888888;
+ text-decoration: none;
+}
+
+
17 years, 1 month
JBoss Rich Faces SVN: r4300 - in trunk/ui/calendar/src/main: resources/org/richfaces/renderkit/html/css and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-11-27 15:24:22 -0500 (Tue, 27 Nov 2007)
New Revision: 4300
Added:
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/html/iconimages/CalendarSeparator.java
Modified:
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
Separator image for calendar.
Added: trunk/ui/calendar/src/main/java/org/richfaces/renderkit/html/iconimages/CalendarSeparator.java
===================================================================
--- trunk/ui/calendar/src/main/java/org/richfaces/renderkit/html/iconimages/CalendarSeparator.java (rev 0)
+++ trunk/ui/calendar/src/main/java/org/richfaces/renderkit/html/iconimages/CalendarSeparator.java 2007-11-27 20:24:22 UTC (rev 4300)
@@ -0,0 +1,121 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.iconimages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.util.Date;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.GifRenderer;
+import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper2;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class CalendarSeparator extends Java2Dresource {
+ private final static Dimension DIMENSIONS = new Dimension(1, 15);
+ private final static String COLOR_SKIN_PARAM = "headerTextColor";
+ private final static String DEFAULT_HTML_COLOR = "#FFFFFF";
+
+ public CalendarSeparator() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ @Override
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return DIMENSIONS;
+ }
+
+ @Override
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return DIMENSIONS;
+ }
+
+ @Override
+ protected Object getDataToStore(FacesContext context, Object data) {
+ Skin skin = SkinFactory.getInstance().getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
+
+ byte [] ret = new byte[3];
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ String htmlColor = (String) skin.getParameter(context, COLOR_SKIN_PARAM);
+ if (null == htmlColor || "".equals(htmlColor))
+ htmlColor = (String) defaultSkin.getParameter(context, COLOR_SKIN_PARAM);
+
+ if (htmlColor == null) {
+ htmlColor = DEFAULT_HTML_COLOR;
+ }
+
+ color = HtmlColor.decode(htmlColor);
+
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ @Override
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color color = (Color)restoreData(context);
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ g2d.setColor(color);
+ //TODO hans, need to be optimized
+ for (int i = 0;i < DIMENSIONS.getHeight(); i += 2 ) {
+ g2d.drawLine(0, i, 0, i);
+ }
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+
+ Zipper2 zipper = new Zipper2(objectArray);
+
+ return zipper.nextColor();
+ }
+
+ public boolean isCacheable() {
+ return true;
+ }
+}
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2007-11-27 19:45:17 UTC (rev 4299)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2007-11-27 20:24:22 UTC (rev 4300)
@@ -215,6 +215,15 @@
<u:style name="cursor" value="pointer"/>
<u:style name="vertical-align" value="middle"/>
</u:selector>
-}
+
+ <u:selector name=".rich-calendar-close-tool">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.iconimages.CalendarSeparator" />
+ </u:style>
+ <u:style name="background-repeat" value="no-repeat" />
+ <u:style name="background-position" value="left center" />
+ <u:style name="background-attachment" value="scroll" />
+ <u:style name="background-color" skin="headerBackgroundColor"/>
+ </u:selector>
</f:template>
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-11-27 19:45:17 UTC (rev 4299)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-11-27 20:24:22 UTC (rev 4300)
@@ -1770,7 +1770,7 @@
[
new ET(function (context) { return Richfaces.evalMacro("nextYearControl", context)})
]),
- new E('td',{'class': 'rich-calendar-tool'},
+ new E('td',{'class': 'rich-calendar-tool rich-calendar-close-tool'},
[
new ET(function (context) { return Richfaces.evalMacro("closeControl", context)})
])
17 years, 1 month