Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.ide.editor
Class AsynchronousEditor

java.lang.Object
  extended by oracle.ide.view.View
      extended by oracle.ide.editor.Editor
          extended by oracle.ide.editor.AsynchronousEditor

All Implemented Interfaces:
ControllerProvider, Helpable, LayoutSelector, Observer

public abstract class AsynchronousEditor
extends Editor

Base editor template for editors that load the UI model on a thread off the event dispatch thread.


Field Summary

 

Fields inherited from class oracle.ide.editor.Editor
_addin, _context, ATTRIBUTE_BACKGROUND_COLOR, ATTRIBUTE_CUSTOM_HORIZONTAL_SCROLLBAR, ATTRIBUTE_CUSTOM_VERTICAL_SCROLLBAR, ATTRIBUTE_DELAY_PALETTE_LOAD, ATTRIBUTE_HORIZONTAL_BLOCK_INCREMENT, ATTRIBUTE_HORIZONTAL_SCROLLBAR_POLICY, ATTRIBUTE_HORIZONTAL_UNIT_INCREMENT, ATTRIBUTE_MENU_ID, ATTRIBUTE_OLD_EDITOR, ATTRIBUTE_SCROLLABLE, ATTRIBUTE_VERTICAL_BLOCK_INCREMENT, ATTRIBUTE_VERTICAL_SCROLLBAR_POLICY, ATTRIBUTE_VERTICAL_UNIT_INCREMENT, CUSTOM_BORDER, PROPERTY_FIXED_BOTTOM_MARGIN, PROPERTY_FIXED_LEFT_MARGIN, PROPERTY_FIXED_RIGHT_MARGIN, PROPERTY_FIXED_TOP_MARGIN, PROPERTY_SCROLLABLE_LEFT_MARGIN, PROPERTY_SCROLLABLE_TOP_MARGIN

 

Fields inherited from class oracle.ide.view.View
EMPTY_SELECTION, PROJECT_PROP, VISIBLE_PROP, WORKSPACE_PROP

 

Constructor Summary
AsynchronousEditor()
          Creates a new AsynchronousEditor.

 

Method Summary
 void activate()
          Called when this editor is the active view.
protected  void activateImpl(boolean contentAvailable)
          Called when this editor is the active view.
protected  boolean asyncModeEnabled()
          Indicates whether this editor supports asynchronous loading of its contents.
 void close()
          Closes this editor.
protected  void closeImpl(boolean contentAvailable)
          Closes this editor.
protected  void contextAvailable()
          Indicates that the context has been set in this editor, after the UI model has been loaded in a worker thread.
