org.mozilla.jrex.ui
Class JRexCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--org.mozilla.jrex.ui.JRexCanvas
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class JRexCanvas
extends Canvas

JRexCanvas is the browser component. This component wraps the nsWebBrowser and related interfaces of mozilla embedding. It allows listening to follwing events:

The Mouse and Key events are posted directly into Java's SystemEvent queue. So there is no specific Mouse and Key Listener for JRexCanvas. All the event except URIContentListener are mulitcast events. i.e only one URIContentListener can be added to a browser component. Listening to ToolTip events not enabled at present. It is used only for internal use. It allows operation related to Navigation, Edit and Print actions.

Version:
1.0
Author:
C.N.Medappa
See Also:
WebNavigation, Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Canvas
Canvas.AccessibleAWTCanvas
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int ENCODE_FLAGS_ABSOLUTE_LINKS
          Persist encoding Flag to Convert links to absolute links where possible.
static int ENCODE_FLAGS_BODY_ONLY
          Persist encoding Flag to Output only the body section and no HTML tags.
static int ENCODE_FLAGS_CR_LINEBREAKS
          Persist encoding Flag to Output with carriage return line breaks.
static int ENCODE_FLAGS_ENCODE_BASIC_ENTITIES
          A Persist encoding Flag to Encode basic entities.
static int ENCODE_FLAGS_ENCODE_HTML_ENTITIES
          Persist encoding Flag to Encode HTML4 entities.
static int ENCODE_FLAGS_ENCODE_LATIN1_ENTITIES
          Persist encoding Flag to Encode Latin1 entities.
static int ENCODE_FLAGS_ENCODE_W3C_ENTITIES
          Persist encoding Flag to Attempt to encode entities standardized at W3C (HTML, MathML, etc).
static int ENCODE_FLAGS_FORMAT_FLOWED
          Persist encoding Flag for plaintext output.
static int ENCODE_FLAGS_FORMATTED
          Persist encoding Flag for plaintext output.
static int ENCODE_FLAGS_LF_LINEBREAKS
          Persist encoding Flag to Output with linefeed line breaks.
static int ENCODE_FLAGS_NOFRAMES_CONTENT
          Persist encoding Flag for plaintext output.
static int ENCODE_FLAGS_NOSCRIPT_CONTENT
          Persist encoding Flag for plaintext output.
static int ENCODE_FLAGS_PREFORMATTED
          Persist encoding Flag to Wrap even if when not doing formatted output.
static int ENCODE_FLAGS_RAW
          Persist encoding Flag to Output without formatting or wrapping the content.
static int ENCODE_FLAGS_SELECTION_ONLY
          Persist encoding Flag to Output only the current selection as opposed to the whole document.
static int ENCODE_FLAGS_WRAP
          Persist encoding Flag to Wrap documents at the specified column.
static int PERSIST_ABORTED
          Persist operation was cancled.
static int PERSIST_FAILURE
          Persist operation encountered a non-specific failure.
static int PERSIST_FLAGS_BYPASS_CACHE
          Bypass the cached data.
static int PERSIST_FLAGS_DONT_CHANGE_FILENAMES
          Don't make any adjustments to filenames
static int PERSIST_FLAGS_DONT_FIXUP_LINKS
          Don't make any adjustments to links
static int PERSIST_FLAGS_FAIL_ON_BROKEN_LINKS
          Fail on broken inline links
static int PERSIST_FLAGS_FIXUP_LINKS_TO_DESTINATION
          Fix links relative to destination location (not origin)
static int PERSIST_FLAGS_FIXUP_ORIGINAL_DOM
          Make changes to original dom rather than cloning nodes
static int PERSIST_FLAGS_FROM_CACHE
          Only use cached data (could result in failure if data is not cached).
static int PERSIST_FLAGS_IGNORE_IFRAMES
          Ignore IFRAME content (usually adverts).
static int PERSIST_FLAGS_IGNORE_REDIRECTED_DATA
          Ignore any redirected data (usually adverts).
static int PERSIST_FLAGS_NO_BASE_TAG_MODIFICATIONS
          Don't modify or add base tags.
static int PERSIST_FLAGS_NO_CONVERSION
          Do not run the incoming data through a content converter.
static int PERSIST_FLAGS_NONE
          No special persistence behaviour.
static int PERSIST_FLAGS_REPLACE_EXISTING_FILES
          Replace existing files on the disk (use with due diligence!)
static int PERSIST_FLAGS_SERIALIZE_OUTPUT
          Force serialization of output (one file at a time; not concurrent)
static int PERSIST_STATE_FINISHED
          Persister has finished saving data
static int PERSIST_STATE_READY
          Persister is ready to save data
static int PERSIST_STATE_SAVING
          Persister is saving data
static int PERSIST_SUCCESS
          Persist operation was successful or is still ongoing if Persister is saving.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
protected JRexCanvas(Hashtable browserSetupFlags)
          Constructor to create JRexCanvas.
 
