Package overit.geocall.basic.ui.control
Class OutputMeasure
java.lang.Object
overit.geocall.platform.ui.UINode
overit.geocall.ui.Component
overit.geocall.ui.Control
overit.geocall.basic.ui.control.Output
overit.geocall.basic.ui.control.OutputDouble
overit.geocall.basic.ui.control.OutputMeasure
- All Implemented Interfaces:
Serializable,overit.geocall.marks.MethodExposer,overit.geocall.marks.NameExposer,Arrangeable,Badgeable,Identified,Tool,overit.geocall.ux.configurability.UIConfigurable,overit.geocall.ux.edm.ModelConfigurable
The class implements and manages the conversion between different units of measure.
Given the unit of measurement that represent the values in input (and a forced display unit if needed) and a value, the component manages the conversion to the units of measurement indicated in the language user's cultural conventions (server to client side).
To set the managed internal unit it is possible to define it directly on the component (see
Here is an example on how to define a default input confUnit (Kilometer) for a field named "AUTEDISTANZA" :
To set the otuput display unit it is possible to define it directly on the component (see
To define a cultural convention regarding the unit of measurement to be displayed in client side, associated to the kilometers units (for example), simply set a rule like this "$MEASURE_km=mi,2" into the dictionary.
If there's no display unit set, the display unit will be represent by the unit.
The units of measures for which the conversion can currently be managed are:
Given the unit of measurement that represent the values in input (and a forced display unit if needed) and a value, the component manages the conversion to the units of measurement indicated in the language user's cultural conventions (server to client side).
To set the managed internal unit it is possible to define it directly on the component (see
setUNIT(java.lang.String) and setUnit(overit.geocall.util.measure.Measure) ) or set a default one on the cofiguration's file into the FieldList tag.Here is an example on how to define a default input confUnit (Kilometer) for a field named "AUTEDISTANZA" :
<FieldList>
<item name="AUTEDISTANZA" unit="km"/>
</FieldList>
If there's no unit it's set will be thrown an ApplicationException.To set the otuput display unit it is possible to define it directly on the component (see
setDISPLAYUNIT(java.lang.String) and setDisplayUnit(overit.geocall.util.measure.Measure)).To define a cultural convention regarding the unit of measurement to be displayed in client side, associated to the kilometers units (for example), simply set a rule like this "$MEASURE_km=mi,2" into the dictionary.
If there's no display unit set, the display unit will be represent by the unit.
The units of measures for which the conversion can currently be managed are:
- For the Distances category:
- Kilometers (km)
- Meters (m)
- Centimeters (cm)
- Millimeters (mm)
- Miles (mi)
- Yards (yd)
- Feet (ft)
- Inches (in)
- For the Weights category:
- Kilograms (kg)
- Grams (g)
- Centigrams (cg)
- Milligrams (mg)
- Stone (st)
- Pounds (lb)
- Ounces (oz)
- For the Temperatures category:
- Kelvin (K)
- Celsius (°C)
- Fahrenheit (°F)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class overit.geocall.ui.Component
Component.Configurable, Component.ConfigurableAttribute, Component.ConfigurableAttributes, Component.FilterCriteria, Component.Registry -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MeasureConverterprotected Measureprotected intprotected MeasureFields inherited from class overit.geocall.basic.ui.control.OutputDouble
_any, _format, _symbolsFields inherited from class overit.geocall.basic.ui.control.Output
_event, _eventicon, _eventsnumber, _eventtitle, _ff, _key, _label2, _minlength, _msg, _nowrap, _numeric, _param, _prompt, _size, _strong, _value, promptEmpty, truncate, valueWrapFields inherited from class overit.geocall.ui.Control
_blank, _cleaner, _dblink, _enabled, _ro, _title, altEventIconsList, altIcon, ariaDescription, ariaLabel, badge, badgeformat, FILTER_PREFIXES, LABEL_ATTRIBUTE, LABEL_IN_LINE_ATTRIBUTE, STATE_BLANK, STATE_NORMAL, STATE_RO, STATE_ROBLANKFields inherited from class overit.geocall.ui.Component
_basic, _childrenContainers, _currentId, _gridalign, _gridcols, _gridrows, _gridvalign, _iconElement, _id, _keylabel, _label, _layoutName, _name, _parentContainer, _registryName, _shortcut, _tabindex, _transformations, _valuesContainer, aliasField, BR, configHidden, configuredLabel, configuredLabelInLine, defaultHidden, ELEMENT_BR, ELEMENT_NULL, entityContainer, entityName, extendedField, fullHeight, important, labelInLine, layoutLabel, PIXEL_IMG, safeInlineService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MeasureConvertergetConverter(Measure unit, Measure displayUnit) Gets theMeasurewith which show the value on server side.intGets the output precision for the value.getUnit()Gets theMeasurefrom which starts the conversion and that represent the unit whith which the value is represent on server side.protected StringvoidsetDisplayUnit(Measure displayUnit) Sets theMeasurewith which show the value on server side.
The value will be converted (on the client side) into the display unit set, according to what has been set in the user's language dictionary.
For example, if it's set (as cultural convention) that $MEASURE_km=mi,2, it means that the display unit "km" will be converted into "mi"voidsetDISPLAYUNIT(String displayUnit) Sets unit of measurement with which show the value on server side.
The value will be converted (on the client side) into the display unit set, according to what has been set in the user's language dictionary.
For example, if it's set (as cultural convention) that $MEASURE_km=mi,2, it means that the display unit "km" will be converted into "mi"voidsetOutputPrecision(int outPrecision) Sets the output precision for the value.voidSets the output precision for the value.voidSets theMeasurefrom which starts the conversion and that represent the unit whith which the value is represent on server side.
This unit of measure will be considered as the server side unit for the component, only if the unit attribute it's not set into the configuration file for this field.voidSets the unit of measurement, from which starts the conversion and that represent the unit whith which the value is shown on server side.protected voidsetup()Setup the ComponentMethods inherited from class overit.geocall.basic.ui.control.OutputDouble
setFORMAT, setSYMBOLSMethods inherited from class overit.geocall.basic.ui.control.Output
getContentHtml, getDescriptionHtml, getGenerationHandle, getHiddenHtml, getHtml, getHtmlValue, setEVENT, setEVENTMSG, setEVENTPARAM, setEVENTPROMPT, setEVENTTITLE, setICON, setKEY, setLABEL2, setMINLENGTH, setNAME, setNOWRAP, setNUMERIC, setPROMPTEMPTY, setSIZE, setSTRONG, setStyle, setTRUNCATE, setVALUE, setVALUEWRAPMethods inherited from class overit.geocall.ui.Control
avoidNull, clean, getBadgeFormat, getBadgeValue, getBLANK, getCleaner, getConfigurableProperties, getDAValues, getDBLINK, getKEYLABEL, getLABEL, getRO, getState, getTITLE, getValues, getWM, isEnabled, isEnabledBasedOnFunction, isFunctionEnabled, isImportant, isRoBasedOnFunction, nameWithNoFilterPrefix, setALTEVENTICON, setALTICON, setARIADESCRIPTION, setARIALABEL, setBADGEFORMAT, setBADGEVALUE, setBLANK, setCLEANER, setConfiguredProperty, setDBLINK, setENABLED, setFUNCTION, setModelProperties, setRO, setTitle, setTITLEMethods inherited from class overit.geocall.ui.Component
adapt, ajaxQuery, appendAttribute, buildDisplayScript, buildSetupScript, calcKeyLabel, calcLabel, calcShortcut, canBeConfigured, changed, clearConfiguredProperties, componentIterator, componentSize, connect, containerIterator, createAjaxFrame, deprecate, fillSetupScript, generateFlexableFullHeightContainer, generateId, getBASIC, getBoolean, getBoolean, getChildrenComponents, getChildrenContainers, getDefaultLabel, getDefaultLayoutLabel, getEntityContainer, getEntityName, getFullHeight, getGridAlign, getGridCols, getGridRows, getGridVAlign, getHtmlLabel, getHtmlLabel, getIcon, getId, getIdentity, getint, getLayoutLabel, getLayoutName, getNAME, getParentComponent, getParentContainer, getPublishedChildrenList, getRegistryName, getSHORTCUT, getTabIndex, getTeacher, getValuesContainer, getWindow, initChilds, isActivable, isActive, isAliasField, isConfigHidden, isDefaultHidden, isExtendedField, isLabelInLine, onInit, setActivable, setActive, setAliasField, setBASIC, setConfigHidden, setDEFAULTHIDDEN, setEntityName, setExtendedField, setFULLHEIGHT, setGRIDALIGN, setGRIDCOLS, setGRIDROWS, setGRIDVALIGN, setIdentity, setIMPORTANT, setLabel, setLABEL, setLABELINLINE, setLAYOUTLABEL, setLAYOUTNAME, setREGISTRYNAME, setTooltip, setValuesContainer, stringForJs, tabIndexerMethods inherited from class overit.geocall.platform.ui.UINode
addChild, addChildText, getChildren, getNodeId, getParent, getRoot, getSchema, setNodeId, setParent, setSchemaMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface overit.geocall.ui.Badgeable
badgeFormat, makeBadgedIcon
-
Field Details
-
unit
-
displayUnit
-
converter
-
outputPrecision
protected int outputPrecision
-
-
Constructor Details
-
OutputMeasure
public OutputMeasure()Creates an InputMeasure
-
-
Method Details
-
setUNIT
Sets the unit of measurement, from which starts the conversion and that represent the unit whith which the value is shown on server side.- Parameters:
unit- The unit of measurement, from which starts the conversion and that represent the unit whith which the value is shown on server side.
-
setDISPLAYUNIT
Sets unit of measurement with which show the value on server side.
The value will be converted (on the client side) into the display unit set, according to what has been set in the user's language dictionary.
For example, if it's set (as cultural convention) that $MEASURE_km=mi,2, it means that the display unit "km" will be converted into "mi"- Parameters:
displayUnit- The unit of measurement with which show the value on client side.
-
setUnit
Sets theMeasurefrom which starts the conversion and that represent the unit whith which the value is represent on server side.
This unit of measure will be considered as the server side unit for the component, only if the unit attribute it's not set into the configuration file for this field.- Parameters:
unit- The MeasureWrapper of measurement from which starts the conversion and that represent the unit whith which the value is represent on server side.
-
setDisplayUnit
Sets theMeasurewith which show the value on server side.
The value will be converted (on the client side) into the display unit set, according to what has been set in the user's language dictionary.
For example, if it's set (as cultural convention) that $MEASURE_km=mi,2, it means that the display unit "km" will be converted into "mi"- Parameters:
displayUnit- The unit of measurement with which show the value on client side.
-
getUnit
Gets theMeasurefrom which starts the conversion and that represent the unit whith which the value is represent on server side.- Returns:
- The
Measurefrom which starts the conversion and that represent the unit whith which the value is represent on server side.
-
getDisplayUnit
Gets theMeasurewith which show the value on server side.- Returns:
- The
Measurewith which show the value on server side.
-
setOUTPUTPRECISION
Sets the output precision for the value. It is used to show the value in the field- Parameters:
s- The string that represent the number of digits of the fractional part.
-
setOutputPrecision
public void setOutputPrecision(int outPrecision) Sets the output precision for the value. It is used to show the value in the field- Parameters:
outPrecision- The number of digits of the fractional part.
-
getOutputPrecision
public int getOutputPrecision()Gets the output precision for the value. It is used to show the value in the field- Returns:
- The number of digits of the fractional part.
-
setup
protected void setup()Description copied from class:ComponentSetup the Component- Overrides:
setupin classOutputDouble
-
prepareValue
- Overrides:
prepareValuein classOutputDouble
-
getConverter
-