Author: a.izobov
Date: 2007-06-07 05:11:40 -0400 (Thu, 07 Jun 2007)
New Revision: 1066
Modified:
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
trunk/richfaces/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js
trunk/richfaces/simpleTogglePanel/src/main/templates/simpleTogglePanel.jspx
Log:
http://jira.jboss.com/jira/browse/RF-254 fixed
Modified:
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
===================================================================
---
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2007-06-07
00:00:28 UTC (rev 1065)
+++
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2007-06-07
09:11:40 UTC (rev 1066)
@@ -42,6 +42,9 @@
//XXXX by nick - denis - seems there is a lot of code common to
org.richfaces.renderkit.html.ToggleControlRenderer. Please commonize!
//private InternetResource[] _scripts = {new PrototypeScript(),
getResource("scripts/simpleTogglePanel.js") };
+ final static String NONE = "none";
+ final static String EMPTY = "";
+
protected Class getComponentClass() {
return UISimpleTogglePanel.class;
}
@@ -181,4 +184,19 @@
super.encodeChildren(context, component);
}
}
+
+ public String getSwitchOnStatus(FacesContext context, UIComponent component) {
+ String sw = Boolean.toString(((UISimpleTogglePanel) component).isOpened());
+ if (sw == null || sw.equals(Boolean.toString(UISimpleTogglePanel.EXPANDED)))
+ return EMPTY;
+ else return NONE;
+ }
+
+ public String getSwitchOffStatus(FacesContext context, UIComponent component) {
+ String sw = Boolean.toString(((UISimpleTogglePanel) component).isOpened());
+ if (sw == null || sw.equals(Boolean.toString(UISimpleTogglePanel.EXPANDED)))
+ return NONE;
+ else return EMPTY;
+ }
+
}
\ No newline at end of file
Modified:
trunk/richfaces/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js
===================================================================
---
trunk/richfaces/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js 2007-06-07
00:00:28 UTC (rev 1065)
+++
trunk/richfaces/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js 2007-06-07
09:11:40 UTC (rev 1066)
@@ -2,7 +2,7 @@
SimpleTogglePanel = Class.create();
SimpleTogglePanel.prototype = {
- initialize: function(panelId, status, openSign, closeSign) {
+ initialize: function(panelId, status) {
this.panelId = panelId;
this.panelId_head = panelId+"_header";
@@ -11,20 +11,6 @@
this.status="true";
}
- this.openSign = openSign;
- if (!this.openSign) {
- this.openSign = "»";
- }
-
- this.closeSign = closeSign;
- if (!this.closeSign) {
- this.closeSign = "«";
- }
-
- //this.divs = divs;
- //this.currentId = initialStateId;
- //this.toggleToState();
-// this.windowOnLoad();
this.timer = setTimeout(this.windowOnLoad.bind(this), 100);
},
@@ -41,19 +27,21 @@
toggleToState: function() {
var body = $(this.panelId+"_body");
+ var switch_on = $(this.panelId+"_switch_on");
+ var switch_off = $(this.panelId+"_switch_off");
if (this.status=="false"){
Element.show(body);
this.status="true";
- $(this.panelId+"_switch").innerHTML = this.closeSign;
+ switch_off.style.display="none";
+ switch_on.style.display="";
this.timer = setTimeout(this.windowOnLoad.bind(this), 100);
// body.firstChild.style.width=body.clientWidth;
- }
-
- else{
- Element.hide(body);
- body.firstChild.style.width="100%";
- this.status="false";
- $(this.panelId+"_switch").innerHTML = this.openSign;
+ } else {
+ Element.hide(body);
+ body.firstChild.style.width="100%";
+ this.status="false";
+ switch_on.style.display="none";
+ switch_off.style.display="";
}
if (RichFaces.navigatorType() == "MSIE"){
Modified: trunk/richfaces/simpleTogglePanel/src/main/templates/simpleTogglePanel.jspx
===================================================================
--- trunk/richfaces/simpleTogglePanel/src/main/templates/simpleTogglePanel.jspx 2007-06-07
00:00:28 UTC (rev 1065)
+++ trunk/richfaces/simpleTogglePanel/src/main/templates/simpleTogglePanel.jspx 2007-06-07
09:11:40 UTC (rev 1066)
@@ -25,30 +25,7 @@
style="width: #{component.attributes['width']};
#{component.attributes['style']};">
<script type="text/javascript">
- SimpleTogglePanelManager.add(new SimpleTogglePanel("#{clientId}",
"#{component.attributes['opened']}"
- <jsp:scriptlet><![CDATA[
- if(component.getFacet("openMarker")!=null &&
component.getFacet("openMarker").isRendered()) {
- ]]></jsp:scriptlet>
- , "<u:insertFacet name='openMarker'/>"
- <jsp:scriptlet><![CDATA[
- } else {
- ]]></jsp:scriptlet>
- , null
- <jsp:scriptlet><![CDATA[
- }
- ]]></jsp:scriptlet>
- <jsp:scriptlet><![CDATA[
- if(component.getFacet("closeMarker")!=null &&
component.getFacet("closeMarker").isRendered()) {
- ]]></jsp:scriptlet>
- , "<u:insertFacet name='closeMarker'/>"
- <jsp:scriptlet><![CDATA[
- } else {
- ]]></jsp:scriptlet>
- , null
- <jsp:scriptlet><![CDATA[
- }
- ]]></jsp:scriptlet>
- ));
+ SimpleTogglePanelManager.add(new SimpleTogglePanel("#{clientId}",
"#{component.attributes['opened']}"));
</script>
<f:call name="utils.encodeBeginFormIfNessesary"/>
@@ -58,10 +35,9 @@
onclick="#{this:getOnClick(context,component)}">
#{component.attributes['label']}
<jsp:scriptlet><![CDATA[writer.write(" ");]]></jsp:scriptlet>
- <div id="#{clientId}_switch"
- style="position : absolute; top: 0px; right: 5px;">
+ <div id="#{clientId}_switch_on"
+ style="position : absolute; top: 0px; right: 5px; display:
#{this:getSwitchOnStatus(context, component)};">
<jsp:scriptlet><![CDATA[
- if(component.isOpened()){
if(component.getFacet("closeMarker")!=null &&
component.getFacet("closeMarker").isRendered()) {
]]></jsp:scriptlet>
<u:insertFacet name="closeMarker" />
@@ -69,7 +45,11 @@
} else {
writer.write("«");
}
- } else {
+ ]]></jsp:scriptlet>
+ </div>
+ <div id="#{clientId}_switch_off"
+ style="position : absolute; top: 0px; right: 5px; display:
#{this:getSwitchOffStatus(context, component)};">
+ <jsp:scriptlet><![CDATA[
if(component.getFacet("openMarker")!=null &&
component.getFacet("openMarker").isRendered()) {
]]></jsp:scriptlet>
<u:insertFacet name="openMarker" />
@@ -77,7 +57,6 @@
} else {
writer.write("»");
}
- }
]]></jsp:scriptlet>
</div>
</div>