Method Summary
 void addContextMenuListener(ContextMenuListener contextMenuListener)
          Adds the specified ContextMenu listener to receive ContextMenu events from this component.
 void addHistoryListener(HistoryListener historyListener)
          Adds the specified History listener to receive History events from this component.
 void addKeyListener(KeyListener l)
          Adds the specified key listener to receive key events from this component.
 void addMouseListener(MouseListener l)
          Adds the specified mouse listener to receive mouse events from this component.
 void addMouseMotionListener(MouseMotionListener l)
          Adds the specified mouse motion listener to receive mouse motion events from this component.
 void addNotify()
          Creates the peer of the JRexCanvas.
 void addProgressListener(ProgressListener progressListener)
          Adds the specified progress listener to receive progress events from this component.
 void addURIContentListener(URIContentListener uriContentListener)
          Adds the specified URIContent listener to receive URIContent events from this component.
 void browserRealized()
          Invoked to indicate that browser peer has completed realization.
 void cancelPrint()
          Invoked to cancel an ongoing print request.
 void cancelPrintPreview()
          Invoked to cancel an print preview.
 void cancelSave()
          Cancels the current operation.
 boolean canCopy()
          Indicates whether an copy operation can be done.
 boolean canCopyImageContents()
          Indicates whether an copy ImageContents operation can be done.
 boolean canCopyImageLocation()
          Indicates whether an copy Imagelocation operation can be done.
 boolean canCopyLinkLocation()
          Indicates whether an copy linklocation operation can be done.
 boolean canCut()
          Indicates whether an cut operation can be done.
 boolean canDelete()
          Indicates whether an Delete operation can be done.
 boolean canPaste()
          Indicates whether an Paste operation can be done.
 boolean canRedo()
          Indicates whether an redo operation can be done.
 boolean canUndo()
          Indicates whether an undo operation can be done.
 void copy()
          Invoked to copy selected text.
 void copyImageContents()
          Invoked to copy ImageContents.
 void copyImageLocation()
          Invoked to copy selected ImageLocation.
 void copyLinkLocation()
          Invoked to copy selected LinkLocation.
static JRexCanvas createBrowserComponent()
          Use this function to create a JRexCanvas.
static JRexCanvas createBrowserComponent(Hashtable browserSetupFlags)
          Use this function to create a JRexCanvas.
static JRexCanvas createBrowserComponent(long chromeFlags)
          Use this function to create a JRexCanvas.
static JRexCanvas createBrowserComponent(long chromeFlags, Hashtable browserSetupFlags)
          Use this function to create a JRexCanvas.
 void cut()
          Invoked to cut selected text.
 void delete()
          Invoked to delete selected text.
 boolean find(JRexFindConfig config)
          Invoked to find a given text.
 boolean findAgain()
          Invoked to repeat previous find.
 Rectangle getBounds()
          Gets the bounds of this component in the form of a Rectangle object.
 ContextMenuListener[] getContextMenuListeners()
          Returns an array of all the ContextMenu listeners registered on this component.
 int getCurrentPersistState()
          Get the current state of the persister object.
 JRexFindConfig getFindConfig()
          Returns the find config assocaited the browser component instance.
 Element getFocusedElement()
          Returns the focused DOM element.
 HistoryListener[] getHistoryListeners()
          Returns an array of all the History listeners registered on this component.
 int getJRexPeer()
          Return peer component associated with JRexCanvas.
 String getJRexWindowTitle()
          Gets the JRex Window Title.
 Dimension getMinimumSize()
          Gets the mininimum size of this component.
 WebNavigation getNavigator()
          Returns the navigator assocaiated with the browser component.
 int getPersistFlags()
          Get the flags governing how data is fetched and saved from the network.
 int getPersistResult()
          Get the value indicating the success or failure of the persist operation.
 Dimension getPreferredSize()
          Gets the preferred size of this component.
 int getPrintPreviewNumPages()
          Gets the number of print preview pages.
 ProgressListener[] getProgressListeners()
          Returns an array of all the progress listeners registered on this component.
 JRexSelection getSelection()
          Returns the Selection associated with the browser component.
 Dimension getSize()
          Returns the size of this object in the form of a Dimension object.
 boolean isEnabled()
          Determines whether this component is enabled.
 boolean isFocusable()
           
 boolean isPrinting()
          Indicates whether a print is under progress.
 boolean isPrintPreviewing()
          Indicates whether a print preview is under progress.
 boolean isVisible()
          Determines whether this component should be visible when its parent is visible.
 void moveFocus(boolean forward)
          Moves the focus from current focused element to next element.
 void pageSetup()
          Invoked to do print PageSetup.
 void paint(Graphics g)
          Paints the JRexCanvas by signalling Repaint to the peer component.
 void paste()
          Invoked to paste text from clipboard.
 void print(boolean prompt, boolean showProgress)
          Invoked to print the current page shown by the browser
 void printPreview(boolean shrinkToFit, boolean isLandScape)
          Invoked to Preview the current page shown by the browser
 void printPreviewNavigate(int navType, int pageNum)
          Invoked to nagivate in print preview mode.
 void processContextMenuEvent(ContextMenuEvent ce)
          Processes ContextMenu events occurring on this browser by dispatching them to any registered ContextMenuListener objects.
