public override void Apply(IActionBuildingContext builder) { foreach (var formerActionId in _formerActionIds) { builder.Action.FormerActionIDs.Add(formerActionId); } }
/// <summary> /// Constructs/initializes an <see cref="DropDownButtonAction"/> via the given <see cref="IActionBuildingContext"/>. /// </summary> /// <remarks>For internal framework use only.</remarks> public override void Apply(IActionBuildingContext builder) { base.Apply(builder); ((DropDownButtonAction)builder.Action).SetMenuModelDelegate( DropDownActionAttribute.CreateGetMenuModelDelegate(builder.ActionTarget, _menuModelPropertyName)); }
public override void Apply(IActionBuildingContext builder) { if (!string.IsNullOrEmpty(FeatureToken)) { builder.Action.FeatureSpecification = new FeatureAuthorizationSpecification(FeatureToken); } }
/// <summary> /// Sets the icon set for an <see cref="IAction"/>, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { //TODO (CR Mar 2010): Observe MouseButton changing and set the iconset. XMouseButtons assignedButton = XMouseButtons.None; if (builder.ActionTarget is MouseImageViewerTool) assignedButton = ((MouseImageViewerTool) builder.ActionTarget).MouseButton; builder.Action.IconSet = new MouseButtonIconSet(this.IconSet, assignedButton); }
/// <summary> /// Applies this attribute to an <see cref="IAction"/> instance, via the specified <see cref="IActionBuildingContext"/>, /// by binding the appropriate handler method on the target object to the action. /// </summary> public override void Apply(IActionBuildingContext builder) { // check that the method exists, etc ValidateClickHandler(builder.ActionTarget, this.HandlerMethodName); ClickHandlerDelegate clickHandler = (ClickHandlerDelegate)Delegate.CreateDelegate(typeof(ClickHandlerDelegate), builder.ActionTarget, this.HandlerMethodName); ((ClickAction)builder.Action).SetClickHandler(clickHandler); }
public override void Apply(IActionBuildingContext builder) { ActionPath path = new ActionPath(_pathHint, builder.ResourceResolver); builder.Action = new ActionPlaceholder(builder.ActionID, path, builder.ResourceResolver); builder.Action.Available = _initiallyAvailable; builder.Action.Persistent = true; builder.Action.Visible = false; builder.Action.Label = path.LastSegment.LocalizedText; builder.Action.GroupHint = new GroupHint(_groupHint ?? string.Empty); }
/// <summary> /// Binds an <see cref="IAction"/> instance to the <paramref name="actionProperty"/> and /// <paramref name="actionEvent"/> on the target object, via the specified <see cref="IActionBuildingContext"/>. /// </summary> protected void Bind <T>(IActionBuildingContext builder, string actionProperty, string actionEvent) { ValidateProperty(builder.ActionTarget, this.PropertyName, typeof(T)); ValidateEvent(builder.ActionTarget, this.ChangeEventName); IObservablePropertyBinding <T> toolBinding = new DynamicObservablePropertyBinding <T>(builder.ActionTarget, this.PropertyName, this.ChangeEventName); IObservablePropertyBinding <T> actionBinding = new DynamicObservablePropertyBinding <T>(builder.Action, actionProperty, actionEvent); ObservablePropertyCoupler <T> .Couple(toolBinding, actionBinding); }
/// <summary> /// Constructs/initializes a <see cref="DropDownAction"/> via the given <see cref="IActionBuildingContext"/>. /// </summary> /// <remarks>For internal framework use only.</remarks> public override void Apply(IActionBuildingContext builder) { ActionPath path = new ActionPath(_path, builder.ResourceResolver); builder.Action = new DropDownAction(builder.ActionID, path, builder.ResourceResolver); builder.Action.Available = this.InitiallyAvailable; builder.Action.Persistent = true; builder.Action.Label = path.LastSegment.LocalizedText; ((DropDownAction)builder.Action).SetMenuModelDelegate( CreateGetMenuModelDelegate(builder.ActionTarget, _menuModelPropertyName)); }
/// <summary> /// Sets the icon set for an <see cref="IAction"/>, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { //TODO (CR Mar 2010): Observe MouseButton changing and set the iconset. XMouseButtons assignedButton = XMouseButtons.None; if (builder.ActionTarget is MouseImageViewerTool) { assignedButton = ((MouseImageViewerTool)builder.ActionTarget).MouseButton; } builder.Action.IconSet = new MouseButtonIconSet(this.IconSet, assignedButton); }
/// <summary> /// Binds an <see cref="IAction"/> instance to the <paramref name="actionProperty"/> and /// <paramref name="actionEvent"/> on the target object, via the specified <see cref="IActionBuildingContext"/>. /// </summary> protected void Bind <T>(IActionBuildingContext builder, string actionProperty, string actionEvent) { ValidateProperty(builder.ActionTarget, this.PropertyName, typeof(T)); // the change event could be null, in which case there is nothing to validate if (!string.IsNullOrEmpty(this.ChangeEventName)) { ValidateEvent(builder.ActionTarget, this.ChangeEventName); } IObservablePropertyBinding <T> toolBinding = new DynamicObservablePropertyBinding <T>(builder.ActionTarget, this.PropertyName, this.ChangeEventName); IObservablePropertyBinding <T> actionBinding = new DynamicObservablePropertyBinding <T>(builder.Action, actionProperty, actionEvent); ObservablePropertyCoupler <T> .Couple(toolBinding, actionBinding); }
/// <summary> /// Applies permissions represented by this attribute to an action instance, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { // if this is the first occurence of this attribute, create the parent spec if (builder.Action.PermissionSpecification == null) builder.Action.PermissionSpecification = new OrSpecification(); // combine the specified tokens with AND logic AndSpecification and = new AndSpecification(); foreach (string token in _authorityTokens) { and.Add(new PrincipalPermissionSpecification(token)); } // combine this spec with any previous occurence of this attribute using OR logic ((OrSpecification)builder.Action.PermissionSpecification).Add(and); }
/// <summary> /// Applies permissions represented by this attribute to an action instance, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { // if this is the first occurence of this attribute, create the parent spec if (builder.Action.PermissionSpecification == null) { builder.Action.PermissionSpecification = new OrSpecification(); } // combine the specified tokens with AND logic AndSpecification and = new AndSpecification(); foreach (string token in _authorityTokens) { and.Add(new PrincipalPermissionSpecification(token)); } // combine this spec with any previous occurence of this attribute using OR logic ((OrSpecification)builder.Action.PermissionSpecification).Add(and); }
/// <summary> /// Applies this attribute to an <see cref="IAction"/> instance, via the specified <see cref="IActionBuildingContext"/>. /// </summary> /// <remarks> /// Because this action is an <see cref="ActionInitiatorAttribute"/>, this method actually /// creates the associated <see cref="ClickAction"/>. <see cref="ActionDecoratorAttribute"/>s /// merely modify the properties of the action. /// </remarks> public override void Apply(IActionBuildingContext builder) { // assert _action == null ActionPath path = new ActionPath(this.Path, builder.ResourceResolver); builder.Action = CreateAction(builder.ActionID, path, this.Flags, builder.ResourceResolver); builder.Action.Available = this.InitiallyAvailable; builder.Action.Persistent = true; ((ClickAction)builder.Action).KeyStroke = this.KeyStroke; builder.Action.Label = path.LastSegment.LocalizedText; if (!string.IsNullOrEmpty(_clickHandler)) { // check that the method exists, etc ValidateClickHandler(builder.ActionTarget, _clickHandler); ClickHandlerDelegate clickHandler = (ClickHandlerDelegate)Delegate.CreateDelegate(typeof(ClickHandlerDelegate), builder.ActionTarget, _clickHandler); ((ClickAction)builder.Action).SetClickHandler(clickHandler); } }
/// <summary> /// Binds the <see cref="IAction.Label"/> property and <see cref="IAction.LabelChanged"/> event /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { Bind <string>(builder, "Label", "LabelChanged"); }
public override void Apply(IActionBuildingContext builder) { foreach (var formerActionId in _formerActionIds) builder.Action.FormerActionIDs.Add(formerActionId); }
/// <summary> /// Sets the <see cref="IAction"/>'s <see cref="GroupHint"/>, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { builder.Action.GroupHint = new GroupHint(_groupHint); }
/// <summary> /// Applies permissions represented by this attribute to an action instance, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { builder.Action.PermissionSpecification = new MockSpecification {Result = _result}; }
/// <summary> /// Applies this attribute to an <see cref="IAction"/> instance, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public abstract void Apply(IActionBuildingContext builder);
/// <summary> /// Sets the icon set for an <see cref="IAction"/>, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { builder.Action.IconSet = IconSet; }
/// <summary> /// Binds the <see cref="IAction.IconSet"/> property and <see cref="IAction.IconSetChanged"/> event /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { Bind<IconSet>(builder, "IconSet", "IconSetChanged"); }
/// <summary> /// Binds the <see cref="IAction.IconSet"/> property and <see cref="IAction.IconSetChanged"/> event /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { Bind <IconSet>(builder, "IconSet", "IconSetChanged"); }
public override void Apply(IActionBuildingContext builder) { builder.Action.Persistent = _persistent; }
/// <summary> /// Applies permissions represented by this attribute to an action instance, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { builder.Action.PermissionSpecification = new MockSpecification { Result = _result }; }
/// <summary> /// Binds the <see cref="IAction.Label"/> property and <see cref="IAction.LabelChanged"/> event /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { Bind<string>(builder, "Label", "LabelChanged"); }
/// <summary> /// Binds the <see cref="IAction.Tooltip"/> property and <see cref="IAction.TooltipChanged"/> event /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { Bind <string>(builder, "Tooltip", "TooltipChanged"); }
/// <summary> /// Binds the <see cref="IClickAction.Checked"/> property and <see cref="IClickAction.CheckedChanged"/> event /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { Bind<bool>(builder, "Checked", "CheckedChanged"); }
/// <summary> /// Sets the <see cref="IAction.Tooltip"/> value for and <see cref="IAction"/> instance, /// via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { // assert _action != null builder.Action.Tooltip = builder.ResourceResolver.LocalizeString(this.TooltipText); }
/// <summary> /// Binds the <see cref="IAction.Tooltip"/> property and <see cref="IAction.TooltipChanged"/> event /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { Bind<string>(builder, "Tooltip", "TooltipChanged"); }
/// <summary> /// Binds the <see cref="IAction.Enabled"/> property and <see cref="IAction.EnabledChanged"/> event /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { Bind <bool>(builder, "Enabled", "EnabledChanged"); }
/// <summary> /// Binds the <see cref="IAction.Visible"/> property and <see cref="IAction.VisibleChanged"/> event /// to the corresponding items on the target object, via the specified <see cref="IActionBuildingContext"/>. /// </summary> public override void Apply(IActionBuildingContext builder) { Bind<bool>(builder, "Visible", "VisibleChanged"); }