Esempio n. 1
0
        public static string ToOrderString(this IActionSpecImmutable spec)
        {
            if (spec == null)
            {
                return("");
            }

            var facet  = spec.GetFacet <IActionInvocationFacet>();
            var suffix = "";

            if (facet != null)
            {
                suffix = facet.OrderString();
            }

            return($"{spec.ToIdString()}/{suffix}");
        }
        private void AddContributedAction(IActionSpecImmutable ca, IObjectSpecImmutable spec)
        {
            var    facet       = ca.GetFacet <IContributedActionFacet>();
            string subMenuName = facet.SubMenuWhenContributedTo(spec);

            if (subMenuName != null)
            {
                string   id      = facet.IdWhenContributedTo(spec);
                MenuImpl subMenu = GetSubMenuIfExists(subMenuName) ?? CreateMenuImmutableAsSubMenu(subMenuName, id);
                subMenu.AddOrderableElementsToMenu(new List <IActionSpecImmutable> {
                    ca
                }, subMenu);
            }
            else
            {
                //i.e. no sub-menu
                AddMenuItem(new MenuAction(ca));
            }
        }
Esempio n. 3
0
 public override IFacet GetFacet(Type type)
 {
     return(actionSpecImmutable.GetFacet(type));
 }
Esempio n. 4
0
        private bool IsContributedFunction(IActionSpecImmutable sa, ITypeSpecImmutable ts)
        {
            var f = sa.GetFacet <IContributedFunctionFacet>();

            return(f != null && f.IsContributedTo(ts));
        }
 private void AddContributedAction(IActionSpecImmutable ca, IObjectSpecImmutable spec) {
     var facet = ca.GetFacet<IContributedActionFacet>();
     string subMenuName = facet.SubMenuWhenContributedTo(spec);
     if (subMenuName != null) {
         string id = facet.IdWhenContributedTo(spec);
         MenuImpl subMenu = GetSubMenuIfExists(subMenuName) ?? CreateMenuImmutableAsSubMenu(subMenuName, id);
         subMenu.AddOrderableElementsToMenu(new List<IActionSpecImmutable> {ca}, subMenu);
     }
     else {
         //i.e. no sub-menu
         AddMenuItem(new MenuAction(ca));
     }
 }
 private static bool IsContributedFunction(IActionSpecImmutable sa, ITypeSpecImmutable ts) => sa.GetFacet <IContributedFunctionFacet>()?.IsContributedTo(ts) == true;