<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:form="sap.ui.layout.form"
	displayBlock="true"> 
	<App autoFocus="false">
		<Page title="NumberFormat" enableScrolling="false">
			<HBox fitContainer="true">
				<ScrollContainer width="100%" height="100%" horizontal="false" vertical="true">
					<layoutData>
						<FlexItemData baseSize="100%" />
					</layoutData>
					<content>
						<form:SimpleForm layout="ResponsiveGridLayout" columnsL="1" width="100%" editable="true">


							<core:Title text="Output" />

							<Image width="30px" height="20px"
									src="{
										parts: ['/locale'],
										formatter: '.formatImageSrc'}" />

							<Label text="" />
							<Input class="large largeinput"
									value="{
										parts: ['/number', '/currency', '/unit', '/type', '/formatOptions', '/locale'],
										formatter: '.genericFormat'
									}"
									change=".genericParse"
							/>


							<core:Title text="Input" />

							<Label text="Format Options" />
							<TextArea id="formatOptions" class="large" rows="6"
								liveChange=".onFormatOptionChange"
							/>

							<Label text="Type" />
							<Select selectedKey="{/type}" change=".onTypeChange">
								<core:Item key="Integer" text="Integer" />
								<core:Item key="Float" text="Float" />
								<core:Item key="Percent" text="Percent" />
								<core:Item key="Unit" text="Unit" />
								<core:Item key="Currency" text="Currency" />
							</Select>

							<Label text="Sample" />
							<Select selectedKey="{/sample}" items="{/samples}" change=".onSampleChange">
								<core:Item key="{key}" text="{text}" />
							</Select>

							<Label text="Number" />
							<Input class="large largeinput" 
									value="{
											path: '/number',
											type: 'sap.ui.model.type.Float',
											formatOptions: {
												groupingEnabled: false,
												groupingSeparator: ',',
												decimalSeparator: '.',
												parseAsString: true
											}
										}"
									liveChange=".onNumberLiveChange" />

							<Label text="Currency"
									visible="{= ${/type} === 'Currency'}" />
							<Input class="large largeinput"
									value="{/currency}"
									visible="{= ${/type} === 'Currency'}"
									change=".onCurrencyChange"
									liveChange=".onCurrencyLiveChange" />

							<Label text="UnitCode"
									visible="{= ${/type} === 'Unit'}" />
							<Input class="large largeinput"
									showSuggestion="true"
									suggestionItems="{/cldrEntries}"
									value="{/unit}"
									visible="{= ${/type} === 'Unit'}"
									change=".onUnitCodeChange"
									liveChange=".onUnitCodeLiveChange" >
								<suggestionItems>
									<core:Item text="{name}" />
								</suggestionItems>
							</Input>

							<Label text="Locale" />
							<Input class="large largeinput"
									showSuggestion="true"
									suggestionItems="{/localesSuggestions}"
									value= "{path: '/locale', type: 'local.LocaleType'}"
									change=".onLocaleChange" >
								<suggestionItems>
									<SuggestionItem icon="{path: 'name', formatter: '.formatLocaleIcon'}" text="{name}" />
								</suggestionItems>
							</Input>
						</form:SimpleForm>
					</content>
				</ScrollContainer>

				<ScrollContainer width="400px" height="100%" horizontal="false" vertical="true">
					<layoutData>
						<FlexItemData baseSize="400px" />
					</layoutData>
					<content>
						<List items="{/locales}">
							<LocaleListItem xmlns="local"
									locale="{}"
									text="{
										parts: ['/number', '/currency', '/unit', '/formatOptions', '/type', ''],
										formatter: '.formatLocaleText'
									}"
							/>
						</List>
					</content>
				</ScrollContainer>
			</HBox>
		</Page>
	</App>
</mvc:View>
