JBoss Rich Faces SVN: r6217 - in trunk/ui/dataTable/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-02-20 11:48:46 -0500 (Wed, 20 Feb 2008)
New Revision: 6217
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
Log:
RF-1741
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-02-20 16:44:12 UTC (rev 6216)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-02-20 16:48:46 UTC (rev 6217)
@@ -82,7 +82,7 @@
return sortField2;
}
- public void toggleSortOrder(ELContext elContext){
+ public void toggleSortOrder(){
if(Ordering.ASCENDING.equals(getSortOrder())) {
setSortOrder(Ordering.DESCENDING);
} else {
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-20 16:44:12 UTC (rev 6216)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-20 16:48:46 UTC (rev 6217)
@@ -498,7 +498,6 @@
protected void doDecode(FacesContext context, UIComponent component) {
Map<String, String> map = context.getExternalContext().getRequestParameterMap();
if (SORT_FILTER_PARAMETER.equals(map.get(component.getClientId(context)))) {
- ELContext elContext = context.getELContext();
String clientId = map.get(SORT_FILTER_PARAMETER);
List<UIComponent> list = component.getChildren();
UIDataTable table = (UIDataTable) component;
@@ -519,7 +518,7 @@
if(!sortPriority.contains(id)) {
sortPriority.add(id);
}
- column.toggleSortOrder(elContext);
+ column.toggleSortOrder();
} else if(isSingleSortMode){
column.setSortOrder(Ordering.UNSORTED);
}
18 years, 2 months
JBoss Rich Faces SVN: r6216 - in trunk/sandbox/ui/fileUpload/src/main: java/org/richfaces/org/jboss/seam/web and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-02-20 11:44:12 -0500 (Wed, 20 Feb 2008)
New Revision: 6216
Modified:
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartRequest.java
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
Log:
label attribute customization
Modified: trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java 2008-02-20 16:26:10 UTC (rev 6215)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java 2008-02-20 16:44:12 UTC (rev 6216)
@@ -7,19 +7,25 @@
import java.util.Map;
import javax.el.ValueExpression;
+import javax.faces.FactoryFinder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import javax.faces.render.RenderKit;
+import javax.faces.render.RenderKitFactory;
import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpSession;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.context.AjaxContextImpl;
import org.ajax4jsf.event.AjaxEvent;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSLiteral;
import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils;
+import org.ajax4jsf.resource.CountingOutputWriter;
import org.richfaces.component.UIProgressBar;
import org.richfaces.event.UploadEvent;
import org.richfaces.org.jboss.seam.ui.component.UIFileUpload;
@@ -63,14 +69,23 @@
Map<String, String[]> params = context.getExternalContext()
.getRequestParameterValuesMap();
- if (params.containsKey("percent")) {
+ if ("progress".equals(request.getParameter("action"))) {
AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance(context);
- ajaxContext.setResponseData("safasfas");
+ String uid = request.getParameter("uid");
+ HttpSession session = (HttpSession)context.getExternalContext().getSession(false);
+ Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) session
+ .getAttribute("_richfaces_upload_sessions");
+
+ if (sessions != null) {
+ MultipartRequest multipartRequest = sessions.get(uid);
+ if (multipartRequest != null) {
+ ajaxContext.setResponseData(multipartRequest.getSize());
+ }
+ }
+
+ }else {
+ new AjaxEvent(component).queue();
}
-//
-// AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance(context);
-
- new AjaxEvent(component).queue();
if (!(request instanceof MultipartRequest)) {
request = unwrapMultipartRequest(request);
}
@@ -123,15 +138,17 @@
// TODO Auto-generated method stub
return null;
}
-
- public String getStopScript(FacesContext context, UIComponent component)
- throws IOException {
-
+
+ private String getActionScript(FacesContext context, UIComponent component,
+ String action, Object oncomplete) throws IOException {
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(
component, context);
Map options = AjaxRendererUtils.buildEventOptions(context, component);
- ((Map) options.get("parameters")).put("action", "stop");
+ ((Map) options.get("parameters")).put("action", action);
((Map) options.get("parameters")).put("uid", new JSReference("uid"));
+ if (oncomplete != null) {
+ options.put("onbeforedomupdate", oncomplete);
+ }
ajaxFunction.addParameter(options);
JSFunctionDefinition function = new JSFunctionDefinition("uid");
@@ -141,6 +158,63 @@
return function.toScript();
}
+ public String getStopScript(FacesContext context, UIComponent component)
+ throws IOException {
+ return getActionScript(context, component, "stop", null);
+ }
+
+ // TODO : complete this one
+ public String getFileSizeScript(FacesContext context, UIComponent component)
+ throws IOException {
+ JSFunctionDefinition oncomplete = new JSFunctionDefinition();
+ oncomplete.addParameter("request");
+ oncomplete.addParameter("event");
+ oncomplete.addParameter("data");
+ StringBuffer body = new StringBuffer("$('");
+ body.append(component.getClientId(context));
+ body.append("').component.getFileSize(data);");
+ oncomplete.addToBody(body);
+ return getActionScript(context, component, "progress", oncomplete);
+
+ }
+
+ public Object getLabelMarkup(FacesContext context, UIComponent component)
+ throws IOException {
+ CountingOutputWriter customWriter = new CountingOutputWriter();
+ StringBuffer result = null;
+ UIComponent label = component.getFacet("label");
+ try {
+ if (label != null) {
+
+ ResponseWriter writer = context.getResponseWriter();
+
+ String defaultRenderKitId = context.getApplication()
+ .getDefaultRenderKitId();
+ if (null == defaultRenderKitId) {
+ defaultRenderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
+ }
+ RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder
+ .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ RenderKit renderKit = renderKitFactory.getRenderKit(context,
+ defaultRenderKitId);
+
+ ResponseWriter responseWriter = renderKit.createResponseWriter(
+ customWriter, null, "UTF-8");
+ context.setResponseWriter(responseWriter);
+ //renderChild(context, label);
+ writeScriptBody(context, label, false);
+ if (writer != null) {
+ context.setResponseWriter(writer);
+ }
+ result = customWriter.getContent();
+ }
+
+ } catch (Exception e) {
+ e.getMessage();
+ }
+ return (result != null) ? new JSLiteral(result.toString()) : null;
+ }
+
/**
* Finds an instance of MultipartRequest wrapped within a request or its
* (recursively) wrapped requests.
Modified: trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartRequest.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartRequest.java 2008-02-20 16:26:10 UTC (rev 6215)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartRequest.java 2008-02-20 16:44:12 UTC (rev 6216)
@@ -244,7 +244,7 @@
private long time;
- private ProgressData progressData = null;
+ //private ProgressData progressData = null;
private boolean shouldStop = false;
public MultipartRequest(HttpServletRequest request,
@@ -255,7 +255,7 @@
String contentLength = request.getHeader("Content-Length");
this.contentLength = Integer.parseInt(contentLength);
- initProgressInfo(this.contentLength);
+ //initProgressInfo(this.contentLength);
if (contentLength != null && maxRequestSize > 0
&& this.contentLength > maxRequestSize) {
throw new FileUploadException(
@@ -442,14 +442,14 @@
private void fillProgressInfo () {
Double percent = (Double) (100.0 * this.read / this.contentLength);
getSession().setAttribute(FileUploadRendererBase._percentBeanName,percent);
- if (this.progressData != null) {
+ /*if (this.progressData != null) {
progressData.setPercent(percent);
progressData.setUploaded((long)this.read);
progressData.setTime((new Date().getTime() / 1000)- this.time);
- }
+ }*/
}
- private void initProgressInfo(int size) {
+ /* private void initProgressInfo(int size) {
time = new Date().getTime()/1000;
progressData = getProgressData();
if (progressData != null) {
@@ -458,6 +458,7 @@
}
}
+ */
private byte[] getBoundaryMarker(String contentType) {
Map<String, Object> params = parseParams(contentType, ";");
@@ -546,6 +547,11 @@
parseRequest();
return parameters.get(name);
}
+
+
+ public Integer getSize() {
+ return contentLength;
+ }
@Override
public Enumeration getParameterNames() {
Modified: trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-20 16:26:10 UTC (rev 6215)
+++ trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-20 16:44:12 UTC (rev 6216)
@@ -138,6 +138,23 @@
this.uploadObject.prepareProgressBar();
},
+ setupLabelUpdate: function () {
+ this.labelUpdateInterval = setInterval(function () { this.updateLabel(); }.bind(this), this.uploadObject.progressBar.options['pollinterval']);
+ },
+
+ updateLabel: function () {
+ if (this.state != FileUploadEntry.UPLOAD_IN_PROGRESS) {
+ clearInterval(this.labelUpdateInterval);
+ }else {
+ var p = this.uploadObject.progressBar.getValue();
+ if (p) {
+ var content = this.uploadObject.labelMarkup.invoke('getContent', this.uploadObject.progressData.getContext(p)).join('');
+ this.statusLabel.innerHTML = content;
+
+ }
+ }
+ },
+
finishProgressBar: function () {
this.uploadObject.finishProgressBar();
},
@@ -195,6 +212,61 @@
});
+ProgressData = Class.create();
+Object.extend(ProgressData.prototype, {
+ size: null,
+
+ startTime: null,
+
+ initialize: function(size) {
+ this.size = size;
+ this.startTime = parseInt((new Date().getTime())/1000);
+ },
+
+ ss: function () {
+ return parseInt((this.time - this.startTime) % 60) + "";
+ },
+
+ mm: function () {
+ return parseInt((this.time - this.startTime)/60)+ "";
+ },
+
+ hh: function () {
+ return parseInt((this.time - this.startTime)/3600) + "";
+ },
+
+ B: function () {
+ return this.size;
+ },
+
+ KB: function () {
+ return parseInt(this.size/1024);
+ },
+
+ MB: function () {
+ return parseInt(this.size/(1024*1024));
+ },
+
+ getContext: function (p) {
+ var context = {};
+ this.time = parseInt((new Date().getTime())/1000);
+ context['B'] = this.B();
+ context['KB'] = this.KB();
+ context['MB'] = this.MB();
+ context['ss'] = this.ss();
+ context['mm'] = this.mm();
+ context['hh'] = this.hh();
+ var s = this.size;
+ this.size = (this.size * p)/100;
+ context['_B'] = this.B();
+ context['_KB'] = this.KB();
+ context['_MB'] = this.MB();
+ this.size = s;
+ return context;
+ }
+
+});
+
LoadWatcher = Class.create();
Object.extend(LoadWatcher.prototype, {
initialize: function(iframe, callback) {
@@ -290,16 +362,19 @@
maxFileBatchSize: 5,
- initialize: function(id, stopScript, progressBarId, classes, options) {
+ initialize: function(id, stopScript, getFileSizeScript, progressBarId, classes, label, options) {
this.id = id;
this.element = $(this.id);
//this.progressBarId = progressBarId;
this._progressBar = $(progressBarId);
this.progressBar = this._progressBar.component;
+ this.labelMarkup = label;
+
this.element.component = this;
this.stopScript = stopScript;
+ this.getFileSizeScript = getFileSizeScript;
this.iframe = $(this.id + "_iframe");
this.items = $(this.id + ":fileItems");
@@ -309,6 +384,19 @@
this.options = options || {};
this.setupAutoUpload();
},
+
+ getFileSize: function (data) {
+ if (data) {
+ var progressData = new ProgressData(data);
+ this.progressData = progressData;
+ if (this.activeEntry) {
+ this.activeEntry.setupLabelUpdate();
+ }
+ }else {
+ if (this.activeEntry)
+ this.getFileSizeScript(this.activeEntry.uid);
+ }
+ },
prepareProgressBar: function () {
this.progressBar.setValue(0);
@@ -637,6 +725,8 @@
parentForm.target = oldTarget;
parentForm.encoding = oldEncoding;
parentForm.enctype = oldEnctype;
+ if (this.labelMarkup)
+ this.getFileSizeScript(entry.uid);
}
}
Modified: trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-02-20 16:26:10 UTC (rev 6215)
+++ trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-02-20 16:44:12 UTC (rev 6216)
@@ -123,7 +123,7 @@
}
};
- new FileUpload('#{clientId}', #{this:getStopScript(context, component)}, '#{this:getProgressBarId(context, component)}', FileUpload.CLASSES);
+ new FileUpload('#{clientId}', #{this:getStopScript(context, component)}, #{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)});
</script>
</span>
18 years, 2 months
JBoss Rich Faces SVN: r6215 - in trunk/ui/dataTable/src/main: java/org/richfaces/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-02-20 11:26:10 -0500 (Wed, 20 Feb 2008)
New Revision: 6215
Modified:
trunk/ui/dataTable/src/main/config/component/column.xml
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
Log:
RF-1741
Modified: trunk/ui/dataTable/src/main/config/component/column.xml
===================================================================
--- trunk/ui/dataTable/src/main/config/component/column.xml 2008-02-20 16:05:37 UTC (rev 6214)
+++ trunk/ui/dataTable/src/main/config/component/column.xml 2008-02-20 16:26:10 UTC (rev 6215)
@@ -79,6 +79,11 @@
<property>
<name>sortExpression</name>
<classname>java.lang.String</classname>
+ <description>DEPRECATED(use sortBy)Attribute defines a bean property which is used for sorting of a column</description>
+ </property>
+ <property>
+ <name>sortBy</name>
+ <classname>java.lang.String</classname>
<description>Attribute defines a bean property which is used for sorting of a column</description>
</property>
<property>
@@ -116,7 +121,7 @@
<classname>java.lang.Object</classname>
<description></description>
</property>
- <property hidden="true">
+ <property>
<name>filterValue</name>
<classname>java.lang.String</classname>
<description></description>
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-02-20 16:05:37 UTC (rev 6214)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-02-20 16:26:10 UTC (rev 6215)
@@ -22,8 +22,11 @@
package org.richfaces.component;
import javax.el.ELContext;
+import javax.el.ELException;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
import org.richfaces.model.ExtendedFilterField;
import org.richfaces.model.FilterField;
@@ -42,6 +45,9 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Column";
+ private Ordering sortOrder = Ordering.UNSORTED;
+ private String filterValue;
+
public abstract String getSortMode();
public abstract void setSortMode(String mode);
@@ -66,11 +72,11 @@
SortField2 sortField2 = null;
if (!Ordering.UNSORTED.equals(getSortOrder())) {
ValueExpression comparator = getValueExpression("comparator");
- ValueExpression sortExpression = getValueExpression("sortExpression");
+ ValueExpression sortBy = getValueExpression("sortBy");
if (comparator != null) {
sortField2 = new SortField2(comparator, getSortOrder());
- } else if (sortExpression != null) {
- sortField2 = new SortField2(sortExpression, getSortOrder());
+ } else if (sortBy != null) {
+ sortField2 = new SortField2(sortBy, getSortOrder());
}
}
return sortField2;
@@ -78,9 +84,84 @@
public void toggleSortOrder(ELContext elContext){
if(Ordering.ASCENDING.equals(getSortOrder())) {
- getValueExpression("sortOrder").setValue(elContext, Ordering.DESCENDING);
+ setSortOrder(Ordering.DESCENDING);
} else {
- getValueExpression("sortOrder").setValue(elContext, Ordering.ASCENDING);
+ setSortOrder(Ordering.ASCENDING);
}
}
+
+ public Ordering getSortOrder(){
+ ValueExpression ve = getValueExpression("sortOrder");
+ if (ve != null) {
+ Ordering value = null;
+ try {
+ value = (Ordering) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ return value;
+ } else {
+ return sortOrder;
+ }
+ }
+
+ public void setSortOrder(Ordering sortOrder){
+ ELContext context = getFacesContext().getELContext();
+ ValueExpression ve = getValueExpression("sortOrder");
+ if (ve != null && !ve.isReadOnly(context)) {
+ try {
+ ve.setValue(context, sortOrder);
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ } else {
+ this.sortOrder = sortOrder;
+ }
+ }
+
+ public String getFilterValue(){
+ ValueExpression ve = getValueExpression("filterValue");
+ if (ve != null) {
+ String value = null;
+ try {
+ value = (String) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ return value;
+ } else {
+ return filterValue;
+ }
+ }
+
+ public void setFilterValue(String filterValue){
+ ELContext context = getFacesContext().getELContext();
+ ValueExpression ve = getValueExpression("filterValue");
+ if (ve != null && !ve.isReadOnly(context)) {
+ try {
+ ve.setValue(context, filterValue);
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ } else {
+ this.filterValue = filterValue;
+ }
+ }
+
+ @Override
+ public Object saveState(FacesContext context) {
+ Object [] state = new Object[3];
+ state[0] = super.saveState(context);
+ state[1] = filterValue;
+ state[2] = sortOrder;
+ return state;
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object state) {
+ Object[] states = (Object[]) state;
+ super.restoreState(context, states[0]);
+ filterValue = (String)states[1];
+ sortOrder = (Ordering)states[2];
+ }
}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-02-20 16:05:37 UTC (rev 6214)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-02-20 16:26:10 UTC (rev 6215)
@@ -21,6 +21,7 @@
package org.richfaces.component;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -28,8 +29,13 @@
import java.util.List;
import java.util.Map;
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import org.ajax4jsf.component.AjaxSupport;
import org.ajax4jsf.component.SequenceDataAdaptor;
@@ -39,6 +45,7 @@
import org.apache.commons.collections.iterators.IteratorChain;
import org.richfaces.model.FilterField;
import org.richfaces.model.ModifiableModel;
+import org.richfaces.model.Ordering;
import org.richfaces.model.SortField2;
@@ -48,6 +55,8 @@
*/
public abstract class UIDataTable extends SequenceDataAdaptor implements Sortable2, Filterable {
+ Collection<Object> sortPriority = new ArrayList<Object>();
+
/**
* @author shura
*
@@ -180,7 +189,7 @@
}
List<SortField2> sortFields = new LinkedList<SortField2>();
- Collection sortPriority = getSortPriority();
+ Collection<Object> sortPriority = getSortPriority();
if (sortPriority != null) {
for (Object object : sortPriority) {
if (object instanceof String) {
@@ -200,8 +209,50 @@
return new ModifiableModel(dataModel, getVar(), getFilterFields(), getSortFields());
}
- public abstract Collection getSortPriority();
- public abstract void setSortPriority(Collection sortPriority);
+ public Collection<Object> getSortPriority(){
+ ValueExpression ve = getValueExpression("sortPriority");
+ if (ve != null) {
+ Collection<Object> value = null;
+ try {
+ value = (Collection) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ return value;
+ } else {
+ return sortPriority;
+ }
+ }
+
+ public void setSortPriority(Collection<Object> sortPriority){
+ ELContext context = getFacesContext().getELContext();
+ ValueExpression ve = getValueExpression("sortPriority");
+ if (ve != null && !ve.isReadOnly(context)) {
+ try {
+ ve.setValue(context, sortPriority);
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ } else {
+ this.sortPriority = sortPriority;
+ }
+ }
+
public abstract String getSortMode();
public abstract void setSortMode(String sortMode);
+
+ @Override
+ public Object saveState(FacesContext context) {
+ Object [] state = new Object[2];
+ state[0] = super.saveState(context);
+ state[1] = sortPriority;
+ return state;
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object state) {
+ Object[] states = (Object[]) state;
+ super.restoreState(context, states[0]);
+ sortPriority = (Collection)states[1];
+ }
}
\ No newline at end of file
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-20 16:05:37 UTC (rev 6214)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-20 16:26:10 UTC (rev 6215)
@@ -160,22 +160,7 @@
String classAttribute = facetName + "Class";
String columnHeaderClass = (String) column.getAttributes().get(
classAttribute);
- if (column instanceof org.richfaces.component.UIColumn &&
- (column.getValueExpression("comparator") != null
- || column.getValueExpression("sortExpression") != null)) {
- org.richfaces.component.UIColumn col =
- (org.richfaces.component.UIColumn) column;
- columnHeaderClass = "dr-table-sortable-header " + columnHeaderClass;
- if (Ordering.ASCENDING.equals(col.getSortOrder())) {
- columnHeaderClass = "dr-table-header-sort-up " + columnHeaderClass;
- } else if (Ordering.DESCENDING.equals(col.getSortOrder())) {
- columnHeaderClass = "dr-table-header-sort-down " + columnHeaderClass;
- }
- }
-
writer.startElement(element, column);
- encodeStyleClass(writer, null, skinCellClass, headerClass,
- columnHeaderClass);
writer.writeAttribute("scope", "col", null);
getUtils().encodeAttribute(context, column, "colspan");
@@ -185,7 +170,7 @@
String clientId = col.getClientId(context) + facetName;
writer.writeAttribute("id", clientId, null);
if (column.getValueExpression("comparator") != null
- || column.getValueExpression("sortExpression") != null) {
+ || column.getValueExpression("sortBy") != null) {
StringBuffer buffer;
if (col.isSelfSorted()) {
UIComponent table = column.getParent();
@@ -204,16 +189,23 @@
writer.writeAttribute(HTML.onclick_ATTRIBUTE, buffer
.toString(), null);
}
+ columnHeaderClass = "dr-table-sortable-header " + columnHeaderClass;
+ if (Ordering.ASCENDING.equals(col.getSortOrder())) {
+ columnHeaderClass = "dr-table-header-sort-up " + columnHeaderClass;
+ } else if (Ordering.DESCENDING.equals(col.getSortOrder())) {
+ columnHeaderClass = "dr-table-header-sort-down " + columnHeaderClass;
+ }
}
}
-
+ encodeStyleClass(writer, null, skinCellClass, headerClass,
+ columnHeaderClass);
UIComponent facet = column.getFacet(facetName);
if (facet != null) {
renderChild(context, facet);
}
if (column instanceof org.richfaces.component.UIColumn) {
if (column.getValueExpression("comparator") != null
- || column.getValueExpression("sortExpression") != null) {
+ || column.getValueExpression("sortBy") != null) {
org.richfaces.component.UIColumn col =
(org.richfaces.component.UIColumn) column;
if (Ordering.ASCENDING.equals(col.getSortOrder()) ||
@@ -520,11 +512,7 @@
if (clientId != null) {
if (children.getClientId(context).equals(clientId)) {
String id = children.getId();
- Collection sortPriority = table.getSortPriority();
- if (sortPriority == null) {
- sortPriority = new ArrayList();
- table.getValueExpression("sortPriority").setValue(elContext, sortPriority);
- }
+ Collection<Object> sortPriority = table.getSortPriority();
if (isSingleSortMode) {
sortPriority.clear();
}
@@ -533,13 +521,12 @@
}
column.toggleSortOrder(elContext);
} else if(isSingleSortMode){
- column.getValueExpression("sortOrder").setValue(elContext, Ordering.UNSORTED);
+ column.setSortOrder(Ordering.UNSORTED);
}
}
String filterValue = map.get(children.getClientId(context) + SORT_FILTER_PARAMETER);
if (filterValue != null) {
- children.getAttributes()
- .put("filterValue", filterValue);
+ column.setFilterValue(filterValue);
}
}
18 years, 2 months
JBoss Rich Faces SVN: r6214 - in trunk/sandbox/ui/inplaceSelect/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-20 11:05:37 -0500 (Wed, 20 Feb 2008)
New Revision: 6214
Modified:
trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss
trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
rename css
Modified: trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss 2008-02-20 15:09:39 UTC (rev 6213)
+++ trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss 2008-02-20 16:05:37 UTC (rev 6214)
@@ -10,6 +10,9 @@
body{padding : 30px;}
fieldset{padding : 30px; border : 1px solid #c0c0c0;}
legend{font-weight : bold}
+
+.rich-inplace {
+}
.rich-inplace-select-default-state{
white-space : nowrap;
@@ -46,6 +49,11 @@
width : 100px;
height : 1px
}
+.rich-inplace-select-btn-set{
+ position : absolute;
+ top:0px; left : 112px;
+ white-space : nowrap
+}
.rich-inplace-select-btn {
background-position : top;
@@ -56,7 +64,7 @@
margin : 0px;
}
-.rich-inplace-select-press{
+.rich-inplace-select-btn-press{
background-position: top;
background-repeat: repeat-x;
background-color: #C7D7EC; /*gradient - from tabBackgroundColor to generalBackgroundColor, background-color - tabBackgroundColor*/
@@ -65,13 +73,6 @@
margin : 0px;
}
-.rich-inplace-select-set{
- position : absolute;
- top:0px;
- left : 112px;
- white-space : nowrap
-}
-
.rich-inplace-select-shadow{
top:0;
left:0;
@@ -88,7 +89,7 @@
font-size : 0px;d!isplay : none
}/*DDL is hidden!!!!!*/
-.rich-inplace-select-list_scroll{
+.rich-inplace-select-list-scroll{
overflow : auto;
height : 100px;
}
@@ -146,27 +147,9 @@
background-position : bottom right;
}
-.rich-inplace-select-shadow-tl{
- background-repeat: repeat-x;
- background-position: top left;
-}
-
-..rich-inplace-select-shadow-tr{
- background-repeat: repeat-x;
- background-position: top right;
-}
-.rich-inplace-select-shadow-bl{
- background-repeat : repeat-x
- background-position: bottom left;
-}
-
-.rich-inplace-select-shadow-br{
- background-repeat : repeat-x;
- background-position : bottom right;
-}
]]>
</f:verbatim>
- <u:selector name="..rich-inplace-select-changed-state">
+ <u:selector name=".rich-inplace-select-changed-state">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.images.EditIcon"/>
</u:style>
@@ -203,30 +186,6 @@
</u:style>
</u:selector>
- <u:selector name=".rich-inplace-select-shadow-tl">
- <u:style name="background-image">
- <f:resource f:key="/org/richfaces/renderkit/html/images/bg_shadow.png"/>
- </u:style>
- </u:selector>
-
- <u:selector name=".rich-inplace-select-shadow-tr">
- <u:style name="background-image">
- <f:resource f:key="/org/richfaces/renderkit/html/images/bg_shadow.png"/>
- </u:style>
- </u:selector>
-
- <u:selector name=".rich-inplace-select-shadow-bl">
- <u:style name="background-image">
- <f:resource f:key="/org/richfaces/renderkit/html/images/bg_shadow.png"/>
- </u:style>
- </u:selector>
-
- <u:selector name=".rich-inplace-select-shadow-br">
- <u:style name="background-image">
- <f:resource f:key="/org/richfaces/renderkit/html/images/bg_shadow.png"/>
- </u:style>
- </u:selector>
-
<u:selector name=".rich-inplace-select-btn">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.images.SpinnerButtonGradient"/>
Modified: trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-20 15:09:39 UTC (rev 6213)
+++ trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-20 16:05:37 UTC (rev 6214)
@@ -60,9 +60,9 @@
</jsp:scriptlet>
<f:resource var="spacer" name="images/spacer.gif"/>
-<span id="#{clientId}" class="insel_edit_state">
+<span id="#{clientId}" class="rich-inplace-select-edit-state">
<input id="#{clientId}tabber" type="button" value="" style="width: 1px; position: absolute; left: -32767px;" />
- <img id="#{clientId}inplaceStrut" src="#{spacer}" class="is_strut"/>
+ <img id="#{clientId}inplaceStrut" src="#{spacer}" class="rich-inplace-select-strut"/>
<input id="#{clientId}inplaceTmpValue"
readonly="readonly"
type="Text"
@@ -71,59 +71,59 @@
autocomplete="off"
maxlength='#{component.attributes["inputMaxLength"]}'
tabindex='#{component.attributes["tabindex"]}'
- class="insel_field"/>
+ class="rich-inplace-select-field"/>
<input id='#{clientId}inplaceValue' name='#{clientId}value' type='hidden' value='#{fieldValue}'/>
- <div id="#{clientId}bar" class="insel_btn_set" style="display:none;">
- <div class="insel_shadow">
+ <div id="#{clientId}bar" class="rich-inplace-select-btn-set" style="display:none;">
+ <div class="rich-inplace-select-shadow">
<table cellpadding="0" cellspacing="0" border="0" class="insel_shadow_size">
<tr>
- <td class="insel_shadow_tl">
+ <td class="rich-inplace-select-shadow-tl">
<img src="#{spacer}" width="10" height="1" alt="" border="0"/><br/>
</td>
- <td class="insel_shadow_tr">
+ <td class="rich-inplace-select-shadow-tr">
<img src="#{spacer}" width="1" height="10" alt="" border="0"/><br/>
</td>
</tr>
<tr>
- <td class="insel_shadow_bl">
+ <td class="rich-inplace-select-shadow-bl">
<img src="#{spacer}" width="1" height="10" alt="" border="0"/><br/>
</td>
- <td class="insel_shadow_br">
+ <td class="rich-inplace-select-shadow-br">
<img src="#{spacer}" width="10" height="1" alt="" border="0"/><br/>
</td>
</tr>
</table>
</div>
<div id="#{clientId}buttons" style="position : relative">
- <input id="#{clientId}ok" type="image" src="#{saveIcon}" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
- <input id="#{clientId}cancel" type="image" src="#{cancelIcon}" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
+ <input id="#{clientId}ok" type="image" src="#{saveIcon}" class="rich-inplace-select-btn" onmousedown="this.className='rich-inplace-select-btn-press'" onmouseout="this.className='rich-inplace-select-btn'" onmouseup="this.className='rich-inplace-select-btn'"/>
+ <input id="#{clientId}cancel" type="image" src="#{cancelIcon}" class="rich-inplace-select-btn" onmousedown="this.className='rich-inplace-select-btn-press'" onmouseout="this.className='rich-inplace-select-btn'" onmouseup="this.className='rich-inplace-select-btn'"/>
</div>
</div>
- <div id="listParent#{clientId}" class="cb_width_list" style="position : absolute; height : 100px; left : 0px; top: 13px">
- <div class="cb_shadow">
+ <div id="listParent#{clientId}" class="rich-inplace-select-width-list" style="position : absolute; height : 100px; left : 0px; top: 13px">
+ <div class="rich-inplace-select-shadow">
<table id="shadow#{clientId}" cellpadding="0" cellspacing="0" border="0" width="257" height="109">
<tr>
- <td class="cb_shadow_tl">
+ <td class=".rich-inplace-select-shadow-tl">
<img src="#{spacer}" width="10" height="1" alt="" border="0"/><br/>
</td>
- <td class="cb_shadow_tr">
+ <td class=".rich-inplace-select-shadow-tr">
<img src="#{spacer}" width="1" height="10" alt="" border="0"/><br/>
</td>
</tr>
<tr>
- <td class="cb_shadow_bl">
+ <td class=".rich-inplace-select-shadow-bl">
<img src="#{spacer}" width="1" height="10" alt="" border="0"/><br/>
</td>
- <td class="cb_shadow_br">
+ <td class=".rich-inplace-select-shadow-br">
<img src="#{spacer}" width="10" height="10" alt="" border="0"/><br/>
</td>
</tr>
</table>
</div>
- <div id="listPosition#{clientId}" class="cb_list_position">
- <div id="listDecoration#{clientId}" class="cb_list_decoration">
- <div id="list#{clientId}" class="cb_list_scroll">
+ <div id="listPosition#{clientId}" class="rich-inplace-select-list-position">
+ <div id="listDecoration#{clientId}" class="rich-inplace-select-list-decoration">
+ <div id="list#{clientId}" class="rich-inplace-select-list-scroll">
<f:call name="encodeItems"/>
</div>
</div>
@@ -143,16 +143,16 @@
DISABLED : "#{inputDisabledStyle}"}
},
COMBO_LIST : {
- LIST : {CLASSES :{ACTIVE : "rich-combobox-list-cord rich-combobox-list-scroll rich-combobox-list-decoration rich-combobox-list-position #{listClass}"},
+ LIST : {CLASSES :{ACTIVE : "rich-inplace-select-list-scroll rich-inplace-select-list-decoration rich-inplace-select-list-position #{listClass}"},
STYLE : {ACTIVE: "#{listStyle}"}
},
- ITEM : {NORMAL : "rich-combobox-item #{itemClass}",
- SELECTED : "rich-combobox-item rich-combobox-item-selected #{itemSelectedClass}"
+ ITEM : {NORMAL : "rich-inplace-select-option #{itemClass}",
+ SELECTED : "rich-inplace-select-option rich-inplace-select-select-item #{itemSelectedClass}"
}
},
- COMPONENT : {CHANGED : {NORMAL : 'rich-inplace insel_default_state insel_changed_state #{component.attributes["changedClass"]}', HOVERED : '#{component.attributes["changedHoveredClass"]}'},
- VIEW : {NORMAL : 'rich-inplace insel_default_state #{component.attributes["viewClass"]}', HOVERED : '#{component.attributes["viewHoveredClass"]}'},
- EDITABLE : 'rich-inplace insel_edit_state #{component.attributes["editClass"]}'
+ COMPONENT : {CHANGED : {NORMAL : 'rich-inplace rich-inplace-select-default-state rich-inplace-select-changed-state #{component.attributes["changedClass"]}', HOVERED : '#{component.attributes["changedHoveredClass"]}'},
+ VIEW : {NORMAL : 'rich-inplace rich-inplace-select-default-state #{component.attributes["viewClass"]}', HOVERED : '#{component.attributes["viewHoveredClass"]}'},
+ EDITABLE : 'rich-inplace rich-inplace-select-edit-state #{component.attributes["editClass"]}'
}
};
@@ -173,8 +173,8 @@
onviewactivated : #{this:getAsEventHandler(context, component, "onviewactivated")}};
var richInplaceList = new Richfaces.InplaceSelectList('list#{clientId}', 'listParent#{clientId}', false,
- Richfaces.InplaceSelect.CLASSES, '100px', '100px', #{this:getItemsTextAsJSArray(context, component)}, null,
- '#{clientId}inplaceTmpValue', 'shadow#{clientId}', 0, 0);
+ Richfaces.InplaceSelect.CLASSES, '100px', '100px', #{this:getItemsTextAsJSArray(context, component)}, null,
+ '#{clientId}inplaceTmpValue', 'shadow#{clientId}', 0, 0);
var richInplaceSelect = new Richfaces.InplaceSelect(richInplaceList, '#{clientId}', '#{clientId}inplaceTmpValue',
'#{clientId}inplaceValue', '#{clientId}tabber', '#{clientId}inplaceStrut',
richInplaceSelAttributes, richInplaceSelEvents, Richfaces.InplaceSelect.CLASSES,
18 years, 2 months
JBoss Rich Faces SVN: r6213 - trunk/sandbox/ui/inplaceSelect/src/main/config/resources.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-20 10:09:39 -0500 (Wed, 20 Feb 2008)
New Revision: 6213
Modified:
trunk/sandbox/ui/inplaceSelect/src/main/config/resources/resource-config.xml
Log:
Modified: trunk/sandbox/ui/inplaceSelect/src/main/config/resources/resource-config.xml
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/config/resources/resource-config.xml 2008-02-20 15:09:13 UTC (rev 6212)
+++ trunk/sandbox/ui/inplaceSelect/src/main/config/resources/resource-config.xml 2008-02-20 15:09:39 UTC (rev 6213)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<resource-config>
- <resource class="org.richfaces.renderkit.html.images.saveControlIcon">
+ <resource class="org.richfaces.renderkit.html.images.SaveControlIcon">
<name>org.richfaces.renderkit.html.images.SaveControlIcon</name>
</resource>
<resource class="org.richfaces.renderkit.html.images.EditIcon">
18 years, 2 months
JBoss Rich Faces SVN: r6212 - trunk/sandbox/ui/inplaceInput/src/main/config/resources.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-20 10:09:13 -0500 (Wed, 20 Feb 2008)
New Revision: 6212
Modified:
trunk/sandbox/ui/inplaceInput/src/main/config/resources/resource-config.xml
Log:
Modified: trunk/sandbox/ui/inplaceInput/src/main/config/resources/resource-config.xml
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/config/resources/resource-config.xml 2008-02-20 15:00:45 UTC (rev 6211)
+++ trunk/sandbox/ui/inplaceInput/src/main/config/resources/resource-config.xml 2008-02-20 15:09:13 UTC (rev 6212)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<resource-config>
- <resource class="org.richfaces.renderkit.html.images.saveControlIcon">
+ <resource class="org.richfaces.renderkit.html.images.SaveControlIcon">
<name>org.richfaces.renderkit.html.images.SaveControlIcon</name>
</resource>
<resource class="org.richfaces.renderkit.html.images.EditIcon">
18 years, 2 months
JBoss Rich Faces SVN: r6211 - trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-02-20 10:00:45 -0500 (Wed, 20 Feb 2008)
New Revision: 6211
Modified:
trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
Log:
latest changes
Modified: trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-02-20 14:41:57 UTC (rev 6210)
+++ trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-02-20 15:00:45 UTC (rev 6211)
@@ -195,6 +195,8 @@
this.createNewText(this.currentText);
this.inplaceInput.className = this.classes.COMPONENT.VIEW.NORMAL;
+ this.inplaceInput.observe("mouseover", function(e){this.inplaceMouseOverHandler(e);}.bindAsEventListener(this));
+
this.strut.hide();
},
18 years, 2 months
JBoss Rich Faces SVN: r6210 - in trunk: ui/dataTable/src/main/config/component and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-02-20 09:41:57 -0500 (Wed, 20 Feb 2008)
New Revision: 6210
Added:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconDown.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconUp.java
Removed:
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
Modified:
trunk/ui/dataTable/src/main/config/component/column.xml
trunk/ui/dataTable/src/main/config/component/dataGrid.xml
trunk/ui/dataTable/src/main/config/component/dataTable.xml
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss
trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/html/images/ListShuttleIconCopy.java
trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/html/images/ListShuttleIconRemove.java
trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java
Log:
Triangle images added to sortable headers.
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconBase.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -0,0 +1,172 @@
+/**
+ * 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 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 abstract class TriangleIconBase extends Java2Dresource {
+
+ private static final Dimension DIMENSION = new Dimension(15, 15);
+
+ protected static final String ICON_COLOR = "generalTextColor";
+ protected static final String BACKGROUND_COLOR = "tabBackgroundColor";
+ protected static final String BORDER_COLOR = "generalBackgroundColor";
+
+ protected static final String DISABLED_ICON_COLOR = "tabDisabledTextColor";
+ protected static final String DISABLED_BACKGROUND_COLOR = "tabBackgroundColor";
+ protected static final String DISABLED_BORDER_COLOR = "generalBackgroundColor";
+
+ public TriangleIconBase() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ abstract protected void paintImage(ResourceContext context, Graphics2D g2d, Color textColor, Color borderColor);
+
+ protected void paintBaseTriangle(Graphics2D g2d) {
+ for (int i = 0; i < 7; i++) {
+ g2d.drawLine(-3 + i, 1, -3 + i, 1 + (i < 4 ? i : 6 - i));
+ }
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+
+ Color [] data = (Color[]) restoreData(context);
+ Color textColor = data[0];
+ Color backgroundColor = data[1];
+ Color borderColor = data[2];
+
+ 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.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+// g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+// g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+
+ /*Dimension dim = getDimensions(context);
+ g2d.setColor(backgroundColor);
+ g2d.fillRect(0, 0, dim.width, dim.height);*/
+
+ if (textColor != null && backgroundColor != null && g2d != null) {
+ paintImage(context, g2d, textColor, borderColor);
+ }
+
+ }
+
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return DIMENSION;
+ }
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return DIMENSION;
+ }
+
+ /**
+ * @param data - pass icon color and background color
+ */
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, ICON_COLOR, BACKGROUND_COLOR, BORDER_COLOR);
+ }
+
+ protected Object storeData(FacesContext context, String colorSkinParam, String backgroundSkinParam, String borderSkinParam) {
+ Skin skin = SkinFactory.getInstance().getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
+
+ byte [] ret = new byte[9];
+
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ String color1 = (String) skin.getParameter(context, colorSkinParam);
+ if (null == color1 || "".equals(color1))
+ color1 = (String) defaultSkin.getParameter(context, colorSkinParam);
+
+ if (color1 == null) {
+ color1 = "#FFFFFF";
+ }
+
+ color = HtmlColor.decode(color1);
+
+ zipper.addColor(color);
+
+ String color2 = (String) skin.getParameter(context, backgroundSkinParam);
+ if (null == color2 || "".equals(color2))
+ color2 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
+
+ if (color2 == null) {
+ color2 = "#000000";
+ }
+
+ color = HtmlColor.decode(color2);
+ zipper.addColor(color);
+
+ String color3 = (String) skin.getParameter(context, borderSkinParam);
+ if (null == color3 || "".equals(color3))
+ color3 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
+
+ if (color3 == null) {
+ color3 = "#000000";
+ }
+
+ color = HtmlColor.decode(color3);
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+
+ Zipper2 zipper = new Zipper2(objectArray);
+
+ return new Color[] {zipper.nextColor(), zipper.nextColor(), zipper.nextColor()};
+ }
+
+ public boolean isCacheable() {
+ return true;
+ }
+
+}
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconDown.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconDown.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconDown.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -0,0 +1,49 @@
+/**
+ * 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 java.awt.Color;
+import java.awt.Graphics2D;
+
+import org.ajax4jsf.resource.ResourceContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class TriangleIconDown extends TriangleIconBase {
+
+ protected void paintImage(ResourceContext context, Graphics2D g2d,
+ Color textColor, Color borderColor) {
+
+ g2d.setColor(textColor);
+ g2d.translate(7, 5);
+ paintBaseTriangle(g2d);
+ g2d.translate(-7, -5);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(4, 5, 10, 5);
+ g2d.drawLine(11, 6, 7, 10);
+ g2d.drawLine(7, 10, 3, 6);
+ }
+
+}
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconUp.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconUp.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/TriangleIconUp.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -0,0 +1,44 @@
+/**
+ * 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 java.awt.Color;
+import java.awt.Graphics2D;
+
+import org.ajax4jsf.resource.ResourceContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class TriangleIconUp extends TriangleIconDown {
+
+ protected void paintImage(ResourceContext context, Graphics2D g2d,
+ Color textColor, Color borderColor) {
+
+ g2d.translate(0, 14);
+ g2d.scale(1, -1);
+
+ super.paintImage(context, g2d, textColor, borderColor);
+ }
+
+}
Modified: trunk/ui/dataTable/src/main/config/component/column.xml
===================================================================
--- trunk/ui/dataTable/src/main/config/component/column.xml 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/dataTable/src/main/config/component/column.xml 2008-02-20 14:41:57 UTC (rev 6210)
@@ -51,12 +51,14 @@
<property>
<name>headerClass</name>
<classname>java.lang.String</classname>
- <description>Space-separated list of CSS style class(es) that are be applied to any header generated for this table</description>
+ <description>Space-separated list of CSS style class(es) that are be applied to any header generated for this table</description>
+ <defaultvalue>""</defaultvalue>
</property>
<property>
<name>footerClass</name>
<classname>java.lang.String</classname>
- <description>Space-separated list of CSS style class(es) that are be applied to any footer generated for this table</description>
+ <description>Space-separated list of CSS style class(es) that are be applied to any footer generated for this table</description>
+ <defaultvalue>""</defaultvalue>
</property>
<property>
<name>width</name>
Modified: trunk/ui/dataTable/src/main/config/component/dataGrid.xml
===================================================================
--- trunk/ui/dataTable/src/main/config/component/dataGrid.xml 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/dataTable/src/main/config/component/dataGrid.xml 2008-02-20 14:41:57 UTC (rev 6210)
@@ -75,7 +75,8 @@
<property>
<name>captionClass</name>
<classname>java.lang.String</classname>
- <description>Space-separated list of CSS style class(es) that are be applied to caption for this component</description>
+ <description>Space-separated list of CSS style class(es) that are be applied to caption for this component</description>
+ <defaultvalue>""</defaultvalue>
</property>
<property>
<name>captionStyle</name>
@@ -86,13 +87,15 @@
<name>headerClass</name>
<classname>java.lang.String</classname>
<description>Space-separated list of CSS style class(es) that are be applied to header for this component
- </description>
+ </description>
+ <defaultvalue>""</defaultvalue>
</property>
<property>
<name>footerClass</name>
<classname>java.lang.String</classname>
<description>Space-separated list of CSS style class(es) that are be applied to footer for this component
- </description>
+ </description>
+ <defaultvalue>""</defaultvalue>
</property>
<!--
<property>
Modified: trunk/ui/dataTable/src/main/config/component/dataTable.xml
===================================================================
--- trunk/ui/dataTable/src/main/config/component/dataTable.xml 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/dataTable/src/main/config/component/dataTable.xml 2008-02-20 14:41:57 UTC (rev 6210)
@@ -78,7 +78,8 @@
<property>
<name>captionClass</name>
<classname>java.lang.String</classname>
- <description>Space-separated list of CSS style class(es) that are be applied to caption for this component</description>
+ <description>Space-separated list of CSS style class(es) that are be applied to caption for this component</description>
+ <defaultvalue>""</defaultvalue>
</property>
<property>
<name>captionStyle</name>
@@ -89,13 +90,15 @@
<name>headerClass</name>
<classname>java.lang.String</classname>
<description>Space-separated list of CSS style class(es) that are be applied to header for this component
- </description>
+ </description>
+ <defaultvalue>""</defaultvalue>
</property>
<property>
<name>footerClass</name>
<classname>java.lang.String</classname>
<description>Space-separated list of CSS style class(es) that are be applied to footer for this component
- </description>
+ </description>
+ <defaultvalue>""</defaultvalue>
</property>
<property>
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -144,7 +144,8 @@
ResponseWriter writer, Iterator headers, String skinCellClass,
String headerClass, String facetName, String element, int colCount)
throws IOException {
- int t_colCount = 0;
+ int t_colCount = 0;
+ String spacerUrl = getResource("/org/richfaces/renderkit/html/images/spacer.gif").getUri(context, null);
while (headers.hasNext()) {
UIComponent column = (UIComponent) headers.next();
if((Integer)column.getAttributes().get("colspan")!=null){
@@ -159,6 +160,18 @@
String classAttribute = facetName + "Class";
String columnHeaderClass = (String) column.getAttributes().get(
classAttribute);
+ if (column instanceof org.richfaces.component.UIColumn &&
+ (column.getValueExpression("comparator") != null
+ || column.getValueExpression("sortExpression") != null)) {
+ org.richfaces.component.UIColumn col =
+ (org.richfaces.component.UIColumn) column;
+ columnHeaderClass = "dr-table-sortable-header " + columnHeaderClass;
+ if (Ordering.ASCENDING.equals(col.getSortOrder())) {
+ columnHeaderClass = "dr-table-header-sort-up " + columnHeaderClass;
+ } else if (Ordering.DESCENDING.equals(col.getSortOrder())) {
+ columnHeaderClass = "dr-table-header-sort-down " + columnHeaderClass;
+ }
+ }
writer.startElement(element, column);
encodeStyleClass(writer, null, skinCellClass, headerClass,
@@ -191,13 +204,6 @@
writer.writeAttribute(HTML.onclick_ATTRIBUTE, buffer
.toString(), null);
}
- if (Ordering.ASCENDING.equals(col.getSortOrder())) {
- writer.writeAttribute(HTML.style_ATTRIBUTE,
- "background-color: red", null);
- } else if (Ordering.DESCENDING.equals(col.getSortOrder())) {
- writer.writeAttribute(HTML.style_ATTRIBUTE,
- "background-color: green", null);
- }
}
}
@@ -205,27 +211,39 @@
if (facet != null) {
renderChild(context, facet);
}
- if (column instanceof org.richfaces.component.UIColumn
- && ((org.richfaces.component.UIColumn)column).getFilterMethod() == null
- && column.getValueExpression("filterExpression") == null
- && column.getValueExpression("filterBy") != null) {
- UIComponent table = column.getParent();
- String id = table.getClientId(context);
- JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(table, context);
- Map eventOptions = AjaxRendererUtils.buildEventOptions(context, table);
- Map parameters = (Map) eventOptions.get("parameters");
- parameters.put(id, SORT_FILTER_PARAMETER);
- ajaxFunction.addParameter(eventOptions);
- StringBuffer buffer = new StringBuffer();
- ajaxFunction.appendScript(buffer);
- writer.startElement(HTML.INPUT_ELEM, column);
- writer.writeAttribute(HTML.TYPE_ATTR, "text", null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE, column.getClientId(context) + SORT_FILTER_PARAMETER, null);
- writer.writeAttribute(HTML.value_ATTRIBUTE, column.getAttributes().get("filterValue"), null);
- writer.writeAttribute(HTML.onchange_ATTRIBUTE, buffer.toString(), null);
- writer.endElement(HTML.INPUT_ELEM);
- }
-
+ if (column instanceof org.richfaces.component.UIColumn) {
+ if (column.getValueExpression("comparator") != null
+ || column.getValueExpression("sortExpression") != null) {
+ org.richfaces.component.UIColumn col =
+ (org.richfaces.component.UIColumn) column;
+ if (Ordering.ASCENDING.equals(col.getSortOrder()) ||
+ Ordering.DESCENDING.equals(col.getSortOrder())) {
+ writer.startElement(HTML.IMG_ELEMENT, column);
+ writer.writeAttribute(HTML.src_ATTRIBUTE, spacerUrl, null);
+ writer.writeAttribute(HTML.width_ATTRIBUTE, "16", null);
+ writer.endElement(HTML.IMG_ELEMENT);
+ }
+ }
+ if (((org.richfaces.component.UIColumn)column).getFilterMethod() == null
+ && column.getValueExpression("filterExpression") == null
+ && column.getValueExpression("filterBy") != null) {
+ UIComponent table = column.getParent();
+ String id = table.getClientId(context);
+ JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(table, context);
+ Map eventOptions = AjaxRendererUtils.buildEventOptions(context, table);
+ Map parameters = (Map) eventOptions.get("parameters");
+ parameters.put(id, SORT_FILTER_PARAMETER);
+ ajaxFunction.addParameter(eventOptions);
+ StringBuffer buffer = new StringBuffer();
+ ajaxFunction.appendScript(buffer);
+ writer.startElement(HTML.INPUT_ELEM, column);
+ writer.writeAttribute(HTML.TYPE_ATTR, "text", null);
+ writer.writeAttribute(HTML.NAME_ATTRIBUTE, column.getClientId(context) + SORT_FILTER_PARAMETER, null);
+ writer.writeAttribute(HTML.value_ATTRIBUTE, column.getAttributes().get("filterValue"), null);
+ writer.writeAttribute(HTML.onchange_ATTRIBUTE, buffer.toString(), null);
+ writer.endElement(HTML.INPUT_ELEM);
+ }
+ }
writer.endElement(element);
Modified: trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss
===================================================================
--- trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss 2008-02-20 14:41:57 UTC (rev 6210)
@@ -97,6 +97,27 @@
<u:style name="font-family" skin="generalFamilyFont"/> <!--generalFamilyFont-->
</u:selector>
+<f:verbatim>
+ .dr-table-sortable-header {
+ background-position: right;
+ background-repeat: no-repeat;
+ cursor : pointer;
+ white-space : nowrap;
+ }
+</f:verbatim>
+
+<u:selector name=".dr-table-header-sort-down" >
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.images.TriangleIconDown"/>
+ </u:style>
+</u:selector>
+
+<u:selector name=".dr-table-header-sort-up" >
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.images.TriangleIconUp"/>
+ </u:style>
+</u:selector>
+
<u:selector name=".dr-table-footer" >
<u:style name="background-color" skin="tableFooterBackgroundColor"/> <!--tableFooterBackgroundColor-->
</u:selector>
Modified: trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/html/images/ListShuttleIconCopy.java
===================================================================
--- trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/html/images/ListShuttleIconCopy.java 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/html/images/ListShuttleIconCopy.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -6,7 +6,7 @@
import org.ajax4jsf.resource.ResourceContext;
-public class ListShuttleIconCopy extends OrderingListIconUp {
+public class ListShuttleIconCopy extends TriangleIconUp {
protected void paintImage(ResourceContext context, Graphics2D g2d,
Color textColor, Color borderColor) {
Modified: trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/html/images/ListShuttleIconRemove.java
===================================================================
--- trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/html/images/ListShuttleIconRemove.java 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/html/images/ListShuttleIconRemove.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -5,7 +5,7 @@
import org.ajax4jsf.resource.ResourceContext;
-public class ListShuttleIconRemove extends OrderingListIconDown {
+public class ListShuttleIconRemove extends TriangleIconDown {
protected void paintImage(ResourceContext context, Graphics2D g2d,
Color textColor, Color borderColor) {
Modified: trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java
===================================================================
--- trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -70,8 +70,8 @@
javaScripts.add("scripts/ListShuttle.js");
javaScripts.add("scripts/ListBase.js");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUp");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconDown");
+ imageClasses.add("org.richfaces.renderkit.html.images.TriangleIconUp");
+ imageClasses.add("org.richfaces.renderkit.html.images.TriangleIconDown");
imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconTop");
imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconBottom");
imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUpDisabled");
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -6,11 +6,11 @@
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.TriangleIconDown;
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.TriangleIconUp;
import org.richfaces.renderkit.html.images.OrderingListIconUpDisabled;
public class OrderingComponentControlsHelper {
@@ -93,7 +93,7 @@
}
},
- new OrderingComponentRendererBase.ControlsHelper("up", "RICH_SHUTTLES_UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUp.class.getName(), FACET_UP,
+ new OrderingComponentRendererBase.ControlsHelper("up", "RICH_SHUTTLES_UP_LABEL", DEFAULT_LABEL_UP, TriangleIconUp.class.getName(), FACET_UP,
"-up", ATTRIBUTE_CLASS_UP_CONTROL, "",
CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK ,true, "up".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
@@ -111,7 +111,7 @@
}
},
- new OrderingComponentRendererBase.ControlsHelper("down", "RICH_SHUTTLES_DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDown.class.getName(), FACET_DOWN,
+ new OrderingComponentRendererBase.ControlsHelper("down", "RICH_SHUTTLES_DOWN_LABEL", DEFAULT_LABEL_DOWN, TriangleIconDown.class.getName(), FACET_DOWN,
"-down", ATTRIBUTE_CLASS_DOWN_CONTROL, "",
CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK, true, "down".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
Deleted: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -1,172 +0,0 @@
-/**
- * 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 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 abstract class OrderingListIconBase extends Java2Dresource {
-
- private static final Dimension DIMENSION = new Dimension(15, 15);
-
- protected static final String ICON_COLOR = "generalTextColor";
- protected static final String BACKGROUND_COLOR = "tabBackgroundColor";
- protected static final String BORDER_COLOR = "generalBackgroundColor";
-
- protected static final String DISABLED_ICON_COLOR = "tabDisabledTextColor";
- protected static final String DISABLED_BACKGROUND_COLOR = "tabBackgroundColor";
- protected static final String DISABLED_BORDER_COLOR = "generalBackgroundColor";
-
- public OrderingListIconBase() {
- setRenderer(new GifRenderer());
- setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
- }
-
- abstract protected void paintImage(ResourceContext context, Graphics2D g2d, Color textColor, Color borderColor);
-
- protected void paintBaseTriangle(Graphics2D g2d) {
- for (int i = 0; i < 7; i++) {
- g2d.drawLine(-3 + i, 1, -3 + i, 1 + (i < 4 ? i : 6 - i));
- }
- }
-
- protected void paint(ResourceContext context, Graphics2D g2d) {
-
- Color [] data = (Color[]) restoreData(context);
- Color textColor = data[0];
- Color backgroundColor = data[1];
- Color borderColor = data[2];
-
- 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.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
-// g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
-// g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
-
- /*Dimension dim = getDimensions(context);
- g2d.setColor(backgroundColor);
- g2d.fillRect(0, 0, dim.width, dim.height);*/
-
- if (textColor != null && backgroundColor != null && g2d != null) {
- paintImage(context, g2d, textColor, borderColor);
- }
-
- }
-
- public Dimension getDimensions(FacesContext facesContext, Object data) {
- return DIMENSION;
- }
- protected Dimension getDimensions(ResourceContext resourceContext) {
- return DIMENSION;
- }
-
- /**
- * @param data - pass icon color and background color
- */
- protected Object getDataToStore(FacesContext context, Object data) {
- return storeData(context, ICON_COLOR, BACKGROUND_COLOR, BORDER_COLOR);
- }
-
- protected Object storeData(FacesContext context, String colorSkinParam, String backgroundSkinParam, String borderSkinParam) {
- Skin skin = SkinFactory.getInstance().getSkin(context);
- Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
-
- byte [] ret = new byte[9];
-
- Color color = null;
- Zipper2 zipper = new Zipper2(ret);
-
- String color1 = (String) skin.getParameter(context, colorSkinParam);
- if (null == color1 || "".equals(color1))
- color1 = (String) defaultSkin.getParameter(context, colorSkinParam);
-
- if (color1 == null) {
- color1 = "#FFFFFF";
- }
-
- color = HtmlColor.decode(color1);
-
- zipper.addColor(color);
-
- String color2 = (String) skin.getParameter(context, backgroundSkinParam);
- if (null == color2 || "".equals(color2))
- color2 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
-
- if (color2 == null) {
- color2 = "#000000";
- }
-
- color = HtmlColor.decode(color2);
- zipper.addColor(color);
-
- String color3 = (String) skin.getParameter(context, borderSkinParam);
- if (null == color3 || "".equals(color3))
- color3 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
-
- if (color3 == null) {
- color3 = "#000000";
- }
-
- color = HtmlColor.decode(color3);
- zipper.addColor(color);
-
- return ret;
- }
-
- protected Object deserializeData(byte[] objectArray) {
- if (objectArray == null) {
- return null;
- }
-
- Zipper2 zipper = new Zipper2(objectArray);
-
- return new Color[] {zipper.nextColor(), zipper.nextColor(), zipper.nextColor()};
- }
-
- public boolean isCacheable() {
- return true;
- }
-
-}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -30,7 +30,7 @@
* @author Siarhej Chalipau
*
*/
-public class OrderingListIconBottom extends OrderingListIconBase {
+public class OrderingListIconBottom extends TriangleIconBase {
protected void paintImage(ResourceContext context, Graphics2D g2d,
Color textColor, Color borderColor) {
Deleted: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -1,49 +0,0 @@
-/**
- * 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 java.awt.Color;
-import java.awt.Graphics2D;
-
-import org.ajax4jsf.resource.ResourceContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconDown extends OrderingListIconBase {
-
- protected void paintImage(ResourceContext context, Graphics2D g2d,
- Color textColor, Color borderColor) {
-
- g2d.setColor(textColor);
- g2d.translate(7, 5);
- paintBaseTriangle(g2d);
- g2d.translate(-7, -5);
-
- g2d.setColor(borderColor);
- g2d.drawLine(4, 5, 10, 5);
- g2d.drawLine(11, 6, 7, 10);
- g2d.drawLine(7, 10, 3, 6);
- }
-
-}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -27,7 +27,7 @@
* @author Siarhej Chalipau
*
*/
-public class OrderingListIconDownDisabled extends OrderingListIconDown {
+public class OrderingListIconDownDisabled extends TriangleIconDown {
protected Object getDataToStore(FacesContext context, Object data) {
return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
}
Deleted: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -1,44 +0,0 @@
-/**
- * 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 java.awt.Color;
-import java.awt.Graphics2D;
-
-import org.ajax4jsf.resource.ResourceContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconUp extends OrderingListIconDown {
-
- protected void paintImage(ResourceContext context, Graphics2D g2d,
- Color textColor, Color borderColor) {
-
- g2d.translate(0, 14);
- g2d.scale(1, -1);
-
- super.paintImage(context, g2d, textColor, borderColor);
- }
-
-}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -27,7 +27,7 @@
* @author Siarhej Chalipau
*
*/
-public class OrderingListIconUpDisabled extends OrderingListIconUp {
+public class OrderingListIconUpDisabled extends TriangleIconUp {
protected Object getDataToStore(FacesContext context, Object data) {
return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
}
Modified: trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java
===================================================================
--- trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java 2008-02-20 14:28:14 UTC (rev 6209)
+++ trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java 2008-02-20 14:41:57 UTC (rev 6210)
@@ -63,8 +63,8 @@
javaScripts.add("scripts/OrderingList.js");
javaScripts.add("scripts/ListBase.js");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUp");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconDown");
+ imageClasses.add("org.richfaces.renderkit.html.images.TriangleIconUp");
+ imageClasses.add("org.richfaces.renderkit.html.images.TriangleIconDown");
imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconTop");
imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconBottom");
imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUpDisabled");
18 years, 2 months
JBoss Rich Faces SVN: r6209 - in trunk/ui/combobox/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-02-20 09:28:14 -0500 (Wed, 20 Feb 2008)
New Revision: 6209
Added:
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js
Modified:
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
trunk/ui/combobox/src/main/templates/combobox.jspx
Log:
class for combolist is added
Modified: trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
--- trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-02-20 14:26:47 UTC (rev 6208)
+++ trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-02-20 14:28:14 UTC (rev 6209)
@@ -351,428 +351,7 @@
}
};
-Richfaces.ComboBoxList = Class.create();
-Richfaces.ComboBoxList.prototype = {
-
- initialize: function(listId, parentListId, selectFirstOnUpdate, classes, width, height, itemsText, onlistcall, fieldId, shadowId,
- showDelay, hideDelay) {
-
- this.list = $(listId);
- this.listParent = $(parentListId);
- //this.iframe = $(iframeId);
- this.iframe = null;
- this.fieldElem = $(fieldId);
- this.itemsText = itemsText;
- this.shadowElem = $(shadowId);
- this.onlistcall = onlistcall;
-
- if (this.onlistcall) {
- this.listParent.observe("rich:onlistcall", this.onlistcall);
- }
-
- this.selectFirstOnUpdate = selectFirstOnUpdate;
- this.classes = classes;
- this.isList = false;
-
- this.defaultRowsAmount = 15;
-
- this.selectedItem = null;
- this.activeItem = null;
-
- this.showDelay = showDelay;
- this.hideDelay = hideDelay;
-
- this.width = width;
- this.height = height;
-
- this.initDimensions();
-
- },
-
- initDimensions : function() {
- this.listParent.style.visibility = "hidden";
- this.listParent.show();
-
- var el = this.listParent.childNodes[1].firstChild;
- this.LAYOUT_BORDER_V = Richfaces.getBorderWidth(el, "tb");
- this.LAYOUT_BORDER_H = Richfaces.getBorderWidth(el, "lr");
- this.LAYOUT_PADDING_V = Richfaces.getPaddingWidth(el, "tb");
- this.LAYOUT_PADDING_H = Richfaces.getPaddingWidth(el, "lr");
-
- this.listParent.hide();
- this.listParent.style.visibility = "visible";
- },
-
- createDefaultList : function() {
- var items = new Array();
- for (var i = 0; i < this.itemsText.length; i++) {
- items.push(this.createItem(this.itemsText[i], this.classes.ITEM.NORMAL));
- }
- this.createNewList(items);
- },
-
- getItems : function() {
- return this.list.childNodes;
- },
-
- showWithDelay : function() {
- this.show();
- /*setTimeout(function(){
- this.show();
- }.bind(this), this.showDelay);*/
- },
-
- show : function() {
- this.fieldDimensions = Richfaces.ComboBoxList.getElemXY(this.fieldElem);
- this.fieldDimensions.height = this.fieldElem.parentNode.offsetHeight;
- this.setSize();
- this.setPosition(this.fieldDimensions.top, this.fieldDimensions.left, this.fieldDimensions.height);
-
- if (this.selectedItem) {
- //was created new item list, so necessary to recreate selectedItem
- this.doSelectItem(this.findItemBySubstr(this.selectedItem.innerHTML));
- }
-
- if (this.selectFirstOnUpdate) {
- var curItems = this.getItems();
- if (curItems.length != 0) {
- if (this.selectedItem) {
- this.doActiveItem(this.selectedItem);
- } else {
- this.doActiveItem(curItems[0]);
- }
- }
- }
- if (this.iframe) {
- this.iframe.show();
- }
- this.listParent.show();
- this.listParent.fire("rich:onlistcall", {});
-
- },
-
- hideWithDelay : function() {
- /*setTimeout(function(){
- this.hide();
- }.bind(this), this.hideDelay);*/
- this.hide();
- },
-
- hide : function() {
- this.resetState();
- if (this.iframe) {
- this.iframe.hide();
- }
- this.listParent.hide();
- },
-
- visible : function() {
- return this.listParent.visible();
- },
-
- setSize : function() {
- var height = this.height;
-
- var currentItemsHeight;
- var rowsAmount;
- var item = this.getItems()[0];
- var actItPars = 0;
- if (item) {
- //FIXME
- this.listParent.style.visibility = "hidden";
- this.listParent.show();
-
- var itemHeight = item.offsetHeight;
-
- this.listParent.hide();
- this.listParent.style.visibility = "visible";
-
- rowsAmount = this.getItems().length;
- currentItemsHeight = itemHeight * rowsAmount;
- }
- if (this.height && (parseInt(this.height) < currentItemsHeight)) {
- if (this.height < currentItemsHeight) {
- height = currentItemsHeight;
- }
- } else {
- if (rowsAmount < this.defaultRowsAmount) {
- height = currentItemsHeight;
- } else {
- height = itemHeight * this.defaultRowsAmount;
- }
- }
- if (Prototype.Browser.IE) {
- height = parseInt(height) + this.LAYOUT_BORDER_V + this.LAYOUT_PADDING_V;
- }
- height = parseInt(height) + "px";
- this.list.style.height = height;
- if (this.iframe) {
- this.iframe.style.height = height;
- }
-
- if (this.shadowElem) {
- if (!Richfaces.browser.isIE6) {
- // shadow offset
- this.shadowElem.style.width = (parseInt(this.width) + 7) + "px";
- this.shadowElem.style.height = (parseInt(height) + 9)+ "px";
- } else {
- this.shadowElem.style.visibility = "hidden";
- }
- }
-
- this.setWidth(this.width);
- },
-
- /*setWidth : function(width) {
- var positionElem = this.listParent.childNodes[1];
- var combobox = this.listParent.parentNode;
- combobox.style.width = width;
- if (this.iframe) {
- this.iframe.style.width = width;
- }
- if (Prototype.Browser.Gecko) {
- width = parseInt(width) - Richfaces.getBorderWidth(positionElem.firstChild, "lr") - Richfaces.getPaddingWidth(positionElem.firstChild, "lr") + "px";
- }
- positionElem.firstChild.style.width = width;
- //positionElem.style.width = width;
- this.listParent.style.visibility = "hidden";
- this.listParent.show();
-
- var scrollWidth = Richfaces.getScrollWidth(positionElem.firstChild);
-
- this.listParent.hide();
- this.listParent.style.visibility = "visible";
- var correction = parseInt(width) - scrollWidth;
- if (Prototype.Browser.Gecko) {
- correction -= Richfaces.getBorderWidth(positionElem.firstChild, "lr") + Richfaces.getPaddingWidth(positionElem.firstChild, "lr");
- }
- this.list.style.width = correction + "px";
-
-
- },*/
-
- setWidth : function(width) {
- var positionElem = this.listParent.childNodes[1];
- var combobox = this.listParent.parentNode;
- //positionElem.style.width = width;
- var correction = parseInt(width) - Richfaces.getBorderWidth(positionElem.firstChild, "lr") - Richfaces.getPaddingWidth(positionElem.firstChild, "lr") + "px";
- this.list.style.width = correction;
- combobox.style.width = correction;
- if (this.iframe) {
- this.iframe.style.width = correction;
- }
- },
-
- setPosition : function(fieldTop, fieldLeft, fieldHeight) {
- var docHeight = Richfaces.getDocumentHeight();
- var comBottom = fieldTop + fieldHeight;
- var listHeight = parseInt(this.list.style.height) + Richfaces.getBorderWidth(this.list.parentNode, "tb");
-
- //var top = 0 ;//= -4;
- var top = comBottom;
- if (parseInt(listHeight) > (docHeight - comBottom)) {
- if (fieldTop > (docHeight - comBottom)) {
- top = fieldTop - parseInt(listHeight);
- //var upPos = true;
- }
- }
-
- this.listParent.style.top = top + "px";
- this.listParent.style.left = fieldLeft + "px";
-
- /*if (!upPos) {
- top = Richfaces.ComboBoxList.getElemXY(this.listParent).top + this.fieldDimensions.height;
- }*/
- if (this.iframe) {
- this.iframe.style.top = top + "px";
- this.iframe.style.left = fieldLeft + "px";
- }
- },
-
- scrolling : function(event) {
- var increment;
- var scrollElem = this.list;
- var listTop = Richfaces.ComboBoxList.getElemXY(scrollElem).top;
- var scrollTop = scrollElem.scrollTop;
- var itemTop = Richfaces.ComboBoxList.getElemXY(this.activeItem).top;
-
- if ((event.keyCode == Event.KEY_UP) || (event.keyCode == 33)) {
- increment = (itemTop - scrollTop) - listTop;
- if (increment < 0) {
- scrollElem.scrollTop += increment;
- }
- } else if ((event.keyCode == Event.KEY_DOWN) || (event.keyCode == 34)) {
- var itemBottom = itemTop + this.activeItem.offsetHeight;
- var increment = (itemBottom - scrollTop) - (listTop + scrollElem.clientHeight);
- if (increment > 0) {
- scrollElem.scrollTop += increment;
- }
- }
- Event.stop(event);
- },
-
- scrollingUpToItem : function(item) {
- var scrollElem = this.list;
- var increment = (Richfaces.ComboBoxList.getElemXY(item).top - scrollElem.scrollTop) - Richfaces.ComboBoxList.getElemXY(scrollElem).top;
- scrollElem.scrollTop += increment;
- },
-
- /* items library*/
- doActiveItem : function(item) {
- if (this.activeItem) {
- this.doNormalItem(this.activeItem);
- }
-
- this.activeItem = item;
-
- this.changeItem(item, this.classes.ITEM.SELECTED);
- },
-
- doNormalItem : function(item) {
- this.activeItem = null;
- this.changeItem(item, this.classes.ITEM.NORMAL);
- },
-
- doSelectItem : function(item) {
- this.selectedItem = item;
- },
-
- changeItem : function(item, className) {
- item.className = className;
- },
-
- getEventItem : function(event) {
- var item = Event.findElement(event, "span");
- /*if ((item == null) || (item.id == this.listParent.id) || (item.id == this.list.id)) {
- return;
- }*/
- return item;
- },
-
- moveActiveItem : function(event) {
- var item = this.activeItem;
- if (!this.activeItem) {
- return;
- }
- if (event.keyCode == Event.KEY_UP) {
- var prevItem = item.previousSibling;
- if (prevItem) {
- this.itemsRearrangement(item, prevItem);
- }
- } else if (event.keyCode == Event.KEY_DOWN) {
- var nextItem = item.nextSibling;
- if (nextItem) {
- this.itemsRearrangement(item, nextItem);
- }
- }
- this.scrolling(event);
- },
-
- itemsRearrangement : function(item, newItem) {
- this.doActiveItem(newItem);
- },
-
- resetState : function() {
- var tempList = this.list.cloneNode(false);
- this.listParent.childNodes[1].firstChild.replaceChild(tempList, this.list);
- this.list = $(tempList.id);
- this.activeItem = null;
- this.isList = false;
- },
-
- dataFilter : function(text) {
- this.createNewList(this.getFilteredItems(text));
- },
-
- getFilteredItems : function(text) {
- var items = new Array();
- for (var i = 0; i < this.itemsText.length; i++) {
- var itText = this.itemsText[i];
- if (itText.substr(0, text.length).toLowerCase() == text.toLowerCase()) { //FIXME: to optimaize
- items.push(this.createItem(itText, this.classes.ITEM.NORMAL));
- }
- }
- return items;
- },
-
- findItemBySubstr : function(substr) {
- var items = this.getItems();
- for (var i = 0; i < items.length; i++) {
- var item = items[i]
- var itText = item.innerHTML;
- if (itText.substr(0, substr.length).toLowerCase() == substr.toLowerCase()) { //FIXME: to optimaize
- return item;
- }
- }
- },
-
- createNewList : function(items) {
- //FIX for FF
- if (this.selectedItem) {
- var text = this.selectedItem.innerHTML;
- }
- this.list.innerHTML = items.join("");
- //was created new item list, so necessary to recreate selectedItem
- if (this.selectedItem) {
- var item = this.findItemBySubstr(text);
- if (item) {
- this.doSelectItem(item);
- }
- }
- },
-
- createItem : function(text, className) {
- return "<span class=\"" + className+ "\">" + text + "</span>";
- },
-
- createIframe : function(parentElem, width, comboboxId, classes) {
- var iframe = document.createElement("iframe");
-
- iframe.id = "iframe" + comboboxId;
-
- iframe.style.display = "none";
- iframe.frameBorder="0";
- iframe.scrolling="no";
-// iframe.style.backgroundColor="#FFFFFF";
-
- iframe.style.width = width;
- iframe.style.zIndex = "2";
-
- iframe.className = classes;
-
- parentElem.appendChild(iframe);
- this.iframe = $(iframe.id);
- }
-}
-
-Richfaces.ComboBoxList.getElemXY = function(elem) {
-
- // for FF support
- /*var originalVisibility = elem.style.visibility;
- var originalPosition = elem.style.position;
- var originalDisplay = elem.style.display;
-
- elem.style.visibility = 'hidden';
- elem.style.position = 'absolute';
- elem.style.display = 'block';*/
-
- var x = elem.offsetLeft;
- var y = elem.offsetTop;
-
-
- for (var parent = Element.getOffsetParent(elem); parent != document.body; parent = Element.getOffsetParent(parent)) {
- x += parent.offsetLeft;
- y += parent.offsetTop;
- }
-
- /*elem.style.display = originalDisplay;
- elem.style.visibility = originalVisibility;
- elem.style.position = originalPosition;*/
-
- return {left: x, top: y};
-}
-
Richfaces.ComboBox.textboxSelect = function(oTextbox, iStart, iEnd) {
if (Prototype.Browser.IE) {
var oRange = oTextbox.createTextRange();
Added: trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js
===================================================================
--- trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js (rev 0)
+++ trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js 2008-02-20 14:28:14 UTC (rev 6209)
@@ -0,0 +1,422 @@
+if(!window.Richfaces) window.Richfaces = {};
+Richfaces.ComboBoxList = Class.create();
+Richfaces.ComboBoxList.prototype = {
+
+ initialize: function(listId, parentListId, selectFirstOnUpdate, classes, width, height, itemsText, onlistcall, fieldId, shadowId,
+ showDelay, hideDelay) {
+
+ this.list = $(listId);
+ this.listParent = $(parentListId);
+ //this.iframe = $(iframeId);
+ this.iframe = null;
+ this.fieldElem = $(fieldId);
+ this.itemsText = itemsText;
+ this.shadowElem = $(shadowId);
+ this.onlistcall = onlistcall;
+
+ if (this.onlistcall) {
+ this.listParent.observe("rich:onlistcall", this.onlistcall);
+ }
+
+ this.selectFirstOnUpdate = selectFirstOnUpdate;
+ this.classes = classes;
+ this.isList = false;
+
+ this.defaultRowsAmount = 15;
+
+ this.selectedItem = null;
+ this.activeItem = null;
+
+ this.showDelay = showDelay;
+ this.hideDelay = hideDelay;
+
+ this.width = width;
+ this.height = height;
+
+ this.initDimensions();
+
+ },
+
+ initDimensions : function() {
+ this.listParent.style.visibility = "hidden";
+ this.listParent.show();
+
+ var el = this.listParent.childNodes[1].firstChild;
+ this.LAYOUT_BORDER_V = Richfaces.getBorderWidth(el, "tb");
+ this.LAYOUT_BORDER_H = Richfaces.getBorderWidth(el, "lr");
+ this.LAYOUT_PADDING_V = Richfaces.getPaddingWidth(el, "tb");
+ this.LAYOUT_PADDING_H = Richfaces.getPaddingWidth(el, "lr");
+
+ this.listParent.hide();
+ this.listParent.style.visibility = "visible";
+ },
+
+ createDefaultList : function() {
+ var items = new Array();
+ for (var i = 0; i < this.itemsText.length; i++) {
+ items.push(this.createItem(this.itemsText[i], this.classes.ITEM.NORMAL));
+ }
+ this.createNewList(items);
+ },
+
+ getItems : function() {
+ return this.list.childNodes;
+ },
+
+ showWithDelay : function() {
+ this.show();
+ /*setTimeout(function(){
+ this.show();
+ }.bind(this), this.showDelay);*/
+ },
+
+ show : function() {
+ this.fieldDimensions = Richfaces.ComboBoxList.getElemXY(this.fieldElem);
+ this.fieldDimensions.height = this.fieldElem.parentNode.offsetHeight;
+
+ this.setSize();
+ this.setPosition(this.fieldDimensions.top, this.fieldDimensions.left, this.fieldDimensions.height);
+
+ if (this.selectedItem) {
+ //was created new item list, so necessary to recreate selectedItem
+ this.doSelectItem(this.findItemBySubstr(this.selectedItem.innerHTML));
+ }
+
+ if (this.selectFirstOnUpdate) {
+ var curItems = this.getItems();
+ if (curItems.length != 0) {
+ if (this.selectedItem) {
+ this.doActiveItem(this.selectedItem);
+ } else {
+ this.doActiveItem(curItems[0]);
+ }
+ }
+ }
+ if (this.iframe) {
+ this.iframe.show();
+ }
+ this.listParent.show();
+ this.listParent.fire("rich:onlistcall", {});
+
+ },
+
+ hideWithDelay : function() {
+ /*setTimeout(function(){
+ this.hide();
+ }.bind(this), this.hideDelay);*/
+ this.hide();
+ },
+
+ hide : function() {
+ this.resetState();
+ if (this.iframe) {
+ this.iframe.hide();
+ }
+ this.listParent.hide();
+ },
+
+ visible : function() {
+ return this.listParent.visible();
+ },
+
+ setSize : function() {
+ var height = this.height;
+
+ var currentItemsHeight;
+ var rowsAmount;
+ var item = this.getItems()[0];
+ var actItPars = 0;
+ if (item) {
+ //FIXME
+ this.listParent.style.visibility = "hidden";
+ this.listParent.show();
+
+ var itemHeight = item.offsetHeight;
+
+ this.listParent.hide();
+ this.listParent.style.visibility = "visible";
+
+ rowsAmount = this.getItems().length;
+ currentItemsHeight = itemHeight * rowsAmount;
+ }
+ if (this.height && (parseInt(this.height) < currentItemsHeight)) {
+ if (this.height < currentItemsHeight) {
+ height = currentItemsHeight;
+ }
+ } else {
+ if (rowsAmount < this.defaultRowsAmount) {
+ height = currentItemsHeight;
+ } else {
+ height = itemHeight * this.defaultRowsAmount;
+ }
+ }
+ if (Prototype.Browser.IE) {
+ height = parseInt(height) + this.LAYOUT_BORDER_V + this.LAYOUT_PADDING_V;
+ }
+ height = parseInt(height) + "px";
+ this.list.style.height = height;
+ if (this.iframe) {
+ this.iframe.style.height = height;
+ }
+
+ if (this.shadowElem) {
+ if (!Richfaces.browser.isIE6) {
+ // shadow offset
+ this.shadowElem.style.width = (parseInt(this.width) + 7) + "px";
+ this.shadowElem.style.height = (parseInt(height) + 9)+ "px";
+ } else {
+ this.shadowElem.style.visibility = "hidden";
+ }
+ }
+
+ this.setWidth(this.width);
+ },
+
+ /*setWidth : function(width) {
+ var positionElem = this.listParent.childNodes[1];
+ var combobox = this.listParent.parentNode;
+ combobox.style.width = width;
+ if (this.iframe) {
+ this.iframe.style.width = width;
+ }
+ if (Prototype.Browser.Gecko) {
+ width = parseInt(width) - Richfaces.getBorderWidth(positionElem.firstChild, "lr") - Richfaces.getPaddingWidth(positionElem.firstChild, "lr") + "px";
+ }
+ positionElem.firstChild.style.width = width;
+ //positionElem.style.width = width;
+ this.listParent.style.visibility = "hidden";
+ this.listParent.show();
+
+ var scrollWidth = Richfaces.getScrollWidth(positionElem.firstChild);
+
+ this.listParent.hide();
+ this.listParent.style.visibility = "visible";
+ var correction = parseInt(width) - scrollWidth;
+ if (Prototype.Browser.Gecko) {
+ correction -= Richfaces.getBorderWidth(positionElem.firstChild, "lr") + Richfaces.getPaddingWidth(positionElem.firstChild, "lr");
+ }
+ this.list.style.width = correction + "px";
+
+
+ },*/
+
+ setWidth : function(width) {
+ var positionElem = this.listParent.childNodes[1];
+ var combobox = this.listParent.parentNode;
+ //positionElem.style.width = width;
+ var correction = parseInt(width) - Richfaces.getBorderWidth(positionElem.firstChild, "lr") - Richfaces.getPaddingWidth(positionElem.firstChild, "lr") + "px";
+ this.list.style.width = correction;
+ combobox.style.width = correction;
+ if (this.iframe) {
+ this.iframe.style.width = correction;
+ }
+ },
+
+ setPosition : function(fieldTop, fieldLeft, fieldHeight) {
+ var docHeight = Richfaces.getDocumentHeight();
+ var comBottom = fieldTop + fieldHeight;
+ var listHeight = parseInt(this.list.style.height) + Richfaces.getBorderWidth(this.list.parentNode, "tb");
+
+ //var top = 0 ;//= -4;
+ var top = comBottom;
+ if (parseInt(listHeight) > (docHeight - comBottom)) {
+ if (fieldTop > (docHeight - comBottom)) {
+ top = fieldTop - parseInt(listHeight);
+ //var upPos = true;
+ }
+ }
+
+ this.listParent.style.top = top + "px";
+ this.listParent.style.left = fieldLeft + "px";
+
+ /*if (!upPos) {
+ top = Richfaces.ComboBoxList.getElemXY(this.listParent).top + this.fieldDimensions.height;
+ }*/
+ if (this.iframe) {
+ this.iframe.style.top = top + "px";
+ this.iframe.style.left = fieldLeft + "px";
+ }
+ },
+
+ scrolling : function(event) {
+ var increment;
+ var scrollElem = this.list;
+ var listTop = Richfaces.ComboBoxList.getElemXY(scrollElem).top;
+ var scrollTop = scrollElem.scrollTop;
+ var itemTop = Richfaces.ComboBoxList.getElemXY(this.activeItem).top;
+
+ if ((event.keyCode == Event.KEY_UP) || (event.keyCode == 33)) {
+ increment = (itemTop - scrollTop) - listTop;
+ if (increment < 0) {
+ scrollElem.scrollTop += increment;
+ }
+ } else if ((event.keyCode == Event.KEY_DOWN) || (event.keyCode == 34)) {
+ var itemBottom = itemTop + this.activeItem.offsetHeight;
+ var increment = (itemBottom - scrollTop) - (listTop + scrollElem.clientHeight);
+ if (increment > 0) {
+ scrollElem.scrollTop += increment;
+ }
+ }
+ Event.stop(event);
+ },
+
+ scrollingUpToItem : function(item) {
+ var scrollElem = this.list;
+ var increment = (Richfaces.ComboBoxList.getElemXY(item).top - scrollElem.scrollTop) - Richfaces.ComboBoxList.getElemXY(scrollElem).top;
+ scrollElem.scrollTop += increment;
+ },
+
+ /* items library*/
+ doActiveItem : function(item) {
+ if (this.activeItem) {
+ this.doNormalItem(this.activeItem);
+ }
+
+ this.activeItem = item;
+
+ this.changeItem(item, this.classes.ITEM.SELECTED);
+ },
+
+ doNormalItem : function(item) {
+ this.activeItem = null;
+ this.changeItem(item, this.classes.ITEM.NORMAL);
+ },
+
+ doSelectItem : function(item) {
+ this.selectedItem = item;
+ },
+
+ changeItem : function(item, className) {
+ item.className = className;
+ },
+
+ getEventItem : function(event) {
+ var item = Event.findElement(event, "span");
+ /*if ((item == null) || (item.id == this.listParent.id) || (item.id == this.list.id)) {
+ return;
+ }*/
+ return item;
+ },
+
+ moveActiveItem : function(event) {
+ var item = this.activeItem;
+ if (!this.activeItem) {
+ return;
+ }
+ if (event.keyCode == Event.KEY_UP) {
+ var prevItem = item.previousSibling;
+ if (prevItem) {
+ this.itemsRearrangement(item, prevItem);
+ }
+ } else if (event.keyCode == Event.KEY_DOWN) {
+ var nextItem = item.nextSibling;
+ if (nextItem) {
+ this.itemsRearrangement(item, nextItem);
+ }
+ }
+ this.scrolling(event);
+ },
+
+ itemsRearrangement : function(item, newItem) {
+ this.doActiveItem(newItem);
+ },
+
+ resetState : function() {
+ var tempList = this.list.cloneNode(false);
+ this.listParent.childNodes[1].firstChild.replaceChild(tempList, this.list);
+ this.list = $(tempList.id);
+ this.activeItem = null;
+ this.isList = false;
+ },
+
+ dataFilter : function(text) {
+ this.createNewList(this.getFilteredItems(text));
+ },
+
+ getFilteredItems : function(text) {
+ var items = new Array();
+ for (var i = 0; i < this.itemsText.length; i++) {
+ var itText = this.itemsText[i];
+ if (itText.substr(0, text.length).toLowerCase() == text.toLowerCase()) { //FIXME: to optimaize
+ items.push(this.createItem(itText, this.classes.ITEM.NORMAL));
+ }
+ }
+ return items;
+ },
+
+ findItemBySubstr : function(substr) {
+ var items = this.getItems();
+ for (var i = 0; i < items.length; i++) {
+ var item = items[i]
+ var itText = item.innerHTML;
+ if (itText.substr(0, substr.length).toLowerCase() == substr.toLowerCase()) { //FIXME: to optimaize
+ return item;
+ }
+ }
+ },
+
+ createNewList : function(items) {
+ //FIX for FF
+ if (this.selectedItem) {
+ var text = this.selectedItem.innerHTML;
+ }
+ this.list.innerHTML = items.join("");
+ //was created new item list, so necessary to recreate selectedItem
+ if (this.selectedItem) {
+ var item = this.findItemBySubstr(text);
+ if (item) {
+ this.doSelectItem(item);
+ }
+ }
+ },
+
+ createItem : function(text, className) {
+ return "<span class=\"" + className+ "\">" + text + "</span>";
+ },
+
+ createIframe : function(parentElem, width, comboboxId, classes) {
+ var iframe = document.createElement("iframe");
+
+ iframe.id = "iframe" + comboboxId;
+
+ iframe.style.display = "none";
+ iframe.frameBorder="0";
+ iframe.scrolling="no";
+// iframe.style.backgroundColor="#FFFFFF";
+
+ iframe.style.width = width;
+ iframe.style.zIndex = "2";
+
+ iframe.className = classes;
+
+ parentElem.appendChild(iframe);
+ this.iframe = $(iframe.id);
+ }
+}
+
+Richfaces.ComboBoxList.getElemXY = function(elem) {
+
+ // for FF support
+ /*var originalVisibility = elem.style.visibility;
+ var originalPosition = elem.style.position;
+ var originalDisplay = elem.style.display;
+
+ elem.style.visibility = 'hidden';
+ elem.style.position = 'absolute';
+ elem.style.display = 'block';*/
+
+ var x = elem.offsetLeft;
+ var y = elem.offsetTop;
+
+
+ for (var parent = Element.getOffsetParent(elem); parent != document.body; parent = Element.getOffsetParent(parent)) {
+ x += parent.offsetLeft;
+ y += parent.offsetTop;
+ }
+
+ /*elem.style.display = originalDisplay;
+ elem.style.visibility = originalVisibility;
+ elem.style.position = originalPosition;*/
+
+ return {left: x, top: y};
+}
Modified: trunk/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/ui/combobox/src/main/templates/combobox.jspx 2008-02-20 14:26:47 UTC (rev 6208)
+++ trunk/ui/combobox/src/main/templates/combobox.jspx 2008-02-20 14:28:14 UTC (rev 6209)
@@ -16,6 +16,7 @@
<h:scripts>
new org.ajax4jsf.javascript.PrototypeScript(),
scripts/comboboxUtils.js,
+ scripts/combolist.js,
scripts/combobox.js,
/org/richfaces/renderkit/html/scripts/utils.js
</h:scripts>
18 years, 2 months
JBoss Rich Faces SVN: r6208 - in trunk/sandbox/ui/inplaceSelect/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-02-20 09:26:47 -0500 (Wed, 20 Feb 2008)
New Revision: 6208
Added:
trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js
Modified:
trunk/sandbox/ui/inplaceSelect/src/main/config/component/inplaceselect.xml
trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
list positioning for select
Modified: trunk/sandbox/ui/inplaceSelect/src/main/config/component/inplaceselect.xml
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/config/component/inplaceselect.xml 2008-02-20 14:20:04 UTC (rev 6207)
+++ trunk/sandbox/ui/inplaceSelect/src/main/config/component/inplaceselect.xml 2008-02-20 14:26:47 UTC (rev 6208)
@@ -110,6 +110,18 @@
<name>value</name>
<classname>java.lang.String</classname>
</property>
+
+ <property>
+ <name>listWidth</name>
+ <classname>java.lang.String</classname>
+ <description></description>
+ </property>
+ <property>
+ <name>listHeight</name>
+ <classname>java.lang.String</classname>
+ <description></description>
+ <defaultvalue>"200px"</defaultvalue>
+ </property>
</properties>
</component>
</components>
Added: trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js (rev 0)
+++ trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js 2008-02-20 14:26:47 UTC (rev 6208)
@@ -0,0 +1,26 @@
+if(!window.Richfaces) window.Richfaces = {};
+Richfaces.InplaceSelectList = Class.create(Richfaces.ComboBoxList, {
+ initialize : function($super, listId, parentListId, selectFirstOnUpdate, classes, width, height, itemsText, onlistcall, fieldId, shadowId,
+ showDelay, hideDelay) {
+ $super(listId, parentListId, selectFirstOnUpdate, classes, width, height, itemsText, onlistcall, fieldId, shadowId,
+ showDelay, hideDelay);
+ },
+
+ setPosition : function($super, fieldTop, fieldLeft, fieldHeight) {
+ var field = this.fieldElem;
+
+ //field.style.visibility = "hidden";
+ field.show();
+ var height = field.offsetHeight;
+ //field.hide();
+ //field.style.visibility = "visible";
+
+ this.listParent.style.top = height + "px";
+ this.listParent.style.left = 0 + "px";
+
+ if (this.iframe) {
+ this.iframe.style.top = 0 + "px";
+ this.iframe.style.left = 0 + "px";
+ }
+ }
+});
Modified: trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-20 14:20:04 UTC (rev 6207)
+++ trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-20 14:26:47 UTC (rev 6208)
@@ -15,8 +15,9 @@
<h:scripts>
new org.ajax4jsf.javascript.PrototypeScript(),
scripts/comboboxUtils.js,
- scripts/combobox.js,
+ scripts/combolist.js,
scripts/inplaceinput.js,
+ scripts/inplaceselectlist.js,
scripts/inplaceselect.js,
/org/richfaces/renderkit/html/scripts/utils.js
</h:scripts>
@@ -171,9 +172,9 @@
oneditactivated : #{this:getAsEventHandler(context, component, "oneditactivated")},
onviewactivated : #{this:getAsEventHandler(context, component, "onviewactivated")}};
- var richInplaceList = new Richfaces.ComboBoxList('list#{clientId}', 'listParent#{clientId}', false,
- Richfaces.InplaceSelect.CLASSES, '100px', '100px', #{this:getItemsTextAsJSArray(context, component)}, null,
- '#{clientId}inplaceTmpValue', 'shadow#{clientId}', 0, 0);
+ var richInplaceList = new Richfaces.InplaceSelectList('list#{clientId}', 'listParent#{clientId}', false,
+ Richfaces.InplaceSelect.CLASSES, '100px', '100px', #{this:getItemsTextAsJSArray(context, component)}, null,
+ '#{clientId}inplaceTmpValue', 'shadow#{clientId}', 0, 0);
var richInplaceSelect = new Richfaces.InplaceSelect(richInplaceList, '#{clientId}', '#{clientId}inplaceTmpValue',
'#{clientId}inplaceValue', '#{clientId}tabber', '#{clientId}inplaceStrut',
richInplaceSelAttributes, richInplaceSelEvents, Richfaces.InplaceSelect.CLASSES,
18 years, 2 months