org.netbeans.modules.jellytools.platform/3 3.13

org.netbeans.jellytools
Class TopComponentOperator

java.lang.Object
  extended by org.netbeans.jemmy.operators.Operator
      extended by org.netbeans.jemmy.operators.ComponentOperator
          extended by org.netbeans.jemmy.operators.ContainerOperator
              extended by org.netbeans.jemmy.operators.JComponentOperator
                  extended by org.netbeans.jellytools.TopComponentOperator
All Implemented Interfaces:
org.netbeans.jemmy.Outputable, org.netbeans.jemmy.Timeoutable
Direct Known Subclasses:
FavoritesOperator, OutputOperator, PropertySheetOperator

public class TopComponentOperator
extends org.netbeans.jemmy.operators.JComponentOperator

Represents org.openide.windows.TopComponent. It is IDE wrapper for a lot of panels in IDE. TopComponent is for example Projects panel, every editor panel or output panel. TopComponent can be located by TopComponentOperator anywhere inside IDE, if it is opened. It is by default activated which means it is put to foreground if there exist more top components in a split area. TopComponent can also be located explicitly inside some Container.

Usage:

      TopComponentOperator tco = new TopComponentOperator("Projects");
      tco.pushMenuOnTab("Maximize");
      tco.restore();
      tco.attachTo("Files", AttachWindowAction.AS_LAST_TAB);
      tco.attachTo("Output", AttachWindowAction.RIGHT);
      tco.close();
 

See Also:
AttachWindowAction, CloneViewAction, CloseAllDocumentsAction, CloseViewAction, MaximizeWindowAction, RestoreWindowAction

Nested Class Summary
 
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.JComponentOperator
org.netbeans.jemmy.operators.JComponentOperator.JComponentByTipFinder, org.netbeans.jemmy.operators.JComponentOperator.JComponentFinder
 
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.ContainerOperator
org.netbeans.jemmy.operators.ContainerOperator.ContainerFinder
 
Nested classes/interfaces inherited from class org.netbeans.jemmy.operators.Operator
org.netbeans.jemmy.operators.Operator.ComponentVisualizer, org.netbeans.jemmy.operators.Operator.DefaultPathParser, org.netbeans.jemmy.operators.Operator.DefaultStringComparator, org.netbeans.jemmy.operators.Operator.Finder, org.netbeans.jemmy.operators.Operator.MapAction, org.netbeans.jemmy.operators.Operator.MapBooleanAction, org.netbeans.jemmy.operators.Operator.MapByteAction, org.netbeans.jemmy.operators.Operator.MapCharacterAction, org.netbeans.jemmy.operators.Operator.MapDoubleAction, org.netbeans.jemmy.operators.Operator.MapFloatAction, org.netbeans.jemmy.operators.Operator.MapIntegerAction, org.netbeans.jemmy.operators.Operator.MapLongAction, org.netbeans.jemmy.operators.Operator.MapVoidAction, org.netbeans.jemmy.operators.Operator.NoBlockingAction, org.netbeans.jemmy.operators.Operator.PathParser, org.netbeans.jemmy.operators.Operator.StringComparator
 
Field Summary
 
Fields inherited from class org.netbeans.jemmy.operators.JComponentOperator
A11Y_DATA, A11Y_DESCRIPTION_DPROP, A11Y_NAME_DPROP, TOOLTIP_TEXT_DPROP
 
Fields inherited from class org.netbeans.jemmy.operators.ComponentOperator
HEIGHT_DPROP, IS_SHOWING_DPROP, IS_VISIBLE_DPROP, NAME_DPROP, WIDTH_DPROP, X_DPROP, Y_DPROP
 
Fields inherited from class org.netbeans.jemmy.operators.Operator
CLASS_DPROP, TO_STRING_DPROP
 
Constructor Summary
TopComponentOperator(org.netbeans.jemmy.operators.ContainerOperator contOper)
          Waits for first TopComponent in specified container.
TopComponentOperator(org.netbeans.jemmy.operators.ContainerOperator contOper, int index)
          Waits for index-th TopComponent in specified container.
TopComponentOperator(org.netbeans.jemmy.operators.ContainerOperator contOper, String topComponentName)
          Waits for TopComponent with given name in specified container.
TopComponentOperator(org.netbeans.jemmy.operators.ContainerOperator contOper, String topComponentName, int index)
          Waits for index-th TopComponent with given name in specified container.