protected  void processFocusEvent(FocusEvent fe)
          Processes focus events occurring on this component by dispatching them to native peer.
 Boolean processHistoryEvent(HistoryEvent he)
          Processes history events occurring on this browser by dispatching them to any registered HistoryListener objects.
 void processProgressEvent(ProgressEvent pe)
          Processes progress events occurring on this browser by dispatching them to any registered ProgressListener objects.
 void processTooltipEvent(TooltipEvent tte)
           
 Object processURIContentEvent(URIContentEvent uce)
          Processes URIContent events occurring on this browser by dispatching them to registered URIContentListener object.
 void redo()
          Invoked to redo an edit operation.
 void removeContextMenuListener(ContextMenuListener contextMenuListener)
          Removes the specified ContextMenu listener so that it no longer receives ContextMenu events from this component.
 void removeHistoryListener(HistoryListener historyListener)
          Removes the specified History listener so that it no longer receives History events from this component.
 void removeKeyListener(KeyListener l)
          Removes the specified key listener so that it no longer receives key events from this component.
 void removeMouseListener(MouseListener l)
          Removes the specified mouse listener so that it no longer receives mouse events from this component.
 void removeMouseMotionListener(MouseMotionListener l)
          Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component.
 void removeNotify()
          Destroys the peer of the JRexCanvas.
 void removeProgressListener(ProgressListener progressListener)
          Removes the specified progress listener so that it no longer receives progress events from this component.
 void removeURIContentListener()
          Removes the URIContent listener so that it no longer receives URIContent events from this component.
 void saveCurrentDocument(String filePath, String dataPath, String outputContentType, int encodingFlags, int wrapColumn, ProgressListener progressListener)
          Save the current DOM document to file.
 void saveURI(String uri, String referURI, InputStream postData, String extraHeaders, String filePath, ProgressListener progressListener)
          Save the given URI.
 void selectAll()
          Invoked to select all text in an control.
 void selectNone()
          Invoked to clear all selection in an control.
 void setBounds(int x, int y, int width, int height)
          Moves and resizes this component.
 void setEnabled(boolean enable)
          Enables or disables this component, depending on the value of the parameter enable.
 void setFocusedElement(Element ele)
          Set's the focused DOM element.
 void setJRexWindowTitle(String title)
          Sets the JRex Window Title.
 void setPersistFlags(int persistFlags)
          Set the flags governing how data is fetched and saved from the network.
 void setVisible(boolean visible)
          Sets the visible state of the JRexCanvas.
 void undo()
          Invoked to undo an edit operation.
 void update(Graphics g)
          Simply calls paint function.
 
Methods inherited from class java.awt.Canvas
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PERSIST_FLAGS_NONE

public static final int PERSIST_FLAGS_NONE
No special persistence behaviour.

See Also:
Constant Field Values

PERSIST_FLAGS_FROM_CACHE

public static final int PERSIST_FLAGS_FROM_CACHE
Only use cached data (could result in failure if data is not cached).

See Also:
Constant Field Values

PERSIST_FLAGS_BYPASS_CACHE

public static final int PERSIST_FLAGS_BYPASS_CACHE
Bypass the cached data.

See Also:
Constant Field Values

PERSIST_FLAGS_IGNORE_REDIRECTED_DATA

public static final int PERSIST_FLAGS_IGNORE_REDIRECTED_DATA
Ignore any redirected data (usually adverts).

See Also:
Constant Field Values

PERSIST_FLAGS_IGNORE_IFRAMES

public static final int PERSIST_FLAGS_IGNORE_IFRAMES
Ignore IFRAME content (usually adverts).

See Also:
Constant Field Values

PERSIST_FLAGS_NO_CONVERSION

public static final int PERSIST_FLAGS_NO_CONVERSION
Do not run the incoming data through a content converter. E.g. to decompress it

See Also:
Constant Field Values

PERSIST_FLAGS_REPLACE_EXISTING_FILES

public static final int PERSIST_FLAGS_REPLACE_EXISTING_FILES
Replace existing files on the disk (use with due diligence!)

See Also:
Constant Field Values

PERSIST_FLAGS_NO_BASE_TAG_MODIFICATIONS

public static final int PERSIST_FLAGS_NO_BASE_TAG_MODIFICATIONS
Don't modify or add base tags.

See Also:
Constant Field Values

PERSIST_FLAGS_FIXUP_ORIGINAL_DOM

public static final int PERSIST_FLAGS_FIXUP_ORIGINAL_DOM
Make changes to original dom rather than cloning nodes

See Also:
Constant Field Values

PERSIST_FLAGS_FIXUP_LINKS_TO_DESTINATION

public static final int PERSIST_FLAGS_FIXUP_LINKS_TO_DESTINATION
Fix links relative to destination location (not origin)

See Also:
Constant Field Values

PERSIST_FLAGS_DONT_FIXUP_LINKS

public static final int PERSIST_FLAGS_DONT_FIXUP_LINKS
Don't make any adjustments to links

See Also:
Constant Field Values

PERSIST_FLAGS_SERIALIZE_OUTPUT

public static final int PERSIST_FLAGS_SERIALIZE_OUTPUT
Force serialization of output (one file at a time; not concurrent)

See Also:
Constant Field Values

PERSIST_FLAGS_DONT_CHANGE_FILENAMES

public static final int PERSIST_FLAGS_DONT_CHANGE_FILENAMES
Don't make any adjustments to filenames

See Also:
Constant Field Values

PERSIST_FLAGS_FAIL_ON_BROKEN_LINKS

public static final int PERSIST_FLAGS_FAIL_ON_BROKEN_LINKS
Fail on broken inline links

See Also:
Constant Field Values

PERSIST_STATE_READY

public static final int PERSIST_STATE_READY
Persister is ready to save data

See Also:
Constant Field Values

PERSIST_STATE_SAVING

public static final int PERSIST_STATE_SAVING
Persister is saving data

See Also:
Constant Field Values

PERSIST_STATE_FINISHED

public static final int PERSIST_STATE_FINISHED
Persister has finished saving data

See Also:
Constant Field Values

PERSIST_SUCCESS

public static final int PERSIST_SUCCESS
Persist operation was successful or is still ongoing if Persister is saving.

See Also:
Constant Field Values

PERSIST_ABORTED

public static final int PERSIST_ABORTED
Persist operation was cancled.

See Also:
Constant Field Values

PERSIST_FAILURE

public static final int PERSIST_FAILURE
Persist operation encountered a non-specific failure.

See Also:
Constant Field Values

ENCODE_FLAGS_SELECTION_ONLY

public static final int ENCODE_FLAGS_SELECTION_ONLY
Persist encoding Flag to Output only the current selection as opposed to the whole document.

See Also:
Constant Field Values

ENCODE_FLAGS_FORMATTED

