Interface ICropper
-
- All Superinterfaces:
IAnyGroup<ICropper>,IComponent<ICropper>,IHtmlBasedComponent<ICropper>
public interface ICropper extends IHtmlBasedComponent<ICropper>, IAnyGroup<ICropper>
ImmutableCroppercomponentAn image cropper that can select a range to get the cropped result.
Support @Action
Name Action Type onChange Denotes user has resized the selected range. onChanging Denotes user is resizing the selected range. onCrop ActionData: FileData
Denotes user has cropped the image.- Author:
- katherine
- See Also:
Cropper
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classICropper.BuilderBuilds instances of typeICropper.static classICropper.CrossoriginSpecifies the crossorigin setting withwithCrossorigin(Crossorigin)static classICropper.UpdaterBuilds an updater of typeICropperforUiAgent.smartUpdate(Locator, SmartUpdater).
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default doublegetAspectRatio()Returns the aspect ratio of the cropped area.org.zkoss.image.ImagegetContent()Returns the content set bywithContent(org.zkoss.image.Image).default java.lang.StringgetCroppedFormat()Returns the cropped image format, e.g.,"image/png","image/jpeg".java.lang.StringgetCrossorigin()Returns the crossorigin of the img of this cropper, could be"anonymous","use-credentials"ornull.default intgetH()Returns the height of the crop area in pixel.default intgetMaxHeight()Returns the maximum height of the selected crop area.default intgetMaxWidth()Returns the maximum width of the selected crop area.default intgetMinHeight()Returns the minimum height of the selected crop area.default intgetMinWidth()Returns the minimum width of the selected crop area.java.lang.StringgetSrc()Returns the source URI of the image.default intgetW()Returns the width of the crop area in pixel.default java.lang.StringgetWidgetClass()Returns the client widget class.default intgetX()Returns the left position of the crop area relates to the left edge of the child image in pixel.default intgetY()Returns the top position of the crop area relates to the top edge of the child image in pixel.default booleanisInstant()Returns whether to send back onChange action immediately while the user is resizing the selected area.default booleanisToolbarVisible()Returns whether the toolbar is visible.static ICropperof(java.lang.String src)Returns the instance with the givensrc.static ICropperof(java.lang.String src, int x, int y, int w, int h)Returns the instance with the given src, x, y, w, and h.static ICropperofId(java.lang.String id)Returns the instance with the given id.static ICropperofSize(int x, int y, int w, int h)Returns the instance with the given size, x, y, w, and h.ICropperwithAspectRatio(double aspectRatio)Returns a copy ofthisimmutable component with the specifiedaspectRatio.default ICropperwithContent(java.awt.image.RenderedImage image)Returns a copy ofthisimmutable component with the specifiedimage.ICropperwithContent(org.zkoss.image.Image image)Returns a copy ofthisimmutable component with the specifiedimage.ICropperwithCroppedFormat(java.lang.String croppedFormat)Returns a copy ofthisimmutable component with the specifiedcroppedFormat.ICropperwithCrossorigin(java.lang.String crossorigin)Returns a copy ofthisimmutable component with the specifiedcrossorigin.default ICropperwithCrossorigin(ICropper.Crossorigin crossorigin)Returns a copy ofthisimmutable component with the specifiedcrossorigin.ICropperwithH(int h)Returns a copy ofthisimmutable component with the specifiedh.ICropperwithInstant(boolean instant)Returns a copy ofthisimmutable component with the specifiedinstant.ICropperwithMaxHeight(int maxHeight)Returns a copy ofthisimmutable component with the specifiedmaxHeight.ICropperwithMaxWidth(int maxWidth)Returns a copy ofthisimmutable component with the specifiedmaxWidth.ICropperwithMinHeight(int minHeight)Returns a copy ofthisimmutable component with the specifiedminHeight.ICropperwithMinWidth(int minWidth)Returns a copy ofthisimmutable component with the specifiedminWidth.ICropperwithSrc(java.lang.String src)Returns a copy ofthisimmutable component with the specifiedsrc.ICropperwithToolbarVisible(boolean toolbarVisible)Returns a copy ofthisimmutable component with the specifiedtoolbarVisible.ICropperwithW(int w)Returns a copy ofthisimmutable component with the specifiedw.ICropperwithX(int x)Returns a copy ofthisimmutable component with the specifiedx.ICropperwithY(int y)Returns a copy ofthisimmutable component with the specifiedy.-
Methods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverrides
-
Methods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndex
-
-
-
-
Field Detail
-
DEFAULT
static final ICropper DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Detail
-
getWidgetClass
default java.lang.String getWidgetClass()
Returns the client widget class.Default:
"zkmax.cropper.Cropper"- Specified by:
getWidgetClassin interfaceIComponent<ICropper>
-
getCrossorigin
@Nullable java.lang.String getCrossorigin()
Returns the crossorigin of the img of this cropper, could be"anonymous","use-credentials"ornull.Default:
null.
-
withCrossorigin
ICropper withCrossorigin(@Nullable java.lang.String crossorigin)
Returns a copy ofthisimmutable component with the specifiedcrossorigin.Sets the crossorigin of the img of this cropper, could be
"anonymous","use-credentials"ornull.- Parameters:
crossorigin- The crossorigin of the img of this cropper, could be"anonymous","use-credentials"ornull.Default:
null.- Returns:
- A modified copy of the
thisobject
-
withCrossorigin
default ICropper withCrossorigin(@Nullable ICropper.Crossorigin crossorigin)
Returns a copy ofthisimmutable component with the specifiedcrossorigin.Sets the crossorigin of the img of this cropper, could be
"anonymous","use-credentials"ornull.- Parameters:
crossorigin- The crossorigin of the img of this cropper, could be"anonymous","use-credentials"ornull.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getContent
@Nullable org.zkoss.image.Image getContent()
Returns the content set bywithContent(org.zkoss.image.Image).Note: it won't fetch what is set through by
withSrc(String). It simply returns what is passed towithContent(org.zkoss.image.Image).
-
withContent
ICropper withContent(@Nullable org.zkoss.image.Image image)
Returns a copy ofthisimmutable component with the specifiedimage.Sets the content directly.
Default:
null.Calling this method implies
withSrc(null). In other words, the invocation ofwithContent(org.zkoss.image.Image)overrides thewithSrc(String), if any.- Parameters:
image- The image to display.- Returns:
- A modified copy of
thisobject - See Also:
withSrc(String)
-
withContent
default ICropper withContent(@Nullable java.awt.image.RenderedImage image)
Returns a copy ofthisimmutable component with the specifiedimage.Sets the content directly with the rendered image. It actually encodes the rendered image to an PNG image (
Image) withImages.encode(java.lang.String, java.awt.image.RenderedImage, float, boolean), and then invokewithContent(org.zkoss.image.Image)}.If you want more control such as different format, quality, and naming, you can use
Imagesdirectly.- Parameters:
image- The image to display.- Returns:
- A modified copy of
thisobject
-
getAspectRatio
default double getAspectRatio()
Returns the aspect ratio of the cropped area.Default:
0Means the ratio has no restrict
-
withAspectRatio
ICropper withAspectRatio(double aspectRatio)
Returns a copy ofthisimmutable component with the specifiedaspectRatio.Sets the aspect ratio of the selected area.
- Parameters:
aspectRatio- The aspect ratio of the selected area.Default:
0- Returns:
- A modified copy of
thisobject
-
getMinWidth
default int getMinWidth()
Returns the minimum width of the selected crop area.Default:
0
-
withMinWidth
ICropper withMinWidth(int minWidth)
Returns a copy ofthisimmutable component with the specifiedminWidth.Sets the minimum width of the selected crop area.
- Parameters:
minWidth- The minimum width of the selected crop area.Default:
0- Returns:
- A modified copy of
thisobject
-
getMinHeight
default int getMinHeight()
Returns the minimum height of the selected crop area.Default:
0
-
withMinHeight
ICropper withMinHeight(int minHeight)
Returns a copy ofthisimmutable component with the specifiedminHeight.Sets the minimum height of the selected crop area.
- Parameters:
minHeight- The minimum height of the selected crop area.Default:
0- Returns:
- A modified copy of
thisobject
-
getMaxWidth
default int getMaxWidth()
Returns the maximum width of the selected crop area.Default:
0
-
withMaxWidth
ICropper withMaxWidth(int maxWidth)
Returns a copy ofthisimmutable component with the specifiedmaxWidth.Sets the maximum width of the selected crop area.
- Parameters:
maxWidth- The maximum width of the selected crop area.Default:
0- Returns:
- A modified copy of
thisobject
-
getMaxHeight
default int getMaxHeight()
Returns the maximum height of the selected crop area.Default:
0
-
withMaxHeight
ICropper withMaxHeight(int maxHeight)
Returns a copy ofthisimmutable component with the specifiedmaxHeight.Sets the maximum height of the selected crop area.
- Parameters:
maxHeight- The maximum height of the selected crop area.Default:
0- Returns:
- A modified copy of
thisobject
-
getX
default int getX()
Returns the left position of the crop area relates to the left edge of the child image in pixel.Default:
0
-
withX
ICropper withX(int x)
Returns a copy ofthisimmutable component with the specifiedx.Sets the left position of the crop area relates to the left edge of the child image in pixel.
- Parameters:
x- The left position of the crop areaDefault:
0- Returns:
- A modified copy of
thisobject
-
getY
default int getY()
Returns the top position of the crop area relates to the top edge of the child image in pixel.Default:
0
-
withY
ICropper withY(int y)
Returns a copy ofthisimmutable component with the specifiedy.Sets the top position of the crop area relates to the top edge of the child image in pixel.
- Parameters:
y- The top position of the crop areaDefault:
0- Returns:
- A modified copy of
thisobject
-
getW
default int getW()
Returns the width of the crop area in pixel.Default:
0
-
withW
ICropper withW(int w)
Returns a copy ofthisimmutable component with the specifiedw.Sets the width of the crop area in pixel.
- Parameters:
w- The width of the crop area in pixel.Default:
0- Returns:
- A modified copy of
thisobject
-
getH
default int getH()
Returns the height of the crop area in pixel.Default:
0
-
withH
ICropper withH(int h)
Returns a copy ofthisimmutable component with the specifiedh.Sets the height of the crop area in pixel.
- Parameters:
h- The height of the crop area in pixel.Default:
0- Returns:
- A modified copy of
thisobject
-
isToolbarVisible
default boolean isToolbarVisible()
Returns whether the toolbar is visible.Default:
true
-
withToolbarVisible
ICropper withToolbarVisible(boolean toolbarVisible)
Returns a copy ofthisimmutable component with the specifiedtoolbarVisible.Sets whether the toolbar is visible.
- Parameters:
toolbarVisible- Whether the toolbar is visible.Default:
true- Returns:
- A modified copy of
thisobject
-
getCroppedFormat
default java.lang.String getCroppedFormat()
Returns the cropped image format, e.g.,"image/png","image/jpeg". If the requested type is invalid or unspecified, it will use"image/png".Default:
"image/png".
-
withCroppedFormat
ICropper withCroppedFormat(java.lang.String croppedFormat)
Returns a copy ofthisimmutable component with the specifiedcroppedFormat.Sets the cropped image format, e.g.,
"image/png","image/jpeg". If the requested type is invalid or unspecified, it will use"image/png".- Parameters:
croppedFormat- The cropped image format.Default:
"image/png"- Returns:
- A modified copy of
thisobject
-
isInstant
default boolean isInstant()
Returns whether to send back onChange action immediately while the user is resizing the selected area.Default:
false
-
withInstant
ICropper withInstant(boolean instant)
Returns a copy ofthisimmutable component with the specifiedinstant.Sets whether to send back onChange action immediately while the user is resizing the selected area.
- Parameters:
instant- Whether to send back onChange action immediately while the user is resizing the selected area.Default:
"image/png"- Returns:
- A modified copy of
thisobject
-
getSrc
@Nullable java.lang.String getSrc()
Returns the source URI of the image.Default:
null.
-
withSrc
ICropper withSrc(@Nullable java.lang.String src)
Returns a copy ofthisimmutable component with the specifiedsrc.Sets the source URI of the image.
- Parameters:
src- The URI of the image source- Returns:
- A modified copy of
thisobject - See Also:
withContent(org.zkoss.image.Image),withContent(RenderedImage)
-
of
static ICropper of(java.lang.String src)
Returns the instance with the givensrc.- Parameters:
src- The URI of the image source.
-
of
static ICropper of(java.lang.String src, int x, int y, int w, int h)
Returns the instance with the given src, x, y, w, and h.- Parameters:
src- The URI of the image sourcex- The left position of the crop areay- The top position of the crop areaw- The width of the crop areah- The height of the crop area
-
ofSize
static ICropper ofSize(int x, int y, int w, int h)
Returns the instance with the given size, x, y, w, and h.- Parameters:
x- The left position of the crop areay- The top position of the crop areaw- The width of the crop areah- The height of the crop area
-
ofId
static ICropper ofId(java.lang.String id)
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-
-