ModernJava
http://www.modernminds.com
M odule WVPanelText

The text module (WVPanelText) allows you display non-scrolling text. The module is especially useful for displaying headlines or banners.

The WVPanelText module is always added to a WildView display by using a <PANEL> tag in a WildView layout file.

This module's documentation is divided into four sections:
M odule Attributes

Each possible attribute that can be specified for a panel tag that uses the WVPanelText module is listed below along with a link to the attribute's description.

Be aware that attribute values are shown for illustrative purposes only: refer to each attribute's description for information regarding attribute requirements.

<PANEL
   module="WVPanelText"
   name=StaticText
   clock=125
   x=10
   y=10
   w=50
   h=25
   mouseX=0
   mouseY=0
   mouseW=200
   mouseH=100
   font="TimesRoman"
   fontSize=14
   fontStyle=bold
   fontColor=FFFF00
   justify=center
   align=middle
   background=FFFFFF
   lineWidth=45
   leading=-2
   initWait=Image1Panel
   blink=enter
   hidden=false
>

Note that attribute names and attribute values are always converted to lowercase internally (this does not apply to the tag type name -- "PANEL" -- which must always be in uppercase characters).

If you wish to preserve the case of an attribute value (e.g., you are specifying a file name that has upper and lower case characters), then you should surround the attribute value with quotation marks. Also, if there is a space character in an attribute value, then you should use quotation marks around the entire attribute value.

A ttribute Descriptions

Each attribute of the WVPanelText panel tag is defined below. The attribute's use is described and the valid attribute values are listed.
module

The module attribute identifies the Java component that will be associated with the panel.

In order to use the WVPanelText module, this attribute must be set as:

module="WVPanelText"

Note that the module name is within quotation marks in order to preserve the case of the characters.

Be sure that the spelling and the capitalization of the module name match exactly, or WildView will not be able to locate the module.
name

The name attribute allows you to assign a name to the panel.

Panel names are primarily used in conjunction with triggers in order to identify what panel a trigger is being sent to, or in some cases, what panel the trigger was received from.

Panel names are also used by WildView when logging error conditions in order to identify the panel that encountered the error.

The name attribute is optional, but if it is not specified then you will not be able to send triggers to this panel from other panels.
clock

The clock attribute defines how frequently the module will get a chance to draw in the WildView display area.

For the WVPanelText module, the clock attribute is used in combination with the blink attribute to determine how fast the text will blink (if blinking text has been enabled).

See the blink attribute for more details about blinking text.

The clock attribute value is expressed in milliseconds (1000 milliseconds is equivalent to 1 second -- which would be slow for this module).

To increase the blink speed, decrease the clock value; to decrease the blink speed , increase the clock value.

A good value to try initially is 250 milliseconds. Using this value, the attribute specification will be:

clock=250

If the clock attribute is not specified, then the clock value defaults to zero. A clock value of zero will disable the blinking text capability, regardless of the setting of the blink attribute.
x

The x attribute determines where the left edge of the panel will be located in the WildView display area (this attribute need not be specified if the hidden attribute is set to true).

For instance, if the WildView display area has a total width of 200, and if a value of 100 is specified for the panel's x attribute, then the panel will be drawn with its left edge located in the middle of the WildView display.

A module will only draw within the rectangle defined by the x, y, w, and h attributes.

Panel Area

In order for a panel to be completely visible in the WildView display area, the x attribute value must be greater than or equal to zero and less than the total width of the WildView display area.

If the x attribute is not specified, then the attribute's value will default to zero (i.e., the left edge of the WildView display area).
y

The y attribute determines where the top edge of the panel will be located in the WildView display area (this attribute need not be specified if the hidden attribute is set to true).

For instance, if the WildView display area has a total height of 100, and if a value of 50 is specified for the panel's y attribute, then the panel will be drawn with its top edge located in the middle of the WildView display.

A module will only draw within the rectangle defined by the x, y, w, and h attributes.

