Exemplo n.º 1
0
        private void BuildColumns(Zetbox.App.Base.DataType cls, IEnumerable <Property> props, IEnumerable <Method> methods, Mode mode)
        {
            if (cls == null)
            {
                throw new ArgumentNullException("cls");
            }
            if (props == null)
            {
                throw new ArgumentNullException("props");
            }
            if (methods == null)
            {
                throw new ArgumentNullException("methods");
            }

            ShowIcon = cls.ShowIconInLists;
            ShowId   = cls.ShowIdInLists;
            ShowName = cls.ShowNameInLists;

            this.Columns = new ObservableCollection <ColumnDisplayModel>(
                props.Select(p => CreateColumnDisplayModel(mode, p))
                .Concat(methods.Select(m => GridDisplayConfiguration.CreateColumnDisplayModel(m)))
                .ToList()
                );
        }
Exemplo n.º 2
0
 public void Reset()
 {
     ViewModelFactory.CreateDelayedTask(this, () =>
     {
         _displayedColumns = null;
         OnPropertyChanged("DisplayedColumns");
     })
     .Trigger();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a ColumnDisplayModel for a zetbox object property or property path
        /// </summary>
        /// <param name="mode">Requested mode (readonly, editable)</param>
        /// <param name="p">list of properties to build column for</param>
        /// <returns>a ready configurated ColumnDisplayModel</returns>
        public static ColumnDisplayModel Create(GridDisplayConfiguration.Mode mode, params Property[] p)
        {
            if (p == null) throw new ArgumentNullException("p");
            if (p.Length == 0) throw new ArgumentOutOfRangeException("p", "At least one property is requiered");

            var last = p.Last();

            var colMdl = new ColumnDisplayModel()
            {
                Header = string.Join(", ", p.Select(i => i.GetLabel()).ToArray()),
                Path = string.Join(".", p.Select(i => i.Name).ToArray()),
                DynamicOrderByExpression = FormatDynamicOrderByExpression(p),
                Property = last,
                Properties = p,
                RequestedWidth = p.Last().GetDisplayWidth(),
                Type = ColumnType.PropertyModel
            };
            switch (mode)
            {
                case GridDisplayConfiguration.Mode.ReadOnly:
                    colMdl.ControlKind = last.ValueModelDescriptor.GetDefaultGridCellDisplayKind();
                    colMdl.GridPreEditKind = last.ValueModelDescriptor.GetDefaultGridCellDisplayKind();
                    break;
                case GridDisplayConfiguration.Mode.Editable:
                    colMdl.ControlKind = last.ValueModelDescriptor.GetDefaultGridCellEditorKind();
                    colMdl.GridPreEditKind = last.ValueModelDescriptor.GetDefaultGridCellPreEditorKind();
                    break;
            }
            return colMdl;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a ColumnDisplayModel for a zetbox object property or property path
 /// </summary>
 /// <param name="mode">Requested mode (readonly, editable)</param>
 /// <param name="header">Label for the list header</param>
 /// <param name="kind">The requested editor kind or null if default should be used</param>
 /// <param name="gridPreviewKind">The requested preview kind or null if default should be used</param>
 /// <param name="requestedWidth">Requested list column width</param>
 /// <param name="requestedWidthAbsolute">Requested list column width in absolute toolkit units</param>
 /// <param name="p">list of properties to build column for</param>
 /// <returns>a ready configurated ColumnDisplayModel</returns>
 public static ColumnDisplayModel Create(GridDisplayConfiguration.Mode mode, string header, ControlKind kind, ControlKind gridPreviewKind, WidthHint requestedWidth, int? requestedWidthAbsolute, params Property[] p)
 {
     var colMdl = Create(mode, p);
     colMdl.Header = header;
     colMdl.ControlKind = kind;
     colMdl.GridPreEditKind = gridPreviewKind ?? kind;
     colMdl.RequestedWidth = requestedWidth;
     colMdl.RequestedWidthAbsolute = requestedWidthAbsolute;
     return colMdl;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a ColumnDisplayModel for a zetbox object property or property path
 /// </summary>
 /// <param name="mode">Requested mode (readonly, editable)</param>
 /// <param name="header">Label for the list header</param>
 /// <param name="requestedWidthAbsoulte">Requested list column width in absolute toolkit units</param>
 /// <param name="p">list of properties to build column for</param>
 /// <returns>a ready configurated ColumnDisplayModel</returns>
 public static ColumnDisplayModel Create(GridDisplayConfiguration.Mode mode, string header, int requestedWidthAbsoulte, params Property[] p)
 {
     var colMdl = Create(mode, p);
     colMdl.Header = header;
     colMdl.RequestedWidthAbsolute = requestedWidthAbsoulte;
     return colMdl;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a ColumnDisplayModel for a zetbox object property or property path
 /// </summary>
 /// <param name="mode">Requested mode (readonly, editable)</param>
 /// <param name="requestedWidth">Requested list column width</param>
 /// <param name="p">list of properties to build column for</param>
 /// <returns>a ready configurated ColumnDisplayModel</returns>
 public static ColumnDisplayModel Create(GridDisplayConfiguration.Mode mode, WidthHint requestedWidth, params Property[] p)
 {
     var colMdl = Create(mode, p);
     colMdl.RequestedWidth = requestedWidth;
     return colMdl;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a ColumnDisplayModel for a zetbox object property or property path
 /// </summary>
 /// <param name="mode">Requested mode (readonly, editable)</param>
 /// <param name="header">Label for the list header</param>
 /// <param name="p">list of properties to build column for</param>
 /// <returns>a ready configurated ColumnDisplayModel</returns>
 public static ColumnDisplayModel Create(GridDisplayConfiguration.Mode mode, string header, params Property[] p)
 {
     var colMdl = Create(mode, p);
     colMdl.Header = header;
     return colMdl;
 }
Exemplo n.º 8
0
        protected virtual GridDisplayConfiguration CreateDisplayedColumns()
        {
            var result = new GridDisplayConfiguration();
            result.BuildColumns(_dataType, GridDisplayConfiguration.Mode.Editable, true);

            // Fix column control kinds
            var editKind = NamedObjects.Gui.ControlKinds.Zetbox_App_GUI_EnumerationSelectorKind.Find(FrozenContext);
            foreach (var col in result.Columns)
            {
                col.ControlKind = editKind;
                col.GridPreEditKind = editKind;
            }

            return result;
        }