public static final int ENCODE_FLAGS_FORMATTED
Persist encoding Flag for plaintext output. Convert html to plaintext that looks like the html. Implies wrap (except inside <pre>), since html wraps. HTML output: always do prettyprinting, ignoring existing formatting.

See Also:
Constant Field Values

ENCODE_FLAGS_RAW

public static final int ENCODE_FLAGS_RAW
Persist encoding Flag to Output without formatting or wrapping the content. This flag may be used to preserve the original formatting as much as possible.

See Also:
Constant Field Values

ENCODE_FLAGS_BODY_ONLY

public static final int ENCODE_FLAGS_BODY_ONLY
Persist encoding Flag to Output only the body section and no HTML tags.

See Also:
Constant Field Values

ENCODE_FLAGS_PREFORMATTED

public static final int ENCODE_FLAGS_PREFORMATTED
Persist encoding Flag to Wrap even if when not doing formatted output. E.g. for text fields.

See Also:
Constant Field Values

ENCODE_FLAGS_WRAP

public static final int ENCODE_FLAGS_WRAP
Persist encoding Flag to Wrap documents at the specified column.

See Also:
Constant Field Values

ENCODE_FLAGS_FORMAT_FLOWED

public static final int ENCODE_FLAGS_FORMAT_FLOWED
Persist encoding Flag for plaintext output. Output for format flowed (RFC 2646). This is used when converting to text for mail sending. This differs just slightly but in an important way from normal formatted, and that is that lines are space stuffed. This can't (correctly) be done later.

See Also:
Constant Field Values

ENCODE_FLAGS_ABSOLUTE_LINKS

public static final int ENCODE_FLAGS_ABSOLUTE_LINKS
Persist encoding Flag to Convert links to absolute links where possible.

See Also:
Constant Field Values

ENCODE_FLAGS_ENCODE_W3C_ENTITIES

public static final int ENCODE_FLAGS_ENCODE_W3C_ENTITIES
Persist encoding Flag to Attempt to encode entities standardized at W3C (HTML, MathML, etc). This is a catch-all flag for documents with mixed contents. Beware of interoperability issues. See below for other flags which might likely do what you want.

See Also:
Constant Field Values

ENCODE_FLAGS_CR_LINEBREAKS

public static final int ENCODE_FLAGS_CR_LINEBREAKS
Persist encoding Flag to Output with carriage return line breaks. May also be combined with ENCODE_FLAGS_LF_LINEBREAKS and if neither is specified, the platform default format is used.

See Also:
Constant Field Values

ENCODE_FLAGS_LF_LINEBREAKS

public static final int ENCODE_FLAGS_LF_LINEBREAKS
Persist encoding Flag to Output with linefeed line breaks. May also be combined with ENCODE_FLAGS_CR_LINEBREAKS and if neither is specified, the platform default format is used.

See Also:
Constant Field Values

ENCODE_FLAGS_NOSCRIPT_CONTENT

public static final int ENCODE_FLAGS_NOSCRIPT_CONTENT
Persist encoding Flag for plaintext output. Output the content of noscript elements.

See Also:
Constant Field Values

ENCODE_FLAGS_NOFRAMES_CONTENT

public static final int ENCODE_FLAGS_NOFRAMES_CONTENT
Persist encoding Flag for plaintext output. Output the content of noframes elements.

See Also:
Constant Field Values

ENCODE_FLAGS_ENCODE_BASIC_ENTITIES

public static final int ENCODE_FLAGS_ENCODE_BASIC_ENTITIES
A Persist encoding Flag to Encode basic entities. E.g. output   instead of character code 0xa0. The basic set is just   & < > " for interoperability with older products that don't support α and friends.

See Also:
Constant Field Values

ENCODE_FLAGS_ENCODE_LATIN1_ENTITIES

public static final int ENCODE_FLAGS_ENCODE_LATIN1_ENTITIES
Persist encoding Flag to Encode Latin1 entities. This includes the basic set and accented letters between 128 and 255.

See Also:
Constant Field Values

ENCODE_FLAGS_ENCODE_HTML_ENTITIES

public static final int ENCODE_FLAGS_ENCODE_HTML_ENTITIES
Persist encoding Flag to Encode HTML4 entities. This includes the basic set, accented letters, greek letters and certain special markup symbols.

See Also:
Constant Field Values
Constructor Detail

JRexCanvas

protected JRexCanvas(Hashtable browserSetupFlags)
Constructor to create JRexCanvas.

Method Detail

createBrowserComponent

public static JRexCanvas createBrowserComponent()
Use this function to create a JRexCanvas. If this function is used then Global Setup-Flag is used(if set) from system property jrex.browser.setupflag, The property should be an integer object.


createBrowserComponent

public static JRexCanvas createBrowserComponent(long chromeFlags)
Use this function to create a JRexCanvas. If this function is used then Global Setup-Flag is used(if set) from system property jrex.browser.setupflag, The property should be an integer object.

Parameters:
chromeFlags - The chrome falgs to use for canvas creation

createBrowserComponent

public static JRexCanvas createBrowserComponent(Hashtable browserSetupFlags)
Use this function to create a JRexCanvas. This function is meant for WindowManger to handle WindowCreation request from embedding engine.

