Package com.iizix.prop.ui
Class UIImage2
java.lang.Object
com.iizix.prop.GProp<GProp<?>[]>
com.iizix.prop.PropCnr
com.iizix.prop.ui.UIComp
com.iizix.prop.ui.UIImage2
- All Implemented Interfaces:
EventListener
,IFocusComp
,IMessageBox
,IComponent
,ICustomDataProvider
,IGProp<GProp<?>[]>
,IPropCnr
,IUIComp
,IUIContextMenuOwner
,IUIFocusComp
,IVSComponentListener
,IVSComponentState
,IVSFieldListener
,Cloneable
- Direct Known Subclasses:
EUIImage2
Image Crop and Upload UI component.
- 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
Modifier and TypeFieldDescriptionstatic final String
The default supported image types and file etensions: ".jpg,.jpeg,image/jpeg,.png,image/png".static final GSize
The default viewport size: 100x100.Fields inherited from class com.iizix.prop.ui.UIComp
EMPTY, REMOTE_FOCUS_EVENT, styles, vsField
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_INCLUDE_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
Method Summary
Modifier and TypeMethodDescriptionboolean
addListener
(IUIImage2Listener listener) Adds a new listener for changes in this image property.boolean
Returns if the component can be aligned left, right, center, or horizontal fill.boolean
Returns 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 int
Gets the device type: -1=mobile, 0=both, 1=desktop.getImage()
Gets the image.byte[]
Gets the image file data.int
Gets the image height.Gets the image orientation.Gets the image type.int
Gets the image width.int
Gets the maximum file size of an image.int
Gets the maximum width or height allowed for a user selected image.int
Gets 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.Gets the viewport size.double
Gets the image zoom factor.boolean
Returns if the component has implicit component horizontal fill.boolean
Returns if the component has implicit component vertical fill.boolean
isCircle()
Gets if the selected cropping area is a circle or of rectangular shape.boolean
Returns if the component can show the context menu in mobile mode.boolean
Does this component require an explicitly defined height?boolean
Does this component require an explicitly defined width?boolean
Does this component require a height?boolean
Does this component require a width?void
onEventSelf
(GEvent event) Self events.void
onRemoteEvent
(RemoteEvent event) Called when a remote property event should be processed by this property.boolean
removeListener
(IUIImage2Listener listener) Removes a listener for changes in this image property.boolean
setCircle
(boolean isCircle) Gets if the selected cropping area is a circle or of rectangular shape.boolean
setImage
(IImageTarget image) Sets the image.boolean
setImageFileData
(String fileName, byte[] data) Sets the image file data and the original file name (path is removed).boolean
setMaximumFileSize
(int size) Sets the maximum file size of an image.boolean
setMinMaxWidthOrHeight
(int min, int max) Sets the minimum and maximum width or height allowed for a user selected image.boolean
setSupportedImageTypes
(String types) Sets the supported image types.boolean
setViewport
(GSize size) Sets the viewport size.boolean
setZoomFactor
(double zoomFactor) Sets the image zoom factor.protected boolean
shouldSerializeToXML
(int programType, GProp<?> childProp) Method used to check for child property serialization to XML.boolean
verify
(PropVerification verification) Verifies this property container.Methods inherited from class com.iizix.prop.ui.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, onPropDispose, 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, verifyComponentScope
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, 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, initializeValue, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, 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, virtualize
Methods inherited from class com.iizix.prop.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, 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, isPropRootLoading, isPropRootTreeModificationsAllowed, isPropUSER, isPropValueTreeLockNeeded, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, isSibling, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, 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, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, 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.gyro.IFocusComp
requestFocus, requestFocus, requestFocusEx, requestFocusEx
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, 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, warning
Methods inherited from interface com.iizix.gyro.IMessageBox
messageBox, messageBox, messageBox
Methods inherited from interface com.iizix.prop.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, validateClassInstances
Methods inherited from interface com.iizix.prop.ui.IUIComp
getContainerFirstUIComponent, getContainerFirstUIComponentNull, getFirstUIComponent, getFirstUIComponentNull, getPanelUIComponent, getPanelUIComponentNull, getUIRef
Methods inherited from interface com.iizix.prop.ui.IUIContextMenuOwner
getContainedContextMenu, getContextMenu, getReferencedContextMenu, isContextMenuSupported, onBroken, onResolved
Methods inherited from interface com.iizix.prop.ui.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:
Constructor Details
UIImage2
public UIImage2()Creates the component without a name. The name must be set in all cases using thesetPropertyAtom
call.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 theGProp
items. All system-reserved names for components begins with "$".- Parameters:
propertyAtom
- The name of the component, unique within it's parent.newValue
- The array of all properties the component should have.- Throws:
PropException
- when at least one of the properties to initialize the component with is invalid.
Method Details
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:
shouldSerializeToXML
in classPropCnr
- Parameters:
programType
- From PropFactory.getProgramType(): 0=PropFactory.CLIENT
, 1=PropFactory.SERVER
or 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:
getDeviceType
in interfaceIUIComp
isMobileContextMenuSupported
public boolean isMobileContextMenuSupported()Returns if the component can show the context menu in mobile mode.- Specified by:
isMobileContextMenuSupported
in interfaceIUIContextMenuOwner
- Returns:
- Image crop and upload component does NOT support context menus for mobile.
onEventSelf
Self events.- Specified by:
onEventSelf
in interfaceIGProp<GProp<?>[]>
- Overrides:
onEventSelf
in classUIComp
- Parameters:
event
- The event.
onRemoteEvent
Called when a remote property event should be processed by this property.- Specified by:
onRemoteEvent
in interfaceIGProp<GProp<?>[]>
- Overrides:
onRemoteEvent
in classUIComp
- Parameters:
event
- The remote event.
mustHaveWidth
public boolean mustHaveWidth()Does this component require a width?- Overrides:
mustHaveWidth
in 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:
mustHaveHeight
in 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:
mustHaveExplicitWidth
in 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:
mustHaveExplicitHeight
in 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:
hasImplicitAlignFillX
in 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:
hasImplicitAlignFillY
in classUIComp
- Returns:
- Always: true means component will always fill the space in Y.
canAlignX
public boolean canAlignX()Returns if the component can be aligned left, right, center, or horizontal fill.canAlignY
public boolean canAlignY()Returns if the component can be aligned top, bottom, middle or vertical fill.getApproximateSize
Returns the size of the component in pixels. The size is a calculation and does not exactly reflect the real size that may be different due to additional styles not taken into account by this method. The size is calculated from the font of the component and default or defined values (such as character length or number of lines for text area).- Specified by:
getApproximateSize
in 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
Gets the image.- Returns:
- An image, null for none.
setImage
Sets the image.When setting the image (assuming
image
is 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
Gets the viewport size.- Returns:
- The viewport size.
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:
true
if circular,false
if 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:true
if circular,false
if rectangular shaped.- Returns:
true
if changed,false
for 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:
true
if changed,false
for no change.- Throws:
IllegalArgumentException
- Ifmin
ormax
is less than zero, or ifmin
is 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:
true
if changed,false
for no change.- Throws:
IllegalArgumentException
- Ifsize
is zero or less, or larger than 8 MB (8_388_608 bytes).
getImageFileData
public byte[] getImageFileData()Gets the image file data.- Returns:
- The file data byte array,
null
if 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.- Parameters:
fileName
- The file name (ignored ifdata
isnull
.data
- The file data byte array,null
to 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 thefileName
isnull
anddata
is 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
Gets the image type.- Returns:
- The image type, UNKNOWN for none.
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
null
orempty
string 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,
null
if 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.