package StockTradeWindows;
import DisplayProject.DisplayProjectTestUtils;
import java.lang.String;
import org.fest.swing.core.ComponentFinder;
import org.fest.swing.fixture.FrameFixture;
import org.fest.swing.fixture.JButtonFixture;
import org.fest.swing.fixture.JTextComponentFixture;
public class LogonWindowWidgets {
public static JTextComponentFixture getqq_LoginName(FrameFixture frame) {
return frame.textBox("LoginName");
}
public static JTextComponentFixture enterLoginName(FrameFixture frame, String value) {
return DisplayProjectTestUtils.setTextValue(getqq_LoginName(frame), value);
}
public static JTextComponentFixture checkLoginNameIs(FrameFixture frame, String value) {
return DisplayProjectTestUtils.checkTextValue(getqq_LoginName(frame), value);
}
public static JTextComponentFixture getqq_Password(FrameFixture frame) {
return frame.textBox("Password");
}
public static JTextComponentFixture enterPassword(FrameFixture frame, String value) {
return DisplayProjectTestUtils.setTextValue(getqq_Password(frame), value);
}
public static JTextComponentFixture checkPasswordIs(FrameFixture frame, String value) {
return DisplayProjectTestUtils.checkTextValue(getqq_Password(frame), value);
}
public static JButtonFixture getqq_AsCustomerBtn(FrameFixture frame) {
return frame.button("AsCustomerBtn");
}
public static void clickAsCustomerBtn(FrameFixture frame) {
DisplayProjectTestUtils.waitForIdle();
getqq_AsCustomerBtn(frame).click();
}
public static JButtonFixture getqq_AsTraderBtn(FrameFixture frame) {
return frame.button("AsTraderBtn");
}
public static void clickAsTraderBtn(FrameFixture frame) {
DisplayProjectTestUtils.waitForIdle();
getqq_AsTraderBtn(frame).click();
}
/** The name of the window */
public static final String cWINDOW_NAME = "LogonWindow";
/**
* Return the FrameFixture corresponding to an instance of LogonWindow
*/
public static FrameFixture getWindow(ComponentFinder finder) {
return DisplayProjectTestUtils.findFrameWithName(finder, cWINDOW_NAME);
}
/**
* Return the window which is a child of the passed frame which is an instance of LogonWindow. This allows access
* to the underlying data models, in case it is desired to confirm that data entered in the windows is
* correctly mapped to the underlying model.
*/
public static LogonWindow getActualWindow(FrameFixture frame) {
return (LogonWindow)frame.target;
}
/**
* Find a LogonWindow frame fixture which is a synchronous child of the passed parent window
* @param parentWin the parent window frame fixture which should have a LogonWindow as a direct child.
* @return a frame fixture representing the LogonWindow child
*/
public static FrameFixture getWindowAsChildOf(FrameFixture parentWin) {
return DisplayProjectTestUtils.findChildWithName(parentWin, cWINDOW_NAME);
}
public static FrameFixture getWindowAsAsyncChildOf(FrameFixture parentWin) {
FrameFixture frame = getWindow(parentWin.robot.finder());
DisplayProjectTestUtils.pushThreadForAsyncWindow(frame);
return frame;
}
}