Panel Area

In order for a panel to be completely visible in the WildView display area, the y attribute value must be greater than or equal to zero and less than the total height of the WildView display area.

If the y attribute is not specified, then the attribute's value will default to zero (i.e., the top edge of the WildView display area).
w

The w attribute determines the width of the panel in the WildView display area.

For instance, if the WildView display area has a total width of 200, and if the panel's x attribute has a value of 20, and the panel's w attribute has a value of 160 (positioning the right edge of the panel at 20 + 160 = 180), then the panel will be centered horizontally in the WildView display (there is a margin of 20 to the left of the left panel edge and a margin of 200 - 180 = 20 to the right of the right panel edge).

A module will only draw within the rectangle defined by the x, y, w, and h attributes.

Panel Area

In order for a panel to be completely visible in the WildView display area, the w attribute value added to the x attribute value must be less than or equal to the total width of the WildView display area.

If the w attribute is not specified, then the attribute's value will default to zero (i.e., the panel will not be visible in the WildView display area).
h

The h attribute determines the height of the panel in the WildView display area.

For instance, if the WildView display area has a total height of 100, and if the panel's y attribute has a value of 10, and the panel's h attribute has a value of 80 (positioning the bottom edge of the panel at 10 + 80 = 90), then the panel will be centered vertically in the WildView display (there is a margin of 10 above the top panel edge and a margin of 100 - 90 = 10 below the bottom panel edge).

A module will only draw within the rectangle defined by the x, y, w, and h attributes.

Panel Area

In order for a panel to be completely visible in the WildView display area, the h attribute value added to the y attribute value must be less than or equal to the total height of the WildView display area.

If the h attribute is not specified, then the attribute's value will default to zero (i.e., the panel will not be visible in the WildView display area).
mouseX

The mouseX attribute is an optional attribute that defines the left most side of a rectangle in which mouse events will be recognized by the panel.

Normally, the mouse area (defined by the mouseX, mouseY, mouseW, and mouseH attributes) is identical to the panel display area (defined by the x, y, w, and h attributes).

Occasionally it is useful to define a mouse area that is different from the display area. For instance, you might have a small panel in a corner of a WildView display that contains vertically scrolling text. If you want the scrolling to pause whenever the mouse enters the WildView display area (as opposed to when the mouse enters the panel area), you can define a mouse area equal to the entire WildView display area (of which the scrolling text panel occupies just a part).

A module will only respond to mouse events that occur within the rectangle defined by the mouseX, mouseY, mouseW, and mouseH attributes.

The illustration below shows a panel with a mouse area that is smaller than the panel area.

Mouse Area

If the mouseX attribute is not specified, then the attribute's value will default to value of the x attribute.
mouseY

The mouseY attribute is an optional attribute that defines the top most side of a rectangle in which mouse events will be recognized by the panel.

Normally, the mouse area (defined by the mouseX, mouseY, mouseW, and mouseH attributes) is identical to the panel display area (defined by the x, y, w, and h attributes).

Occasionally it is useful to define a mouse area that is different from the display area. For instance, you might have a small panel in a corner of a WildView display that contains vertically scrolling text. If you want the scrolling to pause whenever the mouse enters the WildView display area (as opposed to when the mouse enters the panel area), you can define a mouse area equal to the entire WildView display area (of which the scrolling text panel occupies just a part).

A module will only respond to mouse events that occur within the rectangle defined by the mouseX, mouseY, mouseW, and mouseH attributes.

The illustration below shows a panel with a mouse area that is smaller than the panel area.

Mouse Area

If the mouseY attribute is not specified, then the attribute's value will default to value of the y attribute.
mouseW

The mouseW attribute is an optional attribute that defines the width of a rectangle in which mouse events will be recognized by the panel.

Normally, the mouse area (defined by the mouseX, mouseY, mouseW, and mouseH attributes) is identical to the panel display area (defined by the x, y, w, and h attributes).