TopComponentOperator(JComponent jComponent)
          Creates new instance from given TopComponent.
TopComponentOperator(String topComponentName)
          Waits for first TopComponent with given name in whole IDE.
TopComponentOperator(String topComponentName, int index)
          Waits for index-th TopComponent with given name in whole IDE.
 
Method Summary
 void attachTo(String targetTopComponentName, String side)
          Attaches this top component to a new position defined by target top component and side.
 void attachTo(TopComponentOperator targetTopComponentOperator, String side)
          Attaches this top component to a new position defined by target top component and side.
 void cloneDocument()
          Clones this TopComponent.
 void close()
          Closes this TopComponent instance by IDE API call and wait until it is not closed.
 void closeAllDocuments()
          Closes all opened documents and waits until this top component is closed.
 void closeDiscard()
          Closes this TopComponent instance by IDE API call and wait until it is not closed.
 void closeWindow()
          Closes this TopComponent and wait until it is closed.
protected  TopComponentOperator findParentTopComponent()
          Returns TopComponentOperator from parents hierarchy.
 TabbedContainer findTabbedAdapter()
          Returns TabbedAdapter component from parents hierarchy.
 Container findTabDisplayer()
           
protected static JComponent findTopComponent(org.netbeans.jemmy.operators.ContainerOperator cont, String name, int index, org.netbeans.jemmy.ComponentChooser subchooser)
          Finds index-th TopComponent with given name in IDE registry.