Parameters:
browserSetupFlags - The list of SETUP-Flags that allow certain properties of a new browser object to set before the browser window is created. Global Setup-Flag can be set using system property, Below are the list of setup properties.
  • jrex.browser.usesetupflags value should be true/false, Enables/disables usage of setup flags.
  • jrex.browser.allow.plugin value should be true/false, Enables/disables plugin support for this browser.
  • jrex.browser.allow.javascript value should be true/false, Enables/disables Javascript support for this browser.
  • jrex.browser.allow.metaredirects value should be true/false, Enables/disables meta redirect support for this browser. Meta redirect timers will be ignored if this option is disabled.
  • jrex.browser.allow.subframes value should be true/false, Enables/disables subframes support for this browser.
  • jrex.browser.allow.images value should be true/false, Enables/disables image loading for this browser.
  • jrex.browser.ischromewrapper value should be true/false, Setting this property to true makes the browser a chrome wrapper.
  • jrex.browser.useglobalhistory value should be true/false, Enables/disables the use of global history in the browser. Visited URLs will not be recorded in the global history when it is disabled.
Note:- The value in browserSetupFlags is expected to a Boolean object.

createBrowserComponent

public static JRexCanvas createBrowserComponent(long chromeFlags,
                                                Hashtable browserSetupFlags)
Use this function to create a JRexCanvas. This function is meant for WindowManger to handle WindowCreation request from embedding engine.

Parameters:
browserSetupFlags - The list of SETUP-Flags that allow certain properties of a new browser object to set before the browser window is created. Global Setup-Flag can be set using system property, Below are the list of setup properties.
  • jrex.browser.usesetupflags value should be true/false, Enables/disables usage of setup flags.
  • jrex.browser.allow.plugin value should be true/false, Enables/disables plugin support for this browser.
  • jrex.browser.allow.javascript value should be true/false, Enables/disables Javascript support for this browser.
  • jrex.browser.allow.metaredirects value should be true/false, Enables/disables meta redirect support for this browser. Meta redirect timers will be ignored if this option is disabled.
  • jrex.browser.allow.subframes value should be true/false, Enables/disables subframes support for this browser.
  • jrex.browser.allow.images value should be true/false, Enables/disables image loading for this browser.
  • jrex.browser.ischromewrapper value should be true/false, Setting this property to true makes the browser a chrome wrapper.
  • jrex.browser.useglobalhistory value should be true/false, Enables/disables the use of global history in the browser. Visited URLs will not be recorded in the global history when it is disabled.
Note:- The value in browserSetupFlags is expected to a Boolean object.
chromeFlags - The chrome falgs to use for canvas creation

getJRexPeer

public int getJRexPeer()
Return peer component associated with JRexCanvas.


addNotify

public void addNotify()
Creates the peer of the JRexCanvas. The native component is realized and made visible. This function is also used to associate the JRex peer with java canvas peer in windows platform.

Overrides:
addNotify in class Canvas
See Also:
Canvas.addNotify()

browserRealized

public void browserRealized()
Invoked to indicate that browser peer has completed realization. This function is intended to be used by WindowManager.


processFocusEvent

protected void processFocusEvent(FocusEvent fe)
Processes focus events occurring on this component by dispatching them to native peer.

Overrides:
processFocusEvent in class Component
See Also:
Component.processFocusEvent(FocusEvent)

isFocusable

public boolean isFocusable()
Overrides:
isFocusable in class Component

paint

public void paint(Graphics g)
Paints the JRexCanvas by signalling Repaint to the peer component. This function is also used to associate the JRex peer with java canvas peer in *nix platform. since the java.awt.Component's addnotify function actualy does not create a java peer component in addnotify call.

Overrides:
paint in class Canvas
Parameters:
g - the specified Graphics context
See Also:
Component.paint(Graphics)

update

public void update(Graphics g)
Simply calls paint function.

Overrides:
update in class Canvas
Parameters:
g - the specified Graphics context
See Also:
paint(Graphics)

removeNotify

public void removeNotify()
Destroys the peer of the JRexCanvas.

Overrides:
removeNotify in class Component
See Also:
Component.removeNotify()

setVisible

public void setVisible(boolean visible)
Sets the visible state of the JRexCanvas.

Overrides:
setVisible in class Component
Parameters:
visible - if true, shows this JRexCanvas peer; otherwise, hides it

isVisible

public boolean isVisible()
Determines whether this component should be visible when its parent is visible.

Overrides:
isVisible in class Component
See Also:
setVisible(boolean)

setEnabled

public void setEnabled(boolean enable)
Enables or disables this component, depending on the value of the parameter enable.

Overrides:
setEnabled in class Component

isEnabled

public boolean isEnabled()
Determines whether this component is enabled.

Overrides:
isEnabled in class Component
See Also:
setEnabled(boolean)

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Moves and resizes this component. The new location of the top-left corner is specified by x and y, and the new size is specified by width and height.

Overrides:
setBounds in class Component
Parameters:
x - the new x-coordinate of this component
y - the new y-coordinate of this component
width - the new width of this component
height - the new height of this component
See Also:
getBounds()

getBounds

public Rectangle getBounds()
Gets the bounds of this component in the form of a Rectangle object. The bounds specify this component's width, height, and location relative to its parent.

Overrides:
getBounds in class Component
Returns:
a rectangle indicating this component's bounds
See Also:
setBounds(int, int, int, int)

getMinimumSize

public Dimension getMinimumSize()
Gets the mininimum size of this component.

Overrides:
getMinimumSize in class Component
See Also:
getSize(), LayoutManager

getSize

public Dimension getSize()
Returns the size of this object in the form of a Dimension object. The height field of the Dimension object contains this objects's height, and the width field of the Dimension object contains this object's width.

Overrides:
getSize in class Component
Returns:
a Dimension object that indicates the size of this component; null if this object is not on the screen

getPreferredSize

public Dimension getPreferredSize()
Gets the preferred size of this component.

Overrides:
getPreferredSize in class Component
Returns:
a dimension object indicating this component's preferred size
See Also:
getSize()

getJRexWindowTitle

