Java Code Examples for org.netbeans.jemmy.operators.JTabbedPaneOperator#getTabCount()

The following examples show how to use org.netbeans.jemmy.operators.JTabbedPaneOperator#getTabCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultVisualizer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Switches tabs to make the component visible.
 *
 * @param tabOper an operator representing a tabbed pane.
 * @param target a component - target to be made visible.
 */
protected void switchTab(JTabbedPaneOperator tabOper, Component target) {
    int tabInd = 0;
    for (int j = 0; j < tabOper.getTabCount(); j++) {
        if (target == tabOper.getComponentAt(j)) {
            tabInd = j;
            break;
        }
    }
    if (tabOper.getSelectedIndex() != tabInd) {
        tabOper.selectPage(tabInd);
    }
}
 
Example 2
Source File: Autoupdate.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void GeneralChecks( )
{
  startTest( );

  // Open
  new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenuNoBlock("Tools|Plugins");

  JDialogOperator jdPlugins = new JDialogOperator( "Plugins" );
  //try{ Dumper.dumpAll( "c:\\dump.txt" ); } catch( IOException ex ) { }

  // Wait for a while because tab selection might change.
  Sleep( 2000 );

  // Check tabs
  JTabbedPaneOperator jtTabs = new JTabbedPaneOperator( jdPlugins, 0 );
  String[] asTabs =
  {
    "Updates",
    "Available Plugins",
    "Downloaded",
    "Installed",
    "Settings"
  };

  int iCount = jtTabs.getTabCount( );
  if( iCount != asTabs.length )
    fail( "Invalid number of tabs: " + iCount + ", expected: " + asTabs.length );
  for( int iIndex = 0; iIndex < asTabs.length; iIndex++ )
  {
    String sTitle = jtTabs.getTitleAt( iIndex );
    if( !sTitle.startsWith( asTabs[ iIndex ] ) )
      fail( "Invalid tab at index " + iIndex + ": \"" + sTitle + "\"" );
  }

  // Check buttons
  new JButtonOperator( jdPlugins, "Reload Catalog" );
  new JButtonOperator( jdPlugins, "Uninstall" );
  new JButtonOperator( jdPlugins, "Deactivate" );
  new JButtonOperator( jdPlugins, "Help" );

  // Check there is label
  new JLabelOperator( jdPlugins, "Search:" );

  // Check there is table operator
  new JTableOperator( jdPlugins, 0 );

  // Search text field
  JTextFieldOperator jtSearch = new JTextFieldOperator( jdPlugins, 0 );
  // Check does this field affect selection
  String sSelected = jtTabs.getTitleAt( jtTabs.getSelectedIndex( ) );
  System.out.println( "===" + sSelected );
  jtSearch.enterText( "java" );
  Sleep( 2000 );
  sSelected = jtTabs.getTitleAt( jtTabs.getSelectedIndex( ) );
  System.out.println( "===" + sSelected );
  if( !sSelected.matches( "Installed [(][0-9]+/[0-9]+[)]" ) )
    fail( "Invalid result of filtering." );
  jtSearch.enterText( "" );

  // Close by button
  JButtonOperator jbClose = new JButtonOperator( jdPlugins, "Close" );
  jbClose.push( );
  jdPlugins.waitClosed( );

  endTest( );
}