static JComponent findTopComponent(String name, int index)
          Finds index-th TopComponent with given name in whole IDE.
 boolean isModified()
          Returns true if this top component is modified (e.g.
protected  boolean isOpened()
          Returns true if this TopComponent is opened.
 void makeComponentVisible()
          Makes active window in which this top component resides (main window in joined mode) and then activates this top component to be in the foreground.
 void maximize()
          Maximizes this top component.
 void pushMenuOnTab(String popupPath)
          Makes top component active and pushes given menu on its tab.
 void restore()
          Restores maximized window.
 void save()
          Saves content of this TopComponent.
 void setUnmodified()
          Finds DataObject for the content of this TopComponent and set it unmodified.
 void waitClosed()
          Waits the topcomponent to be closed.
protected static JComponent waitTopComponent(org.netbeans.jemmy.operators.ContainerOperator cont, String name, int index, org.netbeans.jemmy.ComponentChooser subchooser)
          Waits for index-th TopComponent with given name in IDE registry.
protected static JComponent waitTopComponent(String name, int index)
          Waits for index-th TopComponent with given name in IDE registry.
 
Methods inherited from class org.netbeans.jemmy.operators.JComponentOperator
addAncestorListener, addVetoableChangeListener, computeVisibleRect, createToolTip, findJComponent, findJComponent, findJComponent, findJComponent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getAutoscrolls, getBorder, getCenterXForClick, getCenterYForClick, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDump, getInsets, getNextFocusableComponent, getOutput, getRegisteredKeyStrokes, getRootPane, getTimeouts, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVisibleRect, getWindowContainerOperator, grabFocus, isFocusCycleRoot, isManagingFocus, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, requestDefaultFocus, resetKeyboardActions, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setOutput, setPreferredSize, setRequestFocusEnabled, setTimeouts, setToolTipText, showToolTip, unregisterKeyboardAction, updateUI, waitJComponent, waitJComponent, waitJComponent, waitJComponent, waitToolTip
 
Methods inherited from class org.netbeans.jemmy.operators.ContainerOperator
add, add, add, add, add, addContainerListener, createSubOperator, createSubOperator, findComponentAt, findComponentAt, findContainer, findContainer, findContainer, findContainer, findContainerUnder, findContainerUnder, findSubComponent, findSubComponent, getComponent, getComponentCount, getComponents, getInsets, getLayout, isAncestorOf, paintComponents, printComponents, remove, remove, removeAll, removeContainerListener, setLayout, waitContainer, waitContainer, waitContainer, waitContainer, waitSubComponent, waitSubComponent
 
Methods inherited from class org.netbeans.jemmy.operators.ComponentOperator
activateWindow, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, checkImage, checkImage, clickForPopup, clickForPopup, clickForPopup, clickForPopup, clickMouse, clickMouse, clickMouse, clickMouse, clickMouse, clickMouse, clickMouse, contains, contains, copyEnvironment, createImage, createImage, dispatchEvent, doLayout, dragMouse, dragMouse, dragMouse, dragNDrop, dragNDrop, dragNDrop, enableInputMethods, enterMouse, exitMouse, findComponent, findComponent, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getCenterX, getCenterY, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getContainer, getContainers, getCursor, getDropTarget, getEventDispatcher, getFocus, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getSize, getSource, getToolkit, getTreeLock, getWidth, getWindow, getX, getY, hasFocus, imageUpdate, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, list, list, list, list, list, moveMouse, paint, paintAll, prepareImage, prepareImage, pressKey, pressKey, pressMouse, pressMouse, print, printAll, pushKey, pushKey, releaseKey, releaseKey, releaseMouse, releaseMouse, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, transferFocus, typeKey, typeKey, typeKey, update, validate, waitComponent, waitComponent, waitComponent, waitComponent, waitComponentEnabled, waitComponentShowing, waitComponentVisible, waitHasFocus, wtComponentEnabled
 
Methods inherited from class org.netbeans.jemmy.operators.Operator
addOperatorPackage, addToDump, addToDump, createOperator, getCharBindingMap, getCharKey, getCharModifiers, getCharsKeys, getCharsKeys, getCharsModifiers, getCharsModifiers, getComparator, getDefaultComponentVisualizer, getDefaultMouseButton, getDefaultPathParser, getDefaultStringComparator, getDefaultVerification, getEnvironmentOperator, getParentPath, getParentPath, getPathParser, getPopupMouseButton, getProperties, getQueueTool, getVerification, getVisualizer, isCaptionEqual, isCaptionEqual, isCaptionEqual, lockQueue, parseString, parseString, printDump, produceNoBlocking, produceNoBlocking, produceTimeRestricted, produceTimeRestricted, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, runMapping, setCharBindingMap, setComparator, setDefaultComponentVisualizer, setDefaultPathParser, setDefaultStringComparator, setDefaultVerification, setPathParser, setProperties, setVerification, setVisualizer, toStringSource, unlockAndThrow, unlockQueue, waitState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopComponentOperator

public TopComponentOperator(org.netbeans.jemmy.operators.ContainerOperator contOper,
                            String topComponentName,
                            int index)
Waits for index-th TopComponent with given name in specified container. It is activated by default.

Parameters:
contOper - container where to search
topComponentName - name of TopComponent (it used to be label of tab)
index - index of TopComponent to be find

TopComponentOperator

public TopComponentOperator(org.netbeans.jemmy.operators.ContainerOperator contOper,
                            String topComponentName)
Waits for TopComponent with given name in specified container. It is activated by default.

Parameters:
contOper - container where to search
topComponentName - name of TopComponent (it used to be label of tab)

TopComponentOperator

public TopComponentOperator(org.netbeans.jemmy.operators.ContainerOperator contOper,
                            int index)
Waits for index-th TopComponent in specified container. It is activated by default.

Parameters:
contOper - container where to search
index - index of TopComponent to be find

TopComponentOperator

public TopComponentOperator(org.netbeans.jemmy.operators.ContainerOperator contOper)
Waits for first TopComponent in specified container. It is activated by default.

Parameters:
contOper - container where to search

TopComponentOperator

public TopComponentOperator(String topComponentName,
                            int index)
Waits for index-th TopComponent with given name in whole IDE. It is activated by default.

Parameters:
topComponentName - name of TopComponent (it used to be label of tab)
index - index of TopComponent to be find

TopComponentOperator

public TopComponentOperator(String topComponentName)
Waits for first TopComponent with given name in whole IDE. It is activated by default.

Parameters:
topComponentName - name of TopComponent (it used to be label of tab)

TopComponentOperator

public TopComponentOperator(JComponent jComponent)
Creates new instance from given TopComponent. It is activated by default. This constructor is used in properties.PropertySheetOperator.

Parameters:
jComponent - instance of JComponent
Method Detail

makeComponentVisible

public void makeComponentVisible()
Makes active window in which this top component resides (main window in joined mode) and then activates this top component to be in the foreground.

Overrides:
makeComponentVisible in class org.netbeans.jemmy.operators.ComponentOperator

attachTo

public void attachTo(String targetTopComponentName,
                     String side)
Attaches this top component to a new position defined by target top component and side.

Parameters:
targetTopComponentName - name of top component defining a position where to attach top component
side - side where to attach top component (AttachWindowAction.LEFT, AttachWindowAction.RIGHT, AttachWindowAction.TOP, AttachWindowAction.BOTTOM, AttachWindowAction.AS_LAST_TAB)

attachTo

public void attachTo(TopComponentOperator targetTopComponentOperator,
                     String side)
Attaches this top component to a new position defined by target top component and side.

Parameters:
targetTopComponentOperator - operator of top component defining a position where to attach top component
side - side where to attach top component (AttachWindowAction.LEFT, AttachWindowAction.RIGHT, AttachWindowAction.TOP, AttachWindowAction.BOTTOM, AttachWindowAction.AS_LAST_TAB)

maximize

public void maximize()
Maximizes this top component.


restore

public void restore()
Restores maximized window.


cloneDocument

public void cloneDocument()
Clones this TopComponent. TopComponent is activated before action is performed.


closeWindow

public void closeWindow()
Closes this TopComponent and wait until it is closed. TopComponent is activated before action is performed.


closeDiscard

public void closeDiscard()
Closes this TopComponent instance by IDE API call and wait until it is not closed. If this TopComponent is modified (e.g. editor top component), it discards possible changes.

See Also:
close()

setUnmodified

public void setUnmodified()
Finds DataObject for the content of this TopComponent and set it unmodified. Used in closeDiscard method.


isModified

public boolean isModified()
Returns true if this top component is modified (e.g. source in editor)

Returns:
boolean true if this object is modified; false otherwise

save

public void save()
Saves content of this TopComponent. If it is not applicable or content of TopComponent is not modified, it does nothing.


close

public void close()
Closes this TopComponent instance by IDE API call and wait until it is not closed. If this TopComponent is modified (e.g. editor top component), question dialog is shown and you have to close it. To close this TopComponent and discard possible changes use closeDiscard() method.


closeAllDocuments

public void closeAllDocuments()
Closes all opened documents and waits until this top component is closed.


findTopComponent

public static JComponent findTopComponent(String name,
                                          int index)
Finds index-th TopComponent with given name in whole IDE.

Parameters:
name - name of TopComponent
index - index of TopComponent
Returns:
TopComponent instance or null if noone matching criteria was found

findTopComponent

protected static JComponent findTopComponent(org.netbeans.jemmy.operators.ContainerOperator cont,
                                             String name,
                                             int index,
                                             org.netbeans.jemmy.ComponentChooser subchooser)
Finds index-th TopComponent with given name in IDE registry.

Parameters:
cont - container where to search
name - name of TopComponent
index - index of TopComponent
subchooser - ComponentChooser to determine exact TopComponent
Returns:
TopComponent instance or null if noone matching criteria was found

waitTopComponent

protected static JComponent waitTopComponent(String name,
                                             int index)
Waits for index-th TopComponent with given name in IDE registry. It throws JemmyException when TopComponent is not find until timeout expires.

Parameters:
name - name of TopComponent
index - index of TopComponent
Returns:
TopComponent instance or throws JemmyException if not found
See Also:
findTopComponent(java.lang.String, int)

waitTopComponent

protected static JComponent waitTopComponent(org.netbeans.jemmy.operators.ContainerOperator cont,
                                             String name,
                                             int index,
                                             org.netbeans.jemmy.ComponentChooser subchooser)
Waits for index-th TopComponent with given name in IDE registry. It throws JemmyException when TopComponent is not find until timeout expires.

Parameters:
cont - container where to search
name - name of TopComponent
index - index of TopComponent
subchooser - ComponentChooser to determine exact TopComponent
Returns:
TopComponent instance or throws JemmyException if not found
See Also:
findTopComponent(java.lang.String, int)

pushMenuOnTab

public void pushMenuOnTab(String popupPath)
Makes top component active and pushes given menu on its tab.

Parameters:
popupPath - menu path separated by '|' (e.g. "CVS|Refresh")

findTabbedAdapter

public TabbedContainer findTabbedAdapter()
Returns TabbedAdapter component from parents hierarchy. Used also in EditorWindowOperator.


findTabDisplayer

public Container findTabDisplayer()

waitClosed

public void waitClosed()
Waits the topcomponent to be closed.


isOpened

protected boolean isOpened()
Returns true if this TopComponent is opened. If it is not opened, it usually means it is contained within MultiviewTopComponent.

Returns:
true if open, false otherwise

findParentTopComponent

protected TopComponentOperator findParentTopComponent()
Returns TopComponentOperator from parents hierarchy. It should be MultiviewTopComponent.


org.netbeans.modules.jellytools.platform/3 3.13

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.