myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r375420 - in /myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom: dojo/ effect/
Date Mon, 06 Feb 2006 23:54:31 GMT
Author: werpu
Date: Mon Feb  6 15:54:29 2006
New Revision: 375420

URL: http://svn.apache.org/viewcvs?rev=375420&view=rev
Log:
dojo import foundation now working and in place

Added:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoConfig.java
  (with props)
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializer.java
  (with props)
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerRenderer.java
  (with props)
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerTag.java
  (with props)
Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoUtils.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/effect/EffectRenderer.java

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoConfig.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoConfig.java?rev=375420&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoConfig.java
(added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoConfig.java
Mon Feb  6 15:54:29 2006
@@ -0,0 +1,161 @@
+/**
+ * Copyright 2004 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.dojo;
+
+/**
+ * Dojo configuration holder helper
+ * this is a helper class to generate
+ * a dojo configuration
+ * if a null value is set the toString 
+ * ignores the djconfig
+ * 
+ * the toString method generates a full djconfig
+ * 
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class DojoConfig
+{
+    Boolean _ioSendTransport      = null;
+    Boolean _debug                = null;
+    String  _baseScriptUri        = null;
+    Boolean _allowQueryConfig     = null;
+    String  _debugContainerId     = null;
+    String  _searchIds            = null;
+    Boolean _parseWidgets         = null;
+    Boolean _bindEncoding         = null;
+    Boolean _ignoreClassNames     = null;
+    Boolean _preventBackButtonFix = null;
+    
+    
+    private final void createConfigEntry(StringBuffer target, String name, Object toCheck)
{
+            if(toCheck == null) return;
+            if(!target.toString().trim().equals(""))
+                target.append(",\n");
+            target.append(name);
+            target.append(":");
+            target.append(toCheck);
+    }    
+    
+    /**
+     * returns a valid djconfig string 
+     */
+    public String toString() {
+        
+        StringBuffer configBuilder = new StringBuffer(128);
+        configBuilder.append("var djConfig = { \n");
+
+        createConfigEntry(configBuilder, "ioSendTransport", _ioSendTransport);
+        createConfigEntry(configBuilder, "debug", _debug);
+        createConfigEntry(configBuilder, "baseScriptUri", _baseScriptUri);
+        createConfigEntry(configBuilder, "allowQueryConfig", _allowQueryConfig);
+        createConfigEntry(configBuilder, "debugContainerId", _debugContainerId);
+        createConfigEntry(configBuilder, "searchIds", _searchIds);
+        createConfigEntry(configBuilder, "parseWidgets", _parseWidgets);
+        createConfigEntry(configBuilder, "bindEncoding", _bindEncoding);
+        createConfigEntry(configBuilder, "ignoreClassNames", _ignoreClassNames);
+        createConfigEntry(configBuilder, "preventBackButtonFix", _preventBackButtonFix);
+
+        
+        configBuilder.append("\n");
+        configBuilder.append("}; \n");
+
+        return configBuilder.toString();
+    }
+    
+    //getters and setters for the djconfig
+    public Boolean getAllowQueryConfig()
+    {
+        return _allowQueryConfig;
+    }
+    public void setAllowQueryConfig(Boolean allowQueryConfig)
+    {
+        this._allowQueryConfig = allowQueryConfig;
+    }
+    public String getBaseScriptUri()
+    {
+        return _baseScriptUri;
+    }
+    public void setBaseScriptUri(String baseScriptUri)
+    {
+        this._baseScriptUri = baseScriptUri;
+    }
+    public Boolean getBindEncoding()
+    {
+        return _bindEncoding;
+    }
+    public void setBindEncoding(Boolean bindEncoding)
+    {
+        this._bindEncoding = bindEncoding;
+    }
+    public Boolean getDebug()
+    {
+        return _debug;
+    }
+    public void setDebug(Boolean debug)
+    {
+        this._debug = debug;
+    }
+    public String getDebugContainerId()
+    {
+        return _debugContainerId;
+    }
+    public void setDebugContainerId(String debugContainerId)
+    {
+        this._debugContainerId = debugContainerId;
+    }
+    public Boolean getIgnoreClassNames()
+    {
+        return _ignoreClassNames;
+    }
+    public void setIgnoreClassNames(Boolean ignoreClassNames)
+    {
+        this._ignoreClassNames = ignoreClassNames;
+    }
+    public Boolean getIoSendTransport()
+    {
+        return _ioSendTransport;
+    }
+    public void setIoSendTransport(Boolean ioSendTransport)
+    {
+        this._ioSendTransport = ioSendTransport;
+    }
+    public Boolean getParseWidgets()
+    {
+        return _parseWidgets;
+    }
+    public void setParseWidgets(Boolean parseWidgets)
+    {
+        this._parseWidgets = parseWidgets;
+    }
+    public Boolean getPreventBackButtonFix()
+    {
+        return _preventBackButtonFix;
+    }
+    public void setPreventBackButtonFix(Boolean preventBackButtonFix)
+    {
+        this._preventBackButtonFix = preventBackButtonFix;
+    }
+    public String getSearchIds()
+    {
+        return _searchIds;
+    }
+    public void setSearchIds(String searchIds)
+    {
+        this._searchIds = searchIds;
+    }
+}

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoConfig.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializer.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializer.java?rev=375420&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializer.java
(added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializer.java
Mon Feb  6 15:54:29 2006
@@ -0,0 +1,213 @@
+/**
+ * Copyright 2004 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.dojo;
+
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+
+/**
+ * Default component for the dojo intializer
+ * 
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class DojoInitializer extends UIOutput
+{
+    DojoConfig                 _dojoConfig           = new DojoConfig();
+    String                     _require             = null;
+
+    public static final String COMPONENT_TYPE        = "org.apache.myfaces.DojoInitializer";
+    public static final String DEFAULT_RENDERER_TYPE = DojoInitializerRenderer.RENDERER_TYPE;
+    public static final String COMPONENT_FAMILY      = "javax.faces.Output";
+
+    public DojoInitializer()
+    {
+        setRendererType(DEFAULT_RENDERER_TYPE);
+    }
+
+    public String getRendererType()
+    {
+        return DojoInitializerRenderer.RENDERER_TYPE;
+    }
+
+    public String getFamily()
+    {
+        return COMPONENT_FAMILY;
+    }
+
+    public String getComponentType()
+    {
+        return COMPONENT_TYPE;
+    }
+
+    public Object getValue()
+    {
+        return "DojoInitializers";
+    }
+
+    public void restoreState(FacesContext context, Object state)
+    {
+        Object values[] = (Object[]) state;
+        super.restoreState(context, values[0]);
+        _dojoConfig.setAllowQueryConfig((Boolean) values[1]);
+        _dojoConfig.setBaseScriptUri((String) values[2]);
+        _dojoConfig.setBindEncoding((Boolean) values[3]);
+        _dojoConfig.setDebug((Boolean) values[4]);
+        _dojoConfig.setDebugContainerId((String) values[5]);
+        _dojoConfig.setIgnoreClassNames((Boolean) values[6]);
+        _dojoConfig.setIoSendTransport((Boolean) values[7]);
+        _dojoConfig.setParseWidgets((Boolean) values[8]);
+        _dojoConfig.setPreventBackButtonFix((Boolean) values[9]);
+        _dojoConfig.setSearchIds((String) values[10]);
+        _require = (String) values[11];
+        
+    }
+
+    public Object saveState(FacesContext context)
+    {
+        Object values[] = new Object[12];
+        values[0] = super.saveState(context);
+        values[1] = _dojoConfig.getAllowQueryConfig();
+        values[2] = _dojoConfig.getBaseScriptUri();
+        values[3] = _dojoConfig.getBindEncoding();
+        values[4] = _dojoConfig.getDebug();
+        values[5] = _dojoConfig.getDebugContainerId();
+        values[6] = _dojoConfig.getIgnoreClassNames();
+        values[7] = _dojoConfig.getIoSendTransport();
+        values[8] = _dojoConfig.getParseWidgets();
+        values[9] = _dojoConfig.getPreventBackButtonFix();
+        values[10] = _dojoConfig.getSearchIds();
+        values[11] = _require;
+        return values;
+    }
+
+    public Boolean getAllowQueryConfig()
+    {
+        return _dojoConfig.getAllowQueryConfig();
+    }
+
+    public String getBaseScriptUri()
+    {
+        return _dojoConfig.getBaseScriptUri();
+    }
+
+    public Boolean getBindEncoding()
+    {
+        return _dojoConfig.getBindEncoding();
+    }
+
+    public Boolean getDebug()
+    {
+        return _dojoConfig.getDebug();
+    }
+
+    public String getDebugContainerId()
+    {
+        return _dojoConfig.getDebugContainerId();
+    }
+
+    public Boolean getIgnoreClassNames()
+    {
+        return _dojoConfig.getIgnoreClassNames();
+    }
+
+    public Boolean getIoSendTransport()
+    {
+        return _dojoConfig.getIoSendTransport();
+    }
+
+    public Boolean getParseWidgets()
+    {
+        return _dojoConfig.getParseWidgets();
+    }
+
+    public Boolean getPreventBackButtonFix()
+    {
+        return _dojoConfig.getPreventBackButtonFix();
+    }
+
+    public String getSearchIds()
+    {
+        return _dojoConfig.getSearchIds();
+    }
+
+    public void setAllowQueryConfig(Boolean allowQueryConfig)
+    {
+        _dojoConfig.setAllowQueryConfig(allowQueryConfig);
+    }
+
+    public void setBaseScriptUri(String baseScriptUri)
+    {
+        _dojoConfig.setBaseScriptUri(baseScriptUri);
+    }
+
+    public void setBindEncoding(Boolean bindEncoding)
+    {
+        _dojoConfig.setBindEncoding(bindEncoding);
+    }
+
+    public void setDebug(Boolean debug)
+    {
+        _dojoConfig.setDebug(debug);
+    }
+
+    public void setDebugContainerId(String debugContainerId)
+    {
+        _dojoConfig.setDebugContainerId(debugContainerId);
+    }
+
+    public void setIgnoreClassNames(Boolean ignoreClassNames)
+    {
+        _dojoConfig.setIgnoreClassNames(ignoreClassNames);
+    }
+
+    public void setIoSendTransport(Boolean ioSendTransport)
+    {
+        _dojoConfig.setIoSendTransport(ioSendTransport);
+    }
+
+    public void setParseWidgets(Boolean parseWidgets)
+    {
+        _dojoConfig.setParseWidgets(parseWidgets);
+    }
+
+    public void setPreventBackButtonFix(Boolean preventBackButtonFix)
+    {
+        _dojoConfig.setPreventBackButtonFix(preventBackButtonFix);
+    }
+
+    public void setSearchIds(String searchIds)
+    {
+        _dojoConfig.setSearchIds(searchIds);
+    }
+
+    public DojoConfig getDojoConfig()
+    {
+        return _dojoConfig;
+    }
+
+    public String getRequire()
+    {
+        return _require;
+    }
+
+    public void setRequire(String required)
+    {
+        this._require = required;
+    }
+
+}

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerRenderer.java?rev=375420&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerRenderer.java
(added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerRenderer.java
Mon Feb  6 15:54:29 2006
@@ -0,0 +1,87 @@
+/**
+ * Copyright 2004 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.dojo;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.renderkit.JSFAttr;
+import org.apache.myfaces.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.renderkit.html.util.AddResource;
+
+/**
+ * Dojointializerrenderer
+ * 
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class DojoInitializerRenderer extends HtmlRenderer
+{
+    public static final String RENDERER_TYPE = "org.apache.myfaces.DojoInitializerRenderer";
+
+    /**
+     * 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
+     */
+    private void encodeJavascript(FacesContext context, UIComponent component)
+    {
+        String javascriptLocation = (String) component.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
+        DojoUtils.addMainInclude(context, javascriptLocation, ((DojoInitializer) component).getDojoConfig());
+        String require = (String) component.getAttributes().get("require");
+
+        if (require != null)
+            DojoUtils.addRequired(context, require);
+    }
+
+    public boolean getRendersChildren()
+    {
+        return false;
+    }
+
+    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);
+    }
+
+    /**
+     * Standard encode end
+     *
+     */
+    public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException
+    {
+        super.encodeEnd(facesContext, component);
+    }
+
+}

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerRenderer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerTag.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerTag.java?rev=375420&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerTag.java
(added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerTag.java
Mon Feb  6 15:54:29 2006
@@ -0,0 +1,144 @@
+/**
+ * Copyright 2004 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.dojo;
+
+import javax.faces.component.UIComponent;
+
+import org.apache.myfaces.taglib.html.HtmlOutputTextTagBase;
+
+/**
+ * Tag for the dojo intializer code
+ * 
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class DojoInitializerTag extends HtmlOutputTextTagBase
+{
+    String _ioSendTransport      = null;
+    String _debug                = null;
+    String _baseScriptUri        = null;
+    String _allowQueryConfig     = null;
+    String _debugContainerId     = null;
+    String _searchIds            = null;
+    String _parseWidgets         = null;
+    String _bindEncoding         = null;
+    String _ignoreClassNames     = null;
+    String _preventBackButtonFix = null;
+
+    String _require              = null;
+
+    public String getComponentType()
+    {
+        return DojoInitializer.COMPONENT_TYPE;
+    }
+
+    public String getRendererType()
+    {
+        return DojoInitializerRenderer.RENDERER_TYPE;
+    }
+
+    public void release()
+    {
+        super.release();
+        _ioSendTransport = null;
+        _debug = null;
+        _baseScriptUri = null;
+        _allowQueryConfig = null;
+        _debugContainerId = null;
+        _searchIds = null;
+        _parseWidgets = null;
+        _bindEncoding = null;
+        _ignoreClassNames = null;
+        _preventBackButtonFix = null;
+        _require = null;
+    }
+
+    protected void setProperties(UIComponent component)
+    {
+        super.setProperties(component);
+        super.setBooleanProperty(component, "ioSendTransport", _ioSendTransport);
+        super.setBooleanProperty(component, "debug", _debug);
+        super.setStringProperty(component, "baseScriptUri", _baseScriptUri);
+        super.setBooleanProperty(component, "allowQueryConfig", _allowQueryConfig);
+        super.setStringProperty(component, "debugContainerId", _debugContainerId);
+        super.setStringProperty(component, "searchIds", _searchIds);
+        super.setBooleanProperty(component, "parseWidgets", _parseWidgets);
+        super.setBooleanProperty(component, "bindEncoding", _bindEncoding);
+
+        super.setBooleanProperty(component, "ignoreClassNames", _ignoreClassNames);
+        super.setBooleanProperty(component, "preventBackButtonFix", _preventBackButtonFix);
+
+        super.setStringProperty(component, "require", _require);
+
+    }
+
+    public void setAllowQueryConfig(String allowQueryConfig)
+    {
+        this._allowQueryConfig = allowQueryConfig;
+    }
+
+    public void setBaseScriptUri(String baseScriptUri)
+    {
+        this._baseScriptUri = baseScriptUri;
+    }
+
+    public void setBindEncoding(String bindEncoding)
+    {
+        this._bindEncoding = bindEncoding;
+    }
+
+    public void setDebug(String debug)
+    {
+        this._debug = debug;
+    }
+
+    public void setDebugContainerId(String debugContainerId)
+    {
+        this._debugContainerId = debugContainerId;
+    }
+
+    public void setIgnoreClassNames(String ignoreClassNames)
+    {
+        this._ignoreClassNames = ignoreClassNames;
+    }
+
+    public void setIoSendTransport(String ioSendTransport)
+    {
+        this._ioSendTransport = ioSendTransport;
+    }
+
+    public void setParseWidgets(String parseWidgets)
+    {
+        this._parseWidgets = parseWidgets;
+    }
+
+    public void setPreventBackButtonFix(String preventBackButtonFix)
+    {
+        this._preventBackButtonFix = preventBackButtonFix;
+    }
+
+    public void setSearchIds(String searchIds)
+    {
+        this._searchIds = searchIds;
+    }
+
+    public void setRequire(String require)
+    {
+        this._require = require;
+    }
+
+}

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoInitializerTag.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoUtils.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoUtils.java?rev=375420&r1=375419&r2=375420&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoUtils.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/dojo/DojoUtils.java
Mon Feb  6 15:54:29 2006
@@ -44,39 +44,8 @@
     public static final boolean DOJO_COMPRESSED        = false;
     public static final boolean DOJO_DEBUG             = false;
 
-    /**
-     * Write a dojo require include 
-     * 
-     * @param writer        the response write
-     * @param component     the component
-     * @param dojoPackage   the dojo package string (wildcards allowed
-     * @throws IOException  in case of an io error
-     */
-    public static final void require(ResponseWriter writer, UIComponent component, String
dojoPackage)
-            throws IOException
-    {
-        writer.startElement(HTML.SCRIPT_ELEM, component);
-        writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null);
-        StringBuffer buf = new StringBuffer(40);
-
-        buf.append("dojo.require(\"");
-        buf.append(dojoPackage);
-        buf.append("\");");
-
-        writer.write(buf.toString());
-
-        writer.endElement(HTML.SCRIPT_ELEM);
-    }
 
