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.JComboBoxFixture;
import org.fest.swing.fixture.JTextComponentFixture;
public class OrderWindowWidgets {
public static JTextComponentFixture getqq_NewOrderGrid_CustomerName(FrameFixture frame) {
return frame.textBox("CustomerName");
}
public static JTextComponentFixture enterNewOrderGrid_CustomerName(FrameFixture frame, String value) {
return DisplayProjectTestUtils.setTextValue(getqq_NewOrderGrid_CustomerName(frame), value);
}
public static JTextComponentFixture checkNewOrderGrid_CustomerNameIs(FrameFixture frame, String value) {
return DisplayProjectTestUtils.checkTextValue(getqq_NewOrderGrid_CustomerName(frame), value);
}
public static JComboBoxFixture getqq_NewOrderGrid_StockName(FrameFixture frame) {
return frame.comboBox("StockName");
}
/**
* Change the value in the qq_NewOrderGrid_StockName drop list to have the passed index
*/
public static JComboBoxFixture selectNewOrderGrid_StockName(FrameFixture frame, int index) {
DisplayProjectTestUtils.waitForIdle();
return getqq_NewOrderGrid_StockName(frame).selectItem(index);
}
/**
* Change the value in the qq_NewOrderGrid_StockName drop list to have a value of the passed string
*/
public static JComboBoxFixture selectNewOrderGrid_StockName(FrameFixture frame, String value) {
DisplayProjectTestUtils.waitForIdle();
return getqq_NewOrderGrid_StockName(frame).selectItem(value);
}
public static JTextComponentFixture getqq_NewOrderGrid_Quantity(FrameFixture frame) {
return frame.textBox("Quantity");
}
public static JTextComponentFixture enterNewOrderGrid_Quantity(FrameFixture frame, String value) {
return DisplayProjectTestUtils.setTextValue(getqq_NewOrderGrid_Quantity(frame), value);
}
public static JTextComponentFixture checkNewOrderGrid_QuantityIs(FrameFixture frame, String value) {
return DisplayProjectTestUtils.checkTextValue(getqq_NewOrderGrid_Quantity(frame), value);
}
public static JTextComponentFixture getqq_NewOrderGrid_Price(FrameFixture frame) {
return frame.textBox("Price");
}
public static JTextComponentFixture enterNewOrderGrid_Price(FrameFixture frame, String value) {
return DisplayProjectTestUtils.setTextValue(getqq_NewOrderGrid_Price(frame), value);
}
public static JTextComponentFixture checkNewOrderGrid_PriceIs(FrameFixture frame, String value) {
return DisplayProjectTestUtils.checkTextValue(getqq_NewOrderGrid_Price(frame), value);
}
public static JButtonFixture getqq_SubmitBtn(FrameFixture frame) {
return frame.button("SubmitBtn");
}
public static void clickSubmitBtn(FrameFixture frame) {
DisplayProjectTestUtils.waitForIdle();
getqq_SubmitBtn(frame).click();
}
public static JButtonFixture getqq_CancelBtn(FrameFixture frame) {
return frame.button("CancelBtn");
}
public static void clickCancelBtn(FrameFixture frame) {
DisplayProjectTestUtils.waitForIdle();
getqq_CancelBtn(frame).click();
}
/** The name of the window */
public static final String cWINDOW_NAME = "OrderWindow";
/**
* Return the FrameFixture corresponding to an instance of OrderWindow
*/
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 OrderWindow. 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 OrderWindow getActualWindow(FrameFixture frame) {
return (OrderWindow)frame.target;
}
/**
* Find a OrderWindow frame fixture which is a synchronous child of the passed parent window
* @param parentWin the parent window frame fixture which should have a OrderWindow as a direct child.
* @return a frame fixture representing the OrderWindow 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;
}
}