Occasionally it is useful to define a mouse area that is different from the display area. For instance, you might have a small panel in a corner of a WildView display that contains vertically scrolling text. If you want the scrolling to pause whenever the mouse enters the WildView display area (as opposed to when the mouse enters the panel area), you can define a mouse area equal to the entire WildView display area (of which the scrolling text panel occupies just a part).

A module will only respond to mouse events that occur within the rectangle defined by the mouseX, mouseY, mouseW, and mouseH attributes.

The illustration below shows a panel with a mouse area that is smaller than the panel area.

Mouse Area

If the mouseW attribute is not specified, then the attribute's value will default to value of the w attribute.
mouseH

The mouseH attribute is an optional attribute that defines the height of a rectangle in which mouse events will be recognized by the panel.

Normally, the mouse area (defined by the mouseX, mouseY, mouseW, and mouseH attributes) is identical to the panel display area (defined by the x, y, w, and h attributes).

Occasionally it is useful to define a mouse area that is different from the display area. For instance, you might have a small panel in a corner of a WildView display that contains vertically scrolling text. If you want the scrolling to pause whenever the mouse enters the WildView display area (as opposed to when the mouse enters the panel area), you can define a mouse area equal to the entire WildView display area (of which the scrolling text panel occupies just a part).

A module will only respond to mouse events that occur within the rectangle defined by the mouseX, mouseY, mouseW, and mouseH attributes.

The illustration below shows a panel with a mouse area that is smaller than the panel area.

Mouse Area

If the mouseH attribute is not specified, then the attribute's value will default to value of the h attribute.
font

This attribute specifies the typeface to be used when drawing the text.

The font name can be any of the standard Java fonts:
  • "Dialog"
  • "Helvetica"
  • "TimesRoman"
  • "Courier"
  • "Symbol"
Note that the font name must be surrounded with quotation marks in order for Java to find and load the correct font.

If a value for this attribute is not specified, then the text font will default to "Helvetica".
fontSize

This attribute assigns the size of the font used to draw the text.

If a value for this attribute is not specified, then the text font size will default to 12.
fontStyle

This attribute assigns the style of the font used to draw the text.

The value for the style attribute can be any one of the following:
  • plain
  • bold
  • italic
  • italic+bold
  • bold+italic
If a value for this parameter is not specified, then the font style will default to "plain".
fontColor

This attribute assigns the font color used to draw the text.

The value for this attribute must be a RGB value in hexadecimal format. For instance, the color red would be FF0000, and a medium gray would be 888888.

If a value for this attribute is not specified, then the font color will default to black.
justify

The justify attribute enables you to specify the text justification within the panel display area.

The valid values for the justify attribute are:
  • left - text is justified against the left side of the panel display area
  • center - text is justified in the center of the panel display area
  • right - text is justified against the right side of the panel display area
If a value for this attribute is not specified, then the text will be left justified.
align

The align attribute enables you to specify the text vertical alignment within the panel display area.

The valid values for the align attribute are:
  • top - text is aligned vertically at the top of the panel display area
  • middle - text is aligned vertically in the middle of the panel display area
  • bottom - text is aligned vertically at the bottom of the panel display area
If a value for this attribute is not specified, then the text will be top aligned.
background

The background color or background image for the panel's display area is assigned using this attribute.

The attribute's value may be a color in RGB hexadecimal format (for example, the color red would be FF0000, and a medium gray would be 888888), or it may be the special value "clear", or it may be the name of a WVPanelImage panel.

If the special value "clear" is used as the background color, then the panel area will not be filled with a color, but rather the text will be displayed over whatever image lies under the panel area.

If the name of a WVPanelImage panel is used for the attribute value, then the WVPanelText module will "grab" the image that is currently being displayed by the image panel and use it as a background image.

Note that the image panel does not need to be visible in order to "grab" its image. If you are using the image panel only to provide a background image for the text panel, then you can position the image panel at a location outside of the WildView display area.

