Author: werpu
Date: Tue Oct 4 15:33:51 2005
New Revision: 294939
URL: http://svn.apache.org/viewcvs?rev=294939&view=rev
Log:
convert tabs to spaces
Modified:
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/effect/EffectRenderer.java
myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/effect/EffectTag.java
Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/effect/EffectRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/effect/EffectRenderer.java?rev=294939&r1=294938&r2=294939&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/effect/EffectRenderer.java (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/effect/EffectRenderer.java Tue
Oct 4 15:33:51 2005
@@ -46,198 +46,198 @@
*/
public class EffectRenderer extends HtmlRenderer {
- private static final String JAVASCRIPT_ENCODED = "org.apache.myfaces.inputsuggestajax.JAVASCRIPT_ENCODED";
+ private static final String JAVASCRIPT_ENCODED = "org.apache.myfaces.inputsuggestajax.JAVASCRIPT_ENCODED";
- /**
- * Encodes any stand-alone javascript functions that are needed. Uses either
- * the extension filter, or a user-supplied location for the javascript
- * files.
- *
- * @param context
- * FacesContext
- * @param component
- * UIComponent
- * @throws java.io.IOException
- */
- private void encodeJavascript(FacesContext context, UIComponent component) throws IOException
{
- // check to see if javascript has already been written (which could
- // happen if more than one tree on the same page)
- if (context.getExternalContext().getRequestMap().containsKey(JAVASCRIPT_ENCODED)) {
- return;
- }
-
- // render javascript function for client-side toggle (it won't be used
- // if user has opted for server-side toggle)
- ResponseWriter out = context.getResponseWriter();
- String javascriptLocation = (String) component.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
- if (javascriptLocation == null) {
- AddResource.addJavaScriptToHeader(PrototypeResourceLoader.class, "prototype.js", context);
- AddResource.addJavaScriptToHeader(PrototypeResourceLoader.class, "effects.js", context);
- AddResource.addJavaScriptToHeader(EffectRenderer.class, "fat.js", context);
-
-
- } else {
- out.startElement(HTML.SCRIPT_ELEM, null);
- out.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
- out.writeAttribute(HTML.SRC_ATTR, javascriptLocation + "/prototype.js", null);
- out.endElement(HTML.SCRIPT_ELEM);
-
- out.startElement(HTML.SCRIPT_ELEM, null);
- out.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
- out.writeAttribute(HTML.SRC_ATTR, javascriptLocation + "/effects.js", null);
- out.endElement(HTML.SCRIPT_ELEM);
-
- out.startElement(HTML.SCRIPT_ELEM, null);
- out.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
- out.writeAttribute(HTML.SRC_ATTR, javascriptLocation + "/dragdrop.js", null);
- out.endElement(HTML.SCRIPT_ELEM);
-
- out.startElement(HTML.SCRIPT_ELEM, null);
- out.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
- out.writeAttribute(HTML.SRC_ATTR, javascriptLocation + "/controls.js", null);
- out.endElement(HTML.SCRIPT_ELEM);
-
- }
-
- context.getExternalContext().getRequestMap().put(JAVASCRIPT_ENCODED, Boolean.TRUE);
- }
-
- public boolean getRendersChildren() {
- return true;
- }
-
- public static final String RENDERER_TYPE = "script.aculo.us.renderer";
-
- /**
- * We only need an encodeBeing method because the fade control, does not
- * have any childs
- *
- * The fading is done via a styleClass tag according to the FAT specs, for
- * now this is more flexible than embedding yet another tag in another tag
- * but less flexible for styleClass usage reasons (but you always can use
- * x:div for handling this issue in a proper manner)
- *
- * we have to do a full overload unfortunately because it is altered
- * severely
- *
- */
- public void encodeBegin(FacesContext context, UIComponent component) throws IOException
{
- if ((context == null) || (component == null)) {
- throw new NullPointerException();
- }
-
- Boolean rendered = (Boolean) component.getAttributes().get("rendered");
-
- if ((rendered != null) && (!rendered.booleanValue()))
- return;
- encodeJavascript(context, component);
- super.encodeBegin(context, component);
- prepareFade(component);
- renderEffectsBegin(context, component);
- }
-
- /**
- * prepares the styleClasses for the fading renderer
- *
- * @param component
- */
- private void prepareFade(UIComponent component) {
- Div theComponent = (Div) component;
- Boolean fade = (Boolean) component.getAttributes().get(EffectTag.TAG_PARAM_FADE);
-
- String theStyleClass = theComponent.getStyleClass();
- if (theStyleClass == null)
- theStyleClass = "";
- if (fade != null && fade.booleanValue() && !(theStyleClass.indexOf("fade")
!= -1)) {
-
- if (theStyleClass != null && !theStyleClass.trim().equalsIgnoreCase(""))
- theStyleClass += ";fade";
- else
- theStyleClass = "fade";
-
- String fadeColor = (String) component.getAttributes().get(EffectTag.TAG_PARAM_FADECOLOR);
-
- fadeColor = (fadeColor != null) ? fadeColor : "";
- fadeColor = fadeColor.replaceAll("#", "");
- if (fadeColor.length() != 0)
- fadeColor = "-" + fadeColor;
-
- theStyleClass += fadeColor;
- theComponent.setStyleClass(theStyleClass);
- }
- }
-
- public void renderEffectsBegin(FacesContext context, UIComponent component) throws IOException
{
-
- // dump all the parameters which affect us into we dont set a central
- // unchecked here to keep the warning level high
- Boolean squish = (Boolean) component.getAttributes().get(EffectTag.TAG_PARAM_SQUISH);
- Boolean puff = (Boolean) component.getAttributes().get(EffectTag.TAG_PARAM_PUFF);
- Boolean scale = (Boolean) component.getAttributes().get(EffectTag.TAG_PARAM_SCALE);
- Boolean pulsate = (Boolean) component.getAttributes().get(EffectTag.TAG_PARAM_PULSATE);
- Integer scaleSize = (Integer) component.getAttributes().get(EffectTag.TAG_PARAM_SCALE_SIZE);
-
- Div div = (Div) component;
- ResponseWriter writer = context.getResponseWriter();
-
- // if(fade != null && fade.booleanValue())
- // ScriptController.renderScriptWithDeps(context, component, writer,
- // ScriptController.FAT_VIEW_ID);
-
- writer.startElement(HTML.DIV_ELEM, component);
- HtmlRendererUtils.writeIdIfNecessary(writer, component, context);
-
- String styleClass = div.getStyleClass();
- String style = div.getStyle();
- if (null != styleClass && null != style) {
- throw new IllegalStateException("Only one of style or styleClass can be specified");
- }
- if (null != styleClass) {
- writer.writeAttribute(HTML.CLASS_ATTR, styleClass, null);
- }
- if (null != style) {
- writer.writeAttribute(HTML.STYLE_ATTR, style, null);
- }
- // todo check the existing code for already existent javascript code
- // not needed now, but probably in the long run
-
- if (puff != null && puff.booleanValue()) {
- writer.writeAttribute(HTML.ONCLICK_ATTR, "javascript:new Effect.Puff(this);", null);
- }
- if (squish != null && squish.booleanValue()) {
- writer.writeAttribute(HTML.ONCLICK_ATTR, "javascript:new Effect.Squish(this);", null);
- }
- if(pulsate != null && pulsate.booleanValue()) {
- writer.writeAttribute(HTML.ONCLICK_ATTR, "javascript:new Effect.Pulsate(this);", null);
- }
- if (scale != null && scale.booleanValue()) {
- writer.writeAttribute(HTML.ONMOUSEOVER_ATTR, "javascript:new Effect.Scale(this," + scaleSize.toString()
+ ");", null);
- writer.writeAttribute(HTML.ONMOUSEOUT_ATTR, "javascript:new Effect.Scale(this,100);",
null);
- }
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.render.Renderer#encodeChildren(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws IOException
{
-
- RendererUtils.renderChildren(facesContext, uiComponent);
- HtmlRendererUtils.writePrettyLineSeparator(facesContext);
- }
-
- /**
- * Standard encode end
- *
- */
- public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException
{
- ResponseWriter writer = facesContext.getResponseWriter();
- writer.endElement(HTML.DIV_ELEM);
- HtmlRendererUtils.writePrettyLineSeparator(facesContext);
- super.encodeEnd(facesContext, component);
- }
+ /**
+ * Encodes any stand-alone javascript functions that are needed. Uses either
+ * the extension filter, or a user-supplied location for the javascript
+ * files.
+ *
+ * @param context
+ * FacesContext
+ * @param component
+ * UIComponent
+ * @throws java.io.IOException
+ */
+ private void encodeJavascript(FacesContext context, UIComponent component) throws IOException
{
+ // check to see if javascript has already been written (which could
+ // happen if more than one tree on the same page)
+ if (context.getExternalContext().getRequestMap().containsKey(JAVASCRIPT_ENCODED))
{
+ return;
+ }
+
+ // render javascript function for client-side toggle (it won't be used
+ // if user has opted for server-side toggle)
+ ResponseWriter out = context.getResponseWriter();
+ String javascriptLocation = (String) component.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
+ if (javascriptLocation == null) {
+ AddResource.addJavaScriptToHeader(PrototypeResourceLoader.class, "prototype.js",
context);
+ AddResource.addJavaScriptToHeader(PrototypeResourceLoader.class, "effects.js",
context);
+ AddResource.addJavaScriptToHeader(EffectRenderer.class, "fat.js", context);
+
+
+ } else {
+ out.startElement(HTML.SCRIPT_ELEM, null);
+ out.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
+ out.writeAttribute(HTML.SRC_ATTR, javascriptLocation + "/prototype.js", null);
+ out.endElement(HTML.SCRIPT_ELEM);
+
+ out.startElement(HTML.SCRIPT_ELEM, null);
+ out.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
+ out.writeAttribute(HTML.SRC_ATTR, javascriptLocation + "/effects.js", null);
+ out.endElement(HTML.SCRIPT_ELEM);
+
+ out.startElement(HTML.SCRIPT_ELEM, null);
+ out.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
+ out.writeAttribute(HTML.SRC_ATTR, javascriptLocation + "/dragdrop.js", null);
+ out.endElement(HTML.SCRIPT_ELEM);
+
+ out.startElement(HTML.SCRIPT_ELEM, null);
+ out.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
+ out.writeAttribute(HTML.SRC_ATTR, javascriptLocation + "/controls.js", null);
+ out.endElement(HTML.SCRIPT_ELEM);
+
+ }
+
+ context.getExternalContext().getRequestMap().put(JAVASCRIPT_ENCODED, Boolean.TRUE);
+ }
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ public static final String RENDERER_TYPE = "script.aculo.us.renderer";
+
+ /**
+ * We only need an encodeBeing method because the fade control, does not
+ * have any childs
+ *
+ * The fading is done via a styleClass tag according to the FAT specs, for
+ * now this is more flexible than embedding yet another tag in another tag
+ * but less flexible for styleClass usage reasons (but you always can use
+ * x:div for handling this issue in a proper manner)
+ *
+ * we have to do a full overload unfortunately because it is altered
+ * severely
+ *
+ */
+ public void encodeBegin(FacesContext context, UIComponent component) throws IOException
{
+ if ((context == null) || (component == null)) {
+ throw new NullPointerException();
+ }
+
+ Boolean rendered = (Boolean) component.getAttributes().get("rendered");
+
+ if ((rendered != null) && (!rendered.booleanValue()))
+ return;
+ encodeJavascript(context, component);
+ super.encodeBegin(context, component);
+ prepareFade(component);
+ renderEffectsBegin(context, component);
+ }
+
+ /**
+ * prepares the styleClasses for the fading renderer
+ *
+ * @param component
+ */
+ private void prepareFade(UIComponent component) {
+ Div theComponent = (Div) component;
+ Boolean fade = (Boolean) component.getAttributes().get(EffectTag.TAG_PARAM_FADE);
+
+ String theStyleClass = theComponent.getStyleClass();
+ if (theStyleClass == null)
+ theStyleClass = "";
+ if (fade != null && fade.booleanValue() && !(theStyleClass.indexOf("fade")
!= -1)) {
+
+ if (theStyleClass != null && !theStyleClass.trim().equalsIgnoreCase(""))
+ theStyleClass += ";fade";
+ else
+ theStyleClass = "fade";
+
+ String fadeColor = (String) component.getAttributes().get(EffectTag.TAG_PARAM_FADECOLOR);
+
+ fadeColor = (fadeColor != null) ? fadeColor : "";
+ fadeColor = fadeColor.replaceAll("#", "");
+ if (fadeColor.length() != 0)
+ fadeColor = "-" + fadeColor;
+
+ theStyleClass += fadeColor;
+ theComponent.setStyleClass(theStyleClass);
+ }
+ }
+
+ public void renderEffectsBegin(FacesContext context, UIComponent component) throws IOException
{
+
+ // dump all the parameters which affect us into we dont set a central
+ // unchecked here to keep the warning level high
+ Boolean squish = (Boolean) component.getAttributes().get(EffectTag.TAG_PARAM_SQUISH);
+ Boolean puff = (Boolean) component.getAttributes().get(EffectTag.TAG_PARAM_PUFF);
+ Boolean scale = (Boolean) component.getAttributes().get(EffectTag.TAG_PARAM_SCALE);
+ Boolean pulsate = (Boolean) component.getAttributes().get(EffectTag.TAG_PARAM_PULSATE);
+ Integer scaleSize = (Integer) component.getAttributes().get(EffectTag.TAG_PARAM_SCALE_SIZE);
+
+ Div div = (Div) component;
+ ResponseWriter writer = context.getResponseWriter();
+
+ // if(fade != null && fade.booleanValue())
+ // ScriptController.renderScriptWithDeps(context, component, writer,
+ // ScriptController.FAT_VIEW_ID);
+
+ writer.startElement(HTML.DIV_ELEM, component);
+ HtmlRendererUtils.writeIdIfNecessary(writer, component, context);
+
+ String styleClass = div.getStyleClass();
+ String style = div.getStyle();
+ if (null != styleClass && null != style) {
+ throw new IllegalStateException("Only one of style or styleClass can be specified");
+ }
+ if (null != styleClass) {
+ writer.writeAttribute(HTML.CLASS_ATTR, styleClass, null);
+ }
+ if (null != style) {
+ writer.writeAttribute(HTML.STYLE_ATTR, style, null);
+ }
+ // todo check the existing code for already existent javascript code
+ // not needed now, but probably in the long run
+
+ if (puff != null && puff.booleanValue()) {
+ writer.writeAttribute(HTML.ONCLICK_ATTR, "javascript:new Effect.Puff(this);",
null);
+ }
+ if (squish != null && squish.booleanValue()) {
+ writer.writeAttribute(HTML.ONCLICK_ATTR, "javascript:new Effect.Squish(this);",
null);
+ }
+ if(pulsate != null && pulsate.booleanValue()) {
+ writer.writeAttribute(HTML.ONCLICK_ATTR, "javascript:new Effect.Pulsate(this);",
null);
+ }
+ if (scale != null && scale.booleanValue()) {
+ writer.writeAttribute(HTML.ONMOUSEOVER_ATTR, "javascript:new Effect.Scale(this,"
+ scaleSize.toString() + ");", null);
+ writer.writeAttribute(HTML.ONMOUSEOUT_ATTR, "javascript:new Effect.Scale(this,100);",
null);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.render.Renderer#encodeChildren(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent)
+ */
+ public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws
IOException {
+
+ RendererUtils.renderChildren(facesContext, uiComponent);
+ HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+ }
+
+ /**
+ * Standard encode end
+ *
+ */
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException
{
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.endElement(HTML.DIV_ELEM);
+ HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+ super.encodeEnd(facesContext, component);
+ }
}
Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/effect/EffectTag.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/effect/EffectTag.java?rev=294939&r1=294938&r2=294939&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/effect/EffectTag.java (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/effect/EffectTag.java Tue Oct
4 15:33:51 2005
@@ -35,131 +35,131 @@
public class EffectTag extends DivTag {
- public static final String TAG_PARAM_FADECOLOR = "fadeColor";
+ public static final String TAG_PARAM_FADECOLOR = "fadeColor";
- public static final String TAG_PARAM_FADE = "fade";
+ public static final String TAG_PARAM_FADE = "fade";
- public static final String TAG_PARAM_SQUISH = "squish";
+ public static final String TAG_PARAM_SQUISH = "squish";
- public static final String TAG_PARAM_SCALE = "scale";
+ public static final String TAG_PARAM_SCALE = "scale";
- public static final String TAG_PARAM_SCALE_SIZE = "scaleSize";
-
- public static final String TAG_PARAM_PUFF = "puff";
-
- public static final String TAG_PARAM_PULSATE = "pulsate";
-
- /**
- * only one param, to keep it as simple as possible it will hover out at
- * 100% and the default hover in is 150% there is no real need for a
- * different hover out than 100% that I can see for now but feel free to add
- * one if you need it
- */
-
- String _fadeColor = "";
-
- String _fade = "false";
-
- String _puff = "false";
-
- String _scale = "false";
-
- String _scaleSize = "150";
-
- String _squish = "false";
-
- String _pulsate = "false";
-
- protected void setProperties(UIComponent component) {
- super.setProperties(component);
- super.setStringProperty(component, TAG_PARAM_FADECOLOR, _fadeColor);
- super.setIntegerProperty(component, TAG_PARAM_SCALE_SIZE, _scaleSize);
- super.setBooleanProperty(component, TAG_PARAM_FADE, _fade);
-
-
- super.setBooleanProperty(component, TAG_PARAM_PUFF, _puff);
- super.setBooleanProperty(component, TAG_PARAM_SCALE, _scale);
- super.setBooleanProperty(component, TAG_PARAM_SQUISH, _squish);
- super.setBooleanProperty(component, TAG_PARAM_PULSATE, _pulsate);
- }
-
- /**
- * release method
- */
- public void release() {
- super.release();
- _fadeColor = null;
- _fade = null;
- _puff = null;
- _scale = null;
- _squish = null;
- _scaleSize = null;
- _pulsate = null;
- }
-
- public String getComponentType() {
- return super.getComponentType();
- }
-
- public String getRendererType() {
- return EffectRenderer.RENDERER_TYPE;
- }
-
- /**
- * Setter for the fade color now in place
- *
- * @param fadeColor
- */
- public void setFadeColor(String fadeColor) {
- _fadeColor = fadeColor;
- }
-
- /**
- * enable the fading effect
- *
- * @param fade
- */
- public void setFade(String fade) {
- _fade = fade;
- }
-
- /**
- * enable the scaleing effect
- *
- * @param incoming
- */
- public void setscale(String incoming) {
- _scale = incoming;
- }
-
- /**
- * enable the puffing effect
- *
- * @param puff
- */
- public void setPuff(String puff) {
- _puff = puff;
- }
-
- /**
- * enable the squishing effect
- *
- * @param sqish
- */
- public void setSquish(String sqish) {
- _squish = sqish;
- }
-
- /**
- * Scale size for the hover out adjustment of the scale effect
- *
- * @param size
- */
- public void setScaleSize(String size) {
- _scaleSize = size;
- }
-
- public void setPulsate(String pulsate) {
- _pulsate = pulsate;
- }
+ public static final String TAG_PARAM_SCALE_SIZE = "scaleSize";
+
+ public static final String TAG_PARAM_PUFF = "puff";
+
+ public static final String TAG_PARAM_PULSATE = "pulsate";
+
+ /**
+ * only one param, to keep it as simple as possible it will hover out at
+ * 100% and the default hover in is 150% there is no real need for a
+ * different hover out than 100% that I can see for now but feel free to add
+ * one if you need it
+ */
+
+ String _fadeColor = "";
+
+ String _fade = "false";
+
+ String _puff = "false";
+
+ String _scale = "false";
+
+ String _scaleSize = "150";
+
+ String _squish = "false";
+
+ String _pulsate = "false";
+
+ protected void setProperties(UIComponent component) {
+ super.setProperties(component);
+ super.setStringProperty(component, TAG_PARAM_FADECOLOR, _fadeColor);
+ super.setIntegerProperty(component, TAG_PARAM_SCALE_SIZE, _scaleSize);
+ super.setBooleanProperty(component, TAG_PARAM_FADE, _fade);
+
+
+ super.setBooleanProperty(component, TAG_PARAM_PUFF, _puff);
+ super.setBooleanProperty(component, TAG_PARAM_SCALE, _scale);
+ super.setBooleanProperty(component, TAG_PARAM_SQUISH, _squish);
+ super.setBooleanProperty(component, TAG_PARAM_PULSATE, _pulsate);
+ }
+
+ /**
+ * release method
+ */
+ public void release() {
+ super.release();
+ _fadeColor = null;
+ _fade = null;
+ _puff = null;
+ _scale = null;
+ _squish = null;
+ _scaleSize = null;
+ _pulsate = null;
+ }
+
+ public String getComponentType() {
+ return super.getComponentType();
+ }
+
+ public String getRendererType() {
+ return EffectRenderer.RENDERER_TYPE;
+ }
+
+ /**
+ * Setter for the fade color now in place
+ *
+ * @param fadeColor
+ */
+ public void setFadeColor(String fadeColor) {
+ _fadeColor = fadeColor;
+ }
+
+ /**
+ * enable the fading effect
+ *
+ * @param fade
+ */
+ public void setFade(String fade) {
+ _fade = fade;
+ }
+
+ /**
+ * enable the scaleing effect
+ *
+ * @param incoming
+ */
+ public void setscale(String incoming) {
+ _scale = incoming;
+ }
+
+ /**
+ * enable the puffing effect
+ *
+ * @param puff
+ */
+ public void setPuff(String puff) {
+ _puff = puff;
+ }
+
+ /**
+ * enable the squishing effect
+ *
+ * @param sqish
+ */
+ public void setSquish(String sqish) {
+ _squish = sqish;
+ }
+
+ /**
+ * Scale size for the hover out adjustment of the scale effect
+ *
+ * @param size
+ */
+ public void setScaleSize(String size) {
+ _scaleSize = size;
+ }
+
+ public void setPulsate(String pulsate) {
+ _pulsate = pulsate;
+ }
}
|