/// <summary> /// Creates an action with full-post-back behavior. /// </summary> /// <param name="text">Do not pass null or the empty string.</param> /// <param name="modificationMethod">A modification method that takes a collection of selected-item IDs.</param> /// <param name="displaySetup"></param> /// <param name="icon">The icon.</param> /// <param name="confirmationDialogContent">Pass a value to open a confirmation dialog box with a button that triggers the action.</param> /// <param name="actionGetter">A method that returns the action EWF will perform if there were no modification errors.</param> public static SelectedItemAction <IdType> CreateWithFullPostBackBehavior <IdType>( string text, Action <IReadOnlyCollection <IdType> > modificationMethod, DisplaySetup displaySetup = null, ActionComponentIcon icon = null, IReadOnlyCollection <FlowComponent> confirmationDialogContent = null, Func <PostBackAction> actionGetter = null) =>
/// <summary> /// Creates a standard style object. /// </summary> /// <param name="text">Do not pass null or the empty string.</param> /// <param name="buttonSize"></param> /// <param name="icon">The icon.</param> public StandardButtonStyle(string text, ButtonSize buttonSize = ButtonSize.Normal, ActionComponentIcon icon = null) { this.buttonSize = buttonSize; this.icon = icon; this.text = text; }
IEnumerable <FlowComponentOrNode> ButtonStyle.GetChildren() { return(ActionComponentIcon.GetIconAndTextComponents(icon, text)); }
/// <summary> /// Creates a standard style object. /// </summary> /// <param name="text">Do not pass null. Pass the empty string to use the destination URL.</param> /// <param name="icon">The icon.</param> public StandardHyperlinkStyle(string text, ActionComponentIcon icon = null) { this.icon = icon; this.text = text; }
IEnumerable <FlowComponentOrNode> HyperlinkStyle.GetChildren(string destinationUrl) { return(ActionComponentIcon.GetIconAndTextComponents(icon, text.Any() ? text : destinationUrl)); }
/// <summary> /// Creates an action button with the given behavior (ActionControl). The ActionControlStyle of the given actionControl will be overwritten. /// </summary> public ActionButtonSetup(string text, ActionControl actionControl, ActionComponentIcon icon = null) { this.text = text; this.icon = icon; this.actionControl = actionControl; }
IReadOnlyCollection <FlowComponent> ButtonStyle.GetChildren() { return(ActionComponentIcon.GetIconAndTextComponents(icon, text)); }
/// <summary> /// NOTE: This method will be deleted when RSIS Goal 925 is completed. But continue using it when necessary since there is no good alternative. /// </summary> public static ActionButtonSetup CreateWithUrl(string text, ResourceInfo resourceInfo, ActionComponentIcon icon = null) { return(new ActionButtonSetup(text, new EwfLink(resourceInfo), icon: icon)); }
/// <summary> /// Creates a hyperlink setup object. /// </summary> /// <param name="behavior">The behavior. Pass a <see cref="ResourceInfo"/> to navigate to the resource in the default way, or call /// <see cref="HyperlinkBehaviorExtensionCreators.ToHyperlinkNewTabBehavior(ResourceInfo)"/> or /// <see cref="HyperlinkBehaviorExtensionCreators.ToHyperlinkModalBoxBehavior(ResourceInfo, BrowsingContextSetup)"/>. For a mailto link, call /// <see cref="HyperlinkBehaviorExtensionCreators.ToHyperlinkBehavior(Email.EmailAddress, string, string, string, string)"/>.</param> /// <param name="text">Do not pass null. Pass the empty string to use the destination URL.</param> /// <param name="displaySetup"></param> /// <param name="icon">The icon.</param> public HyperlinkSetup(HyperlinkBehavior behavior, string text, DisplaySetup displaySetup = null, ActionComponentIcon icon = null) { DisplaySetup = displaySetup; hyperlinkGetter = hyperlinkStyleSelector => behavior.UserCanNavigateToDestination() ? new EwfHyperlink(behavior, hyperlinkStyleSelector(text, icon)) : null; }
internal static IReadOnlyCollection <PhrasingComponent> GetIconAndTextComponents(ActionComponentIcon icon, string text) { // Use a container because our CSS selectors for icons include first-child and last-child and these do not take into account "text nodes", i.e. text that // is interspersed with elements. var textComponent = new GenericPhrasingContainer(text.ToComponents()); if (icon == null) { return(textComponent.ToCollection()); } if (icon.placement == ActionComponentIconPlacement.Left) { return new PhrasingComponent[] { icon.icon, textComponent } } ; if (icon.placement == ActionComponentIconPlacement.Right) { return new PhrasingComponent[] { textComponent, icon.icon } } ; throw new ApplicationException("unknown placement"); }
IReadOnlyCollection <FlowComponent> HyperlinkStyle.GetChildren(string destinationUrl) => ActionComponentIcon.GetIconAndTextComponents(icon, text.Any() ? text : destinationUrl);
/// <summary> /// Creates a button setup object. /// </summary> /// <param name="text">Do not pass null or the empty string.</param> /// <param name="displaySetup"></param> /// <param name="behavior">The behavior. Pass null to use the form default action.</param> /// <param name="icon">The icon.</param> public ButtonSetup(string text, DisplaySetup displaySetup = null, ButtonBehavior behavior = null, ActionComponentIcon icon = null) { behavior = behavior ?? new FormActionBehavior(FormState.Current.DefaultAction); DisplaySetup = displaySetup; buttonGetter = (enableSubmitButton, buttonStyleSelector) => { var postBack = !enableSubmitButton ? null : behavior is FormActionBehavior formActionBehavior ? (formActionBehavior.Action as PostBackFormAction)?.PostBack : behavior is PostBackBehavior postBackBehavior ? postBackBehavior.PostBackAction.PostBack : null; return(postBack != null ? (PhrasingComponent) new SubmitButton(buttonStyleSelector(text, icon), postBack: postBack) : new EwfButton(buttonStyleSelector(text, icon), behavior: behavior)); }; }