Package org.netbeans.jemmy

Examples of org.netbeans.jemmy.JemmyException


        } else if(compare(head, new byte[]{8, 0, 0, 0, 0})) {
            mode = PNGEncoder.GREYSCALE_MODE;
        } else if(compare(head, new byte[]{8, 2, 0, 0, 0})) {
            mode = PNGEncoder.COLOR_MODE;
        } else {
            throw(new JemmyException("Format error"));
        }

        readInt();//!!crc

        int size = readInt();

        byte[] idat = read(4);
        checkEquality(idat, "IDAT".getBytes());

        byte[] data = read(size);


        Inflater inflater = new Inflater();
        inflater.setInput(data, 0, size);

        int color;

        try {
            switch (mode) {
            case PNGEncoder.BW_MODE:
                {
                    int bytes = (int)(width / 8);
                    if((width % 8) != 0) {
                        bytes++;
                    }
                    byte colorset;
                    byte[] row = new byte[bytes];
                    for (int y = 0; y < height; y++) {
                        inflater.inflate(new byte[1]);
                        inflater.inflate(row);
                        for (int x = 0; x < bytes; x++) {
                            colorset = row[x];
                            for (int sh = 0; sh < 8; sh++) {
                                if(x * 8 + sh >= width) {
                                    break;
                                }
                                if((colorset & 0x80) == 0x80) {
                                    result.setRGB(x * 8 + sh, y, Color.white.getRGB());
                                } else {
                                    result.setRGB(x * 8 + sh, y, Color.black.getRGB());
                                }
                                colorset <<= 1;
                            }
                        }
                    }
                }
                break;
            case PNGEncoder.GREYSCALE_MODE:
                {
                    byte[] row = new byte[width];
                    for (int y = 0; y < height; y++) {
                        inflater.inflate(new byte[1]);
                        inflater.inflate(row);
                        for (int x = 0; x < width; x++) {
                            color = row[x];
                            result.setRGB(x, y, (color << 16) + (color << 8) + color);
                        }
                    }
                }
                break;
            case PNGEncoder.COLOR_MODE:
                {
                    byte[] row = new byte[width * 3];
                    for (int y = 0; y < height; y++) {
                        inflater.inflate(new byte[1]);
                        inflater.inflate(row);
                        for (int x = 0; x < width; x++) {
                            result.setRGB(x, y,
                                          ((row[x * 3 + 0]&0xff) << 16) +
                                          ((row[x * 3 + 1]&0xff) << 8) +
                                          ((row[x * 3 + 2]&0xff)));
                        }
                    }
                }
            }
        } catch(DataFormatException e) {
            throw(new JemmyException("ZIP error", e));
        }

        readInt();//!!crc
        readInt();//0

View Full Code Here


     */
    public static BufferedImage decode(String fileName) {
        try {
            return(new PNGDecoder(new FileInputStream(fileName)).decode());
        } catch(IOException e) {
            throw(new JemmyException("IOException during image reading", e));
        }
    }
View Full Code Here

     * @see #setDriver
     */
    public static Object getDriver(String id, Class operatorClass) {
  Object result = getADriver(id, operatorClass, JemmyProperties.getProperties());
  if(result == null) {
      throw(new JemmyException("No \"" + id + "\" driver registered for " +
             operatorClass.getName() + " class!"));
  } else {
      return(result);
  }
    }
View Full Code Here

        if(driver instanceof Driver) {
            setDriver(id, (Driver)driver);
        } else if(driver instanceof LightDriver) {
            setDriver(id, (LightDriver)driver);
        } else {
            throw(new JemmyException("Driver is neither Driver nor LightDriver " +
                                     driver.toString()));
        }
    }
View Full Code Here

        public void scrollToString(String pattern, StringComparator comparator) {
            int index = findItem(pattern, comparator);
            if(index != -1) {
                scrollToIndex(index);
            } else {
                throw(new JemmyException("No \"" + pattern + "\" item in JSpinner", getSource()));
            }
        }
View Full Code Here

  if(canDragAndDrop(oper)) {
      doDragAndDrop(oper, adj);
  }
  if(canPushAndWait(oper)) {
      if(!doPushAndWait(oper, adj, oper.getTimeouts().getTimeout(SCROLL_FREEZE_TIMEOUT))) {
                throw new JemmyException("Scrolling stuck for more than " +
                        oper.getTimeouts().getTimeout(SCROLL_FREEZE_TIMEOUT) +
                        " on " + oper);
            }
  }
  for(int i = 0; i < ADJUST_CLICK_COUNT; i++) {
View Full Code Here

  wt.setTimeoutsToCloneOf(timeouts, "JProgressBarOperator.WaitValueTimeout");
  wt.setOutput(output.createErrorOutput());
  try {
      wt.waitAction(null);
  } catch (InterruptedException e) {
      throw(new JemmyException("Exception during progressbar value waiting", e));
  }
    }
View Full Code Here

        }
        for(int depth = 1; depth < chooser.getDepth(); depth++) {
            // TODO - wait for menu item
            int elementIndex = getDesiredElementIndex(menuObject, chooser, depth);
            if(elementIndex == -1) {
                throw(new JemmyException("Unable to find menu (menuitem): " + ((DescriptablePathChooser)chooser).getDescription()));
            }
            for(int i = ((depth == 1) ? 0 : 1); i<=elementIndex; i++) {
                pressKey(KeyEvent.VK_DOWN, 0);
                releaseKey(KeyEvent.VK_DOWN, 0);
            }
View Full Code Here

                          PathChooser chooser, int depth, boolean pressMouse) {
        try {
            oper.waitComponentVisible(true);
            oper.waitComponentEnabled();
        } catch(InterruptedException e) {
            throw(new JemmyException("Interrupted!", e));
        }
  if(depth > chooser.getDepth() - 1) {
            if(oper instanceof JMenuOperator) {
                if(((JMenuOperator)oper).isPopupMenuVisible()) {
                    ((JMenuOperator)oper).setPopupMenuVisible(false);
                }
                ((JMenuOperator)oper).setPopupMenuVisible(true);
                waitPopupMenu(oper);
            }
            ((AbstractButtonOperator)oper).doClick();
      return(oper.getSource());
  } else {
            if(((JMenuOperator)oper).isPopupMenuVisible()) {
                ((JMenuOperator)oper).setPopupMenuVisible(false);
            }
            ((JMenuOperator)oper).setPopupMenuVisible(true);
            waitPopupMenu(oper);
        }
  oper.getTimeouts().sleep("JMenuOperator.WaitBeforePopupTimeout");
  JMenuItem item = waitItem(oper, waitPopupMenu(oper), chooser, depth);
  if(item instanceof JMenu) {
      JMenuOperator mo = new JMenuOperator((JMenu)item);
      mo.copyEnvironment(oper);
      Object result = push(mo, null, chooser, depth + 1, false);
            if(result instanceof JMenu) {
                org.netbeans.jemmy.JemmyProperties.getCurrentOutput().printLine("IN HERE" + ((JMenu)result).getText());
                org.netbeans.jemmy.JemmyProperties.getCurrentOutput().printLine("IN HERE" + Boolean.toString(((JMenu)result).isPopupMenuVisible()));
                if(!((JMenu)result).isPopupMenuVisible()) {
                    ((JMenuOperator)oper).setPopupMenuVisible(false);
                }
            } else {
                ((JMenuOperator)oper).setPopupMenuVisible(false);
                waitNoPopupMenu(oper);
            }
            return(result);
  } else {
      JMenuItemOperator mio = new JMenuItemOperator(item);
      mio.copyEnvironment(oper);
            try {
                mio.waitComponentEnabled();
            } catch(InterruptedException e) {
                throw(new JemmyException("Interrupted!", e));
            }
            ((AbstractButtonOperator)mio).doClick();
            ((JMenuOperator)oper).setPopupMenuVisible(false);
            waitNoPopupMenu(oper);
      return(item);
View Full Code Here

        }
        try {
            robotReference.invokeMethod(method, params, paramClasses);
            synchronizeRobot();
        } catch(InvocationTargetException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        } catch(IllegalStateException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        } catch(NoSuchMethodException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        } catch(IllegalAccessException e) {
            throw(new JemmyException("Exception during java.awt.Robot accessing", e));
        }
    }
View Full Code Here

TOP

Related Classes of org.netbeans.jemmy.JemmyException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.