Class UIComp
- java.lang.Object
- com.iizix.prop.GProp<GProp<?>[]>
- com.iizix.prop.PropCnr
- com.iizix.prop.ui.UIComp
- All Implemented Interfaces:
EventListener
,IMessageBox
,IComponent
,ICustomDataProvider
,IGProp<GProp<?>[]>
,IPropCnr
,IUIComp
,IVSComponentListener
,IVSComponentState
,IVSFieldListener
,java.lang.Cloneable
- Direct Known Subclasses:
AbstractUIAction
,CalendarEvent
,MapMarkerProp
,MUISwitch
,UIAbstractListChoice
,UICalendar
,UIChart
,UICheckBox
,UICheckedMenuItem
,UIContainer
,UIDateTime
,UIEmpty
,UIGauge
,UIImage2
,UILabel
,UIMedia
,UIMenuSeparator
,UIOutput
,UIProgress
,UIRadioButton
,UIRadioMenuItem
,UISlider
,UITableColumn
,UIText
public abstract class UIComp extends PropCnr implements IUIComp
The UIComp class is the basic implementation of a single user interface component.The component has a data container that is not persistent, i.e. is not written e.g. to disk.
- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from interface com.iizix.gyro.IMessageBox
IMessageBox.Icon
Nested classes/interfaces inherited from interface com.iizix.prop.vs.IVSComponentState
IVSComponentState.State
Field Summary
Fields Modifier and Type Field Description static UIComp[]
EMPTY
Empty array of components.protected static int
REMOTE_FOCUS_EVENT
Remote event for focus.protected Styles
styles
The style container.protected VSField
vsField
The connected field, null for none.Fields inherited from class com.iizix.prop.PropCnr
EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_ID
Fields inherited from class com.iizix.prop.GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_USER_1, PROP_USER_2
Fields inherited from interface com.iizix.prop.IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_PRIVATE, EQC_SAVE_FILE, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATE
Fields inherited from interface com.iizix.gyro.IMessageBox
ICON_ERROR, ICON_INFORMATION, ICON_MAP, ICON_NONE, ICON_QUESTION, ICON_WARNING
Fields inherited from interface com.iizix.prop.ui.IUIComp
ERROR, INFORMATION, NONE, WARNING
Constructor Summary
Constructors Constructor Description UIComp()
Creates a property container with the specified name with a null value.UIComp(Atom propertyAtom)
Creates a property container with the specified name with a null value.UIComp(Atom propertyAtom, GProp<?>[] properties)
Creates a property container with the specified name and properties.
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
add(UIComp component)
Adds a component to the container with a property for the layout manager.protected void
addMappings(VSMappings mappings, VSComponent vsStateFocus)
Gets the mappings of a VirtualSpace to the panel components.static void
assignFontInfoResolver(IFontInfo.Resolver resolver)
Assigns the IFontInfo resolver.java.lang.String
canAcceptUIContainerFocus()
Returns if this container can accept focus itself or for one of its children components.boolean
canAlignX()
Returns if the component can be aligned left, right, center, or horizontal fill.boolean
canAlignY()
Returns if the component can be aligned top, bottom, middle or vertical fill.boolean
canFillX()
Returns if the component can fill in X or not.boolean
canFillY()
Returns if the component can fill in Y or not.java.lang.String
canRequestFocus()
Returns if this component can receive focus.java.lang.String
canRequestFocus(boolean ignoreVisibleFlag, boolean ignoreEnabledFlag)
Returns if this component can receive focus.boolean
clearErrorMessage()
Clears the error message, if any.UIComp
clone()
Creates a clone out of this property.java.lang.String
couldRequestFocusIfVirtualized(boolean ignoreVisibleFlag, boolean ignoreEnabledFlag)
Returns if this component could receive focus if it would be virtualized.protected Styles
createStyles()
Creates the Styles container (can be overridden by Designer to create com.iizigo.style.prop.EditorStyles).protected GProp<?>
createTitleProp()
Creates the title property a StringProp, KStringProp or PlainKStringProp depending on the component.boolean
disconnectVSField()
Disconnects from the VirtualSpace Field connection.boolean
enterVSProcessing(VSComponent component)
Call this method when the VSField or the text will update each other, in order to avoid recursion in event processing.void
exitVSProcessing()
Call this routine to exit VSField processing routine that was entered usingenterVSProcessing(VSComponent)
.boolean
fireSelection()
Fires the selection to the listeners if it is changed.protected boolean
fireSelection(GEvent event)
Fires the selection to the listeners if it is changed.java.util.Map<java.lang.String,java.lang.Object>
forbiddenGetCustomDataMap(boolean doCreate)
Deprecated.abstract Size
getApproximateSize()
Returns the size of the component in pixels.GBadge
getBadge()
Gets the badge for the component.Value.Type
getBestVSFieldValueType(VSRelativeReference<?> reference)
Requests the value type that would best suit the listener.int
getComponentID()
Creates or gets the unique ID within the panel for a component.java.util.List<VSComponent>
getComponentMappings()
Gets the mappings to VSComponent's for this component.KString
getErrorMessage(ValueConversionException exception)
Gets the localized error message for a validation exception.KString
getErrorMessage(ILocaleString localeString, ValueConversionException exception)
Gets the localized error message for a validation exception.KString
getErrorMessageEx(ILocaleString localeString, java.lang.Exception exception)
Gets the localized error message for a validation exception of any kind of exception.java.lang.String
getErrorMessageString(ValueConversionException exception)
Gets the localized error message for a validation exception.java.lang.String
getErrorMessageString(ILocaleString localeString, ValueConversionException exception)
Gets the localized error message for a validation exception.java.lang.String
getErrorMessageStringEx(ILocaleString localeString, java.lang.Exception exception)
Gets the localized error message for a validation exception of any kind of exception.VSComponent
getFirstContainerVSStateFocus()
Gets the first VS component encountered for state and focus of this container or in the parent tree up to the panel level.int
getFixHeight()
Gets the designed fixed height of this component in pixels.int
getFixWidth()
Gets the designed fixed width of this component in pixels.IFontInfo
getFontInfo()
Returns the font information from this component.int
getForcedAlignX()
Gets the default alignment in X when it is not supported, i.e.int
getForcedAlignY()
Gets the default alignment in Y when it is not supported, i.e.KString
getKStringText()
Gets the text from the control as aKString
.LayoutProp
getLayout()
Gets the layout properties of this component.LayoutMgr<?>
getLayoutMgr()
Gets the layout manager for the component.<LAYOUT_MGR extends LayoutMgr<?>>
LAYOUT_MGRgetLayoutMgr(java.lang.Class<LAYOUT_MGR> layoutMgrClass)
Gets the layout manager for the component.VSComponent
getMappedVSComponent()
Gets the main component that is used to map the UI component to the VirtualSpace.KTooltip
getMessage()
Gets the current message for the component.java.lang.String
getMessageText()
Gets the current message text for the component as a plain string.int
getPixelHeight()
Returns the height in pixel units of the component from the layout.int
getPixelWidth()
Returns the width in pixel units of the component from the layout.void
getPredefinedProps()
Gets the references to predefined properties.Size
getSize()
Returns the size of the component in pixels.Styles
getStyles()
Gets the Styles property.Styles
getStyles(boolean doCreate)
Gets the Styles property.java.lang.String
getText()
Gets the text.java.lang.String
getTitle()
Get the title of the component (i.e.KString
getTitleKS()
Gets the title of the component as a (Plain) KString (i.e.PlainKString
getTitlePKS()
Gets the title of the component as a PlainKString (i.e.KTooltip
getTooltip()
Gets the current tooltip for the component.java.lang.String
getTooltipText()
Gets the current tooltip text for the component as a plain string.protected GProp<?>
getTrigger(GEvent event)
Gets the trigger from an event.UIPanelBase
getUIPanel()
Gets the UIPanel.UIContainer
getUIParent()
Gets the parent container of this component.Value
getValue(Atom atom)
Gets the value from a property namedatom
.Value
getValue(java.lang.String name)
Gets the value from a property namedname
.VirtualSpace
getVirtualSpace()
Gets the VirtualSpace of the UI component.VSField
getVSField()
Gets the connected or disconnected VirtualSpace Field.VSComponent
getVSStateFocus()
Gets the VS component for state and focus of this component (always null) if the component is not a container.boolean
hasExplicitHeight()
Verifies if the component has an implicit height.boolean
hasExplicitWidth()
Verifies if the component has a width.boolean
hasFocus()
Returns if the component currently has focus.boolean
hasImplicitAlignFillX()
Returns if the component has implicit component horizontal fill.boolean
hasImplicitAlignFillY()
Returns if the component has implicit component vertical fill.boolean
hasImplicitHeight()
Verifies if the component has an implicit height.boolean
hasImplicitWidth()
Verifies if the component has a width.protected boolean
hasSelectionChanged()
Checks if the selection has changed since last call to fireSelection.boolean
isEnabled()
Get the enabled state of the component.boolean
isMobile()
Checks if the panel is of mobile type.boolean
isReadOnly()
Get the read-only state of the component.boolean
isRTL()
Returns if the component is displayed in RTL or not.boolean
isVisible()
Get the visibility state of the component.boolean
isVSFieldDisconnected()
Checks if the connection state to the VirtualSpace Field is disconnected.boolean
mustHaveExplicitHeight()
Does this component require an explicitly defined height?boolean
mustHaveExplicitWidth()
Does this component require an explicitly defined width?boolean
mustHaveHeight()
Does this component require a height?boolean
mustHaveWidth()
Does this component require a width?void
onBroken(VSRelativeReference<?> reference, VSField field)
Called when the property reference has been broken, i.e.void
onComponentSelectedInParent(boolean on)
Called by the parent container to inform that this component has been selected in its container.void
onEventSelf(GEvent event)
Updates a VirtualSpace Field when a component text changes.void
onFocusGained(IFocusComp opposite, IGProp<?> trigger, boolean isRemoteInduced)
Called to the component when it receives focus.protected void
onNotifySelectionChanged(GEvent event)
Method called when the selection of the component has changed and has been verified to be different from a previous selection.void
onParentStateChanged(IVSComponent parent, IVSComponentState.State state, boolean on)
Called when the column changes state.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.protected void
onPrepare(IAppOwner appOwner, IModuleOwner moduleOwner, boolean isPostCall, java.util.List<java.lang.Throwable> errors)
Called when the application is being prepared.protected void
onPropDispose()
Called when a property is disposed of by delete/remove in a container, or by the dispose method.void
onRemoteEvent(RemoteEvent event)
Called when a remote property event should be processed by this property.void
onResolved(VSRelativeReference<?> reference, VSField field)
Called when the property reference has been resolved.protected void
onSelectionChanged(GEvent event)
Method called when the selection of the component changed due to a property change (value changed, property added or removed).void
onStateChanged(VSField field, IVSComponentState.State state, boolean on)
Called when the field changes state.void
onValueChanged(VSField field, Value value, GProp<?> trigger, IPostEventProcessing postProcessing)
Called when the field value is set.protected void
onVirtualizationCompleted(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp, boolean isPostResolve)
Called when virtualization completed.protected void
processVSComponentSelection(VSComponent mappedComponent)
Override to process the VS components selection state when Atom.SELECTED BoolProp changes.boolean
reconnectVSField(boolean update)
Reconnects to a previously disconnected VirtualSpace Field connection.java.lang.String
requestFocus()
Requests focus to this component.java.lang.String
requestFocus(boolean doAnimate)
Requests focus to this component.java.lang.String
requestFocus(IGProp<?> trigger, boolean isRemoteInduced)
Requests focus to this component.java.lang.String
requestFocus(IGProp<?> trigger, boolean isRemoteInduced, boolean doAnimate)
Requests focus to this component.boolean
requestFocusEx()
Requests focus to this component.boolean
requestFocusEx(boolean doAnimate)
Requests focus to this component.boolean
requestFocusEx(IGProp<?> trigger, boolean isRemoteInduced)
Requests focus to this component.boolean
requestFocusEx(IGProp<?> trigger, boolean isRemoteInduced, boolean doAnimate)
Requests focus to this component.void
resetComponentID()
Resets the component ID, typically when copied or saved in order to add make copies of the (some) component data.boolean
setBadge(GBadge badge)
Sets or clears the badge of the component.boolean
setBadge(java.lang.String text)
Sets a red badge text with default font size for the component as a plain string.int
setComponentToVSField()
Sets the text or value from this text or value component to its VirtualSpace Field, if any.boolean
setEnabled(boolean on)
Sets the enabled state of the component.boolean
setEnabled(boolean on, IVSComponent trigger)
Sets the enabled state of the component.void
setErrorMessage(ValueConversionException exception)
Transposes an exception from conversion to the component as an error message.void
setErrorMessage(ILocaleString localeString, ValueConversionException exception)
Transposes an exception from conversion to the component as an error message.boolean
setErrorMessage(KString errorMessage)
Sets (or removes) the ERROR message for the component.boolean
setErrorMessage(java.lang.String errorMessage)
Sets (or removes) the ERROR message for the component.boolean
setHTMLText(java.lang.String text)
Sets the HTML text property KStringProp without tags processing.LayoutMgr<?>
setLayoutMgr(LayoutMgr<?> layoutManager)
Sets the layout manager for the component.boolean
setMessage(KTooltip message)
Sets (or removes) the message for the component.boolean
setMessage(java.lang.String message, int category)
Sets (or removes) a plain message string for the component with specified category.boolean
setReadOnly(boolean on)
Sets the read-only state of the component.boolean
setReadOnly(boolean on, IVSComponent trigger)
Sets the read-only state of the component.boolean
setText(KString text)
Sets the HTML text property KStringProp Atom.TEXT ($text).boolean
setText(java.lang.String text)
Sets the plain text property without tags processing.boolean
setTitle(KString str)
Get the title of the component (i.e.boolean
setTitle(PlainKString str)
Get the title of the component (i.e.boolean
setTitle(java.lang.String str)
Get the title of the component (i.e.boolean
setTooltip(KTooltip tooltip)
Sets (or removes) the tooltip for the component.boolean
setTooltip(java.lang.String text)
Sets (or removes) the plain tooltip text for the component.java.lang.String
setUIContainerFocus(UIComp requestor, boolean doAnimate)
Sets the focus to the UI container and all its parents.boolean
setVisible(boolean on)
Sets the visibility state of the component.boolean
setVisible(boolean on, IVSComponent trigger)
Sets the visibility state of the component.boolean
setVSFieldMessageToComponent(VSField field, boolean clear)
Sets the VirtualSpace Field's message to this component.void
setVSFieldToComponent(VSField field)
Method called when a VirtualSpace Field is resolved or when reconnection is done.boolean
verify(PropVerification verification)
Verifies this property container: component type must match panel type (desktop v/s mobile).protected boolean
verifyComponentScope(UIContainer scopeContainer, java.lang.String what, PropVerification verification, VSComponent vsOuter)
Verifies that this component has it's VS references inside the outer VS reference.Methods inherited from class com.iizix.prop.PropCnr
__transferChildProps, addPredefinedProps, addProp, addProp, addProp2, addProp2, appendPropValue, completeVirtualize, containsProp, containsProp, convertLoadedProp, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, doVirtualizePropCnr, enablePropCommunication, enablePropHashMap, equalsTree, equalsTree, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsContainer, getExtendsError, getExtendsName, getExtendsOverride, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropBaseReference, getPropCnr, getPropCount, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue0, getReferences, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializeValue, initPropCnr, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, isSibling, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropRemoved, onPropTreeInitialized, onReferenceEvent, paramString, prepare, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, replaceProps, requestFocus, requestFocusEx, resolveReferences, resolveRuntimeReferences, setBool, setBool, setBool, setBool, setCreateRequiredProp, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, shouldCreateProps, shouldSerializeToXML, toElementString, toNativeValue0, usePropHashMap, usesPropIndex, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verifyInternalUseOnly, verifyTree, virtualize
Methods inherited from class com.iizix.prop.GProp
addPropError, addPropListener, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, extendsClone, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParent, getTreeLock, hasChanged, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropUSER, isPropValueTreeLockNeeded, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onPropInvalidateCache, onPropParentChanged, onPropValueSet, onVirtualized, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, verifyHasPropertyItem, warning, warning, warning
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.iizix.IComponent
messageBox
Methods inherited from interface com.iizix.prop.ICustomDataProvider
getCustomData, putCustomData, putCustomDataIfAbsent
Methods inherited from interface com.iizix.prop.IGProp
addPropError, addPropListener, dispose, equals, fine, fine, finer, finer, finest, finest, fromElementString, getAppSessionGyro, getAtomPath, getClientSessionGyro, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropNameDebug, getModuleFolder, getModuleFolder, getParent, getParent, getPropAtom, getPropBaseReference, getPropError, getPropError, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getReferencePropName, getReferences, getRelativePropName, getRootParent, getTreeLock, getValueClasses, getVSReference, hasChanged, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCommunicating, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropVirtualized, list, list, list, list, list, mapAliasToReference, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onPropTreeInitialized, removePropError, removePropListener, renameProp, resolveRuntimeReferences, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPropError, setPropExtendsFinal, setPropExtendsPrivate, setPropNullable, setPropPrivate, setPropReadOnly, setPropValue, setPropValue, severe, severe, severe, toElementString, toNativeValue, triggerRemoteEvent, triggerRemoteEvent, validateProp, validatePropType, validatePropValue, verifyHasPropertyItem, warning, warning, warning
Methods inherited from interface com.iizix.gyro.IMessageBox
messageBox, messageBox
Methods inherited from interface com.iizix.prop.IPropCnr
addProp, addProp, addProp2, addProp2, canRequestFocus, containsProp, containsProp, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, enablePropCommunication, enablePropHashMap, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsError, getExtendsName, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropCnr, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getString, getString, getString, getString, initializeExtendsFramework, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsRoot, isPropAddRemoveAllowed, isPropExtended, isSibling, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, setBool, setBool, setBool, setBool, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, usePropHashMap, usesPropIndex, validateClassInstances
Methods inherited from interface com.iizix.prop.ui.IUIComp
getContainerFirstUIComponent, getContainerFirstUIComponentNull, getDeviceType, getFirstUIComponent, getFirstUIComponentNull, getPanelUIComponent, getPanelUIComponentNull, getUIRef
Field Detail
REMOTE_FOCUS_EVENT
protected static final int REMOTE_FOCUS_EVENT
Remote event for focus.- See Also:
- Constant Field Values
EMPTY
public static final UIComp[] EMPTY
Empty array of components.
styles
protected Styles styles
The style container.
vsField
protected VSField vsField
The connected field, null for none.Note: use thread-safe code when working with this variable as it can become unresolved, thus
null
.
Constructor Detail
UIComp
public UIComp()
Creates a property container with the specified name with a null value.
UIComp
public UIComp(Atom propertyAtom)
Creates a property container with the specified name with a null value.- Parameters:
propertyAtom
- the property atom.
UIComp
public UIComp(Atom propertyAtom, GProp<?>[] properties) throws PropException
Creates a property container with the specified name and properties.- Parameters:
propertyAtom
- the property atom.properties
- the property array value for the property.- Throws:
PropException
- as structural changes in containers on client is prohibited.
Method Detail
getPredefinedProps
public void getPredefinedProps()
Gets the references to predefined properties. If the Styles is created, make sure to get it.- Overrides:
getPredefinedProps
in classPropCnr
forbiddenGetCustomDataMap
@Deprecated public java.util.Map<java.lang.String,java.lang.Object> forbiddenGetCustomDataMap(boolean doCreate)
Deprecated.Gets or creates the provider map. This method is not intended to be called by user code, it is used by the system.Do not call this method!
- Specified by:
forbiddenGetCustomDataMap
in interfaceICustomDataProvider
- Parameters:
doCreate
- Creates the map if required.- Returns:
- The map or newly created map,
null
if not created.Note: the map returned is NOT synchronized thus not thread safe. It is up to the caller to synchronize on it to ensure thread safety.
clone
public UIComp clone()
Creates a clone out of this property. The cloning is overridden by the subclasses in order to handle cloning of its class variables appropriately.Cloning is used for "virtualization" of a property tree in the server. Client property classes will therefore throw
CloneNotSupportedException
.Once a tree has been cloned, the change-flag is reset, and the create-flag is set. All listeners are also removed! The new cloned property is an orphan, i.e. has no parent set. All children properties are also (deep) cloned.
Note that the cloning process is done WITHOUT thread synchronization for performance reasons, thus no modifications should be done to the tree!
isMobile
public boolean isMobile()
Checks if the panel is of mobile type.
getUIParent
public final UIContainer getUIParent()
Gets the parent container of this component.- Specified by:
getUIParent
in interfaceIComponent
- Returns:
- null if none is present.
getUIPanel
public final UIPanelBase getUIPanel()
Gets the UIPanel.- Specified by:
getUIPanel
in interfaceIComponent
- Returns:
- null if none is present.
getVirtualSpace
public VirtualSpace getVirtualSpace()
Gets the VirtualSpace of the UI component.- Specified by:
getVirtualSpace
in interfaceIUIComp
- Returns:
- The VirtualSpace, or null for none.
assignFontInfoResolver
public static void assignFontInfoResolver(IFontInfo.Resolver resolver)
Assigns the IFontInfo resolver.
getFontInfo
public IFontInfo getFontInfo()
Returns the font information from this component. This call can only be done in the Designer and will throw IllegalStateException in the Server.- Returns:
- The font information.
- Throws:
java.lang.IllegalStateException
- If called from the Server in runtime (or outside the Designer).
hasImplicitAlignFillX
public boolean hasImplicitAlignFillX()
Returns if the component has implicit component horizontal fill.- Returns:
- true means component will always fill the space in X, false otherwise.
hasImplicitAlignFillY
public boolean hasImplicitAlignFillY()
Returns if the component has implicit component vertical fill.- Returns:
- true means component will always fill the space in Y, false otherwise.
getSize
public Size getSize()
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).The method attempts to use the bounds settings if available. If not available, the size is retrieved from the potential settings of the layout data, and if that is not provided, the approximate size is used.
- Returns:
- The size of the component.
- Throws:
java.lang.IllegalStateException
- If called outside of the Designer.
getApproximateSize
public abstract Size getApproximateSize() throws java.lang.IllegalStateException
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).- Returns:
- The size of the component.
- Throws:
java.lang.IllegalStateException
- If called outside of the Designer, e.g. from the Server.
getPixelWidth
public int getPixelWidth()
Returns the width in pixel units of the component from the layout.- Returns:
- -1 if width is not defined, otherwise the pixel width.
getPixelHeight
public int getPixelHeight()
Returns the height in pixel units of the component from the layout.- Returns:
- -1 if height is not defined, otherwise the pixel height.
hasImplicitWidth
public boolean hasImplicitWidth()
Verifies if the component has a width.This means a width that is either present due to the component or that the width has explicitly been set, or that it is in a container that sets the outer bounds of the component.
- Returns:
- true if the width is defined and non-zero, false otherwise.
hasImplicitHeight
public boolean hasImplicitHeight()
Verifies if the component has an implicit height.This means a height that is either present due to the component or that the height has explicitly been set, or that it is in a container that sets the outer bounds of the component.
- Returns:
- true if the height is defined and non-zero, false otherwise.
hasExplicitWidth
public boolean hasExplicitWidth()
Verifies if the component has a width.This means a width that is either present due to the component or that the width has explicitly been set, or that it is in a container that sets the outer bounds of the component.
- Returns:
- true if the width is defined and non-zero, false otherwise.
hasExplicitHeight
public boolean hasExplicitHeight()
Verifies if the component has an implicit height.This means a height that is either present due to the component or that the height has explicitly been set, or that it is in a container that sets the outer bounds of the component.
- Returns:
- true if the height is defined and non-zero, false otherwise.
mustHaveWidth
public boolean mustHaveWidth()
Does this component require a width?- Returns:
- true if the width must be defined and non-zero, false otherwise.
mustHaveHeight
public boolean mustHaveHeight()
Does this component require a height?- Returns:
- true if the height must be defined and non-zero, false otherwise.
mustHaveExplicitWidth
public boolean mustHaveExplicitWidth()
Does this component require an explicitly defined width?- Returns:
- true if the width must be defined and non-zero, false otherwise.
mustHaveExplicitHeight
public boolean mustHaveExplicitHeight()
Does this component require an explicitly defined height?- Returns:
- true if the height must be defined and non-zero, false otherwise.
canFillX
public boolean canFillX()
Returns if the component can fill in X or not.- Returns:
- true (default) for fill supported, false otherwise (e.g. for a checkbox).
canFillY
public boolean canFillY()
Returns if the component can fill in Y or not.- Returns:
- true (default) for fill supported, false otherwise (e.g. for a checkbox).
canAlignX
public boolean canAlignX()
Returns if the component can be aligned left, right, center, or horizontal fill.- Returns:
- true by default, components override to return false if they are fixed in width or take up the entire width.
canAlignY
public boolean canAlignY()
Returns if the component can be aligned top, bottom, middle or vertical fill.- Returns:
- true by default, components override to return false if they are fixed in height or take up the entire height.
getForcedAlignX
public int getForcedAlignX()
Gets the default alignment in X when it is not supported, i.e.canAlignX()
returns false.- Returns:
- 1=left, 2=center, 3=right, 4=fill (default value), or -1 for failure: align not possible.
getForcedAlignY
public int getForcedAlignY()
Gets the default alignment in Y when it is not supported, i.e.canAlignY()
returns false.- Returns:
- 1=top, 2=middle, 3=bottom, 4=fill (default value), or -1 for failure: align not possible.
getFixWidth
public int getFixWidth()
Gets the designed fixed width of this component in pixels.- Specified by:
getFixWidth
in interfaceIUIComp
- Returns:
- Zero (default) for not fixed.
getFixHeight
public int getFixHeight()
Gets the designed fixed height of this component in pixels.- Specified by:
getFixHeight
in interfaceIUIComp
- Returns:
- Zero (default) for not fixed.
getComponentID
public int getComponentID()
Creates or gets the unique ID within the panel for a component. This ID can be used as the HTML ID and is used by the LabelForReference.- Specified by:
getComponentID
in interfaceIUIComp
- Returns:
- A unique number for a component in a panel.
resetComponentID
public void resetComponentID()
Resets the component ID, typically when copied or saved in order to add make copies of the (some) component data. The operation is recursive.
getStyles
public final Styles getStyles()
Gets the Styles property. If it doesn't exist, it is created.- Specified by:
getStyles
in interfaceIComponent
- Returns:
- The Styles property container or null for none.
getStyles
public final Styles getStyles(boolean doCreate)
Gets the Styles property. If it doesn't exist, it is created depending on thedoCreate
flag.- Returns:
- The Styles property container or null for none.
createStyles
protected Styles createStyles()
Creates the Styles container (can be overridden by Designer to create com.iizigo.style.prop.EditorStyles).
setEnabled
public final boolean setEnabled(boolean on)
Sets the enabled state of the component.- Specified by:
setEnabled
in interfaceIComponent
- Parameters:
on
- The enabled state.- Returns:
- true when this property has been changed, false otherwise (or for error).
setEnabled
public final boolean setEnabled(boolean on, IVSComponent trigger)
Sets the enabled state of the component.- Parameters:
on
- The enabled state.trigger
- The trigger VS component, null for none.- Returns:
- true when this property has been changed, false otherwise (or for error).
isEnabled
public final boolean isEnabled()
Get the enabled state of the component.- Specified by:
isEnabled
in interfaceIComponent
- Returns:
- true if component is enabled, false otherwise.
setReadOnly
public final boolean setReadOnly(boolean on)
Sets the read-only state of the component.Note: certain components are always in a "kind of read-only" mode, thus this property doesn't really apply to them.
- Specified by:
setReadOnly
in interfaceIComponent
- Parameters:
on
- the read-only state.- Returns:
- true when this property has been changed, false otherwise (or for error).
setReadOnly
public final boolean setReadOnly(boolean on, IVSComponent trigger)
Sets the read-only state of the component.Note: certain components are always in a "kind of read-only" mode, thus this property doesn't really apply to them.
- Parameters:
on
- The read-only state.trigger
- The trigger VS component, null for none.- Returns:
- true when this property has been changed, false otherwise (or for error).
isReadOnly
public final boolean isReadOnly()
Get the read-only state of the component.Note: certain components are always in a "kind of read-only" mode, thus this property doesn't really apply to them.
- Specified by:
isReadOnly
in interfaceIComponent
- Returns:
- true if component is read-only, false otherwise.
setVisible
public final boolean setVisible(boolean on)
Sets the visibility state of the component.- Specified by:
setVisible
in interfaceIComponent
- Parameters:
on
- the visibility state.- Returns:
- true when this property has been changed, false otherwise (or for error).
setVisible
public final boolean setVisible(boolean on, IVSComponent trigger)
Sets the visibility state of the component.- Parameters:
on
- The visibility state.trigger
- The trigger VS component, null for none.- Returns:
- true when this property has been changed, false otherwise (or for error).
isVisible
public final boolean isVisible()
Get the visibility state of the component.- Specified by:
isVisible
in interfaceIComponent
- Returns:
- true if component is visible, false otherwise.
getLayout
public LayoutProp getLayout()
Gets the layout properties of this component. If the properties are not present, they are created.
setLayoutMgr
public final LayoutMgr<?> setLayoutMgr(LayoutMgr<?> layoutManager)
Sets the layout manager for the component. If the same layout manager is set twice, there will be no change and the return value is the instance of thelayoutManager
parameter passed into this method.- Specified by:
setLayoutMgr
in interfaceIComponent
- Parameters:
layoutManager
- the layout manager instance, or null to remove the layout manager.- Returns:
- the previous layout manager instance, or
null
if none was set.
getLayoutMgr
public LayoutMgr<?> getLayoutMgr()
Gets the layout manager for the component.- Specified by:
getLayoutMgr
in interfaceIComponent
- Returns:
- the layout manager instance, or
null
if none is set.
getLayoutMgr
public <LAYOUT_MGR extends LayoutMgr<?>> LAYOUT_MGR getLayoutMgr(java.lang.Class<LAYOUT_MGR> layoutMgrClass)
Gets the layout manager for the component.- Specified by:
getLayoutMgr
in interfaceIUIComp
- Parameters:
layoutMgrClass
- The class of the layout manager.- Returns:
- the layout manager instance, or
null
if none is set.
add
public final void add(UIComp component) throws PropException
Adds a component to the container with a property for the layout manager.- Parameters:
component
- the component to add.- Throws:
PropException
- when the container cannot accept the component with the specific layout property.
getText
public final java.lang.String getText()
Gets the text. The string is retrieved from the Atom.TEXT ($text) property and can be eitherStringProp
orKStringProp
.If it's a
KString
, the plain string is returned. It is recommended to use the more accurate text methodsgetPlainText()
orgetKStringText()
to have better control.- Specified by:
getText
in interfaceIComponent
- Returns:
- The plain text string or null if not supported.
getKStringText
public KString getKStringText()
Gets the text from the control as aKString
. This KString can be plain or in HTML depending on the input, butKString
provides methods to get text in different ways.Components implementing KString support implements the
interface.IUIHTMLTextComponent
- Specified by:
getKStringText
in interfaceIComponent
- Returns:
- The
KString
of the text if available, or null if none is present or KString is not supported by the component.
setText
public final boolean setText(java.lang.String text)
Sets the plain text property without tags processing.If the component is connected to a VirtualSpace Field, that text is set instead of the UI component's text.
- Specified by:
setText
in interfaceIComponent
- Parameters:
text
- The text to set in plain text (no tags and no HTML tags will be processed).- Returns:
- true for change of text, false for no change or not supported.
setText
public final boolean setText(KString text)
Sets the HTML text property KStringProp Atom.TEXT ($text).Components implementing KString support implements the
interface.IUIHTMLTextComponent
- Specified by:
setText
in interfaceIComponent
- Parameters:
text
- The text to set.- Returns:
- true for change of text, false for no change or not supported.
setHTMLText
public final boolean setHTMLText(java.lang.String text)
Sets the HTML text property KStringProp without tags processing.The
KStringException
is caught in case of invalid HTML text and logs a warning message.Components implementing KString support implements the
interface.IUIHTMLTextComponent
- Specified by:
setHTMLText
in interfaceIComponent
- Parameters:
text
- The text to set.- Returns:
- true for change of text, false for no change or not supported.
getValue
public Value getValue(java.lang.String name)
Gets the value from a property namedname
.
getBestVSFieldValueType
public Value.Type getBestVSFieldValueType(VSRelativeReference<?> reference)
Requests the value type that would best suit the listener.- Specified by:
getBestVSFieldValueType
in interfaceIVSFieldListener
- Parameters:
reference
- The VSRelativeReference instance holding the reference.- Returns:
- null if none is available.
getVSField
public VSField getVSField()
Gets the connected or disconnected VirtualSpace Field.- Specified by:
getVSField
in interfaceIUIComp
- Returns:
- The field, or null if no field resolved (connected or disconnected) is present.
isVSFieldDisconnected
public boolean isVSFieldDisconnected()
Checks if the connection state to the VirtualSpace Field is disconnected.- Specified by:
isVSFieldDisconnected
in interfaceIUIComp
- Returns:
- true if currently disconnected.
disconnectVSField
public boolean disconnectVSField()
Disconnects from the VirtualSpace Field connection.- Specified by:
disconnectVSField
in interfaceIUIComp
- Returns:
- true for success, false if already done or none is connected.
reconnectVSField
public boolean reconnectVSField(boolean update)
Reconnects to a previously disconnected VirtualSpace Field connection.The method
setVSFieldToComponent(VSField)
is called if there was a disconnected field set.- Specified by:
reconnectVSField
in interfaceIUIComp
- Parameters:
update
- Update flag, i.e. if all states, messages and field contents should be updated to match the field.- Returns:
- true for success, false if not disconnected.
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 theUIComp
class.Components must override to provide the implementation for e.g. value contents, styles, etc.
- Specified by:
onResolved
in interfaceIVSFieldListener
- Parameters:
reference
- The VSRelativeReference instance holding the reference.field
- The target reference.
getMappedVSComponent
public VSComponent getMappedVSComponent()
Gets the main component that is used to map the UI component to the VirtualSpace.- Returns:
- The VS component, or null for none. Default is to return the VSField of UIComp. Override e.g. for actions.
getComponentMappings
public final java.util.List<VSComponent> getComponentMappings()
Gets the mappings to VSComponent's for this component.The VS components are sorted for the deepest first.
- Specified by:
getComponentMappings
in interfaceIUIComp
- Returns:
- An unmodifiable set of VSComponent's, or null for no VS mappings.
getVSStateFocus
public VSComponent getVSStateFocus()
Gets the VS component for state and focus of this component (always null) if the component is not a container.- Returns:
- The component is always null for a non-container UI component.
getFirstContainerVSStateFocus
public VSComponent getFirstContainerVSStateFocus()
Gets the first VS component encountered for state and focus of this container or in the parent tree up to the panel level.- Returns:
- The component (generally a VS Group), null if none is set.
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.
- 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.
setVSFieldToComponent
public void setVSFieldToComponent(VSField field)
Method called when a VirtualSpace Field is resolved or when reconnection is done. Override to provide additional processing. By default all states (enabled, read-only and visible), message and field contents are set from the field to the component.- Specified by:
setVSFieldToComponent
in interfaceIUIComp
- Parameters:
field
- The VS field.
setVSFieldMessageToComponent
public boolean setVSFieldMessageToComponent(VSField field, boolean clear)
Sets the VirtualSpace Field's message to this component.- Specified by:
setVSFieldMessageToComponent
in interfaceIUIComp
- Parameters:
field
- The VS field.clear
- Flag to clear the component message if the field hasn't got a message.- Returns:
- true if changed, false for no change.
onBroken
public void onBroken(VSRelativeReference<?> reference, VSField field)
Called when the property reference has been broken, i.e. unresolved.- Specified by:
onBroken
in interfaceIVSFieldListener
- Parameters:
reference
- The VSRelativeReference instance holding the reference.field
- The target reference.
onStateChanged
public void onStateChanged(VSField field, IVSComponentState.State state, boolean on)
Called when the field changes state.- Specified by:
onStateChanged
in interfaceIVSFieldListener
- Parameters:
field
- The VS field.state
- The state change.on
- New state.
onParentStateChanged
public void onParentStateChanged(IVSComponent parent, IVSComponentState.State state, boolean on)
Called when the column changes state.- Specified by:
onParentStateChanged
in interfaceIVSComponentListener
- Parameters:
parent
- The parent who's state was changed.state
- The state change, possible values PARENT_ENABLED, PARENT_READONLY, PARENT_VISIBLE.on
- New state.
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 interfaceIVSFieldListener
- Parameters:
field
- The VS field.value
- The value, never null, butvalue.isNull()
could be true.trigger
- The trigger property that may be null.postProcessing
- Post-processing instance.
enterVSProcessing
public final boolean enterVSProcessing(VSComponent component)
Call this method when the VSField or the text will update each other, in order to avoid recursion in event processing.Programming note: it is IMPERATIVE that the
exitVSProcessing()
is called after any kind of call to this routine: surround e.g. with "try-finally" block. If this method returnsfalse
theexitVSProcessing()
should not be called.- Parameters:
component
- The VS component that is used for processing.- Returns:
- true if OK to process, false otherwise.
exitVSProcessing
public final void exitVSProcessing()
Call this routine to exit VSField processing routine that was entered usingenterVSProcessing(VSComponent)
.- Throws:
java.lang.InternalError
- If theenterVSProcessing(VSComponent)
wasn't called.
onEventSelf
public void onEventSelf(GEvent event)
Updates a VirtualSpace Field when a component text changes.- Specified by:
onEventSelf
in interfaceIGProp<GProp<?>[]>
- Overrides:
onEventSelf
in classGProp<GProp<?>[]>
- Parameters:
event
- The property event.
getTrigger
protected GProp<?> getTrigger(GEvent event)
Gets the trigger from an event. If the event is remote induced, it is set to "this" component. Otherwise the value is the event's trigger.- Parameters:
event
- The event, null for none.- Returns:
- The trigger, never null (defaults to "this").
hasSelectionChanged
protected boolean hasSelectionChanged()
Checks if the selection has changed since last call to fireSelection.- Returns:
- true for changed, false for no changes (or component is not a selection component).
fireSelection
public boolean fireSelection()
Fires the selection to the listeners if it is changed. The method does not return until it has notifiedthis.onNotifySelectionChanged()
method, listeners, and the UI component's onUISelection method.- Returns:
- true if selection really has changed, false otherwise (or the component is not an instance of IUISelectionComp).
fireSelection
protected boolean fireSelection(GEvent event)
Fires the selection to the listeners if it is changed.- Parameters:
event
- The trigger of the event, MUST be non-null.- Returns:
- true if selection really has changed, false otherwise (or the component is not an instance of IUISelectionComp).
processVSComponentSelection
protected void processVSComponentSelection(VSComponent mappedComponent)
Override to process the VS components selection state when Atom.SELECTED BoolProp changes. Nothing is done by default and must be overridden to process selections by each component.Typically, call
mappedComponent.setSelected(isSelected(),this);
- Parameters:
mappedComponent
- The matching mapped component.
onSelectionChanged
protected void onSelectionChanged(GEvent event)
Method called when the selection of the component changed due to a property change (value changed, property added or removed). Note that this method is allowed to perform actions that changes selection, e.g. if an update to VS failed and the selection is restored or set elsewhere.Override the
onNotifySelectionChanged()
method if you wish to know that the selection really has changed.- Parameters:
event
- The event that causes the selection change.
onNotifySelectionChanged
protected void onNotifySelectionChanged(GEvent event)
Method called when the selection of the component has changed and has been verified to be different from a previous selection. Subclasses can override this method to inform potential listeners.- Parameters:
event
- The event that causes the selection change, COULD BE NULL!
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 interfaceIUIComp
- Returns:
- 1 for update completed, 0 for nothing done and -1 for error occurred.
getErrorMessage
public KString getErrorMessage(ValueConversionException exception)
Gets the localized error message for a validation exception.- Specified by:
getErrorMessage
in interfaceIUIComp
- Parameters:
exception
- The exception, ornull
for no error.- Returns:
- The error message, e.g. to display in the component, or
null
for no error present, i.e. theexception
isnull
.
getErrorMessage
public KString getErrorMessage(ILocaleString localeString, ValueConversionException exception)
Gets the localized error message for a validation exception.- Specified by:
getErrorMessage
in interfaceIUIComp
- Parameters:
localeString
- ThelocaleString
instance to used for localization, ornull
to look it up for the current session.exception
- The exception, ornull
for no error.- Returns:
- The error message, e.g. to display in the component, or
null
for no error present, i.e. theexception
isnull
.
getErrorMessageString
public java.lang.String getErrorMessageString(ValueConversionException exception)
Gets the localized error message for a validation exception.- Parameters:
exception
- The exception, ornull
for no error.- Returns:
- The error message, e.g. to display in the component, or
null
for no error present, i.e. theexception
isnull
.
getErrorMessageString
public java.lang.String getErrorMessageString(ILocaleString localeString, ValueConversionException exception)
Gets the localized error message for a validation exception.- Parameters:
localeString
- ThelocaleString
instance to used for localization, ornull
to look it up for the current session.exception
- The exception, ornull
for no error.- Returns:
- The error message, e.g. to display in the component, or
null
for no error present, i.e. theexception
isnull
.
getErrorMessageEx
public KString getErrorMessageEx(ILocaleString localeString, java.lang.Exception exception)
Gets the localized error message for a validation exception of any kind of exception.- Parameters:
localeString
- ThelocaleString
instance to used for localization, ornull
to look it up for the current session.exception
- The exception, ornull
for no error.- Returns:
- The error message, e.g. to display in the component, or
null
for no error present, i.e. theexception
isnull
.
getErrorMessageStringEx
public java.lang.String getErrorMessageStringEx(ILocaleString localeString, java.lang.Exception exception)
Gets the localized error message for a validation exception of any kind of exception.- Parameters:
localeString
- ThelocaleString
instance to used for localization, ornull
to look it up for the current session.exception
- The exception, ornull
for no error.- Returns:
- The error message, e.g. to display in the component, or
null
for no error present, i.e. theexception
isnull
.
setErrorMessage
public void setErrorMessage(ValueConversionException exception)
Transposes an exception from conversion to the component as an error message.- Specified by:
setErrorMessage
in interfaceIUIComp
- Parameters:
exception
- The exception, ornull
to remove it.
setErrorMessage
public void setErrorMessage(ILocaleString localeString, ValueConversionException exception)
Transposes an exception from conversion to the component as an error message.- Specified by:
setErrorMessage
in interfaceIUIComp
- Parameters:
localeString
- ThelocaleString
instance to used for localization, ornull
to look it up for the current session.exception
- The exception, ornull
to remove it.
onComponentSelectedInParent
public void onComponentSelectedInParent(boolean on)
Called by the parent container to inform that this component has been selected in its container. The containers that call this method are typically accordion, swap and tab containers.The container processes this method by selecting the VSComponent for state and focus that may be connected.
- Parameters:
on
- The selection state.
setTooltip
public boolean setTooltip(KTooltip tooltip)
Sets (or removes) the tooltip for the component.- Specified by:
setTooltip
in interfaceIComponent
- Parameters:
tooltip
- The tooltip, ornull
to remove it.- Returns:
- true for changed, false for no change.
setTooltip
public boolean setTooltip(java.lang.String text)
Sets (or removes) the plain tooltip text for the component.- Specified by:
setTooltip
in interfaceIComponent
- Parameters:
text
- The plain tooltip text, ornull
to remove it.- Returns:
- true for changed, false for no change.
getTooltip
public KTooltip getTooltip()
Gets the current tooltip for the component.- Specified by:
getTooltip
in interfaceIComponent
- Returns:
- The tooltip, or
null
for none.
getTooltipText
public java.lang.String getTooltipText()
Gets the current tooltip text for the component as a plain string.- Specified by:
getTooltipText
in interfaceIComponent
- Returns:
- The tooltip as a plain string, or
null
for none.
setErrorMessage
public boolean setErrorMessage(java.lang.String errorMessage)
Sets (or removes) the ERROR message for the component.- Specified by:
setErrorMessage
in interfaceIComponent
- Parameters:
errorMessage
- The ERROR message, ornull
to remove it.- Returns:
- true for changed, false for no change.
setErrorMessage
public boolean setErrorMessage(KString errorMessage)
Sets (or removes) the ERROR message for the component.- Specified by:
setErrorMessage
in interfaceIComponent
- Parameters:
errorMessage
- The ERROR message, ornull
to remove it.- Returns:
- true for changed, false for no change.
clearErrorMessage
public boolean clearErrorMessage()
Clears the error message, if any.- Specified by:
clearErrorMessage
in interfaceIComponent
- Returns:
- true if changed, false otherwise.
setMessage
public boolean setMessage(KTooltip message)
Sets (or removes) the message for the component.- Specified by:
setMessage
in interfaceIComponent
- Parameters:
message
- The message, ornull
to remove it.- Returns:
- true for changed, false for no change.
setMessage
public boolean setMessage(java.lang.String message, int category)
Sets (or removes) a plain message string for the component with specified category.- Specified by:
setMessage
in interfaceIComponent
- Parameters:
message
- The message to set, ornull
to clear it.category
- The category of the message:IUIComp.NONE
,IUIComp.INFORMATION
,IUIComp.WARNING
orIUIComp.ERROR
.- Returns:
- true for changed, false for no change.
getMessage
public KTooltip getMessage()
Gets the current message for the component.- Specified by:
getMessage
in interfaceIComponent
- Returns:
- The message, or
null
for none.
getMessageText
public java.lang.String getMessageText()
Gets the current message text for the component as a plain string.- Specified by:
getMessageText
in interfaceIComponent
- Returns:
- The message as a plain string, or
null
for none.
setBadge
public boolean setBadge(java.lang.String text)
Sets a red badge text with default font size for the component as a plain string.- Specified by:
setBadge
in interfaceIComponent
- Parameters:
text
- The plain text string, or null to clear it.- Returns:
- true for changed, false for no change.
setBadge
public boolean setBadge(GBadge badge)
Sets or clears the badge of the component.- Specified by:
setBadge
in interfaceIComponent
- Parameters:
badge
- The badge to set, or null to clear it.- Returns:
- true for changed, false for no change.
getBadge
public GBadge getBadge()
Gets the badge for the component.- Specified by:
getBadge
in interfaceIComponent
- Returns:
- The badge, or null if undefined.
isRTL
public boolean isRTL()
Returns if the component is displayed in RTL or not.
canAcceptUIContainerFocus
public java.lang.String canAcceptUIContainerFocus()
Returns if this container can accept focus itself or for one of its children components. If this is a component and not a container, this request is redirected to the parent container.This method recurses up to the topmost UI container, and all containers must return null for this method to return null.
Typically, a container returns itself as instance if it is disabled or hidden.
- Specified by:
canAcceptUIContainerFocus
in interfaceIUIComp
- Returns:
- null if this container (or parent container if this is a component) and all containers up to the topmost level returns null, otherwise an error message why the container that did not accept focus.
setUIContainerFocus
public java.lang.String setUIContainerFocus(UIComp requestor, boolean doAnimate)
Sets the focus to the UI container and all its parents. This method is called when focus is to be set to a component, making it possible for containers such as accordion/swap/tab to change its main container into view.Subclasses must override this method to process it, but make sure to call
super.setUIContainerFocus(requestor)
first!- Specified by:
setUIContainerFocus
in interfaceIUIComp
- Parameters:
requestor
- The requestor is a child to this container.doAnimate
- Flag to enable animation when selection is changed for e.g. accordion, swap or tab containers.- Returns:
- null for success, otherwise an error message why it failed.
canRequestFocus
public java.lang.String canRequestFocus()
Returns if this component can receive focus. Focus capable components may override to returnnull
for success, or other error message.Default processing is to return "Component not focusable" if the component doesn't implement the
IFocusComp
interface, "Not virtualized" if the component is not in a virtualized state, "Component is hidden" ifisVisible()
isfalse
or "Component is disabled" ifisEnabled()
isfalse
.- Specified by:
canRequestFocus
in interfaceIPropCnr
- Returns:
null
focus is possible to this component, or an error message describing why focus cannot be requested.
canRequestFocus
public java.lang.String canRequestFocus(boolean ignoreVisibleFlag, boolean ignoreEnabledFlag)
Returns if this component can receive focus. Focus capable components may override to returnnull
for success, or other error message.Default processing is to return "Component not focusable" if the component doesn't implement the
IFocusComp
interface, "Not virtualized" if the component is not in a virtualized state, "Component is hidden" ifisVisible()
isfalse
or "Component is disabled" ifisEnabled()
isfalse
.- Specified by:
canRequestFocus
in interfaceIPropCnr
- Overrides:
canRequestFocus
in classPropCnr
- Parameters:
ignoreVisibleFlag
- Flag indicating that the visible state should be ignored. If this flag is false and the component hidden an error message is returned.ignoreEnabledFlag
- Flag indicating that the enabled state should be ignored. If this flag is false and the component hidden an error message is returned.- Returns:
null
focus is possible to this component, or an error message describing why focus cannot be requested.
couldRequestFocusIfVirtualized
public java.lang.String couldRequestFocusIfVirtualized(boolean ignoreVisibleFlag, boolean ignoreEnabledFlag)
Returns if this component could receive focus if it would be virtualized. Focus capable components may override to returnnull
for success, or other error message.Default processing is to return "Component not focusable" if the component doesn't implement the
IFocusComp
interface, "Component is hidden" ifisVisible()
isfalse
and theignoreVisibleFlag
isfalse
, or "Component is disabled" ifisEnabled()
isfalse
theignoreEnabledFlag
isfalse
.- Specified by:
couldRequestFocusIfVirtualized
in interfaceIPropCnr
- Overrides:
couldRequestFocusIfVirtualized
in classPropCnr
- Parameters:
ignoreVisibleFlag
- Flag indicating that the visible state should be ignored. If this flag is false and the component hidden an error message is returned.ignoreEnabledFlag
- Flag indicating that the enabled state should be ignored. If this flag is false and the component hidden an error message is returned.- Returns:
null
focus is possible to this component, or an error message describing why focus cannot be requested.
hasFocus
public boolean hasFocus()
Returns if the component currently has focus.
requestFocus
public java.lang.String requestFocus()
Requests focus to this component. This call is redirected to the panel focus engine. The engine may veto the focus change, because it currently cannot change focus, or the request is not virtualized.This method is less precise than
requestFocusEx()
, but avoids try-catching.- Specified by:
requestFocus
in interfaceIComponent
- Returns:
null
for success, otherwise an error message indicating why focus was not able to be changed.
requestFocusEx
public boolean requestFocusEx() throws FocusException
Requests focus to this component. This call is redirected to the panel focus engine. The engine may veto the focus change, because it currently cannot change focus, or the request is not virtualized.- Specified by:
requestFocusEx
in interfaceIComponent
- Returns:
- true if focus was changed, false otherwise.
- Throws:
FocusException
- If focus could not be changed.
requestFocus
public java.lang.String requestFocus(boolean doAnimate)
Requests focus to this component. This call is redirected to the panel focus engine. The engine may veto the focus change, because it currently cannot change focus, or the request is not virtualized.This method is less precise than
requestFocusEx()
, but avoids try-catching.- Specified by:
requestFocus
in interfaceIComponent
- Parameters:
doAnimate
- Flag to enable animation when selection is changed for e.g. accordion, swap or tab containers.- Returns:
null
for success, otherwise an error message indicating why focus was not able to be changed.
requestFocusEx
public boolean requestFocusEx(boolean doAnimate) throws FocusException
Requests focus to this component. This call is redirected to the panel focus engine. The engine may veto the focus change, because it currently cannot change focus, or the request is not virtualized.- Specified by:
requestFocusEx
in interfaceIComponent
- Parameters:
doAnimate
- Flag to enable animation when selection is changed for e.g. accordion, swap or tab containers.- Returns:
- true if focus was changed, false otherwise.
- Throws:
FocusException
- If focus could not be changed.
requestFocus
public java.lang.String requestFocus(IGProp<?> trigger, boolean isRemoteInduced)
Requests focus to this component. This call is redirected to the focus engine for the component type. The engine may veto the focus change, because it currently cannot change focus, or the request is not or cannot be virtualized.This method is less precise than
PropCnr.requestFocusEx(IGProp, boolean, IFocusVetoListener)
, but avoids try-catching.This method is implemented in
PropCnr
, but should only be called forIFocusComp
implementing property classes. This method will return "Component not focusable" if called on a non-focus component.- Specified by:
requestFocus
in interfaceIPropCnr
- Overrides:
requestFocus
in classPropCnr
- Parameters:
trigger
- The trigger property, null for none.isRemoteInduced
- Flag for remote induced focus.- Returns:
null
for success, otherwise an error message indicating why focus was not able to be changed.
requestFocusEx
public boolean requestFocusEx(IGProp<?> trigger, boolean isRemoteInduced) throws FocusException
Requests focus to this component. This call is redirected to the focus engine for the component type. The engine may veto the focus change, because it currently cannot change focus, or the request is not or cannot be virtualized.This method is implemented in
PropCnr
, but should only be called forIFocusComp
implementing property classes. This method will throwFocusException
with message "Component not focusable" if called on a non-focus component.- Specified by:
requestFocusEx
in interfaceIPropCnr
- Overrides:
requestFocusEx
in classPropCnr
- Parameters:
trigger
- The trigger property, null for none.isRemoteInduced
- Flag for remote induced focus.- Returns:
- true if focus was changed, false otherwise.
- Throws:
FocusException
- If focus could not be changed.
requestFocus
public java.lang.String requestFocus(IGProp<?> trigger, boolean isRemoteInduced, boolean doAnimate)
Requests focus to this component. This call is redirected to the focus engine for the component type. The engine may veto the focus change, because it currently cannot change focus, or the request is not or cannot be virtualized.This method is less precise than
PropCnr.requestFocusEx(IGProp, boolean, IFocusVetoListener)
, but avoids try-catching.This method is implemented in
PropCnr
, but should only be called forIFocusComp
implementing property classes. This method will return "Component not focusable" if called on a non-focus component.- Parameters:
trigger
- The trigger property, null for none.isRemoteInduced
- Flag for remote induced focus.- Returns:
null
for success, otherwise an error message indicating why focus was not able to be changed.
requestFocusEx
public boolean requestFocusEx(IGProp<?> trigger, boolean isRemoteInduced, boolean doAnimate) throws FocusException
Requests focus to this component. This call is redirected to the focus engine for the component type. The engine may veto the focus change, because it currently cannot change focus, or the request is not or cannot be virtualized.This method is implemented in
PropCnr
, but should only be called forIFocusComp
implementing property classes. This method will throwFocusException
with message "Component not focusable" if called on a non-focus component.- Parameters:
trigger
- The trigger property, null for none.isRemoteInduced
- Flag for remote induced focus.- Returns:
- true if focus was changed, false otherwise.
- Throws:
FocusException
- If focus could not be changed.
onFocusGained
public void onFocusGained(IFocusComp opposite, IGProp<?> trigger, boolean isRemoteInduced)
Called to the component when it receives focus. This method will become visible when the interface is added to a component extending UIComp, but it will not be required to provide the code unless specific code is required.Focus components override this method if they need to process focus lost.
- Parameters:
opposite
- Component losing focus, null for none.trigger
- The component triggering the focus, null for none.isRemoteInduced
- Flag indicating this event is due to a remote event.
onRemoteEvent
public void onRemoteEvent(RemoteEvent event)
Called when a remote property event should be processed by this property.A subclass can override this method to perform appropriate processing and is not required to call
super.onRemoteEvent(e)
.The onRemoteEvent is NOT called when in a proxied property container, but rather the normal onEventSelf method.
The UIComp implementation processes remote induced focus events.
- Specified by:
onRemoteEvent
in interfaceIGProp<GProp<?>[]>
- Overrides:
onRemoteEvent
in classGProp<GProp<?>[]>
- Parameters:
event
- The remote event.
verify
public boolean verify(PropVerification verification)
Verifies this property container: component type must match panel type (desktop v/s mobile).
verifyComponentScope
protected boolean verifyComponentScope(UIContainer scopeContainer, java.lang.String what, PropVerification verification, VSComponent vsOuter)
Verifies that this component has it's VS references inside the outer VS reference.- Parameters:
scopeContainer
- The scope container.what
- What the scope container is.verification
- The property verification class.vsOuter
- The outer VS parent.- Returns:
- true if OK, false if somehow outside.
onPrepare
protected void onPrepare(IAppOwner appOwner, IModuleOwner moduleOwner, boolean isPostCall, java.util.List<java.lang.Throwable> errors) throws PropException
Called when the application is being prepared. The order ofonPrepare
calls is always parent first, the children. The method is called twice, first time withisPostCall
set tofalse
, then a second time withtrue
.- Overrides:
onPrepare
in classGProp<GProp<?>[]>
- Parameters:
appOwner
- The application owner.moduleOwner
- The Module owner.isPostCall
- Flag indicating this is a post-call.errors
- A list of errors that occurred but did not cause an abort.- Throws:
PropException
- For property errors during the application preparation to need to abort.
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.
- Parameters:
cr
- The class reference with a valid reference.errors
- The list of errors that is returned to the caller in case resolving fails.
onVirtualizationCompleted
protected void onVirtualizationCompleted(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp, boolean isPostResolve)
Called when virtualization completed.This method is called to the entire tree of the newly virtualized property container.
- Overrides:
onVirtualizationCompleted
in classGProp<GProp<?>[]>
- Parameters:
appGyro
- The application gyro instance performing the virtualization.clientGyro
- The client gyro session, can benull
if not initialized from the client gyro.virtualSpace
- The virtualized VirtualSpace.virtualizedProp
- The property being virtualized.isPostResolve
- Flag indicating this call is done after references are attempted to be resolved.
onPropDispose
protected void onPropDispose()
Called when a property is disposed of by delete/remove in a container, or by the dispose method.The Property Container clears the structure of unsent communication requests to clear memory.
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 classPropCnr
getTitle
public java.lang.String getTitle()
Get the title of the component (i.e. tooltip for mouse hover typically).- Returns:
- The component title, or null for none.
- See Also:
getTitlePKS()
getTitleKS
public KString getTitleKS()
Gets the title of the component as a (Plain) KString (i.e. tooltip for mouse hover typically).Note: most components uses PlainKString's but e.g. UIChart supports KString with HTML.
- Returns:
- The component title, or null for none.
- See Also:
getTitle()
getTitlePKS
public PlainKString getTitlePKS()
Gets the title of the component as a PlainKString (i.e. tooltip for mouse hover typically).- Returns:
- The component title, or null for none.
- See Also:
getTitle()
createTitleProp
protected GProp<?> createTitleProp()
Creates the title property a StringProp, KStringProp or PlainKStringProp depending on the component.- Returns:
- A new PlainKStringProp named Atom.TITLE by default, override for other types.
setTitle
public boolean setTitle(java.lang.String str)
Get the title of the component (i.e. tooltip for mouse hover typically). Sets the component title.- Parameters:
str
- The title.- Returns:
- true for value changed, false for no change.
setTitle
public boolean setTitle(KString str)
Get the title of the component (i.e. tooltip for mouse hover typically). Sets the component title.Note: only a few components like UIChart supports KString's with HTML, so this method might fail if you attempt to set a KString with HTML type on e.g. a UILabel.
- Parameters:
str
- The KString title.- Returns:
- true for value changed, false for no change.
setTitle
public boolean setTitle(PlainKString str)
Get the title of the component (i.e. tooltip for mouse hover typically). Sets the component title.- Parameters:
str
- The plain KString title.- Returns:
- true for value changed, false for no change.