站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

MultiViewElement (MultiView Windows) - NetBeans API Javadoc (Current Development Version)

org.netbeans.core.multiview/1 1.9

org.netbeans.core.spi.multiview
Interface MultiViewElement


public interface MultiViewElement

View element for multi view, provides the UI components to the multiview component. Gets notified by the enclosing component about the changes in the lifecycle.


Method Summary
 CloseOperationState canCloseElement()
          Element decides if it can be safely closed.
 void componentActivated()
          Called when this multi view element is activated.
 void componentClosed()
          Called only when multi view top component was closed.
 void componentDeactivated()
          Called when this multi view element is deactivated.
 void componentHidden()
          Called when this MultiViewElement was hidden.
 void componentOpened()
          Called only when enclosing multi view top component was closed before and now is opened again for the first time.
 void componentShowing()
          Called when this MultiViewElement is about to be shown.
 Action[] getActions()
          Gets the actions which will appear in the popup menu of this component.
 Lookup getLookup()
          Lookup for the MultiViewElement.
 JComponent getToolbarRepresentation()
          Returns the visual component with the multi view element's toolbar.Should be relatively fast as it's called everytime the current perspective is switched.
 UndoRedo getUndoRedo()
          UndoRedo support, Get the undo/redo support for this element.
 JComponent getVisualRepresentation()
          Returns Swing visual representation of this multi view element.
 void setMultiViewCallback(MultiViewElementCallback callback)
          Use the passed in callback instance for manipulating the enclosing multiview component, keep the instance around during lifecycle of the component if you want to automatically switch to this component etc.
 

Method Detail

getVisualRepresentation

JComponent getVisualRepresentation()
Returns Swing visual representation of this multi view element. Should be relatively fast and always return the same component.


getToolbarRepresentation

JComponent getToolbarRepresentation()
Returns the visual component with the multi view element's toolbar.Should be relatively fast as it's called everytime the current perspective is switched.


getActions

Action[] getActions()
Gets the actions which will appear in the popup menu of this component.

Subclasses are encouraged to use add the default TopComponent actions to the array of their own. These are accessible by calling MultiViewElementCallback.createDefaultActions()

 
          public Action[] getActions() {
             Action[] retValue;
             // the multiviewObserver was passed to the element in setMultiViewCallback() method.
             if (multiViewObserver != null) {
                 retValue = multiViewObserver.createDefaultActions();
                 // add you own custom actions here..
             } else {
                 // fallback..
                 retValue = super.getActions();
             }
             return retValue;
         }
   

Returns:
array of actions for this component

getLookup

Lookup getLookup()
Lookup for the MultiViewElement. Will become part of the TopComponent's lookup.

Returns:
the lookup to use when the MultiViewElement is active.

componentOpened

void componentOpened()
Called only when enclosing multi view top component was closed before and now is opened again for the first time. The intent is to provide subclasses information about multi view TopComponent's life cycle. Subclasses will usually perform initializing tasks here.


componentClosed

void componentClosed()
Called only when multi view top component was closed. The intent is to provide subclasses information about TopComponent's life cycle. Subclasses will usually perform cleaning tasks here.


componentShowing

void componentShowing()
Called when this MultiViewElement is about to be shown. That can happen when switching the current perspective/view or when the topcomonent itself is shown for the first time.


componentHidden

void componentHidden()
Called when this MultiViewElement was hidden. This happens when other view replaces this one as the selected view or when the whole topcomponent gets hidden (eg. when user selects anothe topcomponent in the current mode).


componentActivated

void componentActivated()
Called when this multi view element is activated. This happens when the parent window of this component gets focus (and this component is the preferred one in it), or when this component is selected in its window (and its window was already focused).


componentDeactivated

void componentDeactivated()
Called when this multi view element is deactivated. This happens when the parent window of this component loses focus (and this component is the preferred one in the parent), or when this component loses preference in the parent window (and the parent window is focussed).


getUndoRedo

UndoRedo getUndoRedo()
UndoRedo support, Get the undo/redo support for this element.

Returns:
undoable edit for this component, null if not implemented.

setMultiViewCallback

void setMultiViewCallback(MultiViewElementCallback callback)
Use the passed in callback instance for manipulating the enclosing multiview component, keep the instance around during lifecycle of the component if you want to automatically switch to this component etc. The enclosing window enviroment attaches the callback right after creating the element from the description. Same applies for deserialization of MultiViewTopComponent, thus MultiViewElement implementors shall not attempt to serialize the passed instance.


canCloseElement

CloseOperationState canCloseElement()
Element decides if it can be safely closed. The element shall just return a value (created by MultiViewFactory.createCloseState() factory method), not open any UI, that is a semantical difference from TopComponent.canClose(). The CloseOperationHandler is the centralized place to show dialogs to the user. In cases when the element is consistent, just return CloseOperationState.STATE_OK.


org.netbeans.core.multiview/1 1.9

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.