public String getJRexWindowTitle()
Gets the JRex Window Title.

Returns:
the tittle associated with the browser component
See Also:
setJRexWindowTitle(java.lang.String)

setJRexWindowTitle

public void setJRexWindowTitle(String title)
Sets the JRex Window Title.

Parameters:
title - the tittle to be associated with the browser component
See Also:
getJRexWindowTitle()

getNavigator

public WebNavigation getNavigator()
Returns the navigator assocaiated with the browser component.

See Also:
WebNavigation

getSelection

public JRexSelection getSelection()
Returns the Selection associated with the browser component. If DOM is not enabled this method returns null

See Also:
JRexSelection

moveFocus

public void moveFocus(boolean forward)
Moves the focus from current focused element to next element.

Parameters:
forward - If true focus is moved in foward direction.

getFocusedElement

public Element getFocusedElement()
Returns the focused DOM element. If DOM is not enabled this method returns null


setFocusedElement

public void setFocusedElement(Element ele)
Set's the focused DOM element. If DOM is not enabled this method does nothing.


addKeyListener

public void addKeyListener(KeyListener l)
Adds the specified key listener to receive key events from this component. If listener l is null, no exception is thrown and no action is performed.

Overrides:
addKeyListener in class Component
Parameters:
l - the key listener.
See Also:
KeyEvent, KeyListener, removeKeyListener(java.awt.event.KeyListener), Component.getKeyListeners()

addMouseListener

public void addMouseListener(MouseListener l)
Adds the specified mouse listener to receive mouse events from this component. If listener l is null, no exception is thrown and no action is performed.

Overrides:
addMouseListener in class Component
Parameters:
l - the mouse listener
See Also:
MouseEvent, MouseListener, removeMouseListener(java.awt.event.MouseListener), Component.getMouseListeners()

addMouseMotionListener

public void addMouseMotionListener(MouseMotionListener l)
Adds the specified mouse motion listener to receive mouse motion events from this component. If listener l is null, no exception is thrown and no action is performed.

Overrides:
addMouseMotionListener in class Component
Parameters:
l - the mouse motion listener
See Also:
MouseEvent, MouseMotionListener, removeMouseMotionListener(java.awt.event.MouseMotionListener), Component.getMouseMotionListeners()

addProgressListener

public void addProgressListener(ProgressListener progressListener)
Adds the specified progress listener to receive progress events from this component. If listener progressListener is null, no exception is thrown and no action is performed.

Parameters:
progressListener - the Progress listener
See Also:
ProgressEvent, removeProgressListener(org.mozilla.jrex.event.progress.ProgressListener), getProgressListeners()

getProgressListeners

public ProgressListener[] getProgressListeners()
Returns an array of all the progress listeners registered on this component.

Returns:
all of this component's ProgressListeners or an empty array if no progress listeners are currently registered
See Also:
addProgressListener(org.mozilla.jrex.event.progress.ProgressListener), removeProgressListener(org.mozilla.jrex.event.progress.ProgressListener)

addContextMenuListener

public void addContextMenuListener(ContextMenuListener contextMenuListener)
Adds the specified ContextMenu listener to receive ContextMenu events from this component. If listener contextMenuListener is null, no exception is thrown and no action is performed.

Parameters:
contextMenuListener - the ContextMenu listener
See Also:
ContextMenuEvent, removeContextMenuListener(org.mozilla.jrex.event.context.ContextMenuListener), getContextMenuListeners()

getContextMenuListeners

public ContextMenuListener[] getContextMenuListeners()
Returns an array of all the ContextMenu listeners registered on this component.

Returns:
all of this component's ContextMenuListeners or an empty array if no ContextMenu listeners are currently registered
See Also:
addContextMenuListener(org.mozilla.jrex.event.context.ContextMenuListener), removeContextMenuListener(org.mozilla.jrex.event.context.ContextMenuListener)

addHistoryListener

public void addHistoryListener(HistoryListener historyListener)
Adds the specified History listener to receive History events from this component. If listener historyListener is null, no exception is thrown and no action is performed.

Parameters:
historyListener - the History listener
See Also:
HistoryEvent, removeHistoryListener(org.mozilla.jrex.event.history.HistoryListener), getHistoryListeners()

getHistoryListeners

public HistoryListener[] getHistoryListeners()
Returns an array of all the History listeners registered on this component.

Returns:
all of this component's HistoryListeners or an empty array if no History listeners are currently registered
See Also:
addHistoryListener(org.mozilla.jrex.event.history.HistoryListener), removeHistoryListener(org.mozilla.jrex.event.history.HistoryListener)

addURIContentListener

public void addURIContentListener(URIContentListener uriContentListener)
Adds the specified URIContent listener to receive URIContent events from this component. If listener uriContentListener is null, no exception is thrown and no action is performed. If listener was already added the uriContentListener will relace it.

Parameters:
uriContentListener - the URIContent listener
See Also:
URIContentEvent, removeURIContentListener()

removeKeyListener

public void removeKeyListener(KeyListener l)
Removes the specified key listener so that it no longer receives key events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listener l is null, no exception is thrown and no action is performed. If list of KeyListeners is empty, native peer is requested to remove the KeyListener.

Overrides:
removeKeyListener in class Component
Parameters:
l - the key listener
See Also:
KeyEvent, KeyListener, addKeyListener(java.awt.event.KeyListener), Component.getKeyListeners()

removeMouseListener

public void removeMouseListener(MouseListener l)
Removes the specified mouse listener so that it no longer receives mouse events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listener l is null, no exception is thrown and no action is performed. If list of MouseListener is empty, native peer is requested to remove the MouseListener.

