Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GridBoundColumn{T}"/> class.
        /// </summary>
        /// <param name="value">The property to which the column is bound to.</param>
        public GridBoundColumn(Grid <TModel> grid, Expression <Func <TModel, TValue> > expression)
            : base(grid)
        {
            Guard.IsNotNull(expression, "expression");

            if (typeof(TModel).IsPlainType() && !expression.IsBindable())
            {
                throw new InvalidOperationException(TextResource.MemberExpressionRequired);
            }

            Expression          = expression;
            Member              = expression.MemberWithoutInstance();
            MemberType          = expression.ToMemberExpression().Type();
            Value               = expression.Compile();
            Aggregates          = new List <AggregateFunction>();
            GroupFooterTemplate = new HtmlTemplate <GridAggregateResult>();
            GroupHeaderTemplate = new HtmlTemplate <GridGroupAggregateResult>();

#if MVC2 || MVC3
            if (typeof(TModel).IsPlainType())
            {
                Metadata   = ModelMetadata.FromLambdaExpression(expression, new ViewDataDictionary <TModel>());
                MemberType = Metadata.ModelType;
                Title      = Metadata.DisplayName;
                Format     = Metadata.DisplayFormatString;
                Visible    = Metadata.ShowForDisplay;
                ReadOnly   = Metadata.IsReadOnly;
            }
#endif
            if (string.IsNullOrEmpty(Title))
            {
                Title = Member.AsTitle();
            }
        }
Ejemplo n.º 2
0
 protected GridColumnBase(Grid <T> grid)
 {
     Grid           = grid;
     Settings       = new GridColumnSettings();
     Visible        = true;
     HeaderTemplate = new HtmlTemplate();
     FooterTemplate = new HtmlTemplate <GridAggregateResult>();
 }
Ejemplo n.º 3
0
        public SplitterPane()
        {
            Scrollable = true;
            Resizable  = true;

            HtmlAttributes = new RouteValueDictionary();

            Template = new HtmlTemplate();
        }
Ejemplo n.º 4
0
 public GridCell(GridColumnBase <T> column, T dataItem)
 {
     Column         = column;
     Grid           = column.Grid;
     DataItem       = dataItem;
     Template       = new HtmlTemplate <T>();
     HtmlAttributes = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);
     HtmlAttributes.Merge(column.HtmlAttributes);
 }
Ejemplo n.º 5
0
        public Editor(ViewContext viewContext,
                      IClientSideObjectWriterFactory clientSideObjectWriterFactory,
                      IWebAssetCollectionResolver resolver,
                      ILocalizationService localizationService,
                      IUrlGenerator urlGenerator)
            : base(viewContext, clientSideObjectWriterFactory)
        {
            this.resolver     = resolver;
            this.urlGenerator = urlGenerator;

            ScriptFileNames.AddRange(new[] {
                "telerik.common.js",
                "telerik.list.js",
                "telerik.combobox.js",
                "telerik.draganddrop.js",
                "telerik.window.js",
                "telerik.editor.js"
            });

            DefaultToolGroup = new EditorToolGroup(this);

            ClientEvents = new EditorClientEvents();

            StyleSheets = new WebAssetGroup("default", false)
            {
                DefaultPath = WebAssetDefaultSettings.StyleSheetFilesPath
            };

            Localization = new EditorLocalization(localizationService, CultureInfo.CurrentUICulture);

            Template = new HtmlTemplate();

            new EditorToolFactory(DefaultToolGroup)
            .Bold().Italic().Underline().Strikethrough()
            .Separator()
            .FontName()
            .FontSize()
            .FontColor().BackColor()
            .Separator()
            .JustifyLeft().JustifyCenter().JustifyRight().JustifyFull()
            .Separator()
            .InsertUnorderedList().InsertOrderedList()
            .Separator()
            .Outdent().Indent()
            .Separator()
            .FormatBlock()
            .Separator()
            .CreateLink().Unlink()
            .Separator()
            .InsertImage();

            FileBrowserSettings = new EditorFileBrowserSettings(this);

            DefaultToolGroup.Tools.OfType <EditorComboBox>()
            .Each(combo => combo.InputHtmlAttributes.Add("title", combo.Identifier));
        }
Ejemplo n.º 6
0
 private Action <object, IHtmlNode> MapDetailViewTemplate(HtmlTemplate <T> detailViewTemplate)
 {
     return((dataItem, container) =>
     {
         if (detailViewTemplate != null && detailViewTemplate.HasValue())
         {
             detailViewTemplate.Apply((T)dataItem, container);
         }
     });
 }
