package gw.exportimport.web uses gw.api.locale.DisplayKey uses gw.exportimport.EntityFlowMask /** * Represents the backing object for the "Format" selection on the ExcelExportPopup. * Used in {@link ExportMaskSelection}. */ @ReadOnly class ExportMaskDataFormat { var _mask : EntityFlowMask as readonly Mask var _all : boolean as readonly All static final var ALL_FORMAT = new ExportMaskDataFormat(null, true) private construct(aFormat : EntityFlowMask, isAll : boolean = false) { _mask = aFormat _all = isAll } override function toString() : String { return _all ? DisplayKey.get("Web.ExcelExport.AllFormat") : _mask.Name } /** * Creates a new {@link ExportMaskDataFormat} by wrapping given {@link EntityFlowMaskData}. */ static function ofFlowMaskData(aFormat : EntityFlowMaskData) : ExportMaskDataFormat { var parameterizedType = EntityFlowMask.Type.getParameterizedType({aFormat.EntityType}) var constructor = parameterizedType.TypeInfo.getCallableConstructor({EntityFlowMaskData}) var entityFlowMask = constructor.Constructor.newInstance({aFormat}) as EntityFlowMask return new ExportMaskDataFormat(entityFlowMask, false) } /** * Returns singleton instance of an {@link ExportMaskDataFormat} representing the "All" option. */ static function ofAll() : ExportMaskDataFormat { return ALL_FORMAT } }