|
UIX 2.2.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.cabo.image.tools.AbstractImageGenerator | +--oracle.cabo.image.tools.ImageGenerator
ImageGenerator is a utility class that generates images based on parameters specified in an XML file.
The ImageGenerator was created to help HTML clients produce images that contain translated text. It also lets HTML clients create Browser Look And Feel buttons and tabs out of images instead of complex HTML tables.
Currently the ImageGenerator can produce images of "action" buttons, "global" buttons and tab bars with the Browser Look And Feel. The ImageGenerator will try to render images as described by an input XML file. If any resulting image contains more than 256 colors, the image is dithered to the web-safe color palette.
The ImageGenerator tool supports the following command line arguments:
For example, the following command line can be used to run the ImageGenerator to generate translated Japanese images.
java oracle.cabo.image.tools.ImageGenerator -output=D:\Temp\images -language=ja -region=JP -bundle=oracle.sample.resource.ButtonBundle button.xml
The ImageGenerator XML file format uses an ImageGenerator
root element, which must be placed in the UIX Dynamic Images namespace by defining an "xmlns" attribute. The ImageGenerator
root element contains a defaults section, followed by elements which specify the images to generate. These image elements must be of type button, globalButton, or tabBar. A valid ImageGenerator XML file looks like this:
<?xml version="1.0"?> <ImageGenerator version="2.0" xmlns="http://xmlns.oracle.com/uix/image"> <!-- Set up some defaults --> <defaults> <!-- Let's use a really big font by default --> <font> <name>Arial</name> <size>18</size> <style>bold</style> </font> </defaults> <!-- An action button --> <button name="button1"> <text>Hello, world!</text> </button> <!-- A global button --> <globalButton name="global1" source="images/help.gif"/> <!-- A tab bar --> <tabBar name="tabbar1" selectedIndex="0"> <tab> <text>Tab 1</text> </tab> <tab> <text>Tab 2</text> </tab> <tab> <text>Tab 3</text> </tab> </tabBar> </ImageGenerator>
Clients can specify default values for various attributes in the defaults
section. These defaults are applied to all images in the XML file. Most of the values specified in the defaults section can be overridden on a per-image basis. The defaults
tag may contain the following elements and attributes:
font
font
element contains three types of tags which are used to specify the default font to use when rendering text: name
, size
, and style
. The name
tag corresponds to the name of the font, the size
tag is an integer that corresponds to the size of the font. Both these tags are required. The style
tag specifies a font style. Valid styles include plain
, bold
, and italic
. There can be more than one style
tag, eg. to indicate both bold and italic. If no style
is specified, the style defaults to plain
. All three of these values can also be specified as attributes on the font element. For example, the following two samples both define a 16 point, Arial font:
<font> <name>Arial</name> <size>16</size> </font> <font name="Arial" size="16"/>
foreground
foreground
element specifies the default foreground color to use for all generated images. The foreground
tag, like all other color-based tags, uses attributes for the red, green, and blue values. The XML should look like this:
<foreground red="255" green="0" blue="0"></foreground>Alternatively, colors can be specified with a single
rgb
attribute, using the "#RRGGBB" hexadecimal format. For example, the foreground color defined above using red, green and blue attributes can also be defined as:
<foreground rgb="#ff0000"/>
background
background
element specifies the default background color for all generated images. Like foreground, the background
tag can either be defined using a single rgb
attribute, or using individual red
, green
, and blue
attributes. textAntialias
attributetextAntialias
attribute indicates whether text should be antialiased by default. By default, text is not antialiased. The value must be either "true" or "false".The following XML elements/attributes can be specified for all image types ie. for button, globalButton and tabBar elements. Several of these elements or attributes have equivalents in the defaults
section. Any value specified at the individual image level takes precedence over an equivalent value specified in the defaults section.
name
attributename
attribute specifies a unique name for the generated image. The name
is used as the basis for the name of the output file name. It does not need to include a file extension. The appropriate file extension (eg. ".gif") is appended by the ImageGenerator.font
font
tag specifies the font to use when rendering text. See above for a description of the font
syntax. This is an optional element. If the font
tag is not specified, the font value specified in the defaults section is used. If no font is specified in either the image element or in the defaults section, a look and feel-specific font will be selected.foreground
foreground
syntax. As with the font element, this element is not required - an appropriate default will be selected, either from the defaults section (if specified), or from the current look and feel.background
background
syntax. As with the font element, this element is not required - an appropriate default will be selected, either from the defaults section (if specified), or from the current look and feel.disabled
attributetextAntialias
attributetextAntialias
attribute is "false".The ImageGenerator can generate action buttons with the Browser Look and Feel using the button
tag. In addition to the common elements and attributes described above, clients can specify the following button-specific elements/attributes.
text
text
element indicates the text to be displayed in the button. The text value can optionally be specified as a text
attribute on the button element. translatedText
translatedText
tag can be used in place of the text
tag to specify a translated text label for the button. The translatedText
element has two attributes: bundle
and key
. The bundle
attribute specifies the name of the resource bundle to use to obtain the text value. The key
attribute specifies the key to use to retrieve the text value. key
must be specified. If bundle
is not specified, the default bundle specified when the ImageGenerator is run is used.startRounded
attributestartRounded
is a boolean attribute which is used to indicate whether the start of the button (left side in left to right languages, right side in right to left languages) should be rounded. By default, the start side of the button is rounded.endRounded
attributeendRounded
is a boolean attribute which is used to indicate whether the end of the button (right side in left to right languages, left side in right to left languages) should be rounded. By default, the end side of the button is rounded.The ImageGenerator can render Browser LAF "global" buttons. Each global button is described by a globalButton
element. In addition to the common elements and attributes described above, globalButton
elements may also contain the following:
source
attributesource
attribute is used to specify the input image to to use. The ImageGenerator will render a global button border around this image. source
must be either a full path or relative path (relative to the current working directory) of a valid image file on the file system.selected
attributeThe ImageGenerator can render a Browser LAF tab bar which contains multiple tabs. In addition to generating an image of the tab bar, the ImageGenerator can also output a client side image map that corresponds to the rendered tab bar. The image map is saved to a ".map" file using the same file name as the generated image.
The XML for the tab bar consists of a tabBar
element which may contain the commmon elements and attribtues described above, in addition the following tab bar-specific elements and attributes.
tab
tab
element is used to describe a single tab in the tab bar. The tab
tag can contain three attributes:
text:
The text label to display in the tab. The text can alternatively be specified using a text
or translatedText
child element.destination:
The URL to display when the tab is selected. The destination
is optional. If no destination is specified, clicking on the tab will not navigate. However, the preferred way to specify a non-navigable tab is via the disabled
attribute.disabled:
A boolean attribute indicating whether the tab is disabled. disabled
is optional and defaults to false.text
or translatedText
child which specifies the text label for the tab.selectedIndex
attributeselectedIndex
attribute is a zero-based Integer value indicating the index of the selected tab in the tab bar. If selectedIndex
is not specified, no tab is selected.selectedForeground
selectedBackground
selectedFont
name
, size
and style
child elements. This element is optional. If it is not specified, the appropriate font for the Browser LAF will be used.Constructor Summary | |
protected |
ImageGenerator() Creates an ImageGenerator instance |
Method Summary | |
protected ImageProvider |
getImageProvider() Implementation of AbstractImageGenerator.getImageProvider(). |
static void |
main(java.lang.String[] args) Run the ImageGenerator. |
Methods inherited from class oracle.cabo.image.tools.AbstractImageGenerator |
generate, getBundle, getLocale, getOutputDirectory |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected ImageGenerator()
Method Detail |
public static void main(java.lang.String[] args)
protected ImageProvider getImageProvider()
getImageProvider
in class AbstractImageGenerator
|
UIX 2.2.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |