Пример #1
0
 /// <inheritdoc />
 public bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
 {
     wrapper = wrapperFuncs.ContainsKey(control.Editor.Alias)
         ? wrapperFuncs[control.Editor.View](control)
         : null;
     return(wrapper != null);
 }
        /// <summary>
        /// Gets an instance <see cref="GridControlWrapper"/> for the specified <paramref name="control"/>.
        /// </summary>
        /// <param name="control">The control to be wrapped.</param>
        /// <param name="wrapper">The wrapper.</param>
        public virtual bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
        {
            wrapper = null;

            switch (control.Editor.Alias)
            {
            case "media":
                wrapper = control.GetControlWrapper <GridControlMediaValue, GridEditorMediaConfig>();
                break;

            case "embed":
                wrapper = control.GetControlWrapper <GridControlEmbedValue>();
                break;

            case "rte":
                wrapper = control.GetControlWrapper <GridControlRichTextValue>();
                break;

            case "macro":
                wrapper = control.GetControlWrapper <GridControlMacroValue>();
                break;

            case "quote":
            case "headline":
                wrapper = control.GetControlWrapper <GridControlTextValue, GridEditorTextConfig>();
                break;
            }

            return(wrapper != null);
        }
Пример #3
0
        /// <summary>
        /// Gets an instance <see cref="GridControlWrapper"/> for the specified <paramref name="control"/>.
        /// </summary>
        /// <param name="control">The control to be wrapped.</param>
        /// <param name="wrapper">The wrapper.</param>
        public virtual bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
        {
            wrapper = null;

            if (IsEmbedEditor(control.Editor))
            {
                wrapper = control.GetControlWrapper <GridControlEmbedValue>();
            }
            else if (IsMacroEditor(control.Editor))
            {
                wrapper = control.GetControlWrapper <GridControlMacroValue>();
            }
            else if (IsMediaEditor(control.Editor))
            {
                wrapper = control.GetControlWrapper <GridControlMediaValue, GridEditorMediaConfig>();
            }
            else if (IsRichTextEditor(control.Editor))
            {
                wrapper = control.GetControlWrapper <GridControlRichTextValue>();
            }
            else if (IsTextStringEditor(control.Editor))
            {
                wrapper = control.GetControlWrapper <GridControlTextValue, GridEditorTextConfig>();
            }

            return(wrapper != null);
        }
Пример #4
0
 /// <summary>
 /// Gets an instance <see cref="GridControlWrapper"/> for the specified <paramref name="control"/>.
 /// </summary>
 /// <param name="control">The control to be wrapped.</param>
 /// <param name="wrapper">The wrapper.</param>
 public override bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
 {
     wrapper = null;
     if (IsDocTypeGridEditor(control.Editor))
     {
         wrapper = control.GetControlWrapper <GridControlDtgeValue>();
     }
     return(wrapper != null);
 }
Пример #5
0
 /// <summary>
 /// Gets an instance <see cref="GridControlWrapper"/> for the specified <paramref name="control"/>.
 /// </summary>
 /// <param name="control">The control to be wrapped.</param>
 /// <param name="wrapper">The wrapper.</param>
 public bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
 {
     wrapper = null;
     if (IsVideoPicker(control.Editor))
     {
         wrapper = control.GetControlWrapper <GridControlVideoPickerValue>();
     }
     return(wrapper != null);
 }
 /// <summary>
 /// Gets an instance <see cref="GridControlWrapper"/> for the specified <paramref name="control"/>.
 /// </summary>
 /// <param name="control">The control to be wrapped.</param>
 /// <param name="wrapper">The wrapper.</param>
 public override bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
 {
     wrapper = null;
     if (IsImagePickerEditor(control.Editor))
     {
         wrapper = control.GetControlWrapper <GridControlImagePickerValue, GridEditorImagePickerConfig>();
     }
     return(wrapper != null);
 }
Пример #7
0
        /// <summary>
        /// Gets an instance <see cref="GridControlWrapper" /> for the specified <paramref name="control" />.
        /// </summary>
        /// <param name="control">The control to be wrapped.</param>
        /// <param name="wrapper">The wrapper.</param>
        /// <returns></returns>
        public bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
        {
            wrapper = null;
            if (this.isLeBlenderEditor(control.Editor))
            {
                wrapper = control.GetControlWrapper <GridControlLeBlenderValue, GridEditorLeBlenderConfig>();
            }

            return(wrapper != null);
        }
        public bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
        {
            wrapper = null;

            if (control.Editor.Alias == "latestNewsEventsBlock")
            {
                wrapper = control.GetControlWrapper <GridControlLatestNewsEventsBlockValue>();
            }

            return(wrapper != null);
        }
        public bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
        {
            wrapper = null;

            if (control.Editor.Alias == "accordionBlock")
            {
                wrapper = control.GetControlWrapper <GridControlAccordionValue>();
            }

            return(wrapper != null);
        }
        public bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
        {
            wrapper = null;

            if (control.Editor.Alias == "tilesBlock")
            {
                wrapper = control.GetControlWrapper <GridControlTileValue>();
            }

            return(wrapper != null);
        }
        public bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
        {
            wrapper = null;

            if (control.Editor.Alias == "campaignSection")
            {
                wrapper = control.GetControlWrapper <GridControlCampaignSectionValue>();
            }

            return(wrapper != null);
        }
        public bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
        {
            wrapper = null;

            if (control.Editor.Alias == "richtextBlock")
            {
                wrapper = control.GetControlWrapper <GridControlRichTextValue>();
            }

            return(wrapper != null);
        }
        /// <summary>
        /// Gets an instance <see cref="GridControlWrapper"/> for the specified <paramref name="control"/>.
        /// </summary>
        /// <param name="control">The control to be wrapped.</param>
        /// <param name="wrapper">The wrapper.</param>
        public virtual bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
        {
            // Just set the value to NULL initially (output parameters must be defined)
            wrapper = null;

            // Check the alias of the grid editor
            switch (control.Editor.Alias)
            {
            // Initialize a control wrapper with the correct generic types
            case "SkriftContactPersons":
                wrapper = control.GetControlWrapper <SkriftGridControlContactPersonsValue, SkriftGridEditorContactPersonsConfig>();
                break;
            }

            // Return whether our converter supported the editor
            return(wrapper != null);
        }