Ejemplo n.º 7
0
 protected NavigationItem()
 {
     Template              = new HtmlTemplate();
     HtmlAttributes        = new RouteValueDictionary();
     ImageHtmlAttributes   = new RouteValueDictionary();
     LinkHtmlAttributes    = new RouteValueDictionary();
     RouteValues           = new RouteValueDictionary();
     ContentHtmlAttributes = new RouteValueDictionary();
     Visible = true;
     Enabled = true;
     Encoded = true;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Grid{T}"/> class.
        /// </summary>
        /// <param name="viewContext">The view context.</param>
        /// <param name="clientSideObjectWriterFactory">The client side object writer factory.</param>
        /// <param name="urlGenerator">The URL generator.</param>
        /// <param name="builderFactory">The builder factory.</param>
        public Grid(ViewContext viewContext, IClientSideObjectWriterFactory clientSideObjectWriterFactory, IUrlGenerator urlGenerator,
                    ILocalizationService localizationService, IGridHtmlBuilderFactory htmlBuilderFactory)
            : base(viewContext, clientSideObjectWriterFactory)
        {
            this.htmlBuilderFactory = htmlBuilderFactory;

            UrlGenerator = urlGenerator;

            PrefixUrlParameters = true;
            RowTemplate         = new HtmlTemplate <T>();
            DataProcessor       = new GridDataProcessor(this);
            Columns             = new List <GridColumnBase <T> >();
            DataKeys            = new List <IGridDataKey <T> >();

            Paging             = new GridPagingSettings(this);
            Sorting            = new GridSortSettings(this);
            Scrolling          = new GridScrollingSettings();
            KeyboardNavigation = new GridKeyboardNavigationSettings(this);
            ColumnContextMenu  = new GridColumnContextMenuSettings(this);
            Filtering          = new GridFilteringSettings();
            Editing            = new GridEditingSettings <T>(this)
            {
                PopUp = new Window(viewContext, clientSideObjectWriterFactory, new WindowHtmlBuilderFactory())
                {
                    Modal     = true,
                    Draggable = true
                }
            };

            Grouping   = new GridGroupingSettings(this);
            Resizing   = new GridResizingSettings();
            Reordering = new GridReorderingSettings();

            TableHtmlAttributes = new RouteValueDictionary();

            DataBinding = new GridDataBindingSettings(this);

            Footer  = true;
            IsEmpty = true;

            ClientEvents = new GridClientEvents();
            Selection    = new GridSelectionSettings();
            ScriptFileNames.AddRange(new[] { "telerik.common.js", "telerik.grid.js" });

            ToolBar           = new GridToolBarSettings <T>(this);
            Localization      = new GridLocalization(localizationService, CultureInfo.CurrentUICulture);
            NoRecordsTemplate = new HtmlTemplate();

            ValidationMetadata = new Dictionary <string, object>();

            AutoGenerateColumns = true;
        }
Ejemplo n.º 9
0
        protected virtual IGridDataCellBuilder CreateDisplayBuilderCore(IGridHtmlHelper htmlHelper)
        {
            var template = new HtmlTemplate <T>();

            if (Template != null)
            {
                template.CodeBlockTemplate = Template;
            }

            if (InlineTemplate != null)
            {
                template.InlineTemplate = InlineTemplate;
            }

            var builder = new GridTemplateCellBuilder <T>(template);

            builder.HtmlAttributes.Merge(HtmlAttributes);
            return(builder);
        }
        public virtual IClientSideObjectWriter Append(string name, HtmlTemplate htmlTemplate)
        {
            Guard.IsNotNullOrEmpty(name, "name");

            if (htmlTemplate.HasValue())
            {
                if (htmlTemplate.Content != null)
                {
                    EnsureStart();

                    writer.Write(appended ? ", " : "{");
                    writer.Write("{0}:'".FormatWith(name));
                    htmlTemplate.Content();
                    writer.Write("'");

                    return(this);
                }

                if (htmlTemplate.Html.HasValue())
                {
                    string formattedValue = QuoteString(htmlTemplate.Html);

                    Append("{0}:'{1}'".FormatWith(name, formattedValue));

                    return(this);
                }

                if (htmlTemplate.InlineTemplate != null)
                {
                    var inlineTemplate = htmlTemplate.InlineTemplate(null);

                    if (inlineTemplate != null)
                    {
                        string formattedValue = QuoteString(inlineTemplate.ToString());

                        Append("{0}:'{1}'".FormatWith(name, formattedValue));
                    }
                }
            }

            return(this);
        }
Ejemplo n.º 11
0
        public Window(ViewContext viewContext, IClientSideObjectWriterFactory clientSideObjectWriterFactory, IWindowHtmlBuilderFactory builderFactory)
            : base(viewContext, clientSideObjectWriterFactory)
        {
            this.builderFactory = builderFactory;

            ScriptFileNames.AddRange(new[] { "telerik.common.js", "telerik.draganddrop.js", "telerik.window.js" });

            Template = new HtmlTemplate();

            ClientEvents     = new WindowClientEvents();
            ResizingSettings = new WindowResizingSettings();

            Buttons = new WindowButtons();
            defaultButtons.Each(button => Buttons.Container.Add(button));

            Effects = new Effects();
            defaultEffects.Each(el => Effects.Container.Add(el));

            ContentHtmlAttributes = new RouteValueDictionary();

            Scrollable = true;

            Visible = true;
        }
Ejemplo n.º 12
0
 public EditorCustomTool()
 {
     HtmlAttributes = new Dictionary <string, object>();
     Template       = new HtmlTemplate();
 }
Ejemplo n.º 13
0
 public GridDetailView()
 {
     Template = new HtmlTemplate <TModel>();
 }
Ejemplo n.º 14
0
 public GridToolBarSettings(Grid <T> grid)
 {
     Commands = new List <GridActionCommandBase>();
     Grid     = grid;
     Template = new HtmlTemplate();
 }