package StockTradeWindows;
import DisplayProject.DisplayProjectTestUtils;
import java.lang.String;
import net.helipilot50.stocktrade.windows.TraderWindow;
import org.fest.swing.core.ComponentFinder;
import org.fest.swing.fixture.FrameFixture;
import org.fest.swing.fixture.JButtonFixture;
import org.fest.swing.fixture.JTableFixture;
import org.fest.swing.fixture.JTextComponentFixture;
public class TraderWindowWidgets {
public static JTextComponentFixture getqq_StatusLine(FrameFixture frame) {
return frame.textBox("StatusLine");
}
public static JTextComponentFixture enterStatusLine(FrameFixture frame, String value) {
return DisplayProjectTestUtils.setTextValue(getqq_StatusLine(frame), value);
}
public static JTextComponentFixture checkStatusLineIs(FrameFixture frame, String value) {
return DisplayProjectTestUtils.checkTextValue(getqq_StatusLine(frame), value);
}
public static JTextComponentFixture getqq_TraderName(FrameFixture frame) {
return frame.textBox("TraderName");
}
public static JTextComponentFixture enterTraderName(FrameFixture frame, String value) {
return DisplayProjectTestUtils.setTextValue(getqq_TraderName(frame), value);
}
public static JTextComponentFixture checkTraderNameIs(FrameFixture frame, String value) {
return DisplayProjectTestUtils.checkTextValue(getqq_TraderName(frame), value);
}
public static JTableFixture getqq_OrderList(FrameFixture frame) {
return frame.table("OrderList");
}
public static JTextComponentFixture getqq_OrderListArray_CustomerName(FrameFixture frame) {
return frame.textBox("CustomerName");
}
public static JTextComponentFixture enterOrderListArray_CustomerName(FrameFixture frame, String value) {
return DisplayProjectTestUtils.setTextValue(getqq_OrderListArray_CustomerName(frame), value);
}
public static JTextComponentFixture checkOrderListArray_CustomerNameIs(FrameFixture frame, String value) {
return DisplayProjectTestUtils.checkTextValue(getqq_OrderListArray_CustomerName(frame), value);
}
public static JTextComponentFixture getqq_OrderListArray_StockName(FrameFixture frame) {
return frame.textBox("StockName");
}
public static JTextComponentFixture enterOrderListArray_StockName(FrameFixture frame, String value) {
return DisplayProjectTestUtils.setTextValue(getqq_OrderListArray_StockName(frame), value);
}
public static JTextComponentFixture checkOrderListArray_StockNameIs(FrameFixture frame, String value) {
return DisplayProjectTestUtils.checkTextValue(getqq_OrderListArray_StockName(frame), value);
}
public static JTextComponentFixture getqq_OrderListArray_Quantity(FrameFixture frame) {
return frame.textBox("Quantity");
}
public static JTextComponentFixture enterOrderListArray_Quantity(FrameFixture frame, String value) {
return DisplayProjectTestUtils.setTextValue(getqq_OrderListArray_Quantity(frame), value);
}
public static JTextComponentFixture checkOrderListArray_QuantityIs(FrameFixture frame, String value) {
return DisplayProjectTestUtils.checkTextValue(getqq_OrderListArray_Quantity(frame), value);
}
public static JTextComponentFixture getqq_OrderListArray_Price(FrameFixture frame) {
return frame.textBox("Price");
}
public static JTextComponentFixture enterOrderListArray_Price(FrameFixture frame, String value) {
return DisplayProjectTestUtils.setTextValue(getqq_OrderListArray_Price(frame), value);
}
public static JTextComponentFixture checkOrderListArray_PriceIs(FrameFixture frame, String value) {
return DisplayProjectTestUtils.checkTextValue(getqq_OrderListArray_Price(frame), value);
}
public static JTextComponentFixture getqq_OrderListArray_Type(FrameFixture frame) {
return frame.textBox("Type");
}
public static JTextComponentFixture enterOrderListArray_Type(FrameFixture frame, String value) {
return DisplayProjectTestUtils.setTextValue(getqq_OrderListArray_Type(frame), value);
}
public static JTextComponentFixture checkOrderListArray_TypeIs(FrameFixture frame, String value) {
return DisplayProjectTestUtils.checkTextValue(getqq_OrderListArray_Type(frame), value);
}
public static JButtonFixture getqq_ViewHoldingsBtn(FrameFixture frame) {
return frame.button("ViewHoldingsBtn");
}
public static void clickViewHoldingsBtn(FrameFixture frame) {
DisplayProjectTestUtils.waitForIdle();
getqq_ViewHoldingsBtn(frame).click();
}
public static JButtonFixture getqq_MakeTradeBtn(FrameFixture frame) {
return frame.button("MakeTradeBtn");
}
public static void clickMakeTradeBtn(FrameFixture frame) {
DisplayProjectTestUtils.waitForIdle();
getqq_MakeTradeBtn(frame).click();
}
public static JButtonFixture getqq_ExitBtn(FrameFixture frame) {
return frame.button("ExitBtn");
}
public static void clickExitBtn(FrameFixture frame) {
DisplayProjectTestUtils.waitForIdle();
getqq_ExitBtn(frame).click();
}
/** The name of the window */
public static final String cWINDOW_NAME = "TraderWindow";
/**
* Return the FrameFixture corresponding to an instance of TraderWindow
*/
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 TraderWindow. 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 TraderWindow getActualWindow(FrameFixture frame) {
return (TraderWindow)frame.target;
}
/**
* Find a TraderWindow frame fixture which is a synchronous child of the passed parent window
* @param parentWin the parent window frame fixture which should have a TraderWindow as a direct child.
* @return a frame fixture representing the TraderWindow 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;
}
}