/// <summary>
        /// Retrieves the formatted value of a property from an instance
        /// </summary>
        /// <param name="formatter">The formatter</param>
        /// <param name="modelType">The type of the model to which the property belongs (i.e. Case where the property might be on its base class WorkflowItem)</param>
        /// <param name="property">The property of <paramref name="entity"/> whose value should be formatted</param>
        /// <param name="entity">The instance containing the data to format</param>
        public static string FormatProperty(this IDisplayFormatter formatter, Type modelType, Accessor property,
                                            object entity)
        {
            var raw = property.GetValue(entity);

            return(formatter.FormatValue(modelType, property, raw));
        }
Exemple #2
0
        public override Action <EntityDTO> CreateDtoFiller(IGridData data, IDisplayFormatter formatter, IUrlRegistry urls)
        {
            var displaySource = data.GetterFor(Accessor);
            var idSource      = data.GetterFor(IdAccessor);
            var urlSource     = this.toUrlSource(urls, idSource);

            if (_disabled)
            {
                return(dto =>
                {
                    var rawValue = displaySource();
                    var display = _literalText == null?formatter.GetDisplayForValue(Accessor, rawValue) : _literalText.ToString();

                    dto.AddCellDisplay(display);
                });
            }

            return(dto =>
            {
                var rawValue = displaySource();
                var display = _literalText == null?formatter.GetDisplayForValue(Accessor, rawValue) : _literalText.ToString();

                dto.AddCellDisplay(display);

                dto[_linkName] = urlSource();
            });
        }
Exemple #3
0
        /// <summary>
        /// Formats the provided value using the accessor accessor metadata and a custom format
        /// </summary>
        /// <param name="formatter">The formatter</param>
        /// <param name="modelType">The type of the model to which the accessor belongs (i.e. Case where the accessor might be on its base class WorkflowItem)</param>
        /// <param name="accessor">The property that holds the given value</param>
        /// <param name="value">The data to format</param>
        /// <param name="format">The custom format specifier</param>
        public static string FormatValue(this IDisplayFormatter formatter, Type modelType, Accessor accessor,
                                         object value, string format)
        {
            var request = new GetStringRequest(accessor, value, null, format, null);

            return(formatter.GetDisplay(request));
        }
 public void Init()
 {
     _notificationCenter = Substitute.For <INotificationCenter>();
     _calc             = Substitute.For <IPositionCalc>();
     _display          = Substitute.For <IDisplay>();
     _displayFormatter = new DisplayFormatter(_display, _calc, _notificationCenter, _testWidth, _testHeight);
 }
Exemple #5
0
 public void Init()
 {
     _display            = Substitute.For <IDisplay>();
     _formatter          = Substitute.For <IDisplayFormatter>();
     _notificationCenter = new NotificationCenter(_display);
     _notificationCenter.SetFormatter(_formatter);
 }
Exemple #6
0
 /// <summary>
 /// Formats the provided value using the property accessor metadata
 /// </summary>
 /// <param name="modelType">The type of the model to which the property belongs (i.e. Case where the property might be on its base class WorkflowItem)</param>
 /// <param name="formatter">The formatter</param>
 /// <param name="property">The property that holds the given value</param>
 /// <param name="value">The data to format</param>
 public static string FormatValue(this IDisplayFormatter formatter, Type modelType, Accessor property, object value)
 {
     return(formatter.GetDisplay(new GetStringRequest(property, value, null)
     {
         OwnerType = modelType
     }));
 }
Exemple #7
0
        public void Init()
        {
            _log = Substitute.For <ILog>();
            _displayFormatter = Substitute.For <IDisplayFormatter>();

            _monitor  = Substitute.For <IMonitor>();
            _airspace = new Airspace(_monitor, _displayFormatter, _log);
        }
Exemple #8
0
        public void SetUp()
        {
            _formatter         = null;
            theTimeZone        = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
            theTimeZoneContext = new SimpleTimeZoneContext(theTimeZone);

            localTime = new DateTime(2012, 6, 27, 8, 0, 0);
            utcTime   = localTime.ToUniversalTime(theTimeZone);
        }
Exemple #9
0
        public Airspace(IMonitor monitor, IDisplayFormatter display, ILog log)
        {
            Monitor          = monitor;
            DisplayFormatter = display;
            Log = log;

            _tracks = new List <Data>();
            Monitor.SetShareList(ref _tracks);
        }
Exemple #10
0
 public GridRunner(IDisplayFormatter formatter, IUrlRegistry urls, IObjectConverter converter, TService service,
                   IQueryService queryService, IEnumerable <IDataRestriction <TEntity> > restrictions)
 {
     _formatter    = formatter;
     _urls         = urls;
     _converter    = converter;
     _service      = service;
     _queryService = queryService;
     _restrictions = restrictions;
 }
Exemple #11
0
 public Func <object, string> ToFormatter(IDisplayFormatter formatter)
 {
     return(o =>
     {
         var request = new GetStringRequest(_accessor, o, null)
         {
             Format = "{0:s}"
         };
         return formatter.GetDisplay(request);
     });
 }
