package StockTradeWindows;
import DisplayProject.CloseHideAdaptor;
import DisplayProject.Constants;
import DisplayProject.CursorMgr;
import DisplayProject.DataField;
import DisplayProject.DropListModel;
import DisplayProject.GridField;
import DisplayProject.UDSWindow;
import DisplayProject.UIutils;
import DisplayProject.WindowManager;
import DisplayProject.WindowUsageMap;
import DisplayProject.actions.ColourChange;
import DisplayProject.actions.DefaultButton;
import DisplayProject.actions.ElementList;
import DisplayProject.actions.HeightPolicy;
import DisplayProject.actions.UserWindow;
import DisplayProject.actions.WidthPolicy;
import DisplayProject.binding.BindingManager;
import DisplayProject.binding.beans.ExtendedPropertyChangeSupport;
import DisplayProject.binding.beans.Observable;
import DisplayProject.controls.DropList;
import DisplayProject.controls.TextGraphic;
import DisplayProject.events.ClientEventManager;
import DisplayProject.factory.CompoundFieldFactory;
import DisplayProject.factory.DataFieldFactory;
import DisplayProject.factory.DropFillinFactory;
import DisplayProject.factory.GraphicFactory;
import DisplayProject.factory.PushButtonFactory;
import DisplayProject.plaf.Win32LookAndFeel;
import Framework.Array_Of_ListElement;
import Framework.ErrorMgr;
import Framework.EventHandle;
import Framework.EventManager;
import Framework.EventRegistration;
import Framework.File;
import Framework.ForteKeyboardFocusManager;
import Framework.ListElement;
import Framework.Log;
import Framework.RuntimeProperties;
import Framework.TextData;
import Framework.UsageException;
import StockTradeBusinessClasses.Array_Of_Holding;
import StockTradeBusinessClasses.Holding;
import StockTradeBusinessClasses.Order;
import StockTradeServices.interfaces.*;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.KeyboardFocusManager;
import java.awt.Window;
import java.awt.event.ComponentListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.lang.Cloneable;
import java.lang.Object;
import java.lang.String;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.ToolTipManager;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import org.fest.swing.fixture.FrameFixture;
import org.fest.swing.fixture.JTextComponentFixture;
/**
* OrderWindow<p>
* <p>
* @author Generated from Forte
* @since 24-Aug-2010
*/
@RuntimeProperties(isDistributed=false, isAnchored=false, isShared=false, isTransactional=false)
@UDSWindow()
@SuppressWarnings("serial")
public class OrderWindow
extends JFrame
implements Cloneable, Serializable, Observable
{
// ----------
// Attributes
// ----------
protected File defaultHelpFile;
protected BindingManager bindingManager = null;
public PropertyChangeSupport qq_Listeners = null;
private Array_Of_ListElement<ListElement> stockNameList;
private Order newOrderGrid;
// ------------
// Constructors
// ------------
public OrderWindow() {
// Explicitly call the superclass constructor to prevent the implicit call
super();
this.initialize();
this.setNewOrderGrid(new Order());
//self.CustomerName = new;
//self.StockNamelist = new;
}
// ----------------------
// Accessors and Mutators
// ----------------------
public File getDefaultHelpFile() {
return defaultHelpFile;
}
public void setDefaultHelpFile(File defaultHelpFile) {
this.defaultHelpFile = defaultHelpFile;
UserWindow.createHelp(this, defaultHelpFile);
}
public void setHelpURL(String urlString) {
try {
URL url = new URL(urlString);
UserWindow.createHelp(this, url);
} catch (MalformedURLException e) {
UsageException err = new UsageException("Cannot create help URL", e);
ErrorMgr.addError(err);
throw err;
}
}
protected BindingManager getBindingManager() {
if (this.bindingManager == null) {
this.bindingManager = new BindingManager(this);
}
return bindingManager;
}
public void setStockNameList(Array_Of_ListElement<ListElement> stockNameList) {
Array_Of_ListElement<ListElement> oldValue = this.stockNameList;
this.stockNameList = stockNameList;
this.firePropertyChange("stockNameList", oldValue, this.stockNameList);
}
/**
* Getter for the attribute StockNameList
*/
public Array_Of_ListElement<ListElement> getStockNameList() {
return this.stockNameList;
}
public void setNewOrderGrid(Order newOrderGrid) {
Order oldValue = this.newOrderGrid;
this.newOrderGrid = newOrderGrid;
this.firePropertyChange("newOrderGrid", oldValue, this.newOrderGrid);
}
/**
* Getter for the attribute NewOrderGrid
*/
public Order getNewOrderGrid() {
return this.newOrderGrid;
}
// -------
// Methods
// -------
public void firePropertyChange(PropertyChangeEvent evt) {
if (qq_Listeners != null) {
qq_Listeners.firePropertyChange(evt);
}
}
public void firePropertyChange(String pName, boolean oldValue, boolean newValue) {
if (qq_Listeners != null) {
qq_Listeners.firePropertyChange(pName, oldValue, newValue);
}
}
public void firePropertyChange(String pName, int oldValue, int newValue) {
if (qq_Listeners != null) {
qq_Listeners.firePropertyChange(pName, oldValue, newValue);
}
}
public void firePropertyChange(String pName, Object oldValue, Object newValue) {
if (qq_Listeners != null) {
qq_Listeners.firePropertyChange(pName, oldValue, newValue);
}
}
public boolean hasListeners(String propertyName) {
if (qq_Listeners != null) {
return qq_Listeners.hasListeners(propertyName);
}
return false;
}
public PropertyChangeSupport getPropertyListeners() {
if (qq_Listeners == null)
qq_Listeners = new ExtendedPropertyChangeSupport(this, true);
return this.qq_Listeners;
}
public void setPropertyListeners(PropertyChangeSupport pcs) {
qq_Listeners = pcs;
}
public void addPropertyChangeListener(String property, PropertyChangeListener listener) {
if (qq_Listeners == null) {
qq_Listeners = new ExtendedPropertyChangeSupport(this, true);
}
qq_Listeners.addPropertyChangeListener(property, listener);
}
public void addPropertyChangeListener(PropertyChangeListener listener) {
if (qq_Listeners == null) {
qq_Listeners = new ExtendedPropertyChangeSupport(this, true);
}
qq_Listeners.addPropertyChangeListener(listener);
}
public void removePropertyChangeListener(String property, PropertyChangeListener listener) {
if (qq_Listeners != null) {
qq_Listeners.removePropertyChangeListener(property, listener);
}
}
public void removePropertyChangeListener(PropertyChangeListener listener) {
if (qq_Listeners != null) {
qq_Listeners.removePropertyChangeListener(listener);
}
}
/**
* createListOfOwnedStock<p>
* <p>
* @param pOwnHoldingList Type: Array_Of_Holding<Holding>
* @return Array_Of_ListElement<ListElement>
*/
public Array_Of_ListElement<ListElement> createListOfOwnedStock(Array_Of_Holding<Holding> pOwnHoldingList) {
Array_Of_ListElement<ListElement> custStockList = null;
custStockList = new Array_Of_ListElement<ListElement>();
ListElement tempStockName = null;
if (pOwnHoldingList != null) {
for (Holding row : pOwnHoldingList) {
tempStockName = new ListElement();
tempStockName.setTextValue(new TextData(row.getStockName()));
custStockList.add(tempStockName);
}
}
return custStockList;
}
/**
* display<p>
* <p>
* @param pName4OrdWin Type: TextData
* @param pOrderType Type: String
* @param pHoldingList Type: Array_Of_Holding<Holding> (Input) (default in Forte: NIL)
*/
public void display(TextData pName4OrdWin, String pOrderType, Array_Of_Holding<Holding> pHoldingList) {
this.getNewOrderGrid().getCustomerName().setValue( pName4OrdWin );
if ("Buy".equals(pOrderType)) {
this.setTitle("Buy Order Window");
this.setStockNameList(CustomerSO_proxy.getInstance().getStockNameList());
}
else {
this.setTitle("Sell Order Window");
this.setStockNameList(this.createListOfOwnedStock(pHoldingList));
}
ElementList.set(this.getqq_NewOrderGrid_StockName(), this.getStockNameList());
UserWindow.open(this);
// ----------
// Event Loop
// ----------
EventManager.startEventLoop();
try {
EventRegistration TaskHandle_Shutdown_langThreadcurrentThread = ClientEventManager.register( Thread.currentThread(), "Shutdown" );
EventRegistration PushButton_Click_getqq_SubmitBtn = ClientEventManager.register( this.getqq_SubmitBtn(), "Click" );
EventRegistration PushButton_Click_getqq_CancelBtn = ClientEventManager.register( this.getqq_CancelBtn(), "Click" );
while (true) {
UIutils.processGUIActions();
EventHandle qq_currentEvent = EventManager.waitForEvent();
if (qq_currentEvent == null)
break;
// -------------
// task.Shutdown
// -------------
if (qq_currentEvent.isEvent(TaskHandle_Shutdown_langThreadcurrentThread)) {
try {
CursorMgr.startEvent();
// ================ Begin Forte Event Handler Translation ================
if (UIutils.hasDataChanged(this.getForm())) {
Log.standardLog().info("Exiting with some data changed");
}
break;
// ================ End Forte Event Handler Translation ================
}
finally {
CursorMgr.endEvent();
}
}
// -----------------
// <SubmitBtn>.Click
// -----------------
else if (qq_currentEvent.isEvent(PushButton_Click_getqq_SubmitBtn)) {
try {
CursorMgr.startEvent();
// ================ Begin Forte Event Handler Translation ================
//self.Window.MessageDialog(MessageText='Not yet implemented',
// MessageType=MT_INFO);
this.getNewOrderGrid().setType(pOrderType);
TradeSO_proxy.getInstance().takeOrder(this.getNewOrderGrid());
WindowManager.messageDialog(this, "Submit Order Successful", 1, 50);
break;
// ================ End Forte Event Handler Translation ================
}
finally {
CursorMgr.endEvent();
}
}
// -----------------
// <CancelBtn>.Click
// -----------------
else if (qq_currentEvent.isEvent(PushButton_Click_getqq_CancelBtn)) {
try {
CursorMgr.startEvent();
// ================ Begin Forte Event Handler Translation ================
break;
// ================ End Forte Event Handler Translation ================
}
finally {
CursorMgr.endEvent();
}
}
}
EventManager.deregister( TaskHandle_Shutdown_langThreadcurrentThread );
EventManager.deregister( PushButton_Click_getqq_SubmitBtn );
EventManager.deregister( PushButton_Click_getqq_CancelBtn );
}
//catch (Exception qq_error) {
//Logger.getLogger("task.part.Event").error("Event loop terminated by unhandled exception: " + qq_error.getMessage(), qq_error );
//throw qq_error;
//}
finally {
EventManager.endEventLoop();
UserWindow.close(this);
}
}
// ------------------
// Window Definitions
// ------------------
// <editor-fold defaultstate="collapsed" desc="Window Definitions">
private int qq_defaultSet = 0;
private int qq_msgNumber = 0;
private int qq_msgSet = 1;
protected Window primaryWindow = null;
protected int initialX;
protected int initialY;
protected int qq_SystemClosePolicy = Constants.SC_ENABLEDSHUTDOWN;
protected int qq_initialPositionPolicy = Constants.PP_SYSTEMDEFAULT;
public DataField qq_NewOrderGrid_CustomerName;
public DataField qq_NewOrderGrid_Price;
public DataField qq_NewOrderGrid_Quantity;
public DropList qq_NewOrderGrid_StockName;
public GridField qq_ButtonGrid;
public GridField qq_NewOrderGrid;
public GridField qq_OuterGrid;
public JButton qq_CancelBtn;
public JButton qq_SubmitBtn;
public JPanel Form;
public TextGraphic qq_ClientNameLbl;
public TextGraphic qq_PriceLbl;
public TextGraphic qq_QuantityLbl;
public TextGraphic qq_StockNameLbl;
/**
* qq_ClientNameLbl: transformed from: qqds_TextGraphic
* TagId=24
* isInherited=FALSE
*/
public TextGraphic getqq_ClientNameLbl() {
if (qq_ClientNameLbl == null) {
qq_ClientNameLbl = GraphicFactory.newTextGraphic("Client Name:\n", "");
qq_ClientNameLbl.setHorizontalAlignment( SwingConstants.LEFT );
// OPTIONAL UIutils.reloadLabelText(qq_ClientNameLbl, mcat);
WidthPolicy.set(qq_ClientNameLbl, Constants.SP_NATURAL);
HeightPolicy.set(qq_ClientNameLbl, Constants.SP_NATURAL);
qq_ClientNameLbl.setMinimumSize(new Dimension(67, 16));
}
return qq_ClientNameLbl;
}
/**
* qq_NewOrderGrid_CustomerName: transformed from: qqds_DataField
* TagId=25
* isInherited=FALSE
*/
public DataField getqq_NewOrderGrid_CustomerName() {
if (qq_NewOrderGrid_CustomerName == null) {
// Mask type: MK_NONE
qq_NewOrderGrid_CustomerName = DataFieldFactory.newDataField("CustomerName", 14, TextData.class, Constants.MK_NONE);
qq_NewOrderGrid_CustomerName.setValue("");
qq_NewOrderGrid_CustomerName.setHorizontalAlignment(JTextField.LEFT);
getBindingManager().bindComponent(qq_NewOrderGrid_CustomerName, "newOrderGrid.customerName");
WidthPolicy.set(qq_NewOrderGrid_CustomerName, Constants.SP_EXPLICIT);
HeightPolicy.set(qq_NewOrderGrid_CustomerName, Constants.SP_NATURAL);
qq_NewOrderGrid_CustomerName.setMinimumSize(new Dimension(100, 19));
qq_NewOrderGrid_CustomerName.setSize(new Dimension(100, 19));
}
return qq_NewOrderGrid_CustomerName;
}
/**
* qq_StockNameLbl: transformed from: qqds_TextGraphic
* TagId=26
* isInherited=FALSE
*/
public TextGraphic getqq_StockNameLbl() {
if (qq_StockNameLbl == null) {
qq_StockNameLbl = GraphicFactory.newTextGraphic("Stock Name:\n", "");
qq_StockNameLbl.setHorizontalAlignment( SwingConstants.LEFT );
// OPTIONAL UIutils.reloadLabelText(qq_StockNameLbl, mcat);
WidthPolicy.set(qq_StockNameLbl, Constants.SP_NATURAL);
HeightPolicy.set(qq_StockNameLbl, Constants.SP_NATURAL);
qq_StockNameLbl.setMinimumSize(new Dimension(69, 16));
}
return qq_StockNameLbl;
}
/**
* qq_NewOrderGrid_StockName: transformed from: qqds_DropList
* TagId=27
* isInherited=FALSE
*/
public DropList getqq_NewOrderGrid_StockName() {
if (qq_NewOrderGrid_StockName == null) {
Array_Of_ListElement<ListElement> elements = new Array_Of_ListElement<ListElement>();
elements.add( new ListElement( 1, "", ListElement.qq_Resolver.cINTEGERVALUE_TEXTVALUE ) );
qq_NewOrderGrid_StockName = DropFillinFactory.newDropList();
qq_NewOrderGrid_StockName.setName("StockName");
getBindingManager().bindComponent(qq_NewOrderGrid_StockName, "newOrderGrid.stockName", elements);
qq_NewOrderGrid_StockName.addActionListener( (DropListModel)qq_NewOrderGrid_StockName.getModel() );
// OPTIONAL UIutils.reloadLabelText(qq_NewOrderGrid_StockName, mcat);
qq_NewOrderGrid_StockName.setMaximumRowCount(6);
WidthPolicy.set(qq_NewOrderGrid_StockName, Constants.SP_NATURAL);
HeightPolicy.set(qq_NewOrderGrid_StockName, Constants.SP_NATURAL);
qq_NewOrderGrid_StockName.setMinimumSize(new Dimension(39, 19));
}
return qq_NewOrderGrid_StockName;
}
/**
* qq_QuantityLbl: transformed from: qqds_TextGraphic
* TagId=28
* isInherited=FALSE
*/
public TextGraphic getqq_QuantityLbl() {
if (qq_QuantityLbl == null) {
qq_QuantityLbl = GraphicFactory.newTextGraphic("Quantity:\n", "");
qq_QuantityLbl.setHorizontalAlignment( SwingConstants.LEFT );
// OPTIONAL UIutils.reloadLabelText(qq_QuantityLbl, mcat);
WidthPolicy.set(qq_QuantityLbl, Constants.SP_NATURAL);
HeightPolicy.set(qq_QuantityLbl, Constants.SP_NATURAL);
qq_QuantityLbl.setMinimumSize(new Dimension(52, 16));
}
return qq_QuantityLbl;
}
/**
* qq_NewOrderGrid_Quantity: transformed from: qqds_DataField
* TagId=29
* isInherited=FALSE
*/
public DataField getqq_NewOrderGrid_Quantity() {
if (qq_NewOrderGrid_Quantity == null) {
// Mask type: MK_NONE
qq_NewOrderGrid_Quantity = DataFieldFactory.newDataField("Quantity", 16, Constants.MK_NONE);
qq_NewOrderGrid_Quantity.setValue(Integer.valueOf(0));
qq_NewOrderGrid_Quantity.setHorizontalAlignment(JTextField.RIGHT);
getBindingManager().bindComponent(qq_NewOrderGrid_Quantity, "newOrderGrid.quantity");
WidthPolicy.set(qq_NewOrderGrid_Quantity, Constants.SP_EXPLICIT);
HeightPolicy.set(qq_NewOrderGrid_Quantity, Constants.SP_NATURAL);
qq_NewOrderGrid_Quantity.setMinimumSize(new Dimension(112, 19));
qq_NewOrderGrid_Quantity.setSize(new Dimension(112, 19));
}
return qq_NewOrderGrid_Quantity;
}
/**
* qq_PriceLbl: transformed from: qqds_TextGraphic
* TagId=30
* isInherited=FALSE
*/
public TextGraphic getqq_PriceLbl() {
if (qq_PriceLbl == null) {
qq_PriceLbl = GraphicFactory.newTextGraphic("Price:\n", "");
qq_PriceLbl.setHorizontalAlignment( SwingConstants.LEFT );
// OPTIONAL UIutils.reloadLabelText(qq_PriceLbl, mcat);
WidthPolicy.set(qq_PriceLbl, Constants.SP_NATURAL);
HeightPolicy.set(qq_PriceLbl, Constants.SP_NATURAL);
qq_PriceLbl.setMinimumSize(new Dimension(33, 16));
}
return qq_PriceLbl;
}
/**
* qq_NewOrderGrid_Price: transformed from: qqds_DataField
* TagId=31
* isInherited=FALSE
*/
public DataField getqq_NewOrderGrid_Price() {
if (qq_NewOrderGrid_Price == null) {
// Mask type: MK_TEMPLATE
// original Forte format string -->$#,##0<--
this.qq_NewOrderGrid_Price = DataFieldFactory.newDataField("Price", 14, "$#,##0", Float.TYPE);
qq_NewOrderGrid_Price.setOriginalFormatText("$#,##0");
qq_NewOrderGrid_Price.setHorizontalAlignment(JTextField.RIGHT);
getBindingManager().bindComponent(qq_NewOrderGrid_Price, "newOrderGrid.price");
WidthPolicy.set(qq_NewOrderGrid_Price, Constants.SP_EXPLICIT);
HeightPolicy.set(qq_NewOrderGrid_Price, Constants.SP_NATURAL);
qq_NewOrderGrid_Price.setMinimumSize(new Dimension(100, 19));
qq_NewOrderGrid_Price.setSize(new Dimension(100, 19));
}
return qq_NewOrderGrid_Price;
}
/**
* qq_NewOrderGrid: transformed from: qqds_GridField
* TagId=23
* isInherited=FALSE
* In forte this was a 2x4 grid field, displaying a Order object.
* The cell margins are all 100 mils
* The width policy is set to Natural, and the height policy is set to Natural.
*/
protected void setqq_NewOrderGridProperties() {
qq_NewOrderGrid.setCellTopMargin(50);
qq_NewOrderGrid.setCellBottomMargin(50);
qq_NewOrderGrid.setCellLeftMargin(50);
qq_NewOrderGrid.setCellRightMargin(50);
qq_NewOrderGrid.setCellGravity(Constants.CG_MIDDLELEFT);
qq_NewOrderGrid.setCollapsed(true);
qq_NewOrderGrid.setHeightPolicy(Constants.SP_NATURAL);
qq_NewOrderGrid.setWidthPolicy(Constants.SP_NATURAL);
qq_NewOrderGrid.setBackground(null);
qq_NewOrderGrid.setMinimumSize(new Dimension(223, 162));
}
public GridField getqq_NewOrderGrid() {
if (qq_NewOrderGrid == null) {
qq_NewOrderGrid = CompoundFieldFactory.newGridField("NewOrderGrid", false);
getBindingManager().bindComponent(qq_NewOrderGrid, "newOrderGrid");
setqq_NewOrderGridProperties();
GridBagConstraints qq_gbc = new GridBagConstraints();
qq_gbc.gridx = 0; // Column 1
qq_gbc.gridy = 0; // Row 1
qq_gbc.weightx = 0;
qq_gbc.weighty = 0;
qq_gbc.anchor = GridBagConstraints.EAST; // Gravity - original: CG_MIDDLERIGHT
qq_gbc.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
qq_gbc.insets = new Insets(4, 4, 4, 4); // Top, Left, Bottom, Right Margin
qq_NewOrderGrid.add( getqq_ClientNameLbl(), qq_gbc );
GridBagConstraints qq_gbc1 = new GridBagConstraints();
qq_gbc1.gridx = 1; // Column 2
qq_gbc1.gridy = 0; // Row 1
qq_gbc1.weightx = 0;
qq_gbc1.weighty = 0;
qq_gbc1.anchor = GridBagConstraints.WEST; // Gravity - original: CG_MIDDLELEFT gf
qq_gbc1.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
qq_gbc1.insets = new Insets(4, 4, 4, 4); // Top, Left, Bottom, Right Margin
qq_NewOrderGrid.add( getqq_NewOrderGrid_CustomerName(), qq_gbc1 );
GridBagConstraints qq_gbc2 = new GridBagConstraints();
qq_gbc2.gridx = 0; // Column 1
qq_gbc2.gridy = 1; // Row 2
qq_gbc2.weightx = 0;
qq_gbc2.weighty = 0;
qq_gbc2.anchor = GridBagConstraints.EAST; // Gravity - original: CG_MIDDLERIGHT
qq_gbc2.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
qq_gbc2.insets = new Insets(4, 4, 4, 4); // Top, Left, Bottom, Right Margin
qq_NewOrderGrid.add( getqq_StockNameLbl(), qq_gbc2 );
GridBagConstraints qq_gbc3 = new GridBagConstraints();
qq_gbc3.gridx = 1; // Column 2
qq_gbc3.gridy = 1; // Row 2
qq_gbc3.weightx = 0;
qq_gbc3.weighty = 0;
qq_gbc3.anchor = GridBagConstraints.WEST; // Gravity - original: CG_MIDDLELEFT gf
qq_gbc3.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
qq_gbc3.insets = new Insets(4, 4, 4, 4); // Top, Left, Bottom, Right Margin
qq_NewOrderGrid.add( getqq_NewOrderGrid_StockName(), qq_gbc3 );
GridBagConstraints qq_gbc4 = new GridBagConstraints();
qq_gbc4.gridx = 0; // Column 1
qq_gbc4.gridy = 2; // Row 3
qq_gbc4.weightx = 0;
qq_gbc4.weighty = 0;
qq_gbc4.anchor = GridBagConstraints.EAST; // Gravity - original: CG_MIDDLERIGHT
qq_gbc4.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
qq_gbc4.insets = new Insets(4, 4, 4, 4); // Top, Left, Bottom, Right Margin
qq_NewOrderGrid.add( getqq_QuantityLbl(), qq_gbc4 );
GridBagConstraints qq_gbc5 = new GridBagConstraints();
qq_gbc5.gridx = 1; // Column 2
qq_gbc5.gridy = 2; // Row 3
qq_gbc5.weightx = 0;
qq_gbc5.weighty = 0;
qq_gbc5.anchor = GridBagConstraints.WEST; // Gravity - original: CG_MIDDLELEFT gf
qq_gbc5.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
qq_gbc5.insets = new Insets(4, 4, 4, 4); // Top, Left, Bottom, Right Margin
qq_NewOrderGrid.add( getqq_NewOrderGrid_Quantity(), qq_gbc5 );
GridBagConstraints qq_gbc6 = new GridBagConstraints();
qq_gbc6.gridx = 0; // Column 1
qq_gbc6.gridy = 3; // Row 4
qq_gbc6.weightx = 0;
qq_gbc6.weighty = 0;
qq_gbc6.anchor = GridBagConstraints.EAST; // Gravity - original: CG_MIDDLERIGHT
qq_gbc6.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
qq_gbc6.insets = new Insets(4, 4, 4, 4); // Top, Left, Bottom, Right Margin
qq_NewOrderGrid.add( getqq_PriceLbl(), qq_gbc6 );
GridBagConstraints qq_gbc7 = new GridBagConstraints();
qq_gbc7.gridx = 1; // Column 2
qq_gbc7.gridy = 3; // Row 4
qq_gbc7.weightx = 0;
qq_gbc7.weighty = 0;
qq_gbc7.anchor = GridBagConstraints.WEST; // Gravity - original: CG_MIDDLELEFT gf
qq_gbc7.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
qq_gbc7.insets = new Insets(4, 4, 4, 4); // Top, Left, Bottom, Right Margin
qq_NewOrderGrid.add( getqq_NewOrderGrid_Price(), qq_gbc7 );
}
return qq_NewOrderGrid;
}
/**
* qq_SubmitBtn: transformed from: qqds_PushButton
* TagId=20
* isInherited=FALSE
*/
public JButton getqq_SubmitBtn() {
if (qq_SubmitBtn == null) {
qq_SubmitBtn = PushButtonFactory.newInstance("SubmitBtn", "Submit");
DefaultButton.set(qq_SubmitBtn, true);
qq_SubmitBtn.setVerifyInputWhenFocusTarget(true);
WidthPolicy.set(qq_SubmitBtn, Constants.SP_NATURAL);
HeightPolicy.set(qq_SubmitBtn, Constants.SP_NATURAL);
qq_SubmitBtn.setMinimumSize(new Dimension(48, 23));
}
return qq_SubmitBtn;
}
/**
* qq_CancelBtn: transformed from: qqds_PushButton
* TagId=21
* isInherited=FALSE
*/
public JButton getqq_CancelBtn() {
if (qq_CancelBtn == null) {
qq_CancelBtn = PushButtonFactory.newInstance("CancelBtn", "Cancel");
WidthPolicy.set(qq_CancelBtn, Constants.SP_NATURAL);
HeightPolicy.set(qq_CancelBtn, Constants.SP_NATURAL);
qq_CancelBtn.setMinimumSize(new Dimension(46, 23));
}
return qq_CancelBtn;
}
/**
* qq_ButtonGrid: transformed from: qqds_GridField
* TagId=32
* isInherited=FALSE
* In forte this was a 2x1 grid field.
* The top and bottom cell margins are both 100 mils and the left and right cell margins are both 200 mils.
* The width policy is set to Natural, and the height policy is set to Natural.
*/
protected void setqq_ButtonGridProperties() {
qq_ButtonGrid.setCellTopMargin(50);
qq_ButtonGrid.setCellBottomMargin(50);
qq_ButtonGrid.setCellLeftMargin(100);
qq_ButtonGrid.setCellRightMargin(100);
qq_ButtonGrid.setCellGravity(Constants.CG_CENTER);
qq_ButtonGrid.setCollapsed(true);
qq_ButtonGrid.setHeightPolicy(Constants.SP_NATURAL);
qq_ButtonGrid.setWidthPolicy(Constants.SP_NATURAL);
qq_ButtonGrid.setBackground(null);
qq_ButtonGrid.setMinimumSize(new Dimension(175, 45));
}
public GridField getqq_ButtonGrid() {
if (qq_ButtonGrid == null) {
qq_ButtonGrid = CompoundFieldFactory.newGridField("ButtonGrid", false);
setqq_ButtonGridProperties();
GridBagConstraints qq_gbc = new GridBagConstraints();
qq_gbc.gridx = 0; // Column 1
qq_gbc.gridy = 0; // Row 1
qq_gbc.weightx = 0;
qq_gbc.weighty = 0;
qq_gbc.anchor = GridBagConstraints.CENTER; // Gravity - original: CG_CENTER gf
qq_gbc.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
qq_gbc.insets = new Insets(4, 9, 4, 9); // Top, Left, Bottom, Right Margin
qq_ButtonGrid.add( getqq_SubmitBtn(), qq_gbc );
GridBagConstraints qq_gbc1 = new GridBagConstraints();
qq_gbc1.gridx = 1; // Column 2
qq_gbc1.gridy = 0; // Row 1
qq_gbc1.weightx = 0;
qq_gbc1.weighty = 0;
qq_gbc1.anchor = GridBagConstraints.CENTER; // Gravity - original: CG_CENTER gf
qq_gbc1.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
qq_gbc1.insets = new Insets(4, 9, 4, 9); // Top, Left, Bottom, Right Margin
qq_ButtonGrid.add( getqq_CancelBtn(), qq_gbc1 );
}
return qq_ButtonGrid;
}
/**
* qq_OuterGrid: transformed from: qqds_GridField
* TagId=22
* isInherited=FALSE
* In forte this was a 1x2 grid field.
* The cell margins are all 100 mils
* The width policy is set to Natural, and the height policy is set to Natural.
*/
protected void setqq_OuterGridProperties() {
qq_OuterGrid.setCellTopMargin(50);
qq_OuterGrid.setCellBottomMargin(50);
qq_OuterGrid.setCellLeftMargin(50);
qq_OuterGrid.setCellRightMargin(50);
qq_OuterGrid.setCellGravity(Constants.CG_CENTER);
qq_OuterGrid.setCollapsed(true);
qq_OuterGrid.setHeightPolicy(Constants.SP_NATURAL);
qq_OuterGrid.setWidthPolicy(Constants.SP_NATURAL);
qq_OuterGrid.setBackground(null);
qq_OuterGrid.setMinimumSize(new Dimension(246, 250));
qq_OuterGrid.setLocation(31, 18);
}
public GridField getqq_OuterGrid() {
if (qq_OuterGrid == null) {
qq_OuterGrid = CompoundFieldFactory.newGridField("OuterGrid", false);
setqq_OuterGridProperties();
GridBagConstraints qq_gbc = new GridBagConstraints();
qq_gbc.gridx = 0; // Column 1
qq_gbc.gridy = 0; // Row 1
qq_gbc.weightx = 0;
qq_gbc.weighty = 0;
qq_gbc.anchor = GridBagConstraints.CENTER; // Gravity - original: CG_CENTER gf
qq_gbc.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
qq_gbc.insets = new Insets(4, 4, 4, 4); // Top, Left, Bottom, Right Margin
qq_OuterGrid.add( getqq_NewOrderGrid(), qq_gbc );
GridBagConstraints qq_gbc1 = new GridBagConstraints();
qq_gbc1.gridx = 0; // Column 1
qq_gbc1.gridy = 1; // Row 2
qq_gbc1.weightx = 0;
qq_gbc1.weighty = 0;
qq_gbc1.anchor = GridBagConstraints.CENTER; // Gravity - original: CG_CENTER gf
qq_gbc1.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
qq_gbc1.insets = new Insets(4, 4, 4, 4); // Top, Left, Bottom, Right Margin
qq_OuterGrid.add( getqq_ButtonGrid(), qq_gbc1 );
}
return qq_OuterGrid;
}
/**
* Form: transformed from: qqds_Panel
* TagId=1
* isInherited=FALSE
*/
protected void setFormProperties() {
Form.setOpaque( true );
ColourChange.setBackground(Form, UIutils.White);
}
public JPanel getForm() {
if (Form == null) {
Form = CompoundFieldFactory.newForm();
this.setFormProperties();
Form.add( getqq_OuterGrid() );
}
return Form;
}
/**
* Gets the system close policy
*
* The SystemClosePolicy property determines how a window responds to user attempts to close it by using the native window system through the window close box or a window system menu command.
* SystemClosePolicy responds to window closure attempts according to the following parameters:
* <li>Constants.SC_DISABLED Does not allow window closure through window system.</li>
* <li>Constants.SC_ENABLEDNOFINALIZE Window can be closed, but the contents are not verified, guaranteeing that the window will close (for example, the user clicks the Cancel button).</li>
* <li>Constants.SC_ENABLEDFINALIZE Posts the RequestFinalize method on the window, with a reason code of zero.</li>
* <li>Constants.SC_ENABLEDSHUTDOWN Posts Shutdown event to window�s task and to all tasks started by that task. This is the default value.</li>
*/
public int getSystemClosePolicy() {
return qq_SystemClosePolicy;
}
/**
* Sets the system close policy
*
* The SystemClosePolicy property determines how a window responds to user attempts to close it by using the native window system through the window close box or a window system menu command.
* SystemClosePolicy responds to window closure attempts according to the following parameters:
* <li>Constants.SC_DISABLED Does not allow window closure through window system.</li>
* <li>Constants.SC_ENABLEDNOFINALIZE Window can be closed, but the contents are not verified, guaranteeing that the window will close (for example, the user clicks the Cancel button).</li>
* <li>Constants.SC_ENABLEDFINALIZE Posts the RequestFinalize method on the window, with a reason code of zero.</li>
* <li>Constants.SC_ENABLEDSHUTDOWN Posts Shutdown event to window�s task and to all tasks started by that task. This is the default value.</li>
*/
public void setSystemClosePolicy(int policy) {
this.qq_SystemClosePolicy = policy;
if (policy == Constants.SC_DISABLED) {
this.addComponentListener(new CloseHideAdaptor(this));
} else {
for (ComponentListener cl : this.getComponentListeners()) {
if (cl instanceof CloseHideAdaptor) {
this.removeComponentListener(cl);
break;
}
}
}
}
/**
* Gets the initial position policy
*
* The InitialPositionPolicy property sets the position of a main window when it is first displayed, relative to a primary window or the screen.
* You use the InitialPositionPolicy property in conjunction with the InitialX, InitialY properties.
* InitialPositionPolicy sets the position of a window according to the following values:
* <li>Constants.PP_SYSTEMDEFAULT Accepts the default window system placement specification.</li>
* <li>Constants.PP_PRIMARYCENTERED Centers the window relative to the window specified as the PrimaryWindow property.</li>
* <li>Constants.PP_PRIMARYRELATIVE Positions the window relative to the primary window, using the PrimaryWindow, InitialX and InitialY attributes.</li>
* <li>Constants.PP_SCREENCENTERED Centers the window relative to the screen.</li>
* <li>Constants.PP_SCREENRELATIVE Positions the window relative to the screen, using the InitialX and InitialY properties.</li>
*/
public int getInitialPositionPolicy() {
return qq_initialPositionPolicy;
}
/**
* Sets the initial position policy
*
* The InitialPositionPolicy property sets the position of a main window when it is first displayed, relative to a primary window or the screen.
* You use the InitialPositionPolicy property in conjunction with the InitialX, InitialY properties.
* InitialPositionPolicy sets the position of a window according to the following values:
* <li>Constants.PP_SYSTEMDEFAULT Accepts the default window system placement specification.</li>
* <li>Constants.PP_PRIMARYCENTERED Centers the window relative to the window specified as the PrimaryWindow property.</li>
* <li>Constants.PP_PRIMARYRELATIVE Positions the window relative to the primary window, using the PrimaryWindow, InitialX and InitialY attributes.</li>
* <li>Constants.PP_SCREENCENTERED Centers the window relative to the screen.</li>
* <li>Constants.PP_SCREENRELATIVE Positions the window relative to the screen, using the InitialX and InitialY properties.</li>
*/
public void setInitialPositionPolicy(int policy) {
this.qq_initialPositionPolicy = policy;
}
/**
* Gets the primary window
*
* The primary window property designates a window, known as a primary window, to serve as an initial position reference for the current window.
* When a main window first realizes itself through the Open method on the UserWindow, it assumes a position according to the InitialPositionPolicy attribute.
* When the InitialPositionPolicy property is set to PP_PRIMARYRELATIVE (relative to the primary window) or PP_PRIMARYCENTERED (centered on the primary window),
* the window realizes itself in a position relative to the designated primary window.<p>
* <p>
* To take a position relative to the primary window, a window uses the PrimaryWindow attribute in conjunction with the InitialX and InitialY properties, which specify the window�s horizontal and vertical coordinates.
*/
public Window getPrimaryWindow() {
return this.primaryWindow;
}
/**
* Sets the primary window
*
* The primary window property designates a window, known as a primary window, to serve as an initial position reference for the current window.
* When a main window first realizes itself through the Open method on the UserWindow, it assumes a position according to the InitialPositionPolicy attribute.
* When the InitialPositionPolicy property is set to PP_PRIMARYRELATIVE (relative to the primary window) or PP_PRIMARYCENTERED (centered on the primary window),
* the window realizes itself in a position relative to the designated primary window.<p>
* <p>
* To take a position relative to the primary window, a window uses the PrimaryWindow attribute in conjunction with the InitialX and InitialY properties, which specify the window�s horizontal and vertical coordinates.
*/
public void setPrimaryWindow(Window value) {
this.primaryWindow = value;
}
/**
* Gets the InitialX value
*
* The InitialX property (integer) is the window�s initial horizontal screen position, relative to a primary window or the screen. It is specified in mils.
* InitialX applies only to main windows and only when a window�s InitialPositionPolicy attribute is set to PP_PRIMARYRELATIVE (relative to the primary window) or PP_SCREENRELATIVE (relative to the screen).
* InitialX, and its corollary, InitialY, work in conjunction with the PrimaryWindow and InitialPositionPolicy attributes to determine the position of a main window when it is first realized.
*/
public int getInitialX() {
return initialX;
}
/**
* Sets the InitialX value
*
* The InitialX property (integer) is the window�s initial horizontal screen position, relative to a primary window or the screen. It is specified in mils.
* InitialX applies only to main windows and only when a window�s InitialPositionPolicy attribute is set to PP_PRIMARYRELATIVE (relative to the primary window) or PP_SCREENRELATIVE (relative to the screen).
* InitialX, and its corollary, InitialY, work in conjunction with the PrimaryWindow and InitialPositionPolicy attributes to determine the position of a main window when it is first realized.
*/
public void setInitialX(int value) {
this.initialX = value;
}
/**
* Gets the InitialY value
*
* The InitialY property (integer) is the window�s initial vertical screen position, relative to a primary window or the screen. It is specified in mils.
* InitialY applies only to main windows and only when a window�s InitialPositionPolicy attribute is set to PP_PRIMARYRELATIVE (relative to the primary window) or PP_SCREENRELATIVE (relative to the screen).
* InitialY, and its corollary, InitialX, work in conjunction with the PrimaryWindow and InitialPositionPolicy attributes to determine the position of a main window when it is first realized.
*/
public int getInitialY() {
return initialY;
}
/**
* Sets the InitialY value
*
* The InitialY property (integer) is the window�s initial vertical screen position, relative to a primary window or the screen. It is specified in mils.
* InitialY applies only to main windows and only when a window�s InitialPositionPolicy attribute is set to PP_PRIMARYRELATIVE (relative to the primary window) or PP_SCREENRELATIVE (relative to the screen).
* InitialY, and its corollary, InitialX, work in conjunction with the PrimaryWindow and InitialPositionPolicy attributes to determine the position of a main window when it is first realized.
*/
public void setInitialY(int value) {
this.initialY = value;
}
/**
* Gets the default message set number for the window and its widgets.
*/
public int getSetNum() {
return this.qq_defaultSet;
}
/**
* Sets the default message set number for the window and its widgets.
*/
public void setSetNum(int value) {
if (value != this.qq_defaultSet) {
this.qq_defaultSet = value;
UIutils.reloadLabelText(this);
}
}
/**
* Gets the message set number for the message number of the window's title.
*/
public int getTitleSetNum() {
return this.qq_msgSet;
}
/**
* Sets the message set number for the message number of the window's title.
*/
public void setTitleSetNum(int value) {
if (value != this.qq_msgNumber) {
this.qq_msgSet = value;
UIutils.reloadTitle(this, this.qq_msgSet, this.qq_msgNumber);
}
}
/**
* Gets the message number for the message number of the window's title.
*/
public int getTitleMsgNum() {
return this.qq_msgNumber;
}
/**
* Sets the message number for the message number of the window's title.
*/
public void setTitleMsgNum(int value) {
if (value != this.qq_msgSet) {
this.qq_msgNumber = value;
UIutils.reloadTitle(this, this.qq_msgSet, this.qq_msgNumber);
}
}
/**
* Initialise the window and all its children.
*/
protected void initialize() {
if (this.Form == null) {
this.setName( "OrderWindow" );
this.setTitle( "" );
this.setSetNum(1);
this.setTitleMsgNum(0);
this.setTitleSetNum(0);
this.setSystemClosePolicy(Constants.SC_ENABLEDSHUTDOWN);
if (this.getContentPane() != this.getForm()) {
this.setContentPane(getForm());
}
this.qq_setupWindowUsage();
this.setResizable( false );
this.setAlwaysOnTop(false);
UserWindow.setIconizeEnabled(this, true);
WindowManager.addWindowListener(this);
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.setUsage(Constants.WU_UPDATE);
UIutils.processGUIActions();
this.pack();
this.setInitialX(0);
this.setInitialY(0);
this.setInitialPositionPolicy(Constants.PP_SYSTEMDEFAULT);
}
}
// ----------------
// Window usage
//-----------------
protected WindowUsageMap qq_usage = new WindowUsageMap();
public int getUsage() {
return this.qq_usage.getUsage();
}
public WindowUsageMap getUsageMap() {
return this.qq_usage;
}
/**
* Sets the window usage
*
* The Usage property sets the state for all a window�s child widgets at once, providing collective widget state changes on a predefined basis. A widget�s state determines how the widget reacts to mouse actions and how it displays itself. A window�s Usage property provides a convenient way to control the states of a group of widgets in the context of their parent window. With the Usage attribute, you can synchronize widget states to conform to a pattern you establish for the window.
* The Usage attribute accepts the following values:
* <li>Constants.WU_EDIT Edit usage: widgets themselves are editable, but not underlying data.</li>
* <li>Constants.WU_QUERY Query only usage: widget data is editable, but not widgets themselves.</li>
* <li>Constants.WU_UPDATE Update usage: mouse actions and keyboard input accepted. Widgets themselves are changeable. This is the default.</li>
* <li>Constants.WU_USER1 A user-defined usage. Default values same as WU_UPDATE.</li>
* <li>Constants.WU_USER2 A user-defined usage. Default values same as WU_UPDATE.</li>
* <li>Constants.WU_USER3 A user-defined usage. Default values same as WU_UPDATE.</li>
* <li>Constants.WU_VIEW View-only usage: no keyboard input is accepted. Widget posts Click events for mouse clicks.</li>
*/
public void setUsage(int usage) {
this.qq_usage.setUsage(usage);
}
public void qq_setupWindowUsage() {
this.qq_usage = new WindowUsageMap();
this.qq_usage.add(getqq_OuterGrid(), Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
this.qq_usage.add(getqq_NewOrderGrid(), Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
this.qq_usage.add(getqq_ClientNameLbl(), Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
this.qq_usage.add(getqq_NewOrderGrid_CustomerName(), Constants.FS_VIEWONLY, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
this.qq_usage.add(getqq_StockNameLbl(), Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
this.qq_usage.add(getqq_NewOrderGrid_StockName(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
this.qq_usage.add(getqq_QuantityLbl(), Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
this.qq_usage.add(getqq_NewOrderGrid_Quantity(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
this.qq_usage.add(getqq_PriceLbl(), Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
this.qq_usage.add(getqq_NewOrderGrid_Price(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
this.qq_usage.add(getqq_ButtonGrid(), Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
this.qq_usage.add(getqq_SubmitBtn(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
this.qq_usage.add(getqq_CancelBtn(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
}
// </editor-fold>
// -----------
// Main method
// -----------
public static void main(String []args) {
KeyboardFocusManager.setCurrentKeyboardFocusManager(new ForteKeyboardFocusManager());
try {
UIManager.setLookAndFeel(new Win32LookAndFeel());
}
catch (Exception e) {}
ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);
OrderWindow myClass = new OrderWindow();
myClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myClass.setVisible(true);
UIutils.processGUIActions();
}
} // end class OrderWindow
// c Pass 2 Conversion Time: 500 milliseconds