Overrides:
removeMouseListener in class Component
Parameters:
l - the mouse listener
See Also:
MouseEvent, MouseListener, addMouseListener(java.awt.event.MouseListener), Component.getMouseListeners()

removeMouseMotionListener

public void removeMouseMotionListener(MouseMotionListener l)
Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listener l is null, no exception is thrown and no action is performed. If list of MouseMotionListener is empty, native peer is requested to remove the MouseMotionListener.

Overrides:
removeMouseMotionListener in class Component
Parameters:
l - the mouse motion listener
See Also:
MouseEvent, MouseMotionListener, addMouseMotionListener(java.awt.event.MouseMotionListener), Component.getMouseMotionListeners()

removeProgressListener

public void removeProgressListener(ProgressListener progressListener)
Removes the specified progress listener so that it no longer receives progress events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listener progressListener is null, no exception is thrown and no action is performed. If list of ProgressListener is empty, native peer is requested to remove the ProgressListener.

Parameters:
progressListener - the progress listener
See Also:
ProgressEvent, addProgressListener(org.mozilla.jrex.event.progress.ProgressListener), getProgressListeners()

removeContextMenuListener

public void removeContextMenuListener(ContextMenuListener contextMenuListener)
Removes the specified ContextMenu listener so that it no longer receives ContextMenu events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listener contextMenuListener is null, no exception is thrown and no action is performed. If list of ContextMenuListener is empty, native peer is requested to remove the ContextMenuListener.

Parameters:
contextMenuListener - the ContextMenu listener
See Also:
ContextMenuEvent, addContextMenuListener(org.mozilla.jrex.event.context.ContextMenuListener), getContextMenuListeners()

removeHistoryListener

public void removeHistoryListener(HistoryListener historyListener)
Removes the specified History listener so that it no longer receives History events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listener historyListener is null, no exception is thrown and no action is performed. If list of HistoryListener is empty, native peer is requested to remove the HistoryListener.

Parameters:
historyListener - the History listener
See Also:
HistoryEvent, addHistoryListener(org.mozilla.jrex.event.history.HistoryListener), getHistoryListeners()

removeURIContentListener

public void removeURIContentListener()
Removes the URIContent listener so that it no longer receives URIContent events from this component. This method performs no function, nor does it throw an exception, if the listener was not previously added to this component. Native peer is requested to remove the URIContentListener.

See Also:
URIContentEvent, addURIContentListener(org.mozilla.jrex.event.uricontent.URIContentListener)

processProgressEvent

public void processProgressEvent(ProgressEvent pe)
Processes progress events occurring on this browser by dispatching them to any registered ProgressListener objects.

This method is not called unless progress events are enabled for this browser. Progress events are enabled when an ProgressListener object is registered via addProgressListener.

Parameters:
pe - the Progress event
See Also:
ProgressListener

processContextMenuEvent

public void processContextMenuEvent(ContextMenuEvent ce)
Processes ContextMenu events occurring on this browser by dispatching them to any registered ContextMenuListener objects.

This method is not called unless ContextMenu events are enabled for this browser. ContextMenu events are enabled when an ContextMenuListener object is registered via addContextMenuListener.

Parameters:
ce - the ContextMenu event
See Also:
ContextMenuListener

processHistoryEvent

public Boolean processHistoryEvent(HistoryEvent he)
Processes history events occurring on this browser by dispatching them to any registered HistoryListener objects.

This method is not called unless history events are enabled for this browser. History events are enabled when an HistoryListener object is registered via addHistoryListener.

Parameters:
he - the History event
Returns:
Boolean appropriate can's depending on event.
See Also:
HistoryListener

processURIContentEvent

public Object processURIContentEvent(URIContentEvent uce)
Processes URIContent events occurring on this browser by dispatching them to registered URIContentListener object.

This method is not called unless URIContent events are enabled for this browser. URIContent events are enabled when an URIContentListener object is registered via addURIContentListener.

Parameters:
uce - the URIContent event
See Also:
URIContentListener

processTooltipEvent

public void processTooltipEvent(TooltipEvent tte)

print

public void print(boolean prompt,
                  boolean showProgress)
           throws JRexException
Invoked to print the current page shown by the browser

Parameters:
prompt - If true system will prompt with print dialog.
showProgress - If true print progress dialog is shown.
JRexException

cancelPrint

public void cancelPrint()
                 throws JRexException
Invoked to cancel an ongoing print request.

JRexException
See Also:
isPrinting()

isPrinting

public boolean isPrinting()
                   throws JRexException
Indicates whether a print is under progress.

JRexException
See Also:
cancelPrint(), print(boolean, boolean)

printPreview

public void printPreview(boolean shrinkToFit,
                         boolean isLandScape)
                  throws JRexException
Invoked to Preview the current page shown by the browser

Parameters:
shrinkToFit - If true Preview will shrink to fit to the browser component view.
isLandScape - If true Preview will be in LandScape view.
JRexException
See Also:
print(boolean, boolean)

cancelPrintPreview

public void cancelPrintPreview()
                        throws JRexException
Invoked to cancel an print preview.

JRexException
See Also:
isPrintPreviewing()

isPrintPreviewing

public boolean isPrintPreviewing()
                          throws JRexException
Indicates whether a print preview is under progress.

JRexException
See Also:
cancelPrintPreview(), printPreview(boolean, boolean)

getPrintPreviewNumPages

public int getPrintPreviewNumPages()
                            throws JRexException
Gets the number of print preview pages.

JRexException
See Also:
printPreview(boolean, boolean)

printPreviewNavigate

public void printPreviewNavigate(int navType,
                                 int pageNum)
                          throws JRexException
Invoked to nagivate in print preview mode.

