JBoss Rich Faces SVN: r3936 - in trunk/sandbox/ui/orderingList/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-12 15:18:12 -0500 (Mon, 12 Nov 2007)
New Revision: 3936
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
Log:
VB handling for activeItem/selection added
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-12 19:06:42 UTC (rev 3935)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-12 20:18:12 UTC (rev 3936)
@@ -431,7 +431,6 @@
}
}
-
/**
* <p>Specialized decode behavior on top of that provided by the
* superclass. In addition to the standard
@@ -787,15 +786,15 @@
selectionSet.add(selectionItem);
}
- this.selection = selectionSet;
- this.localSelectionSet = true;
+ setSelection(selectionSet);
if (submittedValueHolder.activeItem != null) {
dataModel.setRowKey(submittedValueHolder.activeItem);
Object activeItem = dataModel.getRowData();
- this.activeItem = activeItem;
- this.localActiveItemSet = true;
+ setActiveItem(activeItem);
+ } else {
+ setActiveItem(null);
}
Object previous = getValue();
@@ -1030,7 +1029,7 @@
return ScriptUtils.toScript(order);
}
- public boolean isActiveItem() {
+ public boolean isActive() {
return activeItem != null && activeItem.equals(getRowData()) || submittedValueHolder != null && (submittedValueHolder.activeItem != null && submittedValueHolder.activeItem.equals(getTranslatedRowKey()));
}
@@ -1038,9 +1037,42 @@
return selection != null && selection.contains(getRowData()) || submittedValueHolder != null && submittedValueHolder.selectedItems.contains(getTranslatedRowKey());
}
- public abstract Collection getSelection();
- public abstract void setSelection(Collection collection);
+ public Collection getSelection() {
+ if (this.selection != null) {
+ return this.selection;
+ } else {
+ ValueBinding vb = getValueBinding("selection");
+ if (vb != null) {
+ return (Collection) vb.getValue(FacesContext.getCurrentInstance());
+ }
+ }
+
+ return null;
+ }
+
+ public void setSelection(Collection collection) {
+ this.selection = collection;
+ this.localSelectionSet = true;
+ }
+ public Object getActiveItem() {
+ if (this.activeItem != null) {
+ return this.activeItem;
+ } else {
+ ValueBinding vb = getValueBinding("activeItem");
+ if (vb != null) {
+ return vb.getValue(FacesContext.getCurrentInstance());
+ }
+ }
+
+ return null;
+ }
+
+ public void setActiveItem(Object activeItem) {
+ this.activeItem = activeItem;
+ this.localActiveItemSet = true;
+ }
+
public abstract boolean isOrderControlsVisible();
public abstract void setOrderControlsVisible(boolean visible);
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-12 19:06:42 UTC (rev 3935)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-12 20:18:12 UTC (rev 3936)
@@ -371,7 +371,7 @@
writer.writeAttribute("id", clientId, null);
String className = null;
- if (table.isActiveItem()) {
+ if (table.isActive()) {
className = "ol_active rich-ordering-list-row-active";
} else if (table.isSelected()) {
className = "ol_select rich-ordering-list-row-selected";
18 years, 5 months
JBoss Rich Faces SVN: r3935 - in trunk/sandbox/ui/orderingList/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-12 14:06:42 -0500 (Mon, 12 Nov 2007)
New Revision: 3935
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/TranslatedSequenceDataModel.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
Log:
latest changes for orderingList
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/TranslatedSequenceDataModel.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/TranslatedSequenceDataModel.java 2007-11-12 18:19:34 UTC (rev 3934)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/TranslatedSequenceDataModel.java 2007-11-12 19:06:42 UTC (rev 3935)
@@ -67,6 +67,10 @@
}
}
+ public Object getTranslatedRowKey() {
+ return super.getRowKey();
+ }
+
public Object getRowKey() {
return rowKey;
}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-12 18:19:34 UTC (rev 3934)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-12 19:06:42 UTC (rev 3935)
@@ -1,5 +1,6 @@
package org.richfaces.component;
+import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
@@ -37,6 +38,7 @@
import org.ajax4jsf.component.UIDataAdaptor;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.RepeatState;
import org.apache.commons.collections.Predicate;
@@ -65,7 +67,7 @@
public static final class SubmittedValue {
private int[] permutationOrder;
private Set selectedItems = new HashSet();
- private int activeItem;
+ private Integer activeItem;
public SubmittedValue(String submittedString) {
super();
@@ -87,7 +89,7 @@
if ('s' == c) {
selectedItems.add(new Integer(permutationOrder[i]));
} else if ('a' == c) {
- activeItem = permutationOrder[i];
+ activeItem = new Integer(permutationOrder[i]);
} else {
break ;
}
@@ -104,11 +106,13 @@
for (int i = 0; i < permutationOrder.length; i++) {
result.append(permutationOrder[i]);
- if (selectedItems.contains(new Integer(i))) {
+ Integer key = new Integer(i);
+
+ if (selectedItems.contains(key)) {
result.append('s');
}
- if (activeItem == i) {
+ if (key.equals(activeItem)) {
result.append('a');
}
@@ -127,7 +131,8 @@
public static final Predicate isColumn = new Predicate() {
public boolean evaluate(Object input) {
- return (input instanceof UIColumn || input instanceof Column);
+ return (input instanceof UIColumn || input instanceof Column) &&
+ ((UIComponent) input).isRendered();
}
};
@@ -191,8 +196,39 @@
private transient SubmittedValue submittedValueHolder = null;
private transient EditableState editableState = new EditableState();
+ private void convertState(FacesContext faces) {
+ final HashSet selectionItemsSet = new HashSet();
+ final ExtendedDataModel dataModel = getExtendedDataModel();
+ try {
+ dataModel.walk(faces, new DataVisitor() {
+
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ dataModel.setRowKey(rowKey);
+
+ if (selection != null && selection.contains(rowKey)) {
+ selectionItemsSet.add(getRowData());
+ }
+
+ if (rowKey.equals(activeItem)) {
+ activeItem = getRowData();
+ }
+ }
+
+ }, null, null);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ if (this.selection != null) {
+ this.selection = selectionItemsSet;
+ }
+ }
+
public void restoreState(FacesContext faces, Object object) {
- Object[] state = (Object[]) object;
+ final Object[] state = (Object[]) object;
super.restoreState(faces, state[0]);
validators = (List) restoreAttachedState(faces, state[1]);
validator = (MethodBinding) restoreAttachedState(faces, state[2]);
@@ -200,11 +236,11 @@
value = state[3];
localValueSet = ((Boolean) state[4]).booleanValue();
- selection = (Collection) state[5];
- localSelectionSet = ((Boolean) state[6]).booleanValue();
-
- activeItem = state[7];
- localActiveItemSet = ((Boolean) state[8]).booleanValue();
+ localSelectionSet = ((Boolean) state[5]).booleanValue();
+ localActiveItemSet = ((Boolean) state[6]).booleanValue();
+
+ selection = (Collection) state[7];
+ activeItem = state[8];
}
public Object saveState(FacesContext faces) {
@@ -216,12 +252,41 @@
state[3] = value;
state[4] = localValueSet ? Boolean.TRUE : Boolean.FALSE;
- state[5] = selection;
- state[6] = localSelectionSet ? Boolean.TRUE : Boolean.FALSE;
+ state[5] = localSelectionSet ? Boolean.TRUE : Boolean.FALSE;
+ state[6] = localActiveItemSet ? Boolean.TRUE : Boolean.FALSE;
- state[7] = activeItem;
- state[8] = localActiveItemSet ? Boolean.TRUE : Boolean.FALSE;
+ final HashSet selectionKeySet = new HashSet();
+ final HashSet activeItemSet = new HashSet(1);
+
+ final ExtendedDataModel dataModel = getExtendedDataModel();
+ try {
+ dataModel.walk(faces, new DataVisitor() {
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ dataModel.setRowKey(rowKey);
+ Object data = dataModel.getRowData();
+ if (data.equals(activeItem)) {
+ activeItemSet.add(getTranslatedRowKey());
+ }
+
+ if (selection != null && selection.contains(data)) {
+ selectionKeySet.add(getTranslatedRowKey());
+ }
+
+ }
+
+ }, null, null);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ state[7] = selectionKeySet;
+
+ state[8] = activeItemSet.isEmpty() ? null : activeItemSet.iterator().next();
+
return state;
}
@@ -379,6 +444,8 @@
*/
public void processDecodes(FacesContext context) {
+ convertState(context);
+
if (context == null) {
throw new NullPointerException();
}
@@ -723,11 +790,13 @@
this.selection = selectionSet;
this.localSelectionSet = true;
- dataModel.setRowIndex(new Integer(submittedValueHolder.activeItem));
- Object activeItem = dataModel.getRowData();
+ if (submittedValueHolder.activeItem != null) {
+ dataModel.setRowKey(submittedValueHolder.activeItem);
+ Object activeItem = dataModel.getRowData();
- this.activeItem = activeItem;
- this.localActiveItemSet = true;
+ this.activeItem = activeItem;
+ this.localActiveItemSet = true;
+ }
Object previous = getValue();
setValue(newValue);
@@ -930,7 +999,10 @@
return (false);
}
-
+ public Object getTranslatedRowKey() {
+ return ((TranslatedSequenceDataModel) getExtendedDataModel()).getTranslatedRowKey();
+ }
+
private void addConversionErrorMessage(FacesContext context,
ConverterException ce, Object value) {
FacesMessage message = ce.getFacesMessage();
@@ -959,11 +1031,11 @@
}
public boolean isActiveItem() {
- return activeItem != null && activeItem.equals(getRowData());
+ return activeItem != null && activeItem.equals(getRowData()) || submittedValueHolder != null && (submittedValueHolder.activeItem != null && submittedValueHolder.activeItem.equals(getTranslatedRowKey()));
}
public boolean isSelected() {
- return selection != null && selection.contains(getRowData());
+ return selection != null && selection.contains(getRowData()) || submittedValueHolder != null && submittedValueHolder.selectedItems.contains(getTranslatedRowKey());
}
public abstract Collection getSelection();
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-12 18:19:34 UTC (rev 3934)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-12 19:06:42 UTC (rev 3935)
@@ -13,9 +13,6 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.iterators.FilterIterator;
-import org.richfaces.component.Column;
import org.richfaces.component.UIOrderingList;
import org.richfaces.renderkit.html.images.OrderingListIconBottom;
import org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled;
@@ -213,21 +210,6 @@
return true;
}
- protected Iterator columnFacets(UIOrderingList orderingList, final String name){
- return new FilterIterator(orderingList.columns(), new Predicate() {
-
- public boolean evaluate(Object input) {
- UIComponent component = (UIComponent) input;
- // accept only columns with corresponding facets.
- if (component instanceof Column || component instanceof UIColumn) {
- return component.isRendered()&&(component.getFacet(name) != null);
- }
- else{
- return false;
- }
- }});
- }
-
public void encodeCaption(FacesContext context, UIOrderingList orderingList)
throws IOException {
ResponseWriter writer = context.getResponseWriter();
@@ -252,7 +234,7 @@
throws IOException {
ResponseWriter writer = context.getResponseWriter();
//UIComponent header = orderingList.getHeader();
- Iterator headers = columnFacets(orderingList,"header");
+ Iterator headers = orderingList.columns();
if (headers.hasNext()) {
writer.startElement("thead", orderingList);
@@ -371,6 +353,8 @@
UIComponent facet = column.getFacet(facetName);
if (facet != null && facet.isRendered()) {
renderChild(context, facet);
+ } else {
+ writer.write(" ");
}
writer.endElement("div");
18 years, 5 months
JBoss Rich Faces SVN: r3934 - in trunk/sandbox/samples/orderingListDemo/src/main: webapp and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-11-12 13:19:34 -0500 (Mon, 12 Nov 2007)
New Revision: 3934
Added:
trunk/sandbox/samples/orderingListDemo/src/main/webapp/scripts/
trunk/sandbox/samples/orderingListDemo/src/main/webapp/scripts/effects.js
Modified:
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
Log:
Ordering list demo. Event handlers with effects.
Modified: trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-12 17:51:01 UTC (rev 3933)
+++ trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-12 18:19:34 UTC (rev 3934)
@@ -15,8 +15,8 @@
private String controlsVerticalAlign = "center";
private String headerLabel = "headerLabel";
- private String ontopclick;
- private String onbottomclick;
+ private String ontopclick = "new Effect.Highlight('form:ontopclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});";
+ private String onbottomclick = "new Effect.Highlight('form:onbottomclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});";
private boolean orderControlsVisible = true;
private boolean fastOrderControlsVisible = true;
Modified: trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-12 17:51:01 UTC (rev 3933)
+++ trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-12 18:19:34 UTC (rev 3934)
@@ -10,14 +10,22 @@
<style type="text/css">
.columnClass {
vertical-align: top;
+ }
+ .eventDiv {
+ background-color: green;
+ color: white;
+ width: 200px;
+ height: 50px;
+ font-weight: bold;
}
</style>
- <title></title>
+ <script type="text/javascript" src="scripts/effects.js" />
+ <title>Ordering List Demo.</title>
</head>
<body>
<f:view>
- <h:form>
+ <h:form id="form" >
<h:selectOneRadio binding="#{skinBean.component}" />
<h:commandLink action="#{skinBean.change}" value="set skin" />
<br />
@@ -34,8 +42,13 @@
controlsVerticalAlign="#{demoBean.controlsVerticalAlign}"
orderControlsVisible="#{demoBean.orderControlsVisible}"
fastOrderControlsVisible="#{demoBean.fastOrderControlsVisible}"
-
- >
+
+ ontopclick="#{demoBean.ontopclick}"
+ onbottomclick="#{demoBean.onbottomclick}"
+ onorderchanged="new Effect.Highlight('form:onorderchangedDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
+ ondownclick="new Effect.Highlight('form:ondownclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
+ onheaderclick="new Effect.Highlight('form:onheaderclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
+ onupclick="new Effect.Highlight('form:onupclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});" >
<h:column>
<f:facet name="header">
@@ -68,6 +81,27 @@
</ol:orderingList>
<h:panelGrid columns="2">
+ <h:panelGroup layout="block" styleClass="eventDiv" id="ontopclickDiv" >
+ <h:outputText value="ontopclick" />
+ </h:panelGroup>
+ <h:panelGroup layout="block" styleClass="eventDiv" id="onbottomclickDiv" >
+ <h:outputText value="onbottomclick" />
+ </h:panelGroup>
+ <h:panelGroup layout="block" styleClass="eventDiv" id="onorderchangedDiv" >
+ <h:outputText value="onorderchanged" />
+ </h:panelGroup>
+ <h:panelGroup layout="block" styleClass="eventDiv" id="ondownclickDiv" >
+ <h:outputText value="ondownclick" />
+ </h:panelGroup>
+ <h:panelGroup layout="block" styleClass="eventDiv" id="onupclickDiv">
+ <h:outputText value="onupclick" />
+ </h:panelGroup>
+ <h:panelGroup layout="block" styleClass="eventDiv" id="onheaderclickDiv" >
+ <h:outputText value="onheaderclick" />
+ </h:panelGroup>
+ </h:panelGrid>
+
+ <h:panelGrid columns="2">
<h:outputText value="Item Clicked: " />
<h:outputText value="#{demoBean.actionResult}" id="actionResult" />
Added: trunk/sandbox/samples/orderingListDemo/src/main/webapp/scripts/effects.js
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/webapp/scripts/effects.js (rev 0)
+++ trunk/sandbox/samples/orderingListDemo/src/main/webapp/scripts/effects.js 2007-11-12 18:19:34 UTC (rev 3934)
@@ -0,0 +1,263 @@
+var Effect = {
+ tagifyText: function(element) {
+ var tagifyStyle = 'position:relative';
+ if (/MSIE/.test(navigator.userAgent)) tagifyStyle += ';zoom:1';
+ element = $(element);
+ $A(element.childNodes).each(function(child) {
+ if (child.nodeType == 3) {
+ child.nodeValue.toArray().each(function(character) {
+ element.insertBefore(
+ Builder.node('span', {style: tagifyStyle},
+ character == ' ' ? String.fromCharCode(160) : character),
+ child);
+ });
+ Element.remove(child);
+ }
+ });
+ },
+ multiple: function(element, effect) {
+ var elements;
+ if (((typeof element == 'object') ||
+ (typeof element == 'function')) &&
+ (element.length))
+ elements = element;
+ else
+ elements = $(element).childNodes;
+
+ var options = Object.extend({
+ speed: 0.1,
+ delay: 0.0
+ }, arguments[2] || {});
+ var masterDelay = options.delay;
+
+ $A(elements).each(function(element, index) {
+ new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
+ });
+ },
+ PAIRS: {
+ 'slide': ['SlideDown','SlideUp'],
+ 'blind': ['BlindDown','BlindUp'],
+ 'appear': ['Appear','Fade']
+ },
+ toggle: function(element, effect) {
+ element = $(element);
+ effect = (effect || 'appear').toLowerCase();
+ var options = Object.extend({
+ queue: { position:'end', scope:(element.id || 'global') }
+ }, arguments[2] || {});
+ Effect[Element.visible(element) ?
+ Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
+ }
+};
+
+Effect.Transitions = {}
+
+Effect.Transitions.linear = function(pos) {
+ return pos;
+}
+Effect.Transitions.sinoidal = function(pos) {
+ return (-Math.cos(pos * Math.PI) / 2) + 0.5;
+}
+Effect.Transitions.reverse = function(pos) {
+ return 1 - pos;
+}
+Effect.Transitions.flicker = function(pos) {
+ return ((-Math.cos(pos * Math.PI) / 4) + 0.75) + Math.random() / 4;
+}
+Effect.Transitions.wobble = function(pos) {
+ return (-Math.cos(pos * Math.PI * (9 * pos)) / 2) + 0.5;
+}
+Effect.Transitions.pulse = function(pos) {
+ return (Math.floor(pos * 10) % 2 == 0 ?
+ (pos * 10 - Math.floor(pos * 10)) : 1 - (pos * 10 - Math.floor(pos * 10)));
+}
+Effect.Transitions.none = function(pos) {
+ return 0;
+}
+Effect.Transitions.full = function(pos) {
+ return 1;
+}
+
+/* ------------- core effects ------------- */
+
+Effect.ScopedQueue = Class.create();
+Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
+ initialize: function() {
+ this.effects = [];
+ this.interval = null;
+ },
+ _each: function(iterator) {
+ this.effects._each(iterator);
+ },
+ add: function(effect) {
+ var timestamp = new Date().getTime();
+
+ var position = (typeof effect.options.queue == 'string') ?
+ effect.options.queue : effect.options.queue.position;
+
+ switch (position) {
+ case 'front':
+ // move unstarted effects after this effect
+ this.effects.findAll(function(e) {
+ return e.state == 'idle'
+ }).each(function(e) {
+ e.startOn += effect.finishOn;
+ e.finishOn += effect.finishOn;
+ });
+ break;
+ case 'end':
+ // start effect after last queued effect has finished
+ timestamp = this.effects.pluck('finishOn').max() || timestamp;
+ break;
+ }
+
+ effect.startOn += timestamp;
+ effect.finishOn += timestamp;
+ this.effects.push(effect);
+ if (!this.interval)
+ this.interval = setInterval(this.loop.bind(this), 40);
+ },
+ remove: function(effect) {
+ this.effects = this.effects.reject(function(e) {
+ return e == effect
+ });
+ if (this.effects.length == 0) {
+ clearInterval(this.interval);
+ this.interval = null;
+ }
+ },
+ loop: function() {
+ var timePos = new Date().getTime();
+ this.effects.invoke('loop', timePos);
+ }
+});
+
+Effect.Queues = {
+ instances: $H(),
+ get: function(queueName) {
+ if (typeof queueName != 'string') return queueName;
+
+ if (!this.instances[queueName])
+ this.instances[queueName] = new Effect.ScopedQueue();
+
+ return this.instances[queueName];
+ }
+}
+Effect.Queue = Effect.Queues.get('global');
+
+Effect.DefaultOptions = {
+ transition: Effect.Transitions.sinoidal,
+ duration: 1.0, // seconds
+ fps: 25.0, // max. 25fps due to Effect.Queue implementation
+ sync: false, // true for combining
+ from: 0.0,
+ to: 1.0,
+ delay: 0.0,
+ queue: 'parallel'
+}
+
+Effect.Base = function() {
+};
+Effect.Base.prototype = {
+ position: null,
+ start: function(options) {
+ this.options = Object.extend(Object.extend({}, Effect.DefaultOptions), options || {});
+ this.currentFrame = 0;
+ this.state = 'idle';
+ this.startOn = this.options.delay * 1000;
+ this.finishOn = this.startOn + (this.options.duration * 1000);
+ this.event('beforeStart');
+ if (!this.options.sync)
+ Effect.Queues.get(typeof this.options.queue == 'string' ?
+ 'global' : this.options.queue.scope).add(this);
+ },
+ loop: function(timePos) {
+ if (timePos >= this.startOn) {
+ if (timePos >= this.finishOn) {
+ this.render(1.0);
+ this.cancel();
+ this.event('beforeFinish');
+ if (this.finish) this.finish();
+ this.event('afterFinish');
+ return;
+ }
+ var pos = (timePos - this.startOn) / (this.finishOn - this.startOn);
+ var frame = Math.round(pos * this.options.fps * this.options.duration);
+ if (frame > this.currentFrame) {
+ this.render(pos);
+ this.currentFrame = frame;
+ }
+ }
+ },
+ render: function(pos) {
+ if (this.state == 'idle') {
+ this.state = 'running';
+ this.event('beforeSetup');
+ if (this.setup) this.setup();
+ this.event('afterSetup');
+ }
+ if (this.state == 'running') {
+ if (this.options.transition) pos = this.options.transition(pos);
+ pos *= (this.options.to - this.options.from);
+ pos += this.options.from;
+ this.position = pos;
+ this.event('beforeUpdate');
+ if (this.update) this.update(pos);
+ this.event('afterUpdate');
+ }
+ },
+ cancel: function() {
+ if (!this.options.sync)
+ Effect.Queues.get(typeof this.options.queue == 'string' ?
+ 'global' : this.options.queue.scope).remove(this);
+ this.state = 'finished';
+ },
+ event: function(eventName) {
+ if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
+ if (this.options[eventName]) this.options[eventName](this);
+ },
+ inspect: function() {
+ return '#<Effect:' + $H(this).inspect() + ',options:' + $H(this.options).inspect() + '>';
+ }
+}
+
+Effect.Highlight = Class.create();
+Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
+ initialize: function(element) {
+ this.element = $(element);
+ var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
+ this.start(options);
+ },
+ setup: function() {
+ // Prevent executing on elements not in the layout flow
+ if (Element.getStyle(this.element, 'display') == 'none') {
+ this.cancel();
+ return;
+ }
+ // Disable background image during the effect
+ this.oldStyle = {
+ backgroundImage: Element.getStyle(this.element, 'background-image') };
+ Element.setStyle(this.element, {backgroundImage: 'none'});
+ if (!this.options.endcolor)
+ this.options.endcolor = Element.getStyle(this.element, 'background-color').parseColor('#ffffff');
+ if (!this.options.restorecolor)
+ this.options.restorecolor = Element.getStyle(this.element, 'background-color');
+ // init color calculations
+ this._base = $R(0, 2).map(function(i) {
+ return parseInt(this.options.startcolor.slice(i * 2 + 1, i * 2 + 3), 16)
+ }.bind(this));
+ this._delta = $R(0, 2).map(function(i) {
+ return parseInt(this.options.endcolor.slice(i * 2 + 1, i * 2 + 3), 16) - this._base[i]
+ }.bind(this));
+ },
+ update: function(position) {
+ Element.setStyle(this.element, {backgroundColor: $R(0, 2).inject('#', function(m, v, i) {
+ return m + (Math.round(this._base[i] + (this._delta[i] * position)).toColorPart());
+ }.bind(this)) });
+ },
+ finish: function() {
+ Element.setStyle(this.element, Object.extend(this.oldStyle, {
+ backgroundColor: this.options.restorecolor
+ }));
+ }
+});
\ No newline at end of file
18 years, 5 months
JBoss Rich Faces SVN: r3933 - trunk/sandbox/samples/contextMenuDemo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-11-12 12:51:01 -0500 (Mon, 12 Nov 2007)
New Revision: 3933
Modified:
trunk/sandbox/samples/contextMenuDemo/src/main/webapp/pages/index.jsp
Log:
RF-1305
Modified: trunk/sandbox/samples/contextMenuDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/contextMenuDemo/src/main/webapp/pages/index.jsp 2007-11-12 17:35:38 UTC (rev 3932)
+++ trunk/sandbox/samples/contextMenuDemo/src/main/webapp/pages/index.jsp 2007-11-12 17:51:01 UTC (rev 3933)
@@ -1,6 +1,7 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/dataTable" prefix="dt"%>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/ui/contextMenu" prefix="cm"%>
<html>
<head>
<title>
@@ -19,6 +20,7 @@
<body>
<f:view>
<h:form>
+ <cm:contextMenu></cm:contextMenu>
<dt:dataTable id="table" value="#{bean.model}" var="row" style="width:300px"
first="0" rows="40" width="100%">
<dt:column headerClass="header" footerClass="footer">
18 years, 5 months
JBoss Rich Faces SVN: r3932 - trunk/sandbox/ui/contextMenu/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-11-12 12:35:38 -0500 (Mon, 12 Nov 2007)
New Revision: 3932
Added:
trunk/sandbox/ui/contextMenu/src/main/config/component/contextMenu.xml
Log:
RF-1300
Added: trunk/sandbox/ui/contextMenu/src/main/config/component/contextMenu.xml
===================================================================
--- trunk/sandbox/ui/contextMenu/src/main/config/component/contextMenu.xml (rev 0)
+++ trunk/sandbox/ui/contextMenu/src/main/config/component/contextMenu.xml 2007-11-12 17:35:38 UTC (rev 3932)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
+<components>
+ <component>
+ <name>org.richfaces.ContextMenu</name>
+ <family>org.richfaces.ContextMenu</family>
+ <classname>org.richfaces.component.html.ContextMenu</classname>
+ <superclass>org.richfaces.component.UIContextMenu</superclass>
+ <description>
+ <![CDATA[ ]]>
+ </description>
+
+ <renderer>
+ <name>org.richfaces.DropDownMenuRenderer</name>
+ <classname>org.richfaces.renderkit.html.ContextMenuRendererDelegate</classname>
+ </renderer>
+ <tag>
+ <name>contextMenu</name>
+ <classname>org.richfaces.taglib.ContextMenuTag</classname>
+ <superclass>
+ org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
+ </superclass>
+ <test/>
+ </tag>
+ &ui_component_attributes;
+ </component>
+</components>
18 years, 5 months
JBoss Rich Faces SVN: r3931 - in trunk/sandbox/ui/orderingList/src/main: resources/org/richfaces/renderkit/html/css and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2007-11-12 12:01:39 -0500 (Mon, 12 Nov 2007)
New Revision: 3931
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/Control.js
trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
Log:
support of disabled facets
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-12 16:41:20 UTC (rev 3930)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-12 17:01:39 UTC (rev 3931)
@@ -18,9 +18,13 @@
import org.richfaces.component.Column;
import org.richfaces.component.UIOrderingList;
import org.richfaces.renderkit.html.images.OrderingListIconBottom;
+import org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled;
import org.richfaces.renderkit.html.images.OrderingListIconDown;
+import org.richfaces.renderkit.html.images.OrderingListIconDownDisabled;
import org.richfaces.renderkit.html.images.OrderingListIconTop;
+import org.richfaces.renderkit.html.images.OrderingListIconTopDisabled;
import org.richfaces.renderkit.html.images.OrderingListIconUp;
+import org.richfaces.renderkit.html.images.OrderingListIconUpDisabled;
public abstract class OrderingListRendererBase extends AbstractRowsRenderer {
@@ -38,6 +42,14 @@
private final static String FACET_DOWN = "downControl";
+ private final static String FACET_DIS_TOP = "topControlDisabled";
+
+ private final static String FACET_DIS_BOTTOM = "bottomControlDisabled";
+
+ private final static String FACET_DIS_UP = "upControlDisabled";
+
+ private final static String FACET_DIS_DOWN = "downControlDisabled";
+
private final static String FACET_CAPTION = "caption";
private final static String CONTROL_TYPE_LINK = "link";
@@ -62,6 +74,8 @@
private final static String ATTRIBUTE_CAPTION_LABEL = "captionLabel";
+ private final static String DIS_CONTROL_ID_PREFIX = "dis";
+
private final static String CONTROL_ID_UP = "up";
private final static String CONTROL_ID_DOWN = "down";
@@ -133,6 +147,14 @@
}
},
+ new ControlsHelper("disabledTop", "↟", OrderingListIconTopDisabled.class.getName(), FACET_DIS_TOP,
+ "rich-ordering-control-disabled", DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null) {
+
+ public boolean isRendered(FacesContext context, UIOrderingList list) {
+ return list.isFastOrderControlsVisible();
+ }
+
+ },
new ControlsHelper("up", "↑", OrderingListIconUp.class.getName(), FACET_UP,
"rich-ordering-control-up", CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK) {
@@ -141,6 +163,14 @@
}
},
+ new ControlsHelper("disabledUp", "↑", OrderingListIconUpDisabled.class.getName(), FACET_DIS_UP,
+ "rich-ordering-control-disabled", DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null) {
+
+ public boolean isRendered(FacesContext context, UIOrderingList list) {
+ return list.isOrderControlsVisible();
+ }
+
+ },
new ControlsHelper("down", "↓", OrderingListIconDown.class.getName(), FACET_DOWN,
"rich-ordering-control-down", CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK) {
@@ -149,6 +179,14 @@
}
},
+ new ControlsHelper("disabledDown", "↓", OrderingListIconDownDisabled.class.getName(), FACET_DIS_DOWN,
+ "rich-ordering-control-disabled", DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null) {
+
+ public boolean isRendered(FacesContext context, UIOrderingList list) {
+ return list.isFastOrderControlsVisible();
+ }
+
+ },
new ControlsHelper("botton", "↡", OrderingListIconBottom.class.getName(), FACET_BOTTOM,
"rich-ordering-control-bottom", CONTROL_ID_BOTTOM, ATTRIBUTE_CE_ONBOTTOMCLICK) {
@@ -156,6 +194,14 @@
return list.isOrderControlsVisible();
}
+ },
+ new ControlsHelper("disabledBotton", "↡", OrderingListIconBottomDisabled.class.getName(), FACET_DIS_BOTTOM,
+ "rich-ordering-control-disabled", DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null) {
+
+ public boolean isRendered(FacesContext context, UIOrderingList list) {
+ return list.isOrderControlsVisible();
+ }
+
}
};
@@ -243,7 +289,10 @@
Map attributes = orderingList.getAttributes();
String controlType = (String) attributes.get(ATTRIBUTE_CONTROLS_TYPE);
- String customEvent = (String) attributes.get(helper.customEvent);
+ String customEvent = null;
+ if (helper.customEvent != null) {
+ customEvent = (String) attributes.get(helper.customEvent);
+ }
String htmlElem = null;
if (CONTROL_TYPE_BUTTON.equals(controlType)) {
Modified: trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-12 16:41:20 UTC (rev 3930)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-12 17:01:39 UTC (rev 3931)
@@ -121,10 +121,12 @@
}
.ol_control_shown {
- visibility: visible;
+ /*visibility: visible;*/
+ display: block;
}
.ol_control_hidden {
- visibility: hidden;
+ /*visibility: hidden;*/
+ display: none;
}
.body {
Modified: trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/Control.js
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/Control.js 2007-11-12 16:41:20 UTC (rev 3930)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/Control.js 2007-11-12 17:01:39 UTC (rev 3931)
@@ -45,11 +45,11 @@
}
Control.prototype.doHideNode = function(node) {
- node.className = Control.CLASSES[this.action].hidden;
+ node.parentNode.className = Control.CLASSES[this.action].hidden;
}
Control.prototype.doShowNode = function(node) {
- node.className = Control.CLASSES[this.action].shown;
+ node.parentNode.className = Control.CLASSES[this.action].shown;
}
Modified: trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2007-11-12 16:41:20 UTC (rev 3930)
+++ trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2007-11-12 17:01:39 UTC (rev 3931)
@@ -54,10 +54,6 @@
<td class="ol_button_layout">
<f:call name="encodeControlsFacets"/>
<f:clientId var="clientId"/>
- <a id="#{clientId}disFirst" href="#">disabledTop</a><br/>
- <a id="#{clientId}disUp" href="#">disUp</a><br/>
- <a id="#{clientId}disDown" href="#">disDown</a><br/>
- <a id="#{clientId}disLast" href="#">disBottom</a>
</td>
</tr>
</tbody>
@@ -76,7 +72,7 @@
document.body.onselectstart = function() {return false;};
document.body.className = "body";
function init() {
- var cotrolsIdPrefix = [['up', 'disUp'], ['down', 'disDown'], ['last', 'disLast'], ['first','disFirst']];
+ var cotrolsIdPrefix = [['up', 'disup'], ['down', 'disdown'], ['last', 'dislast'], ['first','disfirst']];
var shuttle = new Shuttle('#{cId}', '#{cId}internal_tab', '#{cId}internal_header_tab', '#{cId}focusKeeper', '#{cId}valueKeeper', cotrolsIdPrefix, '#{cId}sortLabel');
var layoutManager = new LayoutManager('#{clientId}internal_header_tab', '#{clientId}internal_tab');
layoutManager.widthSynchronization();
18 years, 5 months
JBoss Rich Faces SVN: r3930 - trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-11-12 11:41:20 -0500 (Mon, 12 Nov 2007)
New Revision: 3930
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
Log:
Disabled icon images added to ordering list.
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java 2007-11-12 16:21:38 UTC (rev 3929)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java 2007-11-12 16:41:20 UTC (rev 3930)
@@ -88,7 +88,10 @@
/**
* @param data - pass icon color and background color
*/
- protected abstract Object getDataToStore(FacesContext context, Object data);
+ @Override
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, "headerTextColor", "headerBackgroundColor");
+ }
protected Object storeData(FacesContext context, String colorSkinParam, String backgroundSkinParam) {
Skin skin = SkinFactory.getInstance().getSkin(context);
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2007-11-12 16:21:38 UTC (rev 3929)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2007-11-12 16:41:20 UTC (rev 3930)
@@ -65,9 +65,4 @@
g2d.fill(path);
}
- @Override
- protected Object getDataToStore(FacesContext context, Object data) {
- return storeData(context, "headerTextColor", "headerBackgroundColor");
- }
-
}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2007-11-12 16:21:38 UTC (rev 3929)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2007-11-12 16:41:20 UTC (rev 3930)
@@ -55,10 +55,5 @@
g2d.setColor(textColor);
g2d.fill(path);
}
-
- @Override
- protected Object getDataToStore(FacesContext context, Object data) {
- return storeData(context, "headerTextColor", "headerBackgroundColor");
- }
}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java 2007-11-12 16:21:38 UTC (rev 3929)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java 2007-11-12 16:41:20 UTC (rev 3930)
@@ -65,9 +65,4 @@
g2d.fill(path);
}
- @Override
- protected Object getDataToStore(FacesContext context, Object data) {
- return storeData(context, "headerTextColor", "headerBackgroundColor");
- }
-
}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2007-11-12 16:21:38 UTC (rev 3929)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2007-11-12 16:41:20 UTC (rev 3930)
@@ -54,10 +54,5 @@
g2d.setColor(textColor);
g2d.fill(path);
}
-
- @Override
- protected Object getDataToStore(FacesContext context, Object data) {
- return storeData(context, "headerTextColor", "headerBackgroundColor");
- }
}
18 years, 5 months
JBoss Rich Faces SVN: r3929 - trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-11-12 11:21:38 -0500 (Mon, 12 Nov 2007)
New Revision: 3929
Added:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
Log:
Disabled icon images added to ordering list.
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java 2007-11-12 16:19:46 UTC (rev 3928)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java 2007-11-12 16:21:38 UTC (rev 3929)
@@ -88,7 +88,9 @@
/**
* @param data - pass icon color and background color
*/
- protected Object getDataToStore(FacesContext context, Object data) {
+ protected abstract Object getDataToStore(FacesContext context, Object data);
+
+ protected Object storeData(FacesContext context, String colorSkinParam, String backgroundSkinParam) {
Skin skin = SkinFactory.getInstance().getSkin(context);
Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
@@ -96,10 +98,9 @@
Color color = null;
- String skinParameter = "headerTextColor";
- String color1 = (String) skin.getParameter(context, skinParameter);
+ String color1 = (String) skin.getParameter(context, colorSkinParam);
if (null == color1 || "".equals(color1))
- color1 = (String) defaultSkin.getParameter(context, skinParameter);
+ color1 = (String) defaultSkin.getParameter(context, colorSkinParam);
if (color1 == null) {
color1 = "#FFFFFF";
@@ -109,10 +110,9 @@
ret[0] = color.getRGB();
- skinParameter = "headerBackgroundColor";
- String color2 = (String) skin.getParameter(context, skinParameter);
+ String color2 = (String) skin.getParameter(context, backgroundSkinParam);
if (null == color2 || "".equals(color2))
- color2 = (String) defaultSkin.getParameter(context, skinParameter);
+ color2 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
if (color2 == null) {
color2 = "#000000";
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2007-11-12 16:19:46 UTC (rev 3928)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2007-11-12 16:21:38 UTC (rev 3929)
@@ -26,6 +26,8 @@
import java.awt.Graphics2D;
import java.awt.geom.GeneralPath;
+import javax.faces.context.FacesContext;
+
import org.ajax4jsf.resource.ResourceContext;
/**
@@ -63,4 +65,9 @@
g2d.fill(path);
}
+ @Override
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, "headerTextColor", "headerBackgroundColor");
+ }
+
}
Added: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java (rev 0)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java 2007-11-12 16:21:38 UTC (rev 3929)
@@ -0,0 +1,35 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.images;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconBottomDisabled extends OrderingListIconBottom {
+ @Override
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, "tabDisabledTextColor", "tabBackgroundColor");
+ }
+}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2007-11-12 16:19:46 UTC (rev 3928)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2007-11-12 16:21:38 UTC (rev 3929)
@@ -27,6 +27,8 @@
import java.awt.RenderingHints;
import java.awt.geom.GeneralPath;
+import javax.faces.context.FacesContext;
+
import org.ajax4jsf.resource.ResourceContext;
/**
@@ -53,5 +55,10 @@
g2d.setColor(textColor);
g2d.fill(path);
}
+
+ @Override
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, "headerTextColor", "headerBackgroundColor");
+ }
}
Added: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java (rev 0)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java 2007-11-12 16:21:38 UTC (rev 3929)
@@ -0,0 +1,35 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.images;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconDownDisabled extends OrderingListIconDown {
+ @Override
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, "tabDisabledTextColor", "tabBackgroundColor");
+ }
+}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java 2007-11-12 16:19:46 UTC (rev 3928)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java 2007-11-12 16:21:38 UTC (rev 3929)
@@ -26,6 +26,8 @@
import java.awt.Graphics2D;
import java.awt.geom.GeneralPath;
+import javax.faces.context.FacesContext;
+
import org.ajax4jsf.resource.ResourceContext;
/**
@@ -62,5 +64,10 @@
path.closePath();
g2d.fill(path);
}
+
+ @Override
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, "headerTextColor", "headerBackgroundColor");
+ }
}
Added: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java (rev 0)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java 2007-11-12 16:21:38 UTC (rev 3929)
@@ -0,0 +1,35 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.images;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconTopDisabled extends OrderingListIconTop {
+ @Override
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, "tabDisabledTextColor", "tabBackgroundColor");
+ }
+}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2007-11-12 16:19:46 UTC (rev 3928)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2007-11-12 16:21:38 UTC (rev 3929)
@@ -26,6 +26,8 @@
import java.awt.Graphics2D;
import java.awt.geom.GeneralPath;
+import javax.faces.context.FacesContext;
+
import org.ajax4jsf.resource.ResourceContext;
/**
@@ -52,5 +54,10 @@
g2d.setColor(textColor);
g2d.fill(path);
}
+
+ @Override
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, "headerTextColor", "headerBackgroundColor");
+ }
}
Added: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java (rev 0)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java 2007-11-12 16:21:38 UTC (rev 3929)
@@ -0,0 +1,35 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.images;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconUpDisabled extends OrderingListIconUp {
+ @Override
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, "tabDisabledTextColor", "tabBackgroundColor");
+ }
+}
18 years, 5 months
JBoss Rich Faces SVN: r3927 - in branches/3.1.x: ui/jQuery/src/main/java/org/richfaces/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-12 11:15:28 -0500 (Mon, 12 Nov 2007)
New Revision: 3927
Modified:
branches/3.1.x/samples/jQuery-sample/src/main/webapp/jQuery.xhtml
branches/3.1.x/ui/jQuery/src/main/java/org/richfaces/renderkit/JQueryRendererBase.java
branches/3.1.x/ui/jQuery/src/main/templates/jQuery.jspx
Log:
Fix for http://jira.jboss.com/jira/browse/RF-1261 merged
Modified: branches/3.1.x/samples/jQuery-sample/src/main/webapp/jQuery.xhtml
===================================================================
--- branches/3.1.x/samples/jQuery-sample/src/main/webapp/jQuery.xhtml 2007-11-12 16:10:43 UTC (rev 3926)
+++ branches/3.1.x/samples/jQuery-sample/src/main/webapp/jQuery.xhtml 2007-11-12 16:15:28 UTC (rev 3927)
@@ -19,11 +19,12 @@
<h:graphicImage value="http://www.archos.com/img/av_700/picto_game.gif" />
</h:panelGrid>
-
+
<rich:jQuery name="makeFat" timing="onJScall" query="stop().animate({width:param.ewidth})" />
<rich:jQuery name="makeThin" timing="onJScall" query="stop().animate({width:'50px'})" />
<rich:jQuery selector="#menu img" timing="onload" query="mouseover(function(){makeFat(this,{ewidth:'120px'});})" />
<rich:jQuery selector="#menu img" timing="onload" query="mouseout(function(){makeThin(this);})" />
+ <rich:jQuery selector="document.body" timing="onload" query="append('Dynamic text')" />
</h:form>
</body>
Modified: branches/3.1.x/ui/jQuery/src/main/java/org/richfaces/renderkit/JQueryRendererBase.java
===================================================================
--- branches/3.1.x/ui/jQuery/src/main/java/org/richfaces/renderkit/JQueryRendererBase.java 2007-11-12 16:10:43 UTC (rev 3926)
+++ branches/3.1.x/ui/jQuery/src/main/java/org/richfaces/renderkit/JQueryRendererBase.java 2007-11-12 16:15:28 UTC (rev 3927)
@@ -1,13 +1,10 @@
package org.richfaces.renderkit;
-import java.io.IOException;
-import java.util.regex.Pattern;
-
+import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.FacesException;
-import org.richfaces.renderkit.JQueryRendererBase;
-import org.ajax4jsf.renderkit.ComponentVariables;
+
+import org.ajax4jsf.javascript.JSEncoder;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.richfaces.component.UIJQuery;
import org.richfaces.component.util.HtmlUtil;
@@ -52,5 +49,20 @@
return HtmlUtil.expandIdSelector(selector, component, context);
}
-
+ public String escapeJavaScript(Object o) {
+ if (o != null) {
+ JSEncoder encoder = new JSEncoder();
+ StringBuffer result = new StringBuffer();
+ String string = o.toString();
+ int length = string.length();
+
+ for (int i = 0; i < length; i++) {
+ result.append(encoder.encode(string.charAt(i)));
+ }
+
+ return result.toString();
+ } else {
+ return null;
+ }
+ }
}
Modified: branches/3.1.x/ui/jQuery/src/main/templates/jQuery.jspx
===================================================================
--- branches/3.1.x/ui/jQuery/src/main/templates/jQuery.jspx 2007-11-12 16:10:43 UTC (rev 3926)
+++ branches/3.1.x/ui/jQuery/src/main/templates/jQuery.jspx 2007-11-12 16:15:28 UTC (rev 3927)
@@ -34,7 +34,12 @@
<script type="text/javascript">
//<![CDATA[
function #{name}(elm, param) {
- jQuery(elm || '#{selector}').#{query};
+ var selector = '#{selector}';
+ try {
+ selector = eval("#{this:escapeJavaScript(selector)}");
+ } catch (e) {}
+
+ jQuery(elm || selector).#{query};
}
//]]>
</script>
@@ -43,7 +48,13 @@
<jsp:scriptlet><![CDATA[ if ( "immediate".equals(timing) ) { ]]></jsp:scriptlet>
<script type="text/javascript">
//<![CDATA[
- jQuery('#{selector}').#{query};
+ {
+ var selector = '#{selector}';
+ try {
+ selector = eval("#{this:escapeJavaScript(selector)}");
+ } catch (e) {}
+ jQuery(selector).#{query};
+}
//]]>
</script>
<jsp:scriptlet><![CDATA[ } ]]></jsp:scriptlet>
@@ -52,7 +63,11 @@
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function() {
- jQuery('#{selector}').#{query};
+ var selector = '#{selector}';
+ try {
+ selector = eval("#{this:escapeJavaScript(selector)}");
+ } catch (e) {}
+ jQuery(selector).#{query};
});
//]]>
</script>
18 years, 5 months