Class UICalendar

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

public class UICalendar extends UIComp implements IUIFocusComp, IUIDateValueComponent, IUIContextMenuOwner
Calendar UI component.
Author:
Christopher Mindus
  • Constructor Details

    • UICalendar

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

      public UICalendar(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.
    • UICalendar

      public UICalendar(Atom propertyAtom, GProp<?>[] newValue) throws PropException
      Creates the component with the specified name, initialized to contain the GProp items. All system-reserved names for components begins with "$".
      Parameters:
      propertyAtom - The name of the component, unique within it's parent.
      newValue - The array of all properties the component should have.
      Throws:
      PropException - when at least one of the properties to initialize the component with is invalid.
  • Method Details

    • getDeviceType

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

      public boolean isMobileContextMenuSupported()
      Returns if the component can show the context menu in mobile mode.
      Specified by:
      isMobileContextMenuSupported in interface IUIContextMenuOwner
      Returns:
      Calendar component supports context menus for mobile.
    • canFillX

      public boolean canFillX()
      Returns if the component can fill in X or not.
      Overrides:
      canFillX in class UIComp
      Returns:
      Always false, calendar cannot be filled in X.
    • canFillY

      public boolean canFillY()
      Returns if the component can fill in Y or not.
      Overrides:
      canFillY in class UIComp
      Returns:
      Always false, calendar cannot be filled in Y.
    • setComponentToVSField

      public int setComponentToVSField()
      Sets the text or value from this text or value 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.
    • getDefaultValue

      public GDateTime getDefaultValue()
      Gets the default date value when the value property is undefined.
      Specified by:
      getDefaultValue in interface IUIDateTimeComponent
      Returns:
      The LocalDate value of the epoch, i.e. 1st of January 1970.
    • getStartDate

      public LocalDate getStartDate()
      Gets the start date for the calendar component UI.

      This value is used to avoid users to select a date out of range but does not provider any guarantee that the selected date is inside this range as it can be set outside of range by API calls.

      Returns:
      The start date, or null for none.
    • getEndDate

      public LocalDate getEndDate()
      Gets the end date for the calendar component UI.

      This value is used to avoid users to select a date out of range but does not provider any guarantee that the selected date is inside this range as it can be set outside of range by API calls.

      Returns:
      The start date, or null for none.
    • setStartAndEndDates

      public boolean setStartAndEndDates(LocalDate startDate, LocalDate endDate)
      Sets the end date for the calendar component UI.

      This value is used to avoid users to select a date out of range but does not provider any guarantee that the selected date is inside this range as it can be set outside of range by API calls.

      Parameters:
      startDate - The new start date, or null to remove it.
      endDate - The new end date, or null to remove it.
      Returns:
      true for changes, false for no changes.
      Throws:
      IllegalArgumentException - If endDate is before or equal to startDate.
    • getDayFormat

      public int getDayFormat()
      Gets the day format or width.
      Returns:
      The day format or width as:
      • 0 = narrow (default),
      • 1 = abbreviated,
      • 2 = wide.
    • setDayFormat

      public boolean setDayFormat(int formatOrWidth)
      Sets the day format or width.
      Parameters:
      formatOrWidth - The day format or width as:
      • 0 = narrow (default),
      • 1 = abbreviated,
      • 2 = wide.
      Returns:
      true for changed, false for no changes.
      Throws:
      IllegalArgumentException - If the formatOrWidth value is not 0 to 2.
    • 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: 400x300.