Parameters:
navType - the type of navigation to perform.
pageNum - the page number to navigate to.
JRexException
See Also:
see PrintPreview Navigation Constants Above.

pageSetup

public void pageSetup()
               throws JRexException
Invoked to do print PageSetup.

JRexException
See Also:
print(boolean, boolean)

canUndo

public boolean canUndo()
                throws JRexException
Indicates whether an undo operation can be done.

JRexException
See Also:
undo()

canRedo

public boolean canRedo()
                throws JRexException
Indicates whether an redo operation can be done.

JRexException
See Also:
redo()

canCut

public boolean canCut()
               throws JRexException
Indicates whether an cut operation can be done.

JRexException
See Also:
cut()

canCopy

public boolean canCopy()
                throws JRexException
Indicates whether an copy operation can be done.

JRexException
See Also:
copy()

canCopyLinkLocation

public boolean canCopyLinkLocation()
                            throws JRexException
Indicates whether an copy linklocation operation can be done.

JRexException
See Also:
copyLinkLocation()

canCopyImageLocation

public boolean canCopyImageLocation()
                             throws JRexException
Indicates whether an copy Imagelocation operation can be done.

JRexException
See Also:
copyImageLocation()

canCopyImageContents

public boolean canCopyImageContents()
                             throws JRexException
Indicates whether an copy ImageContents operation can be done.

JRexException
See Also:
copyImageContents()

canPaste

public boolean canPaste()
                 throws JRexException
Indicates whether an Paste operation can be done.

JRexException
See Also:
paste()

canDelete

public boolean canDelete()
                  throws JRexException
Indicates whether an Delete operation can be done.

JRexException
See Also:
delete()

undo

public void undo()
          throws JRexException
Invoked to undo an edit operation.

JRexException

redo

public void redo()
          throws JRexException
Invoked to redo an edit operation.

JRexException

cut

public void cut()
         throws JRexException
Invoked to cut selected text.

JRexException

copy

public void copy()
          throws JRexException
Invoked to copy selected text.

JRexException

copyLinkLocation

public void copyLinkLocation()
                      throws JRexException
Invoked to copy selected LinkLocation.

JRexException

copyImageLocation

public void copyImageLocation()
                       throws JRexException
Invoked to copy selected ImageLocation.

JRexException

copyImageContents

public void copyImageContents()
                       throws JRexException
Invoked to copy ImageContents.

JRexException

paste

public void paste()
           throws JRexException
Invoked to paste text from clipboard.

JRexException

selectAll

public void selectAll()
               throws JRexException
Invoked to select all text in an control.

JRexException

selectNone

public void selectNone()
                throws JRexException
Invoked to clear all selection in an control.

JRexException

delete

public void delete()
            throws JRexException
Invoked to delete selected text.

JRexException

find

public boolean find(JRexFindConfig config)
             throws JRexException
Invoked to find a given text.

Returns:
true if a match is found for given config.
JRexException
See Also:
JRexFindConfig

findAgain

public boolean findAgain()
                  throws JRexException
Invoked to repeat previous find.

Returns:
true if a match is found for config set via Find.
JRexException
See Also:
JRexFindConfig

getFindConfig

public JRexFindConfig getFindConfig()
                             throws JRexException
Returns the find config assocaited the browser component instance.

JRexException
See Also:
JRexFindConfig

getPersistFlags

public int getPersistFlags()
                    throws JRexException
Get the flags governing how data is fetched and saved from the network.

JRexException

setPersistFlags

public void setPersistFlags(int persistFlags)
                     throws JRexException
Set the flags governing how data is fetched and saved from the network. It is best to set this value explicitly unless you are prepared to accept the default values.

JRexException

getCurrentPersistState

public int getCurrentPersistState()
                           throws JRexException
Get the current state of the persister object.

JRexException

getPersistResult

public int getPersistResult()
                     throws JRexException
Get the value indicating the success or failure of the persist operation.

JRexException

saveURI

public void saveURI(String uri,
                    String referURI,
                    InputStream postData,
                    String extraHeaders,
                    String filePath,
                    ProgressListener progressListener)
             throws JRexException
Save the given URI.

Parameters:
uri - The URI string to load.
referURI - The referring URI. If this argument is NULL, the referring URI will be inferred internally.
postData - InputStream containing POST data for the request.
extraHeaders - String containing extra headers for the request.
filePath - the complete path where to save the URI.
progressListener - Callback listener for progress notifications. Note:- Progress listener is simply added to the browser component, so all progress listener will get save progress.
JRexException
See Also:
setPersistFlags(int)

saveCurrentDocument

public void saveCurrentDocument(String filePath,
                                String dataPath,
                                String outputContentType,
                                int encodingFlags,
                                int wrapColumn,
                                ProgressListener progressListener)
                         throws JRexException
Save the current DOM document to file. And optionally all linked files (e.g. images, CSS, JS & subframes). Do not call this method until the document has finished loading!

Parameters:
filePath - the complete path where to save the document.
dataPath - Path to directory where URIs linked to the document are saved or nsnull if no linked URIs should be saved.
outputContentType - The desired MIME type format to save the document and all subdocuments into or nsnull to use the default behaviour.
encodingFlags - Flags to pass to the encoder.
wrapColumn - For text documents, indicates the desired width to wrap text at. Parameter is ignored if wrapping is not specified by the encoding flags.
progressListener - Callback listener for progress notifications. Note:- Progress listener is simply added to the browser component, so all progress listener will get save progress.
JRexException

cancelSave

public void cancelSave()
                throws JRexException
Cancels the current operation. The caller is responsible for cleaning up partially written files or directories.

JRexException


Copyright © 2004 C.N.Medappa. All Rights Reserved.