Exemple #12
0
        public virtual Action <EntityDTO> CreateDtoFiller(IGridData data, IDisplayFormatter formatter, IUrlRegistry urls)
        {
            var source   = data.GetterFor(Accessor);
            var toString = _formatterStrategy.ToFormatter(formatter);

            return(dto =>
            {
                var rawValue = source();

                var displayForValue = toString(rawValue);
                dto.AddCellDisplay(displayForValue);
            });
        }
        public void SetUp()
        {
            _formatter = null;
            theTimeZone = TimeZoneInfo.GetSystemTimeZones().First();
                
                
                
                
            theTimeZoneContext = new SimpleTimeZoneContext(theTimeZone);

            localTime = new DateTime(2012, 6, 27, 8, 0, 0);
            utcTime = localTime.ToUniversalTime(theTimeZone);
        }
Exemple #14
0
        public Action <EntityDTO> CreateDtoFiller(IGridData data, IDisplayFormatter formatter, IUrlRegistry urls)
        {
            var idSource = data.GetterFor(_accessor);

            return(dto =>
            {
                dto.AddCellDisplay(_body.ToString());

                var parameters = new RouteParameters();
                parameters[_accessor.Name] = idSource().ToString();

                var url = urls.UrlFor(typeof(TInputType), parameters);
                dto[_linkName] = url;
            });
        }
Exemple #15
0
        private void configurationIs(Action <DateTimePolicies> action)
        {
            container = new Container();
            var registry = new FubuRegistry();

            registry.Services(x =>
            {
                x.SetServiceIfNone <ITimeZoneContext>(theTimeZoneContext);
            });
            registry.Import <DateTimePolicies>(action);

            FubuApplication.For(registry).StructureMap(container).Bootstrap();


            _formatter = container.GetInstance <IDisplayFormatter>();
        }
        private void configurationIs(Action<DateTimePolicies> action)
        {
            container = new Container();
            var registry = new FubuRegistry();
            registry.Services(x =>
            {
                x.SetServiceIfNone<ITimeZoneContext>(theTimeZoneContext);
            });
            registry.Import<FubuMVC.Core.UI.FubuHtmlRegistration>();
            registry.Import<DateTimePolicies>(action);

            FubuApplication.For(registry).StructureMap(container).Bootstrap();


            _formatter = container.GetInstance<IDisplayFormatter>();
        }
        public void SetUp()
        {
            _formatter = null;
            theTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
            theTimeZoneContext = new SimpleTimeZoneContext(theTimeZone);

            localTime = new DateTime(2012, 6, 27, 8, 0, 0);
            utcTime = localTime.ToUniversalTime(theTimeZone);
        }
Exemple #18
0
 public void SetFormatter(IDisplayFormatter formatter)
 {
     _formatter = formatter;
 }
Exemple #19
0
 Func <object, string> IColumnFormatterStrategy.ToFormatter(IDisplayFormatter formatter)
 {
     return(o => formatter.GetDisplayForValue(Accessor, o));
 }
Exemple #20
0
 public abstract Action <EntityDTO> CreateDtoFiller(IGridData data, IDisplayFormatter formatter, IUrlRegistry urls);
Exemple #21
0
 public ReaderApp(IDisplayFormatter displayFormatter)
 {
     _displayFormatter = displayFormatter;
 }
Exemple #22
0
 public override Action <EntityDTO> CreateDtoFiller(IGridData data, IDisplayFormatter formatter, IUrlRegistry urls)
 {
     throw new NotImplementedException();
 }
 public Windows10(IDisplayFormatter displayFormatter) : base(displayFormatter)
 {
 }
 public static string GetDisplayForProperty(this IDisplayFormatter formatter, Accessor accessor, object target)
 {
     return(formatter.GetDisplay(accessor, accessor.GetValue(target)));
 }
Exemple #25
0
 public override Action <EntityDTO> CreateDtoFiller(IGridData data, IDisplayFormatter formatter, IUrlRegistry urls)
 {
     return(dto => { });
 }
Exemple #26
0
 public ReadingApp(IDisplayFormatter displayformatter)
 {
     this.displayformatter = displayformatter;
 }
Exemple #27
0
        public Action <EntityDTO> CreateDtoFiller(IGridData data, IDisplayFormatter formatter, IUrlRegistry urls)
        {
            var getter = data.GetterFor(_accessor);

            return(dto => dto["Id"] = getter().ToString());
        }
 public SimplePropertyHandler(IObjectConverter converter, IDisplayFormatter formatter)
 {
     _converter = converter;
     _formatter = formatter;
 }
Exemple #29
0
 public FormattedValues(IDisplayFormatter formatter, IValues <T> inner)
 {
     _formatter = formatter;
     _inner     = inner;
 }
Exemple #30
0
 /// <summary>
 /// Formats the provided value using the property accessor metadata
 /// </summary>
 /// <param name="modelType">The type of the model to which the property belongs (i.e. Case where the property might be on its base class WorkflowItem)</param>
 /// <param name="formatter">The formatter</param>
 /// <param name="property">The property that holds the given value</param>
 /// <param name="value">The data to format</param>
 public static string FormatValue(this IDisplayFormatter formatter, Type modelType, Accessor property,
                                  object value) => formatter.GetDisplay(new GetStringRequest(property, value, null, null, modelType));