Class UIImage2
- All Implemented Interfaces:
EventListener, IFocusComp, IMessageBox, IComponent, ICustomDataProvider, IGProp<GProp<?>[]>, IPropCnr, IUIComp, IUIContextMenuOwner, IUIFocusComp, IVSComponentListener, IVSComponentState, IVSFieldListener, Cloneable
- Direct Known Subclasses:
EUIImage2
The image file the user picks or drops is uploaded over HTTPS through the upload service of the client session, as the original file, as soon as it passes the pixel check: the client raises the remote event REMOTE_REQUEST with the upload channel's request, which this component reserves for one PNG or JPEG file no larger than the maximum file size, narrowed to UPLOAD_TYPES so that a disguised file fails verification. When the file has been received and verified, the client raises event 1 naming the reservation, and the listeners' IUIImage2Listener.onImageSelection(UIImage2, String, ImageType, byte[], int, int, ImageOrientation, double, GRect, boolean) is called with the bytes of the verified file, which is then deleted. Crop, zoom and orientation are properties and never upload again. The upload in flight is cancelled when the value is replaced from the server (REASON_REPLACED) and when the component is disposed of (REASON_DISPOSED).
Where the client session cannot upload - the server does not allow uploads ($upload.allow), or the client has no upload channel - the client sends the file over the WebSocket as the value of the component, as before, and it is accepted only there, bounded by the maximum file size.
- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from interface IMessageBox
IMessageBox.IconNested classes/interfaces inherited from interface IVSComponentState
IVSComponentState.StateField Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default supported image types and file etensions: ".jpg,.jpeg,image/jpeg,.png,image/png".static final GSizeThe default viewport size: 100x100.static final StringThe reason the upload in flight is cancelled with when the component is disposed of: "disposed".static final StringThe reason the upload in flight is cancelled with when the value of the component is replaced from the server, by code or a VirtualSpace: "replaced".static final intThe remote event of the client asking to upload the image file the user picked: its parameters are the upload channel's request (UploadChannelProps.encodeReserve(int, List, boolean, String)).static final StringThe media types an image file is uploaded as, whatever the supported image types say: "image/png,image/jpeg".Fields inherited from class UIComp
EMPTY, REMOTE_FOCUS_EVENT, styles, vsFieldFields inherited from class PropCnr
EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_IDFields inherited from class 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_ATTR_STRING_SECRET, PROP_USER_1, PROP_USER_2Fields inherited from interface IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_INCLUDE_PRIVATE, EQC_SAVE_FILE, EQC_SAVE_RELEVANT_ONLY, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATEFields inherited from interface IMessageBox
ICON_ERROR, ICON_INFORMATION, ICON_MAP, ICON_NONE, ICON_QUESTION, ICON_WARNINGFields inherited from interface IUIComp
ERROR, INFORMATION, NONE, WARNINGConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionbooleanaddListener(IUIImage2Listener listener) Adds a new listener for changes in this image property.booleanReturns if the component can be aligned left, right, center, or horizontal fill.booleanReturns if the component can be aligned top, bottom, middle or vertical fill.clone()Creates a clone out of this property.Returns the size of the component in pixels.final intGets the device type: -1=mobile, 0=both, 1=desktop.getImage()Gets the image.byte[]Gets the image file data.intGets the image height.Gets the image orientation.Gets the image type.intGets the image width.intGets the maximum file size of an image.intGets the maximum width or height allowed for a user selected image.intGets the minimum width or height allowed for a user selected image.Gets the original image file name when the user selected the image.Gets the supported image formats.protected IClientUploadAPIGets the file upload API of the client session this component belongs to.protected UploadChannelPropsGets the upload channel of the client session this component belongs to: where a request that cannot be read is answered, since noUploadRequestexists to refuse.Gets the viewport size.doubleGets the image zoom factor.booleanReturns if the component has implicit component horizontal fill.booleanReturns if the component has implicit component vertical fill.booleanisCircle()Gets if the selected cropping area is a circle or of rectangular shape.booleanReturns if the component can show the context menu in mobile mode.booleanGets if the upload progress bar is shown: a thin bar along the bottom edge while the image file the user picked is uploaded, so that the crop area stays usable.booleanDoes this component require an explicitly defined height?booleanDoes this component require an explicitly defined width?booleanDoes this component require a height?booleanDoes this component require a width?voidonEventSelf(GEvent event) Self events.protected voidCalled when a property is disposed of by delete/remove in a container, or by the dispose method.voidonRemoteEvent(RemoteEvent event) Called when a remote property event should be processed by this property.booleanremoveListener(IUIImage2Listener listener) Removes a listener for changes in this image property.booleansetCircle(boolean isCircle) Gets if the selected cropping area is a circle or of rectangular shape.booleansetImage(IImageTarget image) Sets the image.booleansetImageFileData(String fileName, byte[] data) Sets the image file data and the original file name (path is removed).booleansetMaximumFileSize(int size) Sets the maximum file size of an image.booleansetMinMaxWidthOrHeight(int min, int max) Sets the minimum and maximum width or height allowed for a user selected image.booleansetShowProgress(boolean isShown) Sets if the upload progress bar is shown.booleansetSupportedImageTypes(String types) Sets the supported image types.booleansetViewport(GSize size) Sets the viewport size.booleansetZoomFactor(double zoomFactor) Sets the image zoom factor.protected booleanshouldSerializeToXML(int programType, GProp<?> childProp) Method used to check for child property serialization to XML.booleanverify(PropVerification verification) Verifies this property container.Methods inherited from class UIComp
add, addMappings, assignFontInfoResolver, canAcceptUIContainerFocus, canFillX, canFillY, canRequestFocus, canRequestFocus, clearErrorMessage, couldRequestFocusIfVirtualized, createStyles, createTitleProp, disconnectVSField, doUpdateVSFieldFromUIComponent, enterVSProcessing, exitVSProcessing, fireSelection, fireSelection, forbiddenGetCustomDataMap, getBadge, getBestVSFieldValueType, getComponentID, getComponentMappings, getCSSClassNames, getErrorMessage, getErrorMessage, getErrorMessageEx, getErrorMessageString, getErrorMessageString, getErrorMessageStringEx, getFirstContainerVSStateFocus, getFixHeight, getFixWidth, getFontInfo, getForcedAlignX, getForcedAlignY, getKStringText, getLayout, getLayoutMgr, getLayoutMgr, getMappedVSComponent, getMessage, getMessageText, getPixelHeight, getPixelWidth, getPredefinedProps, getSize, getStyles, getStyles, getText, getTitle, getTitleKS, getTitlePKS, getTooltip, getTooltipText, getTrigger, getUIPanel, getUIParent, getValue, getValue, getVirtualSpace, getVSField, getVSStateFocus, hasExplicitHeight, hasExplicitWidth, hasFocus, hasImplicitHeight, hasImplicitWidth, hasSelectionChanged, initPropCnr, invokeOnUICreateTree, isEnabled, isMobile, isReadOnly, isRTL, isVisible, isVSFieldDisconnected, onBroken, onComponentSelectedInParent, onFocusGained, onNotifySelectionChanged, onParentStateChanged, onPrepare, onPrepare, onResolved, onSelectionChanged, onStateChanged, onValueChanged, processVSComponentSelection, reconnectVSField, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusEx, requestFocusEx, requestFocusEx, requestFocusEx, resetComponentID, setBadge, setBadge, setComponentToVSField, setCSSClassNames, setCSSClassNames2, setEnabled, setEnabled, setErrorMessage, setErrorMessage, setErrorMessage, setErrorMessage, setHTMLText, setLayoutMgr, setMessage, setMessage, setReadOnly, setReadOnly, setText, setText, setTitle, setTitle, setTitle, setTooltip, setTooltip, setUIContainerFocus, setVisible, setVisible, setVSFieldMessageToComponent, setVSFieldToComponent, verifyComponentScopeMethods inherited from class PropCnr
__transferChildProps, addPredefinedProps, addProp, addProp, addProp2, addProp2, appendPropValue, completeVirtualize, containsProp, containsProp, convertLoadedProp, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, 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, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializePropTree, initializeValue, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, isPropValueTreeLockNeeded, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropRemoved, onPropTreeInitialized, onReferenceEvent, onVirtualContainerCreated, onVirtualizationCompleted, 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, toElementString, toNativeValue0, usePropHashMap, usesPropIndex, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verifyInternalUseOnly, verifyTree, virtualizeMethods inherited from class GProp
addPropError, addPropListener, appendProp, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, 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, getReferencePropNameNoAssert, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParentNoAssert, getTreeLock, hasChanged, hasCircularReferencesError, hashCode, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropErrorPersisted, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropForEditorAtCreation, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropRootLoading, isPropRootTreeModificationsAllowed, isPropSaveRelevant, isPropSecret, isPropSecretCapable, isPropUSER, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, isSibling, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onInitialize, onPropInvalidateCache, onPropParentChanged, onPropValueSet, paramString, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropSecret, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toShortString, toShortString, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from interface IComponent
messageBoxMethods inherited from interface ICustomDataProvider
getCustomData, putCustomData, putCustomDataIfAbsentMethods inherited from interface IFocusComp
requestFocus, requestFocus, requestFocusEx, requestFocusExMethods inherited from interface 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, getRelativePropName, getRootParent, getTreeLock, getValueClasses, getVSReference, hasChanged, hasCircularReferencesError, 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, isSibling, 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, warning, warning, warningMethods inherited from interface IMessageBox
messageBox, messageBox, messageBoxMethods inherited from interface IPropCnr
addProp, addProp, addProp2, addProp2, canRequestFocus, canRequestFocus, canRequestFocus, containsProp, containsProp, couldRequestFocusIfVirtualized, 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, hasFocus, initializeExtendsFramework, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsRoot, isPropAddRemoveAllowed, isPropExtended, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, requestFocus, requestFocusEx, 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, validateClassInstancesMethods inherited from interface IUIComp
getContainerFirstUIComponent, getContainerFirstUIComponentNull, getFirstUIComponent, getFirstUIComponentNull, getPanelUIComponent, getPanelUIComponentNull, getUIRefMethods inherited from interface IUIContextMenuOwner
getContainedContextMenu, getContextMenu, getReferencedContextMenu, isContextMenuSupported, onBroken, onResolvedMethods inherited from interface IUIFocusComp
onFocusGained, onFocusLost
Field Details
DEFAULT_VIEWPORT_SIZE
The default viewport size: 100x100.DEFAULT_SUPPORTED_IMAGE_TYPES
The default supported image types and file etensions: ".jpg,.jpeg,image/jpeg,.png,image/png".- See Also:
REMOTE_REQUEST
public static final int REMOTE_REQUESTThe remote event of the client asking to upload the image file the user picked: its parameters are the upload channel's request (UploadChannelProps.encodeReserve(int, List, boolean, String)). Event 1 (image selected) and event 2 (crop, zoom or orientation changed) are older.- See Also:
UPLOAD_TYPES
The media types an image file is uploaded as, whatever the supported image types say: "image/png,image/jpeg". The reservation is narrowed to them on the verified type.- See Also:
REASON_REPLACED
The reason the upload in flight is cancelled with when the value of the component is replaced from the server, by code or a VirtualSpace: "replaced".- See Also:
REASON_DISPOSED
The reason the upload in flight is cancelled with when the component is disposed of: "disposed".- See Also:
Constructor Details
UIImage2
public UIImage2()Creates the component without a name. The name must be set in all cases using thesetPropertyAtomcall.UIImage2
Creates the component with the specified name. All system-reserved names for components begins with "$".- Parameters:
propertyAtom- the name of the component, unique within it's parent.
UIImage2
Creates the component with the specified name, initialized to contain theGPropitems. All system-reserved names for components begins with "$".- Parameters:
propertyAtom- The name of the component, unique within it's parent.newValue- The array of all properties the component should have.- Throws:
PropException- when at least one of the properties to initialize the component with is invalid.
Method Details
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!
shouldSerializeToXML
Method used to check for child property serialization to XML. Override this method and return false to avoid writing the child property to XML. The default is to write all properties.- Overrides:
shouldSerializeToXMLin classPropCnr- Parameters:
programType- From PropFactory.getProgramType(): 0=PropFactory.CLIENT, 1=PropFactory.SERVERor 2=PropFactory.EDITOR.childProp- The child property.- Returns:
- true (default if not VOLATILE) to save to XML, false to avoid writing the property to XML.
getDeviceType
public final int getDeviceType()Gets the device type: -1=mobile, 0=both, 1=desktop.- Specified by:
getDeviceTypein interfaceIUIComp
isMobileContextMenuSupported
public boolean isMobileContextMenuSupported()Returns if the component can show the context menu in mobile mode.- Specified by:
isMobileContextMenuSupportedin interfaceIUIContextMenuOwner- Returns:
- Image crop and upload component does NOT support context menus for mobile.
onEventSelf
Self events.- Specified by:
onEventSelfin interfaceIGProp<GProp<?>[]>- Overrides:
onEventSelfin classUIComp- Parameters:
event- The event.
onRemoteEvent
Called when a remote property event should be processed by this property.- Specified by:
onRemoteEventin interfaceIGProp<GProp<?>[]>- Overrides:
onRemoteEventin classUIComp- Parameters:
event- The remote event.
getUploadAPI
Gets the file upload API of the client session this component belongs to.- Returns:
- The API, or null if the component is not in the panel tree of a server client session.
getUploadChannel
Gets the upload channel of the client session this component belongs to: where a request that cannot be read is answered, since noUploadRequestexists to refuse.- Returns:
- The channel, or null if the client created none or the component is not in the panel tree of a client session.
onPropDispose
protected void onPropDispose()Called when a property is disposed of by delete/remove in a container, or by the dispose method.The upload in flight is cancelled with the reason
REASON_DISPOSED(ruling row 16): the crop, the zoom and the listeners belong to this instance. A received file the client has not selected is deleted, and the link of this component is removed from the upload API.- Overrides:
onPropDisposein classUIComp
mustHaveWidth
public boolean mustHaveWidth()Does this component require a width?- Overrides:
mustHaveWidthin classUIComp- Returns:
- true if the width must be defined and non-zero, false otherwise.
mustHaveHeight
public boolean mustHaveHeight()Does this component require a height?- Overrides:
mustHaveHeightin classUIComp- 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?- Overrides:
mustHaveExplicitWidthin classUIComp- 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?- Overrides:
mustHaveExplicitHeightin classUIComp- Returns:
- true if the height must be defined and non-zero, false otherwise.
hasImplicitAlignFillX
public boolean hasImplicitAlignFillX()Returns if the component has implicit component horizontal fill.- Overrides:
hasImplicitAlignFillXin classUIComp- Returns:
- Always true: true means component will always fill the space in X.
hasImplicitAlignFillY
public boolean hasImplicitAlignFillY()Returns if the component has implicit component vertical fill.- Overrides:
hasImplicitAlignFillYin classUIComp- Returns:
- Always: true means component will always fill the space in Y.
canAlignX
canAlignY
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:
getApproximateSizein classUIComp- Returns:
- The size of the image and when no image is set 64x64.
addListener
Adds a new listener for changes in this image property. Calling this method multiple times with the same listener will have no effect (but to return false).- Parameters:
listener- The listener to add.- Returns:
- true if the listener was added, false otherwise.
- Throws:
NullPointerException- If the listener isnull.
removeListener
Removes a listener for changes in this image property.- Parameters:
listener- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
getImage
setImage
Sets the image.When setting the image (assuming
imageis notnull):- the image width, height, user selected image file data is cleared.
- The file type will match the set image file name extension as "jpeg"/"jpg" or "png".
- The image orientation will be reset to default "NO_CHANGE".
- The user selected original file name will also be cleared.
- Crop points will be reset.
- Parameters:
image- The image, null for none.- Returns:
- true for changed (or the original file name is cleared, or the file image data is cleared), false for no change.
- Throws:
IllegalArgumentException- If image type is not of bitmap type, i.e. it's an SVG or FontIcon.
setViewport
Sets the viewport size.- Parameters:
size- The viewport size, or null for default 100x100.- Returns:
- true if changed, false otherwise.
- Throws:
IllegalArgumentException- If any size is less than 10 or larger than 99999.
getViewport
getZoomFactor
public double getZoomFactor()Gets the image zoom factor.- Returns:
- A double value for the zoom, greater than zero, defaults to
1d.
setZoomFactor
public boolean setZoomFactor(double zoomFactor) Sets the image zoom factor.- Parameters:
zoomFactor- A double value for the zoom, greater than zero, defaults to1d.- Returns:
- true if changed, false otherwise.
- Throws:
IllegalArgumentException- If the zoom factor is zero or less.
isCircle
public boolean isCircle()Gets if the selected cropping area is a circle or of rectangular shape.- Returns:
trueif circular,falseif rectangular shaped.
setCircle
public boolean setCircle(boolean isCircle) Gets if the selected cropping area is a circle or of rectangular shape.- Parameters:
isCircle- Flag for circle cropping area:trueif circular,falseif rectangular shaped.- Returns:
trueif changed,falsefor no change.
isShowProgress
public boolean isShowProgress()Gets if the upload progress bar is shown: a thin bar along the bottom edge while the image file the user picked is uploaded, so that the crop area stays usable.- Returns:
true(default) if shown.
setShowProgress
public boolean setShowProgress(boolean isShown) Sets if the upload progress bar is shown.- Parameters:
isShown-true(default) to show it.- Returns:
trueif changed,falsefor no change.
getMinimumWidthOrHeight
public int getMinimumWidthOrHeight()Gets the minimum width or height allowed for a user selected image.- Returns:
- The minimum width or height, zero for no minimum, default is 50.
getMaximumWidthOrHeight
public int getMaximumWidthOrHeight()Gets the maximum width or height allowed for a user selected image.- Returns:
- The maximum width or height, zero for no maximum, default is 4096.
setMinMaxWidthOrHeight
public boolean setMinMaxWidthOrHeight(int min, int max) Sets the minimum and maximum width or height allowed for a user selected image.- Parameters:
min- The minimum width or height, zero for no minimum, default is 50.max- The maximum width or height, zero for no maximum, default is 4096.- Returns:
trueif changed,falsefor no change.- Throws:
IllegalArgumentException- Ifminormaxis less than zero, or ifminis larger thanmax.
getMaximumFileSize
public int getMaximumFileSize()Gets the maximum file size of an image.- Returns:
- The maximum file size, default 5 MB (5_242_880 bytes).
setMaximumFileSize
public boolean setMaximumFileSize(int size) Sets the maximum file size of an image.- Parameters:
size- The maximum file size, default 5 MB (5_242_880 bytes).- Returns:
trueif changed,falsefor no change.- Throws:
IllegalArgumentException- Ifsizeis zero or less, or larger than 8 MB (8_388_608 bytes).
getImageFileData
public byte[] getImageFileData()Gets the image file data.An image the user picks is uploaded through the upload service and handed to
IUIImage2Listener.onImageSelection(UIImage2, String, ImageType, byte[], int, int, ImageOrientation, double, GRect, boolean)only: it is not kept as the value of the component, so this method returnsnullfor it (ruling UU-21). It returns the data set withsetImageFileData(String, byte[]), and the data of an image the client sent over the WebSocket where the client session cannot upload.- Returns:
- The file data byte array,
nullif image source is not user selected.
setImageFileData
Sets the image file data and the original file name (path is removed). Only valid file extensions can be specified.The image replaces the one shown as a fresh image: the previous
IImageTarget, and the size, orientation, crop points and zoom of the image that went are removed with the data, as they are when the data is cleared, so that the client binds the new image centred with the zoom limits of its own size (UIIMAGE2-REPLACE-KEEPS-OLD-TRANSFORM).- Parameters:
fileName- The file name (ignored ifdataisnull.data- The file data byte array,nullto clear it so that the user can select an image.- Returns:
- true for changed (original file name, file image data, previous
IImageTarget, width, height, orientation, crop points and/or zoom), false for no change. - Throws:
IllegalArgumentException- If the file extension is not '.png', '.jpg' or '.jpeg', or if the image cannot be decoded in the media formats 'image/jpeg' or 'image/png'.NullPointerException- If thefileNameisnullanddatais present.
getImageWidth
public int getImageWidth()Gets the image width.- Returns:
- The image width, zero if image source is not user selected.
getImageHeight
public int getImageHeight()Gets the image height.- Returns:
- The image height, zero if image source is not user selected.
getImageType
getSupportedImageTypes
Gets the supported image formats.- Returns:
- A string with supported image formats separated by comma. It is a combination of file extensions if the string starts with a '.' (dot). Otherwise it is a media file type such as 'image/jpeg' and/or 'image/png'. The default is list is:
- .jpg
- .jpeg
- image/jpeg
- .png
- image/png
setSupportedImageTypes
Sets the supported image types.- Parameters:
types- The string with supported image formats separated by comma. It is a combination of file extensions if the string starts with a '.' (dot). Otherwise it is a media file type such as 'image/jpeg' and/or 'image/png'. Accepted values are case sensitive and are:- .jpg
- .jpeg
- image/jpeg
- .png
- image/png
A
nulloremptystring will set the default types.- Returns:
- true if changed, false for no change.
- Throws:
IllegalArgumentException- If an invalid image media type is found, or a file extension is invalid, or if the string is not in lower case.
getImageOrientation
Gets the image orientation.- Returns:
- The image orientation.
getOriginalImageFileName
Gets the original image file name when the user selected the image.- Returns:
- The file name,
nullif image source is not user selected.
verify
Verifies this property container. The check performed is the extension of classes and that no circular reference is present.