JBoss Rich Faces SVN: r6778 - trunk/test-applications/jsp/src/main/webapp/ScrollableDataTable.
by richfaces-svn-commits@lists.jboss.org
Author: ayanul
Date: 2008-03-13 08:50:02 -0400 (Thu, 13 Mar 2008)
New Revision: 6778
Modified:
trunk/test-applications/jsp/src/main/webapp/ScrollableDataTable/ScrollableDataTableProperty.jsp
Log:
+ fix
Modified: trunk/test-applications/jsp/src/main/webapp/ScrollableDataTable/ScrollableDataTableProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ScrollableDataTable/ScrollableDataTableProperty.jsp 2008-03-13 12:49:26 UTC (rev 6777)
+++ trunk/test-applications/jsp/src/main/webapp/ScrollableDataTable/ScrollableDataTableProperty.jsp 2008-03-13 12:50:02 UTC (rev 6778)
@@ -55,7 +55,7 @@
<h:outputText value="sortMode" />
<h:selectOneRadio value="#{sortingAndFiltering.sortMode}" onchange="submit();">
<f:selectItem itemLabel="single" itemValue="single" />
- <f:selectItem itemLabel="multy" itemValue="multy" />
+ <f:selectItem itemLabel="multi" itemValue="multi" />
</h:selectOneRadio>
</h:panelGrid>
<a4j:commandButton value="reRender" reRender="sdt"></a4j:commandButton>
16 years, 10 months
JBoss Rich Faces SVN: r6777 - trunk/test-applications/facelets/src/main/webapp/ScrollableDataTable.
by richfaces-svn-commits@lists.jboss.org
Author: ayanul
Date: 2008-03-13 08:49:26 -0400 (Thu, 13 Mar 2008)
New Revision: 6777
Modified:
trunk/test-applications/facelets/src/main/webapp/ScrollableDataTable/ScrollableDataTableProperty.xhtml
Log:
+ fix
Modified: trunk/test-applications/facelets/src/main/webapp/ScrollableDataTable/ScrollableDataTableProperty.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/ScrollableDataTable/ScrollableDataTableProperty.xhtml 2008-03-13 12:23:11 UTC (rev 6776)
+++ trunk/test-applications/facelets/src/main/webapp/ScrollableDataTable/ScrollableDataTableProperty.xhtml 2008-03-13 12:49:26 UTC (rev 6777)
@@ -51,7 +51,7 @@
<h:outputText value="sortMode" />
<h:selectOneRadio value="#{sortingAndFiltering.sortMode}" onchange="submit();">
<f:selectItem itemLabel="single" itemValue="single" />
- <f:selectItem itemLabel="multy" itemValue="multy" />
+ <f:selectItem itemLabel="multi" itemValue="multi" />
</h:selectOneRadio>
</h:panelGrid>
<a4j:commandButton value="reRender" reRender="sdt"></a4j:commandButton>
16 years, 10 months
JBoss Rich Faces SVN: r6776 - trunk/ui/assembly.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-03-13 08:23:11 -0400 (Thu, 13 Mar 2008)
New Revision: 6776
Modified:
trunk/ui/assembly/pom.xml
Log:
http://jira.jboss.com/jira/browse/RF-2399
Modified: trunk/ui/assembly/pom.xml
===================================================================
--- trunk/ui/assembly/pom.xml 2008-03-13 12:05:46 UTC (rev 6775)
+++ trunk/ui/assembly/pom.xml 2008-03-13 12:23:11 UTC (rev 6776)
@@ -294,6 +294,12 @@
<include>
${project.build.directory}/compressed/org/richfaces/renderkit/html/scripts/ListShuttle-min.js
</include>
+ <include>
+ ${project.build.directory}/compressed/org/richfaces/renderkit/html/scripts/PickListSI-min.js
+ </include>
+ <include>
+ ${project.build.directory}/compressed/org/richfaces/renderkit/html/scripts/PickList-min.js
+ </include>
<include>**/*-min.js</include>
</includes>
<!-- files to exclude, path relative to output's directory -->
16 years, 10 months
JBoss Rich Faces SVN: r6775 - in trunk/ui/fileUpload/src: main/java/org/richfaces/component and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-03-13 08:05:46 -0400 (Thu, 13 Mar 2008)
New Revision: 6775
Modified:
trunk/ui/fileUpload/src/main/config/component/fileUpload.xml
trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
trunk/ui/fileUpload/src/test/java/org/richfaces/component/FileUploadComponentTest.java
Log:
RF-2468
Modified: trunk/ui/fileUpload/src/main/config/component/fileUpload.xml
===================================================================
--- trunk/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-03-13 11:44:06 UTC (rev 6774)
+++ trunk/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-03-13 12:05:46 UTC (rev 6775)
@@ -225,6 +225,34 @@
<name>onerror</name>
<classname>java.lang.String</classname>
</property>
+ <property>
+ <name>addControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>uploadControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>stopControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>cancelEntryControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>clearControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>clearAllControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>stopEntryControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
</component>
&listeners;
</components>
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2008-03-13 11:44:06 UTC (rev 6774)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2008-03-13 12:05:46 UTC (rev 6775)
@@ -1,14 +1,18 @@
package org.richfaces.component;
import java.io.InputStream;
+import java.util.Locale;
import java.util.Map;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
import javax.faces.event.FacesEvent;
import javax.servlet.http.HttpServletRequest;
@@ -109,7 +113,11 @@
public abstract void setStyleClass(String styleClass);
public abstract void setStyle(String style);
+
+ public abstract Object getLocale();
+ public abstract void setLocale(Object locale);
+
public abstract MethodExpression getFileUploadListener();
public abstract void setFileUploadListener(MethodExpression scrollerListener);
@@ -172,4 +180,63 @@
}
}
+
+ /**
+ *Parse Locale from String.
+ *String must be represented as Locale.toString(); xx_XX_XXXX
+*/
+
+ public Locale parseLocale(String localeStr){
+
+ int length = localeStr.length();
+ if(null==localeStr||length<2){
+ return Locale.getDefault();
+ }
+
+ //Lookup index of first '_' in string locale representation.
+ int index1 = localeStr.indexOf("_");
+ //Get first charters (if exist) from string
+ String language = null;
+ if(index1!=-1){
+ language = localeStr.substring(0, index1);
+ }else{
+ return new Locale(localeStr);
+ }
+ //Lookup index of second '_' in string locale representation.
+ int index2 = localeStr.indexOf("_", index1+1);
+ String country = null;
+ if(index2!=-1){
+ country = localeStr.substring(index1+1, index2);
+ String variant = localeStr.substring(index2+1);
+ return new Locale(language, country, variant);
+ }else{
+ country = localeStr.substring(index1+1);
+ return new Locale(language, country);
+ }
+ }
+
+ public Locale getAsLocale(Object locale) {
+
+ if (locale instanceof Locale) {
+
+ return (Locale) locale;
+
+ } else if (locale instanceof String) {
+
+ return parseLocale((String) locale);
+
+ } else {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ Application application = context.getApplication();
+ Converter converter = application
+ .createConverter(locale.getClass());
+ if (null != converter) {
+ return parseLocale(converter.getAsString(context, this, locale));
+ } else {
+ throw new FacesException(
+ "Wrong locale attibute type or there is no converter for custom attibute type");
+ }
+ }
+ }
}
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-03-13 11:44:06 UTC (rev 6774)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-03-13 12:05:46 UTC (rev 6775)
@@ -1,9 +1,12 @@
package org.richfaces.renderkit;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
import javax.el.ValueExpression;
import javax.faces.FactoryFinder;
@@ -13,6 +16,7 @@
import javax.faces.render.RenderKit;
import javax.faces.render.RenderKitFactory;
import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.ajax4jsf.Filter;
@@ -45,17 +49,44 @@
/** Attribute name where collection of files uploaded will be stored */
private static final String _FILES_UPLOADED_ATTRIBUTE_NAME = "uploadData";
-
+
/** Multipart request class name */
- private static final String _MULTIPART_REQUEST_CLASS_NAME = MultipartRequest.class.getName();
+ private static final String _MULTIPART_REQUEST_CLASS_NAME = MultipartRequest.class
+ .getName();
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
+ /** File upload bundle name */
+ private static final String FILE_UPLOAD_BUNDLE = "org.richfaces.renderkit.fileUpload";
+
+ /** Bundle prefix */
+ private static final String bundlePrefix = "RICH_FILE_UPLOAD_";
+
+ /** Bundle postfix */
+ private static final String bundlePostfix = "_LABEL";
+
+ /** Set of bundles that can be defined */
+ private static final String[] bundlesLables = { "add", "upload", "stop",
+ "clear_all", "entry_cancel", "entry_clear", "entry_stop", "done",
+ "size_error", "transfer_error" };
+
+ /** Default labels values */
+ private static final String[] defaultLables = { "Add...", "<b>Upload</b>",
+ "<b>Stop</b>", "Clear All", "Cancel", "Clear", "Stop",
+ "<b>Done</b>", "File size restricted", "Transfer error occuried" };
+
+ /** Set of attributes that can define label's value */
+ private static final String[] labelAttribues = { "addControlLabel",
+ "uploadControlLabel", "stopControlLabel", "clearAllControlLabel",
+ "cancelEntryControlLabel", "clearControlLabel",
+ "stopEntryControlLabel", null, null, null };
+
+
+ /**
+ * Overrides standard JSF component method.
+ * @param context faces context
+ * @param component file upload component
*/
@Override
+ @SuppressWarnings ("unchecked")
protected void doDecode(FacesContext context, UIComponent component) {
UIFileUpload fileUpload = (UIFileUpload) component;
ServletRequest request = (ServletRequest) context.getExternalContext()
@@ -64,19 +95,21 @@
String clientId = component.getClientId(context);
new AjaxEvent(component).queue();
-
+
Class requestClazz = request.getClass();
-
- if (_MULTIPART_REQUEST_CLASS_NAME
- .equals(requestClazz.getName())
- || "org.jboss.seam.web.MultipartRequest".equals(requestClazz.getName())) {
-
- HttpSession session = (HttpSession)context.getExternalContext().getSession(false);
+
+ if (_MULTIPART_REQUEST_CLASS_NAME.equals(requestClazz.getName())
+ || "org.jboss.seam.web.MultipartRequest".equals(requestClazz
+ .getName())) {
+
+ HttpSession session = (HttpSession) context.getExternalContext()
+ .getSession(false);
String uid = request.getParameter(Filter.UPLOAD_FILES_ID);
- Map<String, MultipartRequest> map = (Map<String, MultipartRequest>)session.getAttribute(Filter.REQUESTS_SESSIONS_BEAN_NAME);
-
+ Map<String, MultipartRequest> map = (Map<String, MultipartRequest>) session
+ .getAttribute(Filter.REQUESTS_SESSIONS_BEAN_NAME);
+
MultipartRequest multipartRequest = map.get(uid);
-
+
clientId = clientId + ":file";
String fileName = multipartRequest.getFileName(clientId);
Object file = multipartRequest.getFile(clientId);
@@ -85,7 +118,128 @@
}
}
+
+
+ /**
+ * Generates map with internalized labels to be put into JS
+ * @param o map of labels
+ * @return javascript hash map
+ */
+ public Object _getLabels(Object o) {
+ return ScriptUtils.toScript(o);
+ }
+
+
+ /**
+ * Gets internalized labels.
+ * At the first system is looking for them in appropriate attributes if they are defined.
+ * Next search place is application and file upload bundles.
+ * If no result - default label value will be set up.
+ * @param context facesContext instance
+ * @param component UIComponent
+ * @return map of labels
+ */
+ public Map<String, String> getLabels(FacesContext context,
+ UIComponent component) {
+ Map<String, String> labelsMap = new HashMap<String, String>();
+ ResourceBundle bundle1 = null;
+ ResourceBundle bundle2 = null;
+ UIFileUpload fileUpload = (UIFileUpload) component;
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ String messageBundle = context.getApplication().getMessageBundle();
+ Object locale = fileUpload.getLocale();
+ if (locale == null) {
+ HttpServletRequest request = (HttpServletRequest) context
+ .getExternalContext().getRequest();
+ locale = request.getLocale();
+ }
+ if (null != messageBundle) {
+ bundle1 = ResourceBundle.getBundle(messageBundle, fileUpload
+ .getAsLocale(locale), loader);
+ }
+ try {
+ bundle2 = ResourceBundle.getBundle(FILE_UPLOAD_BUNDLE, fileUpload
+ .getAsLocale(locale), loader);
+ } catch (MissingResourceException e) {
+ // No external bundle was found, ignore this exception.
+ }
+ initLabels(labelsMap, bundle1, bundle2, fileUpload);
+ return labelsMap;
+ }
+
+
+ /**
+ * Sets values for labels.
+ * @param map map of labels
+ * @param bundle1 application bundle
+ * @param bundle2 file upload bundle
+ * @param fileUpload
+ */
+ private void initLabels(Map<String, String> map, ResourceBundle bundle1,
+ ResourceBundle bundle2, UIFileUpload fileUpload) {
+ int i = 0;
+ for (String name : bundlesLables) {
+ boolean found = false;
+ if (labelAttribues[i] != null) {
+ String attributeName = labelAttribues[i];
+ if (fileUpload.getAttributes().get(attributeName) != null) {
+ map.put(name, (String) fileUpload.getAttributes().get(
+ attributeName));
+ found = true;
+ }
+ }
+ if (!found && (bundle1 != null || bundle2 != null)) {
+ String label = getFromBundle(name, bundle1, bundle2);
+ if (label != null) {
+ map.put(name, getFromBundle(name, bundle1, bundle2));
+ found = true;
+ }
+ }
+ if (!found) {
+ map.put(name, defaultLables[i]);
+ }
+ i++;
+ }
+ }
+
+ /**
+ * Looking for labels name in bundles provided.
+ * @param bundle1 application bundle
+ * @param bundle2 file upload bundle
+ * @return String label value
+ */
+ private String getFromBundle(String name, ResourceBundle bundle1,
+ ResourceBundle bundle2) {
+ name = bundlePrefix + name.toUpperCase() + bundlePostfix;
+ String v = null;
+ if (bundle1 != null) {
+ try {
+ v = bundle1.getString(name);
+ } catch (Exception e) {
+ if (bundle2 != null) {
+ try {
+ v = bundle2.getString(name);
+ } catch (Exception ex) {
+ // no value has been found
+ }
+ }
+
+ }
+
+ } else if (bundle2 != null) {
+ try {
+ v = bundle2.getString(name);
+ ByteArrayOutputStream b = new ByteArrayOutputStream();
+ b.write(v.getBytes());
+ b.toString("UTF-8");
+ } catch (Exception e) {
+ // no value has been found
+ }
+ }
+ return v;
+ }
+
/**
* Method checks if uploaded files count overflowed
*
Modified: trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
--- trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-03-13 11:44:06 UTC (rev 6774)
+++ trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-03-13 12:05:46 UTC (rev 6775)
@@ -1,6 +1,24 @@
FileUploadEntry = {};
FileUploadEntry = Class.create();
+
+FileUploadEntry.INITIALIZED = "initialized";
+FileUploadEntry.READY = "ready";
+FileUploadEntry.UPLOAD_IN_PROGRESS = "progress";
+
+FileUploadEntry.UPLOAD_CANCELED = "canceled";
+FileUploadEntry.UPLOAD_SUCCESS = "done";
+FileUploadEntry.UPLOAD_TRANSFER_ERROR = "transfer_error";
+FileUploadEntry.UPLOAD_SERVER_ERROR = "server_error";
+FileUploadEntry.UPLOAD_SIZE_ERROR = "size_error";
+
+FileUploadEntry.LABELS = {};
+FileUploadEntry.LABELS[FileUploadEntry.INITIALIZED] = '';
+FileUploadEntry.LABELS[FileUploadEntry.READY] = '';
+FileUploadEntry.LABELS[FileUploadEntry.UPLOAD_IN_PROGRESS] = 'uploading';
+FileUploadEntry.LABELS[FileUploadEntry.UPLOAD_CANCELED] = '';
+
+
FileUploadEntry.clearControlTemplate =
[
new E('a',
@@ -11,7 +29,7 @@
'href':'#'
},
[
- new T('Clear')
+ new T(function (context) {return Richfaces.evalMacro("controlLink", context);} )
])
];
@@ -25,7 +43,7 @@
'href':'#'
},
[
- new T('Stop')
+ new T(function (context) {return Richfaces.evalMacro("controlLink", context);} )
])
];
@@ -39,7 +57,7 @@
'href':'#'
},
[
- new T('Cancel')
+ new T(function (context) {return Richfaces.evalMacro("controlLink", context);} )
])
];
@@ -81,26 +99,7 @@
];
-FileUploadEntry.INITIALIZED = "initialized";
-FileUploadEntry.READY = "ready";
-FileUploadEntry.UPLOAD_IN_PROGRESS = "progress";
-FileUploadEntry.UPLOAD_CANCELED = "canceled";
-FileUploadEntry.UPLOAD_SUCCESS = "success";
-FileUploadEntry.UPLOAD_TRANSFER_ERROR = "transfer_error";
-FileUploadEntry.UPLOAD_SERVER_ERROR = "server_error";
-FileUploadEntry.UPLOAD_SIZE_ERROR = "size_error";
-
-FileUploadEntry.LABELS = {};
-FileUploadEntry.LABELS[FileUploadEntry.INITIALIZED] = '';
-FileUploadEntry.LABELS[FileUploadEntry.READY] = '';
-FileUploadEntry.LABELS[FileUploadEntry.UPLOAD_IN_PROGRESS] = 'uploading';
-FileUploadEntry.LABELS[FileUploadEntry.UPLOAD_CANCELED] = '';
-FileUploadEntry.LABELS[FileUploadEntry.UPLOAD_SUCCESS] = '<b>Done</b>';
-FileUploadEntry.LABELS[FileUploadEntry.UPLOAD_TRANSFER_ERROR] = 'transfer_error';
-FileUploadEntry.LABELS[FileUploadEntry.UPLOAD_SERVER_ERROR] = 'server_error';
-FileUploadEntry.LABELS[FileUploadEntry.UPLOAD_SIZE_ERROR] = 'File size restricted';
-
FileUploadEntry.getComponent = function(elt) {
while (elt) {
var component = elt.component;
@@ -197,11 +196,11 @@
Element.insert(this.statusLabel, FileUploadEntry.LABELS[newState]);
if (newState == FileUploadEntry.UPLOAD_IN_PROGRESS) {
- Element.update(this.controlArea, FileUploadEntry.stopControlTemplate.invoke('getContent',{'className': this.uploadObject.classes.FILE_ENTRY_CONTROL.ENABLED}).join(''));
+ Element.update(this.controlArea, FileUploadEntry.stopControlTemplate.invoke('getContent',{'controlLink': FileUploadEntry.LABELS['entry_stop'],'className': this.uploadObject.classes.FILE_ENTRY_CONTROL.ENABLED}).join(''));
} else if (newState == FileUploadEntry.UPLOAD_SUCCESS) {
- Element.update(this.controlArea, FileUploadEntry.clearControlTemplate.invoke('getContent',{'className': this.uploadObject.classes.FILE_ENTRY_CONTROL.ENABLED}).join(''));
+ Element.update(this.controlArea, FileUploadEntry.clearControlTemplate.invoke('getContent',{'controlLink': FileUploadEntry.LABELS['entry_clear'],'className': this.uploadObject.classes.FILE_ENTRY_CONTROL.ENABLED}).join(''));
} else {
- Element.update(this.controlArea, FileUploadEntry.cancelControlTemplate.invoke('getContent',{'className': this.uploadObject.classes.FILE_ENTRY_CONTROL.ENABLED}).join(''));
+ Element.update(this.controlArea, FileUploadEntry.cancelControlTemplate.invoke('getContent',{'controlLink': FileUploadEntry.LABELS['entry_cancel'],'className': this.uploadObject.classes.FILE_ENTRY_CONTROL.ENABLED}).join(''));
}
if (newState == FileUploadEntry.UPLOAD_SUCCESS) {
@@ -374,7 +373,7 @@
uploadedCount: 0,
- initialize: function(id, stopScript, getFileSizeScript, progressBarId, classes, label, maxFiles, events, disabled, acceptedTypes, options) {
+ initialize: function(id, stopScript, getFileSizeScript, progressBarId, classes, label, maxFiles, events, disabled, acceptedTypes, options, labels) {
this.id = id;
this.element = $(this.id);
this._progressBar = $(progressBarId);
@@ -402,8 +401,17 @@
this.setupAutoUpload();
this.checkFrame();
this.initFileEntryWidth();
+ this.initLabels(labels);
},
+ initLabels: function (labels) {
+ if (labels) {
+ for (var l in labels) {
+ FileUploadEntry.LABELS[l] = labels[l];
+ }
+ }
+ },
+
initFileEntryWidth: function () {
var w = this.element.clientWidth - 115;
this.fileEntryWidth = w;
@@ -640,13 +648,13 @@
switchUploadButton: function () {
if (this.runUpload) {
var d = $(this.id + ":upload2");
- d.innerHTML = "<b>Stop</b>";
+ d.innerHTML = FileUploadEntry.LABELS['stop'];
d.onclick = function () {
this.stop();
}.bind(this);
}else {
var d = $(this.id + ":upload2");
- d.innerHTML = "<b>Upload</b>";
+ d.innerHTML = FileUploadEntry.LABELS['upload'];;
d.onclick = function () {
this.upload();
}.bind(this);
Modified: trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-03-13 11:44:06 UTC (rev 6774)
+++ trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-03-13 12:05:46 UTC (rev 6775)
@@ -34,6 +34,13 @@
variables.setVariable("addButtonClassContent",addButtonClassContent);
variables.setVariable("uploadListClass",uploadListClass);
+ Map<String, String> labels = getLabels(context, component);
+ variables.setVariable("labels",labels);
+ variables.setVariable("addLabel",labels.get("add"));
+ variables.setVariable("uploadLabel",labels.get("upload"));
+ variables.setVariable("clearAllLabel",labels.get("clear_all"));
+
+
]]>
</jsp:scriptlet>
@@ -57,7 +64,7 @@
style="position: relative; overflow: hidden; width:70px;"
id="#{clientId}:add1">
<div class="#{addButtonClassContent}"
- id="#{clientId}:add2" style="direction: rtl;">Add...</div>
+ id="#{clientId}:add2" style="direction: rtl;">#{addLabel}</div>
<input type="file" style="cursor: pointer; z-index: 3; right: -10px; top: -10px; font-size: 10em; position: absolute"
class="hidden"
id="#{clientId}:file"
@@ -74,7 +81,7 @@
<a href="#" class="upload_button_selection">
<div class="upload_button_content upload_font upload_ico upload_ico_start #{component.attributes['uploadButtonClass']}"
id="#{clientId}:upload2">
- <b>Upload</b>
+ #{uploadLabel}
</div>
</a>
</div>
@@ -91,7 +98,7 @@
id="#{clientId}:clean1">
<a href="#" class="upload_button_selection">
<div class="upload_button_content upload_font upload_ico upload_ico_clear_dis #{component.attributes['cleanButtonClass']}"
- id="#{clientId}:clean2">Clear All</div>
+ id="#{clientId}:clean2">#{clearAllLabel}</div>
</a>
</div>
</div>
@@ -159,7 +166,7 @@
onerror : #{this:getAsEventHandler(context, component, "onerror")}
};
- new FileUpload('#{clientId}', #{this:getStopScript(context, component)}, #{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)}, '#{component.attributes["maxFilesQuantity"]}', events, #{component.attributes["disabled"]}, #{this:getAcceptedTypes(context, component)}, {'autoclear':#{component.attributes["autoclear"]}});
+ new FileUpload('#{clientId}', #{this:getStopScript(context, component)}, #{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)}, '#{component.attributes["maxFilesQuantity"]}', events, #{component.attributes["disabled"]}, #{this:getAcceptedTypes(context, component)}, {'autoclear':#{component.attributes["autoclear"]}},#{this:_getLabels(labels)});
</script>
</span>
Modified: trunk/ui/fileUpload/src/test/java/org/richfaces/component/FileUploadComponentTest.java
===================================================================
--- trunk/ui/fileUpload/src/test/java/org/richfaces/component/FileUploadComponentTest.java 2008-03-13 11:44:06 UTC (rev 6774)
+++ trunk/ui/fileUpload/src/test/java/org/richfaces/component/FileUploadComponentTest.java 2008-03-13 12:05:46 UTC (rev 6775)
@@ -65,6 +65,7 @@
fileUpload = (UIFileUpload) application.createComponent(UIFileUpload.COMPONENT_TYPE);
fileUpload.setAcceptedTypes("application/zip,image/jpeg,video/mpeg");
fileUpload.setMaxFilesQuantity(5);
+ fileUpload.setLocale("en");
Map<String, UIComponent> facets = fileUpload.getFacets();
UIProgressBar progressBar = (UIProgressBar) application.createComponent(UIProgressBar.COMPONENT_TYPE);
facets.put("progress", progressBar);
16 years, 10 months
JBoss Rich Faces SVN: r6774 - trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-03-13 07:44:06 -0400 (Thu, 13 Mar 2008)
New Revision: 6774
Modified:
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js
Log:
fix IFRAME left position bug under IE
Modified: 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 2008-03-13 09:48:11 UTC (rev 6773)
+++ trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js 2008-03-13 11:44:06 UTC (rev 6774)
@@ -250,7 +250,7 @@
}*/
if (this.iframe) {
this.iframe.style.top = top + "px";
- this.iframe.style.left = fieldLeft + "px";
+ this.iframe.style.left = 0 + "px";
}
},
16 years, 10 months
JBoss Rich Faces SVN: r6773 - in trunk/test-applications/jsp/src/main: java/modalPanel and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ayanul
Date: 2008-03-13 05:48:11 -0400 (Thu, 13 Mar 2008)
New Revision: 6773
Modified:
trunk/test-applications/jsp/src/main/java/fileUpload/FileUpload.java
trunk/test-applications/jsp/src/main/java/modalPanel/ModalPanel.java
trunk/test-applications/jsp/src/main/java/skinning/Skinning.java
trunk/test-applications/jsp/src/main/java/util/style/Style.java
trunk/test-applications/jsp/src/main/webapp/FileUpload/FileUpload.jsp
trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanel.jsp
trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanelProperty.jsp
trunk/test-applications/jsp/src/main/webapp/PickList/PickList.jsp
Log:
update
Modified: trunk/test-applications/jsp/src/main/java/fileUpload/FileUpload.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/fileUpload/FileUpload.java 2008-03-12 21:41:13 UTC (rev 6772)
+++ trunk/test-applications/jsp/src/main/java/fileUpload/FileUpload.java 2008-03-13 09:48:11 UTC (rev 6773)
@@ -4,8 +4,8 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.List;
-
import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;
@@ -18,10 +18,10 @@
private String requiredMessage;
private String listHeight;
private String listWidth;
- private ArrayList data;
+ private List data;
private Integer maxFilesQuantity;
-
- public FileUpload() {
+
+ public FileUpload() {
data = new ArrayList();
disabled = false;
autoclear = false;
@@ -38,10 +38,12 @@
UploadItem upload = event.getUploadItem();
if (upload.isFile()) {
File file = upload.getFile();
+ System.out.println("FileUpload.fileUploadListener()");
} else {
ByteArrayOutputStream b = new ByteArrayOutputStream();
b.write(upload.getData());
}
+ System.out.println("FileUpload.fileUploadListener()");
}
public boolean isDisabled() {
@@ -116,11 +118,13 @@
this.acceptedTypes = acceptedTypes;
}
- public ArrayList getData() {
+ public List getData() {
+ for(int i = 0; i < data.size(); i++)
+ System.out.println(data.get(i));
return data;
}
- public void setData(ArrayList data) {
+ public void setData(List data) {
this.data = data;
}
}
Modified: trunk/test-applications/jsp/src/main/java/modalPanel/ModalPanel.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/modalPanel/ModalPanel.java 2008-03-12 21:41:13 UTC (rev 6772)
+++ trunk/test-applications/jsp/src/main/java/modalPanel/ModalPanel.java 2008-03-13 09:48:11 UTC (rev 6773)
@@ -1,7 +1,6 @@
package modalPanel;
public class ModalPanel {
- private String id;
private boolean autosized;
private boolean keepVisualState;
private String left;
@@ -19,8 +18,17 @@
private boolean resizeable;
private String inputTextTest;
private String selectOneListboxTest;
+ private String visualOptions;
+ public String getVisualOptions() {
+ return visualOptions;
+ }
+
+ public void setVisualOptions(String visualOptions) {
+ this.visualOptions = visualOptions;
+ }
+
public String getInputTextTest() {
return inputTextTest;
}
@@ -38,6 +46,7 @@
}
public ModalPanel() {
+ this.visualOptions = "";
this.inputTextTest = "text";
this.selectOneListboxTest = "1";
this.minHeight = 100;
@@ -48,8 +57,8 @@
this.resizeable=true;
this.autosized = false;
this.keepVisualState = false;
- this.left = "100";
- this.top = "100";
+ this.left = "auto";
+ this.top = "auto";
this.rendered = true;
this.shadowDepth = "3";
this.shadowOpacity = "3";
@@ -222,12 +231,4 @@
public void setZindex(int zindex) {
this.zindex = zindex;
}
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
}
Modified: trunk/test-applications/jsp/src/main/java/skinning/Skinning.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/skinning/Skinning.java 2008-03-12 21:41:13 UTC (rev 6772)
+++ trunk/test-applications/jsp/src/main/java/skinning/Skinning.java 2008-03-13 09:48:11 UTC (rev 6773)
@@ -41,6 +41,7 @@
selectOneRadio = "rich-select";
skinning = "disable";
skinningClass = "disable";
+ selectSkinning = "none";
}
public String getCommandButton() {
@@ -196,9 +197,9 @@
}
public void setSelectSkinning(String selectSkinning) {
- if (selectSkinning.equals("skinning")) {
+ if (selectSkinning.equals("SKINNING")) {
setSkinning("enable");
- } else if (selectSkinning.equals("skinningClass")) {
+ } else if (selectSkinning.equals("SKINNING_CLASSES")) {
setSkinning("disable");
setSkinningClass("enable");
} else {
Modified: trunk/test-applications/jsp/src/main/java/util/style/Style.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/util/style/Style.java 2008-03-12 21:41:13 UTC (rev 6772)
+++ trunk/test-applications/jsp/src/main/java/util/style/Style.java 2008-03-13 09:48:11 UTC (rev 6773)
@@ -4,6 +4,7 @@
public class Style {
private RichBean curentComponent;
+ private String controlsClass;
private String style;
private String styleClass;
private String rangeStyleClass;
@@ -78,6 +79,7 @@
private String headerClassA;
public Style() {
+ controlsClass = "controlsClass";
style = "style";
styleClass = "styleClass";
rangeStyleClass = "rangeStyleClass";
@@ -727,4 +729,12 @@
public void setHandleStyle(String handleStyle) {
this.handleStyle = handleStyle;
}
+
+ public String getControlsClass() {
+ return controlsClass;
+ }
+
+ public void setControlsClass(String controlsClass) {
+ this.controlsClass = controlsClass;
+ }
}
Modified: trunk/test-applications/jsp/src/main/webapp/FileUpload/FileUpload.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/FileUpload/FileUpload.jsp 2008-03-12 21:41:13 UTC (rev 6772)
+++ trunk/test-applications/jsp/src/main/webapp/FileUpload/FileUpload.jsp 2008-03-13 09:48:11 UTC (rev 6773)
@@ -4,14 +4,14 @@
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="FileUploadSubviewID">
- <rich:fileUpload id="fileUploadID" uploadData="#{fileUpload.data}"
+ <rich:fileUpload id="fileUploadID" uploadData="#{fileUpload.data}"
acceptedTypes="#{fileUpload.acceptedTypes}"
disabled="#{fileUpload.disabled}" autoclear="#{fileUpload.autoclear}"
required="#{fileUpload.required}"
requiredMessage="#{fileUpload.requiredMessage}"
rendered="#{fileUpload.rendered}"
listHeight="#{fileUpload.listHeight}"
- listWidth="#{fileUpload.listHeight}"
+ listWidth="#{fileUpload.listWidth}"
maxFilesQuantity="#{fileUpload.maxFilesQuantity}"
fileUploadListener="#{fileUpload.fileUploadListener}">
<f:facet name="label">
@@ -19,6 +19,12 @@
</f:facet>
</rich:fileUpload>
+ <h:panelGrid columns="2">
+ <a4j:commandButton value="show file" reRender="fileUploadDataID"></a4j:commandButton>
+ <h:dataTable id="fileUploadDataID" value="#{fileUpload.data}" var="item">
+ <h:outputText value="#{item.fileName}"></h:outputText>
+ </h:dataTable>
+ </h:panelGrid>
<h:panelGrid columns="2">
<h:outputText value="acceptedTypes"></h:outputText>
Modified: trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanel.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanel.jsp 2008-03-12 21:41:13 UTC (rev 6772)
+++ trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanel.jsp 2008-03-13 09:48:11 UTC (rev 6773)
@@ -10,11 +10,12 @@
<f:selectItems value="#{richBean.listContainer}" />
</h:selectOneMenu>
- <rich:modalPanel id="modalPanelID" minHeight="#{modalPanel.minHeight}" minWidth="#{modalPanel.minWidth}"
+ <rich:modalPanel id="modalPanelID" visualOptions="#{modalPanel.visualOptions}" left="#{modalPanel.left}" top="#{modalPanel.top}" minHeight="#{modalPanel.minHeight}" minWidth="#{modalPanel.minWidth}"
height="#{modalPanel.height}" width="#{modalPanel.width}" moveable="#{modalPanel.moveable}"
resizeable="#{modalPanel.resizeable}" keepVisualState="#{modalPanel.keepVisualState}" rendered="#{modalPanel.rendered}"
zindex="#{modalPanel.zindex}" autosized="#{modalPanel.autosized}" shadowDepth="#{modalPanel.shadowDepth}"
shadowOpacity="#{modalPanel.shadowOpacity}" showWhenRendered="#{modalPanel.showWhenRendered}"
+ controlsClass="#{style.controlsClass}" headerClass="#{style.headerClass}" styleClass="#{style.styleClass}"
onhide="#{event.onhide}" onmaskclick="#{event.onmaskclick}" onmaskcontextmenu="#{event.onmaskcontextmenu}" onmaskdblclick="#{event.onmaskdblclick}" onmaskmousedown="#{event.onmaskmousedown}" onmaskmousemove="#{event.onmaskmousemove}" onmaskmouseout="#{event.onmaskmouseout}" onmaskmouseover="#{event.onmaskmouseover}" onmaskmouseup="#{event.onmaskmouseup}" onmove="#{event.onmove}" onresize="#{event.onresize}" onshow="#{event.onshow}">
<f:facet name="header">
<h:outputText value="Heder goes here..." />
Modified: trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanelProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanelProperty.jsp 2008-03-12 21:41:13 UTC (rev 6772)
+++ trunk/test-applications/jsp/src/main/webapp/ModalPanel/ModalPanelProperty.jsp 2008-03-13 09:48:11 UTC (rev 6773)
@@ -5,6 +5,9 @@
<f:subview id="ModalPanelPropertySubviewID">
<h:panelGrid columns="2">
+ <h:outputText value="visualOptions"></h:outputText>
+ <h:inputText value="#{modalPanel.visualOptions}" onchange="submit();"></h:inputText>
+
<h:outputText value="shadowDepth" />
<h:inputText value="#{modalPanel.shadowDepth}" >
<a4j:support event="onchange" reRender="modalPanelID"></a4j:support>
Modified: trunk/test-applications/jsp/src/main/webapp/PickList/PickList.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/PickList/PickList.jsp 2008-03-12 21:41:13 UTC (rev 6772)
+++ trunk/test-applications/jsp/src/main/webapp/PickList/PickList.jsp 2008-03-13 09:48:11 UTC (rev 6773)
@@ -3,7 +3,6 @@
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="pickListSubviewID">
-
<rich:pickList id="pickListID" value="#{pickList.value}" showButtonsLabel="#{pickList.showButtonLabels}" valueChangeListener="#{pickList.valueChangeListener}"
controlClass="#{style.controlClass}" listClass="#{style.listClass}" style="#{style.style}" styleClass="#{style.styleClass}"
copyAllControlLabel="#{pickList.copyAllControlLabel}" copyControlLabel="#{pickList.copyControlLabel}"
@@ -17,14 +16,10 @@
onfocus="#{event.onfocus}" onkeydown="#{event.onkeydown}" onkeypress="#{event.onkeypress}" onkeyup="#{event.onkeyup}"
onmousedown="#{event.onmousedown}" onmousemove="#{event.onmousemove}" onmouseout="#{event.onmouseout}"
onmouseover="#{event.onmouseover}" onmouseup="#{event.onmouseup}">
- <f:selectItem itemValue="selectItem" itemLabel="selectItem" />
- <f:selectItem itemValue="selectItem 1" itemLabel="selectItem 1" />
- <f:selectItem itemValue="selectItem 2" itemLabel="selectItem 2" />
<f:selectItems value="#{pickList.data}" />
</rich:pickList>
<h:panelGrid columns="2">
<a4j:commandButton value="refresh" reRender="pickListvalueCLID"></a4j:commandButton>
<h:outputText id="pickListvalueCLID" value="#{pickList.valueCL}"></h:outputText>
</h:panelGrid>
-
</f:subview>
\ No newline at end of file
16 years, 10 months
JBoss Rich Faces SVN: r6772 - branches/3.1.x/samples/richfaces-demo.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-03-12 17:41:13 -0400 (Wed, 12 Mar 2008)
New Revision: 6772
Modified:
branches/3.1.x/samples/richfaces-demo/pom.xml
Log:
Compiler level 1.5 removed from pom.xml for richfaces-demo
Modified: branches/3.1.x/samples/richfaces-demo/pom.xml
===================================================================
--- branches/3.1.x/samples/richfaces-demo/pom.xml 2008-03-12 20:56:36 UTC (rev 6771)
+++ branches/3.1.x/samples/richfaces-demo/pom.xml 2008-03-12 21:41:13 UTC (rev 6772)
@@ -116,14 +116,6 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
16 years, 10 months
JBoss Rich Faces SVN: r6771 - trunk/ui/tabPanel/src/main/java/org/richfaces/taglib.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-03-12 16:56:36 -0400 (Wed, 12 Mar 2008)
New Revision: 6771
Modified:
trunk/ui/tabPanel/src/main/java/org/richfaces/taglib/TabPanelTagBase.java
Log:
http://jira.jboss.com/jira/browse/RF-2419
Modified: trunk/ui/tabPanel/src/main/java/org/richfaces/taglib/TabPanelTagBase.java
===================================================================
--- trunk/ui/tabPanel/src/main/java/org/richfaces/taglib/TabPanelTagBase.java 2008-03-12 20:15:23 UTC (rev 6770)
+++ trunk/ui/tabPanel/src/main/java/org/richfaces/taglib/TabPanelTagBase.java 2008-03-12 20:56:36 UTC (rev 6771)
@@ -79,7 +79,7 @@
throw new FacesException(e);
}
} else {
- component.setValueExpression("selectedTab", _value);
+ component.setValueExpression("value", _value);
}
}
}
16 years, 10 months
JBoss Rich Faces SVN: r6770 - in trunk/docs: userguide/en/src/main/docbook/included and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vsukhov
Date: 2008-03-12 16:15:23 -0400 (Wed, 12 Mar 2008)
New Revision: 6770
Added:
trunk/docs/userguide/en/src/main/resources/images/componentControl1.png
Modified:
trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
trunk/docs/userguide/en/src/main/docbook/included/componentControl.xml
trunk/docs/userguide/en/src/main/docbook/included/pickList.xml
Log:
http://jira.jboss.com/jira/browse/RF-1216 corrected Skin Parameters Redefinition and style Classes also for pickList
http://jira.jboss.com/jira/browse/RF-2390 ComponentControl: described the interaction with another components
http://jira.jboss.com/jira/browse/RF-2061 Corrected data I've deleted How to use jsFunction with JSON section
Modified: trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
===================================================================
--- trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2008-03-12 18:04:36 UTC (rev 6769)
+++ trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2008-03-12 20:15:23 UTC (rev 6770)
@@ -1777,67 +1777,70 @@
</h:form>
...]]></programlisting>
</section>
- <section>
- <?dbhtml filename="HighlightRowDataTable.html"?>
- <title>How to ReRender table cells with ajax support?</title>
- <para>In order to ReRender table cells with ajax support you must set exact id values for a all updatable components,
- and point this id's in the reRender parameters.</para>
+ <section id="reRenderCells">
+ <?dbhtml filename="reRenderCells.html"?>
+ <title>How to reRender table cells with <a4j:support>?</title>
+ <para>In order to reRender table cells with <emphasis role="bold"><property><a4j:support></property></emphasis>
+ you should set exact <property>ids</property> values for every updatable components
+ and point this <property>id</property> to the <emphasis><property>"reRender"</property></emphasis> attribute.</para>
<note>
<title>Note:</title>
<para>The value of <emphasis><property>"reRender"</property></emphasis>
attribute of the <emphasis role="bold"><property><a4j:support></property></emphasis> tag defines which part(s)
of our page is (are) to be updated. In this case, the only part of the page to update is the
- <emphasis role="bold"><property><h:outputText></property></emphasis> tag because its ID value matches to the value of <emphasis><property>"reRender"</property></emphasis>
+ <emphasis role="bold"><property><h:outputText></property></emphasis> tag because its <property>id</property>
+ value matches to the value of <emphasis><property>"reRender"</property></emphasis>
attribute.
- As you see, it's not difficult to update multiple elements on the page, only list their IDs as the value of "reRender" .</para>
+ As you see, it's not difficult to update multiple elements on the page, only list their <property>ids</property> as the value of
+ <emphasis><property>"reRender"</property></emphasis>
+ attribute .</para>
</note>
<para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
<rich:column>
- <f:facet name="header">
- <h:outputText value="Input1"/>
- </f:facet>
- <f:facet name="footer">
- <h:outputText value="#{Controller.totalInput1}"/>
- </f:facet>
- <h:inputText id="input1" value="#{entry.input1}" >
- <a4j:support actionListener="{Controller.updateEntry}"event="onblur" reRender="output1">
- </a4j:support>
- </h:inputText>
+ <f:facet name="header">
+ <h:outputText value="Input1"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText value="#{Controller.totalInput1}"/>
+ </f:facet>
+ <h:inputText id="input1" value="#{entry.input1}">
+ <a4j:support actionListener="{Controller.updateEntry}"event="onblur" reRender="output1"/>
+ </h:inputText>
</rich:column>
<rich:column>
- <f:facet name="header">
- <h:outputText value="Value2"/>
- </f:facet>
- <f:facet name="footer">
- <h:outputText value="#{Controller.totalOutput1}"/>
- </f:facet>
- <h:outputText id="output1" value="#{entry.output1}" >
- </h:outputText>
+ <f:facet name="header">
+ <h:outputText value="Value2"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:outputText value="#{Controller.totalOutput1}"/>
+ </f:facet>
+ <h:outputText id="output1" value="#{entry.output1}"/>
</rich:column>
...]]></programlisting>
+ <para>As it could be seen in the example above, the footer with <emphasis role="bold"><property><h:outputText></property></emphasis> reRenderes.</para>
</section>
- <section>
+ <!--section>
<?dbhtml filename="HighlightRowDataTable.html"?>
<title>How to use jsFunction with JSON?</title>
- <para>There is some main cases to use jsFunction and JSON. An example use case: </para>
+ <para>JsFunction and JSON can be used in many ways, for example:</para>
- <para>A user want to create device in a circuit diagram.</para>
+ <para>You want to create device in a circuit diagram. Here is the number of steps for creating:</para>
<itemizedlist>
<listitem>
- He drags and drops it from the toolbox in our embedded Javascript(!) graphical editor. But first only a "please wait"-ModalPanel is shown.
+ You drag and drop it from the toolbox in our embedded Javascript(!) graphical editor. But first only a "please wait"-ModalPanel is shown.
</listitem>
<listitem>
With JSFunction we come to the SessionBean and from there to the DB to fetch some Data for drawing the device in the Editor.
</listitem>
<listitem>
- When the answer comes back, we asked the user with a modal panel to give a name to the device.
+ When the answer comes back, we asked you with a modal panel to give a name to the device.
</listitem>
<listitem>
- After he clicks OK, the model panel disappears (and the please wait model panel shows up again) and another JSFunction call goes over the SessionBean to the DB to create the device data there.
+ After you click OK, the model panel disappears (and the please wait model panel shows up again) and another JSFunction call goes over the SessionBean to the DB to create the device data there.
</listitem>
<listitem>
When the answer comes back, a JSON-String is created with all data for drawing the device (for example the given name) and the Editor is advised to draw it (and the please wait modal panel disappears again).
@@ -1851,30 +1854,28 @@
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="JAVA"><![CDATA[import org.richfaces.json.JSONException;
- import org.richfaces.json.JSONObject;
+ <programlisting role="JAVA"><![CDATA[ import org.richfaces.json.JSONException;
+ import org.richfaces.json.JSONObject;
public class SomeDataToJSON implements DataToJSON {
- public String toJSON(Object obj)
- {
- SomeData data = (SomeData) obj;
- JSONObject dataToJSON = new JSONObject();
- try
- {
- dataToJSON.put("ID", data.getObjPhysName());
- dataToJSON.put("name", data.getName());
- dataToJSON.put("width", data.getWidth());
- dataToJSON.put("height", data.getHeight());
- }
- catch (JSONException e)
- {
- //TODO Approriate exception handling
- e.printStackTrace();
- }
- return dataToJSON.toString();
- }
- }
- ]]></programlisting>
- <para>As you can see, the SimpleJSON library build the JSON-String for you (integrated in Richfaces).
+public String toJSON(Object obj)
+{
+SomeData data = (SomeData) obj;
+JSONObject dataToJSON = new JSONObject();
+try
+{
+dataToJSON.put("ID", data.getObjPhysName());
+dataToJSON.put("name", data.getName());
+dataToJSON.put("width", data.getWidth());
+dataToJSON.put("height", data.getHeight());
+}
+catch (JSONException e)
+{
+e.printStackTrace();
+}
+return dataToJSON.toString();
+}
+}]]></programlisting>
+ <para>As you can see, the SimpleJSON library build the JSON-String for you (integrated in RichFaces).
Sometimes you have to add some brackets or something else.</para>
<para>Here your Javascript code.</para>
<para>
@@ -1882,9 +1883,8 @@
</para>
<programlisting role="JAVA"><![CDATA[var jsonString = executeObjectCreation("test", "anotherParam");
var myObject = eval(jsonString);
-
var name = myObject.name;
-...]]></programlisting>
+...]]></programlisting-->
<!--para>You can use jsFunction to call the jsonTest backing bean that generates some random data in a JSON-String.
That JSON-String is then passed to the updateFields method, which evaluates it and populates some html tags with its content. </para>
<para>
@@ -2020,11 +2020,13 @@
}
}
...]]></programlisting-->
- </section>
- <section>
- <?dbhtml filename="HighlightRowDataTable.html"?>
- <title>How to DynamicColumns?</title>
- <para>In order to create DynamicColumns you can use the rendered attribute of the rich:column. </para>
+ <!--/section-->
+ <section id="DinamicColumns">
+ <?dbhtml filename="DinamicColumns.html"?>
+ <title>How to dynamic columns?</title>
+ <para>In order to create dynamic columns you could use the <emphasis role="bold"><property><rich:column></property></emphasis> component
+ with the<emphasis><property>"rendered"</property></emphasis> attribute. You should just set the value of defined dynamic cell to the
+ <emphasis><property>"rendered"</property></emphasis> attribute field.</para>
<para>
<emphasis role="bold">Example:</emphasis>
</para>
@@ -2032,86 +2034,79 @@
<ui:composition template="/WEB-INF/layout/template.xhtml">
<ui:define name="body">
<h2>Table</h2>
- <h:form>
- <rich:dataTable id="aTable" onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
- onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" value="#{trb.tableData}" var="row">
- <f:facet name="header">
- <rich:columnGroup>
- <rich:column colspan="2">
- Testing
- </rich:column>
- </rich:columnGroup>
- </f:facet>
-
- <f:facet name="footer">
- <rich:columnGroup>
- <rich:column colspan="2">
- Footer
- </rich:column>
- </rich:columnGroup>
- </f:facet>
-
- <rich:column rendered="#{trb.cellRendered['value1']}">
- <f:facet name="header">
-
- <s:div>
- value1 <h:commandLink value="x" action="#{trb.hideColumn('value1')}"/>
- </s:div>
- </f:facet>
- #{row.value1}
- </rich:column>
-
- </rich:dataTable>
- Generate new table values:
- <h:commandButton value="generate" action="#{trb.createData}"/>
- </h:form>
-
- <h:form>
- Select which columns are rendered.
- <br/>
- <h:selectBooleanCheckbox title="value1" value="#{trb.cellRendered['value1']}"/>
- <br/>
- <h:commandButton value="Apply" action="rerender"/>
- </h:form>
- </ui:define>
+ <h:form>
+ <rich:dataTable id="aTable" onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
+ onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" value="#{trb.tableData}" var="row">
+ <f:facet name="header">
+ <rich:columnGroup>
+ <rich:column colspan="2">
+ Testing
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column colspan="2">
+ Footer
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+ <rich:column rendered="#{trb.cellRendered['value1']}">
+ <f:facet name="header">
+ <s:div>
+ value1 <h:commandLink value="x" action="#{trb.hideColumn('value1')}"/>
+ </s:div>
+ </f:facet>
+ #{row.value1}
+ </rich:column>
+ </rich:dataTable>
+ Generate new table values:
+ <h:commandButton value="generate" action="#{trb.createData}"/>
+ </h:form>
+ <h:form>
+ Select which columns are rendered.
+ <br/>
+ <h:selectBooleanCheckbox title="value1" value="#{trb.cellRendered['value1']}"/>
+ <br/>
+ <h:commandButton value="Apply" action="rerender"/>
+ </h:form>
+ </ui:define>
</ui:composition>
...]]></programlisting>
- <para>Here you can see the JAVA code.</para>
+ <para>In order to build this application, you can create a managed bean like this
+ one.</para>
<para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="JAVA"><![CDATA[
-public class TableBackingRendered implements Serializable{
- /**
- *
- */
+public class TableBackingRendered implements Serializable {
private static final long serialVersionUID = 1L;
private Random rand = new Random(System.currentTimeMillis());
private List<TableItem> tableData;
- private Map<String,Boolean> cellRendered = new HashMap<String,Boolean>();
- public TableBackingRendered(){
+ private Map<String, Boolean> cellRendered = new HashMap<String, Boolean>();
+ public TableBackingRendered() {
createData();
allCellsRendered();
}
public String createData(){
- int count = rand.nextInt(25)+1;
- tableData = new ArrayList<TableItem>(count);
- for(int i=0; i<count; i++){
- tableData.add( new TableItem(
- "value1_" +i,
- ));
+ int count = rand.nextInt(25)+1;
+ tableData = new ArrayList<TableItem>(count);
+ for(int i=0; i<count; i++){
+ tableData.add( new TableItem(
+ "value1_" +i,
+ ));
+ }
+ return null;
}
- return null;
- }
- public String allCellsRendered(){
+ public String allCellsRendered() {
cellRendered.put("value1", Boolean.TRUE);
return null;
}
- public String hideColumn(final String columnToHide){
+ public String hideColumn(final String columnToHide) {
cellRendered.put(columnToHide, Boolean.FALSE);
return null;
}
- public List<TableItem> getTableData() {
+ public List<TableItem> getTableData() {
return tableData;
}
public Map<String, Boolean> getCellRendered() {
@@ -2143,10 +2138,10 @@
</rich:dataTable>
...]]></programlisting-->
</section>
- <section>
- <?dbhtml filename="HighlightRowDataTable.html"?>
- <title>RichFacesWithTrinidad?</title>
- <para>Here is a stripped down version of web.xml that integrates Richfaces and Trinidad.</para>
+ <section id="Trinidad">
+ <?dbhtml filename="Trinidad.html"?>
+ <title>RichFaces with Trinidad?</title>
+ <para>Here is a stripped down version of<property> web.xml</property> that integrates RichFaces and Trinidad.</para>
<para>
<emphasis role="bold">Example:</emphasis>
Modified: trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-03-12 18:04:36 UTC (rev 6769)
+++ trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-03-12 20:15:23 UTC (rev 6770)
@@ -289,9 +289,8 @@
</section>
<section>
<title>Skin Parameters Redefinition</title>
-
<table>
- <title>Skin parameters redefinition for a shadow</title>
+ <title>Skin parameters redefinition for a popup list</title>
<tgroup cols="2">
<thead>
<row>
@@ -302,18 +301,18 @@
<tbody>
<row>
<entry>generalBackgroundColor</entry>
- <entry>background-color</entry>
+ <entry>background</entry>
</row>
<row>
- <entry>additionalBackgroundColor</entry>
- <entry>background</entry>
+ <entry>buttonBorderColor</entry>
+ <entry>border-color</entry>
</row>
- </tbody>
+
+ </tbody>
</tgroup>
</table>
-
- <table>
- <title>Skin parameters redefinition for a button</title>
+ <table>
+ <title>Skin parameters redefinition for a button background, button background in pressed and disable state</title>
<tgroup cols="2">
<thead>
<row>
@@ -326,10 +325,21 @@
<entry>generalBackgroundColor</entry>
<entry>background-color</entry>
</row>
+
+ </tbody>
+ </tgroup>
+ </table>
+ <table>
+ <title>Skin parameters redefinition for a button in inactive and disable state</title>
+ <tgroup cols="2">
+ <thead>
<row>
- <entry>buttonBorderColor</entry>
- <entry>border-color</entry>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
</row>
+ </thead>
+ <tbody>
+
<row>
<entry>buttonBorderColor</entry>
<entry>border-top-color</entry>
@@ -338,14 +348,26 @@
<entry>buttonBorderColor</entry>
<entry>border-left-color</entry>
</row>
+
+ </tbody>
+ </tgroup>
+ </table>
+ <table>
+ <title>Skin parameters redefinition for a hovered button</title>
+ <tgroup cols="2">
+ <thead>
<row>
- <entry>buttonBorderColor</entry>
- <entry>border-bottom-color</entry>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
</row>
+ </thead>
+ <tbody>
+
<row>
<entry>buttonBorderColor</entry>
- <entry>border-right-color</entry>
+ <entry>border-color</entry>
</row>
+
</tbody>
</tgroup>
</table>
@@ -368,11 +390,15 @@
<entry>itemFamilyFont</entry>
<entry>font-family</entry>
</row>
+ <row>
+ <entry>itemTextColor</entry>
+ <entry>color</entry>
+ </row>
</tbody>
</tgroup>
</table>
<table>
- <title>Skin parameters redefinition for a default label</title>
+ <title>Skin parameters redefinition for a font in inactive state</title>
<tgroup cols="2">
<thead>
<row>
@@ -382,18 +408,31 @@
</thead>
<tbody>
<row>
- <entry>generalBackgroundColor</entry>
- <entry>background-color</entry>
+ <entry>itemSizeFont</entry>
+ <entry>font-size</entry>
</row>
<row>
- <entry>additionalBackgroundColor</entry>
- <entry>background</entry>
+ <entry>itemFamilyFont</entry>
+ <entry>font-family</entry>
</row>
<row>
<entry>itemTextColor</entry>
<entry>color</entry>
</row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table>
+ <title>Skin parameters redefinition for a font in disabled state</title>
+ <tgroup cols="2">
+ <thead>
<row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
<entry>itemSizeFont</entry>
<entry>font-size</entry>
</row>
@@ -401,12 +440,12 @@
<entry>itemFamilyFont</entry>
<entry>font-family</entry>
</row>
-
+
</tbody>
</tgroup>
</table>
<table>
- <title>Skin parameters redefinition for a popup list</title>
+ <title>Skin parameters redefinition for an input field, input field in inactive and disable state</title>
<tgroup cols="2">
<thead>
<row>
@@ -420,14 +459,28 @@
<entry>background-color</entry>
</row>
<row>
- <entry>additionalBackgroundColor</entry>
- <entry>background</entry>
+ <entry>inputFieldBorderColor</entry>
+ <entry>border-bottom-color</entry>
</row>
<row>
- <entry>itemTextColor</entry>
- <entry>color</entry>
+ <entry>inputFieldBorderColor</entry>
+ <entry>border-right-color</entry>
</row>
+
+ </tbody>
+ </tgroup>
+ </table>
+ <table>
+ <title>Skin parameters redefinition for an item and selected item</title>
+ <tgroup cols="2">
+ <thead>
<row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
<entry>itemSizeFont</entry>
<entry>font-size</entry>
</row>
@@ -435,10 +488,15 @@
<entry>itemFamilyFont</entry>
<entry>font-family</entry>
</row>
+ <row>
+ <entry>itemTextColor</entry>
+ <entry>color</entry>
+ </row>
</tbody>
</tgroup>
</table>
+
</section>
<section>
<title>Definition of Custom Style Classes</title>
@@ -453,9 +511,9 @@
</imageobject>
</mediaobject>
</figure>
-
+
<table id="comboBoxC">
- <title>Classes names that define shadow representation</title>
+ <title>Classes names that define popup list representation</title>
<tgroup cols="2">
<thead>
<row>
@@ -464,25 +522,14 @@
</row>
</thead>
<tbody>
+
<row>
- <entry>rich-combobox-shadow-tl</entry>
- <entry>Defines styles for a top-left shadow</entry>
+ <entry>rich-combobox-list-decoration</entry>
+ <entry>Defines styles for a list</entry>
</row>
- <row>
- <entry>rich-combobox-shadow-tr</entry>
- <entry>Defines styles for a top-right shadow</entry>
- </row>
- <row>
- <entry>rich-combobox-shadow-bl</entry>
- <entry>Defines styles for a bottom-left shadow</entry>
- </row>
- <row>
- <entry>rich-combobox-shadow-br</entry>
- <entry>Defines styles for a bottom-right shadow</entry>
- </row>
</tbody>
</tgroup>
- </table>
+ </table>
<table>
<title>Classes names that define button representation</title>
<tgroup cols="2">
@@ -493,25 +540,36 @@
</row>
</thead>
<tbody>
+
<row>
- <entry>rich-combobox-button-background</entry>
- <entry>Defines styles for a button background</entry>
- </row>
- <row>
<entry>rich-combobox-button-inactive</entry>
<entry>Defines styles for an inactive button</entry>
</row>
<row>
+ <entry>rich-combobox-button-disabled</entry>
+ <entry>Defines styles for a button in disabled state</entry>
+ </row>
+ <row>
<entry>rich-combobox-button-hovered</entry>
<entry>Defines styles for a hovered button</entry>
</row>
<row>
- <entry>rich-combobox-button-icon-inactive</entry>
- <entry>Defines styles for an inactive button icon</entry>
+ <entry>rich-combobox-button-background</entry>
+ <entry>Defines styles for a button background</entry>
</row>
+ <row>
+ <entry>rich-combobox-button-background-inactive</entry>
+ <entry>Defines styles for an inactive button background</entry>
+ </row>
+ <row>
+ <entry>rich-combobox-button-pressed-background</entry>
+ <entry>Defines styles for a pressed button background</entry>
+ </row>
+
</tbody>
</tgroup>
</table>
+
<table>
<title>Classes names that define font representation</title>
<tgroup cols="2">
@@ -538,7 +596,7 @@
</tgroup>
</table>
<table>
- <title>Classes names that define default label representation</title>
+ <title>Classes names that define input field representation</title>
<tgroup cols="2">
<thead>
<row>
@@ -547,15 +605,25 @@
</row>
</thead>
<tbody>
+
<row>
+ <entry>rich-combobox-input</entry>
+ <entry>Defines styles for an input text</entry>
+ </row>
+ <row>
+ <entry>rich-combobox-input-disabled</entry>
+ <entry>Defines styles for an input text in disabled state</entry>
+ </row>
+ <row>
<entry>rich-combobox-input-inactive</entry>
- <entry>Defines styles for an inactive input</entry>
+ <entry>Defines styles for an inactive input text</entry>
</row>
- </tbody>
+
+ </tbody>
</tgroup>
</table>
<table>
- <title>Classes names that define popup list representation</title>
+ <title>Classes names that define item representation</title>
<tgroup cols="2">
<thead>
<row>
@@ -569,12 +637,13 @@
<entry>Defines styles for an item</entry>
</row>
<row>
- <entry>rich-combobox-list-decoration</entry>
- <entry>Defines styles for a list</entry>
+ <entry>rich-combobox-item-selected</entry>
+ <entry>Defines styles for a selected item</entry>
</row>
</tbody>
</tgroup>
</table>
+
<para>In order to redefine styles for all <emphasis role="bold">
<property><rich:comboBox></property>
</emphasis> components on a page using CSS, it's enough to create classes with the
Modified: trunk/docs/userguide/en/src/main/docbook/included/componentControl.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/componentControl.xml 2008-03-12 18:04:36 UTC (rev 6769)
+++ trunk/docs/userguide/en/src/main/docbook/included/componentControl.xml 2008-03-12 20:15:23 UTC (rev 6770)
@@ -168,7 +168,68 @@
</emphasis> component. The <emphasis>
<property>"operation"</property>
</emphasis> attribute contains a name of JavaScript API function. Thus, clicking on the link
- represents the next year on the calendar.</para>
+ represents the next year on the calendar.
+ </para>
+ <para>
+ <emphasis role="bold">
+ <property><rich:componentControl></property>
+ </emphasis> interacts with such components as:
+ <itemizedlist>
+ <listitem><emphasis role="bold">
+ <property><rich:contextMenu></property>
+ </emphasis></listitem>
+ <listitem><emphasis role="bold">
+ <property><rich:toolTip></property>
+ </emphasis></listitem>
+ <listitem><emphasis role="bold">
+ <property><rich:modalPanel ></property>
+ </emphasis></listitem>
+ <listitem><emphasis role="bold">
+ <property><rich:listShuttle></property>
+ </emphasis></listitem>
+ <listitem><emphasis role="bold">
+ <property><rich:orderingList></property>
+ </emphasis></listitem>
+ </itemizedlist>
+ </para>
+ <para>In order to use <emphasis role="bold">
+ <property><rich:componentControl></property>
+ </emphasis> with another component you should place the id of this component into <emphasis>
+ <property>"for"</property>
+ </emphasis> attribute field. All operations with defined component you can find in the JavaScript API section of defined component.</para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<f:view>
+ <h:form>
+ <br>
+ <rich:toolTip id="toolTipFor" followMouse="false" direction="top-right" mode="ajax" value="This is button" horizontalOffset="5" verticalOffset="5" layout="block">
+ </rich:toolTip>
+ </h:form>
+ <h:commandButton id="ButtonID" value="Button">
+ <cc:componentControl for="toolTipFor" attachTo="ButtonID" operation="show" event="onclick"/>
+ </h:commandButton>
+</f:view>
+...]]></programlisting>
+ <para>This is a result:</para>
+ <figure>
+ <title><emphasis role="bold">
+ <property><rich:componentControl></property>
+ </emphasis> with <emphasis><property> "for"</property></emphasis> attribute.</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/componentControl1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>
+ As it could be seen in the picture above, the <emphasis role="bold">
+ <property><rich:toolTip></property>
+ </emphasis> shows after you click the button.
+ </para>
+
<!--para>One more example of <emphasis role="bold">
<property><rich:componentControl></property>
</emphasis> usage is placed below:</para>
Modified: trunk/docs/userguide/en/src/main/docbook/included/pickList.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/pickList.xml 2008-03-12 18:04:36 UTC (rev 6769)
+++ trunk/docs/userguide/en/src/main/docbook/included/pickList.xml 2008-03-12 20:15:23 UTC (rev 6770)
@@ -333,13 +333,17 @@
<entry>generalBackgroundColor</entry>
<entry>background-color</entry>
</row>
+ <row>
+ <entry>tableBorderWidth</entry>
+ <entry>border-width</entry>
+ </row>
</tbody>
</tgroup>
</table>
<table>
- <title>Skin parameters redefinition for a button</title>
+ <title>Skin parameters redefinition for a button, button in disable state</title>
<tgroup cols="2">
<thead>
<row>
@@ -515,18 +519,10 @@
</thead>
<tbody>
<row>
- <entry>tableBorderColor</entry>
+ <entry>controlBorderColor</entry>
<entry>border-color</entry>
</row>
- <row>
- <entry>tableBottomBorderColor</entry>
- <entry>border-bottom-color</entry>
- </row>
- <row>
- <entry>tableTopBorderColor</entry>
- <entry>border-top-color</entry>
- </row>
-
+
</tbody>
</tgroup>
</table>
@@ -565,10 +561,7 @@
<entry>rich-picklist-list</entry>
<entry>Defines styles for a wrapper <table> element of a pickList</entry>
</row>
- <row>
- <entry>rich-list-picklist</entry>
- <entry>Defines styles for a wrapper <table> element of a pickList</entry>
- </row>
+
</tbody>
</tgroup>
</table>
@@ -591,29 +584,7 @@
<entry>rich-list-picklist-button-disabled</entry>
<entry>Defines styles for a disabled button</entry>
</row>
- </tbody>
- </tgroup>
- </table>
-
- <table >
- <title>Classes names that define pressed and highlighted button representation</title>
- <tgroup cols="2">
- <thead>
<row>
- <entry>Class name</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>rich-list-picklist-button</entry>
- <entry>Defines styles for a button</entry>
- </row>
- <row>
- <entry>rich-list-picklist-button-disabled</entry>
- <entry>Defines styles for a disabled button</entry>
- </row>
- <row>
<entry>rich-list-picklist-button-press</entry>
<entry>Defines styles for a pressed button</entry>
</row>
@@ -621,30 +592,21 @@
<entry>rich-list-picklist-button-light</entry>
<entry>Defines styles for a button highlight</entry>
</row>
- </tbody>
- </tgroup>
- </table>
-
- <table >
- <title>Classes names that define a button selection representation</title>
- <tgroup cols="2">
- <thead>
<row>
- <entry>Class name</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
<entry>rich-list-picklist-button-selection</entry>
<entry>Defines styles for a button selection</entry>
</row>
- </tbody>
+ <row>
+ <entry>rich-list-picklist-button-content</entry>
+ <entry>Defines styles for a button content</entry>
+ </row>
+ </tbody>
</tgroup>
</table>
-
+
+
<table >
- <title>Classes names that define a button content representation</title>
+ <title>Classes names that define a source and target items representation</title>
<tgroup cols="2">
<thead>
<row>
@@ -653,17 +615,21 @@
</row>
</thead>
<tbody>
- <row>
- <entry>rich-list-picklist-button-content</entry>
- <entry>Defines styles for a button content</entry>
+ <row>
+ <entry>rich-picklist-source-items</entry>
+ <entry>Defines styles for an item in a source list</entry>
</row>
+ <row>
+ <entry>rich-picklist-target-items</entry>
+ <entry>Defines styles for an item in a target list</entry>
+ </row>
</tbody>
</tgroup>
</table>
<table >
- <title>Classes names that define a source and target items representation</title>
+ <title>Classes names that define a source cell representation</title>
<tgroup cols="2">
<thead>
<row>
@@ -673,20 +639,23 @@
</thead>
<tbody>
<row>
- <entry>rich-picklist-source-items</entry>
- <entry>Defines styles for an item in a source list</entry>
+ <entry>rich-picklist-source-cell</entry>
+ <entry>Defines styles for a cell in a source list</entry>
</row>
<row>
- <entry>rich-picklist-target-items</entry>
- <entry>Defines styles for an item in a target list</entry>
+ <entry>rich-picklist-source-cell-selected</entry>
+ <entry>Defines styles for a selected cell in a source list</entry>
</row>
-
+ <row>
+ <entry>rich-picklist-source-cell-active</entry>
+ <entry>Defines styles for an active cell in a source list</entry>
+ </row>
</tbody>
</tgroup>
</table>
<table >
- <title>Classes names that define a source and target cell representation</title>
+ <title>Classes names that define a target cell representation</title>
<tgroup cols="2">
<thead>
<row>
@@ -696,13 +665,17 @@
</thead>
<tbody>
<row>
- <entry>rich-picklist-source-cell</entry>
+ <entry>rich-picklist-target-cel</entry>
<entry>Defines styles for a cell in a source list</entry>
</row>
<row>
- <entry>rich-picklist-target-cell</entry>
- <entry>Defines styles for a cell in a target list</entry>
+ <entry>rich-picklist-target-cell-selected</entry>
+ <entry>Defines styles for a selected cell in a target list</entry>
</row>
+ <row>
+ <entry>rich-picklist-target-cell-active</entry>
+ <entry>Defines styles for an active cell in a target list</entry>
+ </row>
</tbody>
</tgroup>
</table>
Added: trunk/docs/userguide/en/src/main/resources/images/componentControl1.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/componentControl1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 10 months
JBoss Rich Faces SVN: r6769 - in trunk/ui/pickList/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-03-12 14:04:36 -0400 (Wed, 12 Mar 2008)
New Revision: 6769
Modified:
trunk/ui/pickList/src/main/java/org/richfaces/picklist/util/PickListUtils.java
trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
Log:
http://jira.jboss.com/jira/browse/RF-2361
Modified: trunk/ui/pickList/src/main/java/org/richfaces/picklist/util/PickListUtils.java
===================================================================
--- trunk/ui/pickList/src/main/java/org/richfaces/picklist/util/PickListUtils.java 2008-03-12 17:35:00 UTC (rev 6768)
+++ trunk/ui/pickList/src/main/java/org/richfaces/picklist/util/PickListUtils.java 2008-03-12 18:04:36 UTC (rev 6769)
@@ -1,281 +1,160 @@
package org.richfaces.picklist.util;
-import java.io.Serializable;
import java.lang.reflect.Array;
-import java.util.Collections;
-import java.util.HashSet;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.UISelectMany;
-import javax.faces.component.UISelectOne;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
-import javax.faces.convert.ConverterException;
import javax.faces.model.SelectItem;
import org.ajax4jsf.util.SelectUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
-
-
-
public class PickListUtils {
-
- private static final Log log = LogFactory.getLog(PickListUtils.class);
- public static final Object NOTHING = new Serializable() {};
- public static Converter findUISelectManyConverter(FacesContext context, UISelectMany component) {
-
- Converter converter = component.getConverter();
-
- if (converter != null) return converter;
- //Try to find out by value binding
- ValueExpression ve = component.getValueExpression("value");
- if (ve == null) return null;
+ private static final Log log = LogFactory.getLog(PickListUtils.class);
- Class valueType = ve.getType(context.getELContext());
- if (valueType == null) return null;
+ public static Converter findUISelectManyConverter(FacesContext context, UISelectMany component) {
- if (List.class.isAssignableFrom(valueType)) {
- List selectItems = SelectUtils.getSelectItems(context, component);
+ Converter converter = component.getConverter();
+ if (converter != null) {
+ return converter;
+ }
- if (selectItems != null && selectItems.size() > 0) {
- SelectItem selectItem = (SelectItem) selectItems.get(0);
- Class listComponentType = selectItem.getValue().getClass();
-
- if (!(String.class.equals(listComponentType))) {
- try {
- return context.getApplication().createConverter(listComponentType);
- }
- catch (FacesException e) {
- log.error("No Converter for type " + listComponentType.getName() + " found", e);
- return null;
- }
- }
- }
+ ValueExpression ve = component.getValueExpression("value");
+ if (ve == null) {
+ return null;
+ }
+ Class valueType = ve.getType(context.getELContext());
+ if (valueType == null) {
+ return null;
+ }
+
+ if (List.class.isAssignableFrom(valueType)) {
+ List selectItems = SelectUtils.getSelectItems(context, component);
+ if (selectItems != null && selectItems.size() > 0) {
+ SelectItem selectItem = (SelectItem) selectItems.get(0);
+ Class listComponentType = selectItem.getValue().getClass();
+ if (!(String.class.equals(listComponentType))) {
+ try {
+ return context.getApplication().createConverter(listComponentType);
+ } catch (FacesException e) {
+ log.error("No Converter for type " + listComponentType.getName() + " found", e);
return null;
+ }
}
+ }
+ return null;
+ }
- if (!valueType.isArray()) {
- throw new IllegalArgumentException("ValueBinding for UISelectMany : must be of type List or Array");
- }
+ if (!valueType.isArray()) {
+ throw new IllegalArgumentException("ValueBinding for UISelectMany : must be of type List or Array");
+ }
- Class arrayComponentType = valueType.getComponentType();
- if (String.class.equals(arrayComponentType)) return null; //No converter needed for String type
- if (Object.class.equals(arrayComponentType)) return null; //There is no converter for Object class
+ Class arrayComponentType = valueType.getComponentType();
+ if (String.class.equals(arrayComponentType))
+ return null;
+ if (Object.class.equals(arrayComponentType))
+ return null;
- try {
- return context.getApplication().createConverter(arrayComponentType);
- } catch (FacesException e) {
- log.error("No Converter for type " + arrayComponentType.getName() + " found", e);
- return null;
- }
- }
-
- public static Converter findUISelectManyConverterFailsafe(FacesContext facesContext, UIComponent uiComponent) {
- Converter converter;
- try {
- converter = findUISelectManyConverter(
- facesContext, (UISelectMany) uiComponent);
- }
- catch (FacesException e) {
- log.error("Error finding Converter for component with id "
- + uiComponent.getClientId(facesContext), e);
- converter = null;
- }
- return converter;
+ try {
+ return context.getApplication().createConverter(arrayComponentType);
+ } catch (FacesException e) {
+ log.error("No Converter for type " + arrayComponentType.getName() + " found", e);
+ return null;
+ }
}
-
- public static Set getSubmittedOrSelectedValuesAsSet(boolean selectMany, UIComponent uiComponent, FacesContext facesContext, Converter converter) {
- Set lookupSet;
- if (selectMany) {
- UISelectMany uiSelectMany = (UISelectMany) uiComponent;
- lookupSet = getSubmittedValuesAsSet(facesContext, uiComponent, converter, uiSelectMany);
- if (lookupSet == null) {
- lookupSet = getSelectedValuesAsSet(facesContext, uiComponent, converter, uiSelectMany);
- }
- }
- else {
- UISelectOne uiSelectOne = (UISelectOne) uiComponent;
- Object lookup = uiSelectOne.getSubmittedValue();
- if (lookup == null) {
- lookup = uiSelectOne.getValue();
- String lookupString = getConvertedStringValue(facesContext, uiComponent, converter, lookup);
- lookupSet = Collections.singleton(lookupString);
- }
- else if (NOTHING.equals(lookup)) {
- lookupSet = Collections.EMPTY_SET;
- }
- else {
- lookupSet = Collections.singleton(lookup);
- }
- }
- return lookupSet;
+ public static Converter findUISelectManyConverterFailsafe(FacesContext facesContext, UIComponent uiComponent) {
+ Converter converter;
+ try {
+ converter = findUISelectManyConverter(facesContext, (UISelectMany) uiComponent);
+ } catch (FacesException e) {
+ log.error("Error finding Converter for component with id " + uiComponent.getClientId(facesContext), e);
+ converter = null;
+ }
+ return converter;
}
-
- public static Set getSubmittedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany) {
- Object submittedValues = uiSelectMany.getSubmittedValue();
- if (submittedValues == null) {
- return null;
- }
-
- if(converter != null) {
- converter = new PassThroughAsStringConverter(converter);
- }
- return internalSubmittedOrSelectedValuesAsSet(context, component, converter, uiSelectMany, submittedValues);
+ public static List getValuesList(UIComponent uiComponent, FacesContext facesContext, Converter converter) {
+ List lookupList = null;
+ if (uiComponent instanceof UISelectMany) {
+ UISelectMany uiSelectMany = (UISelectMany) uiComponent;
+ lookupList = getSelectValuesList(facesContext, uiComponent, converter, uiSelectMany);
+ }
+ return lookupList;
}
-
- private static class PassThroughAsStringConverter implements Converter {
- private final Converter converter;
- public PassThroughAsStringConverter(Converter converter) {
- this.converter = converter;
- }
+ public static List getSelectValuesList(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany) {
+ Object selectedValues = uiSelectMany.getValue();
+ return internalSelectValuesList(context, component, converter, uiSelectMany, selectedValues);
+ }
- public Object getAsObject(FacesContext context, UIComponent component,
- String value) throws ConverterException {
- return converter.getAsObject(context, component, value);
- }
+ private static List internalSelectValuesList(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany, Object values) {
+ List valuesList = new ArrayList();
- public String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException {
- return (String)value;
- }
+ if (values == null || "".equals(values)) {
+ return valuesList;
+
+ } else if (values instanceof Object[]) {
+
+ Object[] ar = (Object[]) values;
+ if (ar.length == 0) {
+ return valuesList;
+ }
+ valuesList = new ArrayList();
+ for (int i = 0; i < ar.length; i++) {
+ valuesList.add(getConvertedStringValue(context, component, converter, ar[i]));
+ }
+ return valuesList;
+
+ } else if (values.getClass().isArray()) {
+
+ int len = Array.getLength(values);
+ valuesList = new ArrayList();
+ for (int i = 0; i < len; i++) {
+ valuesList.add(getConvertedStringValue(context, component, converter, Array.get(values, i)));
+ }
+ return valuesList;
+
+ } else if (values instanceof List) {
+
+ List lst = (List) values;
+ if (lst.size() == 0) {
+ return lst;
+ } else {
+ valuesList = new ArrayList();
+ for (Iterator i = lst.iterator(); i.hasNext();) {
+ valuesList.add(getConvertedStringValue(context, component, converter, i.next()));
+ }
+ return valuesList;
+ }
+
+ } else {
+ throw new IllegalArgumentException("Value of UISelectMany component : is not of type Array or List");
}
-
- public static Set getSelectedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany) {
- Object selectedValues = uiSelectMany.getValue();
- return internalSubmittedOrSelectedValuesAsSet(context, component, converter, uiSelectMany, selectedValues);
- }
-
- private static Set internalSubmittedOrSelectedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany,Object values) {
-
- if (values == null || "".equals(values)) {
- return Collections.EMPTY_SET;
- } else if (values instanceof Object[]) {
- //Object array
- Object[] ar = (Object[]) values;
- if (ar.length == 0) {
- return Collections.EMPTY_SET;
- }
-
- HashSet set = new HashSet(calcCapacity(ar.length));
- for (int i = 0; i < ar.length; i++) {
- set.add(getConvertedStringValue(context, component, converter, ar[i]));
- }
- return set;
- } else if (values.getClass().isArray()) {
- //primitive array
- int len = Array.getLength(values);
- HashSet set = new HashSet(calcCapacity(len));
- for (int i = 0; i < len; i++) {
- set.add(getConvertedStringValue(context, component, converter, Array.get(values, i)));
- }
- return set;
- } else if (values instanceof List) {
- List lst = (List) values;
- if (lst.size() == 0) {
- return Collections.EMPTY_SET;
- } else {
- HashSet set = new HashSet(calcCapacity(lst.size()));
- for (Iterator i = lst.iterator(); i.hasNext();) {
- set.add(getConvertedStringValue(context, component, converter, i.next()));
- }
- return set;
- }
- } else {
- throw new IllegalArgumentException("Value of UISelectMany component : is not of type Array or List");
- }
- }
-
- public static final int calcCapacity(int size) {
- return ((size * 4) + 3) / 3;
- }
-
- public static String getConvertedStringValue(FacesContext context, UIComponent component, Converter converter, Object value) {
- if (converter == null) {
- if (value == null) {
- return "";
- } else if (value instanceof String) {
- return (String) value;
- } else {
- throw new IllegalArgumentException(
- "Value is not String (class=" + value.getClass().getName() + ", value=" + value + ") and component "
- + component.getClientId(context) + " does not have a Converter");
- }
- }
-
- return converter.getAsString(context, component, value);
- }
-// public static boolean renderHTMLAttributes(ResponseWriter writer,
-// UIComponent component, String[] attributes) throws IOException {
-// boolean somethingDone = false;
-// for (int i = 0, len = attributes.length; i < len; i++) {
-// String attrName = attributes[i];
-// if (renderHTMLAttribute(writer, component, attrName, attrName)) {
-// somethingDone = true;
-// }
-// }
-// return somethingDone;
-// }
-//
-// public static boolean renderHTMLAttribute(ResponseWriter writer,
-// UIComponent component, String componentProperty, String htmlAttrName) throws IOException {
-// Object value = component.getAttributes().get(componentProperty);
-// return renderHTMLAttribute(writer, componentProperty, htmlAttrName, value);
-// }
-//
-// public static boolean renderHTMLAttribute(ResponseWriter writer,
-// String componentProperty, String attrName, Object value) throws IOException {
-// if (!isDefaultAttributeValue(value)) {
-// // render JSF "styleClass" and "itemStyleClass" attributes as "class"
-// String htmlAttrName =
-// attrName.equals("styleClass") ? "class" : attrName;
-// writer.writeAttribute(htmlAttrName, value, componentProperty);
-// return true;
-// }
-//
-// return false;
-// }
-//
-// public static boolean isDefaultAttributeValue(Object value) {
-// if (value == null) {
-// return true;
-// }
-// else if (value instanceof Boolean) {
-// return !((Boolean) value).booleanValue();
-// }
-// else if (value instanceof Number) {
-// if (value instanceof Integer) {
-// return ((Number) value).intValue() == Integer.MIN_VALUE;
-// }
-// else if (value instanceof Double) {
-// return ((Number) value).doubleValue() == Double.MIN_VALUE;
-// }
-// else if (value instanceof Long) {
-// return ((Number) value).longValue() == Long.MIN_VALUE;
-// }
-// else if (value instanceof Byte) {
-// return ((Number) value).byteValue() == Byte.MIN_VALUE;
-// }
-// else if (value instanceof Float) {
-// return ((Number) value).floatValue() == Float.MIN_VALUE;
-// }
-// else if (value instanceof Short) {
-// return ((Number) value).shortValue() == Short.MIN_VALUE;
-// }
-// }
-// return false;
-// }
+ }
+ public static String getConvertedStringValue(FacesContext context, UIComponent component, Converter converter, Object value) {
+ if (converter == null) {
+ if (value == null) {
+ return "";
+ } else if (value instanceof String) {
+ return (String) value;
+ } else {
+ throw new IllegalArgumentException("Value is not String (class=" + value.getClass().getName() + ", value=" + value + ") and component "
+ + component.getClientId(context) + " does not have a Converter");
+ }
+ }
+ return converter.getAsString(context, component, value);
+ }
}
Modified: trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
--- trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-03-12 17:35:00 UTC (rev 6768)
+++ trunk/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-03-12 18:04:36 UTC (rev 6769)
@@ -10,7 +10,6 @@
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.Set;
import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
@@ -37,331 +36,336 @@
import org.richfaces.picklist.util.PickListUtils;
public class PickListRenderer extends HeaderResourcesRendererBase {
-
- private static final String HIDDEN_SUFFIX = "valueKeeper";
+
+ private static final String HIDDEN_SUFFIX = "valueKeeper";
protected static final OrderingComponentRendererBase.ControlsHelper[] SHUTTLE_HELPERS = ListShuttleControlsHelper.HELPERS;
protected final static String SHOW_LABELS_ATTRIBUTE_NAME = "showButtonsLabel";
private static final String MESSAGE_BUNDLE_NAME = OrderingListRendererBase.class.getPackage().getName() + "ListShuttle";
private boolean isSelectedList;
private boolean isAvailableList;
-
- protected List <SelectItem> selectItemsForSelectedList(FacesContext facesContext,UIComponent uiComponent, List <SelectItem> selectItemList, Converter converter, Set <SelectItem> lookupSet) {
- List <SelectItem> selectItemForSelectedValues = new ArrayList<SelectItem>(lookupSet.size());
- for (Iterator <SelectItem> i = selectItemList.iterator(); i.hasNext();) {
- SelectItem selectItem = i.next();
- String itemStrValue = PickListUtils.getConvertedStringValue(facesContext, uiComponent,converter, selectItem.getValue());
- for (Iterator <SelectItem> i2 = lookupSet.iterator(); i2.hasNext();) {
- Object value = i2.next();
- if (value.equals(itemStrValue)) {
- selectItemForSelectedValues.add(selectItem);
- }
- }
+
+ protected List<SelectItem> selectItemsForSelectedList(FacesContext facesContext, UIComponent uiComponent, List<SelectItem> selectItemList,
+ Converter converter, List<SelectItem> lookupList) {
+ List<SelectItem> selectItemForSelectedValues = new ArrayList<SelectItem>();
+
+ for (Iterator<SelectItem> i2 = lookupList.iterator(); i2.hasNext();) {
+ Object value = i2.next();
+ for (Iterator<SelectItem> i = selectItemList.iterator(); i.hasNext();) {
+ SelectItem selectItem = i.next();
+ String itemStrValue = PickListUtils.getConvertedStringValue(facesContext, uiComponent, converter, selectItem.getValue());
+ if (value.equals(itemStrValue)) {
+ selectItemForSelectedValues.add(selectItem);
}
- return selectItemForSelectedValues;
+ }
}
+ return selectItemForSelectedValues;
+ }
- protected List selectItemsForAvailableList(FacesContext facesContext, UIComponent uiComponent, List <SelectItem> selectItemList, List <SelectItem> selectItemsForSelectedList, Converter converter) {
- Collection collection = CollectionUtils.subtract(selectItemList, selectItemsForSelectedList);
- return new ArrayList <SelectItem>(collection);
+ protected List selectItemsForAvailableList(FacesContext facesContext, UIComponent uiComponent, List<SelectItem> selectItemList,
+ List<SelectItem> selectItemsForSelectedList, Converter converter) {
+ Collection collection = CollectionUtils.subtract(selectItemList, selectItemsForSelectedList);
+ return new ArrayList<SelectItem>(collection);
+ }
+
+ protected List getSelectItemsList(FacesContext context, UIComponent component) {
+ return SelectUtils.getSelectItems(context, component);
+ }
+
+ private final String bundleName;
+
+ public PickListRenderer() {
+ super();
+ this.bundleName = MESSAGE_BUNDLE_NAME;
+ }
+
+ public void decode(FacesContext context, UIComponent component) {
+
+ UIPickList picklist = (UIPickList) component;
+ if (!(picklist instanceof EditableValueHolder)) {
+ throw new IllegalArgumentException("Component " + picklist.getClientId(context) + " is not an EditableValueHolder");
}
-
- protected List getSelectItemsList(FacesContext context,UIComponent component) {
- return SelectUtils.getSelectItems(context, component);
- }
-
- private final String bundleName;
-
- public PickListRenderer() {
- super();
- this.bundleName = MESSAGE_BUNDLE_NAME;
- }
-
- public void decode(FacesContext context, UIComponent component) {
-
- UIPickList picklist = (UIPickList)component;
- if (!(picklist instanceof EditableValueHolder)) {
- throw new IllegalArgumentException("Component " + picklist.getClientId(context) + " is not an EditableValueHolder");
- }
- String hiddenClientId = picklist.getClientId(context) + HIDDEN_SUFFIX;
- Map paramValuesMap = context.getExternalContext().getRequestParameterValuesMap();
+ String hiddenClientId = picklist.getClientId(context) + HIDDEN_SUFFIX;
+ Map paramValuesMap = context.getExternalContext().getRequestParameterValuesMap();
- if (picklist.isDisabled()) {
- return;
- }
+ if (picklist.isDisabled()) {
+ return;
+ }
- if (paramValuesMap.containsKey(hiddenClientId)) {
- String[] valuesInline = (String[]) paramValuesMap.get(hiddenClientId);
- if (valuesInline[0].trim().equals("")) {
- ((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
- } else {
- String[] reqValues = valuesInline[0].split(",");
- ((EditableValueHolder) picklist).setSubmittedValue(reqValues);
- }
+ if (paramValuesMap.containsKey(hiddenClientId)) {
+ String[] valuesInline = (String[]) paramValuesMap.get(hiddenClientId);
+ if (valuesInline[0].trim().equals("")) {
+ ((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
} else {
- ((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
+ String[] reqValues = valuesInline[0].split(",");
+ ((EditableValueHolder) picklist).setSubmittedValue(reqValues);
}
+ } else {
+ ((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
}
-
- private static boolean isTrue(Object obj) {
- if (!(obj instanceof Boolean)) {
- return false;
- }
- return ((Boolean) obj).booleanValue();
+ }
+
+ private static boolean isTrue(Object obj) {
+ if (!(obj instanceof Boolean)) {
+ return false;
}
-
- @Override
- public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue)
- throws ConverterException {
-
- if ((component instanceof UISelectMany) && (submittedValue instanceof String[])) {
- return SelectUtils.getConvertedUISelectManyValue(context,(UISelectMany)component, (String [])submittedValue);
- } else if ((component instanceof UISelectOne) && (submittedValue instanceof String)) {
- return SelectUtils.getConvertedUIInputValue(context, (UISelectOne)component, (String)submittedValue);
- } else {
- throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName());
- }
-
+ return ((Boolean) obj).booleanValue();
+ }
+
+ @Override
+ public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException {
+
+ if ((component instanceof UISelectMany) && (submittedValue instanceof String[])) {
+ return SelectUtils.getConvertedUISelectManyValue(context, (UISelectMany) component, (String[]) submittedValue);
+ } else if ((component instanceof UISelectOne) && (submittedValue instanceof String)) {
+ return SelectUtils.getConvertedUIInputValue(context, (UISelectOne) component, (String) submittedValue);
+ } else {
+ throw new ConverterException("Unsupported component class " + component.getClass().getName());
}
-
- private void encodeRows(FacesContext context, UIComponent component, boolean source) throws IOException {
- List selectItemsList = SelectUtils.getSelectItems(context,component);
- Converter converter = PickListUtils.findUISelectManyConverterFailsafe(context, component);
- Set lookupSet = PickListUtils.getSubmittedOrSelectedValuesAsSet(true, component, context, converter);
- List selectItemsForSelectedValues = selectItemsForSelectedList(context, component, selectItemsList, converter, lookupSet); //TODO: optimaze
- List selectItemsForAvailableList = selectItemsForAvailableList(context, component, selectItemsList, selectItemsForSelectedValues, converter);
- isSelectedList = !selectItemsForSelectedValues.isEmpty();
- isAvailableList = !selectItemsForAvailableList.isEmpty();
- List selectItemList = null;
- if (source) {
- selectItemList = selectItemsForAvailableList;
+
+ }
+
+ private void encodeRows(FacesContext context, UIComponent component, boolean source) throws IOException {
+ List selectItemsList = SelectUtils.getSelectItems(context, component);
+
+ Converter converter = PickListUtils.findUISelectManyConverterFailsafe(context, component);
+ List lookupList = PickListUtils.getValuesList(component, context, converter);
+ List selectItemsForSelectedValues = selectItemsForSelectedList(context, component, selectItemsList, converter, lookupList);
+ List selectItemsForAvailableList = selectItemsForAvailableList(context, component, selectItemsList, selectItemsForSelectedValues, converter);
+ isSelectedList = !selectItemsForSelectedValues.isEmpty();
+ isAvailableList = !selectItemsForAvailableList.isEmpty();
+
+ List selectItemList = null;
+ if (source) {
+ selectItemList = selectItemsForAvailableList;
+ } else {
+ selectItemList = selectItemsForSelectedValues;
+ }
+
+ int i = 0;
+ for (Iterator it = selectItemList.iterator(); it.hasNext();) {
+ i++;
+ SelectItem selectItem = (SelectItem) it.next();
+ if (selectItem instanceof SelectItemGroup) {
+ SelectItem[] items = ((SelectItemGroup) selectItem).getSelectItems();
+ for (int j = 0; j < items.length; j++) {
+ encodeItem(context, component, converter, items[i], source, "group:" + Integer.toString(j));
+ }
} else {
- selectItemList = selectItemsForSelectedValues;
+ encodeItem(context, component, converter, selectItem, source, Integer.toString(i));
}
-
- int i = 0;
- for (Iterator it = selectItemList.iterator(); it.hasNext();) {
- i++;
- SelectItem selectItem = (SelectItem)it.next();
- if (selectItem instanceof SelectItemGroup) {
- //TODO
- } else {
- String itemStrValue = PickListUtils.getConvertedStringValue(context, component, converter, selectItem.getValue());
-
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.TR_ELEMENT, component);
- String clientId = component.getClientId(context);
- if (source) {
- clientId += ":source:";
- }
- String id = clientId + ":" + i;
- writer.writeAttribute("id", id, null);
-
- StringBuffer rowClassName = new StringBuffer();
- StringBuffer cellClassName = new StringBuffer();
- if (source) {
- rowClassName.append("rich-picklist-source-row");
- cellClassName.append("rich-picklist-source-cell");
- } else {
- rowClassName.append("rich-picklist-target-row");
- cellClassName.append("rich-picklist-target-cell");
- }
-
- writer.writeAttribute("class", rowClassName.toString(), null);
- writer.startElement(HTML.td_ELEM, component);
- Object width = component.getAttributes().get("width");
- writer.writeAttribute(HTML.class_ATTRIBUTE, cellClassName, null);
-
- if (width != null) {
- writer.writeAttribute("style", "width: " + HtmlUtil.qualifySize(width.toString()), null);
- }
-
- encodeSpacer(context, component, writer);
-
- boolean escape = isTrue(component.getAttributes().get("escape"));
- if (escape) {
- writer.writeText(selectItem.getLabel(), null);
- } else {
- writer.write(selectItem.getLabel());
- }
-
- encodeItemValue(context, component, writer, id, itemStrValue, lookupSet, i);
- writer.endElement(HTML.td_ELEM);
- writer.endElement(HTML.TR_ELEMENT);
- }
- }
}
-
- public void encodeTargetRows(FacesContext context, UIComponent component) throws IOException {
- encodeRows(context, component, false);
+ }
+
+ public void encodeItem(FacesContext context, UIComponent component, Converter converter, SelectItem selectItem, boolean source, String suff)
+ throws IOException {
+
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(HTML.TR_ELEMENT, component);
+ String clientId = component.getClientId(context);
+ if (source) {
+ clientId += ":source:";
}
-
- public void encodeSourceRows(FacesContext context, UIComponent component) throws IOException {
- encodeRows(context, component, true);
+ String id = clientId + ":" + suff;
+ writer.writeAttribute("id", id, null);
+
+ StringBuffer rowClassName = new StringBuffer();
+ StringBuffer cellClassName = new StringBuffer();
+ if (source) {
+ rowClassName.append("rich-picklist-source-row");
+ cellClassName.append("rich-picklist-source-cell");
+ } else {
+ rowClassName.append("rich-picklist-target-row");
+ cellClassName.append("rich-picklist-target-cell");
}
-
- private void encodeItemValue(FacesContext context, UIComponent component,
- ResponseWriter writer, String id,
- String itemStrValue, Set<SelectItem> lookupSet, int rowKey) throws IOException { //rowKey = i
- writer.startElement(HTML.INPUT_ELEM, component);
- writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE, id, null);
- StringBuffer value = new StringBuffer();
- value.append(itemStrValue);
- writer.writeAttribute(HTML.value_ATTRIBUTE, value.toString(), null);
- writer.writeAttribute(HTML.id_ATTRIBUTE, id + "StateInput", null);
- writer.endElement(HTML.INPUT_ELEM);
+ writer.writeAttribute("class", rowClassName.toString(), null);
+ writer.startElement(HTML.td_ELEM, component);
+ Object width = component.getAttributes().get("width");
+ writer.writeAttribute(HTML.class_ATTRIBUTE, cellClassName, null);
+
+ if (width != null) {
+ writer.writeAttribute("style", "width: " + HtmlUtil.qualifySize(width.toString()), null);
}
-
- protected void encodeSpacer(FacesContext context, UIComponent component,
- ResponseWriter writer) throws IOException {
- writer.startElement(HTML.IMG_ELEMENT, component);
- writer.writeAttribute(HTML.src_ATTRIBUTE, getResource("/org/richfaces/renderkit/html/images/spacer.gif").getUri(context, null), null);
- writer.writeAttribute(HTML.style_ATTRIBUTE, "width:1px;height:1px;", null);
- writer.endElement(HTML.IMG_ELEMENT);
+
+ encodeSpacer(context, component, writer);
+
+ boolean escape = isTrue(component.getAttributes().get("escape"));
+ if (escape) {
+ writer.writeText(selectItem.getLabel(), null);
+ } else {
+ writer.write(selectItem.getLabel());
}
-
- public void encodeHiddenField(FacesContext context, UIComponent component) throws IOException {
- UIPickList pl = (UIPickList) component;
- ResponseWriter writer = context.getResponseWriter();
- Converter converter = PickListUtils.findUISelectManyConverterFailsafe(context, pl);
- Set lookupSet = PickListUtils.getSubmittedOrSelectedValuesAsSet(true, (UIPickList) pl, context, converter);
- encodeHiddenField(context, pl, pl.getClientId(context) + HIDDEN_SUFFIX, lookupSet, writer);
- }
-
- private void encodeHiddenField(FacesContext context, UIComponent component,
- String hiddenFieldCliendId, Set lookupSet, ResponseWriter writer) throws IOException {
- writer.startElement(HTML.INPUT_ELEM, component);
- writer.writeAttribute(HTML.TYPE_ATTR, "hidden", "type");
- writer.writeAttribute(HTML.id_ATTRIBUTE, hiddenFieldCliendId, "id");
- writer.writeAttribute("name", hiddenFieldCliendId, null);
- StringBuffer sb = new StringBuffer();
- int n = 0;
-
- for (Iterator i = lookupSet.iterator(); i.hasNext();) {
- if (n > 0) {
- sb.append(",");
- }
- String value = (String) i.next();
- sb.append(value);
- n++;
- }
- writer.writeAttribute(HTML.value_ATTRIBUTE, sb.toString(), null);
- writer.endElement(HTML.INPUT_ELEM);
+ String itemValue = PickListUtils.getConvertedStringValue(context, component, converter, selectItem.getValue());
+ encodeItemValue(context, component, writer, id, itemValue);
+ writer.endElement(HTML.td_ELEM);
+ writer.endElement(HTML.TR_ELEMENT);
+ }
+
+ public void encodeTargetRows(FacesContext context, UIComponent component) throws IOException {
+ encodeRows(context, component, false);
+ }
+
+ public void encodeSourceRows(FacesContext context, UIComponent component) throws IOException {
+ encodeRows(context, component, true);
+ }
+
+ private void encodeItemValue(FacesContext context, UIComponent component, ResponseWriter writer, String id, String itemValue) throws IOException { //rowKey = i
+
+ writer.startElement(HTML.INPUT_ELEM, component);
+ writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
+ writer.writeAttribute(HTML.NAME_ATTRIBUTE, id, null);
+
+ StringBuffer value = new StringBuffer();
+
+ value.append(itemValue);
+ writer.writeAttribute(HTML.value_ATTRIBUTE, value.toString(), null);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, id + "StateInput", null);
+ writer.endElement(HTML.INPUT_ELEM);
+ }
+
+ protected void encodeSpacer(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException {
+ writer.startElement(HTML.IMG_ELEMENT, component);
+ writer.writeAttribute(HTML.src_ATTRIBUTE, getResource("/org/richfaces/renderkit/html/images/spacer.gif").getUri(context, null), null);
+ writer.writeAttribute(HTML.style_ATTRIBUTE, "width:1px;height:1px;", null);
+ writer.endElement(HTML.IMG_ELEMENT);
+ }
+
+ public void encodeHiddenField(FacesContext context, UIComponent component) throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ Converter converter = PickListUtils.findUISelectManyConverterFailsafe(context, component);
+ List lookupList = PickListUtils.getValuesList(component, context, converter);
+ encodeHiddenField(context, component, lookupList, writer);
+ }
+
+ private void encodeHiddenField(FacesContext context, UIComponent component, List lookupList, ResponseWriter writer) throws IOException {
+ String hiddenFieldCliendId = component.getClientId(context) + HIDDEN_SUFFIX;
+ writer.startElement(HTML.INPUT_ELEM, component);
+ writer.writeAttribute(HTML.TYPE_ATTR, "hidden", "type");
+ writer.writeAttribute(HTML.id_ATTRIBUTE, hiddenFieldCliendId, "id");
+ writer.writeAttribute("name", hiddenFieldCliendId, null);
+ StringBuffer sb = new StringBuffer();
+ int n = 0;
+
+ for (Iterator i = lookupList.iterator(); i.hasNext();) {
+ if (n > 0) {
+ sb.append(",");
+ }
+ String value = (String) i.next();
+ sb.append(value);
+ n++;
}
-
- protected Class <? extends UIComponent> getComponentClass() {
- return UIPickList.class;
- }
-
- public String getAsEventHandler(FacesContext context, UIComponent component, String attributeName) {
- String event = (String) component.getAttributes().get(attributeName);
- ScriptString result = JSReference.NULL;
-
- if (event != null) {
- event = event.trim();
- if (event.length() != 0) {
- JSFunctionDefinition function = new JSFunctionDefinition();
- function.addParameter("event");
- function.addToBody(event);
- result = function;
- }
- }
- return ScriptUtils.toScript(result);
+ writer.writeAttribute(HTML.value_ATTRIBUTE, sb.toString(), null);
+ writer.endElement(HTML.INPUT_ELEM);
+ }
+
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UIPickList.class;
+ }
+
+ public String getAsEventHandler(FacesContext context, UIComponent component, String attributeName) {
+ String event = (String) component.getAttributes().get(attributeName);
+ ScriptString result = JSReference.NULL;
+
+ if (event != null) {
+ event = event.trim();
+ if (event.length() != 0) {
+ JSFunctionDefinition function = new JSFunctionDefinition();
+ function.addParameter("event");
+ function.addToBody(event);
+ result = function;
+ }
}
-
- public String getColumnClassesAsJSArray(FacesContext context, UIComponent component) {
- return ScriptUtils.toScript(getClassesAsList(context, component, "columnClasses"));
+
+ return ScriptUtils.toScript(result);
+ }
+
+ public String getColumnClassesAsJSArray(FacesContext context, UIComponent component) {
+ return ScriptUtils.toScript(getClassesAsList(context, component, "columnClasses"));
+ }
+
+ public String getRowClassesAsJSArray(FacesContext context, UIComponent component) {
+ return ScriptUtils.toScript(getClassesAsList(context, component, "rowClasses"));
+ }
+
+ protected List getClassesAsList(FacesContext context, UIComponent component, String attr) {
+ String value = (String) ((UIComponent) component).getAttributes().get(attr);
+ if (value != null && (value.length() != 0)) {
+ return Arrays.asList(value.split(","));
}
-
- public String getRowClassesAsJSArray(FacesContext context, UIComponent component) {
- return ScriptUtils.toScript(getClassesAsList(context, component, "rowClasses"));
- }
-
- protected List getClassesAsList(FacesContext context, UIComponent component, String attr) {
- String value = (String) ((UIComponent) component).getAttributes().get(attr);
- if (value != null && (value.length() != 0)) {
- return Arrays.asList(value.split(","));
+ return null;
+ }
+
+ public void encodePickListControlsFacets(FacesContext context, UIComponent component) throws IOException {
+ String clientId = component.getClientId(context);
+ ResponseWriter writer = context.getResponseWriter();
+ int divider = SHUTTLE_HELPERS.length / 2;
+ boolean enable = false;
+ for (int i = 0; i < SHUTTLE_HELPERS.length; i++) {
+ OrderingComponentRendererBase.ControlsHelper helper = SHUTTLE_HELPERS[i];
+ boolean isDisabled = helper.getButtonStyleClass().equals(ListShuttleControlsHelper.DISABLED_STYLE_PREF);
+ if (helper.getBundlePropertyName().equals(ListShuttleControlsHelper.BUNDLE_REMOVE_ALL_LABEL)) {
+ enable = isSelectedList;
+ if ((!enable && isDisabled) || (enable && !isDisabled)) {
+ enable = true;
+ } else {
+ enable = false;
}
- return null;
+ } else if (helper.getBundlePropertyName().equals(ListShuttleControlsHelper.BUNDLE_COPY_ALL_LABEL)) {
+ enable = isAvailableList;
+ if ((!enable && isDisabled) || (enable && !isDisabled)) {
+ enable = true;
+ } else {
+ enable = false;
+ }
+ } else {
+ if (helper.getButtonStyleClass().equals(ListShuttleControlsHelper.DISABLED_STYLE_PREF)) {
+ enable = true;
+ } else {
+ enable = false;
+ }
+ }
+ encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer, enable, "rich-list-picklist-button", " rich-picklist-control");
}
-
- public void encodePickListControlsFacets(FacesContext context, UIComponent component) throws IOException {
- String clientId = component.getClientId(context);
- ResponseWriter writer = context.getResponseWriter();
- int divider = SHUTTLE_HELPERS.length / 2;
- boolean enable = false;
- for (int i = 0; i < SHUTTLE_HELPERS.length; i++) {
- OrderingComponentRendererBase.ControlsHelper helper = SHUTTLE_HELPERS[i];
- boolean isDisabled = helper.getButtonStyleClass().equals(ListShuttleControlsHelper.DISABLED_STYLE_PREF);
- if (helper.getBundlePropertyName().equals(ListShuttleControlsHelper.BUNDLE_REMOVE_ALL_LABEL)) {
- enable = isSelectedList;
- if ((!enable && isDisabled) || (enable && !isDisabled)) {
- enable = true;
- } else {
- enable = false;
- }
- } else if (helper.getBundlePropertyName().equals(ListShuttleControlsHelper.BUNDLE_COPY_ALL_LABEL)) {
- enable = isAvailableList;
- if ((!enable && isDisabled) || (enable && !isDisabled)) {
- enable = true;
- } else {
- enable = false;
- }
- } else {
- if (helper.getButtonStyleClass().equals(ListShuttleControlsHelper.DISABLED_STYLE_PREF)) {
- enable = true;
- } else {
- enable = false;
- }
- }
- encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer, enable,
- "rich-list-picklist-button", " rich-picklist-control");
- }
- }
-
- protected void encodeControlFacet(FacesContext context,
- UIComponent component, OrderingComponentRendererBase.ControlsHelper helper,
- String clientId, ResponseWriter writer, boolean enabled, String baseStyle,
- String baseControlStyle) throws IOException {
- Locale locale = null;
-
- UIViewRoot viewRoot = context.getViewRoot();
- if (viewRoot != null) {
- locale = viewRoot.getLocale();
- }
-
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- ResourceBundle bundle = null;
-
- if (locale != null) {
- try {
- bundle = ResourceBundle.getBundle(bundleName, locale, contextClassLoader);
- } catch (MissingResourceException e) {
- }
- }
-
- Map attributes = component.getAttributes();
- UIComponent facet = component.getFacet(helper.getFacetName());
- boolean useFacet = (facet != null && facet.isRendered());
- renderDefaultControl(context, component, writer, useFacet, helper, clientId, bundle ,enabled, baseStyle, baseControlStyle);
+ }
+
+ protected void encodeControlFacet(FacesContext context, UIComponent component, OrderingComponentRendererBase.ControlsHelper helper, String clientId,
+ ResponseWriter writer, boolean enabled, String baseStyle, String baseControlStyle) throws IOException {
+ Locale locale = null;
+
+ UIViewRoot viewRoot = context.getViewRoot();
+ if (viewRoot != null) {
+ locale = viewRoot.getLocale();
}
-
- protected void renderDefaultControl(FacesContext context,
- UIComponent orderingList, ResponseWriter writer,
- boolean useFacet, OrderingComponentRendererBase.ControlsHelper helper, String clientId, ResourceBundle bundle,
- boolean enabled, String baseStyle, String baseControlStyle)
- throws IOException {
+
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ ResourceBundle bundle = null;
+
+ if (locale != null) {
+ try {
+ bundle = ResourceBundle.getBundle(bundleName, locale, contextClassLoader);
+ } catch (MissingResourceException e) {
+ }
+ }
+
+ Map attributes = component.getAttributes();
+ UIComponent facet = component.getFacet(helper.getFacetName());
+ boolean useFacet = (facet != null && facet.isRendered());
+ renderDefaultControl(context, component, writer, useFacet, helper, clientId, bundle, enabled, baseStyle, baseControlStyle);
+ }
+
+ protected void renderDefaultControl(FacesContext context, UIComponent orderingList, ResponseWriter writer, boolean useFacet,
+ OrderingComponentRendererBase.ControlsHelper helper, String clientId, ResourceBundle bundle, boolean enabled, String baseStyle,
+ String baseControlStyle) throws IOException {
UIComponent facet = orderingList.getFacet(helper.getFacetName());
String customEvent = null;
Map attributes = orderingList.getAttributes();
-
+
if (helper.customEvent != null) {
- customEvent = (String) attributes.get(helper.customEvent);
+ customEvent = (String) attributes.get(helper.customEvent);
}
String styleFromAttribute = (String) attributes.get(helper.styleFromAttribute);
@@ -370,98 +374,97 @@
String currentStyle = baseControlStyle + helper.getStyleClassName();
if (styleFromAttribute != null) {
- currentStyle = styleFromAttribute.concat(currentStyle);
+ currentStyle = styleFromAttribute.concat(currentStyle);
}
writer.startElement(HTML.DIV_ELEM, orderingList);
String controlId = clientId + helper.getIdSuffix();
- writer.writeAttribute(HTML.id_ATTRIBUTE, controlId, null); //FIXME:
+ writer.writeAttribute(HTML.id_ATTRIBUTE, controlId, null); // FIXME:
writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
String style = null;
-
+
if (enabled) {
- style = "display:block;";
+ style = "display:block;";
} else {
- style = "display:none;";
+ style = "display:none;";
}
-
+
writer.writeAttribute(HTML.style_ATTRIBUTE, style, null);
-
+
if (!useFacet) {
- writer.startElement(HTML.DIV_ELEM, orderingList);
- writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + helper.getButtonStyleClass(), null);
-
- if (helper.enable) {
- writer.writeAttribute(HTML.onmouseover_ATTRIBUTE, "this.className='" + baseStyleLight + "'", null);
- writer.writeAttribute(HTML.onmousedown_ATTRIBUTE, "this.className='" + baseStylePress + "'", null);
- writer.writeAttribute(HTML.onmouseup_ATTRIBUTE, "this.className='" + baseStyle + "'", null);
- writer.writeAttribute(HTML.onmouseout_ATTRIBUTE, "this.className='" + baseStyle + "'", null);
- }
-
+ writer.startElement(HTML.DIV_ELEM, orderingList);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + helper.getButtonStyleClass(), null);
+
+ if (helper.enable) {
+ writer.writeAttribute(HTML.onmouseover_ATTRIBUTE, "this.className='" + baseStyleLight + "'", null);
+ writer.writeAttribute(HTML.onmousedown_ATTRIBUTE, "this.className='" + baseStylePress + "'", null);
+ writer.writeAttribute(HTML.onmouseup_ATTRIBUTE, "this.className='" + baseStyle + "'", null);
+ writer.writeAttribute(HTML.onmouseout_ATTRIBUTE, "this.className='" + baseStyle + "'", null);
+ }
+
+ writer.startElement(HTML.a_ELEMENT, orderingList);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, controlId + "link", null); // FIXME:
+ writer.writeAttribute(HTML.HREF_ATTR, "#", null);
+ writer.writeAttribute(HTML.onclick_ATTRIBUTE, "return false;", null);
+
+ if (!helper.enable) {
+ writer.writeAttribute(HTML.DISABLED_ATTR, "disabled", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-a-disabled", null);
writer.startElement(HTML.a_ELEMENT, orderingList);
- writer.writeAttribute(HTML.id_ATTRIBUTE, controlId + "link", null); //FIXME:
- writer.writeAttribute(HTML.HREF_ATTR, "#", null);
- writer.writeAttribute(HTML.onclick_ATTRIBUTE, "return false;", null);
-
- if (!helper.enable) {
- writer.writeAttribute(HTML.DISABLED_ATTR, "disabled", null);
- writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-a-disabled", null);
- writer.startElement(HTML.a_ELEMENT, orderingList);
- } else {
- writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-selection", null);
- writer.writeAttribute(HTML.onblur_ATTRIBUTE, "Control.onblur(this);", null);
- writer.writeAttribute(HTML.onfocus_ATTRIBUTE, "Control.onfocus(this);", null);
- }
-
- writer.startElement(HTML.DIV_ELEM, orderingList);
- writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-content", null);
+ } else {
+ writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-selection", null);
+ writer.writeAttribute(HTML.onblur_ATTRIBUTE, "Control.onblur(this);", null);
+ writer.writeAttribute(HTML.onfocus_ATTRIBUTE, "Control.onfocus(this);", null);
+ }
+
+ writer.startElement(HTML.DIV_ELEM, orderingList);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-content", null);
}
if (customEvent != null) {
- writer.writeAttribute(HTML.onclick_ATTRIBUTE, customEvent,null);
+ writer.writeAttribute(HTML.onclick_ATTRIBUTE, customEvent, null);
}
-
+
if (useFacet) {
- renderChild(context, facet);
+ renderChild(context, facet);
} else {
- writer.startElement(HTML.IMG_ELEMENT, orderingList);
- writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
- writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
- writer.writeAttribute(HTML.border_ATTRIBUTE, "0", null);
- writer.writeAttribute(HTML.alt_ATTRIBUTE, helper.getFacetName(),null);
- writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(helper.getImageURI()).getUri(context, null), null);
- writer.endElement(HTML.IMG_ELEMENT);
- //TODO check properties!!!
-// writer.write(helper.getDefaultText());
+ writer.startElement(HTML.IMG_ELEMENT, orderingList);
+ writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
+ writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
+ writer.writeAttribute(HTML.border_ATTRIBUTE, "0", null);
+ writer.writeAttribute(HTML.alt_ATTRIBUTE, helper.getFacetName(), null);
+ writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(helper.getImageURI()).getUri(context, null), null);
+ writer.endElement(HTML.IMG_ELEMENT);
+ // TODO check properties!!!
+ // writer.write(helper.getDefaultText());
- if (getUtils().isBooleanAttribute(orderingList, SHOW_LABELS_ATTRIBUTE_NAME)) {
+ if (getUtils().isBooleanAttribute(orderingList, SHOW_LABELS_ATTRIBUTE_NAME)) {
- String label = (String) attributes.get(helper.getLabelAttributeName());
- if (label == null && bundle != null) {
- try {
- label = bundle.getString(helper.getBundlePropertyName());
- } catch (MissingResourceException e) {
- }
- }
+ String label = (String) attributes.get(helper.getLabelAttributeName());
+ if (label == null && bundle != null) {
+ try {
+ label = bundle.getString(helper.getBundlePropertyName());
+ } catch (MissingResourceException e) {
+ }
+ }
- if (label == null || label.equals("")) {
- label = helper.getDefaultText();
- }
-
- writer.write(label);
+ if (label == null || label.equals("")) {
+ label = helper.getDefaultText();
}
+
+ writer.write(label);
+ }
}
-
+
if (!useFacet) {
- writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.DIV_ELEM);
+ if (!helper.enable) {
+ writer.endElement(HTML.a_ELEMENT);
+ }
- if (!helper.enable) {
- writer.endElement(HTML.a_ELEMENT);
- }
-
- writer.endElement(HTML.a_ELEMENT);
- writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.a_ELEMENT);
+ writer.endElement(HTML.DIV_ELEM);
}
writer.endElement(HTML.DIV_ELEM);
- }
- }
+ }
+}
16 years, 10 months