protected override void RenderChildren(HtmlTextWriter writer) { HyperLink hyperLink = new HyperLink(); hyperLink.NavigateUrl = "#"; hyperLink.CssClass = "ToolBarButtonLnk"; hyperLink.Attributes.Add("onclick", "javascript:return false;"); hyperLink.Attributes.Add("role", "button"); CommandSprite commandSprite = null; if (this.imageId != CommandSprite.SpriteId.NONE || !string.IsNullOrEmpty(this.Command.CustomSpriteCss)) { commandSprite = new CommandSprite(); commandSprite.CssClass = "ToolBarImage"; if (this.imageId != CommandSprite.SpriteId.NONE) { commandSprite.ImageId = this.ImageID; } else { CommandSprite commandSprite2 = commandSprite; commandSprite2.CssClass = commandSprite2.CssClass + " " + this.Command.CustomSpriteCss; } if (string.IsNullOrEmpty(this.Command.Text)) { if (string.IsNullOrEmpty(this.ImageAltText)) { ArgumentNullException ex = new ArgumentNullException("ImageAltText must be set if Command.Text is null/empty."); ex.Data["Name"] = this.Command.Name; ex.Data["Type"] = this.Command.GetType().FullName; ex.Data["ClientId"] = this.ClientID; throw ex; } commandSprite.AlternateText = this.ImageAltText; hyperLink.ToolTip = this.ImageAltText; } hyperLink.Controls.Add(commandSprite); } else if (!base.DesignMode && string.IsNullOrEmpty(this.Command.Text) && string.IsNullOrEmpty(this.command.CustomSpriteCss)) { throw new ArgumentNullException("Text or ImageId property must be set."); } if (!string.IsNullOrEmpty(this.Command.Text) || (commandSprite != null && !string.IsNullOrEmpty(commandSprite.AlternateText))) { EncodingLabel encodingLabel = new EncodingLabel(); if (!string.IsNullOrEmpty(this.Command.Text)) { encodingLabel.Text = this.Command.Text; encodingLabel.CssClass = "ToolBarButtonSpan"; } else { encodingLabel.Text = commandSprite.AlternateText; encodingLabel.CssClass = "ToolBarButtonImageAlter"; } hyperLink.Controls.Add(encodingLabel); } this.Controls.Add(hyperLink); base.RenderChildren(writer); }
public static string GetCssClass(CommandSprite.SpriteId spriteid) { if (spriteid == CommandSprite.SpriteId.NONE) { return(string.Empty); } return(CommandSprite.GetBaseCssClass() + " " + CommandSprite.ImageStyles[(int)spriteid]); }
protected override void CreateChildControls() { base.CreateChildControls(); string text = "filter or search"; if (!string.IsNullOrEmpty(this.WatermarkText)) { text = this.WatermarkText; } this.hiddenForSRLabel = Util.CreateHiddenForSRLabel(text, this.ID); this.Controls.Add(this.hiddenForSRLabel); this.imageButtonFilter = new HyperLink(); this.imageButtonFilter.NavigateUrl = "#"; this.imageButtonFilter.Attributes.Add("onclick", "javascript:return false;"); this.imageButtonFilter.ToolTip = this.SearchButtonToolTip; this.imageButtonFilter.ID = this.ID + "_SearchButton"; CommandSprite commandSprite = new CommandSprite(); if (this.SearchButtonImageId != null) { commandSprite.ImageId = this.SearchButtonImageId.Value; } else { commandSprite.ImageId = CommandSprite.SpriteId.SearchDefault; } commandSprite.ID = this.imageButtonFilter.ID + "_ImageSearchButton"; commandSprite.AlternateText = this.SearchButtonToolTip; this.imageButtonFilter.Controls.Add(commandSprite); EncodingLabel encodingLabel = new EncodingLabel(); encodingLabel.Text = RtlUtil.SearchDefaultMock; encodingLabel.ToolTip = this.SearchButtonToolTip; encodingLabel.CssClass = "filterIndicatorImageAlter"; this.imageButtonFilter.Controls.Add(encodingLabel); this.Controls.Add(this.imageButtonFilter); this.watermarkExtender = new TextBoxWatermarkExtender(); this.watermarkExtender.TargetControlID = this.UniqueID; this.watermarkExtender.WatermarkCssClass = "TextBoxWatermark"; this.watermarkExtender.WatermarkText = this.WatermarkText; this.Controls.Add(this.watermarkExtender); if (this.enableAutoSuggestion) { this.autoCompleteExtender = new EcpAutoCompleteExtender(); this.autoCompleteExtender.TargetControlID = this.UniqueID; WebServiceMethod webServiceMethod = new WebServiceMethod(); webServiceMethod.ServiceUrl = new WebServiceReference(string.Format("{0}&workflow={1}", this.suggestionServicePath, this.SuggestionServiceWorkFlow)); webServiceMethod.ID = this.autoCompleteExtender.ID + "WebServiceMethod"; webServiceMethod.Method = this.SuggestionServiceMethod; webServiceMethod.ParameterNames = (WebServiceParameterNames)Enum.Parse(typeof(WebServiceParameterNames), "GetList"); this.autoCompleteExtender.WebServiceMethod = webServiceMethod; this.autoCompleteExtender.AutoSuggestionPropertyNames = this.autoSuggestionPropertyNames; this.autoCompleteExtender.AutoSuggestionPropertyValues = this.autoSuggestionPropertyValues; this.Controls.Add(this.autoCompleteExtender); } }
private WebControl CreateImageControl() { CommandSprite commandSprite = new CommandSprite(); commandSprite.CssClass = "MenuItemImage"; commandSprite.ImageId = this.ImageId; if (!string.IsNullOrEmpty(this.Command.ImageAltText)) { commandSprite.AlternateText = this.Command.ImageAltText; } if (commandSprite.IsRenderable) { return(commandSprite); } commandSprite.Dispose(); return(null); }
public override string ToJavaScript() { return(string.Format("new ToolBarMoveButton(\"{0}\",{1},\"{2}\",\"{3}\",{4},\"{5}\",{6},\"{7}\",{8},{9},{10},\"{11}\",\"{12}\",\"{13}\",\"{14}\",\"{15}\",\"{16}\")", new object[] { base.Command.Name, base.Command.DefaultCommand.ToJavaScript(), base.Command.ShortCut, base.Command.SelectionMode, string.IsNullOrEmpty(base.Command.OnClientClick) ? "null" : ("function($_){ return " + base.Command.OnClientClick + "($_)}"), base.Command.RefreshAction, string.IsNullOrEmpty(base.Command.Condition) ? "null" : ("function($_){ return " + base.Command.Condition + "}"), base.Command.GroupId, base.Command.HideOnDisable.ToJavaScript(), base.Command.Visible.ToJavaScript(), true.ToJavaScript(), HttpUtility.JavaScriptStringEncode(base.Command.Text), CommandSprite.GetCssClass(base.Command.ImageId), HttpUtility.JavaScriptStringEncode(base.Command.ImageAltText), HttpUtility.JavaScriptStringEncode(base.Command.Description), this.command.ControlIdToMove, this.command.MovedControlCss })); }
protected override void CreateChildControls() { base.CreateChildControls(); Table table = new Table(); TableRow tableRow = new TableRow(); Command defaultCommand = this.Command.GetDefaultCommand(); int num = (defaultCommand == null) ? 1 : 2; bool flag = this.Command.Commands.Count >= num && this.Command.Commands.ContainsVisibleCommands(); TableCell tableCell = new TableCell(); bool flag2; if (defaultCommand == null) { flag2 = flag; } else { flag2 = (defaultCommand.SelectionMode == SelectionMode.SelectionIndependent); } tableCell.CssClass = (flag2 ? "EnabledButtonPart" : "DisabledButtonPart"); this.toolBarButton = new ToolBarButton(this.Command); this.toolBarButton.CssClass = "SplitButtonButtonPart"; tableCell.Controls.Add(this.toolBarButton); tableRow.Cells.Add(tableCell); if (!this.HideArrow) { TableCell tableCell2 = new TableCell(); tableCell2.HorizontalAlign = HorizontalAlign.Center; CommandSprite commandSprite = new CommandSprite(); commandSprite.AlternateText = Strings.More; if (!flag) { tableCell2.CssClass = "SplitButtonArrow DisabledSplitArrow"; commandSprite.ImageId = CommandSprite.SpriteId.DisabledArrow; } else { tableCell2.CssClass = "SplitButtonArrow EnabledSplitArrow"; commandSprite.ImageId = CommandSprite.SpriteId.EnabledArrow; } CommandSprite commandSprite2 = commandSprite; commandSprite2.CssClass += " SplitButtonImage"; HyperLink hyperLink = new HyperLink(); hyperLink.NavigateUrl = "#"; hyperLink.CssClass = "ToolBarButtonLnk"; hyperLink.Attributes.Add("role", "button"); hyperLink.Attributes.Add("aria-haspopup", "true"); hyperLink.ToolTip = Strings.More; hyperLink.Attributes.Add("onclick", "javascript:return false;"); hyperLink.Controls.Add(commandSprite); EncodingLabel encodingLabel = new EncodingLabel(); encodingLabel.Text = "▼"; encodingLabel.CssClass = "SplitButtonImageAlter"; hyperLink.Controls.Add(encodingLabel); tableCell2.Controls.Add(hyperLink); tableRow.Cells.Add(tableCell2); } table.Rows.Add(tableRow); table.Attributes.Add("role", "presentation"); this.Controls.Add(table); this.Controls.Add(this.contextMenu); }
public override string ToJavaScript() { StringBuilder stringBuilder = new StringBuilder("new ToolBarButton("); stringBuilder.Append(string.Format("\"{0}\",{1},\"{2}\",\"{3}\",{4},\"{5}\",{6},\"{7}\",{8},{9},\"{10}\",\"{11}\",\"{12}\",\"{13}\",{14}", new object[] { this.Command.Name, this.Command.DefaultCommand.ToJavaScript(), this.Command.ShortCut, this.Command.SelectionMode, string.IsNullOrEmpty(this.Command.OnClientClick) ? "null" : ("function($_){ return " + this.Command.OnClientClick + "($_)}"), this.Command.RefreshAction, string.IsNullOrEmpty(this.Command.Condition) ? "null" : ("function($_){ return " + this.Command.Condition + "}"), this.Command.GroupId, this.Command.HideOnDisable.ToJavaScript(), this.Command.Visible.ToJavaScript(), this.Command.ConfirmDialogType, HttpUtility.JavaScriptStringEncode(this.Command.SingleSelectionConfirmMessage), HttpUtility.JavaScriptStringEncode(this.Command.SelectionConfirmMessageDetail), HttpUtility.JavaScriptStringEncode(this.Command.MultiSelectionConfirmMessage), this.Command.UseCustomConfirmDialog.ToJavaScript() })); PopupCommand popupCommand = this.Command as PopupCommand; if (popupCommand != null) { stringBuilder.Append(string.Format(",\"{0}\",{1},{2},{3},{4},{5},{6},{7},\"{8}\",\"{9}\",{10},{11},\"{12}\",\"{13}\"", new object[] { popupCommand.SelectionParameterName, popupCommand.UseDefaultWindow.ToJavaScript(), popupCommand.ShowAddressBar.ToJavaScript(), popupCommand.ShowMenuBar.ToJavaScript(), popupCommand.ShowStatusBar.ToJavaScript(), popupCommand.ShowToolBar.ToJavaScript(), popupCommand.Resizable.ToJavaScript(), popupCommand.SingleInstance.ToJavaScript(), HttpUtility.JavaScriptStringEncode(base.ResolveClientUrl(popupCommand.NavigateUrl)), popupCommand.TargetFrame, popupCommand.Position.X, popupCommand.Position.Y, popupCommand.DialogSize.Height, popupCommand.DialogSize.Width })); } else { stringBuilder.Append(",\"\",false,false,false,false,false,false,false,\"\",\"\",-1,-1,\"\",\"\""); } TaskCommand taskCommand = this.Command as TaskCommand; if (taskCommand != null) { stringBuilder.Append(string.Format(",\"{0}\",{1},\"{2}\",\"{3}\",\"{4}\"", new object[] { taskCommand.ActionName, taskCommand.IsLongRunning.ToJavaScript(), HttpUtility.JavaScriptStringEncode(taskCommand.InProgressDescription), HttpUtility.JavaScriptStringEncode(taskCommand.StoppedDescription), HttpUtility.JavaScriptStringEncode(taskCommand.CompletedDescription) })); } else { stringBuilder.Append(",\"\",false,\"\",\"\",\"\""); } stringBuilder.Append(string.Format(",{0},\"{1}\",\"{2}\",\"{3}\",\"{4}\"", new object[] { true.ToJavaScript(), HttpUtility.JavaScriptStringEncode(this.Command.Text), (!string.IsNullOrEmpty(this.command.CustomSpriteCss)) ? this.command.CustomSpriteCss : CommandSprite.GetCssClass(this.Command.ImageId), HttpUtility.JavaScriptStringEncode(this.Command.ImageAltText), HttpUtility.JavaScriptStringEncode(this.Command.Description) })); if (!string.IsNullOrEmpty(this.Command.ClientCommandHandler)) { stringBuilder.Append(string.Format(", new {0}()", this.Command.ClientCommandHandler)); } else { stringBuilder.Append(",\"\""); } stringBuilder.Append(")"); return(stringBuilder.ToString()); }