/// <include file='doc\WmlObjectListAdapter.uex' path='docs/doc[@for="WmlObjectListAdapter.RenderItemDetails"]/*' /> protected virtual void RenderItemDetails(WmlMobileTextWriter writer, ObjectListItem item) { String backCommandText = Control.BackCommandText.Length == 0 ? GetDefaultLabel(BackLabel) : Control.BackCommandText; String softkeyLabel = backCommandText.Length <= Device.MaximumSoftkeyLabelLength ? backCommandText : null; Style labelStyle = Control.LabelStyle; writer.EnterStyle(labelStyle); writer.RenderText(item[Control.LabelFieldIndex], true); writer.ExitStyle(labelStyle); writer.EnterStyle(Style); IObjectListFieldCollection fields = Control.AllFields; int fieldIndex = 0; foreach (ObjectListField field in fields) { if (field.Visible) { String displayText = String.Format(CultureInfo.InvariantCulture, "{0}: {1}", field.Title, item[fieldIndex]); writer.RenderText(displayText, true); } fieldIndex++; } RenderPostBackEvent(writer, _backToList, softkeyLabel, true, backCommandText, true); writer.ExitStyle(Style); }
// Called from RenderItemDetails. (Extracted for intelligibility.) private void RenderItemFieldsInDetailsView(XhtmlMobileTextWriter writer, ObjectListItem item) { Style style = Style; IObjectListFieldCollection fields = Control.AllFields; foreach (ObjectListField field in fields) { if (field.Visible) { writer.Write("<tr><td>"); ConditionalEnterStyle(writer, Style); writer.WriteEncodedText(field.Title); ConditionalExitStyle(writer, Style); writer.Write("</td><td>"); ConditionalEnterStyle(writer, style); writer.WriteEncodedText(item [fields.IndexOf(field)]); ConditionalExitStyle(writer, style); writer.WriteLine("</td></tr>"); } } }
protected override void RenderItemDetails(WmlMobileTextWriter writer, ObjectListItem item) { string str1 = (Control.BackCommandText != String.Empty) ? Control.BackCommandText : base.GetDefaultLabel(ControlAdapter.BackLabel); string str2 = (str1.Length > base.Device.MaximumSoftkeyLabelLength) ? null : str1; Style style = Control.LabelStyle; writer.EnterStyle(style); writer.RenderText(item[Control.LabelFieldIndex], true); writer.ExitStyle(style); writer.EnterStyle(base.Style); IObjectListFieldCollection iObjectListFieldCollection = Control.AllFields; int i = 0; IEnumerator iEnumerator = iObjectListFieldCollection.GetEnumerator(); while (iEnumerator.MoveNext()) { ObjectListField objectListField = (ObjectListField)iEnumerator.Current; if (objectListField.Visible) { if (objectListField.Name == "CALL") { writer.RenderText(String.Format("{0}: {1}", objectListField.Title, WmlcheckPhonenumber(item[i])), true, false); } else if (objectListField.Name == "MAIL") { writer.RenderText(String.Format("{0}: {1}", objectListField.Title, WmlMail(item[i])), true, false); } else { writer.RenderText(String.Format("{0}: {1}", objectListField.Title, item[i]), true); } } i++; } base.RenderPostBackEvent(writer, "__back", str2, true, str1, true); writer.ExitStyle(base.Style); }
private void RenderItemDetailsWithoutTableTags(HtmlMobileTextWriter writer, ObjectListItem item) { Style style = this.Style; Style labelStyle = Control.LabelStyle; Style subCommandStyle = Control.CommandStyle; writer.EnterStyle(labelStyle); writer.WriteText(item[Control.LabelFieldIndex], true); writer.ExitStyle(labelStyle, true); IObjectListFieldCollection fields = Control.AllFields; int fieldIndex = 0; bool boldInStyle = (style.Font.Bold == BooleanOption.True) ? true : false; writer.EnterStyle(style); foreach (ObjectListField field in fields) { if (field.Visible) { if (!boldInStyle) { writer.Write("<b>"); } writer.WriteText(field.Title + ":", true); if (!boldInStyle) { writer.Write("</b>"); } writer.Write(" "); writer.WriteText(item[fieldIndex], true); writer.WriteBreak(); } fieldIndex++; } writer.ExitStyle(style); BooleanOption cachedItalic = subCommandStyle.Font.Italic; subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterStyle(subCommandStyle); writer.Write("[ "); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; writer.EnterStyle(subCommandStyle); ObjectListCommandCollection commands = Control.Commands; foreach (ObjectListCommand command in commands) { RenderPostBackEventAsAnchor(writer, command.Name, command.Text, subCommandStyle); writer.Write(" | "); } String backCommandText = Control.BackCommandText.Length == 0 ? GetDefaultLabel(BackLabel) : Control.BackCommandText; RenderPostBackEventAsAnchor(writer, BackToList, backCommandText, subCommandStyle); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterStyle(subCommandStyle); writer.Write(" ]"); writer.ExitStyle(subCommandStyle, Control.BreakAfter); subCommandStyle.Font.Italic = cachedItalic; }
private void RenderItemDetailsWithTableTags(HtmlMobileTextWriter writer, ObjectListItem item) { Style style = this.Style; Style labelStyle = Control.LabelStyle; Style subCommandStyle = Control.CommandStyle; Color foreColor = (Color)style[Style.ForeColorKey, true]; writer.Write("<table border=0 width=\"100%\">\r\n<tr><td colspan=2>"); writer.BeginStyleContext(); writer.EnterStyle(labelStyle); writer.WriteText(item[Control.LabelFieldIndex], true); writer.ExitStyle(labelStyle); writer.EndStyleContext(); writer.Write("</td></tr>\r\n<tr>"); RenderRule(writer, foreColor, 2); IObjectListFieldCollection fields = Control.AllFields; int fieldIndex = 0; foreach (ObjectListField field in fields) { if (field.Visible) { writer.Write("<tr><td>"); writer.BeginStyleContext(); writer.EnterStyle(Style); writer.WriteText(field.Title, true); writer.ExitStyle(Style); writer.EndStyleContext(); writer.Write("</td><td>"); writer.BeginStyleContext(); writer.EnterStyle(style); writer.WriteText(item[fieldIndex], true); writer.ExitStyle(style); writer.EndStyleContext(); writer.Write("</td></tr>\r\n"); } fieldIndex++; } RenderRule(writer, foreColor, 2); writer.Write("<tr><td colspan=2>"); writer.BeginStyleContext(); BooleanOption cachedItalic = subCommandStyle.Font.Italic; subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterStyle(subCommandStyle); writer.Write("[ "); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; writer.EnterStyle(subCommandStyle); ObjectListCommandCollection commands = Control.Commands; foreach (ObjectListCommand command in commands) { RenderPostBackEventAsAnchor(writer, command.Name, command.Text, subCommandStyle); writer.Write(" | "); } String backCommandText = Control.BackCommandText.Length == 0 ? GetDefaultLabel(BackLabel) : Control.BackCommandText; RenderPostBackEventAsAnchor(writer, BackToList, backCommandText, subCommandStyle); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterStyle(subCommandStyle); writer.Write(" ]"); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; writer.EndStyleContext(); writer.Write("</td></tr></table>"); }
private void RenderItemsListWithoutTableTags(HtmlMobileTextWriter writer) { int startIndex = Control.FirstVisibleItemIndex; int pageSize = Control.VisibleItemCount; ObjectListItemCollection items = Control.Items; IObjectListFieldCollection allFields = Control.AllFields; int count = allFields.Count; int nextStartIndex = startIndex + pageSize; int labelFieldIndex = Control.LabelFieldIndex; Style style = this.Style; Style labelStyle = Control.LabelStyle; writer.EnterStyle(labelStyle); writer.WriteText(Control.AllFields[labelFieldIndex].Title, true); writer.ExitStyle(labelStyle, true); bool hasDefaultCommand = HasDefaultCommand(); bool onlyHasDefaultCommand = OnlyHasDefaultCommand(); bool requiresDetailsScreen = !onlyHasDefaultCommand && HasCommands(); // if there is > 1 visible field, need a details screen for (int visibleFields = 0, i = 0; !requiresDetailsScreen && i < count; i++) { visibleFields += allFields[i].Visible ? 1 : 0; requiresDetailsScreen = requiresDetailsScreen || visibleFields > 1; } bool itemRequiresHyperlink = requiresDetailsScreen || hasDefaultCommand; bool itemRequiresMoreButton = requiresDetailsScreen && hasDefaultCommand; Style subCommandStyle = Control.CommandStyle; subCommandStyle.Alignment = style.Alignment; subCommandStyle.Wrapping = style.Wrapping; writer.EnterStyle(style); for (int i = startIndex; i < nextStartIndex; i++) { ObjectListItem item = items[i]; if (itemRequiresHyperlink) { RenderPostBackEventAsAnchor(writer, hasDefaultCommand ? item.Index.ToString(CultureInfo.InvariantCulture) : String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index), item[labelFieldIndex]); } else { writer.WriteText(item[labelFieldIndex], true); } if (itemRequiresMoreButton) { BooleanOption cachedItalic = subCommandStyle.Font.Italic; subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterFormat(subCommandStyle); writer.Write(" ["); writer.ExitFormat(subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; writer.EnterFormat(subCommandStyle); String moreText = Control.MoreText.Length == 0 ? GetDefaultLabel(MoreLabel) : Control.MoreText; writer.WriteBeginTag("a"); RenderPostBackEventAsAttribute(writer, "href", String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index)); writer.Write(">"); writer.WriteText(moreText, true); writer.WriteEndTag("a"); writer.ExitFormat(subCommandStyle); subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterFormat(subCommandStyle); writer.Write("]"); writer.ExitFormat(subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; } if (i < (nextStartIndex - 1)) { writer.WriteBreak(); } } writer.ExitStyle(style, Control.BreakAfter); }
private void RenderItemsListWithoutTableTags(XhtmlMobileTextWriter writer) { if (Control.VisibleItemCount == 0) { return; } ConditionalRenderOpeningDivElement(writer); int startIndex = Control.FirstVisibleItemIndex; int pageSize = Control.VisibleItemCount; ObjectListItemCollection items = Control.Items; IObjectListFieldCollection allFields = Control.AllFields; int count = allFields.Count; int nextStartIndex = startIndex + pageSize; int labelFieldIndex = Control.LabelFieldIndex; Style style = this.Style; Style labelStyle = Control.LabelStyle; String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute); String labelClass = GetCustomAttributeValue(XhtmlConstants.CssLabelClassCustomAttribute); if (labelClass == null || labelClass.Length == 0) { labelClass = cssClass; } ConditionalEnterStyle(writer, labelStyle); bool requiresLabelClassSpan = CssLocation == StyleSheetLocation.PhysicalFile && labelClass != null && labelClass.Length > 0; if (requiresLabelClassSpan) { writer.WriteBeginTag("span"); writer.WriteAttribute("class", labelClass, true); writer.Write(">"); } writer.Write(Control.AllFields[labelFieldIndex].Title); writer.SetPendingBreak(); if (requiresLabelClassSpan) { writer.WriteEndTag("span"); } ConditionalExitStyle(writer, labelStyle); writer.WritePendingBreak(); bool hasDefaultCommand = HasDefaultCommand(); bool onlyHasDefaultCommand = OnlyHasDefaultCommand(); bool requiresDetailsScreen = !onlyHasDefaultCommand && HasCommands(); // if there is > 1 visible field, need a details screen for (int visibleFields = 0, i = 0; !requiresDetailsScreen && i < count; i++) { visibleFields += allFields[i].Visible ? 1 : 0; requiresDetailsScreen = requiresDetailsScreen || visibleFields > 1; } bool itemRequiresHyperlink = requiresDetailsScreen || hasDefaultCommand; bool itemRequiresMoreButton = requiresDetailsScreen && hasDefaultCommand; Style subCommandStyle = Control.CommandStyle; subCommandStyle.Alignment = style.Alignment; subCommandStyle.Wrapping = style.Wrapping; ConditionalEnterStyle(writer, style); for (int i = startIndex; i < nextStartIndex; i++) { ObjectListItem item = items[i]; String accessKey = GetCustomAttributeValue(item, XhtmlConstants.AccessKeyCustomAttribute); String itemClass = GetCustomAttributeValue(item, XhtmlConstants.CssClassCustomAttribute); if (itemRequiresHyperlink) { RenderPostBackEventAsAnchor(writer, hasDefaultCommand ? item.Index.ToString(CultureInfo.InvariantCulture) : String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index), item[labelFieldIndex], accessKey, Style, cssClass); } else { bool requiresItemClassSpan = CssLocation == StyleSheetLocation.PhysicalFile && itemClass != null && itemClass.Length > 0; if (requiresItemClassSpan) { writer.WriteBeginTag("span"); writer.WriteAttribute("class", itemClass, true); writer.Write(">"); } writer.Write(item[labelFieldIndex]); if (requiresItemClassSpan) { writer.WriteEndTag("span"); } } if (itemRequiresMoreButton) { String commandClass = GetCustomAttributeValue(XhtmlConstants.CssCommandClassCustomAttribute); BooleanOption cachedItalic = subCommandStyle.Font.Italic; subCommandStyle.Font.Italic = BooleanOption.False; ConditionalEnterFormat(writer, subCommandStyle); if ((String)Device[XhtmlConstants.BreaksOnInlineElements] != "true") { writer.Write(" ["); } ConditionalExitFormat(writer, subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; ConditionalEnterFormat(writer, subCommandStyle); String controlMT = Control.MoreText; String moreText = (controlMT == null || controlMT.Length == 0) ? GetDefaultLabel(MoreLabel) : controlMT; RenderPostBackEventAsAnchor(writer, String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index), moreText, null /*accessKey*/, subCommandStyle, commandClass); ConditionalExitFormat(writer, subCommandStyle); subCommandStyle.Font.Italic = BooleanOption.False; ConditionalEnterFormat(writer, subCommandStyle); if ((String)Device[XhtmlConstants.BreaksOnInlineElements] != "true") { writer.Write("]"); } ConditionalExitFormat(writer, subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; } if (i < (nextStartIndex - 1)) { writer.WriteBreak(); } else { writer.SetPendingBreak(); } } ConditionalExitStyle(writer, style); ConditionalRenderClosingDivElement(writer); }
private void RenderItemDetailsWithoutTableTags(XhtmlMobileTextWriter writer, ObjectListItem item) { if (Control.VisibleItemCount == 0) { return; } Style style = this.Style; Style labelStyle = Control.LabelStyle; Style subCommandStyle = Control.CommandStyle; Style subCommandStyleNoItalic = (Style)subCommandStyle.Clone(); subCommandStyleNoItalic.Font.Italic = BooleanOption.False; ConditionalRenderOpeningDivElement(writer); String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute); String labelClass = GetCustomAttributeValue(XhtmlConstants.CssLabelClassCustomAttribute); if (labelClass == null || labelClass.Length == 0) { labelClass = cssClass; } ConditionalEnterStyle(writer, labelStyle); bool requiresLabelClassSpan = CssLocation == StyleSheetLocation.PhysicalFile && labelClass != null && labelClass.Length > 0; if (requiresLabelClassSpan) { writer.WriteBeginTag("span"); writer.WriteAttribute("class", labelClass, true); writer.Write(">"); } writer.Write(item[Control.LabelFieldIndex]); writer.SetPendingBreak(); if (requiresLabelClassSpan) { writer.WriteEndTag("span"); } ConditionalExitStyle(writer, labelStyle); writer.WritePendingBreak(); IObjectListFieldCollection fields = Control.AllFields; int fieldIndex = 0; ConditionalEnterStyle(writer, style); foreach (ObjectListField field in fields) { if (field.Visible) { writer.Write(field.Title + ":"); writer.Write(" "); writer.Write(item[fieldIndex]); writer.WriteBreak(); } fieldIndex++; } ConditionalExitStyle(writer, style); String commandClass = GetCustomAttributeValue(XhtmlConstants.CssCommandClassCustomAttribute); ConditionalEnterStyle(writer, subCommandStyleNoItalic); if ((String)Device[XhtmlConstants.BreaksOnInlineElements] != "true") { writer.Write("[ "); } ConditionalEnterStyle(writer, subCommandStyle); ObjectListCommandCollection commands = Control.Commands; foreach (ObjectListCommand command in commands) { RenderPostBackEventAsAnchor(writer, command.Name, command.Text); if ((String)Device[XhtmlConstants.BreaksOnInlineElements] != "true") { writer.Write(" | "); } } String controlBCT = Control.BackCommandText; String backCommandText = controlBCT == null || controlBCT.Length == 0 ? GetDefaultLabel(BackLabel) : Control.BackCommandText; RenderPostBackEventAsAnchor(writer, BackToList, backCommandText); ConditionalExitStyle(writer, subCommandStyle); if ((String)Device[XhtmlConstants.BreaksOnInlineElements] != "true") { writer.Write(" ]"); } ConditionalExitStyle(writer, subCommandStyleNoItalic); ConditionalRenderClosingDivElement(writer); }
private void RenderItemDetailsWithTableTags(HtmlMobileTextWriter writer, ObjectListItem item) { Style style1 = base.Style; Style style2 = Control.LabelStyle; Style style3 = Control.CommandStyle; Color color = (Color)style1[Style.ForeColorKey, true]; writer.Write("<table border=0 width=\"100%\">\r\n<tr><td colspan=2>"); writer.BeginStyleContext(); writer.EnterStyle(style2); writer.WriteText(item[Control.LabelFieldIndex], true); writer.ExitStyle(style2); writer.EndStyleContext(); writer.Write("</td></tr>\r\n<tr>"); RenderRule(writer, color, 2); IObjectListFieldCollection iObjectListFieldCollection = Control.AllFields; int i = 0; IEnumerator iEnumerator = iObjectListFieldCollection.GetEnumerator(); while (iEnumerator.MoveNext()) { ObjectListField objectListField = (ObjectListField)iEnumerator.Current; if (objectListField.Visible) { writer.Write("<tr><td>"); writer.BeginStyleContext(); writer.EnterStyle(base.Style); writer.WriteText(objectListField.Title, true); writer.ExitStyle(base.Style); writer.EndStyleContext(); writer.Write("</td><td>"); writer.BeginStyleContext(); writer.EnterStyle(style1); if (objectListField.Name == "CALL") { writer.WriteText(HtmlcheckPhonenumber(item[i]), false); } else if (objectListField.Name == "MAIL") { writer.WriteText(HtmlMail(item[i]), false); } else { writer.WriteText(item[i], false); } writer.ExitStyle(style1); writer.EndStyleContext(); writer.Write("</td></tr>\r\n"); } i++; } RenderRule(writer, color, 2); writer.Write("<tr><td colspan=2>"); writer.BeginStyleContext(); BooleanOption booleanOption = style3.Font.Italic; style3.Font.Italic = BooleanOption.False; writer.EnterStyle(style3); writer.Write("[ "); writer.ExitStyle(style3); style3.Font.Italic = booleanOption; writer.EnterStyle(style3); iEnumerator = Control.Commands.GetEnumerator(); while (iEnumerator.MoveNext()) { ObjectListCommand objectListCommand = (ObjectListCommand)iEnumerator.Current; RenderPostBackEventAsAnchor(writer, objectListCommand.Name, objectListCommand.Text, style3); writer.Write(" | "); } string str = (Control.BackCommandText != String.Empty) ? Control.BackCommandText : base.GetDefaultLabel(ControlAdapter.BackLabel); RenderPostBackEventAsAnchor(writer, BackToList, str, style3); writer.ExitStyle(style3); style3.Font.Italic = BooleanOption.False; writer.EnterStyle(style3); writer.Write(" ]"); writer.ExitStyle(style3); style3.Font.Italic = booleanOption; writer.EndStyleContext(); writer.Write("</td></tr></table>"); }
private void RenderItemDetailsWithoutTableTags(HtmlMobileTextWriter writer, ObjectListItem item) { Style style1 = base.Style; Style style2 = Control.LabelStyle; Style style3 = Control.CommandStyle; writer.EnterStyle(style2); writer.WriteText(item[Control.LabelFieldIndex], true); writer.ExitStyle(style2, true); IObjectListFieldCollection iObjectListFieldCollection = Control.AllFields; int i = 0; bool flag = style1.Font.Bold == BooleanOption.True; writer.EnterStyle(style1); IEnumerator iEnumerator = iObjectListFieldCollection.GetEnumerator(); while (iEnumerator.MoveNext()) { ObjectListField objectListField = (ObjectListField)iEnumerator.Current; if (objectListField.Visible) { if (!flag) { writer.Write("<b>"); } writer.WriteText(String.Concat(objectListField.Title, ":"), true); if (!flag) { writer.Write("</b>"); } writer.Write(" "); if (objectListField.Name == "CALL") { writer.WriteText(HtmlcheckPhonenumber(item[i]), true); } else if (objectListField.Name == "MAIL") { writer.WriteText(HtmlMail(item[i]), true); } else { writer.WriteText(item[i], true); } writer.WriteBreak(); } i++; } writer.ExitStyle(style1); BooleanOption booleanOption = style3.Font.Italic; style3.Font.Italic = BooleanOption.False; writer.EnterStyle(style3); writer.Write("[ "); writer.ExitStyle(style3); style3.Font.Italic = booleanOption; writer.EnterStyle(style3); iEnumerator = Control.Commands.GetEnumerator(); while (iEnumerator.MoveNext()) { ObjectListCommand objectListCommand = (ObjectListCommand)iEnumerator.Current; RenderPostBackEventAsAnchor(writer, objectListCommand.Name, objectListCommand.Text, style3); writer.Write(" | "); } string str = (Control.BackCommandText != String.Empty) ? Control.BackCommandText : base.GetDefaultLabel(ControlAdapter.BackLabel); RenderPostBackEventAsAnchor(writer, BackToList, str, style3); writer.ExitStyle(style3); style3.Font.Italic = BooleanOption.False; writer.EnterStyle(style3); writer.Write(" ]"); writer.ExitStyle(style3, Control.BreakAfter); style3.Font.Italic = booleanOption; }