Пример #14
0
        /// <summary>
        /// Generates the HTML for the Grid control based on the specified <paramref name="partial"/> view, or
        /// <paramref name="fallbackPartial"/> if <paramref name="partial"/> could not be found.
        /// </summary>
        /// <param name="helper">The <see cref="HtmlHelper"/> used for rendering the Grid control.</param>
        /// <param name="partial">The alias or virtual path to the partial view for rendering the Grid control.</param>
        /// <param name="fallbackPartial">The fallback partial view to be used if <paramref name="partial"/> isn't found.</param>
        /// <returns>An instance of <see cref="T:System.Web.HtmlString" />.</returns>
        public HtmlString GetHtmlOrFallback(HtmlHelper helper, string partial, string fallbackPartial)
        {
            // Some input validation
            if (helper == null)
            {
                throw new ArgumentNullException(nameof(helper));
            }
            if (String.IsNullOrWhiteSpace(partial))
            {
                throw new ArgumentNullException(nameof(partial));
            }

            // If the control isn't valid, we shouldn't render it
            if (!IsValid)
            {
                return(new HtmlString(""));
            }

            // Get a wrapper for the control
            GridControlWrapper wrapper = GridContext.Current.GetControlWrapper(this);

            // If the wrapper is NULL, we shouldn't render the control
            if (wrapper == null)
            {
                return(new HtmlString(""));
            }

            // Prepend the path to the "Editors" folder if not already specified
            if (GridUtils.IsValidPartialName(partial))
            {
                partial = "TypedGrid/Editors/" + partial;
            }

            // Prepend the path to the "Editors" folder if not already specified
            if (GridUtils.IsValidPartialName(fallbackPartial))
            {
                fallbackPartial = "TypedGrid/Editors/" + fallbackPartial;
            }

            // Render the partial view
            return(helper.ViewExists(partial) ? helper.Partial(partial, wrapper) : helper.Partial(fallbackPartial, wrapper));
        }
        /// <summary>
        /// Generates the HTML for the Grid control.
        /// </summary>
        /// <param name="helper">The <see cref="HtmlHelper"/> used for rendering the Grid control.</param>
        /// <param name="partial">The alias or virtual path to the partial view for rendering the Grid control.</param>
        /// <returns>Returns the Grid control as an instance of <see cref="HtmlString"/>.</returns>
        public HtmlString GetHtml(HtmlHelper helper, string partial)
        {
            // Some input validation
            if (helper == null)
            {
                throw new ArgumentNullException("helper");
            }
            if (String.IsNullOrWhiteSpace(partial))
            {
                throw new ArgumentNullException("partial");
            }

            // If the control isn't valid, we shouldn't render it
            if (!IsValid)
            {
                return(new HtmlString(""));
            }

            // Get a wrapper for the control
            GridControlWrapper wrapper = GridContext.Current.GetControlWrapper(this);

            // If the wrapper is NULL, we shouldn't render the control
            if (wrapper == null)
            {
                return(new HtmlString(""));
            }

            // Prepend the path to the "Editors" folder if not already specified
            if (Regex.IsMatch(partial, "^[a-zA-Z0-9-_]+$"))
            {
                partial = "TypedGrid/Editors/" + partial;
            }

            // Render the partial view
            return(helper.Partial(partial, wrapper));
        }
        /// <summary>
        /// Gets an instance <see cref="GridControlWrapper"/> for the specified <paramref name="control"/>.
        /// </summary>
        /// <param name="control">The control to be wrapped.</param>
        /// <param name="wrapper">The wrapper.</param>
        public bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
        {
            wrapper = null;

            switch (control.Editor.Alias)
            {
            case "media_wide":
            case "media_wide_cropped":
                wrapper = control.GetControlWrapper <GridControlMediaValue, GridEditorMediaConfig>();
                break;

            case "banner_headline":
            case "banner_tagline":
            case "headline_centered":
            case "abstract":
            case "paragraph":
            case "quote_D":
            case "code":
                wrapper = control.GetControlWrapper <GridControlTextValue, GridEditorTextConfig>();
                break;
            }

            return(wrapper != null);
        }
Пример #17
0
 public bool GetControlWrapper(GridControl control, out GridControlWrapper wrapper)
 {
     wrapper = null;
     return(false);
 }