/// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.ConditionalClearPendingBreak"]/*' />
 protected virtual void ConditionalClearPendingBreak(XhtmlMobileTextWriter writer)
 {
     if ((String)Device[XhtmlConstants.BreaksOnInlineElements] == "true")
     {
         writer.ClearPendingBreak();
     }
 }
 /// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.ClearPendingBreakIfDeviceBreaksOnBlockLevel"]/*' />
 protected virtual void ClearPendingBreakIfDeviceBreaksOnBlockLevel(XhtmlMobileTextWriter writer)
 {
     if ((String)Device[XhtmlConstants.BreaksOnBlockElements] != "false")
     {
         writer.ClearPendingBreak();
     }
 }
        // Render the details view
        /// <include file='doc\XhtmlBasicObjectListAdapter.uex' path='docs/doc[@for="XhtmlObjectListAdapter.RenderItemDetails"]/*' />
        protected virtual void RenderItemDetails(XhtmlMobileTextWriter writer, ObjectListItem item) {
            if (Control.AllFields.Count == 0) {
                return;
            }
            if (!Device.Tables) {
                RenderItemDetailsWithoutTableTags(writer, item);
                return;
            }


            Style labelStyle = Control.LabelStyle;
            Style subCommandStyle = Control.CommandStyle;
            Style subCommandStyleNoItalic = (Style)subCommandStyle.Clone();
            subCommandStyleNoItalic.Font.Italic = BooleanOption.False;

            writer.ClearPendingBreak(); // we are writing a block level element in all cases.
            ConditionalEnterLayout(writer, Style);
            writer.WriteBeginTag ("table");
            ConditionalRenderClassAttribute(writer);
            writer.Write(">");
            writer.Write("<tr><td colspan=\"2\">");
            ConditionalEnterStyle(writer, labelStyle);
            writer.WriteEncodedText (item[Control.LabelFieldIndex]);
            ConditionalExitStyle(writer, labelStyle);
            writer.WriteLine("</td></tr>");
            Color foreColor = (Color)Style[Style.ForeColorKey, true];
            RenderRule (writer, foreColor, 2);
            RenderItemFieldsInDetailsView (writer, item);
            RenderRule (writer, foreColor, 2);
            ConditionalPopPhysicalCssClass(writer);
            writer.WriteEndTag("table");
            ConditionalExitLayout(writer, Style);

            ConditionalEnterStyle(writer, subCommandStyleNoItalic);
            writer.Write("[&nbsp;");

            ObjectListCommandCollection commands = Control.Commands;
            String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
            String subCommandClass = GetCustomAttributeValue(XhtmlConstants.CssCommandClassCustomAttribute);
            if (subCommandClass == null || subCommandClass.Length == 0) {
                subCommandClass = cssClass;
            }

            foreach (ObjectListCommand command in commands) {
                RenderPostBackEventAsAnchor(writer, command.Name, command.Text, null /* accessKey */, subCommandStyle, subCommandClass);
                writer.Write("&nbsp;|&nbsp;");
            }
            String controlBCT = Control.BackCommandText;
            String backCommandText = (controlBCT == null || controlBCT.Length == 0) ?
                GetDefaultLabel(BackLabel) :
                controlBCT;

            RenderPostBackEventAsAnchor(writer, BackToList, backCommandText, null /* accessKey */, subCommandStyle, subCommandClass);
            writer.Write("&nbsp;]");
            ConditionalExitStyle(writer, subCommandStyleNoItalic);
        }
 /// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.ConditionalClearPendingBreak"]/*' />
 protected virtual void ConditionalClearPendingBreak(XhtmlMobileTextWriter writer) {
     if ((String)Device[XhtmlConstants.BreaksOnInlineElements] == "true") {
         writer.ClearPendingBreak();
     }
 }
 /// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.ClearPendingBreakIfDeviceBreaksOnBlockLevel"]/*' />
 protected virtual void ClearPendingBreakIfDeviceBreaksOnBlockLevel(XhtmlMobileTextWriter writer) {
     if ((String)Device[XhtmlConstants.BreaksOnBlockElements] != "false") {
         writer.ClearPendingBreak();
     }
 }
        /// <include file='doc\XhtmlBasicPageAdapter.uex' path='docs/doc[@for="XhtmlPageAdapter.Render"]/*' />
        public override void Render (XhtmlMobileTextWriter writer) {
            writer.BeginResponse ();
            if (Page.Request.Browser["requiresPragmaNoCacheHeader"] == "true") {
                Page.Response.AppendHeader("Pragma", "no-cache");
            }
            InitWriterState(writer);          
            writer.BeginCachedRendering ();
            // For consistency with HTML, we render the form style with body tag.
            RenderOpeningBodyElement(writer);
            // Certain WML 2.0 devices require that we write an onevent onenterforward setvar snippet.
            // We cannot know the relevant variables until after the form is rendered, so we mark this
            // position.  The setvar elements will be inserted into the cached rendering here.
            writer.MarkWmlOnEventLocation ();
            Page.ActiveForm.RenderControl(writer);
            RenderClosingBodyElement(writer);
            writer.ClearPendingBreak ();
            writer.EndCachedRendering ();

            // Note: first and third arguments are not used.
            writer.BeginFile (Page.Request.Url.ToString (), Page.Device.PreferredRenderingMime, Page.Response.Charset);
            String supportsXmlDeclaration = Device["supportsXmlDeclaration"];
            // Invariant culture not needed, included for best practices compliance.
            if (supportsXmlDeclaration == null ||
                !String.Equals(supportsXmlDeclaration, "false", StringComparison.OrdinalIgnoreCase)) {
                writer.WriteXmlDeclaration ();
            }
            writer.WriteDoctypeDeclaration(DocumentType);
            // Review: Hard coded xmlns.
            writer.WriteFullBeginTag ("html xmlns=\"http://www.w3.org/1999/xhtml\"");
            writer.WriteLine ();
            writer.WriteFullBeginTag ("head");
            writer.WriteLine ();
            writer.WriteFullBeginTag ("title");
            if (Page.ActiveForm.Title != null) {
                writer.WriteEncodedText(Page.ActiveForm.Title);
            }
            writer.WriteEndTag ("title");
            ConditionalRenderLinkElement (writer);
            ConditionalRenderStyleElement (writer);
            writer.WriteEndTag ("head");
            writer.WriteLine ();
            writer.WriteCachedMarkup (); // includes body tag.
            writer.WriteLine ();
            writer.WriteEndTag ("html");
            writer.EndFile ();
            if (!DoesDeviceRequireCssSuppression()) {
                if (CssLocation == StyleSheetLocation.ApplicationCache && !writer.IsStyleSheetEmpty()) {
                    // Recall that Page.Cache has application scope
                    Page.Cache.Insert(writer.CacheKey, writer.GetStyles (), null, DateTime.MaxValue, _cacheExpirationTime);
                }
                else if (CssLocation == StyleSheetLocation.SessionState && !writer.IsStyleSheetEmpty()) {
                    Page.Session[writer.SessionKey] = writer.GetStyles();
                }
            }

            writer.EndResponse ();
        }
        // Render the details view
        /// <include file='doc\XhtmlBasicObjectListAdapter.uex' path='docs/doc[@for="XhtmlObjectListAdapter.RenderItemDetails"]/*' />
        protected virtual void RenderItemDetails(XhtmlMobileTextWriter writer, ObjectListItem item)
        {
            if (Control.AllFields.Count == 0)
            {
                return;
            }
            if (!Device.Tables)
            {
                RenderItemDetailsWithoutTableTags(writer, item);
                return;
            }


            Style labelStyle              = Control.LabelStyle;
            Style subCommandStyle         = Control.CommandStyle;
            Style subCommandStyleNoItalic = (Style)subCommandStyle.Clone();

            subCommandStyleNoItalic.Font.Italic = BooleanOption.False;

            writer.ClearPendingBreak(); // we are writing a block level element in all cases.
            ConditionalEnterLayout(writer, Style);
            writer.WriteBeginTag("table");
            ConditionalRenderClassAttribute(writer);
            writer.Write(">");
            writer.Write("<tr><td colspan=\"2\">");
            ConditionalEnterStyle(writer, labelStyle);
            writer.WriteEncodedText(item[Control.LabelFieldIndex]);
            ConditionalExitStyle(writer, labelStyle);
            writer.WriteLine("</td></tr>");
            Color foreColor = (Color)Style[Style.ForeColorKey, true];

            RenderRule(writer, foreColor, 2);
            RenderItemFieldsInDetailsView(writer, item);
            RenderRule(writer, foreColor, 2);
            ConditionalPopPhysicalCssClass(writer);
            writer.WriteEndTag("table");
            ConditionalExitLayout(writer, Style);

            ConditionalEnterStyle(writer, subCommandStyleNoItalic);
            writer.Write("[&nbsp;");

            ObjectListCommandCollection commands = Control.Commands;
            String cssClass        = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
            String subCommandClass = GetCustomAttributeValue(XhtmlConstants.CssCommandClassCustomAttribute);

            if (subCommandClass == null || subCommandClass.Length == 0)
            {
                subCommandClass = cssClass;
            }

            foreach (ObjectListCommand command in commands)
            {
                RenderPostBackEventAsAnchor(writer, command.Name, command.Text, null /* accessKey */, subCommandStyle, subCommandClass);
                writer.Write("&nbsp;|&nbsp;");
            }
            String controlBCT      = Control.BackCommandText;
            String backCommandText = (controlBCT == null || controlBCT.Length == 0) ?
                                     GetDefaultLabel(BackLabel) :
                                     controlBCT;

            RenderPostBackEventAsAnchor(writer, BackToList, backCommandText, null /* accessKey */, subCommandStyle, subCommandClass);
            writer.Write("&nbsp;]");
            ConditionalExitStyle(writer, subCommandStyleNoItalic);
        }
        /// <include file='doc\XhtmlBasicPageAdapter.uex' path='docs/doc[@for="XhtmlPageAdapter.Render"]/*' />
        public override void Render(XhtmlMobileTextWriter writer)
        {
            writer.BeginResponse();
            if (Page.Request.Browser["requiresPragmaNoCacheHeader"] == "true")
            {
                Page.Response.AppendHeader("Pragma", "no-cache");
            }
            InitWriterState(writer);
            writer.BeginCachedRendering();
            // For consistency with HTML, we render the form style with body tag.
            RenderOpeningBodyElement(writer);
            // Certain WML 2.0 devices require that we write an onevent onenterforward setvar snippet.
            // We cannot know the relevant variables until after the form is rendered, so we mark this
            // position.  The setvar elements will be inserted into the cached rendering here.
            writer.MarkWmlOnEventLocation();
            Page.ActiveForm.RenderControl(writer);
            RenderClosingBodyElement(writer);
            writer.ClearPendingBreak();
            writer.EndCachedRendering();

            // Note: first and third arguments are not used.
            writer.BeginFile(Page.Request.Url.ToString(), Page.Device.PreferredRenderingMime, Page.Response.Charset);
            String supportsXmlDeclaration = Device["supportsXmlDeclaration"];

            // Invariant culture not needed, included for best practices compliance.
            if (supportsXmlDeclaration == null ||
                !String.Equals(supportsXmlDeclaration, "false", StringComparison.OrdinalIgnoreCase))
            {
                writer.WriteXmlDeclaration();
            }
            writer.WriteDoctypeDeclaration(DocumentType);
            // Review: Hard coded xmlns.
            writer.WriteFullBeginTag("html xmlns=\"http://www.w3.org/1999/xhtml\"");
            writer.WriteLine();
            writer.WriteFullBeginTag("head");
            writer.WriteLine();
            writer.WriteFullBeginTag("title");
            if (Page.ActiveForm.Title != null)
            {
                writer.WriteEncodedText(Page.ActiveForm.Title);
            }
            writer.WriteEndTag("title");
            ConditionalRenderLinkElement(writer);
            ConditionalRenderStyleElement(writer);
            writer.WriteEndTag("head");
            writer.WriteLine();
            writer.WriteCachedMarkup();  // includes body tag.
            writer.WriteLine();
            writer.WriteEndTag("html");
            writer.EndFile();
            if (!DoesDeviceRequireCssSuppression())
            {
                if (CssLocation == StyleSheetLocation.ApplicationCache && !writer.IsStyleSheetEmpty())
                {
                    // Recall that Page.Cache has application scope
                    Page.Cache.Insert(writer.CacheKey, writer.GetStyles(), null, DateTime.MaxValue, _cacheExpirationTime);
                }
                else if (CssLocation == StyleSheetLocation.SessionState && !writer.IsStyleSheetEmpty())
                {
                    Page.Session[writer.SessionKey] = writer.GetStyles();
                }
            }

            writer.EndResponse();
        }