You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2006/08/01 19:44:01 UTC
svn commit: r427657 [35/42] - in /myfaces:
core/trunk/api/src/main/java/javax/faces/component/
core/trunk/api/src/test/java/javax/faces/
core/trunk/api/src/test/java/javax/faces/application/
core/trunk/api/src/test/java/javax/faces/component/ core/trun...
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/timednotifier/TimedNotifierRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/timednotifier/TimedNotifierRenderer.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/timednotifier/TimedNotifierRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/timednotifier/TimedNotifierRenderer.java Tue Aug 1 10:43:28 2006
@@ -1,211 +1,211 @@
-/**
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.myfaces.custom.timednotifier;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.component.UIOutput;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.convert.ConverterException;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.myfaces.custom.dojo.DojoConfig;
-import org.apache.myfaces.custom.dojo.DojoUtils;
-import org.apache.myfaces.renderkit.html.util.AddResource;
-import org.apache.myfaces.renderkit.html.util.AddResourceFactory;
-import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
-import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
-
-/**
- *
- * @author werpu
- * The html renderer for the timed notifier
- *
- */
-public class TimedNotifierRenderer extends HtmlRenderer {
-
- public void decode(FacesContext facesContext, UIComponent component) {
- RendererUtils.checkParamValidity(facesContext, component, null);
-
- if (component instanceof UIInput) {
- HtmlRendererUtils.decodeUIInput(facesContext, component);
- } else {
- throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName());
- }
- }
-
- public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
- RendererUtils.checkParamValidity(facesContext, uiComponent, TimedNotifier.class);
-
- TimedNotifier notifier = (TimedNotifier) uiComponent;
-
- if (notifier.getDisabled() != null) {
-
- if (notifier.getDisabled().booleanValue())
- return;
- }
-
- renderInitialization(facesContext, uiComponent, notifier);
-
- encodeJavascript(facesContext, notifier);
-
-
- }
-
- public Object getConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object submittedValue) throws ConverterException {
- RendererUtils.checkParamValidity(facesContext, uiComponent, UIOutput.class);
-
- return RendererUtils.getConvertedUIOutputValue(facesContext, (UIOutput) uiComponent, submittedValue);
- }
-
- private void encodeJavascript(FacesContext facesContext, TimedNotifier notifier) throws IOException {
- String notifierClientId = notifier.getClientId(facesContext);
-
- String replacedClientId = notifierClientId.replaceAll(":", "_");
- String dialogVar = replacedClientId + "Notifier_Dialog";
- String confirmVar = dialogVar + "_Yes";
-
- Integer timeShow = notifier.getShowDelay();
- Integer timeHide = notifier.getHideDelay();
-
- UIComponent confirmComp = notifier.getConfirm();
-
-
-
-
-
- String notifierVar = replacedClientId + "Notifier";
-
- StringBuffer sb = new StringBuffer();
- sb.append("function "+replacedClientId+"() {\n");
- if(confirmComp == null)
- sb.append("var "+ notifierVar + " = new myfaces_TimedNotifier('" +
- dialogVar + "','" + confirmVar + "','" + notifierClientId + "',"+
- timeShow.toString()+","+timeHide.toString()+");\n");
- else
- sb.append("var "+ notifierVar + " = new myfaces_TimedNotifier('" +
- dialogVar + "',null,'" + notifierClientId + "',"+
- timeShow.toString()+","+timeHide.toString()+");\n");
-
- sb.append( notifierVar + ".showDialog();\n");
- sb.append("};\n");
- sb.append("setTimeout('"+replacedClientId+"()',"+timeShow.toString()+");");
-
- ResponseWriter writer = facesContext.getResponseWriter();
- writer.startElement(HTML.SCRIPT_ELEM, notifier);
- writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
- writer.write(sb.toString());
- writer.endElement(HTML.SCRIPT_ELEM);
-
- }
-
-
-
- private void renderInitialization(FacesContext facesContext, UIComponent uiComponent, TimedNotifier notifier) throws IOException {
- String javascriptLocation = (String) notifier.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
- DojoUtils.addMainInclude(facesContext, uiComponent, javascriptLocation, new DojoConfig());
- DojoUtils.addRequire(facesContext, uiComponent, "dojo.widget.Dialog");
- DojoUtils.addRequire(facesContext, uiComponent, "dojo.event.*");
-
- // DojoUtils.addRequire(facesContext, "dojo.xml.Parse");
-
- writeDialog(facesContext, notifier);
-
- AddResource addResource = AddResourceFactory.getInstance(facesContext);
-
- if (!DojoUtils.isInlineScriptSet(facesContext, "stateChangedNotifier.js"))
- addResource.addJavaScriptHere(facesContext, TimedNotifierRenderer.class, "timednotifier.js");
-
- String styleLocation = (String) uiComponent.getAttributes().get(JSFAttr.STYLE_LOCATION);
-
- // we need a style def for the dialog system
- if (StringUtils.isNotBlank(styleLocation)) {
- addResource.addStyleSheet(facesContext, AddResource.HEADER_BEGIN, styleLocation + "/default.css");
- } else {
- addResource.addStyleSheet(facesContext, AddResource.HEADER_BEGIN, TimedNotifierRenderer.class, "css/default.css");
- }
- }
-
-
-
- /**
- * dialog definition this one is needed for the dojoized dialog
- *
- * @param facesContext
- * @param uiComponent
- * @throws IOException
- */
- private void writeDialog(FacesContext facesContext, TimedNotifier uiComponent) throws IOException {
- /*
- * <div id="form1__idJsp1Notifier_Dialog" style="position:absolute;
- * visibility: hidden;"> <div id="form1__idJsp1Notifier_Dialog_Content">
- * values have changed do you really want to <br> submit the values
- * </div> <input type="button" id="form1__idJsp1Notifier_Dialog_Yes"
- * value="yes" /> <input type="button"
- * id="form1__idJsp1Notifier_Dialog_No" value="no" /> </div>
- */
- TimedNotifier notifier = (TimedNotifier) uiComponent;
-
- String notifierClientId = uiComponent.getClientId(facesContext);
- String replacedClientId = notifierClientId.replaceAll(":", "_");
- String dialogVar = replacedClientId + "Notifier_Dialog";
- String yesText = (String) uiComponent.getAttributes().get("yesText");
-
- yesText = (yesText == null) ? "Yes" : yesText;
-
- String content = uiComponent.getConfirmationMessage();
-
- String styleClass = uiComponent.getStyleClass();
-
- ResponseWriter writer = facesContext.getResponseWriter();
- writer.startElement(HTML.DIV_ELEM, uiComponent);
- writer.writeAttribute(HTML.ID_ATTR, dialogVar, null);
- writer.writeAttribute(HTML.STYLE_ATTR, "position:absolute; visibility: hidden;", null);
- writer.writeAttribute(HTML.CLASS_ATTR, styleClass,null);
- writer.startElement(HTML.DIV_ELEM, uiComponent);
- writer.writeAttribute(HTML.CLASS_ATTR, styleClass,null);
-
- writer.startElement(HTML.DIV_ELEM, uiComponent);
- writer.writeAttribute(HTML.ID_ATTR, dialogVar + "_Content", null);
-
- UIComponent contentComp = notifier.getContent();
- if(contentComp == null)
- writer.write(content);
- else
- RendererUtils.renderChild(facesContext, contentComp);
- writer.endElement(HTML.DIV_ELEM);
- writer.write(HTML.NBSP_ENTITY);
- UIComponent confirmComp = notifier.getConfirm();
- if(confirmComp != null)
- RendererUtils.renderChild(facesContext, confirmComp);
- else {
- writer.startElement(HTML.INPUT_ELEM, uiComponent);
- writer.writeAttribute(HTML.TYPE_ATTR, HTML.BUTTON_ELEM, null);
- writer.writeAttribute(HTML.ID_ATTR, dialogVar + "_Yes", null);
- writer.writeAttribute(HTML.VALUE_ATTR, yesText, null);
- writer.endElement(HTML.INPUT_ELEM);
- }
- writer.write(HTML.NBSP_ENTITY);
- writer.endElement(HTML.DIV_ELEM);
- writer.endElement(HTML.DIV_ELEM);
- }
-}
+/**
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.custom.timednotifier;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.convert.ConverterException;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.myfaces.custom.dojo.DojoConfig;
+import org.apache.myfaces.custom.dojo.DojoUtils;
+import org.apache.myfaces.renderkit.html.util.AddResource;
+import org.apache.myfaces.renderkit.html.util.AddResourceFactory;
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
+
+/**
+ *
+ * @author werpu
+ * The html renderer for the timed notifier
+ *
+ */
+public class TimedNotifierRenderer extends HtmlRenderer {
+
+ public void decode(FacesContext facesContext, UIComponent component) {
+ RendererUtils.checkParamValidity(facesContext, component, null);
+
+ if (component instanceof UIInput) {
+ HtmlRendererUtils.decodeUIInput(facesContext, component);
+ } else {
+ throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName());
+ }
+ }
+
+ public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
+ RendererUtils.checkParamValidity(facesContext, uiComponent, TimedNotifier.class);
+
+ TimedNotifier notifier = (TimedNotifier) uiComponent;
+
+ if (notifier.getDisabled() != null) {
+
+ if (notifier.getDisabled().booleanValue())
+ return;
+ }
+
+ renderInitialization(facesContext, uiComponent, notifier);
+
+ encodeJavascript(facesContext, notifier);
+
+
+ }
+
+ public Object getConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object submittedValue) throws ConverterException {
+ RendererUtils.checkParamValidity(facesContext, uiComponent, UIOutput.class);
+
+ return RendererUtils.getConvertedUIOutputValue(facesContext, (UIOutput) uiComponent, submittedValue);
+ }
+
+ private void encodeJavascript(FacesContext facesContext, TimedNotifier notifier) throws IOException {
+ String notifierClientId = notifier.getClientId(facesContext);
+
+ String replacedClientId = notifierClientId.replaceAll(":", "_");
+ String dialogVar = replacedClientId + "Notifier_Dialog";
+ String confirmVar = dialogVar + "_Yes";
+
+ Integer timeShow = notifier.getShowDelay();
+ Integer timeHide = notifier.getHideDelay();
+
+ UIComponent confirmComp = notifier.getConfirm();
+
+
+
+
+
+ String notifierVar = replacedClientId + "Notifier";
+
+ StringBuffer sb = new StringBuffer();
+ sb.append("function "+replacedClientId+"() {\n");
+ if(confirmComp == null)
+ sb.append("var "+ notifierVar + " = new myfaces_TimedNotifier('" +
+ dialogVar + "','" + confirmVar + "','" + notifierClientId + "',"+
+ timeShow.toString()+","+timeHide.toString()+");\n");
+ else
+ sb.append("var "+ notifierVar + " = new myfaces_TimedNotifier('" +
+ dialogVar + "',null,'" + notifierClientId + "',"+
+ timeShow.toString()+","+timeHide.toString()+");\n");
+
+ sb.append( notifierVar + ".showDialog();\n");
+ sb.append("};\n");
+ sb.append("setTimeout('"+replacedClientId+"()',"+timeShow.toString()+");");
+
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.startElement(HTML.SCRIPT_ELEM, notifier);
+ writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
+ writer.write(sb.toString());
+ writer.endElement(HTML.SCRIPT_ELEM);
+
+ }
+
+
+
+ private void renderInitialization(FacesContext facesContext, UIComponent uiComponent, TimedNotifier notifier) throws IOException {
+ String javascriptLocation = (String) notifier.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
+ DojoUtils.addMainInclude(facesContext, uiComponent, javascriptLocation, new DojoConfig());
+ DojoUtils.addRequire(facesContext, uiComponent, "dojo.widget.Dialog");
+ DojoUtils.addRequire(facesContext, uiComponent, "dojo.event.*");
+
+ // DojoUtils.addRequire(facesContext, "dojo.xml.Parse");
+
+ writeDialog(facesContext, notifier);
+
+ AddResource addResource = AddResourceFactory.getInstance(facesContext);
+
+ if (!DojoUtils.isInlineScriptSet(facesContext, "stateChangedNotifier.js"))
+ addResource.addJavaScriptHere(facesContext, TimedNotifierRenderer.class, "timednotifier.js");
+
+ String styleLocation = (String) uiComponent.getAttributes().get(JSFAttr.STYLE_LOCATION);
+
+ // we need a style def for the dialog system
+ if (StringUtils.isNotBlank(styleLocation)) {
+ addResource.addStyleSheet(facesContext, AddResource.HEADER_BEGIN, styleLocation + "/default.css");
+ } else {
+ addResource.addStyleSheet(facesContext, AddResource.HEADER_BEGIN, TimedNotifierRenderer.class, "css/default.css");
+ }
+ }
+
+
+
+ /**
+ * dialog definition this one is needed for the dojoized dialog
+ *
+ * @param facesContext
+ * @param uiComponent
+ * @throws IOException
+ */
+ private void writeDialog(FacesContext facesContext, TimedNotifier uiComponent) throws IOException {
+ /*
+ * <div id="form1__idJsp1Notifier_Dialog" style="position:absolute;
+ * visibility: hidden;"> <div id="form1__idJsp1Notifier_Dialog_Content">
+ * values have changed do you really want to <br> submit the values
+ * </div> <input type="button" id="form1__idJsp1Notifier_Dialog_Yes"
+ * value="yes" /> <input type="button"
+ * id="form1__idJsp1Notifier_Dialog_No" value="no" /> </div>
+ */
+ TimedNotifier notifier = (TimedNotifier) uiComponent;
+
+ String notifierClientId = uiComponent.getClientId(facesContext);
+ String replacedClientId = notifierClientId.replaceAll(":", "_");
+ String dialogVar = replacedClientId + "Notifier_Dialog";
+ String yesText = (String) uiComponent.getAttributes().get("yesText");
+
+ yesText = (yesText == null) ? "Yes" : yesText;
+
+ String content = uiComponent.getConfirmationMessage();
+
+ String styleClass = uiComponent.getStyleClass();
+
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.startElement(HTML.DIV_ELEM, uiComponent);
+ writer.writeAttribute(HTML.ID_ATTR, dialogVar, null);
+ writer.writeAttribute(HTML.STYLE_ATTR, "position:absolute; visibility: hidden;", null);
+ writer.writeAttribute(HTML.CLASS_ATTR, styleClass,null);
+ writer.startElement(HTML.DIV_ELEM, uiComponent);
+ writer.writeAttribute(HTML.CLASS_ATTR, styleClass,null);
+
+ writer.startElement(HTML.DIV_ELEM, uiComponent);
+ writer.writeAttribute(HTML.ID_ATTR, dialogVar + "_Content", null);
+
+ UIComponent contentComp = notifier.getContent();
+ if(contentComp == null)
+ writer.write(content);
+ else
+ RendererUtils.renderChild(facesContext, contentComp);
+ writer.endElement(HTML.DIV_ELEM);
+ writer.write(HTML.NBSP_ENTITY);
+ UIComponent confirmComp = notifier.getConfirm();
+ if(confirmComp != null)
+ RendererUtils.renderChild(facesContext, confirmComp);
+ else {
+ writer.startElement(HTML.INPUT_ELEM, uiComponent);
+ writer.writeAttribute(HTML.TYPE_ATTR, HTML.BUTTON_ELEM, null);
+ writer.writeAttribute(HTML.ID_ATTR, dialogVar + "_Yes", null);
+ writer.writeAttribute(HTML.VALUE_ATTR, yesText, null);
+ writer.endElement(HTML.INPUT_ELEM);
+ }
+ writer.write(HTML.NBSP_ENTITY);
+ writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.DIV_ELEM);
+ }
+}
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/timednotifier/TimedNotifierRenderer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/timednotifier/TimedNotifierTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/timednotifier/TimedNotifierTag.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/timednotifier/TimedNotifierTag.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/timednotifier/TimedNotifierTag.java Tue Aug 1 10:43:28 2006
@@ -1,103 +1,103 @@
-/**
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.myfaces.custom.timednotifier;
-
-import org.apache.myfaces.custom.htmlTag.HtmlTagTag;
-
-import javax.faces.component.UIComponent;
-
-
-
-/**
- *
- * @author werpu
- * The tag descriptor class for the timed notifier
- *
- */
-public class TimedNotifierTag extends HtmlTagTag {
- private String _confirmationMessage;
-
- private String _disabled;
-
- private String _height;
-
- private String _hideDelay;
-
- private String _okText;
-
- private String _showDelay;
-
- private String _width;
-
- public String getComponentType() {
- return TimedNotifier.COMPONENT_TYPE;
- }
-
- public String getRendererType() {
- return TimedNotifier.DEFAULT_RENDERER_TYPE;
- }
-
- public void release() {
- super.release();
- _confirmationMessage = null;
- _disabled = null;
- _hideDelay = null;
- _showDelay = null;
- _okText = null;
- }
-
- public void setConfirmationMessage(String confirmationMessage) {
- this._confirmationMessage = confirmationMessage;
- }
-
- public void setDisabled(String disabled) {
- this._disabled = disabled;
- }
-
- public void setHeight(String height) {
- this._height = height;
- }
-
- public void setHideDelay(String hideDelay) {
- this._hideDelay = hideDelay;
- }
-
- public void setOkText(String okText) {
- this._okText = okText;
- }
-
- public void setShowDelay(String showDelay) {
- this._showDelay = showDelay;
- }
-
- public void setWidth(String width) {
- this._width = width;
- }
-
- protected void setProperties(UIComponent component) {
-
- super.setProperties(component);
-
- setStringProperty(component, "confirmationMessage", _confirmationMessage);
- setBooleanProperty(component, "disabled", _disabled);
- setIntegerProperty(component, "showDelay", _showDelay);
- setIntegerProperty(component, "hideDelay", _hideDelay);
- setStringProperty(component, "okText", _okText);
- setStringProperty(component, "width", _width);
- setStringProperty(component, "height", _height);
- }
-
-}
+/**
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.custom.timednotifier;
+
+import org.apache.myfaces.custom.htmlTag.HtmlTagTag;
+
+import javax.faces.component.UIComponent;
+
+
+
+/**
+ *
+ * @author werpu
+ * The tag descriptor class for the timed notifier
+ *
+ */
+public class TimedNotifierTag extends HtmlTagTag {
+ private String _confirmationMessage;
+
+ private String _disabled;
+
+ private String _height;
+
+ private String _hideDelay;
+
+ private String _okText;
+
+ private String _showDelay;
+
+ private String _width;
+
+ public String getComponentType() {
+ return TimedNotifier.COMPONENT_TYPE;
+ }
+
+ public String getRendererType() {
+ return TimedNotifier.DEFAULT_RENDERER_TYPE;
+ }
+
+ public void release() {
+ super.release();
+ _confirmationMessage = null;
+ _disabled = null;
+ _hideDelay = null;
+ _showDelay = null;
+ _okText = null;
+ }
+
+ public void setConfirmationMessage(String confirmationMessage) {
+ this._confirmationMessage = confirmationMessage;
+ }
+
+ public void setDisabled(String disabled) {
+ this._disabled = disabled;
+ }
+
+ public void setHeight(String height) {
+ this._height = height;
+ }
+
+ public void setHideDelay(String hideDelay) {
+ this._hideDelay = hideDelay;
+ }
+
+ public void setOkText(String okText) {
+ this._okText = okText;
+ }
+
+ public void setShowDelay(String showDelay) {
+ this._showDelay = showDelay;
+ }
+
+ public void setWidth(String width) {
+ this._width = width;
+ }
+
+ protected void setProperties(UIComponent component) {
+
+ super.setProperties(component);
+
+ setStringProperty(component, "confirmationMessage", _confirmationMessage);
+ setBooleanProperty(component, "disabled", _disabled);
+ setIntegerProperty(component, "showDelay", _showDelay);
+ setIntegerProperty(component, "hideDelay", _hideDelay);
+ setStringProperty(component, "okText", _okText);
+ setStringProperty(component, "width", _width);
+ setStringProperty(component, "height", _height);
+ }
+
+}
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/timednotifier/TimedNotifierTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/urlvalidator/UrlValidator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/urlvalidator/ValidateUrlTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/util/ComponentUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/valueChangeNotifier/ValueChangeCollector.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/valueChangeNotifier/ValueChangeManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/valueChangeNotifier/ValueChangeNotifierTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/valueChangeNotifier/ValueChangePhaseListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/accordion/resource/customRico.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/accordion/resource/customRico.js?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/accordion/resource/customRico.js (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/accordion/resource/customRico.js Tue Aug 1 10:43:28 2006
@@ -1,566 +1,566 @@
-// CUSTOM ACCORDION
-
-Rico.Accordion.Custom = Class.create();
-
-Rico.Accordion.Custom.prototype = {
- initialize: function(container, options)
- {
- this.container = $(container);
- this.lastExpandedTab = null;
- this.accordionTabs = new Array();
- this.setOptions(options);
- this._attachBehaviors();
-
- this.container.style.borderBottom = '1px solid ' + this.options.borderColor;
-
- // set the initial visual state...
- for ( var i = 0; i < this.accordionTabs.length ; i++ )
- {
- if(this.accordionTabs[i].stateHolder.value == 1)
- {
- this.lastExpandedTab = this.accordionTabs[i];
- this.lastExpandedTab.content.style.height = this.options.panelHeight + "px";
- this.lastExpandedTab.showExpanded();
- this.lastExpandedTab.titleBar.style.fontWeight = this.options.expandedFontWeight;
- }
- else
- {
- this.accordionTabs[i].collapse();
- this.accordionTabs[i].content.style.display = 'none';
- }
- }
- },
-
- setOptions: function(options)
- {
- this.options = {
- expandedBg : '#63699c',
- hoverBg : '#63699c',
- collapsedBg : '#6b79a5',
- expandedTextColor : '#ffffff',
- expandedFontWeight : 'bold',
- hoverTextColor : '#ffffff',
- collapsedTextColor : '#ced7ef',
- collapsedFontWeight : 'normal',
- hoverTextColor : '#ffffff',
- borderColor : '#1f669b',
- panelHeight : 200,
- onHideTab : null,
- onShowTab : null
- };
-
- Object.extend(options, {});
- },
-
- showTabByIndex: function( anIndex, animate )
- {
- var doAnimate = arguments.length == 1 ? true : animate;
- this.showTab( this.accordionTabs[anIndex], doAnimate );
- },
-
- showTab: function( accordionTab, animate )
- {
- var doAnimate = arguments.length == 1 ? true : animate;
-
- if ( this.options.onHideTab )
- this.options.onHideTab(this.lastExpandedTab);
-
- this.lastExpandedTab.showCollapsed();
- var accordion = this;
- var lastExpandedTab = this.lastExpandedTab;
-
- this.lastExpandedTab.content.style.height = (this.options.panelHeight - 1) + 'px';
- accordionTab.content.style.display = '';
-
- accordionTab.titleBar.style.fontWeight = this.options.expandedFontWeight;
-
- if ( doAnimate )
- {
- new Effect.AccordionSize(this.lastExpandedTab.content,
- accordionTab.content,
- 1,
- this.options.panelHeight,
- 100, 10,
- { complete: function() {accordion.showTabDone(lastExpandedTab)} } );
- this.lastExpandedTab = accordionTab;
- }
- else
- {
- this.lastExpandedTab.content.style.height = "1px";
- accordionTab.content.style.height = this.options.panelHeight + "px";
- this.lastExpandedTab = accordionTab;
- this.showTabDone(lastExpandedTab);
- }
- },
-
- showTabDone: function(collapsedTab)
- {
- collapsedTab.content.style.display = 'none';
- this.lastExpandedTab.showExpanded();
- if ( this.options.onShowTab )
- this.options.onShowTab(this.lastExpandedTab);
- },
-
- _attachBehaviors: function()
- {
- var panels = this._getDirectChildrenByTag(this.container, 'DIV');
- for ( var i = 0 ; i < panels.length ; i++ )
- {
- var tabChildren = this._getDirectChildrenByTag(panels[i],'DIV');
- if ( tabChildren.length != 2 )
- continue; // unexpected
-
- var stateChildren = this._getDirectChildrenByTag(panels[i], 'INPUT');
-
- var tabTitleBar = tabChildren[0];
- var tabContentBox = tabChildren[1];
- var stateInput = stateChildren[0];
- this.accordionTabs.push( new Rico.Accordion.Tab.Custom(this,tabTitleBar,tabContentBox, stateInput) );
- }
- },
-
- _getDirectChildrenByTag: function(e, tagName)
- {
- var kids = new Array();
- var allKids = e.childNodes;
- for( var i = 0 ; i < allKids.length ; i++ )
- if ( allKids[i] && allKids[i].tagName && allKids[i].tagName == tagName )
- kids.push(allKids[i]);
- return kids;
- }
-};
-
-
-Rico.Accordion.Tab.Custom = Class.create();
-
-Rico.Accordion.Tab.Custom.prototype = {
- initialize: function(accordion, titleBar, content, stateHolder)
- {
- this.accordion = accordion;
- this.titleBar = titleBar;
- this.content = content;
- this.stateHolder = stateHolder;
- this._attachBehaviors();
- },
-
- collapse: function()
- {
- this.showCollapsed();
- this.content.style.height = "1px";
- },
-
- showCollapsed: function()
- {
- this.expanded = false;
- this.titleBar.style.backgroundColor = this.accordion.options.collapsedBg;
- this.titleBar.style.color = this.accordion.options.collapsedTextColor;
- this.titleBar.style.fontWeight = this.accordion.options.collapsedFontWeight;
- this.content.style.overflow = "hidden";
- this.stateHolder.value = 0;
- },
-
- showExpanded: function()
- {
- this.expanded = true;
- this.titleBar.style.backgroundColor = this.accordion.options.expandedBg;
- this.titleBar.style.color = this.accordion.options.expandedTextColor;
- this.content.style.overflow = "visible";
- this.stateHolder.value = 1;
- },
-
- titleBarClicked: function(e)
- {
- if ( this.accordion.lastExpandedTab == this )
- return;
- this.accordion.showTab(this);
- },
-
- hover: function(e)
- {
- this.titleBar.style.backgroundColor = this.accordion.options.hoverBg;
- this.titleBar.style.color = this.accordion.options.hoverTextColor;
- },
-
- unhover: function(e)
- {
- if ( this.expanded )
- {
- this.titleBar.style.backgroundColor = this.accordion.options.expandedBg;
- this.titleBar.style.color = this.accordion.options.expandedTextColor;
- }
- else
- {
- this.titleBar.style.backgroundColor = this.accordion.options.collapsedBg;
- this.titleBar.style.color = this.accordion.options.collapsedTextColor;
- }
- },
-
- _attachBehaviors: function()
- {
- this.content.style.border = "1px solid " + this.accordion.options.borderColor;
- this.content.style.borderTopWidth = "0px";
- this.content.style.borderBottomWidth = "0px";
- this.content.style.margin = "0px";
-
- this.titleBar.onclick = this.titleBarClicked.bindAsEventListener(this);
- this.titleBar.onmouseover = this.hover.bindAsEventListener(this);
- this.titleBar.onmouseout = this.unhover.bindAsEventListener(this);
- }
-};
-
-
-// CUSTOM TOGGLER
-
-Rico.Toggler.Custom = Class.create();
-
-Rico.Toggler.Custom.prototype = {
-
- initialize: function(container, options)
- {
- this.container = $(container);
- this.accordionTabs = new Array();
- this.setOptions(options);
- this._attachBehaviors();
-
- this.container.style.borderBottom = '1px solid ' + this.options.borderColor;
-
- // set the initial visual state...
- for ( var i = 0; i < this.accordionTabs.length ; i++ )
- {
- if(this.accordionTabs[i].stateHolder.value == 1)
- {
- if(this.options.useRealHeight)
- this.accordionTabs[i].content.style.height = "";
- else
- this.accordionTabs[i].content.style.height = this.options.panelHeight + "px";
-
- this.accordionTabs[i].showExpanded();
- this.accordionTabs[i].titleBar.style.fontWeight = this.options.expandedFontWeight;
-
- if (this.accordionTabs[i].closedContent)
- {
- if(this.accordionTabs[i].closedContent.style.display)
- this.accordionTabs[i].closedContent.style.display = 'hidden';
- if(this.accordionTabs[i].closedContent.style.height)
- this.accordionTabs[i].closedContent.style.height = "1px";
- }
-
- }
- else
- {
- this.accordionTabs[i].collapse();
- this.accordionTabs[i].content.style.display = 'none';
- if (this.accordionTabs[i].closedContent)
- {
- if(this.accordionTabs[i].closedContent.style.display)
- this.accordionTabs[i].closedContent.style.display = 'visible';
- if(this.accordionTabs[i].closedContent.style.height)
- this.accordionTabs[i].closedContent.style.height = this.options.closedPanelHeight + "px";
- }
- }
- }
- },
-
- setOptions: function(options)
- {
- this.options = {
- expandedBg : '#63699c',
- hoverBg : '#63699c',
- collapsedBg : '#6b79a5',
- expandedTextColor : '#ffffff',
- expandedFontWeight : 'bold',
- hoverTextColor : '#ffffff',
- collapsedTextColor : '#ced7ef',
- collapsedFontWeight : 'normal',
- hoverTextColor : '#ffffff',
- borderColor : '#1f669b',
- panelHeight : 200,
- closedPanelHeight : 50,
- useRealHeight : true,
- onHideTab : null,
- onShowTab : null
- };
-
- Object.extend(options, {});
- },
-
- showTabByIndex: function(anIndex, animate)
- {
- var doAnimate = arguments.length == 1 ? true : animate;
- this.showTab(this.accordionTabs[anIndex], doAnimate);
- },
-
- toggleTab: function(accordionTab, animate)
- {
-
- var doAnimate = arguments.length == 1 ? true : animate;
-
- if (accordionTab.expanded)
- {
- this._collapseTab(accordionTab, doAnimate);
- }
- else
- {
- this._expandTab(accordionTab, doAnimate);
- }
- },
-
- _collapseTab: function(accordionTab, doAnimate)
- {
- if (this.options.onHideTab)
- this.options.onHideTab(accordionTab);
-
- accordionTab.showCollapsed();
- var accordion = this;
-
- accordionTab.content.style.height = (this.options.panelHeight - 1) + 'px';
-
- if (doAnimate)
- {
- if (!accordionTab.closedContent)
- {
- new Effect.TogglerSize(accordionTab.content,
- 1,
- 100, 10,
- { complete: function()
- {
- accordion.showTabDone(accordionTab)
- } });
- }
- else
- {
- new Effect.AccordionSize(accordionTab.content,
- accordionTab.closedContent,
- 1,
- this.options.closedPanelHeight,
- 100, 10,
- { complete: function()
- {
- accordion.showTabDone(accordionTab)
- } });
- }
- }
- else
- {
- accordionTab.content.style.height = "1px";
-
- if (accordionTab.closedContent)
- {
- accordionTab.closedContent.style.height = this.options.closedPanelHeight + "px";
- }
- this.showTabDone(accordionTab);
- }
- },
-
- _expandTab: function(accordionTab, doAnimate)
- {
- var accordion = this;
-
- accordionTab.content.style.display = '';
- accordionTab.titleBar.style.fontWeight = this.options.expandedFontWeight;
-
- if (accordionTab.closedContent)
- {
- accordionTab.closedContent.style.height = (this.options.closedPanelHeight - 1) + 'px';
- }
-
- if (doAnimate)
- {
- if (!accordionTab.closedContent)
- {
- new Effect.TogglerSize(accordionTab.content,
- this.options.panelHeight,
- 100, 10,
- { complete: function()
- {
- accordionTab.showExpanded();
- if (accordionTab.accordion.options.onShowTab)
- accordionTab.accordion.options.onShowTab(accordionTab);
-
- if(accordionTab.accordion.options.useRealHeight)
- accordionTab.content.style.height = "";
- } });
- }
- else
- {
- new Effect.AccordionSize(accordionTab.closedContent,
- accordionTab.content,
- 1,
- this.options.panelHeight,
- 100, 10,
- { complete: function()
- {
- accordionTab.showExpanded();
- if (accordionTab.accordion.options.onShowTab)
- accordionTab.accordion.options.onShowTab(accordionTab);
-
- if(accordionTab.accordion.options.useRealHeight)
- accordionTab.content.style.height = "";
- } });
- }
-
- }
- else
- {
- if(accordionTab.accordion.options.useRealHeight)
- accordionTab.content.style.height = "";
- else
- accordionTab.content.style.height = this.options.panelHeight + "px";
-
- if (accordionTab.closedContent)
- {
- accordionTab.closedContent.style.height = "1px";
- }
- accordionTab.showExpanded();
- if (this.options.onShowTab)
- this.options.onShowTab(accordionTab);
-
- }
- },
-
- showTabDone: function(collapsedTab)
- {
- collapsedTab.content.style.display = 'none';
- },
-
- _attachBehaviors: function()
- {
- var panels = this._getDirectChildrenByTag(this.container, 'DIV');
- for (var i = 0; i < panels.length; i++)
- {
-
- var tabChildren = this._getDirectChildrenByTag(panels[i], 'DIV');
- var tabTitleBar = null;
- var tabClosedContentBox = null;
- var tabContentBox = null;
-
- if (tabChildren.length == 2)
- {
- tabTitleBar = tabChildren[0];
- tabContentBox = tabChildren[1];
- }
- else if (tabChildren.length == 3)
- {
- tabTitleBar = tabChildren[0];
- tabClosedContentBox = tabChildren[1];
- tabContentBox = tabChildren[2];
- }
- else
- {
- continue;
- // unexpected
- }
-
- var stateChildren = this._getDirectChildrenByTag(panels[i], 'INPUT');
- var stateInput = stateChildren[0];
-
- this.accordionTabs.push(new Rico.Toggler.Tab.Custom(this, tabTitleBar,
- tabClosedContentBox, tabContentBox, stateInput));
- }
- },
-
- _getDirectChildrenByTag: function(e, tagName)
- {
- var kids = new Array();
- var allKids = e.childNodes;
- for (var i = 0; i < allKids.length; i++)
- if (allKids[i] && allKids[i].tagName && allKids[i].tagName == tagName)
- kids.push(allKids[i]);
- return kids;
- }
-
-};
-
-Rico.Toggler.Tab.Custom = Class.create();
-
-Rico.Toggler.Tab.Custom.prototype = {
-
- initialize: function(accordion, titleBar, closedContent, content, stateHolder)
- {
- this.accordion = accordion;
- this.titleBar = titleBar;
- this.content = content;
- this.closedContent = closedContent;
- this.stateHolder = stateHolder;
- this._attachBehaviors();
- },
-
- collapse: function()
- {
- this.showCollapsed();
- this.content.style.height = "1px";
- },
-
- showCollapsed: function()
- {
- this.expanded = false;
- this.titleBar.style.backgroundColor = this.accordion.options.collapsedBg;
- this.titleBar.style.color = this.accordion.options.collapsedTextColor;
- this.titleBar.style.fontWeight = this.accordion.options.collapsedFontWeight;
- this.content.style.overflow = "hidden";
- this.stateHolder.value = 0;
- if (this.closedContent)
- {
- this.closedContent.style.overflow = "visible";
- }
- },
-
- showExpanded: function()
- {
- this.expanded = true;
- this.titleBar.style.backgroundColor = this.accordion.options.expandedBg;
- this.titleBar.style.color = this.accordion.options.expandedTextColor;
- this.content.style.overflow = "visible";
- this.stateHolder.value = 1;
- if (this.closedContent)
- {
- this.closedContent.style.overflow = "hidden";
- }
- },
-
- titleBarClicked: function(e)
- {
- this.accordion.toggleTab(this);
- },
-
- hover: function(e)
- {
- this.titleBar.style.backgroundColor = this.accordion.options.hoverBg;
- this.titleBar.style.color = this.accordion.options.hoverTextColor;
- },
-
- unhover: function(e)
- {
- if (this.expanded)
- {
- this.titleBar.style.backgroundColor = this.accordion.options.expandedBg;
- this.titleBar.style.color = this.accordion.options.expandedTextColor;
- }
- else
- {
- this.titleBar.style.backgroundColor = this.accordion.options.collapsedBg;
- this.titleBar.style.color = this.accordion.options.collapsedTextColor;
- }
- },
-
- _attachBehaviors: function()
- {
- this.content.style.border = "1px solid " + this.accordion.options.borderColor;
- this.content.style.borderTopWidth = "0px";
- this.content.style.borderBottomWidth = "0px";
- this.content.style.margin = "0px";
-
- if (this.closedContent)
- {
- this.closedContent.style.border = "1px solid " + this.accordion.options.borderColor;
- this.closedContent.style.borderTopWidth = "0px";
- this.closedContent.style.borderBottomWidth = "0px";
- this.closedContent.style.margin = "0px";
- }
-
- this.titleBar.onclick = this.titleBarClicked.bindAsEventListener(this);
- this.titleBar.onmouseover = this.hover.bindAsEventListener(this);
- this.titleBar.onmouseout = this.unhover.bindAsEventListener(this);
- }
-
+// CUSTOM ACCORDION
+
+Rico.Accordion.Custom = Class.create();
+
+Rico.Accordion.Custom.prototype = {
+ initialize: function(container, options)
+ {
+ this.container = $(container);
+ this.lastExpandedTab = null;
+ this.accordionTabs = new Array();
+ this.setOptions(options);
+ this._attachBehaviors();
+
+ this.container.style.borderBottom = '1px solid ' + this.options.borderColor;
+
+ // set the initial visual state...
+ for ( var i = 0; i < this.accordionTabs.length ; i++ )
+ {
+ if(this.accordionTabs[i].stateHolder.value == 1)
+ {
+ this.lastExpandedTab = this.accordionTabs[i];
+ this.lastExpandedTab.content.style.height = this.options.panelHeight + "px";
+ this.lastExpandedTab.showExpanded();
+ this.lastExpandedTab.titleBar.style.fontWeight = this.options.expandedFontWeight;
+ }
+ else
+ {
+ this.accordionTabs[i].collapse();
+ this.accordionTabs[i].content.style.display = 'none';
+ }
+ }
+ },
+
+ setOptions: function(options)
+ {
+ this.options = {
+ expandedBg : '#63699c',
+ hoverBg : '#63699c',
+ collapsedBg : '#6b79a5',
+ expandedTextColor : '#ffffff',
+ expandedFontWeight : 'bold',
+ hoverTextColor : '#ffffff',
+ collapsedTextColor : '#ced7ef',
+ collapsedFontWeight : 'normal',
+ hoverTextColor : '#ffffff',
+ borderColor : '#1f669b',
+ panelHeight : 200,
+ onHideTab : null,
+ onShowTab : null
+ };
+
+ Object.extend(options, {});
+ },
+
+ showTabByIndex: function( anIndex, animate )
+ {
+ var doAnimate = arguments.length == 1 ? true : animate;
+ this.showTab( this.accordionTabs[anIndex], doAnimate );
+ },
+
+ showTab: function( accordionTab, animate )
+ {
+ var doAnimate = arguments.length == 1 ? true : animate;
+
+ if ( this.options.onHideTab )
+ this.options.onHideTab(this.lastExpandedTab);
+
+ this.lastExpandedTab.showCollapsed();
+ var accordion = this;
+ var lastExpandedTab = this.lastExpandedTab;
+
+ this.lastExpandedTab.content.style.height = (this.options.panelHeight - 1) + 'px';
+ accordionTab.content.style.display = '';
+
+ accordionTab.titleBar.style.fontWeight = this.options.expandedFontWeight;
+
+ if ( doAnimate )
+ {
+ new Effect.AccordionSize(this.lastExpandedTab.content,
+ accordionTab.content,
+ 1,
+ this.options.panelHeight,
+ 100, 10,
+ { complete: function() {accordion.showTabDone(lastExpandedTab)} } );
+ this.lastExpandedTab = accordionTab;
+ }
+ else
+ {
+ this.lastExpandedTab.content.style.height = "1px";
+ accordionTab.content.style.height = this.options.panelHeight + "px";
+ this.lastExpandedTab = accordionTab;
+ this.showTabDone(lastExpandedTab);
+ }
+ },
+
+ showTabDone: function(collapsedTab)
+ {
+ collapsedTab.content.style.display = 'none';
+ this.lastExpandedTab.showExpanded();
+ if ( this.options.onShowTab )
+ this.options.onShowTab(this.lastExpandedTab);
+ },
+
+ _attachBehaviors: function()
+ {
+ var panels = this._getDirectChildrenByTag(this.container, 'DIV');
+ for ( var i = 0 ; i < panels.length ; i++ )
+ {
+ var tabChildren = this._getDirectChildrenByTag(panels[i],'DIV');
+ if ( tabChildren.length != 2 )
+ continue; // unexpected
+
+ var stateChildren = this._getDirectChildrenByTag(panels[i], 'INPUT');
+
+ var tabTitleBar = tabChildren[0];
+ var tabContentBox = tabChildren[1];
+ var stateInput = stateChildren[0];
+ this.accordionTabs.push( new Rico.Accordion.Tab.Custom(this,tabTitleBar,tabContentBox, stateInput) );
+ }
+ },
+
+ _getDirectChildrenByTag: function(e, tagName)
+ {
+ var kids = new Array();
+ var allKids = e.childNodes;
+ for( var i = 0 ; i < allKids.length ; i++ )
+ if ( allKids[i] && allKids[i].tagName && allKids[i].tagName == tagName )
+ kids.push(allKids[i]);
+ return kids;
+ }
+};
+
+
+Rico.Accordion.Tab.Custom = Class.create();
+
+Rico.Accordion.Tab.Custom.prototype = {
+ initialize: function(accordion, titleBar, content, stateHolder)
+ {
+ this.accordion = accordion;
+ this.titleBar = titleBar;
+ this.content = content;
+ this.stateHolder = stateHolder;
+ this._attachBehaviors();
+ },
+
+ collapse: function()
+ {
+ this.showCollapsed();
+ this.content.style.height = "1px";
+ },
+
+ showCollapsed: function()
+ {
+ this.expanded = false;
+ this.titleBar.style.backgroundColor = this.accordion.options.collapsedBg;
+ this.titleBar.style.color = this.accordion.options.collapsedTextColor;
+ this.titleBar.style.fontWeight = this.accordion.options.collapsedFontWeight;
+ this.content.style.overflow = "hidden";
+ this.stateHolder.value = 0;
+ },
+
+ showExpanded: function()
+ {
+ this.expanded = true;
+ this.titleBar.style.backgroundColor = this.accordion.options.expandedBg;
+ this.titleBar.style.color = this.accordion.options.expandedTextColor;
+ this.content.style.overflow = "visible";
+ this.stateHolder.value = 1;
+ },
+
+ titleBarClicked: function(e)
+ {
+ if ( this.accordion.lastExpandedTab == this )
+ return;
+ this.accordion.showTab(this);
+ },
+
+ hover: function(e)
+ {
+ this.titleBar.style.backgroundColor = this.accordion.options.hoverBg;
+ this.titleBar.style.color = this.accordion.options.hoverTextColor;
+ },
+
+ unhover: function(e)
+ {
+ if ( this.expanded )
+ {
+ this.titleBar.style.backgroundColor = this.accordion.options.expandedBg;
+ this.titleBar.style.color = this.accordion.options.expandedTextColor;
+ }
+ else
+ {
+ this.titleBar.style.backgroundColor = this.accordion.options.collapsedBg;
+ this.titleBar.style.color = this.accordion.options.collapsedTextColor;
+ }
+ },
+
+ _attachBehaviors: function()
+ {
+ this.content.style.border = "1px solid " + this.accordion.options.borderColor;
+ this.content.style.borderTopWidth = "0px";
+ this.content.style.borderBottomWidth = "0px";
+ this.content.style.margin = "0px";
+
+ this.titleBar.onclick = this.titleBarClicked.bindAsEventListener(this);
+ this.titleBar.onmouseover = this.hover.bindAsEventListener(this);
+ this.titleBar.onmouseout = this.unhover.bindAsEventListener(this);
+ }
+};
+
+
+// CUSTOM TOGGLER
+
+Rico.Toggler.Custom = Class.create();
+
+Rico.Toggler.Custom.prototype = {
+
+ initialize: function(container, options)
+ {
+ this.container = $(container);
+ this.accordionTabs = new Array();
+ this.setOptions(options);
+ this._attachBehaviors();
+
+ this.container.style.borderBottom = '1px solid ' + this.options.borderColor;
+
+ // set the initial visual state...
+ for ( var i = 0; i < this.accordionTabs.length ; i++ )
+ {
+ if(this.accordionTabs[i].stateHolder.value == 1)
+ {
+ if(this.options.useRealHeight)
+ this.accordionTabs[i].content.style.height = "";
+ else
+ this.accordionTabs[i].content.style.height = this.options.panelHeight + "px";
+
+ this.accordionTabs[i].showExpanded();
+ this.accordionTabs[i].titleBar.style.fontWeight = this.options.expandedFontWeight;
+
+ if (this.accordionTabs[i].closedContent)
+ {
+ if(this.accordionTabs[i].closedContent.style.display)
+ this.accordionTabs[i].closedContent.style.display = 'hidden';
+ if(this.accordionTabs[i].closedContent.style.height)
+ this.accordionTabs[i].closedContent.style.height = "1px";
+ }
+
+ }
+ else
+ {
+ this.accordionTabs[i].collapse();
+ this.accordionTabs[i].content.style.display = 'none';
+ if (this.accordionTabs[i].closedContent)
+ {
+ if(this.accordionTabs[i].closedContent.style.display)
+ this.accordionTabs[i].closedContent.style.display = 'visible';
+ if(this.accordionTabs[i].closedContent.style.height)
+ this.accordionTabs[i].closedContent.style.height = this.options.closedPanelHeight + "px";
+ }
+ }
+ }
+ },
+
+ setOptions: function(options)
+ {
+ this.options = {
+ expandedBg : '#63699c',
+ hoverBg : '#63699c',
+ collapsedBg : '#6b79a5',
+ expandedTextColor : '#ffffff',
+ expandedFontWeight : 'bold',
+ hoverTextColor : '#ffffff',
+ collapsedTextColor : '#ced7ef',
+ collapsedFontWeight : 'normal',
+ hoverTextColor : '#ffffff',
+ borderColor : '#1f669b',
+ panelHeight : 200,
+ closedPanelHeight : 50,
+ useRealHeight : true,
+ onHideTab : null,
+ onShowTab : null
+ };
+
+ Object.extend(options, {});
+ },
+
+ showTabByIndex: function(anIndex, animate)
+ {
+ var doAnimate = arguments.length == 1 ? true : animate;
+ this.showTab(this.accordionTabs[anIndex], doAnimate);
+ },
+
+ toggleTab: function(accordionTab, animate)
+ {
+
+ var doAnimate = arguments.length == 1 ? true : animate;
+
+ if (accordionTab.expanded)
+ {
+ this._collapseTab(accordionTab, doAnimate);
+ }
+ else
+ {
+ this._expandTab(accordionTab, doAnimate);
+ }
+ },
+
+ _collapseTab: function(accordionTab, doAnimate)
+ {
+ if (this.options.onHideTab)
+ this.options.onHideTab(accordionTab);
+
+ accordionTab.showCollapsed();
+ var accordion = this;
+
+ accordionTab.content.style.height = (this.options.panelHeight - 1) + 'px';
+
+ if (doAnimate)
+ {
+ if (!accordionTab.closedContent)
+ {
+ new Effect.TogglerSize(accordionTab.content,
+ 1,
+ 100, 10,
+ { complete: function()
+ {
+ accordion.showTabDone(accordionTab)
+ } });
+ }
+ else
+ {
+ new Effect.AccordionSize(accordionTab.content,
+ accordionTab.closedContent,
+ 1,
+ this.options.closedPanelHeight,
+ 100, 10,
+ { complete: function()
+ {
+ accordion.showTabDone(accordionTab)
+ } });
+ }
+ }
+ else
+ {
+ accordionTab.content.style.height = "1px";
+
+ if (accordionTab.closedContent)
+ {
+ accordionTab.closedContent.style.height = this.options.closedPanelHeight + "px";
+ }
+ this.showTabDone(accordionTab);
+ }
+ },
+
+ _expandTab: function(accordionTab, doAnimate)
+ {
+ var accordion = this;
+
+ accordionTab.content.style.display = '';
+ accordionTab.titleBar.style.fontWeight = this.options.expandedFontWeight;
+
+ if (accordionTab.closedContent)
+ {
+ accordionTab.closedContent.style.height = (this.options.closedPanelHeight - 1) + 'px';
+ }
+
+ if (doAnimate)
+ {
+ if (!accordionTab.closedContent)
+ {
+ new Effect.TogglerSize(accordionTab.content,
+ this.options.panelHeight,
+ 100, 10,
+ { complete: function()
+ {
+ accordionTab.showExpanded();
+ if (accordionTab.accordion.options.onShowTab)
+ accordionTab.accordion.options.onShowTab(accordionTab);
+
+ if(accordionTab.accordion.options.useRealHeight)
+ accordionTab.content.style.height = "";
+ } });
+ }
+ else
+ {
+ new Effect.AccordionSize(accordionTab.closedContent,
+ accordionTab.content,
+ 1,
+ this.options.panelHeight,
+ 100, 10,
+ { complete: function()
+ {
+ accordionTab.showExpanded();
+ if (accordionTab.accordion.options.onShowTab)
+ accordionTab.accordion.options.onShowTab(accordionTab);
+
+ if(accordionTab.accordion.options.useRealHeight)
+ accordionTab.content.style.height = "";
+ } });
+ }
+
+ }
+ else
+ {
+ if(accordionTab.accordion.options.useRealHeight)
+ accordionTab.content.style.height = "";
+ else
+ accordionTab.content.style.height = this.options.panelHeight + "px";
+
+ if (accordionTab.closedContent)
+ {
+ accordionTab.closedContent.style.height = "1px";
+ }
+ accordionTab.showExpanded();
+ if (this.options.onShowTab)
+ this.options.onShowTab(accordionTab);
+
+ }
+ },
+
+ showTabDone: function(collapsedTab)
+ {
+ collapsedTab.content.style.display = 'none';
+ },
+
+ _attachBehaviors: function()
+ {
+ var panels = this._getDirectChildrenByTag(this.container, 'DIV');
+ for (var i = 0; i < panels.length; i++)
+ {
+
+ var tabChildren = this._getDirectChildrenByTag(panels[i], 'DIV');
+ var tabTitleBar = null;
+ var tabClosedContentBox = null;
+ var tabContentBox = null;
+
+ if (tabChildren.length == 2)
+ {
+ tabTitleBar = tabChildren[0];
+ tabContentBox = tabChildren[1];
+ }
+ else if (tabChildren.length == 3)
+ {
+ tabTitleBar = tabChildren[0];
+ tabClosedContentBox = tabChildren[1];
+ tabContentBox = tabChildren[2];
+ }
+ else
+ {
+ continue;
+ // unexpected
+ }
+
+ var stateChildren = this._getDirectChildrenByTag(panels[i], 'INPUT');
+ var stateInput = stateChildren[0];
+
+ this.accordionTabs.push(new Rico.Toggler.Tab.Custom(this, tabTitleBar,
+ tabClosedContentBox, tabContentBox, stateInput));
+ }
+ },
+
+ _getDirectChildrenByTag: function(e, tagName)
+ {
+ var kids = new Array();
+ var allKids = e.childNodes;
+ for (var i = 0; i < allKids.length; i++)
+ if (allKids[i] && allKids[i].tagName && allKids[i].tagName == tagName)
+ kids.push(allKids[i]);
+ return kids;
+ }
+
+};
+
+Rico.Toggler.Tab.Custom = Class.create();
+
+Rico.Toggler.Tab.Custom.prototype = {
+
+ initialize: function(accordion, titleBar, closedContent, content, stateHolder)
+ {
+ this.accordion = accordion;
+ this.titleBar = titleBar;
+ this.content = content;
+ this.closedContent = closedContent;
+ this.stateHolder = stateHolder;
+ this._attachBehaviors();
+ },
+
+ collapse: function()
+ {
+ this.showCollapsed();
+ this.content.style.height = "1px";
+ },
+
+ showCollapsed: function()
+ {
+ this.expanded = false;
+ this.titleBar.style.backgroundColor = this.accordion.options.collapsedBg;
+ this.titleBar.style.color = this.accordion.options.collapsedTextColor;
+ this.titleBar.style.fontWeight = this.accordion.options.collapsedFontWeight;
+ this.content.style.overflow = "hidden";
+ this.stateHolder.value = 0;
+ if (this.closedContent)
+ {
+ this.closedContent.style.overflow = "visible";
+ }
+ },
+
+ showExpanded: function()
+ {
+ this.expanded = true;
+ this.titleBar.style.backgroundColor = this.accordion.options.expandedBg;
+ this.titleBar.style.color = this.accordion.options.expandedTextColor;
+ this.content.style.overflow = "visible";
+ this.stateHolder.value = 1;
+ if (this.closedContent)
+ {
+ this.closedContent.style.overflow = "hidden";
+ }
+ },
+
+ titleBarClicked: function(e)
+ {
+ this.accordion.toggleTab(this);
+ },
+
+ hover: function(e)
+ {
+ this.titleBar.style.backgroundColor = this.accordion.options.hoverBg;
+ this.titleBar.style.color = this.accordion.options.hoverTextColor;
+ },
+
+ unhover: function(e)
+ {
+ if (this.expanded)
+ {
+ this.titleBar.style.backgroundColor = this.accordion.options.expandedBg;
+ this.titleBar.style.color = this.accordion.options.expandedTextColor;
+ }
+ else
+ {
+ this.titleBar.style.backgroundColor = this.accordion.options.collapsedBg;
+ this.titleBar.style.color = this.accordion.options.collapsedTextColor;
+ }
+ },
+
+ _attachBehaviors: function()
+ {
+ this.content.style.border = "1px solid " + this.accordion.options.borderColor;
+ this.content.style.borderTopWidth = "0px";
+ this.content.style.borderBottomWidth = "0px";
+ this.content.style.margin = "0px";
+
+ if (this.closedContent)
+ {
+ this.closedContent.style.border = "1px solid " + this.accordion.options.borderColor;
+ this.closedContent.style.borderTopWidth = "0px";
+ this.closedContent.style.borderBottomWidth = "0px";
+ this.closedContent.style.margin = "0px";
+ }
+
+ this.titleBar.onclick = this.titleBarClicked.bindAsEventListener(this);
+ this.titleBar.onmouseover = this.hover.bindAsEventListener(this);
+ this.titleBar.onmouseout = this.unhover.bindAsEventListener(this);
+ }
+
};
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/accordion/resource/customRico.js
------------------------------------------------------------------------------
svn:eol-style = native