< prev index next >

src/org/netbeans/jemmy/operators/JInternalFrameOperator.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 22,31 **** --- 22,33 ---- */ package org.netbeans.jemmy.operators; import java.awt.Component; import java.awt.Container; + import java.awt.Dimension; + import java.awt.Point; import java.awt.Rectangle; import java.beans.PropertyVetoException; import java.util.Hashtable; import javax.swing.Icon;
*** 503,512 **** --- 505,517 ---- + Integer.toString(x) + "," + Integer.toString(y) + ")" + " position"); checkIconified(false); wDriver.move(this, x, y); + if (getVerification()) { + waitComponentLocation(new Point(x, y)); + } } /** * Resizes frame. Note: frame should not be iconified. *
*** 524,551 **** --- 529,565 ---- + Integer.toString(width) + "," + Integer.toString(height) + ")" + " size"); checkIconified(false); wDriver.resize(this, width, height); + if (getVerification()) { + waitComponentSize(new Dimension(width, height)); + } } /** * Activates frame. Note: frame should not be iconified. * * @throws WrongInternalFrameStateException */ public void activate() { checkIconified(false); wDriver.activate(this); + if (getVerification()) { + waitActivate(true); + } } /** * Closes the frame. */ public void close() { checkIconified(false); wDriver.requestClose(this); + if (getVerification()) { + waitClosed(); + } } /** * Scrolls to internal frame's rectangle. *
*** 652,697 **** } /** * Waits for the frame to be iconified or deiconified. * ! * @param icon whether the frame needs to be iconified. */ ! public void waitIcon(final boolean icon) { ! waitState(new ComponentChooser() { @Override public boolean checkComponent(Component comp) { ! return ((JInternalFrame) comp).isIcon() == icon; } @Override public String getDescription() { ! return "Iconified JInternalFrame"; } @Override public String toString() { return "JInternalFrameOperator.waitIcon.ComponentChooser{description = " + getDescription() + '}'; } }); } /** * Waits for the frame to be maximized or demaximized. * ! * @param maximum whether the frame needs to be maximized. */ ! public void waitMaximum(final boolean maximum) { ! waitState(new ComponentChooser() { @Override public boolean checkComponent(Component comp) { ! return ((JInternalFrame) comp).isMaximum() == maximum; } @Override public String getDescription() { ! return "Maximizied JInternalFrame"; } @Override public String toString() { return "JInternalFrameOperator.waitMaximum.ComponentChooser{description = " + getDescription() + '}'; --- 666,757 ---- } /** * Waits for the frame to be iconified or deiconified. * ! * @param isIconified whether the frame needs to be iconified or deiconified. */ ! public void waitIcon(final boolean isIconified) { ! waitStateOnQueue(new ComponentChooser() { @Override public boolean checkComponent(Component comp) { ! return isIcon() == isIconified; } @Override public String getDescription() { ! return "Internal Frame is " + (isIconified ? "iconified" : "deiconified"); } @Override public String toString() { return "JInternalFrameOperator.waitIcon.ComponentChooser{description = " + getDescription() + '}'; } }); } /** + * Waits for the frame to be activated or deactivated. + * + * @param isActivate whether the frame needs to be activated or deactivated. + */ + public void waitActivate(final boolean isActivate) { + waitStateOnQueue(new ComponentChooser() { + @Override + public boolean checkComponent(Component comp) { + return isSelected() == isActivate; + } + + @Override + public String getDescription() { + return "Internal Frame is " + (isActivate ? "activated" : "deactivated"); + } + + @Override + public String toString() { + return "JInternalFrameOperator.waitActivate.ComponentChooser{description = " + getDescription() + '}'; + } + }); + } + + /** + * Waits for the frame to be closed. + */ + public void waitClosed() { + waitStateOnQueue(new ComponentChooser() { + @Override + public boolean checkComponent(Component comp) { + return isClosed(); + } + + @Override + public String getDescription() { + return "Internal Frame is closed"; + } + + @Override + public String toString() { + return "JInternalFrameOperator.waitClosed.ComponentChooser{description = " + getDescription() + '}'; + } + }); + } + + /** * Waits for the frame to be maximized or demaximized. * ! * @param isMaximum whether the frame needs to be maximized or demaximized. */ ! public void waitMaximum(final boolean isMaximum) { ! waitStateOnQueue(new ComponentChooser() { @Override public boolean checkComponent(Component comp) { ! return isMaximum() == isMaximum; } @Override public String getDescription() { ! return "Internal Frame is " + (isMaximum ? "maximizied" : "demaximizied"); } @Override public String toString() { return "JInternalFrameOperator.waitMaximum.ComponentChooser{description = " + getDescription() + '}';
< prev index next >