Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Rich Ajax Platform
Release 1.2

org.eclipse.swt.browser
Class Browser

java.lang.Object
  extended by

org.eclipse.swt.widgets.Widget
      extended by

org.eclipse.swt.widgets.Control
          extended by

org.eclipse.swt.widgets.Scrollable
              extended by

org.eclipse.swt.widgets.Composite
                  extended by
org.eclipse.swt.browser.Browser
All Implemented Interfaces:
Adaptable

public class Browser
extends Composite

Instances of this class implement the browser user interface metaphor. It allows the user to visualize and navigate through HTML documents.

Note that although this class is a subclass of Composite, it does not make sense to set a layout on it.

IMPORTANT: This class is not intended to be subclassed.

Since:
1.0

Currently implemented

  • text and url property

The enabled property in not (yet) evaluated.

Focus events are not yet implemented


Field Summary
  String executeScript
           
 
Constructor Summary
Browser ( Composite parent, int style)
          Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
 
Method Summary
 void addLocationListener ( LocationListener listener)
          Adds the listener to the collection of listeners who will be notified when the current location has changed or is about to change.
 boolean execute ( String script)
          Execute the specified script.
  Object getAdapter ( Class adapter)
          Implementation of the Adaptable interface.
  String getUrl ()
          Returns the current URL.
 void removeLocationListener ( LocationListener listener)
          Removes the listener from the collection of listeners who will be notified when the current location is changed or about to be changed.
 boolean setText ( String html)
          Renders HTML.
 boolean setUrl ( String url)
          Loads a URL.
 
Methods inherited from class org.eclipse.swt.widgets. Composite
changed, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setTabList
 
Methods inherited from class org.eclipse.swt.widgets. Scrollable
computeTrim, getClientArea
 
Methods inherited from class org.eclipse.swt.widgets. Control
addControlListener, addFocusListener, addKeyListener, addMouseListener, addTraverseListener, computeSize, forceFocus, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, isEnabled, isFocusControl, isVisible, moveAbove, moveBelow, pack, pack, redraw, removeControlListener, removeFocusListener, removeKeyListener, removeMouseListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay
 
Methods inherited from class org.eclipse.swt.widgets. Widget
addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, notifyListeners, removeDisposeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

executeScript

public 
String executeScript
Constructor Detail

Browser

public Browser(
Composite parent,
               int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

Parameters:
parent - a widget which will be the parent of the new instance (cannot be null)
style - the style of widget to construct
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the parent is null
SWTException -
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
SWTError -
  • ERROR_NO_HANDLES if a handle could not be obtained for browser creation
See Also:
org.eclipse.swt.Widget#getStyle
Method Detail

setUrl

public boolean setUrl(
String url)
Loads a URL.

Parameters:
url - the URL to be loaded
Returns:
true if the operation was successful and false otherwise.
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the url is null
SWTException -
  • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  • ERROR_WIDGET_DISPOSED when the widget has been disposed
See Also:
getUrl()

getUrl

public 
String getUrl()
Returns the current URL.

Returns:
the current URL or an empty String if there is no current URL
Throws:
SWTException -
  • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  • ERROR_WIDGET_DISPOSED when the widget has been disposed
See Also:
setUrl(java.lang.String)

setText

public boolean setText(
String html)
Renders HTML.

The html parameter is Unicode encoded since it is a java String. As a result, the HTML meta tag charset should not be set. The charset is implied by the String itself.

Parameters:
html - the HTML content to be rendered
Returns:
true if the operation was successful and false otherwise.
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the html is null
SWTException -
  • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  • ERROR_WIDGET_DISPOSED when the widget has been disposed
See Also:
setUrl(java.lang.String)

execute

public boolean execute(
String script)
Execute the specified script.

Execute a script containing javascript commands in the context of the current document.

Note: Care should be taken when using this method. The given script is executed in an IFRAME inside the document that represents the client-side application. Since the execution context of an IFRAME is not fully isolated from the surrounding documument it may break the client-side application.

Parameters:
script - the script with javascript commands
Returns:
true if the operation was successful and false otherwise
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the script is null
SWTException -
  • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  • ERROR_WIDGET_DISPOSED when the widget has been disposed
Since:
1.1

addLocationListener

public void addLocationListener(
LocationListener listener)
Adds the listener to the collection of listeners who will be notified when the current location has changed or is about to change.

This notification typically occurs when the application navigates to a new location with setUrl(String) or when the user activates a hyperlink.

Parameters:
listener - the listener which should be notified
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
SWTException -
  • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  • ERROR_WIDGET_DISPOSED when the widget has been disposed

removeLocationListener

public void removeLocationListener(
LocationListener listener)
Removes the listener from the collection of listeners who will be notified when the current location is changed or about to be changed.

Parameters:
listener - the listener which should no longer be notified
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
SWTException -
  • ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  • ERROR_WIDGET_DISPOSED when the widget has been disposed

getAdapter

public 
Object getAdapter(
Class adapter)
Description copied from class: Widget
Implementation of the Adaptable interface.

IMPORTANT: This method is not part of the RWT public API. It is marked public only so that it can be shared within the packages provided by RWT. It should never be accessed from application code.

Specified by:
getAdapter in interface Adaptable
Overrides:
getAdapter in class Composite

Eclipse Rich Ajax Platform
Release 1.2

Copyright (c) Innoopract Informationssysteme GmbH and others 2002, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire