Class MLItemProp

    • Constructor Detail

      • MLItemProp

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

        public MLItemProp​(Atom atom)
        Constructor of the list item property.
        atom - The name of this property.
    • Method Detail

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

        onPropDispose in class UIComp
      • getType

        public MLItemType getType()
        Gets the type specified for the item.
        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
        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
        createIfNotPresent - Creates the content data if it doesn't exist if true.
        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.
        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
        The size of the component.
        java.lang.IllegalStateException - If called outside of the Designer, e.g. from the Server.
      • getGroup

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

        protected void setFocusReference​(java.lang.String focusReference)
        Sets the focus reference. Overridden in the Designer version of the class to use EditorVSFocusReference instead of VSFocusReference.
        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
        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
        doCreate - Create the listener handler if it doesn't exist, false not to.
        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
        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
        on - The select state.
        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.
        state - The state.
        true for state changed, false for no change.
        java.lang.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
        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
        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
        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
        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
        false always.
      • setSelection

        public java.lang.String setSelection​(IUISelection selection)
        Sets the selection.
        Specified by:
        setSelection in interface IUISelectionComp
        selection - The selection.
        "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<?>[]>
        onEventSelf in class UIComp
        event - The property event.
      • onPrepare

        protected void onPrepare​(ClassReference cr,
                                 java.util.List<java.lang.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.

        onPrepare in class AbstractUIAction
        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 java.lang.reflect.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
        The method, or null if none is registered.
      • 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
        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
        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
        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
        onResolved in class UIComp
        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
        onValueChanged in class UIComp
        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
        getVSField in class UIComp
        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.

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