/// <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)); }
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(); }); }
/// <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); }
public void Init() { _display = Substitute.For <IDisplay>(); _formatter = Substitute.For <IDisplayFormatter>(); _notificationCenter = new NotificationCenter(_display); _notificationCenter.SetFormatter(_formatter); }
/// <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 })); }
public void Init() { _log = Substitute.For <ILog>(); _displayFormatter = Substitute.For <IDisplayFormatter>(); _monitor = Substitute.For <IMonitor>(); _airspace = new Airspace(_monitor, _displayFormatter, _log); }
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); }
public Airspace(IMonitor monitor, IDisplayFormatter display, ILog log) { Monitor = monitor; DisplayFormatter = display; Log = log; _tracks = new List <Data>(); Monitor.SetShareList(ref _tracks); }
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; }
public Func <object, string> ToFormatter(IDisplayFormatter formatter) { return(o => { var request = new GetStringRequest(_accessor, o, null) { Format = "{0:s}" }; return formatter.GetDisplay(request); }); }
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); }
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; }); }
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 SetFormatter(IDisplayFormatter formatter) { _formatter = formatter; }
Func <object, string> IColumnFormatterStrategy.ToFormatter(IDisplayFormatter formatter) { return(o => formatter.GetDisplayForValue(Accessor, o)); }
public abstract Action <EntityDTO> CreateDtoFiller(IGridData data, IDisplayFormatter formatter, IUrlRegistry urls);
public ReaderApp(IDisplayFormatter displayFormatter) { _displayFormatter = displayFormatter; }
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))); }
public override Action <EntityDTO> CreateDtoFiller(IGridData data, IDisplayFormatter formatter, IUrlRegistry urls) { return(dto => { }); }
public ReadingApp(IDisplayFormatter displayformatter) { this.displayformatter = displayformatter; }
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; }
public FormattedValues(IDisplayFormatter formatter, IValues <T> inner) { _formatter = formatter; _inner = inner; }
/// <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));