Class UIGauge

All Implemented Interfaces:
EventListener, IFocusComp, IMessageBox, IComponent, ICustomDataProvider, IGProp<GProp<?>[]>, IPropCnr, IUIComp, IUIContextMenuOwner, IUIFocusComp, IUIDoubleRangeValueComponent, IUIDoubleValueComponent, IUIValueComponent, IVSComponentListener, IVSComponentState, IVSFieldListener, Cloneable
Direct Known Subclasses:
EUIGauge

public class UIGauge extends UIComp implements IUIFocusComp, IUIDoubleRangeValueComponent, IUIContextMenuOwner
Gauge UI component: a value between a minimum and a maximum shown on a circular, horizontal, semi circular or vertical scale, which the user may also turn or slide.

The gauge is a value component (IUIDoubleRangeValueComponent): its value is the Number property Atom.VALUE, in the range of its min and max properties (0 and 100 by default), connected to a VirtualSpace Field as the slider and the progress bar are, and a change by the user reaches the panel's OnUIValueChange method.

Author:
Christopher Mindus
  • Constructor Details

    • UIGauge

      public UIGauge()
      Creates the component without a name. The name must be set in all cases using the setPropertyAtom call.
    • UIGauge

      public UIGauge(Atom propertyAtom)
      Creates the component with the specified name. All system-reserved names for components begins with "$".
      Parameters:
      propertyAtom - the name of the component, unique within it's parent.
  • Method Details

    • getDeviceType

      public final int getDeviceType()
      Gets the device type: -1=mobile, 0=both, 1=desktop.
      Specified by:
      getDeviceType in interface IUIComp
    • isMobileContextMenuSupported

      public boolean isMobileContextMenuSupported()
      Returns if the component can show the context menu in mobile mode.
      Specified by:
      isMobileContextMenuSupported in interface IUIContextMenuOwner
      Returns:
      Gauge does not support a mobile context menu.
    • getMinimumDefault

      public double getMinimumDefault()
      Gets the default minimum value of the gauge, when the min property is not set.
      Specified by:
      getMinimumDefault in interface IUIDoubleRangeValueComponent
      Returns:
      Zero.
    • getMaximumDefault

      public double getMaximumDefault()
      Gets the default maximum value of the gauge, when the max property is not set.
      Specified by:
      getMaximumDefault in interface IUIDoubleRangeValueComponent
      Returns:
      100.
    • getDefaultValue

      public double getDefaultValue()
      Gets the default value of the gauge, when its value property is not set.
      Specified by:
      getDefaultValue in interface IUIDoubleValueComponent
      Returns:
      Zero.
    • setComponentToVSField

      public int setComponentToVSField()
      Sets the value from this component to its VirtualSpace Field, if any.
      Specified by:
      setComponentToVSField in interface IUIComp
      Overrides:
      setComponentToVSField in class UIComp
      Returns:
      1 for update completed, 0 for nothing done and -1 for error occurred.
    • onValueChanged

      public void onValueChanged(VSField field, Value value, GProp<?> trigger, IPostEventProcessing postProcessing)
      Called when the field value is set.
      Specified by:
      onValueChanged in interface IVSFieldListener
      Overrides:
      onValueChanged in class UIComp
      Parameters:
      field - The VS field.
      value - The value, never null, but value.isNull() could be true.
      trigger - The trigger property that may be null.
      postProcessing - Post-processing instance.
    • getApproximateSize

      public Size getApproximateSize()
      Returns the size of the component in pixels. The size is a calculation and does not exactly reflect the real size that may be different due to additional styles not taken into account by this method. The size is calculated from the font of the component and default or defined values (such as character length or number of lines for text area).
      Specified by:
      getApproximateSize in class UIComp
      Returns:
      The size of the component: the designed default of 200 x 200 for the circular gauge, 200 x 123 for the semi circular one, and the fixed 49 pixels across of the horizontal (200 x 49) and vertical (49 x 200) gauges.
    • verify

      public boolean verify(PropVerification verification)
      Verifies this property container. The check performed is the extension of classes and that no circular reference is present, then the range and the value.
      Specified by:
      verify in interface IGProp<GProp<?>[]>
      Overrides:
      verify in class UIComp
      Parameters:
      verification - The property verification class.
      Returns:
      true if verification should proceed, false if disposed of and verification should not take place.