Be sure to see the description of the initWait attribute if you plan to use the the name of a WVPanelImage panel as the attribute value.

An example of this attribute using an image panel name is:

background=image1

If the background attribute is not specified, then the background color will default to "clear".
lineWidth

The lineWidth attribute controls the maximum width of a line of text that can be drawn within the panel's display area.

The lineWidth value can be set to a value less than the width of the panel's display area in order to allow extra space to the right of the text (if the text is left justified), or to the left of the text (if the text is right justified), or to either side of the text (if the text is center justified).

If this attribute is not specified, then the lineWidth will default to the same value as the panel's display width.
leading

The leading attribute is used to control the space between each line of text.

If you specify a negative value, then the space between each line of text will be decreased by that number of pixels. For instance, a value of -3 would decrease the space between each line of text by three pixels.

If a positive value is specified, then the space between each line of text will be increased by that number of pixels. For instance, a value of 2 would increase the space between each line of text by two pixels.

Note that the actual amount of space between lines of text may vary depending upon the browser and operating system being used. Also, a leading adjustment value may not be larger than the total height of the line of text. If you specify a value that is too large, it will automatically be changed to the largest value allowed.

If this attribute is not specified, then no adjustment will be made to the default spacing between lines of text (i.e., the value will default to zero).
initWait

The initWait attribute can be used to assign an id that the panel will wait for before drawing anything in its display area. In other words, the panel will wait until it receives a <TRIGGER> with the specified id, before it will draw the text in the panel's display area.

One of the more common ways of using this attribute is in conjunction with a background attribute.

If the background attribute is set to the name of a WVPanelImage panel, then the WVPanelText panel's background will be the image contained in a WVPanelImage panel.

There is one problem, however. When WildView initializes a WVPanelText panel, there is no guarantee that the image in the WVPanelImage panel has been completely loaded.

Since a WVPanelImage panel can send a trigger to another panel when its image has been completely loaded, we can use the WVPanelText initWait attribute to cause the WVPanelText panel to wait until it receives this trigger before it draws into the panel display area, thus insuring that the background image will be complete before it is displayed.
blink

The blink attribute can be used to make the text displayed in the WVPanelText panel blink.

The following are the valid values that can be specified for the blink attribute:
  • true - the text displayed in the panel will blink constantly

  • false - the text displayed in the panel will not blink

  • enter - the text displayed in the panel will blink whenever the mouse enters the panel's mouse area (see the mouseX, mouseY, mouseW, and mouseH attributes for details about the mouse area)

  • number - the text displayed in the panel will blink the number of times specified by the value of the number
The speed at which the text will blink is controlled by the clock attribute. If the clock attribute has a value of zero, then no blinking will occur, regardless of the value of the blink attribute.

If this attribute is not specified, then the text displayed in the panel will not blink (i.e., the attribute value will default to "false").
hidden

The hidden attribute controls whether or not the WVPanelText panel area is ever drawn in the WildView display area.

The valid values for the hidden attribute are:
  • true - the WVPanelText panel will never be drawn in the WildView display area

  • false - the WVPanelText panel will be drawn in the WildView display area
Note that if a WVPanelText panel is hidden, then the x and the y attributes do not need to be specified.

This attribute is intended to be used whenever the WVPanelText panel is being used as an "offscreen text image."

For instance, suppose that a animated transition effects panel (WVPanelFx) is being used in a WildView display, and that the image source for the WVPanelFx panel is a WVPanelText panel. Since the text image that will be displayed will be viewed through the WVPanelFx panel and not through the WVPanelText panel, the hidden attribute of the WVPanelText panel can be set to true so that its text image will not seen in the WildView display area.

Instead of using the hidden attribute, it is possible in theory to simply specify an x and a y coordinate for the WVPanelText panel so that the panel is positioned outside of the WildView display area (and therefore will not be seen). However, some implementations of Java will generate an error if the image is positioned offscreen. It's best to avoid the possibility of an error and to use the hidden attribute instead of specifying an x and a y coordinate that will place the text image offscreen.

