You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by do...@apache.org on 2005/10/19 17:31:56 UTC

svn commit: r326581 [9/9] - in /beehive/trunk/netui: ant/ src/bootstrap/org/apache/beehive/netui/tools/tld/xdoclet/ src/jar-assembly/ src/pageflow/org/apache/beehive/netui/pageflow/ src/simple-tags/ src/simple-tags/org/ src/simple-tags/org/apache/ src/...

Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TagRenderingBase.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TagRenderingBase.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TagRenderingBase.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TagRenderingBase.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,416 @@
+/*
+ * 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.simpletags.rendering;
+
+import org.apache.beehive.netui.simpletags.appender.Appender;
+import org.apache.beehive.netui.simpletags.core.IDocumentTypeProducer;
+import org.apache.beehive.netui.simpletags.core.TagContext;
+import org.apache.beehive.netui.simpletags.util.ContextUtils;
+import org.apache.beehive.netui.util.Bundle;
+import org.apache.beehive.netui.util.config.ConfigUtil;
+import org.apache.beehive.netui.util.config.bean.DocType;
+import org.apache.beehive.netui.util.config.bean.JspTagConfig;
+import org.apache.beehive.netui.util.logging.Logger;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ *
+ */
+public abstract class TagRenderingBase
+{
+    private static final Logger logger = Logger.getInstance(TagRenderingBase.class);
+
+    /**
+     * Unknown Rendering
+     */
+    public static final int UNKNOWN_RENDERING = 0;
+
+    /**
+     * Identifier for HTML 4.01 Rendering
+     */
+    public static final int HTML_RENDERING = 1;
+
+    /**
+     * Identifier for XHTML Transitional Rendering
+     */
+    public static final int XHTML_RENDERING = 2;
+
+    /**
+     * Identifier for HTML 4.01 Rendering in Quirks mode
+     */
+    public static final int HTML_RENDERING_QUIRKS = 3;
+
+    //////////////////////////////////// Supported Rendering Constants  ////////////////////////////
+
+    /**
+     * The static initializer will read the netui config file and set the doc type of there is
+     * one specified.
+     */
+
+    private static int _defaultDocType;
+
+    static
+    {
+        _defaultDocType = HTML_RENDERING_QUIRKS;
+        JspTagConfig tagConfig = ConfigUtil.getConfig().getJspTagConfig();
+        if (tagConfig != null) {
+            DocType docType = tagConfig.getDocType();
+            setDefaultDocType(docType);
+        }
+    }
+
+    public static int getDefaultDocType()
+    {
+        return _defaultDocType;
+    }
+
+    public static void setDefaultDocType(DocType docType)
+    {
+        if (docType != null) {
+            if (docType == DocType.HTML4_LOOSE)
+                _defaultDocType = TagRenderingBase.HTML_RENDERING;
+            else if (docType == DocType.HTML4_LOOSE_QUIRKS)
+                _defaultDocType = TagRenderingBase.HTML_RENDERING_QUIRKS;
+            else if (docType== DocType.XHTML1_TRANSITIONAL)
+                _defaultDocType = TagRenderingBase.XHTML_RENDERING;
+        }
+    }
+
+    /**
+     * Token identifying the Anchor Renderer <a>
+     */
+    public static final Object ANCHOR_TAG = new Object();
+    public static final Object AREA_TAG = new Object();
+    public static final Object BASE_TAG = new Object();
+    public static final Object BODY_TAG = new Object();
+    public static final Object BR_TAG = new Object();
+    public static final Object CAPTION_TAG = new Object();
+    public static final Object FORM_TAG = new Object();
+    public static final Object IMAGE_TAG = new Object();
+    public static final Object INPUT_BOOLEAN_TAG = new Object();
+    public static final Object INPUT_FILE_TAG = new Object();
+    public static final Object INPUT_HIDDEN_TAG = new Object();
+    public static final Object INPUT_IMAGE_TAG = new Object();
+    public static final Object INPUT_SUBMIT_TAG = new Object();
+    public static final Object INPUT_TEXT_TAG = new Object();
+    public static final Object HTML_TAG = new Object();
+    public static final Object LABEL_TAG = new Object();
+    public static final Object OPTION_TAG = new Object();
+    public static final Object SELECT_TAG = new Object();
+    public static final Object SPAN_TAG = new Object();
+    public static final Object DIV_TAG = new Object();
+    public static final Object TABLE_TAG = new Object();
+    public static final Object TBODY_TAG = new Object();
+    public static final Object TD_TAG = new Object();
+    public static final Object TEXT_AREA_TAG = new Object();
+    public static final Object TH_TAG = new Object();
+    public static final Object THEAD_TAG = new Object();
+    public static final Object TFOOT_TAG = new Object();
+    public static final Object TR_TAG = new Object();
+    public static final Object SCRIPT_TAG = new Object();
+
+    //////////////////////////////////// Abstract Methods  ////////////////////////////
+
+    /**
+     * Render the start tag for an element.  The element will render the tag and all of it's
+     * attributes into a InternalStringBuilder.
+     * @param sb          A InternalStringBuilder where the element start tag is appended.
+     * @param renderState The state assocated with the element.
+     */
+    abstract public void doStartTag(Appender sb, AbstractTagState renderState);
+
+    /**
+     * Render the end tag for an element. The end tag will be rendered if the tag requires an end tag.
+     * @param sb A InternalStringBuilder where the element end tag may be appended.
+     */
+    abstract public void doEndTag(Appender sb);
+
+    /**
+     * @param buf
+     * @param name
+     */
+    protected final void renderTag(Appender buf, String name)
+    {
+        assert (buf != null) : "Parameter 'buf' must not be null.";
+        assert (name != null) : "Parameter 'name' must not be null";
+
+        buf.append("<");
+        buf.append(name);
+    }
+
+    /**
+     * @param buf
+     * @param name
+     */
+    protected final void renderEndTag(Appender buf, String name)
+    {
+        buf.append("</");
+        buf.append(name);
+        buf.append(">");
+    }
+
+    /**
+     * This method will append an attribute value to a InternalStringBuilder.
+     * The method assumes that the attr is not <code>null</code>.  If the
+     * <code>value</code> attribute is <code>null</code> the attribute will not be appended to the
+     * <code>InternalStringBuilder</code>.
+     * @param buf   The InternalStringBuilder to append the attribute into.
+     * @param name  The name of the attribute
+     * @param value The value of teh attribute.  If this is <code>null</code> the attribute will not be written.
+     */
+    protected final void renderAttribute(Appender buf, String name, String value)
+    {
+        assert (buf != null) : "Parameter 'buf' must not be null.";
+        assert (name != null) : "Parameter 'name' must not be null";
+
+        // without a value lets skip writting this out
+        if (value == null)
+            return;
+
+        buf.append(" ");
+        buf.append(name);
+        buf.append("=\"");
+        buf.append(value);
+        buf.append("\"");
+    }
+
+    /**
+     * @param buf
+     * @param name
+     * @param value
+     */
+    protected final void renderAttributeSingleQuotes(Appender buf, String name, String value)
+    {
+        assert (buf != null) : "Parameter 'buf' must not be null.";
+        assert (name != null) : "Parameter 'name' must not be null";
+
+        // without a value lets skip writting this out
+        if (value == null)
+            return;
+
+        buf.append(" ");
+        buf.append(name);
+        buf.append("='");
+        buf.append(value);
+        buf.append("'");
+    }
+
+    /**
+     * Render all of the attributes defined in a map and return the string value.  The attributes
+     * are rendered with in a name="value" style supported by XML.
+     * @param type an integer key indentifying the map
+     */
+    protected void renderAttributes(int type, Appender sb, AbstractAttributeState state, boolean doubleQuote)
+    {
+        HashMap map = null;
+        switch (type) {
+            case AbstractAttributeState.ATTR_GENERAL:
+                map = state.getGeneralAttributeMap();
+                break;
+            default:
+                String s = Bundle.getString("Tags_ParameterRenderError",
+                        new Object[]{new Integer(type)});
+                logger.error(s);
+                throw new IllegalStateException(s);
+        }
+        renderGeneral(map, sb, doubleQuote);
+    }
+
+    final protected void renderAttributes(int type, Appender sb, AbstractAttributeState state)
+    {
+        renderAttributes(type, sb, state, true);
+    }
+
+    /**
+     * This method will render all of the general attributes.
+     */
+    protected void renderGeneral(HashMap map, Appender sb, boolean doubleQuote)
+    {
+        if (map == null)
+            return;
+
+        Iterator iterator = map.keySet().iterator();
+        for (; iterator.hasNext();) {
+            String key = (String) iterator.next();
+            if (key == null)
+                continue;
+
+            String value = (String) map.get(key);
+            if (doubleQuote)
+                renderAttribute(sb, key, value);
+            else
+                renderAttributeSingleQuotes(sb, key, value);
+        }
+    }
+
+    /**
+     * This is the factory for obtaining a Tag Rendering object.  The factory supports to types
+     * of renderings HTML 4.01 and XHTML.  The factory is responsible for creating the rendering objects and
+     * passing them out.  The target encoding may be specified on a page by page basis within a WebApp.  The
+     * <code>getRendering</code> method will return a <code>TagRenderingBase</code> object.  This object is always
+     * a stateless object.  The state needed to render the tag will be passed into the tag.
+     */
+    public static class Factory
+    {
+        private static HashMap _xhtml;      // The XHTML TagRenderingBase objects
+        private static HashMap _html;       // The HTML TagRenderingBase objects
+        private static HashMap _htmlQuirks; // THe HTML Quirks TagRenderingBase object
+
+        private static ConstantRendering _xhtmlConstants;
+        private static ConstantRendering _htmlConstants;
+
+        // create the HashMaps and their static renderings.
+        static
+        {
+            _xhtml = new HashMap(37);
+            _html = new HashMap(37);
+            _htmlQuirks = new HashMap(37);
+
+            // build the supported renderers.
+            AnchorTag.add(_html, _htmlQuirks, _xhtml);
+            AreaTag.add(_html, _htmlQuirks, _xhtml);
+            BaseTag.add(_html, _htmlQuirks, _xhtml);
+            BodyTag.add(_html, _htmlQuirks, _xhtml);
+            CaptionTag.add(_html, _htmlQuirks, _xhtml);
+            DivTag.add(_html, _htmlQuirks, _xhtml);
+            FormTag.add(_html, _htmlQuirks, _xhtml);
+            ImageTag.add(_html, _htmlQuirks, _xhtml);
+            InputBooleanTag.add(_html, _htmlQuirks, _xhtml);
+            InputFileTag.add(_html, _htmlQuirks, _xhtml);
+            InputHiddenTag.add(_html, _htmlQuirks, _xhtml);
+            InputImageTag.add(_html, _htmlQuirks, _xhtml);
+            InputSubmitTag.add(_html, _htmlQuirks, _xhtml);
+            InputTextTag.add(_html, _htmlQuirks, _xhtml);
+            HtmlTag.add(_html, _htmlQuirks, _xhtml);
+            LabelTag.add(_html, _htmlQuirks, _xhtml);
+            OptionTag.add(_html, _htmlQuirks, _xhtml);
+            SelectTag.add(_html, _htmlQuirks, _xhtml);
+            SpanTag.add(_html, _htmlQuirks, _xhtml);
+            TableTag.add(_html, _htmlQuirks, _xhtml);
+            TBodyTag.add(_html, _htmlQuirks, _xhtml);
+            TdTag.add(_html, _htmlQuirks, _xhtml);
+            TextAreaTag.add(_html, _htmlQuirks, _xhtml);
+            ThTag.add(_html, _htmlQuirks, _xhtml);
+            THeadTag.add(_html, _htmlQuirks, _xhtml);
+            TFootTag.add(_html, _htmlQuirks, _xhtml);
+            TrTag.add(_html, _htmlQuirks, _xhtml);
+            ScriptTag.add(_html, _htmlQuirks, _xhtml);
+        }
+
+        /**
+         * Factory method for getting a TagRenderingBase for a tag.  The default rendering is HTML 4.01.
+         * @param token The type of TagRenderingBase to retrieve.
+         * @return A <code>TagRenderingBase</code>
+         */
+        public static TagRenderingBase getRendering(Object token)
+        {
+            int renderingType = _defaultDocType;
+            TagContext tagCtxt = ContextUtils.getTagContext();
+            int reqRender = tagCtxt.getTagRenderingType();
+            if (reqRender != -1)
+                renderingType = reqRender;
+            else {
+                IDocumentTypeProducer docProducer = tagCtxt.getDocTypeProducer();
+                if (docProducer != null) {
+                    renderingType = docProducer.getTargetDocumentType();
+                }
+                tagCtxt.setTagRenderingType(renderingType);
+            }
+
+            // pick the map of renderers
+            HashMap h = null;
+            switch (renderingType) {
+                case HTML_RENDERING:
+                    h = _html;
+                    break;
+                case HTML_RENDERING_QUIRKS:
+                    h = _htmlQuirks;
+                    break;
+                case XHTML_RENDERING:
+                    h = _xhtml;
+                    break;
+                default:
+                    assert(true) : "Didn't find the map for rendering type:" + renderingType;
+            }
+
+            // return the renderer
+            Object o = h.get(token);
+            assert(o != null) : "Renderer was not found for [" + token + "] rendering:" + renderingType;
+            return (TagRenderingBase) o;
+        }
+
+        /**
+         * Return true if the current document is XHTML
+         * @return boolean
+         */
+        public static boolean isXHTML()
+        {
+            TagContext tagCtxt = ContextUtils.getTagContext();
+            IDocumentTypeProducer html = tagCtxt.getDocTypeProducer();
+
+            // the default is html 4.0
+            int renderingType = _defaultDocType;
+            if (html != null) {
+                renderingType = html.getTargetDocumentType();
+            }
+
+            return (renderingType == XHTML_RENDERING);
+        }
+
+        /**
+         * @return ConstantRendering
+         */
+        public static ConstantRendering getConstantRendering()
+        {
+            TagContext tagCtxt = ContextUtils.getTagContext();
+            IDocumentTypeProducer docProducer = tagCtxt.getDocTypeProducer();
+
+            if (_htmlConstants == null) {
+                _htmlConstants = ConstantRendering.getRendering(HTML_RENDERING);
+                _xhtmlConstants = ConstantRendering.getRendering(XHTML_RENDERING);
+            }
+
+            // the default is docProducer 4.0
+            int renderingType = TagRenderingBase.getDefaultDocType();
+            if (docProducer != null) {
+                renderingType = docProducer.getTargetDocumentType();
+            }
+            return (renderingType == XHTML_RENDERING) ? _xhtmlConstants : _htmlConstants;
+        }
+    }
+
+    /**
+     * @return String
+     */
+    public static String getAmp()
+    {
+        TagContext tagCtxt = ContextUtils.getTagContext();
+        IDocumentTypeProducer docProducer = tagCtxt.getDocTypeProducer();
+
+        // the default is docProducer 4.0
+        int renderingType = HTML_RENDERING;
+        if (docProducer != null) {
+            renderingType = docProducer.getTargetDocumentType();
+        }
+
+        // pick the map of renderers
+        return (renderingType == XHTML_RENDERING) ? "&amp;" : "&";
+    }
+}

Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TagRenderingBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TdTag.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TdTag.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TdTag.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TdTag.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.simpletags.rendering;
+
+import org.apache.beehive.netui.simpletags.html.HtmlConstants;
+import org.apache.beehive.netui.simpletags.appender.Appender;
+
+import java.util.HashMap;
+
+/**
+ * Body, Start Tag: optional, End tag: optional
+ * Required href
+ */
+public abstract class TdTag extends TagHtmlBase
+{
+    public static void add(HashMap html, HashMap htmlQuirks, HashMap xhtml)
+    {
+        html.put(TD_TAG, new Rendering());
+        htmlQuirks.put(TD_TAG, new Rendering());
+        xhtml.put(TD_TAG, new Rendering());
+    }
+
+    public static class State extends AbstractHtmlState
+    {
+        public void clear()
+        {
+            super.clear();
+        }
+    }
+
+    private static class Rendering extends TdTag implements HtmlConstants
+    {
+        public void doStartTag(Appender sb, AbstractTagState renderState)
+        {
+            assert(sb != null) : "Parameter 'sb' must not be null";
+            assert(renderState != null) : "Parameter 'renderState' must not be null";
+            assert(renderState instanceof State) : "Paramater 'renderState' must be an instance of TdTag.State";
+
+            State state = (State) renderState;
+
+            renderTag(sb, TD);
+
+            renderAttribute(sb, ID, state.id);
+            renderAttribute(sb, CLASS, state.styleClass);
+
+            renderAttributes(AbstractHtmlState.ATTR_GENERAL, sb, state);
+            renderAttribute(sb, STYLE, state.style);
+            renderAttributes(AbstractHtmlState.ATTR_JAVASCRIPT, sb, state);
+            sb.append(">");
+        }
+
+        public void doEndTag(Appender sb)
+        {
+            renderEndTag(sb, TD);
+        }
+    }
+}

Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TdTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TextAreaTag.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TextAreaTag.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TextAreaTag.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TextAreaTag.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.simpletags.rendering;
+
+import org.apache.beehive.netui.simpletags.html.HtmlConstants;
+import org.apache.beehive.netui.simpletags.appender.Appender;
+
+import java.util.HashMap;
+
+/**
+ * Body, Start Tag: optional, End tag: optional
+ * Required href
+ */
+public abstract class TextAreaTag extends TagHtmlBase implements HtmlConstants
+{
+    public static void add(HashMap html, HashMap htmlQuirks, HashMap xhtml)
+    {
+        html.put(TEXT_AREA_TAG, new HtmlRendering());
+        htmlQuirks.put(TEXT_AREA_TAG, new HtmlRendering());
+        xhtml.put(TEXT_AREA_TAG, new XhtmlRendering());
+    }
+
+    public static class State extends AbstractHtmlControlState
+    {
+        public int rows;
+        public int cols;
+        public boolean readonly;
+        public boolean disabled;
+
+        public void clear()
+        {
+            super.clear();
+            rows = 0;
+            cols = 0;
+            readonly = false;
+            disabled = false;
+        }
+    }
+
+    public void doStartTag(Appender sb, AbstractTagState renderState)
+    {
+        assert(sb != null) : "Parameter 'sb' must not be null";
+        assert(renderState != null) : "Parameter 'renderState' must not be null";
+        assert(renderState instanceof State) : "Paramater 'renderState' must be an instance of TextAreaTag.State";
+
+        State state = (State) renderState;
+
+        renderTag(sb, TEXTAREA);
+        renderAttribute(sb, NAME, state.name);
+        renderAttribute(sb, ID, state.id);
+        renderAttribute(sb, CLASS, state.styleClass);
+
+        renderReadonly(sb, state.readonly);
+        renderDisabled(sb, state.disabled);
+
+        if (state.rows > 0)
+            renderAttribute(sb, ROWS, Integer.toString(state.rows));
+        if (state.cols > 0)
+            renderAttribute(sb, COLS, Integer.toString(state.cols));
+
+        renderAttributes(AbstractHtmlState.ATTR_GENERAL, sb, state);
+        renderAttribute(sb, STYLE, state.style);
+        renderAttributes(AbstractHtmlState.ATTR_JAVASCRIPT, sb, state);
+        sb.append(">");
+    }
+
+    public void doEndTag(Appender sb)
+    {
+        renderEndTag(sb, TEXTAREA);
+    }
+
+    abstract protected void renderDisabled(Appender sb, boolean disabled);
+
+    abstract protected void renderReadonly(Appender sb, boolean readonly);
+
+    private static class HtmlRendering extends TextAreaTag
+    {
+        protected void renderDisabled(Appender sb, boolean disabled)
+        {
+            if (disabled)
+                sb.append(" disabled");
+        }
+
+        protected void renderReadonly(Appender sb, boolean readonly)
+        {
+            if (readonly)
+                sb.append(" readonly");
+        }
+    }
+
+    private static class XhtmlRendering extends TextAreaTag
+    {
+        protected void renderDisabled(Appender sb, boolean disabled)
+        {
+            if (disabled)
+                renderAttribute(sb, "disabled", "disabled");
+        }
+
+        protected void renderReadonly(Appender sb, boolean readonly)
+        {
+            if (readonly)
+                renderAttribute(sb, "readonly", "readonly");
+        }
+    }
+}
+

Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TextAreaTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/ThTag.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/ThTag.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/ThTag.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/ThTag.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.simpletags.rendering;
+
+import org.apache.beehive.netui.simpletags.html.HtmlConstants;
+import org.apache.beehive.netui.simpletags.appender.Appender;
+
+import java.util.HashMap;
+
+/**
+ * Body, Start Tag: optional, End tag: optional
+ * Required href
+ */
+public abstract class ThTag
+        extends TagHtmlBase
+{
+    public static void add(HashMap html, HashMap htmlQuirks, HashMap xhtml)
+    {
+        html.put(TH_TAG, new Rendering());
+        htmlQuirks.put(TH_TAG, new Rendering());
+        xhtml.put(TH_TAG, new Rendering());
+    }
+
+    public static class State
+            extends AbstractHtmlState
+    {
+        public void clear()
+        {
+            super.clear();
+        }
+    }
+
+    private static class Rendering
+            extends ThTag
+            implements HtmlConstants
+    {
+        public void doStartTag(Appender sb, AbstractTagState renderState)
+        {
+            assert(sb != null) : "Parameter 'sb' must not be null";
+            assert(renderState != null) : "Parameter 'renderState' must not be null";
+            assert(renderState instanceof State) : "Paramater 'renderState' must be an instance of ThTag.State";
+
+            State state = (State) renderState;
+
+            renderTag(sb, TH);
+
+            renderAttribute(sb, ID, state.id);
+            renderAttribute(sb, CLASS, state.styleClass);
+
+            renderAttributes(AbstractHtmlState.ATTR_GENERAL, sb, state);
+            renderAttribute(sb, STYLE, state.style);
+            renderAttributes(AbstractHtmlState.ATTR_JAVASCRIPT, sb, state);
+
+            sb.append(">");
+        }
+
+        public void doEndTag(Appender sb)
+        {
+            renderEndTag(sb, TH);
+        }
+    }
+}
+

Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/ThTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TrTag.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TrTag.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TrTag.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TrTag.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.simpletags.rendering;
+
+import org.apache.beehive.netui.simpletags.html.HtmlConstants;
+import org.apache.beehive.netui.simpletags.appender.Appender;
+
+import java.util.HashMap;
+
+/**
+ * Body, Start Tag: optional, End tag: optional
+ * Required href
+ */
+public abstract class TrTag extends TagHtmlBase
+{
+    public static void add(HashMap html, HashMap htmlQuirks, HashMap xhtml)
+    {
+        html.put(TR_TAG, new Rendering());
+        htmlQuirks.put(TR_TAG, new Rendering());
+        xhtml.put(TR_TAG, new Rendering());
+    }
+
+    public static class State extends AbstractHtmlState
+    {
+        public void clear()
+        {
+            super.clear();
+        }
+    }
+
+    private static class Rendering extends TrTag implements HtmlConstants
+    {
+        public void doStartTag(Appender sb, AbstractTagState renderState)
+        {
+            assert(sb != null) : "Parameter 'sb' must not be null";
+            assert(renderState != null) : "Parameter 'renderState' must not be null";
+            assert(renderState instanceof State) : "Paramater 'renderState' must be an instance of TdTag.State";
+
+            State state = (State) renderState;
+
+            renderTag(sb, TR);
+
+            renderAttribute(sb, ID, state.id);
+            renderAttribute(sb, CLASS, state.styleClass);
+
+            renderAttributes(AbstractHtmlState.ATTR_GENERAL, sb, state);
+            renderAttribute(sb, STYLE, state.style);
+            renderAttributes(AbstractHtmlState.ATTR_JAVASCRIPT, sb, state);
+            sb.append(">");
+        }
+
+        public void doEndTag(Appender sb)
+        {
+            renderEndTag(sb, TR);
+        }
+    }
+}
+

Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TrTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/ContextUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/ContextUtils.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/ContextUtils.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/ContextUtils.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,23 @@
+package org.apache.beehive.netui.simpletags.util;
+
+import org.apache.beehive.netui.simpletags.core.TagContext;
+import org.apache.beehive.netui.pageflow.PageFlowContext;
+
+public class ContextUtils
+{
+    private final static String TAG_CONTEXT_NAME = "netui.velocity.tags";
+    public static PageFlowContext getPageFlowContext()
+    {
+        PageFlowContext pfCtxt = PageFlowContext.getContext();
+        assert(pfCtxt != null) : "the PageFlowContext returned as null";
+        return pfCtxt;
+    }
+
+    public static TagContext getTagContext()
+    {
+        PageFlowContext pfCtxt = getPageFlowContext();
+        TagContext tagCtxt = (TagContext) pfCtxt.get(TAG_CONTEXT_NAME,TagContext.ACTIVATOR);
+        assert(tagCtxt != null) : "the TagContext returned as null";
+        return tagCtxt;
+    }
+}

Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/ContextUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/PageFlowAdaptor.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/PageFlowAdaptor.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/PageFlowAdaptor.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/PageFlowAdaptor.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,51 @@
+package org.apache.beehive.netui.simpletags.util;
+
+import org.apache.beehive.netui.pageflow.PageFlowContext;
+import org.apache.beehive.netui.pageflow.internal.InternalUtils;
+import org.apache.struts.Globals;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.Locale;
+
+public class PageFlowAdaptor
+{
+    /**
+     * Return the current Locale for this request, creating a new one if
+     * necessary.  If there is no current Locale, and locale support is not
+     * requested, return <code>null</code>.
+     */
+    public static Locale currentLocale(boolean setLocale)
+    {
+        PageFlowContext pfCtxt = ContextUtils.getPageFlowContext();
+        HttpServletRequest req = pfCtxt.getRequest();
+
+        // Create a new session if necessary (setLocale = true) will create the session
+        HttpSession session = req.getSession(setLocale);
+        if (session == null)
+            return null;
+
+        assert(session != null) : "Session is null";
+
+        // Return any currently set Locale in our session
+        Locale current = (Locale) session.getAttribute(Globals.LOCALE_KEY);
+        if (current != null || !setLocale)
+            return current;
+
+        // get the local from the request and set it in the session
+        current = req.getLocale();
+        if (current != null)
+            session.setAttribute(Globals.LOCALE_KEY, current);
+        return current;
+    }
+
+    /**
+     * This method will return the user local of the request.
+     * @return the Locale object to use when rendering this tag
+     */
+    public static Locale getUserLocale() {
+        PageFlowContext pfCtxt = ContextUtils.getPageFlowContext();
+        return InternalUtils.lookupLocale(pfCtxt.getRequest());
+    }
+
+}

Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/PageFlowAdaptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/PageFlowTagUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/PageFlowTagUtils.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/PageFlowTagUtils.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/PageFlowTagUtils.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,246 @@
+/*
+ * 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.simpletags.util;
+
+import org.apache.beehive.netui.pageflow.FlowController;
+import org.apache.beehive.netui.pageflow.PageFlowConstants;
+import org.apache.beehive.netui.pageflow.PageFlowContext;
+import org.apache.beehive.netui.pageflow.PageFlowUtils;
+import org.apache.beehive.netui.pageflow.config.PageFlowActionMapping;
+import org.apache.beehive.netui.pageflow.internal.InternalConstants;
+import org.apache.beehive.netui.simpletags.rendering.TagRenderingBase;
+import org.apache.struts.Globals;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.config.ActionConfig;
+import org.apache.struts.util.TokenProcessor;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.servlet.ServletContext;
+import java.net.URISyntaxException;
+import java.util.Map;
+
+/**
+ * This is a utility class for the beehive tags with routines for helping with URL rewriting.
+ *
+ * <p> Includes methods to create a fully-rewritten url based on an initial url with query
+ * parameters and an anchor (location on page), checking if it needs to be secure and
+ * rewriting. There's also a method to check if a url is an action. </p>
+ */
+public class PageFlowTagUtils
+{
+    /**
+     * Create a fully-rewritten url from an initial action url with query parameters
+     * and an anchor (location on page), checking if it needs to be secure then call
+     * the rewriter service using a type of {@link org.apache.beehive.netui.core.urls.URLType#ACTION}.
+     * @param action      the action url to rewrite.
+     * @param params      the query parameters for this url.
+     * @param location    the location (anchor or fragment) for this url.
+     * @return a uri that has been run through the URL rewriter service.
+     */
+    public static String rewriteActionURL(String action, Map params, String location)
+            throws URISyntaxException
+    {
+        PageFlowContext pfCtxt = ContextUtils.getPageFlowContext();
+        boolean forXML = TagRenderingBase.Factory.isXHTML();
+        if (action.length() > 0 && action.charAt(0) == '/')
+            action = action.substring(1);
+        return PageFlowUtils.getRewrittenActionURI(pfCtxt.getServletContext(), pfCtxt.getRequest(),
+                pfCtxt.getResponse(), action, params, location, forXML);
+    }
+
+    /**
+     * Create a fully-rewritten url from an initial href url with query parameters
+     * and an anchor (location on page), checking if it needs to be secure then call
+     * the rewriter service using a type of {@link org.apache.beehive.netui.core.urls.URLType#ACTION}.
+     * @param url         the href url to rewrite.
+     * @param params      the query parameters for this url.
+     * @param location    the location (anchor or fragment) for this url.
+     * @return a url that has been run through the URL rewriter service.
+     * @see PageFlowUtils#getRewrittenHrefURI(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest,
+     *              javax.servlet.http.HttpServletResponse, String, java.util.Map, String, boolean)
+     */
+    public static String rewriteHrefURL(String url, Map params, String location)
+            throws URISyntaxException
+    {
+        PageFlowContext pfCtxt = ContextUtils.getPageFlowContext();
+        boolean forXML = TagRenderingBase.Factory.isXHTML();
+        return PageFlowUtils.getRewrittenHrefURI(pfCtxt.getServletContext(), pfCtxt.getRequest(),
+                pfCtxt.getResponse(), url, params, location, forXML);
+    }
+
+    /**
+     * Create a fully-rewritten url from an initial resource url with query parameters
+     * and an anchor (location on page), checking if it needs to be secure then call
+     * the rewriter service using a type of {@link org.apache.beehive.netui.core.urls.URLType#RESOURCE}.
+     * @param url         the resource url to rewrite.
+     * @param params      the query parameters for this url.
+     * @param location    the location (anchor or fragment) for this url.
+     * @return a url that has been run through the URL rewriter service.
+     * @see PageFlowUtils#getRewrittenResourceURI(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest,
+     *              javax.servlet.http.HttpServletResponse, String, java.util.Map, String, boolean)
+     */
+    public static String rewriteResourceURL(String url, Map params, String location)
+            throws URISyntaxException
+    {
+        PageFlowContext pfCtxt = ContextUtils.getPageFlowContext();
+        boolean forXML = TagRenderingBase.Factory.isXHTML();
+        return PageFlowUtils.getRewrittenResourceURI(pfCtxt.getServletContext(), pfCtxt.getRequest(),
+                pfCtxt.getResponse(), url, params, location, forXML);
+    }
+
+    /**
+     * Determine whether a given URI is an Action.
+     * @param action  the URI to check.
+     * @return <code>true</code> if the action is defined in the current page flow
+     *         or in a shared flow. Otherwise, return <code>false</code>.
+     */
+    public static boolean isAction(String action)
+    {
+        PageFlowContext pfCtxt = ContextUtils.getPageFlowContext();
+        HttpServletRequest request = pfCtxt.getRequest();
+        ServletContext servletCtxt = pfCtxt.getServletContext();
+        FlowController flowController = PageFlowUtils.getCurrentPageFlow(request,servletCtxt);
+
+        if (flowController != null) {
+            if (action.endsWith(PageFlowConstants.ACTION_EXTENSION)) {
+                action = action.substring(0, action.length() - PageFlowConstants.ACTION_EXTENSION.length());
+            }
+
+            if (getActionMapping(flowController, action) != null)
+                return true;
+            FlowController globalApp = PageFlowUtils.getSharedFlow(InternalConstants.GLOBALAPP_CLASSNAME, request, servletCtxt);
+            return getActionMapping(globalApp, action) != null;
+        }
+
+        return true;
+    }
+
+    /**
+     * Get or generate a token used to prevent double submits to an action.  The token is stored in the session,
+     * and checked (and removed) when processing an action with the <code>preventDoubleSubmit</code> attribute
+     * set to <code>true</code>.
+     */
+    public static String getToken(String action)
+    {
+        PageFlowContext pfCtxt = ContextUtils.getPageFlowContext();
+        FlowController flowController = PageFlowUtils.getCurrentPageFlow(pfCtxt.getRequest(),pfCtxt.getServletContext());
+
+        if (flowController != null) {
+            MappingAndController mac = getActionMapping(flowController, action);
+            if (mac != null)
+                return getToken(mac.mapping);
+        }
+
+        return null;
+    }
+
+    /**
+     * Get or generate a token used to prevent double submits to an action.  The token is stored in the session,
+     * and checked (and removed) when processing an action with the <code>preventDoubleSubmit</code> attribute
+     * set to <code>true</code>.
+     */
+    public static String getToken(ActionMapping mapping)
+    {
+        if (mapping instanceof PageFlowActionMapping && ((PageFlowActionMapping) mapping).isPreventDoubleSubmit()) {
+            PageFlowContext pfCtxt = ContextUtils.getPageFlowContext();
+            HttpServletRequest request = pfCtxt.getRequest();
+            HttpSession session = request.getSession();
+            String token = (String) session.getAttribute(Globals.TRANSACTION_TOKEN_KEY);
+            if (token != null)
+                return token;
+            token = TokenProcessor.getInstance().generateToken(request);
+            session.setAttribute(Globals.TRANSACTION_TOKEN_KEY, token);
+            return token;
+        }
+
+        return null;
+    }
+
+    public static class MappingAndController
+    {
+        public ActionMapping mapping;
+        public FlowController controller;
+    }
+
+    public static MappingAndController getActionMapping(FlowController flowController, String action)
+    {
+        ActionConfig mapping = null;
+        FlowController fc = null;
+
+        if (flowController != null) {
+            //
+            // If there's a '.' delimiter, it's a shared flow action.
+            //
+            int dot = action.indexOf('.');
+            PageFlowContext pfCtxt = ContextUtils.getPageFlowContext();
+            HttpServletRequest request = pfCtxt.getRequest();
+            ServletContext servletCtxt = pfCtxt.getServletContext();
+
+            if (dot == -1) {
+                //
+                // It's an action in the current page flow, or in the (deprecated) Global.app.
+                //
+                if (action.charAt(0) != '/') action = '/' + action;
+                mapping = flowController.getModuleConfig().findActionConfig(action);
+                fc = flowController;
+                
+                //
+                // If we don't find it in the current page flow, look in Global.app.
+                //
+                if (mapping == null) {
+                    FlowController globalApp =
+                            PageFlowUtils.getSharedFlow(InternalConstants.GLOBALAPP_CLASSNAME, request,servletCtxt);
+                    if (globalApp != null) {
+                        mapping = globalApp.getModuleConfig().findActionConfig(action);
+                        fc = globalApp;
+                    }
+                }
+            }
+            else if (dot < action.length() - 1) {
+                //
+                // It's an action in a shared flow.
+                //
+                String sharedFlowName = action.substring(0, dot);
+                if (sharedFlowName.length() > 0 && sharedFlowName.charAt(0) == '/') {
+                    sharedFlowName = sharedFlowName.substring(1);
+                }
+
+                FlowController sharedFlow = (FlowController) PageFlowUtils.getSharedFlows(request).get(sharedFlowName);
+
+                if (sharedFlow != null) {
+                    String actionPath = '/' + action.substring(dot + 1);
+                    mapping = sharedFlow.getModuleConfig().findActionConfig(actionPath);
+                    fc = sharedFlow;
+                }
+            }
+        }
+
+        assert (mapping == null || mapping instanceof ActionMapping) : "Mapping not instance of ActionMapping:" +
+                mapping.getClass().getName();
+
+        if (mapping != null) {
+            MappingAndController mac = new MappingAndController();
+            mac.mapping = (ActionMapping) mapping;
+            mac.controller = fc;
+            return mac;
+        }
+
+        return null;
+    }
+}

Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/PageFlowTagUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/RequestUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/RequestUtils.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/RequestUtils.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/RequestUtils.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2005 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.simpletags.util;
+
+import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
+import org.apache.beehive.netui.pageflow.scoping.ScopedRequest;
+import org.apache.beehive.netui.pageflow.PageFlowContext;
+import org.apache.beehive.netui.pageflow.internal.InternalUtils;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Locale;
+
+/**
+ * This class contains utility methods that deal with requests.  The primary features
+ * are the ability to set/get attributes on the outer request (or real request).
+ */
+public class RequestUtils
+{
+    /**
+     * @param name
+     * @param value
+     */
+    public static void setOuterAttribute(String name, Object value)
+    {
+        HttpServletRequest req = PageFlowContext.getContext().getRequest();
+        ServletRequest realReq = ScopedServletUtils.getOuterRequest(req);
+        realReq.setAttribute(name, value);
+    }
+
+    /**
+     * @param name
+     * @return Object
+     */
+    public static Object getOuterAttribute(String name)
+    {
+        HttpServletRequest req = PageFlowContext.getContext().getRequest();
+        ServletRequest realReq = ScopedServletUtils.getOuterRequest(req);
+        return realReq.getAttribute(name);
+    }
+
+    /**
+     * Return a Scoped Request
+     * @return Return the <code>ScopedRequest</code>
+     */
+    public static ScopedRequest getScopedRequest()
+    {
+        HttpServletRequest req = PageFlowContext.getContext().getRequest();
+        return ScopedServletUtils.unwrapRequest(req);
+    }
+
+    /**
+     * This method will return the user local of the request.
+     * @return the Locale object to use when rendering this tag
+     */
+    public static Locale getUserLocale() {
+        HttpServletRequest req = PageFlowContext.getContext().getRequest();
+        return InternalUtils.lookupLocale(req);
+    }
+
+    /**
+     * This method will look for the <code>ScopeKey</code> value from the <code>ScopedRequest</code>.
+     * If it's found it will be returned, otherwise <code>null</code> is returned.
+     * @return The ScopeKey value or null
+     */
+    public static String getScopeKey() 
+    {
+        HttpServletRequest req = PageFlowContext.getContext().getRequest();
+        ScopedRequest scopedRequest = ScopedServletUtils.unwrapRequest(req);
+        if (scopedRequest != null) {
+            return scopedRequest.getScopeKey().toString();
+        }
+        return null;
+    }
+}

Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/RequestUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native