Package de.hsh.graja.util.comment
Class Image
java.lang.Object
de.hsh.graja.util.comment.Content
de.hsh.graja.util.comment.AbstractElementContent
de.hsh.graja.util.comment.Image
- All Implemented Interfaces:
Serializable
This content is rendered as an image.
Example:
BufferedImage image= ...; // create an image new Image(includeSpec, image);
An image content is embedded into HTML as data URL. Currently there is no support to render an image into plain text.
- See Also:
-
Field Summary
Fields inherited from class de.hsh.graja.util.comment.Content
EXCLUSIVE, renderUuid
-
Constructor Summary
ConstructorsConstructorDescriptionImage
(IncludeSpec includeSpec, int width, int height, String base64, String titleText) Create a content with a given include spec and image data.Image
(IncludeSpec includeSpec, RenderedImage img, String titleText) Create a content with a given include spec and image data. -
Method Summary
Modifier and TypeMethodDescriptionboolean
implements the contract ofObject.equals(Object)
.int
hashCode()
implements the contract ofObject.hashCode()
.boolean
void
renderHtmlImpl
(StringBuilder sb, IncludeInfo includeInfo, RenderContext ctx, boolean useJavascript) render content to HTML.void
renderPlainImpl
(StringBuilder appender, IncludeInfo includeInfo, RenderContext ctx) render content to plain text.void
setMargin
(int marginHorizontal, int marginVertical) Set margin.This method is for debugging purposes.Methods inherited from class de.hsh.graja.util.comment.AbstractElementContent
getNestedContents
Methods inherited from class de.hsh.graja.util.comment.Content
click, dehighlight, disableCallerStacktraceRecording, enableCallerStacktraceRecording, excludeGlobally, getIncludeSpec, getRenderUuid, getStackdump, hide, highlight, include, isCallerStacktraceRecordingEnabled, isHidden, isShowing, onClick, onClick, onHide, onHide, onLoad, onLoad, onShow, onShow, registerCallable, renderHtml, renderHtml, renderIdAttribute, renderJavascriptOncePerClass, renderOnClickAttribute, renderPlain, renderPlain, setGlobalIncludeInfo, setHref, setIncludeSpec, show, toString
-
Constructor Details
-
Image
Create a content with a given include spec and image data.- Parameters:
includeSpec
- The include spec of the commentimg
- the image datatitleText
- optional title
-
Image
Create a content with a given include spec and image data.- Parameters:
includeSpec
- The include spec of the commentwidth
- mandatory widthheight
- mandatory heightbase64
- mandatory base64 datatitleText
- optional title
-
-
Method Details
-
getBase64
-
getTitleText
-
setMargin
public void setMargin(int marginHorizontal, int marginVertical) Set margin.- Parameters:
marginHorizontal
- left and right margin in pixelsmarginVertical
- top and bottom margin in pixels
-
isInlineContent
public boolean isInlineContent()- Specified by:
isInlineContent
in classContent
- Returns:
- true
- See Also:
-
toString
Description copied from class:Content
This method is for debugging purposes. -
hashCode
public int hashCode()implements the contract ofObject.hashCode()
. -
equals
implements the contract ofObject.equals(Object)
. -
renderHtmlImpl
public void renderHtmlImpl(StringBuilder sb, IncludeInfo includeInfo, RenderContext ctx, boolean useJavascript) Description copied from class:Content
render content to HTML. This method is meant to be overriden by subclasses.- Specified by:
renderHtmlImpl
in classContent
- Parameters:
sb
- HTML code resultincludeInfo
- controls, which content to be rendered.ctx
- render contextuseJavascript
- if true, the generated HTML code will contain Javascript- See Also:
-
de.hsh.graja.util.comment.Content#renderHtml(StringBuilder, IncludeInfo, RenderContext)
-
renderPlainImpl
Description copied from class:Content
render content to plain text. This method is meant to be overriden by subclasses.- Specified by:
renderPlainImpl
in classContent
- Parameters:
appender
- plain text resultincludeInfo
- controls, which content to be rendered.ctx
- render context (unused).- See Also:
-