|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.droplets.api.Component | +--com.droplets.api.ImageComponent
Component that displays an image. The Image can send events if it is clicked or allow the end user to save the image locally.
The image to be displayed may be specified in one of two ways: using an
absolute URL and the setImageUrl
and getImageUrl()
methods,
or using a Droplets "image name" and setImageSetName
and
getImageSetName()
. An "image name" is the filename of a .gif,
not including the .gif
extension, to be fetched by
the Droplet Client according to skinning rules (from the imagedir or imagejar).
See Skinning
Droplets for details.
You have several choices for how the image should be displayed. Each choice
is represented by a static final constant of type ImageComponent.ImageMode
defined
within this class. See below for a list of those constants and what they
represent.
Inner Class Summary | |
static class |
ImageComponent.ImageMode
Typesafe constant class to represent the different ways in which an image can be displayed in a panel. |
Field Summary | |
static ImageComponent.ImageMode |
IMAGE_CENTER
Centers the image in the component |
static ImageComponent.ImageMode |
IMAGE_FIT
Fits the image to the component's exact size, changing its aspect ratio accordingly. |
static ImageComponent.ImageMode |
IMAGE_SCALE_BOTH
Scales the image to fit the component without changing the aspect ratio |
static ImageComponent.ImageMode |
IMAGE_SCALE_DOWN
Shrinks the image to fit the component, without changing the aspect ratio (doesn't enlarge the image beyond its native size) |
static ImageComponent.ImageMode |
IMAGE_SCALE_UP
Enlarges the image to fit the component, without changing the aspect ratio (doesn't shrink the image below its native size) |
static ImageComponent.ImageMode |
IMAGE_TILE
Tiles the image with the upper left of the component as the tile origin |
static ImageComponent.ImageMode |
IMAGE_TILE_WRT_WINDOW
Tiles the image with the upper left of the enclosing window as the tile origin (WRT = "with respect to") |
Fields inherited from class com.droplets.api.Component |
ANCHOR_CENTER, ANCHOR_EAST, ANCHOR_NORTH, ANCHOR_NORTHEAST, ANCHOR_NORTHWEST, ANCHOR_SOUTH, ANCHOR_SOUTHEAST, ANCHOR_SOUTHWEST, ANCHOR_WEST, FILL_BOTH, FILL_HORIZONTAL, FILL_NONE, FILL_VERTICAL |
Constructor Summary | |
ImageComponent(LayoutPlacement p,
Window window)
Constructs a new ImageComponent. |
Method Summary | |
protected void |
action(java.lang.String action,
java.lang.String args)
Called by the server when the user has performed an action on this component. |
void |
addClickListener(ClickListener l)
Add a listener for the Click event of this component |
ImageComponent.ImageMode |
getImageMode()
Gets the value of the imageMode property. |
java.lang.String |
getImageSetName()
Gets the name of the image set to use for the button. |
java.lang.String |
getImageUrl()
Returns the current URL of the image file. |
boolean |
getIsResizeHandle()
True if dragging the component will resize the window. |
java.lang.String |
getRedirectorURL()
Gets the current value of the Redirector URL. |
boolean |
getSaveOnDoubleClick()
Returns true if the image will allow the user to save the image when it is double-clicked. |
protected boolean |
isFocusTraversableDefault()
See Component.isFocusTraversableDefault() . |
void |
removeClickListener(ClickListener l)
Remove a listener of the Click event of this component |
void |
setImageMode(ImageComponent.ImageMode value)
Sets the image mode for this component (see above for
details.) |
void |
setImageMode(ImageComponent.ImageMode value,
java.lang.String skin)
Sets the image mode for this component (see above for
details.) |
void |
setImageSetName(java.lang.String value)
Sets the name of the image set to use for the Component. |
void |
setImageSetName(java.lang.String value,
java.lang.String skin)
Sets the name of the image set to use for the Component. |
void |
setImageUrl(java.lang.String value)
Sets the URL of the image that will be displayed. |
void |
setImageUrl(java.lang.String value,
java.lang.String skin)
Sets the URL of the image that will be displayed. |
void |
setIsResizeHandle(boolean value)
If value is true, dragging this component will resize the window |
void |
setIsResizeHandle(boolean value,
java.lang.String skin)
If value is true, dragging this component will resize the window |
void |
setRedirectorURL(java.lang.String value)
The method allows you to override the default redirector location. |
void |
setRedirectorURL(java.lang.String value,
java.lang.String skin)
The method allows you to override the default redirector location. |
void |
setSaveOnDoubleClick(boolean value)
If value is true, allow the user to save the image with a double-click |
void |
setSaveOnDoubleClick(boolean value,
java.lang.String skin)
If value is true, allow the user to save the image with a double-click |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final ImageComponent.ImageMode IMAGE_CENTER
public static final ImageComponent.ImageMode IMAGE_TILE
public static final ImageComponent.ImageMode IMAGE_TILE_WRT_WINDOW
public static final ImageComponent.ImageMode IMAGE_SCALE_BOTH
public static final ImageComponent.ImageMode IMAGE_SCALE_UP
public static final ImageComponent.ImageMode IMAGE_SCALE_DOWN
public static final ImageComponent.ImageMode IMAGE_FIT
Constructor Detail |
public ImageComponent(LayoutPlacement p, Window window)
p
- specifies how this component should be laid out in the
enclosing panel (see LayoutPlacement
)window
- the window in which this component will be placedMethod Detail |
public java.lang.String getImageSetName()
above
for details.public void setImageSetName(java.lang.String value, java.lang.String skin)
above
for details.value
- the image set nameskin
- the skin name to use for this attributepublic void setImageSetName(java.lang.String value)
above
for details.value
- the image set nameskin
- the skin name to use for this attributepublic java.lang.String getImageUrl()
public void setImageUrl(java.lang.String value, java.lang.String skin)
above
for information on your options for displaying
images.value
- Complete URL of the image file.skin
- The name by which this attribute will referred to from
skin files.public void setImageUrl(java.lang.String value)
above
for information on your options for displaying
images.value
- Complete URL of the image file.public java.lang.String getRedirectorURL()
public void setRedirectorURL(java.lang.String value, java.lang.String skin)
value
- The URL of the content redirector.skin
- The name to use for this attribute in the skin files.public void setRedirectorURL(java.lang.String value)
value
- The URL of the content redirector.public ImageComponent.ImageMode getImageMode()
imageMode
property. See above
for details.public void setImageMode(ImageComponent.ImageMode value, java.lang.String skin)
above
for
details.)value
- the desired image modeskin
- the skin name to use for this attributepublic void setImageMode(ImageComponent.ImageMode value)
above
for
details.)value
- the desired image modepublic boolean getSaveOnDoubleClick()
public void setSaveOnDoubleClick(boolean value, java.lang.String skin)
value
- true if double-click on the image should allow the
end-user to save the imageskin
- the skin name of the attributepublic void setSaveOnDoubleClick(boolean value)
value
- true if double-click on the image should allow the
end-user to save the imagepublic boolean getIsResizeHandle()
public void setIsResizeHandle(boolean value, java.lang.String skin)
value
- true if dragging the image should resize the windowskin
- the skin name of the attributepublic void setIsResizeHandle(boolean value)
value
- true if dragging the image should resize the windowprotected void action(java.lang.String action, java.lang.String args)
Component
action
in class Component
com.droplets.api.Component
action
- Identifies the type of action that occurredargs
- Action-specific arguments (extra information)public void addClickListener(ClickListener l)
addClickListener
in interface Clickable
l
- a listener to be notified if this component is clickedpublic void removeClickListener(ClickListener l)
removeClickListener
in interface Clickable
l
- a listener to no longer be notified if this component is clickedprotected boolean isFocusTraversableDefault()
Component.isFocusTraversableDefault()
.isFocusTraversableDefault
in class Component
com.droplets.api.Component
Component.setFocusTraversable(boolean)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |