/** Moves the divider all the way to the right/bottom. */
  public void moveToMaximum() {
    output.printTrace("Scroll JSplitPane to maximum. JSplitPane :    \n" + toStringSource());
    output.printGolden("Scroll JSplitPane to maximum.");
    produceTimeRestricted(
        new Action<Void, Void>() {
          @Override
          public Void launch(Void obj) {
            driver.scrollToMaximum(JSplitPaneOperator.this, getOrientation());
            return null;
          }

          @Override
          public String getDescription() {
            return "Scrolling";
          }

          @Override
          public String toString() {
            return "JSplitPaneOperator.moveToMaximum.Action{description = "
                + getDescription()
                + '}';
          }
        },
        "JSplitPaneOperator.WholeScrollTimeout");
  }
 /**
  * Changes divider location.
  *
  * @param dividerLocation location to move divider to.
  */
 public void moveDivider(int dividerLocation) {
   output.printTrace(
       "Move JSplitPane divider to "
           + Integer.toString(dividerLocation)
           + " location. JSplitPane :    \n"
           + toStringSource());
   output.printGolden(
       "Move JSplitPane divider to " + Integer.toString(dividerLocation) + " location");
   scrollTo(new ValueScrollAdjuster(dividerLocation));
 }
Example #3
0
 /**
  * Waits combobox's list to be displayed.
  *
  * @return JList object if it was displayed in JComboBoxOperator.WaitListTimeout milliseconds,
  *     null otherwise.
  * @throws TimeoutExpiredException
  */
 public JList<?> waitList() {
   ListWater pw = new ListWater();
   pw.setOutput(output.createErrorOutput());
   pw.setTimeoutsToCloneOf(timeouts, "JComboBoxOperator.WaitListTimeout");
   try {
     return (JList) pw.waitAction(null);
   } catch (InterruptedException e) {
     output.printStackTrace(e);
   }
   return null;
 }
 /**
  * Pushes one time left(top) expand button.
  *
  * @throws TimeoutExpiredException
  */
 public void expandLeft() {
   String mess = "Expand ";
   if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
     mess = mess + "left";
   } else {
     mess = mess + "top";
   }
   output.printTrace(mess + " JSplitPane side. JSplitPane :    \n" + toStringSource());
   output.printGolden(mess + " JSplitPane side.");
   expandTo(1);
 }
Example #5
0
  /**
   * Selects combobox item. If verification mode is on, checks that right item has been selected.
   *
   * @param index Item index.
   * @throws TimeoutExpiredException
   */
  public void selectItem(int index) {
    output.printLine(
        "Select " + Integer.toString(index) + "\'th item in combobox\n    : " + toStringSource());
    output.printGolden("Select " + Integer.toString(index) + "\'th item in combobox");
    try {
      waitComponentEnabled();
    } catch (InterruptedException e) {
      throw new JemmyException("Interrupted", e);
    }

    driver.selectItem(this, waitItem(index));

    if (getVerification()) {
      waitItemSelected(index);
    }
  }
 /**
  * Changes divider location.
  *
  * @param proportionalLocation Proportional location. Should be great then 0 and less then 1.
  */
 public void moveDivider(double proportionalLocation) {
   output.printTrace(
       "Move JSplitPane divider to "
           + Double.toString(proportionalLocation)
           + " proportional location. JSplitPane :    \n"
           + toStringSource());
   output.printGolden(
       "Move JSplitPane divider to "
           + Double.toString(proportionalLocation)
           + " proportional location");
   scrollTo(
       new ValueScrollAdjuster(
           getMinimumDividerLocation()
               + (int)
                   (proportionalLocation
                       * (getMaximumDividerLocation() - getMinimumDividerLocation()))));
 }
  /** @see junit.framework.TestCase#setUp() */
  protected void setUp() throws Exception {
    // JemmyProperties.setCurrentDispatchingModel(
    //    JemmyProperties.ROBOT_MODEL_MASK);

    JemmyProperties.setCurrentOutput(TestOut.getNullOutput());

    String prefsFile = FileUtil.createTempFilename() + "-toolbox.xml";
    workspace_ = new PluginWorkspace(prefsFile);
    window_ = new JFrameOperator(workspace_);
  }
Example #8
0
 @Override
 public Component actionProduced(Void obj) {
   Window popupWindow = null;
   if (pChooser.checkComponent(getWindow())) {
     popupWindow = getWindow();
   } else {
     popupWindow = WindowWaiter.getWindow(getWindow(), pChooser);
   }
   if (popupWindow != null) {
     ComponentSearcher sc = new ComponentSearcher(popupWindow);
     sc.setOutput(TestOut.getNullOutput());
     return sc.findComponent(cChooser);
   } else {
     return null;
   }
 }
  /** @see junit.framework.TestCase#setUp() */
  protected void setUp() throws Exception {
    super.setUp();

    // JemmyProperties.setCurrentDispatchingModel(
    //    JemmyProperties.ROBOT_MODEL_MASK);

    JemmyProperties.setCurrentOutput(TestOut.getNullOutput());

    final JFontChooserDialog fsd = new JFontChooserDialog(new JFrame(), "Select font", false);

    fsd.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    fsd.addFontDialogListener(
        new IFontChooserDialogListener() {
          public void okButtonPressed(JFontChooser fontPanel) {
            logger_.debug("OK button pressed");
            fsd.dispose();
          }

          public void cancelButtonPressed(JFontChooser fontPanel) {
            logger_.debug("Cancel button pressed");
            fsd.dispose();
          }

          public void applyButtonPressed(JFontChooser fontPanel) {
            logger_.debug("Apply button pressed");
          }
        });

    SwingUtil.centerWindow(fsd);
    fsd.setVisible(true);

    dialog_ = new JDialogOperator("Select font");

    applyButton_ = JemmyUtil.findButton(dialog_, JFontChooserDialog.NAME_APPLY_BUTTON);

    cancelButton_ = JemmyUtil.findButton(dialog_, JFontChooserDialog.NAME_CANCEL_BUTTON);

    okButton_ = JemmyUtil.findButton(dialog_, JFontChooserDialog.NAME_OK_BUTTON);

    fontList_ = new JListOperator(dialog_, new NameComponentChooser(JFontChooser.NAME_FONT_LIST));

    styleList_ = new JListOperator(dialog_, new NameComponentChooser(JFontChooser.NAME_STYLE_LIST));

    sizeList_ = new JListOperator(dialog_, new NameComponentChooser(JFontChooser.NAME_SIZE_LIST));
  }
Example #10
0
 /**
  * Selects an item by text.
  *
  * @param item a text pattern.
  * @param comparator a searching criteria.
  */
 public void selectItem(String item, StringComparator comparator) {
   output.printLine("Select \"" + item + "\" item in combobox\n    : " + toStringSource());
   output.printGolden("Select \"" + item + "\" item in combobox");
   selectItem(waitItem(item, comparator));
 }
Example #11
0
 @Override
 public boolean checkComponent(Component comp) {
   ComponentSearcher cs = new ComponentSearcher((Container) comp);
   cs.setOutput(TestOut.getNullOutput());
   return cs.findComponent(pChooser) != null;
 }
Example #12
0
 @Override
 public void setOutput(TestOut out) {
   output = out;
   super.setOutput(output.createErrorOutput());
 }