public ConnectorDisplayContext(IConnector item, string displayType, SocketDisplayContext context) : base(context.Connector)
 {
     ConnectorContent = item;
     RenderConnector  = true;
     SocketContext    = context;
     RightField       = new Lazy <SocketEndpoint>(() => new SocketEndpoint(ConnectorContent.RightContent, displayType));
 }
 protected override void Displaying(SocketDisplayContext context) {
     // TODO: Optionally expose a unified feed comprised of all applicable connector types.
     // TODO: We could feasibly want to register the feed on other display types
     if (context.Left.DisplayType == "Detail") {
         var settings = context.Connector.PartDefinition.Settings.GetModel<AggregationTypePartSettings>();
         if (settings != null && settings.ExposeFeed) {
             _feedManager.Register(context.Left.ContentItem.GetTitle() + " - " + context.SocketMetadata.SocketTitle, "rss", new RouteValueDictionary { { "id", context.Left.ContentItem.Id }, { "connector", context.Connector.Name } });
         }
     }
 }
        protected override void Preparing(SocketDisplayContext context) {

            context.ModelContext.With<DrillFilterData>(df => {
                if (context.Connector.Name == df.DrillType) {
                    context.Paradigms.Add("DrillSummary");
                    if (df.Id.HasValue) {
                        context.ModelContext.Paradigms.Add("DrillDetail");
                    }
                }
                else {
                    context.Paradigms.Add("DrillExclude");
                }
            });

        }
        protected override void Displaying(SocketDisplayContext context)
        {
            // Set a paradigm for empty sockets
            if (context.Query.TotalCount == 0)
            {
                context.Paradigms.Add("Empty");
                if (!context.Paradigms.Has("ShowEmpty")) {
                    context.RenderSocket = false;
                }
                // TODO: A pure-placement method didn't work because Displaying happens after Placement. But we don't want to execute the count for every single connector type
                // because a lot will already be decided against in advance. Either a) cache the current count on SocketsPartRecord or b) find another way, e.g. a delegate that
                // will only run if placement hasn't already been denied.
//                context.Paradigms.Add("Empty");
            }

            // Do some default display type mapping
            // TODO: Could be done in placement now?
            if (String.IsNullOrWhiteSpace(context.Connector.DisplayType))
            {
                switch (context.Left.DisplayType)
                {
                    case "Detail":
                        context.Connector.DisplayType = "Summary";
                        break;
                    case "Summary":
                        context.Connector.DisplayType = "SummaryTiny";
                        context.Paradigms.Add("ConnectorsFlatten");
                        break;
                    case "SummaryAdmin":
                        context.Connector.DisplayType = "Link";
                        context.Paradigms.Add("ConnectorsFlatten");
                        break;
                    case "SummaryTiny":
                        // Prevent further recursion by default
                        context.RenderSocket = false;
                        break;
                    case "Link":
                        // Prevent further recursion by default
                        context.RenderSocket = false;
                        break;
                    default:
                        // Any other situtations we don't understand, just use links.
                        context.Connector.DisplayType = "Link";
                        break;
                }
            }
        }
        protected override void Preparing(SocketDisplayContext context)
        {
            if (context.Left.DisplayType == "Detail")
            {
                var clipPart = context.Connector.Definition.Parts.FirstOrDefault(p => p.PartDefinition.Name == "PaperclipPart");
                if (clipPart != null)
                {
                    // Get actual part model from item
                    var settings = clipPart.Settings.GetModel<PaperclipTypePartSettings>();
                    if (!String.IsNullOrWhiteSpace(settings.DefaultPlacement))
                    {
                        context.LayoutPlacement = settings.DefaultPlacement;
                    }

                    if (!String.IsNullOrWhiteSpace(settings.DefaultDisplayType))
                    {
                        context.Connector.DisplayType = settings.DefaultDisplayType;
                    }

                }
            }
        }
        protected override void Displaying(SocketDisplayContext context)
        {
            if (context.RootModel.DisplayType == "Detail")
            {
                switch (context.Connector.Name)
                {
                    case "CountryToTown":
                        context.Left.DisplayType = context.Connector.DisplayType = "Directory";
                        // TODO: In migration add to settings
                        context.Paradigms.Add("Count");
                        break;
                    case "TownToAddress":
                        context.Left.DisplayType = context.Connector.DisplayType = "Listing";
                        // TODO: In migration add to settings
                        context.Paradigms.Add("Collapse");
                        break;
                }
            }

            // From DirectoryController, we get a bunch of Address items in Summary mode
            if (context.RootModel.DisplayType == "Summary")
            {
                switch (context.Connector.Name)
                {
                    case "AddressToUser":
                        context.Left.DisplayType = context.Connector.DisplayType = "Listing";
                        break;
                    case "AddressToTown":
                        context.Left.DisplayType = context.Connector.DisplayType = "Listing";
                        break;
                }
            }

            if (context.RootModel.DisplayType == "Listing")
            {
                // ...
            }
        }
