Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 1 (11.1.1)
E10684-06


oracle.adf.view.rich.context
Class WindowIdProvider

java.lang.Object
  extended by oracle.adf.view.rich.context.WindowIdProvider

Direct Known Subclasses:
WindowIdProviderBase

public abstract class WindowIdProvider
extends java.lang.Object

A class responsible for identifying the IDs of windows and providing notification as new windows are opened and closed. An instance of this class may be obtained from AdfFacesContext.


Constructor Summary
protected WindowIdProvider()
          Create a WindowIdProvider.

 

Method Summary
abstract  void addWindowCloseListener(WindowCloseListener listener)
          Adds a WindowCloseListener.
 java.lang.String decodeWindowId(javax.faces.context.ExternalContext externalContext)
          Gets the window Id from the passed-in ExternalContext.
abstract  java.lang.String getCurrentWindowId(javax.faces.context.FacesContext context)
          Gets the ID for the current window, or null if no ID is known.
 java.lang.String getRedirectURL(java.lang.String url)
          This method returns the initial URL that we want to redirect to.
abstract  boolean isNewWindow(javax.faces.context.FacesContext context)
          Returns true if the current request is known to come from a new window.
 boolean isWindowIdAvailable(javax.faces.context.FacesContext context)
          Returns whether a window ID would be available if necessary.
 boolean needsWindowUnloadedEvents(javax.faces.context.FacesContext context)
          Returns whether WindowUnloadedEvents are desired for this specific request.
abstract  void removeWindowCloseListener(WindowCloseListener listener)
          Removes a WindowCloseListener.
abstract  void windowClosed(javax.faces.context.FacesContext context, java.lang.String windowId)
          Called to notify the WindowIdProvider implementation that a window has been closed.
 java.lang.String windowOpened(javax.faces.context.ExternalContext externalContext, java.lang.String baseWindowId, boolean isDialog)
          Called to notify the WindowIdProvider implementation that a new window has been opened.
abstract  java.lang.String windowOpened(javax.faces.context.FacesContext context, java.lang.String baseWindowId)
          Called to notify the WindowIdProvider implementation that a new window has been opened.
 void windowUnloaded(WindowUnloadedEvent event)
          Provides notification that a window has been unloaded.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

WindowIdProvider

protected WindowIdProvider()
Create a WindowIdProvider.

Method Detail

getCurrentWindowId

public abstract java.lang.String getCurrentWindowId(javax.faces.context.FacesContext context)
Gets the ID for the current window, or null if no ID is known. Window IDs must consist entirely of ASCII letters (A-Z, a-z) and digits (0-9) and underscores ("_").

isNewWindow

public abstract boolean isNewWindow(javax.faces.context.FacesContext context)
Returns true if the current request is known to come from a new window. This can return true in two cases:
  1. An initial request from a client window has been detected
  2. windowOpened() has been called during the current request

windowOpened

public abstract java.lang.String windowOpened(javax.faces.context.FacesContext context,
                                              java.lang.String baseWindowId)
Called to notify the WindowIdProvider implementation that a new window has been opened. Users of ADF Faces must not call this method. The implementation may choose to redirect the user to a new URL. In either case, the value of getCurrentWindowId() will be used to set this new window's ID. If the URL-to-redirect-to is the same as the current URL, except for different query parameters, ADF Faces will not necessarily redirect; it may instead simply update the current page's contents so that subsequent postbacks will contain the proper query parameters.
Parameters:
baseWindowId - the ID of the window that launched this, or null if no window is known as the source
Returns:
the URL to redirect to, if a redirection is required, or null if no redirection is required.

windowOpened

public java.lang.String windowOpened(javax.faces.context.ExternalContext externalContext,
                                     java.lang.String baseWindowId,
                                     boolean isDialog)
Called to notify the WindowIdProvider implementation that a new window has been opened. Users of ADF Faces must not call this method. The implementation may choose to redirect the user to a new URL. In either case, the value of getCurrentWindowId() will be used to set this new window's ID. If the URL-to-redirect-to is the same as the current URL, except for different query parameters, ADF Faces will not necessarily redirect; it may instead simply update the current page's contents so that subsequent postbacks will contain the proper query parameters. This method could be called from a servlet filter, where only the ExternalContext is available.
Parameters:
baseWindowId - the ID of the window that launched this, or null if no window is known as the source
isDialog - boolean indicates whether the newly opened window is a dialog. The implementation of this interface may choose to return a different URL in case of a dialog.
Returns:
the URL to redirect to, if a redirection is required, or null if no redirection is required.

windowClosed

public abstract void windowClosed(javax.faces.context.FacesContext context,
                                  java.lang.String windowId)
Called to notify the WindowIdProvider implementation that a window has been closed. NOTE: this method is not called by ADF at this time.

addWindowCloseListener

public abstract void addWindowCloseListener(WindowCloseListener listener)
Adds a WindowCloseListener.

removeWindowCloseListener

public abstract void removeWindowCloseListener(WindowCloseListener listener)
Removes a WindowCloseListener.

isWindowIdAvailable

public boolean isWindowIdAvailable(javax.faces.context.FacesContext context)
Returns whether a window ID would be available if necessary. The default implementation returns true, so subclassers will rarely need to consider overriding this method. It may, however, be overridden to return false in the scenario where a no-op WindowIdProvider is installed to eliminate unnecessary requests.

needsWindowUnloadedEvents

public boolean needsWindowUnloadedEvents(javax.faces.context.FacesContext context)
Returns whether WindowUnloadedEvents are desired for this specific request. By default, returns false. This will be consulted on each request. If an implementation conditionally returns true on some requests and false on others, it is possible for a WindowUnloadedEvent to be delivered even though the most recent call to this method returned false.

This method will most often be called during the Render Response phase, but may be called at any part of the JSF lifecycle if a redirect is requested.

Parameters:
context - the FacesContext instance

windowUnloaded

public void windowUnloaded(WindowUnloadedEvent event)
Provides notification that a window has been unloaded. This can be delivered because of a server-side redirect, or because on the client a user clicked a link, used the Back, Next, or Refresh buttons or is closing the window, or any other browser action that results in page-to-page navigation. While the view layer will attempt to call this method when applicable, there is no guarantee that it will be called in all circumstances - a best effort is made.

The implementer of this method cannot take any action to attempt to redirect, etc. - the only allowable action is updating application state. The lifecycle will terminate after this method is invoked, and any outcomes (setting the view root, etc.) will be ignored.

This method may be called at any point in the JSF lifecycle.

Parameters:
event - the WindowUnloadedEvent

decodeWindowId

public java.lang.String decodeWindowId(javax.faces.context.ExternalContext externalContext)
Gets the window Id from the passed-in ExternalContext. This method could be called from a Filter. The difference between this method and the getCurrentWindowId() method is that getCurrentWindowId() has to be called from within JSF. This method can give you a window Id from a Filter as long as you have an ExternalContext.
Parameters:
externalContext -
Returns:
window Id

getRedirectURL

public java.lang.String getRedirectURL(java.lang.String url)
This method returns the initial URL that we want to redirect to. Usually this means we will get an URL which doesn't contain any special control tokens in it. So that we can start from scratch again.
Parameters:
url - the original URL
Returns:
the new URL that we want to redirect to

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 1 (11.1.1)
E10684-06


Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.