-    /**
-     * handles the central include of the dojo
-     * core, subsequent packages can be loaded 
-     * via require if needed
-     * 
-     * @param context
-     * @param javascriptLocation
-     */
-    public static final void addMainInclude(FacesContext context, String javascriptLocation)
+    public static final void addMainInclude(FacesContext context, String javascriptLocation,
DojoConfig config)
     {
         AddResource addResource = AddResource.getInstance(context);
         /*
@@ -85,7 +54,7 @@
          };
 
          */
-        dojoPreinitialization(context, addResource);
+        addResource.addInlineScriptAtPosition(context, AddResource.HEADER_BEGIN, config.toString());
         String dojofile = DOJO_COMPRESSED ? DOJO_FILE : DOJO_FILE_UNCOMPRESSED;
         if (javascriptLocation != null)
         {
@@ -95,27 +64,24 @@
         {
             addResource.addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN, DojoResourceLoader.class,
dojofile);
         }
+
     }
 
     /**
-     * preinitialisation code
-     * this code has to be prefixed mandatory
-     * in dojo otherwise the dojo system
-     * does not initialize properly
+     * adds a dojo require include to our mix 
+     * of stuff used
      * 
      * @param context
-     * @param addResource
+     * @param required
      */
-    private static void dojoPreinitialization(FacesContext context, AddResource addResource)
+    public static final void addRequired(FacesContext context, String required)
     {
-        StringBuffer inlineScript = new StringBuffer();
+        AddResource addResource = AddResource.getInstance(context);
+        StringBuffer requiredBuilder = new StringBuffer(32);
+        requiredBuilder.append("dojo.require(\"");
+        requiredBuilder.append(required);
+        requiredBuilder.append("\");");
 
-        inlineScript.append("var djConfig = { \n");
-        inlineScript.append("   isDebug:");
-        inlineScript.append(DOJO_DEBUG);
-        inlineScript.append("\n");
-        inlineScript.append("}; \n");
-        addResource.addInlineScriptAtPosition(context, AddResource.HEADER_BEGIN, inlineScript.toString());
+        addResource.addInlineScriptAtPosition(context, AddResource.HEADER_BEGIN, requiredBuilder.toString());
     }
