Author: artdaw
Date: 2009-03-18 21:38:16 -0400 (Wed, 18 Mar 2009)
New Revision: 13020
Modified:
trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
Log:
https://jira.jboss.org/jira/browse/RF-6530 - popup was fixed on the JavaScript level
Modified: trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
===================================================================
--- trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-03-18
23:43:02 UTC (rev 13019)
+++ trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-03-19
01:38:16 UTC (rev 13020)
@@ -4,7 +4,7 @@
xmlns:c="
http://java.sun.com/jsf/core"
xmlns:ui="
http://ajax4jsf.org/cdk/ui"
xmlns:u="
http://ajax4jsf.org/cdk/u"
- xmlns:x="
http://ajax4jsf.org/cdk/x"
+ xmlns:x="
http://ajax4jsf.org/cdk/x"
xmlns:h="
http://ajax4jsf.org/cdk/h"
class="org.richfaces.renderkit.html.ColorPickerRenderer"
baseclass="org.richfaces.renderkit.ColorPickerRendererBase"
@@ -15,27 +15,34 @@
<h:styles>/org/richfaces/renderkit/html/css/colorPicker.xcss</h:styles>
<f:resource name="/org/richfaces/renderkit/html/images/arrow.gif"
var="arrow" />
<f:resource name="/org/richfaces/renderkit/html/images/rainbow.png"
var="rainbow" />
-
- <c:object var="showEvent" type="java.lang.String" />
+
+ <c:object var="showEvent" type="java.lang.String" />
<c:object var="clientIdJquery" type="java.lang.String" />
- <c:object var="colorMode" type="java.lang.String" />
-
- <div style="display: none;"
id="#{clientId}-colorPickerScript">
- <script type="text/javascript">
- jQuery(document).ready(function(){
-
- if(navigator.appName == "Microsoft Internet Explorer" &&
parseInt(navigator.appVersion) == 4 &&
navigator.appVersion.indexOf("MSIE 7.0") == -1){
- jQuery('div.rich-colorPicker-color').pngFix();
- }
-
- <jsp:scriptlet><![CDATA[
+ <c:object var="colorMode" type="java.lang.String" />
+ <c:object var="value" type="java.lang.String" />
+
+ <div style="display: none;"
id="#{clientId}-colorPickerScript">
+ <script type="text/javascript">
+ jQuery(document).ready(function(){
+
+ if(navigator.appName == "Microsoft Internet Explorer" &&
parseInt(navigator.appVersion) == 4 &&
navigator.appVersion.indexOf("MSIE 7.0") == -1){
+ jQuery('div.rich-colorPicker-color').pngFix();
+ }
+
+ <jsp:scriptlet><![CDATA[
Boolean flat = (Boolean) component.getAttributes().get("flat");
- colorMode = (String) component.getAttributes().get("colorMode");
- showEvent = (String) component.getAttributes().get("showEvent");
- if(showEvent.startsWith("on")){
- showEvent = showEvent.substring(2);
- }
- clientIdJquery = convertToString(clientId);
+ colorMode = (String) component.getAttributes().get("colorMode");
+ showEvent = (String) component.getAttributes().get("showEvent");
+ value = (String) component.getAttributes().get("value");
+
+ if (value == null || value == ""){
+ value = "#ffffff";
+ }
+
+ if(showEvent.startsWith("on")){
+ showEvent = showEvent.substring(2);
+ }
+ clientIdJquery = convertToString(clientId);
clientIdJquery = clientIdJquery.replace(":", "\\\\:");
colorMode = colorMode.toLowerCase();
@@ -43,14 +50,14 @@
colorMode = pattern.matcher(colorMode).replaceAll("");
boolean disabled = getUtils().isBooleanAttribute(component, "disabled");
- variables.setVariable("disabled",new Boolean(disabled));
+ variables.setVariable("disabled",new Boolean(disabled));
]]></jsp:scriptlet>
-
- jQuery('\##{clientIdJquery}colorPicker').colorPicker({
- flat: #{component.attributes['flat']},
- color: "#{component.attributes['value']}",
- showEvent: "#{showEvent}",
- clientId: '\##{clientIdJquery}colorPicker',
+
+ jQuery('\##{clientIdJquery}colorPicker').colorPicker({
+ flat: #{component.attributes['flat']},
+ color: "#{value}",
+ showEvent: "#{showEvent}",
+ clientId: '\##{clientIdJquery}colorPicker',
submit: function(e, ui) {
switch("#{colorMode}"){
case "hex":
@@ -62,10 +69,10 @@
default:
jQuery('\##{clientIdJquery}colorPicker input').val(ui.hex);
}
- }
- });
- });
- </script>
+ }
+ });
+ });
+ </script>
</div>
<span id="#{clientId}colorPicker"
class="rich-colorPicker-span" x:passThruWithExclusions="value,name,type,id,styleClass,class,style">
<input readonly="readonly" disabled="#{disabled}"
type="text" name="#{clientId}"
value="#{this:getInputValue(context, component)}"/>
@@ -84,7 +91,7 @@
}
]]>
</jsp:scriptlet>
- </span>
+ </span>
<div id="#{clientId}colorPicker-popup"
class="rich-colorPicker-wrapper">
<div class="rich-colorPicker-ext">
@@ -143,8 +150,8 @@
<label for="hsb-b">B:</label>
<input id="#{clientId}-colorPicker-hsb-b"
class="rich-colorPicker-colors-input" type="text"
maxlength="3" size="2" />
</div>
- <button type="button" class="rich-colorPicker-submit"
name="submit">Apply</button>
+ <button type="button" class="rich-colorPicker-submit"
name="submit">Apply</button>
<button type="button" class="rich-colorPicker-cancel"
name="cancel">Cancel</button>
</div>
</div>
-</f:root>
+</f:root>