Exemple #7
0
 void ISocketHandler.Updated(SocketDisplayContext context)
 {
     Updated(context);
 }
Exemple #8
0
 void ISocketHandler.Editor(SocketDisplayContext context)
 {
     Editor(context);
 }
Exemple #9
0
 void ISocketHandler.Displaying(SocketDisplayContext context)
 {
     Displaying(context);
 }
Exemple #10
0
 void ISocketHandler.Preparing(SocketDisplayContext context)
 {
     Preparing(context);
 }
Exemple #11
0
 protected virtual void Updated(SocketDisplayContext context) { }
Exemple #12
0
 protected virtual void Preparing(SocketDisplayContext context)
 {
 }
Exemple #13
0
 protected virtual void Updated(SocketDisplayContext context)
 {
 }
 protected override void Displaying(SocketDisplayContext context) {
  
 }
Exemple #15
0
 void ISocketHandler.Updated(SocketDisplayContext context)
 {
     Updated(context);
 }
Exemple #16
0
 void ISocketHandler.Editor(SocketDisplayContext context)
 {
     Editor(context);
 }
Exemple #17
0
 void ISocketHandler.Displaying(SocketDisplayContext context)
 {
     Displaying(context);
 }
Exemple #18
0
 void ISocketHandler.Preparing(SocketDisplayContext context)
 {
     Preparing(context);
 }
 public ConnectorDisplayContext(IConnector item, string displayType, SocketDisplayContext context) : base(context.Connector) {
     ConnectorContent = item;
     RenderConnector = true;
     SocketContext = context;
     RightField = new Lazy<SocketEndpoint>(() => new SocketEndpoint(ConnectorContent.RightContent, displayType));
 }
Exemple #20
0
 protected virtual void Displaying(SocketDisplayContext context)
 {
 }
Exemple #21
0
 protected virtual void Editor(SocketDisplayContext context)
 {
 }
 protected override void Preparing(SocketDisplayContext context) {
     if (context.ModelContext.Mode == "Display" && context.Paradigms.Has("Navigation") && context.ModelContext.DisplayType=="Navigation") {
         context.Connector.DisplayType = "Navigation";
     }
 }
Exemple #23
0
 protected virtual void Preparing(SocketDisplayContext context) { }
        protected override void Editing(SocketDisplayContext context)
        {
            context.Left.DisplayType="Editor";
            context.Connector.DisplayType = "EditorConnector";

            if (context.Query.TotalCount == 0) {
                context.Paradigms.Add("Empty");
            }
            
            // Check box list or drop down list?
            context.Paradigms.Add(context.Connector.Settings.AllowMany ? "Many" : "One");
            context.Paradigms.Add(context.Connector.Settings.AllowDuplicates ? "DuplicatesPossible" : "Unique");

            // Outright hide editor. Typically used when we have an inverse connector and we only
            // actually want to work with one end of the connector in UI.
            if (context.Paradigms.Has("Hidden")) {
                context.RenderSocket = false;
            }
        }
Exemple #25
0
 protected virtual void Displaying(SocketDisplayContext context) { }
 public SocketsDriverResult(string shapeType, string prefix, Framework.SocketDisplayContext socketContext, Func<SocketDisplayContext, ModelShapeContext, dynamic> factory)
     : base(shapeType,prefix,(c)=>factory(socketContext,c))
 {
     SocketContext = socketContext;
 }
Exemple #27
0
 protected virtual void Editor(SocketDisplayContext context) { }