-
 }

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/effect/EffectRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/effect/EffectRenderer.java?rev=375420&r1=375419&r2=375420&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/effect/EffectRenderer.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/effect/EffectRenderer.java
Mon Feb  6 15:54:29 2006
@@ -23,6 +23,7 @@
 import javax.faces.context.ResponseWriter;
 
 import org.apache.myfaces.custom.div.Div;
+import org.apache.myfaces.custom.dojo.DojoConfig;
 import org.apache.myfaces.custom.dojo.DojoUtils;
 import org.apache.myfaces.custom.prototype.PrototypeResourceLoader;
 import org.apache.myfaces.renderkit.JSFAttr;
@@ -44,7 +45,8 @@
  */
 public class EffectRenderer extends HtmlRenderer
 {
-
+    public static final String RENDERER_TYPE = "org.apache.myfaces.effect.EffectRenderer";
+    
     /**
      * Encodes any stand-alone javascript functions that are needed. Uses either
      * the extension filter, or a user-supplied location for the javascript
@@ -81,7 +83,7 @@
             addResource.addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN, FATResourceLoader.class,
"fat.js");
 
         }
-        DojoUtils.addMainInclude(context, javascriptLocation);
+        DojoUtils.addMainInclude(context, javascriptLocation, new DojoConfig());
     }
 
     public boolean getRendersChildren()
@@ -89,7 +91,7 @@
         return true;
     }
 
-    public static final String RENDERER_TYPE = "script.aculo.us.renderer";
+    
 
     /**
      * We only need an encodeBeing method because the fade control, does not



Mime
View raw message