protected  java.awt.Component createEditorNotInitializedGUI()
          Component to be put in the center of the editor while the UI model is being created (e.g.
protected  java.lang.Runnable createUIModelGetterTask(Context newContext)
          Creates the task that will load the UI model off the event thread.
 void deactivate()
          Cleans up after this editor stops being the active view.
protected  void deactivateImpl(boolean contentAvailable)
          Cleans up after this editor stops being the active view.
protected  Context delayContextSet(Context newContext)
          Sets the Context, whose UI should be used only after its UI model becomes available.
protected abstract  void doSetContext(Context context)
          This is where the context gets actually applied to the editor.
 void editorHidden()
          This method is called when an editor is hidden.
protected  void editorReady()
          Called when this editor's UI is ready to be displayed.
 void editorShown()
          Called when this editor is made visible.
protected abstract  void getEditorContent(Context newContext)
          This is the action where loading the UI model takes place.
protected  java.awt.Component getEditorNotInitializedGUI()
          Returns the UI to be displayed while the editor's UI model is being loaded off the event dispatch thread (in a separate worker thread.)
protected  java.lang.String getEditorNotInitializedMessage()
           
 java.awt.Component getGUI()
          Returns the editor's UI if: the editor is not in asynchronous mode the editor is in asynchronous mode, but it finish loading the UI model off the event dispatch thread otherwise it will return the UI to be shown while the UI model is being loaded.
protected abstract  java.awt.Component getGUIComponent()
          Returns this editor's UI component.
protected  void hiddenImpl(boolean contentAvailable)
          This method is called when an editor is hidden.
static void invokeLaterAfterRepaint(java.lang.Runnable runnable)
          Invokes the given task in the Event Dispatch Thread.
protected  boolean isActivated()
          Indicates whether this editor is the active view.
protected abstract  boolean isContentModelLoaded()
          Indicates whether the model for this editor's UI has been already loaded.
protected  boolean isOpened()
          Indicates whether this editor is open.
protected  boolean isShown()
          Indicates whether this editor is shown.
 void open()
          Delegates opening this editor to openImpl(boolean) if this editor has not been previously opened.
protected abstract  void openImpl(boolean contentAvailable)
          Opens this editor, if it wasn't previously opened.
protected  void scheduleTask(ProgressTrackedTask task, Context context)
          Schedules the given task in the IDE's ProgressTracker.
 void setContext(Context newContext)
          Sets the current Context for this editor.
protected  void setDelayedContext(Context newContext)
          Updates this editor with the given context.
protected  void shownImpl(boolean contentAvailable)
          Called when this editor is made visible.
protected  void switchEditorGUI(java.awt.Component newEditorGUI)
          Replaces current component shown by this editor with the given one.
protected  void switchEditorGuiInUiThread(java.awt.Component newEditorGUI)
          Calls switchEditorGUI(java.awt.Component) making sure the call is made in the UI thread (EDT.)
 void update(java.lang.Object observed, UpdateMessage change)
          Notification message.
protected  void updateContextImpl(Context context)
          Called when the IDE context is ready to be used by the editor.

 

Methods inherited from class oracle.ide.editor.Editor
addPreferredLayoutListener, addPropertyChangeListener, firePropertyChangeEvent, getBottomComponent, getContext, getContextMenu, getController, getDefaultFocusComponent, getDependentNodes, getDisplayName, getEditorAddin, getEditorAttribute, getFixedBottomMargin, getFixedLeftMargin, getFixedRightMargin, getFixedTopMargin, getMiniToolbar, getPreferredLayoutBaseName, getPreferredLayoutURL, getScrollableLeftMargin, getScrollableTopMargin, getTabDescription, getTabIcon, getTabLabel, getTitleLabel, getType, initializeActiveLayout, initializeLayout, isReady, loadSettings, newId, prepareForSaving, removePreferredLayoutListener, removePropertyChangeListener, saveSettings, setEditorAddin, setEditorAttribute, setPreferredLayoutBaseName, setPreferredLayoutURL, setType

 

Methods inherited from class oracle.ide.view.View
addViewListener, addViewSelectionListener, addViewStateListener, fireViewCollapsed, fireViewExpanded, fireViewSelectionChanged, getContext, getHelpInfo, getId, getSelection, getSelectionFromUI, getTabName, getToolbar, getViewWithoutDecoration, isVisible, loadLayout, loadManifestToolbar, loadManifestToolbar, owner, removeViewListener, removeViewSelectionListener, removeViewStateListener, saveLayout, scheduleUpdateSelection, setId, setOwner, setToolbarVisible, show, toString, updateSelection, updateSelectionImpl, updateTitle, updateToolbarActions, updateVisibleActions, updateVisibleActions

 

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

 

Constructor Detail

AsynchronousEditor

public AsynchronousEditor()
Creates a new AsynchronousEditor.

Method Detail

setContext

public final void setContext(Context newContext)
Sets the current Context for this editor.

If this editor is working in asynchronous mode, the model for this editor's UI will not be loaded inmediately. Instead, it will be loaded in a separate worker thread. This editor's UI will be displayed once the model has been loaded.

Overrides:
setContext in class Editor
Parameters:
newContext - the new Context to set.

delayContextSet

protected Context delayContextSet(Context newContext)
Sets the Context, whose UI should be used only after its UI model becomes available.
Parameters:
newContext - the new Context to set.
newContext - the new Context to set.

asyncModeEnabled

protected boolean asyncModeEnabled()
Indicates whether this editor supports asynchronous loading of its contents.
Returns:
true by default. Subclasses can opt out by overriding this method to return false.

open

public final void open()
Delegates opening this editor to openImpl(boolean) if this editor has not been previously opened.
Specified by:
open in class Editor
See Also:
openImpl(boolean)

editorShown

public final void editorShown()
Called when this editor is made visible. This method delegates handling of this event to shownImpl(boolean).
Overrides:
editorShown in class Editor
See Also:
shownImpl(boolean)

activate

public final void activate()
Called when this editor is the active view. This method only fires a "view activated" event and then delegates handling of this editor's activation to activateImpl(boolean).
Overrides:
activate in class View
See Also:
activateImpl(boolean)

deactivate

public final void deactivate()
Cleans up after this editor stops being the active view. This method only fires a "view deactivated" event and then delegates handling of this editor's deactivation to {@link #deactivateImpl(boolean).
Overrides:
deactivate in class View
See Also:
deactivateImpl(boolean)

editorHidden

public final void editorHidden()
This method is called when an editor is hidden. This method delegates handling this event to hiddenImpl(boolean).
Overrides:
editorHidden in class Editor
See Also:
hiddenImpl(boolean)

close

public final void close()
Closes this editor. This method delegates closing this editor to closeImpl(boolean).
Overrides:
close in class Editor
See Also:
closeImpl(boolean)

isContentModelLoaded

protected abstract boolean isContentModelLoaded()
Indicates whether the model for this editor's UI has been already loaded.
Returns:
true if the model has been loaded; false otherwise.

getGUI

public final java.awt.Component getGUI()
Returns the editor's UI if: otherwise it will return the UI to be shown while the UI model is being loaded.
Specified by:
getGUI in class View
Returns:
the root graphical user interface component.

getGUIComponent

protected abstract java.awt.Component getGUIComponent()
Returns this editor's UI component. This method should return null if this editor's UI is not ready yet (e.g. the model is still being loaded in a worker thread.)
Returns:
this editor's UI component, or null if the UI is not ready yet.

getEditorNotInitializedGUI

protected final java.awt.Component getEditorNotInitializedGUI()
Returns the UI to be displayed while the editor's UI model is being loaded off the event dispatch thread (in a separate worker thread.)
Returns:
the UI to be displayed while the editor's UI model is being loaded.

createUIModelGetterTask

protected java.lang.Runnable createUIModelGetterTask(Context newContext)
Creates the task that will load the UI model off the event thread.
Parameters:
newContext - the IDE Context.
Returns:
the created task.

getEditorContent

protected abstract void getEditorContent(Context newContext)
This is the action where loading the UI model takes place. This method is called off the event thread.
See Also:
createUIModelGetterTask(Context)

setDelayedContext

protected final void setDelayedContext(Context newContext)
Updates this editor with the given context. The given context is usually the context that was originally set by setContext(Context). This method is usually called after the UI model has been loaded off the event thread.
Parameters:
newContext - the Context to set.

updateContextImpl

protected void updateContextImpl(Context context)
Called when the IDE context is ready to be used by the editor. If async mode is disabled, this method is called from within the setContext. Otherwise it is called after the UI model becomes available.
Parameters:
context - the Context to set.

doSetContext

protected abstract void doSetContext(Context context)
This is where the context gets actually applied to the editor. This method is analogous to setContext in non-asynchronous editors.
Parameters:
context - the Context to set.

contextAvailable

protected void contextAvailable()
Indicates that the context has been set in this editor, after the UI model has been loaded in a worker thread.

isOpened

protected final boolean isOpened()
Indicates whether this editor is open.
Returns:
true if this editor is open; false otherwise.

isActivated

protected final boolean isActivated()
Indicates whether this editor is the active view.
Returns:
true if this editor is the active view; false otherwise.

isShown

protected final boolean isShown()
Indicates whether this editor is shown.
Returns:
true if this editor is shown; false otherwise.

editorReady

protected void editorReady()
Called when this editor's UI is ready to be displayed.

switchEditorGuiInUiThread

protected final void switchEditorGuiInUiThread(java.awt.Component newEditorGUI)
Calls switchEditorGUI(java.awt.Component) making sure the call is made in the UI thread (EDT.)
Parameters:
newEditorGUI - the new editor UI.

switchEditorGUI

protected void switchEditorGUI(java.awt.Component newEditorGUI)
Replaces current component shown by this editor with the given one. It is recommended to call this method in editorReady().

This method will be called by AsynchronousEditor automatically. Subclasses should not call this method directly, unless they need to handle very special use cases. If you need to call this method, please check that it is done in the UI thread. It is recommended to call switchEditorGuiInUiThread(java.awt.Component) instead.

Parameters:
newEditorGUI - the new editor UI. *

scheduleTask

protected void scheduleTask(ProgressTrackedTask task,
                            Context context)
Schedules the given task in the IDE's ProgressTracker.
Parameters:
task - the task to schedule.
context - the current context.

invokeLaterAfterRepaint

public static void invokeLaterAfterRepaint(java.lang.Runnable runnable)
Invokes the given task in the Event Dispatch Thread.
Parameters:
runnable - the given task.

createEditorNotInitializedGUI

protected java.awt.Component createEditorNotInitializedGUI()
Component to be put in the center of the editor while the UI model is being created (e.g. a JLabel with text "Loading Editor".)
Returns:
the component to be put in the center of the editor while the UI model is being created.

getEditorNotInitializedMessage

protected java.lang.String getEditorNotInitializedMessage()

update

public void update(java.lang.Object observed,
                   UpdateMessage change)
Description copied from interface: Observer
Notification message. Subjects call this method when they notify their observers that the subjects state has changed.
Parameters:
observed - the subject whose state has changed.
change - what has changed.
See Also:
Observer.update(Object, UpdateMessage)

openImpl

protected abstract void openImpl(boolean contentAvailable)
Opens this editor, if it wasn't previously opened.
Parameters:
contentAvailable - indicates whether the model of this editor's UI has been already loaded or not.

closeImpl

protected void closeImpl(boolean contentAvailable)
Closes this editor.
Parameters:
contentAvailable - indicates whether the model of this editor's UI has been already loaded or not.

shownImpl

protected void shownImpl(boolean contentAvailable)
Called when this editor is made visible.
Parameters:
contentAvailable - indicates whether the model of this editor's UI has been already loaded or not.

hiddenImpl

protected void hiddenImpl(boolean contentAvailable)
This method is called when an editor is hidden.
Parameters:
contentAvailable - indicates whether the model of this editor's UI has been already loaded or not.

activateImpl

protected void activateImpl(boolean contentAvailable)
Called when this editor is the active view.
Parameters:
contentAvailable - indicates whether the model of this editor's UI has been already loaded or not.

deactivateImpl

protected void deactivateImpl(boolean contentAvailable)
Cleans up after this editor stops being the active view.
Parameters:
contentAvailable - indicates whether the model of this editor's UI has been already loaded or not.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


Copyright © 1997, 2012, Oracle. All rights reserved.