|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uic.widgets.html.HTMLConfig
public class HTMLConfig
A class used to control the default operation and rendering methods
of a HTMLPane
. The same Config
object can be used with multiple panes. During construction all fields of
the preferences object are set to default values. Individual fields
can then be modified through the access methods listed.
Certain methods
can only modify fields before the preferences object has been passed to
a HTMLPane
. Calling such methods after this point will not
throw an exception - the calls are simply ignored.
HTMLPane
Constructor Summary | |
---|---|
HTMLConfig()
Creates a new Config object which will have all fields
set to default values. |
Method Summary | |
---|---|
Font |
getDefaultButtonFont(int displaySize)
Returns a default font being used within THREEDEE and FLUSH
Buttons and ComboBoxes. |
Color |
getDefaultColor(int attributeType)
Returns a default color used by a HTMLPane to render documents. |
Font |
getDefaultFont(int displaySize)
Returns a default font being used by a HTMLPane |
Font |
getDefaultFormTextFont(int displaySize)
Returns a default font being used within THREEDEE and FLUSH
Textfields, TextAreas and Lists. |
int |
getDefaultFrameSpacing()
Returns the default spacing in pixels between frames within a FrameSet document. |
int |
getDefaultMarginheight()
Returns the default vertical margin of a document. |
int |
getDefaultMarginwidth()
Returns the default horizontal margin of a document. |
int |
getFormRenderingStyle()
Returns the default rendering style of FORM components within a
HTMLPane . |
int |
getFrameDisplayWidth(int displaySize)
Returns the width for the specified displaySize at which point a HTMLPane will
start scaling its display if optimizeDisplay is enabled. |
int |
getOptimizeDisplay()
Returns whether a HTMLPane will
adjust display parameters based on frame size. |
Hashtable |
getVisitedHash()
Returns a Hashtable containing references to visited URLs . |
boolean |
isAutomaticallyFollowHyperlinksEnabled()
Returns whether a HTMLPane will automatically navigate activated hyperlinks. |
boolean |
isDisplayErrorDialogsEnabled()
Returns whether a HTMLPane will automatically display a dialog when
errors such as failed hyperlinks occur. |
boolean |
isHandleFormSubmissionEnabled()
Returns whether a HTMLPane will
automatically handle GET and POST form submissions. |
boolean |
isHandleNewFramesEnabled()
Returns whether a new HTMLPane will
automatically be created if specified by an HTML tag. |
boolean |
isLoadImagesEnabled()
Returns whether a HTMLPane will
automatically load images within documents. |
boolean |
isRequestFocusOnMouseClickEnabled()
Returns whether a HTMLPane will request keyboard focus if the mouse is
clicked within it. |
boolean |
isShowHyperlinkOnMouseFocusEnabled()
Returns whether a HTMLPane will only show a hyperlink when the link has mouse focus. |
boolean |
isShowTestNavBarEnabled()
Returns whether a HTMLPane will display a diagnostic navigation bar on startup. |
boolean |
isShowWarningBeforePostEnabled()
Returns whether a HTMLPane will show a warning to the user before a form POST
submission is made. |
boolean |
isUnderlineLinksEnabled()
Returns whether a HTMLPane will underline hyperlinks. |
void |
setAutomaticallyFollowHyperlinks(boolean b)
Enables/disables the automatic navigation of activated hyperlinks in a HTMLPane . |
void |
setDefaultButtonFont(int displaySize,
Font font)
Sets a default font to be used within form Buttons and ComboBoxes. |
void |
setDefaultColor(int attributeType,
Color c)
Sets a default color. |
void |
setDefaultFont(int displaySize,
Font font)
Sets a default font to be used by a HTMLPane . |
void |
setDefaultFormTextFont(int displaySize,
Font font)
Sets a default font to be used within form TextFields, TextAreas and Lists. |
void |
setDefaultFrameSpacing(int n)
Sets the default spacing in pixels between frames within a FrameSet document. |
void |
setDefaultMarginheight(int n)
Sets the default vertical margin of a document. |
void |
setDefaultMarginwidth(int n)
Sets the default horizontal margin of a document. |
void |
setDisplayErrorDialogs(boolean b)
Enables/disables the automatic display of error dialogs within a HTMLPane . |
void |
setFormRenderingStyle(int style)
Sets the rendering style of FORM components within a HTMLPane . |
void |
setFrameDisplayWidth(int displaySize,
int width)
Sets the width for the specified displaySize at which point a HTMLPane will
start scaling its display if optimizeDisplay is enabled. |
void |
setHandleFormSubmission(boolean b)
Enables/disables the automatic processing of GET and POST html forms within a HTMLPane . |
void |
setHandleNewFrames(boolean b)
Enables/disables the automatic creation of a new HTMLPane if
specified by an HTML tag. |
void |
setLoadImages(boolean b)
Enables/disables the automatic loading of images within a HTMLPane . |
void |
setOptimizeDisplay(int optimizeLevel)
Determines whether a HTMLPane will
adjust display parameters based on frame width. |
void |
setRequestFocusOnMouseClick(boolean b)
Determines whether a HTMLPane or one of its subframes will request keyboard focus
if the mouse is clicked within it. |
void |
setShowHyperlinkOnMouseFocus(boolean b)
Determines whether a hyperlink will only be marked as such when it has mouse focus. |
void |
setShowTestNavBar(boolean b)
Enables/disables the display of a diagnostic navigation bar. |
void |
setShowWarningBeforePost(boolean b)
Enables/disables the showing of a warning message before a form POST submission is made. |
void |
setUnderlineLinks(boolean b)
Enables/disables the underlining of hyperlinks within a HTMLPane . |
void |
setVisitedHash(Hashtable table)
Sets the Hashtable containing references to URLs which
will be used by a HTMLPane to mark visited
hyperlinks. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HTMLConfig()
Config
object which will have all fields
set to default values.
Method Detail |
---|
public Hashtable getVisitedHash()
Hashtable
containing references to visited URLs
.
This hashtable can be passed into a new Config
object
at a later date so that a user's visited links are persistent. The
method of storing the hashtable's contents outside of this class
is left to the programmer.
The keys within the hashtable are all Integer
objects,
each representing a hashcode of a visited URL
(note that this is
not the hashcode returned from the URL.hashcode()
method).
The values within the hashtable are all Long
objects
representing the System.currentTimeMillis()
when the
link was last visited. The programmer may therefore remove 'old'
links if so desired.
setVisitedHash(java.util.Hashtable)
public void setVisitedHash(Hashtable table)
Hashtable
containing references to URLs
which
will be used by a HTMLPane
to mark visited
hyperlinks. Only pass in a hashtable which was previously
obtained from a Config
object via the
getVisitedHash()
method.
table
- a Hashtable containing Integer/Long pairs representing visited document URLsgetVisitedHash()
public void setOptimizeDisplay(int optimizeLevel)
HTMLPane
will
adjust display parameters based on frame width.
The arguments which can be sent to this method are:
HTMLConstants.NO_OPTIMIZATION
HTMLConstants.OPTIMIZE_FONTS
HTMLConstants.OPTIMIZE_ALL
See the README.TXT file accompanying this document for more details on optimizeDisplay.
optimizeLevel
- a value indicating the level (if any) of display optimization requiredsetFrameDisplayWidth(int, int)
public int getOptimizeDisplay()
HTMLPane
will
adjust display parameters based on frame size.
See the README.TXT file accompanying this document for more details on optimizeDisplay.
public void setFrameDisplayWidth(int displaySize, int width)
HTMLPane
will
start scaling its display if optimizeDisplay
is enabled.
The permitted displaySize arguments are:
HTMLConstants.S_SMALL
HTMLConstants.S_MEDIUM
There is no need to set a width for displaySize HTMLConstants.S_LARGE
as a
HTMLPane
will treat any width greater than the HTMLConstants.S_MEDIUM
width as a large display.
Default values are: S_SMALL: 250 pixels, S_MEDIUM: 400 pixels
See the README.TXT file accompanying this document for more details on optimizeDisplay.
public int getFrameDisplayWidth(int displaySize)
HTMLPane
will
start scaling its display if optimizeDisplay
is enabled.
The permitted displaySize arguments are:
HTMLConstants.S_SMALL
- HTMLConstants.S_MEDIUM
public void setDefaultFont(int displaySize, Font font)
HTMLPane
.
This method takes three different size arguments:
HTMLConstants.S_SMALL
- HTMLConstants.S_MEDIUM
- HTMLConstants.S_LARGE
HTMLConstants.S_LARGE
argument.
The S_SMALL
and S_MEDIUM
arguments are used in special cases
relating to printing (which is not yet supported in the Java 2 version of HTMLPane) and
the optimizeDisplay
feature of HTMLPane
.
The font point sizes supported in HTMLPane are: 10, 11, 12, 13, 14, 16, 18, 20, 22, 24, 28, 36, 48
If the size of the font sent to this method does not exactly match a supported size, then the closest supported value will be used.
setOptimizeDisplay(int)
public Font getDefaultFont(int displaySize)
HTMLPane
setDefaultFont(int, java.awt.Font)
public void setDefaultButtonFont(int displaySize, Font font)
THREEDEE
and FLUSH
form components. LOOKANDFEEL
components will not be affected.
This method takes three different size arguments:
HTMLConstants.S_SMALL
- HTMLConstants.S_MEDIUM
- HTMLConstants.S_LARGE
HTMLConstants.S_LARGE
argument.
The S_SMALL
and S_MEDIUM
arguments are used in special cases
relating to the optimizeDisplay
feature of HTMLPane
.
The font point sizes supported in HTMLPane are: 10, 11, 12, 13, 14, 16, 18, 20, 22, 24, 28, 36, 48
If the size of the font sent to this method does not exactly match a supported size, then the closest supported value will be used.
setOptimizeDisplay(int)
public Font getDefaultButtonFont(int displaySize)
THREEDEE
and FLUSH
Buttons and ComboBoxes.
setDefaultButtonFont(int, java.awt.Font)
public void setDefaultFormTextFont(int displaySize, Font font)
THREEDEE
and FLUSH
form components. LOOKANDFEEL
components will not be affected.
This method takes three different size arguments:
HTMLConstants.S_SMALL
- HTMLConstants.S_MEDIUM
- HTMLConstants.S_LARGE
HTMLConstants.S_LARGE
argument.
The S_SMALL
and S_MEDIUM
arguments are used in special cases
relating to the optimizeDisplay
feature of HTMLPane
.
The font point sizes supported in HTMLPane are: 10, 11, 12, 13, 14, 16, 18, 20, 22, 24, 28, 36, 48
If the size of the font sent to this method does not exactly match a supported size, then the closest supported value will be used.
setOptimizeDisplay(int)
public Font getDefaultFormTextFont(int displaySize)
THREEDEE
and FLUSH
Textfields, TextAreas and Lists.
setDefaultFormTextFont(int, java.awt.Font)
public void setDefaultColor(int attributeType, Color c)
attributeType | Default | Description |
---|---|---|
HTMLConstants.A_BGCOLOR |
Color.white | Document background color |
HTMLConstants.A_TEXT |
Color.black | Document text color |
HTMLConstants.A_LINK |
Color(0xOOOOEA) | Normal link color |
HTMLConstants.A_VLINK |
Color(0x800080) | Visited link color |
HTMLConstants.A_ALINK |
Color.red | Active link color |
HTMLConstants.FORM_CONTROL |
UIControl | Control color of form components |
HTMLConstants.FORM_HIGHLIGHT |
UIHighlight | Highlight color of form components |
HTMLConstants.FORM_SHADOW |
UIShadow | Shadow color of form components |
HTMLConstants.FORM_TEXT_BACKGROUND |
Color.white | Background color within form components such as textfields |
HTMLConstants.FORM_TEXT_COLOR |
Color.black | Text color within form components such as textfields |
HTMLConstants.TAB_FOCUS_BACKGROUND |
Color(0x300060) | Background color of hyperlinks which have keyboard focus |
HTMLConstants.TAB_FOCUS_FOREGROUND |
Color(0xFFFFD0) | Foreground color of hyperlinks which have keyboard focus |
This method should be called prior to passing the
Config
to a HTMLPane
. Calls after this point
will be ignored.
public Color getDefaultColor(int attributeType)
HTMLPane
to render documents.
See setDefaultColor()
for allowed attributeTypes
setDefaultColor(int, java.awt.Color)
public void setFormRenderingStyle(int style)
FORM
components within a HTMLPane
.
The permitted style values are:
HTMLConstants.USE_LOOK_AND_FEEL
HTMLConstants.USE_CALPA_THREEDEE
HTMLConstants.USE_CALPA_FLUSH
The USE_LOOK_AND_FEEL
argument will use standard Swing components based
on the currently installed Look&Feel. Generally these will provide an acceptable
display, but with certain document background colors these components lose
style features due to a clash between the background color of the document
and the control, shadow, and highlight color of the component.
The USE_CALPA_THREEDEE
and USE_CALPA_FLUSH
styles have
been incorporated to help overcome such a situation. These components support
author-specific color attributes which can be made to blend satisfactorily with
the surrounding document color.
Note that setting the default style via this method does not prevent the document author from setting individual styles within the document itself. Styles can be freely mixed by specifying style attributes within the relevant document form tags.
Although this method can be called at any time during program execution, existing form components will remain in their original style.
The default rendering style of form components is USE_CALPA_THREEDEE
See the README.TXT file accompanying this document for more details on form rendering.
style
- a value which determines the default rendering style of HTML form componentspublic int getFormRenderingStyle()
FORM
components within a
HTMLPane
.
setFormRenderingStyle(int)
public void setDefaultFrameSpacing(int n)
n
- the default spacing in pixels between HTML frames in a FrameSet documentpublic int getDefaultFrameSpacing()
public void setDefaultMarginwidth(int n)
n
- the default horizontal margin in pixels between a document and the border of the frame it
resides in.public int getDefaultMarginwidth()
public void setDefaultMarginheight(int n)
n
- the default vertical margin in pixels between a document and the border of the frame it
resides in.public int getDefaultMarginheight()
public void setUnderlineLinks(boolean b)
HTMLPane
.
The default value is true.
b
- a flag indicating whether hyperlinks should be underlinedpublic boolean isUnderlineLinksEnabled()
HTMLPane
will underline hyperlinks.
true
if hyperlinks will be underlinedpublic void setShowHyperlinkOnMouseFocus(boolean b)
b
- a flag indicating whether hyperlinks will only be marked as such if they have mouse focuspublic boolean isShowHyperlinkOnMouseFocusEnabled()
HTMLPane
will only show a hyperlink when the link has mouse focus.
true
if a hyperlink will only be marked as such when it has mouse focuspublic void setLoadImages(boolean b)
HTMLPane
.
The default value is true.
b
- a flag indicating whether images within documents should be loaded and displayedpublic boolean isLoadImagesEnabled()
HTMLPane
will
automatically load images within documents.
true
if images within documents will be loaded and displayedpublic void setDisplayErrorDialogs(boolean b)
HTMLPane
.
At present such errors will most commonly arise from a failure to navigate to a
selected URL. The default value is true. If set to false, errors will not be displayed
to the screen but will still be passed to the resident HTMLObserver
b
- a flag indicating whether an dialog should be displayed if an error occurs within a Pane.public boolean isDisplayErrorDialogsEnabled()
HTMLPane
will automatically display a dialog when
errors such as failed hyperlinks occur.
true
if an error dialog will be displayed if an error occurs within a Pane.public void setShowTestNavBar(boolean b)
The navigation bar is a legacy of testing the component and is very basic, but it has not been removed as it can be useful at times. It is expected that users will implement their own custom navigation controls if required.
The NavBar operates independently of the HTMLObserver
monitoring the
Pane, and will not interfere with updates to that object. Note also that the NavBar controls do not
receive keyboard focus when tabbing.
This method should be called prior to passing the
Config
to a HTMLPane
. Calls after this point
will be ignored.
b
- a flag indicating whether a HTMLPane's
test navigation controls should be
displayed.public boolean isShowTestNavBarEnabled()
HTMLPane
will display a diagnostic navigation bar on startup.
true
if a HTMLPane
will display test navigation controls.public void setAutomaticallyFollowHyperlinks(boolean b)
HTMLPane
.
The default value is true. If set to false, activated hyperlinks will not be followed
but the event will still be passed to the resident HTMLObserver
b
- a flag indicating whether hyperlinks should be followed if activated by mouse or keyboard.public boolean isAutomaticallyFollowHyperlinksEnabled()
HTMLPane
will automatically navigate activated hyperlinks.
true
if hyperlinks should be followed if activated by keyboard or mouse.public void setHandleFormSubmission(boolean b)
HTMLPane
. The default value is true. If set to false,
form submissions will still be passed to the resident HTMLObserver
b
- a flag indicating whether http GET and POST form submissions should be handled automatically
by a HTMLPane
public boolean isHandleFormSubmissionEnabled()
HTMLPane
will
automatically handle GET and POST form submissions.
true
if http GET and POST form submissions will be handled automatically
by a HTMLPane
public void setShowWarningBeforePost(boolean b)
b
- a flag indicating whether a warning message will displayed before an http form POST
submissionpublic boolean isShowWarningBeforePostEnabled()
HTMLPane
will show a warning to the user before a form POST
submission is made.
true
if a warning message will displayed before an http form POST
submissionpublic void setHandleNewFrames(boolean b)
HTMLPane
if
specified by an HTML tag. The default value is true. If set to false, a request
for a new frame will be sent to the resident HTMLObserver
b
- a flag indicating whether a new HTMLPane
should automatically be
displayed if specified by an HTML tag.public boolean isHandleNewFramesEnabled()
HTMLPane
will
automatically be created if specified by an HTML tag.
true
if a new HTMLPane
will automatically be
displayed if specified by an HTML tag.public void setRequestFocusOnMouseClick(boolean b)
HTMLPane
or one of its subframes will request keyboard focus
if the mouse is clicked within it. The default value is false.
b
- a flag indicating whether a HTMLPane
frame should call
requestFocus()
if the mouse is clicked within it.public boolean isRequestFocusOnMouseClickEnabled()
HTMLPane
will request keyboard focus if the mouse is
clicked within it.
true
if a HTMLPane
frame will call
requestFocus()
if the mouse is clicked within it.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |