Example #1
0
        public Grid(ViewContext viewContext,
                    IJavaScriptInitializer initializer,
                    IUrlGenerator urlGenerator,
                    IGridHtmlBuilderFactory htmlBuilderFactory) : base(viewContext, initializer)
        {
            this.htmlBuilderFactory = htmlBuilderFactory;

            UrlGenerator = urlGenerator;

            PrefixUrlParameters = true;
            RowTemplate         = new HtmlTemplate <T>();
            DetailTemplate      = new HtmlTemplate <T>();
            Columns             = new List <GridColumnBase <T> >();
            DataKeys            = new List <IDataKey>();

            Pageable    = new PageableSettings();
            Sortable    = new GridSortableSettings();
            Scrollable  = new GridScrollableSettings();
            Navigatable = new GridNavigatableSettings(this);
            Filterable  = new GridFilterableSettings();
            ColumnMenu  = new GridColumnMenuSettings();

            Editable = new GridEditableSettings <T>(this)
            {
                PopUp = new Window(viewContext, Initializer)
                {
                    Modal     = true,
                    Draggable = true
                }
            };

            Grouping    = new GridGroupableSettings();
            Resizable   = new GridResizableSettings();
            Reorderable = new GridReorderableSettings();

            TableHtmlAttributes = new RouteValueDictionary();

            IsEmpty = true;

            Selectable = new GridSelectableSettings();

            ToolBar           = new GridToolBarSettings <T>(this);
            NoRecordsTemplate = new HtmlTemplate();

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

            AutoGenerateColumns = true;

            DataSource = new DataSource()
            {
                Type             = DataSourceType.Server,
                ServerAggregates = true,
                ServerFiltering  = true,
                ServerGrouping   = true,
                ServerPaging     = true,
                ServerSorting    = true
            };

            DataSource.ModelType(typeof(T));
        }
Example #2
0
 protected GridColumnBase(Grid <T> grid)
 {
     Grid           = grid;
     Settings       = new GridColumnSettings();
     Visible        = true;
     HeaderTemplate = new HtmlTemplate();
     FooterTemplate = new HtmlTemplate <GridAggregateResult>();
 }
Example #3
0
        public SplitterPane()
        {
            Scrollable = true;
            Resizable  = true;

            HtmlAttributes = new RouteValueDictionary();

            Template = new HtmlTemplate();
        }
Example #4
0
        public MobileNavBar(ViewContext viewContext, IJavaScriptInitializer initializer, IUrlGenerator urlGenerator)
            : base(viewContext, initializer)
        {
            this.urlGenerator = urlGenerator;

            Content = new HtmlTemplate();
//>> Initialization

            //<< Initialization
        }
Example #5
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);
        }
Example #6
0
 private Action <object, IHtmlNode> MapDetailTemplate(HtmlTemplate <T> detailTemplate)
 {
     return((dataItem, container) =>
     {
         if (detailTemplate != null && detailTemplate.HasValue())
         {
             detailTemplate.Apply((T)dataItem, container);
         }
     });
 }
Example #7
0
        public MobileLayout(ViewContext viewContext, IJavaScriptInitializer initializer, IUrlGenerator urlGenerator)
            : base(viewContext, initializer)
        {
            this.urlGenerator    = urlGenerator;
            Header               = new HtmlTemplate();
            Footer               = new HtmlTemplate();
            HeaderHtmlAttributes = new RouteValueDictionary();
            FooterHtmlAttributes = new RouteValueDictionary();
            //>> Initialization

            //<< Initialization
        }
Example #8
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;
 }
Example #9
0
        public MobileModalView(ViewContext viewContext, IJavaScriptInitializer initializer, IUrlGenerator urlGenerator)
            : base(viewContext, initializer)
        {
            this.urlGenerator = urlGenerator;
            Header            = new HtmlTemplate();
            Content           = new HtmlTemplate();
            Footer            = new HtmlTemplate();
            Modal             = true;
//>> Initialization

            //<< Initialization
        }
Example #10
0
        public MobileSplitViewPane()
        {
            //>> Initialization

            //<< Initialization


            HtmlAttributes = new RouteValueDictionary();

            Content = new HtmlTemplate();

            Events = new Dictionary <string, object>();
        }
