JBoss Rich Faces SVN: r12090 - trunk/ui/columns/src/main/java/org/richfaces/taglib.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2009-01-05 05:18:50 -0500 (Mon, 05 Jan 2009)
New Revision: 12090
Added:
trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsAttributes.java
Modified:
trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsHandler.java
trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag.java
Log:
RF-5517
Added: trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsAttributes.java
===================================================================
--- trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsAttributes.java (rev 0)
+++ trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsAttributes.java 2009-01-05 10:18:50 UTC (rev 12090)
@@ -0,0 +1,30 @@
+/**
+ *
+ */
+package org.richfaces.taglib;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Andrey Markavtsov
+ */
+public class ColumnsAttributes {
+
+ /** Filter attributes */
+ public static final List<String> FILTER_ATTRIBUTES = new ArrayList<String>();
+
+ static {
+ FILTER_ATTRIBUTES.add("filterBy");
+ FILTER_ATTRIBUTES.add("filterExpression");
+ FILTER_ATTRIBUTES.add("filterValue");
+ FILTER_ATTRIBUTES.add("filterEvent");
+ }
+
+ /** Sort attributes */
+ public static final List<String> SORT_ATTRIBUTES = new ArrayList<String>();
+
+ static {
+ SORT_ATTRIBUTES.add("sortExpression");
+ }
+}
Modified: trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsHandler.java
===================================================================
--- trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsHandler.java 2009-01-05 10:01:39 UTC (rev 12089)
+++ trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsHandler.java 2009-01-05 10:18:50 UTC (rev 12090)
@@ -28,7 +28,6 @@
package org.richfaces.taglib;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
@@ -66,18 +65,7 @@
public class ColumnsHandler extends MetaTagHandler {
com.sun.facelets.tag.jsf.ComponentHandler handler;
-
- public final static List<String> filterAttributes = new ArrayList<String>();
- public final static List<String> sortAttributes = new ArrayList<String>();
- static {
- filterAttributes.add("filterBy");
- filterAttributes.add("filterExpression");
- filterAttributes.add("filterValue");
- filterAttributes.add("filterEvent");
-
- sortAttributes.add("sortExpression");
- }
-
+
/** value attribute */
private TagAttribute value;
@@ -166,7 +154,7 @@
@Override
public Metadata applyRule(final String name,
final TagAttribute attribute, MetadataTarget meta) {
- if (filterAttributes.indexOf(name) != -1) {
+ if (ColumnsAttributes.FILTER_ATTRIBUTES.indexOf(name) != -1) {
return new Metadata() {
@Override
Modified: trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag.java
===================================================================
--- trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag.java 2009-01-05 10:01:39 UTC (rev 12089)
+++ trunk/ui/columns/src/main/java/org/richfaces/taglib/ColumnsTag.java 2009-01-05 10:18:50 UTC (rev 12090)
@@ -20,7 +20,6 @@
*/
package org.richfaces.taglib;
-import java.beans.FeatureDescriptor;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
@@ -28,14 +27,12 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.regex.Pattern;
import javax.el.ELContext;
import javax.el.ELException;
import javax.el.ELResolver;
import javax.el.FunctionMapper;
import javax.el.MethodExpression;
-import javax.el.MethodInfo;
import javax.el.ValueExpression;
import javax.el.VariableMapper;
import javax.faces.component.UIComponent;
@@ -53,8 +50,6 @@
import org.richfaces.iterator.SimpleForEachIterator;
import org.richfaces.renderkit.CellRenderer;
-import sun.security.provider.certpath.Builder;
-
@SuppressWarnings("unused")
public class ColumnsTag extends UIComponentClassicTagBase implements
IterationTag {
@@ -386,8 +381,8 @@
String fieldName = field.getName();
if (fieldName != null && fieldName.startsWith("_")) {
String attributeName = fieldName.replace("_", "");
- if (ColumnsHandler.filterAttributes.indexOf(attributeName) == -1 &&
- ColumnsHandler.sortAttributes.indexOf(attributeName) == -1) {
+ if (ColumnsAttributes.FILTER_ATTRIBUTES.indexOf(attributeName) == -1 &&
+ ColumnsAttributes.SORT_ATTRIBUTES.indexOf(attributeName) == -1) {
ValueExpression ex = (ValueExpression) o;
ex = createValueExpression(elContext, ex);
component.setValueExpression(attributeName, ex);
15 years, 12 months
JBoss Rich Faces SVN: r12089 - in trunk/ui/editor/src/main/java/org/richfaces: convert/seamtext and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-01-05 05:01:39 -0500 (Mon, 05 Jan 2009)
New Revision: 12089
Removed:
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverter.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverterFactory.java
Modified:
trunk/ui/editor/src/main/java/org/richfaces/component/UIEditor.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java
Log:
code refactoring
Modified: trunk/ui/editor/src/main/java/org/richfaces/component/UIEditor.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/component/UIEditor.java 2009-01-05 09:25:14 UTC (rev 12088)
+++ trunk/ui/editor/src/main/java/org/richfaces/component/UIEditor.java 2009-01-05 10:01:39 UTC (rev 12089)
@@ -27,11 +27,10 @@
package org.richfaces.component;
+import javax.faces.FacesException;
import javax.faces.component.UIInput;
import javax.faces.convert.Converter;
-import org.richfaces.convert.seamtext.SeamTextConverterFactory;
-
/**
* JSF component class
* @author Alexandr Levkovsky
@@ -48,8 +47,7 @@
/** Id suffix of textarea which used as target element for tinyMCE scripts*/
public static final String EDITOR_TEXT_AREA_ID_SUFFIX = "TextArea";
- //TODO nick - it's a bad idea to create converterFactory instance for each component
- private SeamTextConverterFactory converterFactory = new SeamTextConverterFactory();
+ private Converter defaultSeamTextConverter = null;
public abstract void setType(String type);
@@ -141,10 +139,17 @@
public Converter getConverter() {
Converter converter = super.getConverter();
if(isUseSeamText() && converter == null) {
- return converterFactory.getConverter();
+ if(defaultSeamTextConverter == null) {
+ try {
+ // create default seam text converter
+ Class clazz = Thread.currentThread().getContextClassLoader().loadClass("org.richfaces.convert.seamtext.DefaultSeamTextConverter");
+ defaultSeamTextConverter = (Converter) clazz.newInstance();
+ } catch (Exception e) {
+ throw new FacesException(e);
+ }
+ }
+ converter = defaultSeamTextConverter;
}
-
- //TODO nick - check that converter is instance of SeamTextConverter if we use SeamText
return converter;
}
Modified: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java 2009-01-05 09:25:14 UTC (rev 12088)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java 2009-01-05 10:01:39 UTC (rev 12089)
@@ -33,6 +33,7 @@
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import org.jboss.seam.text.SeamTextLexer;
@@ -46,38 +47,31 @@
* @author Alexandr Levkovsky
*
*/
-public final class DefaultSeamTextConverter implements SeamTextConverter {
+public final class DefaultSeamTextConverter implements Converter {
/** The converter id for this converter. */
public static final String CONVERTER_ID = DefaultSeamTextConverter.class.getName();
- //TODO nick - let everybody create instance of this class
- private DefaultSeamTextConverter() {
- }
-
- //TODO nick - this class is not necessary
- private static class DefaultConverterHolder {
- private static final SeamTextConverter INSTANCE = new DefaultSeamTextConverter();
- }
-
- public static SeamTextConverter getInstance() {
- return DefaultConverterHolder.INSTANCE;
- }
-
+
public Object getAsObject(FacesContext context, UIComponent component,
String value) {
+
+ if (value == null) {
+ return null;
+ }
+
try {
- //TODO nick - value can be null here - see JavaDoc
Reader r = new StringReader(value);
HtmlSeamTextLexer lexer = new HtmlSeamTextLexer(r);
HtmlSeamTextParser parser = new HtmlSeamTextParser(lexer);
parser.startRule();
return parser.toString();
-
+
} catch (Exception e) {
- FacesMessage message = new FacesMessage("An error occurred during conversion html to seam text",e.getMessage());
- throw new ConverterException(message,e);
- }
+ FacesMessage message = new FacesMessage("An error occurred during conversion html to seam text",e.getMessage());
+ throw new ConverterException(message,e);
+ }
+
}
public String getAsString(FacesContext context, UIComponent component,
Deleted: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverter.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverter.java 2009-01-05 09:25:14 UTC (rev 12088)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverter.java 2009-01-05 10:01:39 UTC (rev 12089)
@@ -1,32 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.convert.seamtext;
-
-import javax.faces.convert.Converter;
-
-/**
- * @author Anton Belevich
- * Marker interface for the Seam Text Converter
- *
- */
-public interface SeamTextConverter extends Converter {
-}
Deleted: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverterFactory.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverterFactory.java 2009-01-05 09:25:14 UTC (rev 12088)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverterFactory.java 2009-01-05 10:01:39 UTC (rev 12089)
@@ -1,58 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.convert.seamtext;
-
-import java.lang.reflect.Method;
-
-import javax.faces.FacesException;
-
-/**
- * Default seam text converter implementation factory
- * @author Anton Belevich
- *
- */
-public class SeamTextConverterFactory {
-
- private SeamTextConverter converter;
-
-
- public SeamTextConverter getConverter() {
- if(converter == null) {
- converter = createSeamTextConverter();
- }
- return converter;
- }
-
- public SeamTextConverter createSeamTextConverter() {
- try {
- //TODO nick - use ThreadCCL
- Class clazz = Class.forName("org.richfaces.convert.seamtext.DefaultSeamTextConverter");
- Method method = clazz.getMethod("getInstance");
-
- //TODO nick - static method doesn't need any argument, better pass null
- return (SeamTextConverter) method.invoke(clazz);
-
- } catch(Exception e) {
- throw new FacesException(e);
- }
- }
-}
15 years, 12 months
JBoss Rich Faces SVN: r12088 - trunk/samples/richfaces-demo/src/main/webapp/richfaces/queue/examples.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2009-01-05 04:25:14 -0500 (Mon, 05 Jan 2009)
New Revision: 12088
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/queue/examples/repeater.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-5505
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/queue/examples/repeater.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/queue/examples/repeater.xhtml 2009-01-05 09:03:24 UTC (rev 12087)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/queue/examples/repeater.xhtml 2009-01-05 09:25:14 UTC (rev 12088)
@@ -9,16 +9,17 @@
<a4j:queue requestDelay="#{queueBean.requestDelay}"
ignoreDupResponses="#{queueBean.ignoreDupResponces}"
disabled="#{queueBean.disabled}" size="#{queueBean.size}"
- sizeExceededBehavior="#{queueBean.sizeExceededBehavior}" onsubmit="addRequest();"/>
+ sizeExceededBehavior="#{queueBean.sizeExceededBehavior}"
+ onsubmit="addRequest();" />
<h:panelGrid columns="1" width="800px">
<rich:panel>
<h:panelGrid columns="2">
- <h:outputText value="Type here:" />
- <h:inputText id="myinput" value="#{queueBean.text}">
+ <h:outputText value="Type here:" />
+ <h:inputText id="myinput" value="#{queueBean.text}"
+ disabled="#{not (facesContext.maximumSeverity==null)}">
<a4j:support event="onkeyup" reRender="outtext"
onsubmit="addEvent();" ajaxSingle="true"
- oncomplete="printCounts()"
- onbeforedomupdate="addUpdate()"/>
+ oncomplete="printCounts()" onbeforedomupdate="addUpdate()" />
</h:inputText>
<h:outputText value="Repeated text:" />
<h:outputText value="#{queueBean.text}" id="outtext"
@@ -32,19 +33,19 @@
</h:panelGrid>
</rich:panel>
<rich:panel>
+ <rich:message for="form:delay" style="color:red;" />
<h:panelGrid columns="2">
<h:outputText value="Request delay:" />
- <h:inputText value="#{queueBean.requestDelay}">
+ <h:inputText value="#{queueBean.requestDelay}" id="delay"
+ converterMessage="Delay field should be a number (Demo input disabled till this resolved)">
<f:convertNumber integerOnly="true" maxIntegerDigits="5" />
</h:inputText>
-
<h:outputText value="Ignore Duplicated Responces" />
<h:selectBooleanCheckbox value="#{queueBean.ignoreDupResponces}" />
-
<h:outputText value="Disable Queue" />
<h:selectBooleanCheckbox value="#{queueBean.disabled}" />
<f:facet name="footer">
- <h:commandButton value="Apply" action="#{queueBean.resetText}"/>
+ <h:commandButton value="Apply" action="#{queueBean.resetText}" />
</f:facet>
</h:panelGrid>
</rich:panel>
15 years, 12 months
JBoss Rich Faces SVN: r12087 - in trunk/samples/richfaces-demo/src/main: webapp/richfaces/queue/examples and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2009-01-05 04:03:24 -0500 (Mon, 05 Jan 2009)
New Revision: 12087
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/queue/QueueBean.java
trunk/samples/richfaces-demo/src/main/webapp/richfaces/queue/examples/repeater.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-5504
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/queue/QueueBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/queue/QueueBean.java 2009-01-04 14:49:10 UTC (rev 12086)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/queue/QueueBean.java 2009-01-05 09:03:24 UTC (rev 12087)
@@ -28,10 +28,6 @@
strategies.add(item);
}
- public void waitDelay() throws InterruptedException {
- Thread.sleep(1000);
- }
-
public void resetText() {
setText("");
}
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/queue/examples/repeater.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/queue/examples/repeater.xhtml 2009-01-04 14:49:10 UTC (rev 12086)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/queue/examples/repeater.xhtml 2009-01-05 09:03:24 UTC (rev 12087)
@@ -18,7 +18,7 @@
<a4j:support event="onkeyup" reRender="outtext"
onsubmit="addEvent();" ajaxSingle="true"
oncomplete="printCounts()"
- onbeforedomupdate="addUpdate()" action="#{queueBean.waitDelay}"/>
+ onbeforedomupdate="addUpdate()"/>
</h:inputText>
<h:outputText value="Repeated text:" />
<h:outputText value="#{queueBean.text}" id="outtext"
15 years, 12 months
JBoss Rich Faces SVN: r12086 - in trunk/ui/tree/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-01-04 09:49:10 -0500 (Sun, 04 Jan 2009)
New Revision: 12086
Modified:
trunk/ui/tree/src/main/config/component/tree.xml
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
trunk/ui/tree/src/main/templates/htmlTree.jspx
Log:
https://jira.jboss.org/jira/browse/RF-4226
Modified: trunk/ui/tree/src/main/config/component/tree.xml
===================================================================
--- trunk/ui/tree/src/main/config/component/tree.xml 2009-01-04 12:35:24 UTC (rev 12085)
+++ trunk/ui/tree/src/main/config/component/tree.xml 2009-01-04 14:49:10 UTC (rev 12086)
@@ -166,6 +166,13 @@
<description>It's an event that is called when something is dropped on a drop zone</description>
</property>
+ <property>
+ <name>oncontextmenu</name>
+ <classname>java.lang.String</classname>
+ <description>JavaScript handler to be called on right click.
+ Returning false prevents default browser context menu from being displayed</description>
+ </property>
+
<property hidden="true">
<name>varState</name>
<classname>java.lang.String</classname>
Modified: trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
===================================================================
--- trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2009-01-04 12:35:24 UTC (rev 12085)
+++ trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2009-01-04 14:49:10 UTC (rev 12086)
@@ -74,6 +74,8 @@
this.onselect = new Function('event', (events.onselect ? events.onselect : "") + "; return true;");
this.onexpand = new Function('event', (events.onexpand ? events.onexpand : "") + "; return true;");
this.oncollapse = new Function('event', (events.oncollapse ? events.oncollapse : "") + "; return true;");
+ this.oncontextmenu = new Function('event', (events.oncontextmenu ? events.oncontextmenu : "") + "; return true;");
+
this.onAjaxSelect = onAjaxSelect;
this.element = $(id);
this.element.component=this;
@@ -156,6 +158,12 @@
}
}
}.bindAsEventListener(this));
+
+ Event.observe(this.element, "contextmenu", function(event) {
+ if (this.oncontextmenu(event) === false) {
+ Event.stop(event);
+ }
+ }.bindAsEventListener(this));
},
destroy: function() {
Modified: trunk/ui/tree/src/main/templates/htmlTree.jspx
===================================================================
--- trunk/ui/tree/src/main/templates/htmlTree.jspx 2009-01-04 12:35:24 UTC (rev 12085)
+++ trunk/ui/tree/src/main/templates/htmlTree.jspx 2009-01-04 14:49:10 UTC (rev 12086)
@@ -54,7 +54,8 @@
{
onselect: "#{component.attributes['onselected']}",
onexpand: "#{component.attributes['onexpand']}",
- oncollapse: "#{component.attributes['oncollapse']}"
+ oncollapse: "#{component.attributes['oncollapse']}",
+ oncontextmenu: "#{component.attributes['oncontextmenu']}"
},
function(event) {
#{this:getAjaxScript(context, component)}
15 years, 12 months
JBoss Rich Faces SVN: r12085 - trunk/sandbox/ui/colorPicker/design.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-01-04 07:35:24 -0500 (Sun, 04 Jan 2009)
New Revision: 12085
Modified:
trunk/sandbox/ui/colorPicker/design/colorPicker.html
trunk/sandbox/ui/colorPicker/design/ui.colorpicker.js
Log:
rich:colorPicker design: color modes for the input were added
Modified: trunk/sandbox/ui/colorPicker/design/colorPicker.html
===================================================================
--- trunk/sandbox/ui/colorPicker/design/colorPicker.html 2009-01-04 00:37:56 UTC (rev 12084)
+++ trunk/sandbox/ui/colorPicker/design/colorPicker.html 2009-01-04 12:35:24 UTC (rev 12085)
@@ -157,7 +157,7 @@
.rich-colorPicker-span input{
border: 1px solid #BED6F8;
font-size: 12px;
- width: 100px;
+ width:130px;
vertical-align:middle;
}
.rich-colorPicker-icon {
@@ -187,8 +187,10 @@
/*color: {r:128,g:117,b:64},*/
/*color: {h:50,s:50,b:50}*/
clientId: "#rich-colorPicker",
- submit: function(e, ui) {
- $("#rich-colorPicker input").val('#'+ui.hex);
+ submit: function(e, ui) {
+// Possibility to choose color modes for the input
+// $("#rich-colorPicker input").val(ui.hex);
+ $("#rich-colorPicker input").val(ui.rgb);
}
});
});
Modified: trunk/sandbox/ui/colorPicker/design/ui.colorpicker.js
===================================================================
--- trunk/sandbox/ui/colorPicker/design/ui.colorpicker.js 2009-01-04 00:37:56 UTC (rev 12084)
+++ trunk/sandbox/ui/colorPicker/design/ui.colorpicker.js 2009-01-04 12:35:24 UTC (rev 12085)
@@ -353,8 +353,11 @@
var col = this.color;
this.origColor = col;
this._setCurrentColor(col);
- this._setIconColor(col);
- this._trigger("submit", e, { options: this.options, hsb: col, hex: this._HSBToHex(col), rgb: this._HSBToRGB(col) });
+ this._setIconColor(col);
+ var RGBCol = this._HSBToRGB(col);
+
+ this._trigger("submit", e, { options: this.options, hex: '#'+this._HSBToHex(col), rgb: 'rgb('+RGBCol.r+', '+RGBCol.g+', '+RGBCol.b+')' });
+// this._trigger("submit", e, { options: this.options, hsb: col, hex: this._HSBToHex(col), rgb: this._HSBToRGB(col) });
this.picker.hide();
$(document).unbind('mousedown.colorPicker');
return false;
15 years, 12 months
JBoss Rich Faces SVN: r12084 - trunk/sandbox/ui/colorPicker/design.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-01-03 19:37:56 -0500 (Sat, 03 Jan 2009)
New Revision: 12084
Modified:
trunk/sandbox/ui/colorPicker/design/colorPicker.html
trunk/sandbox/ui/colorPicker/design/ui.colorpicker.js
Log:
rich:colorPicker design: colorPicker top, left position bug was fixed
Modified: trunk/sandbox/ui/colorPicker/design/colorPicker.html
===================================================================
--- trunk/sandbox/ui/colorPicker/design/colorPicker.html 2008-12-31 22:33:20 UTC (rev 12083)
+++ trunk/sandbox/ui/colorPicker/design/colorPicker.html 2009-01-04 00:37:56 UTC (rev 12084)
@@ -196,9 +196,7 @@
</head>
- <body style="height: 10000px">
-<br /><br /><br /><br /><br /><br /><br />
-<br /><br /><br /><br /><br /><br /><br />
+ <body>
<span id="rich-colorPicker" class="rich-colorPicker-span">
@@ -209,10 +207,6 @@
<input type="button" value="Set gray color in HEX format" onclick="$('#rich-colorPicker').colorPicker('setColor', '#cccccc')"/>
<input type="button" value="Set seagreen color in HSB format" onclick="$('#rich-colorPicker').colorPicker('setColor', {h:160,s:100,b:100})"/>
-<br /><br /><br /><br /><br /><br /><br />
-<br /><br /><br /><br /><br /><br /><br />
-<br /><br /><br /><br /><br /><br /><br />
-<br /><br /><br /><br /><br /><br /><br />
<div id="rich-colorPicker-ui" class="rich-colorPicker-wrapper">
<div class="rich-colorPicker-ext">
<div class="rich-colorPicker-color">
Modified: trunk/sandbox/ui/colorPicker/design/ui.colorpicker.js
===================================================================
--- trunk/sandbox/ui/colorPicker/design/ui.colorpicker.js 2008-12-31 22:33:20 UTC (rev 12083)
+++ trunk/sandbox/ui/colorPicker/design/ui.colorpicker.js 2009-01-04 00:37:56 UTC (rev 12084)
@@ -367,17 +367,23 @@
_show: function(e) {
this._trigger("beforeShow", e, { options: this.options, hsb: this.color, hex: this._HSBToHex(this.color), rgb: this._HSBToRGB(this.color) });
-
- var pos = this.element.offset();
- var viewPort = this._getScroll();
- var top = pos.top + this.element[0].offsetHeight;
- var left = pos.left;
- if (top + 176 > viewPort.t + Math.min(viewPort.h,viewPort.ih)) {
- top -= this.element[0].offsetHeight + 176;
- }
- if (left + 356 > viewPort.l + Math.min(viewPort.w,viewPort.iw)) {
- left -= 356;
- }
+
+ 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;
+ }
+ 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 (this._trigger("show", e, { options: this.options, hsb: this.color, hex: this._HSBToHex(this.color), rgb: this._HSBToRGB(this.color) }) != false) {
this.picker.show();
@@ -387,7 +393,32 @@
$(document).bind('mousedown.colorPicker', function(e) { return self._hide.call(self, e); });
return false;
- },
+ },
+
+ _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])) {
@@ -415,7 +446,8 @@
prEl = prEl.parentNode;
}
return false;
- },
+ },
+/*
_getScroll: function() {
var t,l,w,h,iw,ih;
if (document.documentElement) {
@@ -432,7 +464,8 @@
iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0;
ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;
return { t: t, l: l, w: w, h: h, iw: iw, ih: ih };
- },
+ },
+*/
_fixHSB: function(hsb) {
return {
h: Math.min(360, Math.max(0, hsb.h)),
15 years, 12 months