Class MLItemProp

All Implemented Interfaces:
IBackReferenceProvider, EventListener, IFocusComp, ILockUI, IMessageBox, IUIPanelAnimation, IComponent, IContentItem, ICustomDataProvider, IGProp<GProp<?>[]>, IPropCnr, IPropEditorReadOnly, IUIAction, IUIActionHolder, IUIComp, IUIContextMenuOwner, IUIFocusComp, IUISelectionComp, IUINullableValueComponent, IVSActionListener, IVSComponentListener, IVSComponentState, IVSFieldListener, Cloneable
Direct Known Subclasses:
EMLItemProp

The property container for mobile list items.
Author:
Christopher Mindus
  • Constructor Details

    • MLItemProp

      public MLItemProp()
      Constructor of the list item property without name.
    • MLItemProp

      public MLItemProp(Atom atom)
      Constructor of the list item property.
      Parameters:
      atom - The name of this property.
  • Method Details

    • onPropDispose

      protected void onPropDispose()
      Called when a property is disposed of by delete/remove in a container, or by the dispose method.

      This call is done just at the end of the delete/remove routine in the container, without synchronization.

      During this call, whatever components that e.g. the client needs to disposed of is done.

      Subclasses needing to perform some intelligent operations upon deletion should do it by overloading this method and always call the super.onPropDispose() method.

      Overrides:
      onPropDispose in class UIComp
    • getType

      public MLItemType getType()
      Gets the type specified for the item.
      Returns:
      The list item type.
    • setContentItem

      public final void setContentItem(IContentData<?> itemData)
      Returns the content item that has initialized this property container.
      Specified by:
      setContentItem in interface IContentItem
      Parameters:
      itemData - Sets the content item that has updated this property container.
    • getContentItem

      public MLItem getContentItem(boolean createIfNotPresent)
      Returns the content item that has initialized this property container. If it has not been initialized, it will be initialized with this call if the flag createIfNotPresent is true.
      Specified by:
      getContentItem in interface IContentItem
      Parameters:
      createIfNotPresent - Creates the content data if it doesn't exist if true.
      Returns:
      The content item, null if not previously initialized if createIfNotPresent is false.
    • assignVSField

      public void assignVSField(VSField vsField)
      Assigns the VSField for this item, typically for MLCheckBox or MLSwitch that are connected through VSTable's.
      Parameters:
      vsField - The field to assign, null to unassign.
    • getDeviceType

      public final int getDeviceType()
      Gets the device type: -1=mobile, 0=both, 1=desktop.
      Specified by:
      getDeviceType in interface IUIComp
    • 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.
      Throws:
      IllegalStateException - If called outside of the Designer, e.g. from the Server.
    • clone

      public MLItemProp clone()
      Clones the property.
      Overrides:
      clone in class AbstractUIAction
      Returns:
      The clone.
    • getGroup

      public MLGroup getGroup()
      Gets the group for this item property.
      Returns:
      The group, or null if not found.
    • setFocusReference

      protected void setFocusReference(String focusReference)
      Sets the focus reference. Overridden in the Designer version of the class to use EditorVSFocusReference instead of VSFocusReference.
      Parameters:
      focusReference - The focus reference.
    • getSelectionPropAtom

      public Atom getSelectionPropAtom()
      Returns the selection property atom for verification of selection changes.

      This method is used by the framework in UIComp to fire selection events when the property value changes.

      Specified by:
      getSelectionPropAtom in interface IUISelectionComp
      Returns:
      The atom of the selection property, or null if a selection property is not used.
    • getSelectionListenerHandler

      public GenericListener<IUISelectionListener> getSelectionListenerHandler(boolean doCreate)
      Returns the generic selection listener.
      Specified by:
      getSelectionListenerHandler in interface IUISelectionComp
      Parameters:
      doCreate - Create the listener handler if it doesn't exist, false not to.
      Returns:
      The selection listener handler, or null if not created.
    • getSelectionType

      public int getSelectionType()
      Gets the selection type of the component.
      Specified by:
      getSelectionType in interface IUISelectionComp
      Returns:
      A value indicating the selection capability as the SELECTION_TYPE_* values define.
    • setSelected

      public boolean setSelected(boolean on)
      Sets the selected state of the action. This state is used e.g. for an action to change the image depending on the state. This state is a programmatic state that is also connected to the VirtualSpace action, i.e. the initial state of the component is set according to the VSAction, and if the select state of the VSAction changes, the UI action will follow the same state.

      Note 1: this state is a programmatic state and does not affect the component apart of e.g. displaying a different image depending on the state (and this is supported in the image definition).

      Note 2: Changing the select state in the UI action does NOT affect the VSAction.

      Specified by:
      setSelected in interface IUIAction
      Parameters:
      on - The select state.
      Returns:
      true for state changed, false for no change.
    • setSelected

      public boolean setSelected(int state)
      Sets the selection state: 0=unselected, 1=selected, 2=third state.
      Parameters:
      state - The state.
      Returns:
      true for state changed, false for no change.
      Throws:
      IllegalArgumentException - If the component doesn't support third state and state==2.
    • isSelected

      public boolean isSelected()
      Returns the selection of state of the component.

      For a multiple-selection capable component, this indicates any selection, i.e. true is returned as soon as at least one element is selected, false for none.

      The checkbox for example has two "selected states": checked and third state: in this case, true is returned for the third state as well as the checked state.

      Specified by:
      isSelected in interface IUIAction
      Specified by:
      isSelected in interface IUISelectionComp
      Returns:
      true if the component is selected, false otherwise.
    • isSelectionBooleanBased

      public boolean isSelectionBooleanBased()
      Returns if the selection component supports index-based selection.
      Specified by:
      isSelectionBooleanBased in interface IUISelectionComp
      Returns:
      true if the list item type is CHECKBOX, SWITCH or RADIO_BUTTON, false otherwise.
    • isSelectionTriStateBased

      public boolean isSelectionTriStateBased()
      Returns if the selection component supports index-based selection.
      Specified by:
      isSelectionTriStateBased in interface IUISelectionComp
      Returns:
      true if the list item type is CHECKBOX, false otherwise.
    • isSelectionIndexBased

      public boolean isSelectionIndexBased()
      Returns if the selection component supports index-based selection.
      Specified by:
      isSelectionIndexBased in interface IUISelectionComp
      Returns:
      true if the list item type is COMBOBOX, false otherwise.
    • isSelectionCellBased

      public boolean isSelectionCellBased()
      Returns if the selection component supports is cell based.
      Specified by:
      isSelectionCellBased in interface IUISelectionComp
      Returns:
      false always.
    • getSelection

      public IUISelection getSelection()
      Gets the current selection of the component.
      Specified by:
      getSelection in interface IUISelectionComp
      Returns:
      Always NoSelection as the MList does not support the selection API based on IUISelection interface (or extending interfaces).
    • setSelection

      public String setSelection(IUISelection selection)
      Sets the selection.
      Specified by:
      setSelection in interface IUISelectionComp
      Parameters:
      selection - The selection.
      Returns:
      "Unsupported selection base" as the MList does not support the selection API based on IUISelection interface (or extending interfaces). Use the direction selection API on the MLItem instances or this instance, e.g. setSelected(boolean).
    • onEventSelf

      public void onEventSelf(GEvent event)
      Updates a VirtualSpace Field when a component text changes.
      Specified by:
      onEventSelf in interface IGProp<GProp<?>[]>
      Overrides:
      onEventSelf in class UIComp
      Parameters:
      event - The property event.
    • onPrepare

      protected void onPrepare(ClassReference cr, List<Throwable> errors)
      Called to resolve methods for the component from main "onPrepare" once the ClassReference has been found.

      Components should override this method to load it's required methods.

      Overrides:
      onPrepare in class AbstractUIAction
      Parameters:
      cr - The class reference with a valid reference.
      errors - The list of errors that is returned to the caller in case resolving fails.
    • getOnUISelectionMethod

      public Method getOnUISelectionMethod()
      Returns the method to use for onUISelection notifications that is attached to this selection component. The method name is not important, but must have the annotation and signature:

      @OnUISelection(name = "some/property")
      public void onUISelection(UISelectionEvent event)

      Specified by:
      getOnUISelectionMethod in interface IUISelectionComp
      Returns:
      The method, or null if none is registered.
    • onRemoteEvent

      public void onRemoteEvent(RemoteEvent event)
      Called when a remote property event should be processed by this property.
      Specified by:
      onRemoteEvent in interface IGProp<GProp<?>[]>
      Overrides:
      onRemoteEvent in class AbstractUIAction
      Parameters:
      event - The remote event.
    • invokeOnUIActionMethod

      public void invokeOnUIActionMethod(GProp<?> trigger, UIComp contextComponent)
      Invokes the action event method, overridden to call potential action listeners of the content item.
      Specified by:
      invokeOnUIActionMethod in interface IUIAction
      Parameters:
      trigger - The trigger property.
      contextComponent - The context component, null for none.
    • isMobileContextMenuSupported

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

      public void setVSActionToComponent(VSAction action)
      Method called when a VirtualSpace action is resolved or when reconnection is done. Override to provide additional processing.

      By default the following is done:

      1. all states (enabled, read-only and visible),
      2. progress delay, and
      3. and message
      are set from the action to the component.
      Specified by:
      setVSActionToComponent in interface IUIAction
      Parameters:
      action - The VS action.
    • onResolved

      public void onResolved(VSRelativeReference<?> reference, VSField field)
      Called when the property reference has been resolved. UI components use this method to set its state according to the field, this is handled in by the UIComp class.

      Components must override to provide the implementation for e.g. value contents, styles, etc.

      Specified by:
      onResolved in interface IVSFieldListener
      Overrides:
      onResolved in class UIComp
      Parameters:
      reference - The VSRelativeReference instance holding the reference.
      field - The target reference.
    • onValueChanged

      public void onValueChanged(VSField field, Value value, GProp<?> trigger, IPostEventProcessing postProcessing)
      Called when the field value is set.

      Components must override to provide the implementation when they are not implementing IPlainTextComponent, in this case the default implementation transports the field string value to this text components plain text.

      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.
    • getVSField

      public VSField getVSField()
      Gets the connected or disconnected VirtualSpace Field.
      Specified by:
      getVSField in interface IUIComp
      Overrides:
      getVSField in class UIComp
      Returns:
      The field, or null if no field resolved (connected or disconnected) is present.
    • addMappings

      protected void addMappings(VSMappings mappings, VSComponent vsStateFocus)
      Gets the mappings of a VirtualSpace to the panel components.

      The default is to find the relative references to VS and add those references. Override to provide other functionality.

      Overrides:
      addMappings in class UIComp
      Parameters:
      mappings - The mappings instance to fill in.
      vsStateFocus - Do not go past this component when going up in the parent tree, null for none.