public class Cropper extends HtmlBasedComponent
Modifier and Type | Class and Description |
---|---|
protected class |
Cropper.ExtraCtrl |
AbstractComponent.Children
_zclass
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
Constructor and Description |
---|
Cropper() |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
To cancel the selected area.
|
void |
crop()
To crop the selected area.
|
double |
getAspectRatio()
Returns the aspect ratio of the cropped area.
|
java.lang.String |
getCroppedFormat()
Get the cropped image format, e.g., image/png, image/jpeg.
|
AImage |
getCroppedImage()
Returns the cropped image as an
AImage . |
java.lang.String |
getCrossOrigin()
Returns the crossOrigin of the img of this cropper, could be "anonymous", "use-credentials" or null.
|
java.lang.Object |
getExtraCtrl()
Returns the client control for this component.
|
int |
getH()
Returns the height of the crop area in pixel.
|
int |
getMaxHeight()
Returns the maximum height of the selected crop area.
|
int |
getMaxWidth()
Returns the maximum width of the selected crop area.
|
int |
getMinHeight()
Returns the minimum height of the selected crop area.
|
int |
getMinWidth()
Returns the minimum width of the selected crop area.
|
java.lang.String |
getSrc()
Returns the source URI of the image.
|
int |
getW()
Returns the width of the crop area in pixel.
|
int |
getX()
Returns the left position of the crop area relates to the left edge of the child image in pixel.
|
int |
getY()
Returns the top position of the crop area relates to the top edge of the child image in pixel.
|
protected boolean |
isChildable()
Not childable.
|
boolean |
isInstant()
Returns whether to send back onChange event immediately while the user is resizing the selected area.
|
boolean |
isToolbarVisible()
Returns whether the toolbar is visible.
|
void |
move(int deltaX,
int deltaY)
Moves the crop area according to the delta x and y.
|
void |
moveTo(int x,
int y)
Moves the crop area to the specified left and top related position.
|
protected void |
renderProperties(ContentRenderer renderer)
Renders the content of this component, excluding the enclosing
tags and children.
|
void |
resize(int deltaW,
int deltaH)
Resize the crop area according to the delta width and height in pixel.
|
void |
resizeTo(int width,
int height)
Resize the crop area to the specified width and height in pixel.
|
void |
service(AuRequest request,
boolean everError)
Processes an AU request.
|
void |
setAspectRatio(double aspectRatio)
Sets the aspect ratio of the selected area.
|
void |
setContent(Image image)
Sets the content directly.
|
void |
setContent(java.awt.image.RenderedImage image)
Sets the content directly with the rendered image.
|
void |
setCroppedFormat(java.lang.String croppedFormat)
Set the cropped image format, e.g., image/png, image/jpeg.
|
void |
setCrossOrigin(java.lang.String crossOrigin)
Could be "anonymous" or "use-credentials", an invalid string and an empty string will be handled as the "anonymous".
|
void |
setH(int h)
Sets the height of the crop area in pixel.
|
void |
setInstant(boolean instant)
Sets whether to send back onChange event as soon as possible while the user is resizing the selected area.
|
void |
setMaxHeight(int maxHeight)
Sets the maximum height of the selected crop area.
|
void |
setMaxWidth(int maxWidth)
Sets the maximum width of the selected crop area.
|
void |
setMinHeight(int minHeight)
Sets the minimum height of the selected crop area.
|
void |
setMinWidth(int minWidth)
Sets the minimum width of the selected crop area.
|
void |
setSrc(java.lang.String src)
Sets the source URI of the image.
|
void |
setToolbarVisible(boolean toolbarVisible)
Sets the visibility of the cropper toolbar.
|
void |
setW(int w)
Sets the width of the crop area in pixel.
|
void |
setX(int x)
Sets the left position of the crop area relates to the left edge of the child image in pixel.
|
void |
setY(int y)
Sets the top position of the crop area relates to the top edge of the child image in pixel.
|
addSclass, clone, evalCSSFlex, focus, getAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getPropertyAccess, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, invalidatePartial, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
invalidatePartial
public double getAspectRatio()
Default: 0 Means the ratio has no restrict
public void setAspectRatio(double aspectRatio)
Default: 0. Means the ratio has no restrict
aspectRatio
- the ratio of the selected areapublic int getMinWidth()
public void setMinWidth(int minWidth)
minWidth
- the minimum width of the selected crop areapublic int getMinHeight()
public void setMinHeight(int minHeight)
minHeight
- the minimum height of the selected crop areapublic int getMaxWidth()
public void setMaxWidth(int maxWidth)
maxWidth
- the maximum width of the selected crop areapublic int getMaxHeight()
public void setMaxHeight(int maxHeight)
maxHeight
- the maximum height of the selected crop areapublic int getX()
public void setX(int x)
x
- as the left related pixelpublic int getY()
public void setY(int y)
y
- as the top related pixelpublic int getW()
public void setW(int w)
w
- as the width of the crop areapublic int getH()
public void setH(int h)
h
- as the height of the crop areapublic AImage getCroppedImage()
AImage
.AImage
cropped imagepublic boolean isToolbarVisible()
public void setToolbarVisible(boolean toolbarVisible)
toolbarVisible
- true or false to set the visibility of toolbarpublic java.lang.String getCroppedFormat()
Default: null.
public void setCroppedFormat(java.lang.String croppedFormat)
croppedFormat
- cropped image formatpublic java.lang.String getSrc()
Default: null.
public void setSrc(java.lang.String src)
Calling this method implies setContent(null).
In other words, the last invocation of setSrc(java.lang.String)
overrides
the previous setContent(org.zkoss.image.Image)
, if any.
src
- the URI of the image sourcesetContent(org.zkoss.image.Image)
,
setContent(RenderedImage)
public void setContent(Image image)
Default: null.
Calling this method implies setSrc(null).
In other words, the last invocation of setContent(org.zkoss.image.Image)
overrides
the previous setSrc(java.lang.String)
, if any.
image
- the image to display.setSrc(java.lang.String)
public void setContent(java.awt.image.RenderedImage image)
Image
) with Images.encode(java.lang.String, java.awt.image.RenderedImage, float, boolean)
,
and then invoke setContent(org.zkoss.image.Image)
.public java.lang.String getCrossOrigin()
Default: null.
public void setCrossOrigin(java.lang.String crossOrigin)
Could be "anonymous" or "use-credentials", an invalid string and an empty string will be handled as the "anonymous". Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
crossOrigin
- the crossOrigin of the img of this cropper.public boolean isInstant()
public void setInstant(boolean instant)
instant
- public void resize(int deltaW, int deltaH)
deltaW
- the delta width to resizedeltaH
- the delta height to resizepublic void resizeTo(int width, int height)
width
- the width of the crop areaheight
- the height of the crop areapublic void move(int deltaX, int deltaY)
deltaX
- the x difference to movedeltaY
- the y difference to movepublic void moveTo(int x, int y)
x
- the x position to move toy
- the y position to move topublic void crop()
public void cancel()
protected boolean isChildable()
isChildable
in class AbstractComponent
protected void renderProperties(ContentRenderer renderer) throws java.io.IOException
HtmlBasedComponent
renderProperties
in class HtmlBasedComponent
java.io.IOException
public void service(AuRequest request, boolean everError)
HtmlBasedComponent
Default: it handles onClick, onDoubleClick, onRightClick onMove, onSize, onZIndex.
service
in interface ComponentCtrl
service
in class HtmlBasedComponent
everError
- whether any error ever occurred before
processing this request.AbstractComponent.setAuService(org.zkoss.zk.au.AuService)
public java.lang.Object getExtraCtrl()
HtmlBasedComponent
Default: creates an instance of HtmlBasedComponent.ExtraCtrl
.
getExtraCtrl
in interface ComponentCtrl
getExtraCtrl
in class HtmlBasedComponent
Cropper
.ComponentCtrl.getExtraCtrl()
Copyright © 2005-2021 Potix Corporation. All Rights Reserved.