Example #11
0
        public MobilePopOver(ViewContext viewContext, IJavaScriptInitializer initializer, IUrlGenerator urlGenerator)
            : base(viewContext, initializer)
        {
            this.urlGenerator = urlGenerator;

            Content = new HtmlTemplate();
//>> Initialization

            Pane = new MobilePopOverPaneSettings();

            Popup = new MobilePopOverPopupSettings();

            //<< Initialization
        }
Example #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GridBoundColumn{TModel, TValue}"/> class.
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="expression"></param>
        public GridBoundColumn(Grid <TModel> grid, Expression <Func <TModel, TValue> > expression)
            : base(grid)
        {
            if (typeof(TModel).IsPlainType() && !expression.IsBindable())
            {
                throw new InvalidOperationException(Exceptions.MemberExpressionRequired);
            }

            Expression = expression;
            Member     = expression.MemberWithoutInstance();
            MemberType = expression.ToMemberExpression().Type();

            Func <TModel, TValue> value;
            var key = expression.ToString();

            using (syncLock.ReadAndWrite())
            {
                if (!expressionCache.TryGetValue(key, out value))
                {
                    using (syncLock.Write())
                    {
                        if (!expressionCache.TryGetValue(key, out value))
                        {
                            expressionCache[key] = value = expression.Compile();
                        }
                    }
                }
            }

            Value = value;
            GroupFooterTemplate = new HtmlTemplate <GridAggregateResult>();
            GroupHeaderTemplate = new HtmlTemplate <GridGroupAggregateResult>();

            if (typeof(TModel).IsPlainType())
            {
                Metadata   = ModelMetadata.FromLambdaExpression(expression, new ViewDataDictionary <TModel>());
                MemberType = Metadata.ModelType;
                Title      = Metadata.DisplayName;
                Format     = Metadata.DisplayFormatString;
                Visible    = Metadata.ShowForDisplay;
            }

            if (string.IsNullOrEmpty(Title))
            {
                Title = Member.AsTitle();
            }

            FilterableSettings = new GridBoundColumnFilterableSettings();
        }
Example #13
0
        public Window(ViewContext viewContext, IJavaScriptInitializer initializer)
            : base(viewContext, initializer)
        {
            Template = new HtmlTemplate();

            ResizingSettings = new WindowResizingSettings();
            PositionSettings = new WindowPositionSettings();

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

            Animation = new PopupAnimation();

            ContentHtmlAttributes = new RouteValueDictionary();

            Scrollable = true;

            Visible = true;
        }
Example #14
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);
        }
Example #15
0
        public Editor(ViewContext viewContext, IJavaScriptInitializer initializer, IUrlGenerator urlGenerator)
            : base(viewContext, initializer)
        {
            UrlGenerator = urlGenerator;

            DefaultToolGroup = new EditorToolGroup(this);

            Template    = new HtmlTemplate();
            Messages    = new EditorMessages();
            StyleSheets = new List <string>();

            new EditorToolFactory(DefaultToolGroup)
            .Formatting()
            .Bold().Italic().Underline()
            .JustifyLeft().JustifyCenter().JustifyRight()
            .InsertUnorderedList().InsertOrderedList()
            .Outdent().Indent()
            .CreateLink().Unlink()
            .InsertImage()
            .TableEditing();

            ImageBrowserSettings = new EditorImageBrowserSettings(Messages.ImageBrowserMessages);
        }
Example #16
0
 public GridToolBarSettings(Grid <T> grid)
 {
     Commands = new List <GridActionCommandBase>();
     Grid     = grid;
     Template = new HtmlTemplate();
 }
Example #17
0
        public MobileScrollViewItem()
        {
            HtmlAttributes = new RouteValueDictionary();

            Content = new HtmlTemplate();
        }
Example #18
0
 public MobileListViewItemBase()
 {
     HtmlAttributes = new RouteValueDictionary();
     Content        = new HtmlTemplate();
 }
Example #19
0
 public GridDetailTemplate()
 {
     Template = new HtmlTemplate <TModel>();
 }