Note that if the hidden attribute is set to true in the panel tag, that it cannot be set to false later with a trigger.

If the hidden attribute is not specified, then the attribute's value will default to false (the WVPanelText panel will be drawn in the WildView display area).
T ags

The text that is to be displayed follows the <PANEL> tag. The WVPanelText module allows the following tags to be embedded in the text:
  • <BR> - insert a line break in the text
  • <P> - insert a paragraph break in the text
<BR>

The <BR> tag places a line break in the panel's formatted text following the character of text that immediately precedes the tag. A line break is equivalent to a carriage return and a line feed.

The format of the <BR> tag is:

<BR>

An example of the <BR> tag is:

Text in panel set:

... this is some<BR> sample text ...

Text as displayed:

... this is some
sample text ...

<P>

The <P> tag places a paragraph break in the panel's formatted text following the character that immediately precedes the tag. A paragraph break is a line break followed by a blank line.

The format of the <P> tag is:

<P>

An example of the <P> tag is:

Text in panel set:

... this is some<P> sample text ...

Text as displayed:

... this is some

sample text ...
R eceiving Triggers

The text displayed in a WVPanelText panel can be completely controlled by a <TRIGGER> sent to the WVPanelText by another panel.

This means that you can change the text being displayed in the panel, any of the font attributes, the panel's background, etc., based on a <TRIGGER>.

As an example, suppose that there are two panels in a panel set: one panel is a WVPanelVScroll panel that displays vertically scrolling text, and the other panel is a WVPanelText panel.

The WVPanelVScroll panel displays text for news articles, and the WVPanelText is used to display headlines for the text. Embedded in the WVPanelVScroll article text are triggers that are fired at the WVPanelText panel. These triggers can change the text displayed by the WVPanelText panel, and any of the text's display attributes.

Here's how the WVPanelText panel might be defined:

<PANEL name=headline module="WVPanelText"
       x=0 y=0 w=100 h=25 justify=center
       font="TimesRoman" fontSize=18
       fontColor=0000FF clock=250>

First Headline

And here is an example of how the WVPanelVScroll panel might be defined:

<PANEL name=article module="WVPanelVScroll"
       x=0 y=30 w=100 h=200 clock=25
       fontSize=14 fontColor=000000 leading=-2>

This is the first article's text.<P>

<TRIGGER panel=headline text="Second Headline"
         fontColor=FF0000 blink=3
         background=000000>

This is the second article's text.<P>

<TRIGGER panel=headline text="Third Headline"
         fontColor=00FF00 fontStyle=bold
         background=FFFFFF>

This is the third article's text.

<SET panelSet="PanelSet2.TXT" stop=true>

When WildView loads the panel set, the "headline" panel displays the text "First Headline" in a blue 18-point TimesRoman font and centers the text in the display area, and the "article" panel begins scrolling the text for the first article ("This is the first article's text.").

Just before the second article's text is displayed ("This is the second article's text."), the "article" panel fires a trigger at the "headline" panel and the "article" panel upon receiving the trigger changes the color of the text to red, the background color to black, and causes the text to blink three times.

When the third article's text is about to be displayed ("This is the third article's text."), the "article" panel fires another trigger at the "headline" panel and the "article" panel upon receiving the trigger makes the text bold, changes the color of the text to green, and changes the background color to white. Since the blink attribute was not changed, the third headline will blink three times as did the second headline.

Note that the text attribute in the <TRIGGER> should be enclosed in quotation marks. Also, the text within the quotation marks may contain <BR> and <P> tags.

Besides the text attribute. the other attributes that can be included in a <TRIGGER> that is being sent to a WVPanelText panel are:
The value of any of the above attributes that are not specified in the trigger will remain unchanged.
Copyright © 1997 by Modern Minds, Inc.