JBoss Rich Faces SVN: r13242 - trunk/test-applications/jsp/src/main/java/util/converter.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2009-03-27 06:29:04 -0400 (Fri, 27 Mar 2009)
New Revision: 13242
Modified:
trunk/test-applications/jsp/src/main/java/util/converter/DataConverter.java
Log:
Modified: trunk/test-applications/jsp/src/main/java/util/converter/DataConverter.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/util/converter/DataConverter.java 2009-03-27 10:28:29 UTC (rev 13241)
+++ trunk/test-applications/jsp/src/main/java/util/converter/DataConverter.java 2009-03-27 10:29:04 UTC (rev 13242)
@@ -12,6 +12,7 @@
public Object getAsObject(FacesContext context, UIComponent component,
String value) {
+ System.out.println("<<<LS: getAsObject>>>");
String [] str = value.split(":");
return new Data(str[0], str[1], str[2], str[3],
Integer.parseInt(str[4]), Integer.parseInt(str[5]), Integer.parseInt(str[6]), Integer.parseInt(str[7]),
@@ -20,6 +21,7 @@
public String getAsString(FacesContext context, UIComponent component,
Object value) {
+ System.out.println("<<<LS: getAsString>>>");
if (value instanceof Data) {
Data data = (Data) value;
return data.toString();
15 years, 9 months
JBoss Rich Faces SVN: r13241 - trunk/test-applications/jsp/src/main/java/inplaceSelect.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2009-03-27 06:28:29 -0400 (Fri, 27 Mar 2009)
New Revision: 13241
Modified:
trunk/test-applications/jsp/src/main/java/inplaceSelect/InplaceSelect.java
Log:
Modified: trunk/test-applications/jsp/src/main/java/inplaceSelect/InplaceSelect.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/inplaceSelect/InplaceSelect.java 2009-03-27 10:27:51 UTC (rev 13240)
+++ trunk/test-applications/jsp/src/main/java/inplaceSelect/InplaceSelect.java 2009-03-27 10:28:29 UTC (rev 13241)
@@ -1,8 +1,12 @@
package inplaceSelect;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
import org.richfaces.component.html.HtmlInplaceSelect;
@@ -33,6 +37,7 @@
private HtmlInplaceSelect myInplaceSelect = null;
private String bindLabel;
private String layout;
+ private List<SelectItem> itemsList;
public void addHtmlInplaceSelect(){
ComponentInfo info = ComponentInfo.getInstance();
@@ -62,6 +67,13 @@
required = false;
requiredMessage="requiredMessage";
layout = "inline";
+
+ itemsList = new ArrayList<SelectItem>();
+ itemsList.add(new SelectItem("1", "ItemOne"));
+ itemsList.add(new SelectItem("2", "ItemTwo"));
+ itemsList.add(new SelectItem("3", "ItemThree"));
+ itemsList.add(new SelectItem("4", "ItemFour"));
+ itemsList.add(new SelectItem("5", "ItemFive"));
}
public String getBindLabel() {
@@ -279,5 +291,13 @@
this.requiredMessage = requiredMessage;
}
+ public List<SelectItem> getItemsList() {
+ return itemsList;
+ }
+ public void setItemsList(List<SelectItem> itemsList) {
+ this.itemsList = itemsList;
+ }
+
+
}
15 years, 9 months
JBoss Rich Faces SVN: r13240 - trunk/test-applications/jsp/src/main/java/colorPicker.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2009-03-27 06:27:51 -0400 (Fri, 27 Mar 2009)
New Revision: 13240
Added:
trunk/test-applications/jsp/src/main/java/colorPicker/ColorPickerConverter.java
Modified:
trunk/test-applications/jsp/src/main/java/colorPicker/ColorPicker.java
Log:
Modified: trunk/test-applications/jsp/src/main/java/colorPicker/ColorPicker.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/colorPicker/ColorPicker.java 2009-03-27 09:32:36 UTC (rev 13239)
+++ trunk/test-applications/jsp/src/main/java/colorPicker/ColorPicker.java 2009-03-27 10:27:51 UTC (rev 13240)
@@ -22,14 +22,26 @@
private boolean immediate;
private boolean localValueSet;
private boolean rendered;
+ private boolean facets;
private boolean required;
private String requiredMessage;
private boolean valid;
private String validatorMessage;
private String value;
+ private String facetsValue;
private String bindLabel;
+ private String showEvent;
+ public String getShowEvent() {
+ return showEvent;
+ }
+
+ public void setShowEvent(String showEvent) {
+ this.showEvent = showEvent;
+ }
+
public ColorPicker() {
+ facets = false;
colorMode = "rgb";
converterMessage = "custom converter message";
flat = false;
@@ -41,7 +53,9 @@
valid = true;
validatorMessage = "custom validator message";
value = "rgb(255, 250, 240)";
+ facetsValue = "rgb(0, 0, 0)";
bindLabel = "Click Binding";
+ showEvent = "onclick";
}
public void checkBinding(ActionEvent e){
@@ -69,9 +83,10 @@
public void validate(FacesContext context, UIComponent component,
Object value) throws ValidatorException {
+ System.out.println("<<<Color Picker Validator Works>>>");
String str = value.toString();
if (str.startsWith("rgb")) {
- if (str.indexOf("100") != -1)
+ if (str.indexOf("56") != -1)
throw new ValidatorException(new FacesMessage(
"Test validator: 100 is restricted!"));
}
@@ -187,4 +202,21 @@
this.bindLabel = bindLabel;
}
+ public boolean isFacets() {
+ return facets;
+ }
+
+ public void setFacets(boolean facets) {
+ this.facets = facets;
+ }
+
+ public String getFacetsValue() {
+ return facetsValue;
+ }
+
+ public void setFacetsValue(String facetsValue) {
+ this.facetsValue = facetsValue;
+ }
+
+
}
Added: trunk/test-applications/jsp/src/main/java/colorPicker/ColorPickerConverter.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/colorPicker/ColorPickerConverter.java (rev 0)
+++ trunk/test-applications/jsp/src/main/java/colorPicker/ColorPickerConverter.java 2009-03-27 10:27:51 UTC (rev 13240)
@@ -0,0 +1,30 @@
+package colorPicker;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.swing.tree.TreeNode;
+import util.data.*;
+
+public class ColorPickerConverter implements Converter {
+
+ public Object getAsObject(FacesContext context, UIComponent component,
+ String value) {
+ System.out.println("<<<ColorPicker Converter getAsObject() Called>>>");
+ String str = value.toString();
+ return str;
+ }
+
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) {
+ System.out.println("<<<ColorPicker Converter getAsString() Called>>>");
+ if (value instanceof String) {
+ String str = value.toString();
+ return str;
+ } else
+ throw new ConverterException(
+ "Test Application: Error in custom converted colorPicker.ColorPickerConverter.java");
+ }
+
+}
15 years, 9 months
JBoss Rich Faces SVN: r13239 - trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util.
by richfaces-svn-commits@lists.jboss.org
Author: alevkovsky
Date: 2009-03-27 05:32:36 -0400 (Fri, 27 Mar 2009)
New Revision: 13239
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileUtils.java
Log:
Change messages for copy file
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileUtils.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileUtils.java 2009-03-27 00:27:23 UTC (rev 13238)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileUtils.java 2009-03-27 09:32:36 UTC (rev 13239)
@@ -4,231 +4,231 @@
import java.util.zip.*;
-
/**
* Command line program to copy a file to another directory.
- *
+ *
* @author Marco Schmidt
*/
//TODO nick - COPYRIGHT!!!
public class FileUtils {
- // constant values for the override option
- public static final int OVERWRITE_ALWAYS = 1;
- public static final int OVERWRITE_NEVER = 2;
- public static final int OVERWRITE_ASK = 3;
+ // constant values for the override option
+ public static final int OVERWRITE_ALWAYS = 1;
+ public static final int OVERWRITE_NEVER = 2;
+ public static final int OVERWRITE_ASK = 3;
- // program options initialized to default values
- private static int bufferSize = 4 * 1024;
- private static boolean clock = true;
- private static boolean copyOriginalTimestamp = true;
- private static boolean verify = true;
- private static int override = OVERWRITE_ASK;
+ // program options initialized to default values
+ private static final int BUFFER_SIZE = 4 * 1024;
+ private static final boolean CLOCK = true;
+ private static final boolean COPY_ORIGINAL_TIMESTAMP = true;
+ private static final boolean VERIFY = true;
+ private static final int OVERRIDE = OVERWRITE_ASK;
- public static Long copyFile(File srcFile, File destFile) throws IOException {
- if(!srcFile.getPath().toLowerCase().endsWith("jpg") && !srcFile.getPath().toLowerCase().endsWith("jpeg")){
- //TODO nick - should be return null
- return -1L;
- }
- InputStream in = new FileInputStream(srcFile);
- OutputStream out = new FileOutputStream(destFile);
- long millis = System.currentTimeMillis();
- CRC32 checksum = null;
- if (verify) {
- checksum = new CRC32();
- checksum.reset();
- }
- byte[] buffer = new byte[bufferSize];
- int bytesRead;
- while ((bytesRead = in.read(buffer)) >= 0) {
- if (verify) {
- checksum.update(buffer, 0, bytesRead);
- }
- out.write(buffer, 0, bytesRead);
- }
-
- //TODO nick - this should be in finally block
- out.close();
- in.close();
- if (clock) {
- millis = System.currentTimeMillis() - millis;
- System.out.println("Second(s): " + (millis / 1000L));
- }
- if (verify) {
- return new Long(checksum.getValue());
- } else {
- return null;
- }
- }
+ public static Long copyFile(File srcFile, File destFile) throws IOException {
+ if (!srcFile.getPath().toLowerCase().endsWith("jpg") && !srcFile.getPath().toLowerCase().endsWith("jpeg")) {
+ //TODO nick - should be return null
+ return -1L;
+ }
+ final InputStream in = new FileInputStream(srcFile);
+ final OutputStream out = new FileOutputStream(destFile);
+ long millis = System.currentTimeMillis();
+ CRC32 checksum;
+ if (VERIFY) {
+ checksum = new CRC32();
+ checksum.reset();
+ }
+ final byte[] buffer = new byte[BUFFER_SIZE];
+ int bytesRead = in.read(buffer);
+ while (bytesRead >= 0) {
+ if (VERIFY) {
+ checksum.update(buffer, 0, bytesRead);
+ }
+ out.write(buffer, 0, bytesRead);
+ bytesRead = in.read(buffer);
+ }
- public static Long createChecksum(File file) throws IOException {
- long millis = System.currentTimeMillis();
- InputStream in = new FileInputStream(file);
- CRC32 checksum = new CRC32();
- checksum.reset();
- byte[] buffer = new byte[bufferSize];
- int bytesRead;
- while ((bytesRead = in.read(buffer)) >= 0) {
- checksum.update(buffer, 0, bytesRead);
- }
- in.close();
- if (clock) {
- millis = System.currentTimeMillis() - millis;
- System.out.println("Second(s): " + (millis / 1000L));
- }
- return new Long(checksum.getValue());
- }
+ //TODO nick - this should be in finally block
+ out.close();
+ in.close();
+ if (CLOCK) {
+ millis = System.currentTimeMillis() - millis;
+ System.out.println("Copy file '" + srcFile.getPath() + "' on " + millis / 1000L + " second(s)");
+ }
+ if (VERIFY) {
+ return checksum.getValue();
+ } else {
+ return null;
+ }
+ }
- /**
- * Determine if data is to be copied to given file. Take into consideration
- * override option and ask user in case file exists and override option is
- * ask.
- *
- * @param file
- * File object for potential destination file
- * @return true if data is to be copied to file, false if not
- */
- public static boolean doCopy(File file) {
- boolean exists = file.exists();
- if (override == OVERWRITE_ALWAYS || !exists) {
- return true;
- } else if (override == OVERWRITE_NEVER) {
- return false;
- } else if (override == OVERWRITE_ASK) {
- return readYesNoFromStandardInput("File exists. "
- + "Overwrite (y/n)?");
- } else {
- throw new InternalError("Program error. Invalid "
- + "value for override: " + override);
- }
- }
+ public static Long createChecksum(File file) throws IOException {
+ long millis = System.currentTimeMillis();
+ final InputStream in = new FileInputStream(file);
+ final CRC32 checksum = new CRC32();
+ checksum.reset();
+ final byte[] buffer = new byte[BUFFER_SIZE];
+ int bytesRead = in.read(buffer);
+ while (bytesRead >= 0) {
+ checksum.update(buffer, 0, bytesRead);
+ bytesRead = in.read(buffer);
+ }
+ in.close();
+ if (CLOCK) {
+ millis = System.currentTimeMillis() - millis;
+ System.out.println("Checksum for file '" + file.getPath() + "' created on " + millis / 1000L + " second(s)");
+ }
+ return checksum.getValue();
+ }
- public static void main(String[] args) throws IOException {
- // make sure there are exactly two arguments
- if (args.length != 2) {
- System.err.println("Usage: CopyFile SRC-FILE-NAME DEST-DIR-NAME");
- System.exit(1);
- }
- // make sure the source file is indeed a readable file
- File srcFile = new File(args[0]);
- if (!srcFile.isFile() || !srcFile.canRead()) {
- System.err.println("Not a readable file: " + srcFile.getName());
- System.exit(1);
- }
- // make sure the second argument is a directory
- File destDir = new File(args[1]);
- if (!destDir.isDirectory()) {
- System.err.println("Not a directory: " + destDir.getName());
- System.exit(1);
- }
- // create File object for destination file
- File destFile = new File(destDir, srcFile.getName());
+ /**
+ * Determine if data is to be copied to given file. Take into consideration
+ * override option and ask user in case file exists and override option is
+ * ask.
+ *
+ * @param file File object for potential destination file
+ * @return true if data is to be copied to file, false if not
+ */
+ public static boolean doCopy(File file) {
+ final boolean exists = file.exists();
+ if (OVERRIDE == OVERWRITE_ALWAYS || !exists) {
+ return true;
+ } else if (OVERRIDE == OVERWRITE_NEVER) {
+ return false;
+ } else if (OVERRIDE == OVERWRITE_ASK) {
+ return readYesNoFromStandardInput("File exists. Overwrite (y/n)?");
+ } else {
+ throw new InternalError("Program error. Invalid "
+ + "value for override: " + OVERRIDE);
+ }
+ }
- // check if copying is desired given overwrite option
- if (!doCopy(destFile)) {
- return;
- }
+ public static void main(String[] args) throws IOException {
+ // make sure there are exactly two arguments
+ if (args.length != 2) {
+ System.err.println("Usage: CopyFile SRC-FILE-NAME DEST-DIR-NAME");
+ System.exit(1);
+ }
+ // make sure the source file is indeed a readable file
+ final File srcFile = new File(args[0]);
+ if (!srcFile.isFile() || !srcFile.canRead()) {
+ System.err.println("Not a readable file: " + srcFile.getName());
+ System.exit(1);
+ }
+ // make sure the second argument is a directory
+ final File destDir = new File(args[1]);
+ if (!destDir.isDirectory()) {
+ System.err.println("Not a directory: " + destDir.getName());
+ System.exit(1);
+ }
+ // create File object for destination file
+ final File destFile = new File(destDir, srcFile.getName());
- // copy file, optionally creating a checksum
- Long checksumSrc = copyFile(srcFile, destFile);
+ // check if copying is desired given overwrite option
+ if (!doCopy(destFile)) {
+ return;
+ }
- // copy timestamp of last modification
- if (copyOriginalTimestamp) {
- if (!destFile.setLastModified(srcFile.lastModified())) {
- System.err.println("Error: Could not set "
- + "timestamp of copied file.");
- }
- }
+ // copy file, optionally creating a checksum
+ final Long checksumSrc = copyFile(srcFile, destFile);
- // optionally verify file
- if (verify) {
- System.out.print("Verifying destination file...");
- Long checksumDest = createChecksum(destFile);
- if (checksumSrc.equals(checksumDest)) {
- System.out.println(" OK, files are equal.");
- } else {
- System.out.println(" Error: Checksums differ.");
- }
- }
- }
+ // copy timestamp of last modification
+ if (COPY_ORIGINAL_TIMESTAMP) {
+ if (!destFile.setLastModified(srcFile.lastModified())) {
+ System.err.println("Error: Could not set timestamp of copied file.");
+ }
+ }
- /**
- * Print a message to standard output and read lines from standard input
- * until yes or no (y or n) is entered.
- *
- * @param message
- * informative text to be answered by user
- * @return user answer, true for yes, false for no.
- */
- public static boolean readYesNoFromStandardInput(String message) {
- System.out.println(message);
- String line;
- BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
- Boolean answer = null;
- try {
- while ((line = in.readLine()) != null) {
- line = line.toLowerCase();
- if ("y".equals(line) || "yes".equals(line)) {
- answer = Boolean.TRUE;
- break;
- } else if ("n".equals(line) || "no".equals(line)) {
- answer = Boolean.FALSE;
- break;
- } else {
- System.out.println("Could not understand answer (\"" + line
- + "\"). Please use y for yes or n for no.");
- }
- }
- if (answer == null) {
- throw new IOException("Unexpected end of input from stdin.");
- }
- in.close();
- return answer.booleanValue();
- } catch (IOException ioe) {
- throw new InternalError(
- "Cannot read from stdin or write to stdout.");
- }
- }
+ // optionally verify file
+ if (VERIFY) {
+ System.out.print("Verifying destination file...");
+ final Long checksumDest = createChecksum(destFile);
+ if (checksumSrc.equals(checksumDest)) {
+ System.out.println(" OK, files are equal.");
+ } else {
+ System.out.println(" Error: Checksums differ.");
+ }
+ }
+ }
- public static void copyDirectory(File srcDir, File dstDir)
- throws IOException {
-
- //TODO nick - skip hidden/system directories
- if (".svn".equals(srcDir.getName())) {
- return;
- }
-
- if (srcDir.isDirectory()) {
- if (!dstDir.exists()) {
- dstDir.mkdir();
- }
+ /**
+ * Print a message to standard output and read lines from standard input
+ * until yes or no (y or n) is entered.
+ *
+ * @param message informative text to be answered by user
+ * @return user answer, true for yes, false for no.
+ */
+ public static boolean readYesNoFromStandardInput(String message) {
+ System.out.println(message);
+ final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
- String[] children = srcDir.list();
- for (int i = 0; i < children.length; i++) {
- copyDirectory(new File(srcDir, children[i]), new File(dstDir,
- children[i]));
- }
- } else {
- FileUtils.copyFile(srcDir, dstDir);
- }
- }
-
- public static void deleteDirectory(File dir) throws IOException {
- if (dir.isDirectory()) {
- if (dir.exists()) {
- File [] children = dir.listFiles();
- for (int i = 0; i < children.length; i++) {
- //TODO nick - add try/finally so that deletion continues if something failed
- deleteDirectory(children[i]);
- }
- }
+ try {
+ Boolean answer = null;
- } else {
- if (dir.exists()) {
- System.out.println(dir.delete());
- }
- }
- dir.delete();
- }
+ String line = in.readLine();
+ while (line != null) {
+ line = line.toLowerCase();
+ if ("y".equals(line) || "yes".equals(line)) {
+ answer = Boolean.TRUE;
+ break;
+ } else if ("n".equals(line) || "no".equals(line)) {
+ answer = Boolean.FALSE;
+ break;
+ } else {
+ System.out.println("Could not understand answer (\"" + line
+ + "\"). Please use y for yes or n for no.");
+ }
+ line = in.readLine();
+ }
+ if (answer == null) {
+ throw new IOException("Unexpected end of input from stdin.");
+ }
+ in.close();
+ return answer;
+ } catch (IOException ioe) {
+ throw new InternalError(
+ "Cannot read from stdin or write to stdout.");
+ }
+ }
+
+ public static void copyDirectory(File srcDir, File dstDir)
+ throws IOException {
+
+ //TODO nick - skip hidden/system directories
+ if (".svn".equals(srcDir.getName())) {
+ return;
+ }
+
+ if (srcDir.isDirectory()) {
+ if (!dstDir.exists()) {
+ dstDir.mkdir();
+ }
+
+ for (String aChildren : srcDir.list()) {
+ copyDirectory(new File(srcDir, aChildren), new File(dstDir, aChildren));
+ }
+ } else {
+ copyFile(srcDir, dstDir);
+ }
+ }
+
+ public static void deleteDirectory(File dir) throws IOException {
+ if (dir.isDirectory()) {
+ if (dir.exists()) {
+ for (File child : dir.listFiles()) {
+ //TODO nick - add try/finally so that deletion continues if something failed
+ deleteDirectory(child);
+ }
+ }
+
+ } else {
+ if (dir.exists()) {
+ final boolean isFileDeleted = dir.delete();
+ System.out.println((isFileDeleted ? "OK " : "CANCEL ") +
+ "Delete file '" + dir.getPath() + '\'');
+ }
+ }
+ dir.delete();
+ }
+
}
\ No newline at end of file
15 years, 9 months
JBoss Rich Faces SVN: r13238 - trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-03-26 20:27:23 -0400 (Thu, 26 Mar 2009)
New Revision: 13238
Modified:
trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js
Log:
https://jira.jboss.org/jira/browse/RF-6594
Modified: trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js
===================================================================
--- trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js 2009-03-26 23:44:14 UTC (rev 13237)
+++ trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js 2009-03-27 00:27:23 UTC (rev 13238)
@@ -319,21 +319,35 @@
var top = 0;
var left = 0;
- var viewPort = this._getWindowScrollOffset();
- var window = this._getWindowDimensions();
- if(window.height - (this.element.offset().top - viewPort.scrollTop) < this.picker.height()){
- top = this.element[0].offsetTop - this.picker.height();
- }else{
- top = this.element[0].offsetTop + this.element[0].offsetHeight;
+ this.picker.css({visibility: 'hidden'}).css({left: '0px', top: '0px', display: 'block'});
+
+ var win = $(window);
+ var winWidth = win.width();
+ var winHeight = win.height();
+
+ var spanOffsets = this.element.offset();
+ var pickerOffsets = this.picker.offset();
+
+ left = spanOffsets.left - pickerOffsets.left;
+ top = spanOffsets.top - pickerOffsets.top;
+
+ var relLeft = spanOffsets.left - win.scrollLeft();
+ var relTop = spanOffsets.top - win.scrollTop();
+
+ if (relTop + this.picker.height() + this.element.height() > winHeight && relTop - this.picker.height() > 0) {
+ top -= this.picker.height();
+ } else {
+ top += this.element.height();
}
- if(window.width - (this.element.offset().left - viewPort.scrollLeft) < this.picker.width()){
- left = this.element[0].offsetLeft - this.picker.width() + this.element[0].offsetWidth;
- }else{
- left = this.element[0].offsetLeft;
- }
- this.picker.css({left: left + 'px', top: top + 'px'});
+ if (relLeft + this.picker.width() > winWidth && relLeft + this.element.width() - this.picker.width() > 0) {
+ left += -this.picker.width() + this.element.width();
+ } else {
+ //left is ok
+ }
+
+ this.picker.css({left: left + 'px', top: top + 'px'}).css({visibility: 'visible'});
if (this._trigger("show", e, { options: this.options, hsb: this.color, hex: this._HSBToHex(this.color), rgb: this._HSBToRGB(this.color) }) != false) {
this.picker.show();
}
@@ -344,30 +358,6 @@
},
- _getWindowDimensions: function() {
- var w = self.innerWidth
- || document.documentElement.clientWidth
- || document.body.clientWidth
- || 0;
- var h = self.innerHeight
- || document.documentElement.clientHeight
- || document.body.clientHeight
- || 0;
- return {width:w, height: h};
- },
-
- _getWindowScrollOffset: function() {
- var x = window.pageXOffset
- || document.documentElement.scrollLeft
- || document.body.scrollLeft
- || 0;
- var y = window.pageYOffset
- || document.documentElement.scrollTop
- || document.body.scrollTop
- || 0;
- return {scrollLeft:x, scrollTop:y};
- },
-
_hide: function(e) {
if (!this._isChildOf(this.picker[0], e.target, this.picker[0])) {
15 years, 9 months
JBoss Rich Faces SVN: r13237 - trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-03-26 19:44:14 -0400 (Thu, 26 Mar 2009)
New Revision: 13237
Modified:
trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js
Log:
https://jira.jboss.org/jira/browse/RF-6614 - empty input fields (R,G,B for example) are filled with 0 value. Bug is fixed
Modified: trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js
===================================================================
--- trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js 2009-03-26 20:28:49 UTC (rev 13236)
+++ trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/scripts/ui.colorpicker.js 2009-03-26 23:44:14 UTC (rev 13237)
@@ -149,6 +149,12 @@
var col;
target = target || e.target;
+ for (i=0; i <= this.fields.length; i++){
+ if(this.fields.eq(i).val() == "" || this.fields.eq(i).val() == null){
+ this.fields.eq(i).val(0);
+ }
+ }
+
if (target.parentNode.className.indexOf('-hex') > 0) {
if(this.patternHex.test(target.value)){
target.value = 0;
15 years, 9 months
JBoss Rich Faces SVN: r13236 - trunk/framework/impl/src/main/java/org/ajax4jsf/component.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-03-26 16:28:49 -0400 (Thu, 26 Mar 2009)
New Revision: 13236
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
Log:
https://jira.jboss.org/jira/browse/PBR-79
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2009-03-26 19:42:53 UTC (rev 13235)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2009-03-26 20:28:49 UTC (rev 13236)
@@ -526,7 +526,7 @@
}
}
processPhaseListeners(context, PhaseId.RENDER_RESPONSE, false);
- super.encodeEnd(context);
+// super.encodeEnd(context);
}
/*
* (non-Javadoc)
15 years, 9 months
JBoss Rich Faces SVN: r13235 - trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-03-26 15:42:53 -0400 (Thu, 26 Mar 2009)
New Revision: 13235
Modified:
trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss
Log:
rich:colorPicker skinning slightly modified
Modified: trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss
===================================================================
--- trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss 2009-03-26 19:23:13 UTC (rev 13234)
+++ trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss 2009-03-26 19:42:53 UTC (rev 13235)
@@ -175,6 +175,7 @@
<u:style name="font-family" skin="generalFamilyFont"/>
</u:selector>
<u:selector name=".rich-colorPicker-span input">
+ <u:style name="background-repeat" value="repeat-x" />
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.images.InputBackgroundImage" />
</u:style>
@@ -238,14 +239,19 @@
<f:resource f:key="/org/richfaces/renderkit/html/images/rangearrows.gif" />
</u:style>
</u:selector>
- <u:selector name=".rich-colorPicker-submit">
+ <u:selector name=".rich-colorPicker-submit, .rich-colorPicker-cancel">
+ <u:style name="color" skin="headerTextColor" />
+ <u:style name="border-color" skin="panelBorderColor" />
<u:style name="font-size" skin="generalSizeFont" />
<u:style name="font-family" skin="generalFamilyFont" />
- <u:style name="color" skin="controlTextColor" />
+ <u:style name="background-color" skin="headerBackgroundColor" />
+
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.images.ButtonBackgroundImage"/>
+ </u:style>
+
+ <u:style name="border-width" value="1px" />
+ <u:style name="background-repeat" value="repeat-x" />
+ <u:style name="background-position" value="top left" />
</u:selector>
- <u:selector name=".rich-colorPicker-cancel">
- <u:style name="font-size" skin="generalSizeFont" />
- <u:style name="font-family" skin="generalFamilyFont" />
- <u:style name="color" skin="controlTextColor" />
- </u:selector>
</f:template>
\ No newline at end of file
15 years, 9 months
JBoss Rich Faces SVN: r13234 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-03-26 15:23:13 -0400 (Thu, 26 Mar 2009)
New Revision: 13234
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tooltip/tooltipAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TooltipTest.java
Log:
RF-6382, RF-6383, RF-6394
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tooltip/tooltipAutoTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TooltipTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TooltipTest.java 2009-03-26 19:22:22 UTC (rev 13233)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TooltipTest.java 2009-03-26 19:23:13 UTC (rev 13234)
@@ -27,6 +27,7 @@
import org.richfaces.AutoTester;
import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
import org.testng.annotations.Test;
public class TooltipTest extends SeleniumTestBase {
@@ -92,19 +93,78 @@
}
@Test
- public void testCoreClientMode(Template template) {
+ public void testCoreAjaxMode(Template template) {
AutoTester autoTester = getAutoTester(this);
- autoTester.renderPage(template, INIT_CLIENT_TEST);
- //TODO: ToolTip: component is activated by defined event; its positioning and dimensions are ok
+ autoTester.renderPage(template, RESET_METHOD);
+ writeStatus("Component retrieves data from server; 'defaultContent' facet is handled; listeners fire");
+ String componentId = autoTester.getClientId(AutoTester.COMPONENT_ID);
+ String contentId = autoTester.getClientId(AutoTester.COMPONENT_ID + "content");
+ String defaultContentId = autoTester.getClientId(AutoTester.COMPONENT_ID + "defaultContent");
+
+ triggerTooltip();
+ writeStatus("Check 'defaultContent' feature");
+ //It seems event handlers registered slow down tooltip appearance a little bit ... wait 0.5 second
+ waiteForCondition("document.getElementById('" + componentId + "').style.display != 'none'", 500);
+ AssertTextEquals(defaultContentId, "Wait...");
+ waitForAjaxCompletion();
+
+ AssertVisible(componentId);
+ AssertTextEquals(contentId, "Tooltip hit count 0");
+ assertTooltipPositioning();
+
+ writeStatus("Check tooltip content (ajax mode) is rendered on server every time");
+ triggerTooltipAndWait();
+ AssertVisible(componentId);
+ AssertTextEquals(contentId, "Tooltip hit count 1");
+ assertTooltipPositioning();
}
@Test
- public void testCoreAjaxMode(Template template) {
+ public void testCoreClientMode(Template template) {
AutoTester autoTester = getAutoTester(this);
- autoTester.renderPage(template, RESET_METHOD);
- //TODO: ToolTip: the same for ajax mode; component retrieves data from server; "defaultContent" facet is handled; listeners fire
+ autoTester.renderPage(template, INIT_CLIENT_TEST);
+ writeStatus("Check component is activated by defined event(onclick); its positioning and dimensions are ok");
+
+ String componentId = autoTester.getClientId(AutoTester.COMPONENT_ID);
+ String contentId = autoTester.getClientId(AutoTester.COMPONENT_ID + "content");
+
+ triggerTooltip();
+ AssertVisible(componentId);
+ AssertTextEquals(contentId, "Tooltip hit count 0");
+ assertTooltipPositioning();
+
+ writeStatus("Check tooltip content (client mode) is rendered on server only once");
+
+ triggerTooltip();
+ AssertVisible(componentId);
+ assertTooltipPositioning();
+ AssertTextEquals(contentId, "Tooltip hit count 0");
}
+ private void assertTooltipPositioning() {
+ writeStatus("Check bottom-right positionning");
+ String componentId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
+ String tooltipAreaId = getAutoTester(this).getClientId("tooltipArea");
+
+ String tooltipLeft = WINDOW_JS_RESOLVER + "$('" + componentId + "').cumulativeOffset().left";
+ String tooltipTop = WINDOW_JS_RESOLVER + "$('" + componentId + "').cumulativeOffset().top";
+
+ // we click at 1,1 of tooltipArea
+ String eventLeft = WINDOW_JS_RESOLVER + "$('" + tooltipAreaId + "').cumulativeOffset().left + 1";
+ String eventTop = WINDOW_JS_RESOLVER + "$('" + tooltipAreaId + "').cumulativeOffset().top + 1";
+
+ String leftExpr = String.format("Math.abs((%1$s) - (%2$s)) <= 2", eventLeft, tooltipLeft);
+ String topExpr = String.format("Math.abs((%1$s) - (%2$s)) <= 2", eventTop, tooltipTop);
+
+ if ("false".equalsIgnoreCase(selenium.getEval(leftExpr))) {
+ Assert.fail(selenium.getEval(eventLeft) + " == " + selenium.getEval(tooltipLeft));
+ }
+
+ if ("false".equalsIgnoreCase(selenium.getEval(topExpr))) {
+ Assert.fail(selenium.getEval(eventTop) + " == " + selenium.getEval(tooltipTop));
+ }
+ }
+
@Test
public void testJSAPI(Template template) {
AutoTester autoTester = getAutoTester(this);
@@ -159,12 +219,14 @@
autoTester.checkActionListener(false);
}
- //@Test
+ @Test
public void testStylesAndClassesAndHtmlAttributes(Template template) {
- //TODO: ToolTip: style and classes, standard HTML attributes are output to client
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
+ writeStatus("Check style and classes, standard HTML attributes are output to client");
+
String componentId = autoTester.getClientId(AutoTester.COMPONENT_ID);
+ String tooltipAreaId = getAutoTester(this).getClientId("tooltipArea");
writeStatus("Check styles and classes are output to client");
@@ -174,6 +236,11 @@
writeStatus("Test component html events");
assertEvents(componentId, SeleniumEvent.STANDARD_HTML_EVENTS);
+
+ triggerTooltipAndWait();
+ assertEvent("onshow");
+ selenium.mouseOut(tooltipAreaId);
+ assertEvent("onhide");
}
@Override
15 years, 9 months
JBoss Rich Faces SVN: r13233 - trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-03-26 15:22:22 -0400 (Thu, 26 Mar 2009)
New Revision: 13233
Modified:
trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit/ColorPickerRendererBase.java
Log:
https://jira.jboss.org/jira/browse/RF-6592
Modified: trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit/ColorPickerRendererBase.java
===================================================================
--- trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit/ColorPickerRendererBase.java 2009-03-26 18:40:52 UTC (rev 13232)
+++ trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit/ColorPickerRendererBase.java 2009-03-26 19:22:22 UTC (rev 13233)
@@ -1,45 +1,14 @@
package org.richfaces.renderkit;
-import java.util.Map;
import java.util.Set;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.context.ExternalContext;
+
import javax.faces.context.FacesContext;
+
import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
-import org.ajax4jsf.util.InputUtils;
import org.richfaces.component.UIColorPicker;
-public abstract class ColorPickerRendererBase extends HeaderResourcesRendererBase{
+public abstract class ColorPickerRendererBase extends InputRendererBase {
- public void decode(FacesContext context, UIComponent component){
- ExternalContext external = context.getExternalContext();
- Map<String, String> requestParams = external.getRequestParameterMap();
- UIColorPicker colorPicker = (UIColorPicker)component;
- String clientId = colorPicker.getClientId(context);
- String submittedValue = requestParams.get(clientId);
-
- if (submittedValue != null) {
- colorPicker.setSubmittedValue(submittedValue);
- }
- }
-
- public String getInputValue(FacesContext context, UIInput input) {
- String inputValue = "";
-
- String submittedValue = (String) input.getSubmittedValue();
- if (submittedValue != null) {
- inputValue = submittedValue;
- } else {
- Object value = input.getValue();
- if (value != null) {
- inputValue = InputUtils.getConvertedStringValue(context, input, value);
- }
- }
-
- return inputValue;
- }
public void addPopupToAjaxRendered(FacesContext context, UIColorPicker component) {
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
Set<String> ajaxRenderedAreas = ajaxContext.getAjaxRenderedAreas();
15 years, 9 months