Class ColumnInputMeasure

All Implemented Interfaces:
Serializable, overit.geocall.marks.MethodExposer, overit.geocall.marks.NameExposer, Badgeable, Hideable, ValueValidator, Identified, Tool, overit.geocall.ux.configurability.UIConfigurable, overit.geocall.ux.edm.ModelConfigurable

@Component public class ColumnInputMeasure extends ColumnInputDouble
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 and client to server).
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 "AUSEDISTANCE" :

  <FieldList>
      <item name="AUSEDISTANCE" 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:
  • Field Details

  • Constructor Details

    • ColumnInputMeasure

      public ColumnInputMeasure()
  • Method Details

    • setUNIT

      public void setUNIT(String unit)
      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

      public void setDISPLAYUNIT(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"
      Parameters:
      displayUnit - The unit of measurement with which show the value on client side.
    • setUnit

      public void setUnit(Measure unit)
      Sets the Measure from 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

      public void setDisplayUnit(Measure displayUnit)
      Sets the Measure 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.
    • getUnit

      public Measure getUnit()
      Gets the Measure from which starts the conversion and that represent the unit whith which the value is represent on server side.
      Returns:
      The Measure from which starts the conversion and that represent the unit whith which the value is represent on server side.
    • getDisplayUnit

      public Measure getDisplayUnit()
      Gets the Measure with which show the value on server side.
      Returns:
      The Measure with which show the value on server side.
    • setOutputPrecision

      public void setOutputPrecision(int outputPrecision)
      Sets the output precision for the value. It is used to show the value in the field
      Parameters:
      outputPrecision - 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: Component
      Setup the Component
      Overrides:
      setup in class ColumnInputDouble
    • prepareName

      protected String prepareName()
      Overrides:
      prepareName in class ColumnInputDouble
    • prepareValue

      protected String prepareValue(ArrayList al)
      Overrides:
      prepareValue in class ColumnInputDouble
    • getConverter

      protected MeasureConverter getConverter(Measure input, Measure output)
    • getDefaultLayoutLabel

      public String getDefaultLayoutLabel()
      Overrides:
      getDefaultLayoutLabel in class ColumnInputDouble