org.mozilla.webclient
Interface NewWindowListener

All Superinterfaces:
WebclientEventListener

public interface NewWindowListener
extends WebclientEventListener

This interface allows the implementer to be notified of NewWindowEvents that occur as a result of user browsing. For example, pop-ups.

The constants defined in this interface should really be defined on NewWindowEvent, but they remain here for backwards compatability. They are given to the user as the value of the type property of the NewWindowEvent. They advise the user on the characteristics of the new window to be created. They should be anded with the argument eventType to determine if they are indicated for this event. Here is an example of how to create a new window in response to a NewWindowEvent:



public void eventDispatched(WebclientEvent newWindowEvent) {

  BrowserControl newBrowserControl = null;
  BrowserControlCanvas newCanvas = null;

  Frame newFrame = new Frame();

  long type = newWindowEvent.getType();
  if (type & NewWindowListener.CHROME_MENUBAR) {
    // create a menu bar for the new window
  }
  if (type & NewWindowListener.CHROME_WINDOW_CLOSE) {
    // Make it so this window cannot be closed
  }

  try {
    newBrowserControl = BrowserControlFactory.newBrowserControl();
    newCanvas = (BrowserControlCanvas)
      newBrowserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
    // obtain any other interfaces you need.
  } catch (Throwable e) {
      System.out.println(e.getMessage());
  }

  newFrame.add(newCanvas, BorderLayout.CENTER);
  newFrame.setVisible(true);
  newCanvas.setVisible(true);
}

 


Field Summary
static long CHROME_ALL
           
static long CHROME_DEFAULT
           
static long CHROME_EXTRA
           
static long CHROME_LOCATIONBAR
          Specifies whether to display the input field for entering URLs directly into the browser.
static long CHROME_MENUBAR
          Specifies whether to display the menu bar.
static long CHROME_PERSONAL_TOOLBAR
          Specifies whether to display the personal bar.
static long CHROME_SCROLLBARS
          Specifies whether to display horizontal and vertical scroll bars.
static long CHROME_STATUSBAR
          Specifies whether to add a status bar at the bottom of the window.
static long CHROME_TITLEBAR
          Specifies whether to display a title bar for the window.
static long CHROME_TOOLBAR
          Specifies whether to display the browser toolbar, making buttons such as Back, Forward, and Stop available.
static long CHROME_WINDOW_BORDERS
           
static long CHROME_WINDOW_CLOSE
           
static long CHROME_WINDOW_MIN
          Specifies whether the window is minimizable.
static long CHROME_WINDOW_POPUP
           
static long CHROME_WINDOW_RESIZE
          Specifies whether the window is resizable.
static long CHROME_WITH_POSITION
           
static long CHROME_WITH_SIZE
           
 
Method Summary
 
Methods inherited from interface org.mozilla.webclient.WebclientEventListener
eventDispatched
 

Field Detail

CHROME_DEFAULT

static final long CHROME_DEFAULT
See Also:
Constant Field Values

CHROME_WINDOW_BORDERS

static final long CHROME_WINDOW_BORDERS
See Also:
Constant Field Values

CHROME_WINDOW_CLOSE

static final long CHROME_WINDOW_CLOSE
See Also:
Constant Field Values

CHROME_WINDOW_RESIZE

static final long CHROME_WINDOW_RESIZE
Specifies whether the window is resizable.

See Also:
Constant Field Values

CHROME_MENUBAR

static final long CHROME_MENUBAR
Specifies whether to display the menu bar.

See Also:
Constant Field Values

CHROME_TOOLBAR

static final long CHROME_TOOLBAR
Specifies whether to display the browser toolbar, making buttons such as Back, Forward, and Stop available.

See Also:
Constant Field Values

CHROME_LOCATIONBAR

static final long CHROME_LOCATIONBAR
Specifies whether to display the input field for entering URLs directly into the browser.

See Also:
Constant Field Values

CHROME_STATUSBAR

static final long CHROME_STATUSBAR
Specifies whether to add a status bar at the bottom of the window.

See Also:
Constant Field Values

CHROME_PERSONAL_TOOLBAR

static final long CHROME_PERSONAL_TOOLBAR
Specifies whether to display the personal bar. (Mozilla only)

See Also:
Constant Field Values

CHROME_SCROLLBARS

static final long CHROME_SCROLLBARS
Specifies whether to display horizontal and vertical scroll bars.

See Also:
Constant Field Values

CHROME_TITLEBAR

static final long CHROME_TITLEBAR
Specifies whether to display a title bar for the window.

See Also:
Constant Field Values

CHROME_EXTRA

static final long CHROME_EXTRA
See Also:
Constant Field Values

CHROME_WITH_SIZE

static final long CHROME_WITH_SIZE
See Also:
Constant Field Values

CHROME_WITH_POSITION

static final long CHROME_WITH_POSITION
See Also:
Constant Field Values

CHROME_WINDOW_MIN

static final long CHROME_WINDOW_MIN
Specifies whether the window is minimizable.

See Also:
Constant Field Values

CHROME_WINDOW_POPUP

static final long CHROME_WINDOW_POPUP
See Also:
Constant Field Values

CHROME_ALL

static final long CHROME_ALL
See Also:
Constant Field Values


Copyright 2002-2007 Mozilla.org All Rights Reserved.