Package StockTradeWindows

Source Code of StockTradeWindows.TraderWindow$AsyncRunner

package StockTradeWindows;

import DisplayProject.ArrayColumn;
import DisplayProject.CloseHideAdaptor;
import DisplayProject.Constants;
import DisplayProject.CursorMgr;
import DisplayProject.DataField;
import DisplayProject.GridField;
import DisplayProject.UDSWindow;
import DisplayProject.UIutils;
import DisplayProject.WindowManager;
import DisplayProject.WindowUsageMap;
import DisplayProject.actions.ColourChange;
import DisplayProject.actions.FrameColor;
import DisplayProject.actions.HeightPolicy;
import DisplayProject.actions.StatusText;
import DisplayProject.actions.TableRow;
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.ArrayField;
import DisplayProject.controls.TextGraphic;
import DisplayProject.events.ClientEventManager;
import DisplayProject.factory.CompoundFieldFactory;
import DisplayProject.factory.DataFieldFactory;
import DisplayProject.factory.GraphicFactory;
import DisplayProject.factory.PushButtonFactory;
import DisplayProject.factory.TableFactory;
import DisplayProject.factory.ToggleFieldFactory;
import DisplayProject.plaf.Win32LookAndFeel;
import DisplayProject.table.ArrayFieldCellHelper;
import DisplayProject.table.CheckBoxCellEditor;
import DisplayProject.table.CheckBoxCellRenderer;
import DisplayProject.table.FormattedCellEditor;
import DisplayProject.table.FormattedCellRenderer;
import Framework.AsyncStarter;
import Framework.DecimalData;
import Framework.ErrorMgr;
import Framework.EventHandle;
import Framework.EventManager;
import Framework.EventRegistration;
import Framework.File;
import Framework.ForteKeyboardFocusManager;
import Framework.GenericException;
import Framework.IntegerData;
import Framework.ParameterHolder_float;
import Framework.ParameterHolder_integer;
import Framework.RuntimeProperties;
import Framework.StringUtils;
import Framework.TextData;
import Framework.UsageException;
import StockTradeBusinessClasses.Array_Of_Order;
import StockTradeBusinessClasses.Order;
import StockTradeBusinessClasses.ParameterHolder_Order;
import StockTradeServices.InvalidTradeException;
import StockTradeServices.TradeMgr;
import StockTradeServices.interfaces.*;
import StockTradeWindows.CustomerWindow;
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.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.ToolTipManager;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import org.fest.swing.fixture.FrameFixture;
import org.fest.swing.fixture.JTextComponentFixture;

/**
* TraderWindow<p>
* <p>
* @author Generated from Forte
* @since  24-Aug-2010
*/
@RuntimeProperties(isDistributed=false, isAnchored=false, isShared=false, isTransactional=false)
@UDSWindow()
@SuppressWarnings("serial")
public class TraderWindow
        extends JFrame
        implements Cloneable, Serializable, Observable
{

    // -------------
    // Inner classes
    // -------------
    /**
     * This class contains routines to be able to start threads for the methods on this class in a manner
     * similar to that allowed by Forte. This includes:<p>
     * <ul>
     * <li>Arbitrary parameters</li>
     * <li>Starting threads as daemon threads</li>
     * <li>Naming the thread for easy debugging</li>
     * </ul>
     */
    public static class AsyncRunner extends AsyncStarter {
        /**
         * Create an async runner which does not fire completion events nor begin a transaction
         */
        public AsyncRunner() {
            super();
        }

        /**
         * display<p>
         * <p>
         * @param pName4TrdrWin Type: TextData
         */
        public Thread display(final TraderWindow pTraderWindow, final TextData pName4TrdrWin) {
            return startTask(pTraderWindow, "TraderWindow.Display",
                    new AsyncStarter.AsyncInvoker() {
                        @Override public void runWithNoReturn() {
                            pTraderWindow.display(pName4TrdrWin);
                        }
                    });
        }
    }

    // ----------
    // Attributes
    // ----------
    protected File defaultHelpFile;
    protected BindingManager bindingManager = null;
    public PropertyChangeSupport qq_Listeners = null;
    private TextData statusLine;
    private TextData traderName;
    private Array_Of_Order<Order> orderList;

    // ------------
    // Constructors
    // ------------
    public TraderWindow() {
        // Explicitly call the superclass constructor to prevent the implicit call
        super();
        this.initialize();
        this.setStatusLine(new TextData());
        StatusText.set(this, this.getStatusLine());

        this.setTraderName(new TextData());
        //self.CustomerName = new;
        //self.TraderName.Setvalue('Boris');
        //self.CustomerName.Setvalue('Natasha');
        //self.StockName = 'Forte';
        //self.Quantity = 100;
        //self.Price = 25;
        //self.Type = 'Buy';

        this.setOrderList(new Array_Of_Order<Order>());
        this.setOrderList(TradeSO_proxy.getInstance().getOrderList());

        //  Import code for Init Method for TraderWindow class
        //  Populate OrderList Array widget
        //
        // Order1 : Order = new;
        // Order1.CustomerName.SetValue('Natasha');
        // Order1.StockName = 'Coarse Light';
        // Order1.Quantity = 100;
        // Order1.Price = 25;
        // Order1.Type = 'Buy';
        // self.OrderList.AppendRow(Order1);
        //        
        // Order2 : Order = new;
        // Order2.CustomerName.SetValue('Bill');
        // Order2.StockName = 'Boston Quicken';
        // Order2.Quantity = 100;
        // Order2.Price = 25;
        // Order2.Type = 'Buy';
        // self.OrderList.AppendRow(Order2);
        //        
        // Order3 : Order = new;
        // Order3.CustomerName.SetValue('Chris');
        // Order3.StockName = 'Coarse Light';
        // Order3.Quantity = 100;
        // Order3.Price = 25;
        // Order3.Type = 'Sell';
        // self.OrderList.AppendRow(Order3);

    }

    // ----------------------
    // 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 setStatusLine(TextData statusLine) {
        TextData oldValue = this.statusLine;
        this.statusLine = statusLine;
        this.firePropertyChange("statusLine", oldValue, this.statusLine);
    }

    /**
     * Getter for the attribute StatusLine
    */
    public TextData getStatusLine() {
        return this.statusLine;
    }

    public void setTraderName(TextData traderName) {
        TextData oldValue = this.traderName;
        this.traderName = traderName;
        this.firePropertyChange("traderName", oldValue, this.traderName);
    }

    /**
     * Getter for the attribute TraderName
    */
    public TextData getTraderName() {
        return this.traderName;
    }

    public void setOrderList(Array_Of_Order<Order> orderList) {
        Array_Of_Order<Order> oldValue = this.orderList;
        this.orderList = orderList;
        this.firePropertyChange("orderList", oldValue, this.orderList);
    }

    /**
     * Getter for the attribute OrderList
    */
    public Array_Of_Order<Order> getOrderList() {
        return this.orderList;
    }

    // -------
    // 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);
        }
    }

    /**
     * display<p>
     * <p>
     * @param pName4TrdrWin Type: TextData
     */
    public void display(TextData pName4TrdrWin) {
        this.getTraderName().setValue( pName4TrdrWin );

        UserWindow.open(this);
        // ----------
        // Event Loop
        // ----------
        EventManager.startEventLoop();
        try {
            EventRegistration TaskHandle_Shutdown_langThreadcurrentThread = ClientEventManager.register( Thread.currentThread(), "Shutdown" );
            EventRegistration TradeMgr_OrderProcessed_getInstance = ClientEventManager.register( TradeSO_proxy.getInstance(), TradeMgr.cEVENT_ORDER_PROCESSED );
            EventRegistration TradeMgr_NewOrderAdded_getInstance = ClientEventManager.register( TradeSO_proxy.getInstance(), TradeMgr.cEVENT_NEW_ORDER_ADDED );
            EventRegistration PushButton_ObjectDrop_getqq_ViewHoldingsBtn = ClientEventManager.register( this.getqq_ViewHoldingsBtn(), "ObjectDrop" );
            EventRegistration PushButton_Click_getqq_ViewHoldingsBtn = ClientEventManager.register( this.getqq_ViewHoldingsBtn(), "Click" );
            EventRegistration PushButton_Click_getqq_MakeTradeBtn = ClientEventManager.register( this.getqq_MakeTradeBtn(), "Click" );
            EventRegistration TradeMgr_MakeTrade_return_getInstance = ClientEventManager.register( TradeSO_proxy.getInstance(), TradeMgr.cEVENT_MAKE_TRADE_RETURN );
            EventRegistration TradeMgr_MakeTrade_exception_getInstance = ClientEventManager.register( TradeSO_proxy.getInstance(), TradeMgr.cEVENT_MAKE_TRADE_EXCEPTION );
            EventRegistration PushButton_Click_getqq_ExitBtn = ClientEventManager.register( this.getqq_ExitBtn(), "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 ================
                        break;

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ----------------------
                // TradeSO.OrderProcessed
                // ----------------------
                else if (qq_currentEvent.isEvent(TradeMgr_OrderProcessed_getInstance)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        Order theProcessedOrder = qq_currentEvent.getParam("pOrder");
                        if (this.getOrderList() != null) {
                            for (Order row : this.getOrderList()) {
                                if (row.getOrderID() == theProcessedOrder.getOrderID()) {
                                    // TODO [1037,Major]: If you are deleting a row inside a loop, use the Iterator in place of the array
                                    this.getOrderList().remove(row);
                                }
                            }
                        }

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ---------------------
                // TradeSO.NewOrderAdded
                // ---------------------
                else if (qq_currentEvent.isEvent(TradeMgr_NewOrderAdded_getInstance)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        Order theNewOrder = qq_currentEvent.getParam("pNewOrder");
                        this.getOrderList().add(theNewOrder);

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ----------------------------
                // <ViewHoldingsBtn>.ObjectDrop
                // ----------------------------
                else if (qq_currentEvent.isEvent(PushButton_ObjectDrop_getqq_ViewHoldingsBtn)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        JComponent theDroppedWidget = qq_currentEvent.getParam("sourceField");
                        int rownum = 0;
                        rownum = TableRow.get(this.getqq_OrderList());
                        CustomerWindow customerWin = new CustomerWindow();
                        customerWin.setUsage(Constants.WU_VIEW);
                        customerWin.display(this.getOrderList().get(rownum-1).getCustomerName());

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // -----------------------
                // <ViewHoldingsBtn>.Click
                // -----------------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_ViewHoldingsBtn)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        //self.Window.MessageDialog(MessageText='View Holdings not yet implemented',
                        //              MessageType=MT_INFO);

                        CustomerWindow customerWin = new CustomerWindow();
                        customerWin.display(this.getTraderName());


                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // --------------------
                // <MakeTradeBtn>.Click
                // --------------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_MakeTradeBtn)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        //self.Window.MessageDialog(MessageText='Make Trade not yet implemented',
                        //              MessageType=MT_INFO);
                        try {
                            Order buyOrder = null, sellOrder = null;
                            int tradeQuantity = 0;
                            float tradePrice = 0;

                            // ------------------------------------
                            // Parameters for call to ValidateMatch
                            // ------------------------------------
                            ParameterHolder_Order qq_pBuyOrder = new ParameterHolder_Order();
                            ParameterHolder_Order qq_pSellOrder = new ParameterHolder_Order();
                            this.validateMatch(qq_pBuyOrder, qq_pSellOrder);
                            buyOrder = qq_pBuyOrder.get();
                            sellOrder = qq_pSellOrder.get();
                            //self.OrderList.DeleteRow(object=buyOrder);
                            //self.OrderList.DeleteRow(object=sellOrder);
                            new TradeMgr.AsyncRunner(true).makeTrade(TradeSO_proxy.getInstance(), buyOrder, sellOrder, new ParameterHolder_integer(), new ParameterHolder_float());

                            //self.Window.MessageDialog(messagetext='Trade completed successfully',
                            //              messagetype = MT_INFO);

                        }
                        catch (InvalidTradeException badOrder) {
                                WindowManager.messageDialog(this, GenericException.getMessageText(badOrder), GenericException.severity(badOrder), 50);
                        }

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ------------------------
                // TradeSO.MakeTrade_return
                // ------------------------
                else if (qq_currentEvent.isEvent(TradeMgr_MakeTrade_return_getInstance)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        int outputQuantity = (Integer)qq_currentEvent.getParam("pMTQuantity");
                        float outputPrice = (Float)qq_currentEvent.getParam("pMTPrice");
                        String returnSecName = qq_currentEvent.getParam("return");
                        TextData tempMsg = new TextData();
                        TextData objSecName = new TextData(returnSecName);
                        DecimalData objPrice = new DecimalData(outputPrice);
                        IntegerData objQuantity = new IntegerData(outputQuantity);
                        tempMsg.replaceParameters("Trade for %1 at price $%2 for %3 shares completed successfully", objSecName, objPrice, objQuantity);
                        WindowManager.messageDialog(this, tempMsg, Constants.MT_INFO, 50);

                        //   when TradeSO.MakeTrade_exception do
                        //       self.Window.MessageDialog(
                        //       messagetext = 'Error in trading. The trade was not performed',
                        //       messageType = MT_ERROR);

                        //  badTrade returned as type OBJECT, need to cast to GenericException or
                        // ErroDesc to access message attribute
                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ---------------------------
                // TradeSO.MakeTrade_exception
                // ---------------------------
                else if (qq_currentEvent.isEvent(TradeMgr_MakeTrade_exception_getInstance)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        RuntimeException badTrade = qq_currentEvent.getParam("exception");
                        // TODO [1094,Minor]: Exception message has been wrapped in a TextData, ensure this doesn't cause any issues.
                        WindowManager.messageDialog(this, GenericException.getMessageText(((GenericException)badTrade)).getValue(), Constants.MT_ERROR, 50);

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ---------------
                // <ExitBtn>.Click
                // ---------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_ExitBtn)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        break;

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }
            }
            EventManager.deregister( TaskHandle_Shutdown_langThreadcurrentThread );
            EventManager.deregister( TradeMgr_OrderProcessed_getInstance );
            EventManager.deregister( TradeMgr_NewOrderAdded_getInstance );
            EventManager.deregister( PushButton_ObjectDrop_getqq_ViewHoldingsBtn );
            EventManager.deregister( PushButton_Click_getqq_ViewHoldingsBtn );
            EventManager.deregister( PushButton_Click_getqq_MakeTradeBtn );
            EventManager.deregister( TradeMgr_MakeTrade_return_getInstance );
            EventManager.deregister( TradeMgr_MakeTrade_exception_getInstance );
            EventManager.deregister( PushButton_Click_getqq_ExitBtn );
        }
        //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);
        }
    }

    /**
     * validateMatch<p>
     * Import code for ValidateMatch Method for TraderWindow class<br>
     * Create counter for Buy Orders marked for Trade<br>
     * Create counter for Sell Orders marked for Trade<br>
     * Step through OrderList to locate Buy and Sell Order<br>
     * Raise InvalidTradeException if:<br>
     * No Buy or Sell Order placed<br>
     * Only 1 Order placed<br>
     * More than 1 Buy Order placed<br>
     * More than 1 Sell Order placed<br>
     * Price, Quantity, Stock Name for Buy/Sell Order don't match<br>
     * <p>
     * @param pBuyOrder Type: Order
     * @param pSellOrder Type: Order
     */
    public void validateMatch(ParameterHolder_Order pBuyOrder, ParameterHolder_Order pSellOrder) {
        int cntOrderForBuy = 0, cntOrderForSell = 0;

        if (this.getOrderList() != null) {
            for (Order row : this.getOrderList()) {
                if (row.getSelectedForTrade() == true) {
                    if ("Buy".equals(row.getType())) {
                        pBuyOrder.setObject(row);
                        cntOrderForBuy = cntOrderForBuy+1;
                    }
                    else {
                        pSellOrder.setObject(row);
                        cntOrderForSell = cntOrderForSell+1;
                    }
                }
            }
        }

        InvalidTradeException badOrder = new InvalidTradeException();

        if (cntOrderForBuy < 1 || cntOrderForSell < 1) {
            badOrder.setWithParams(Framework.Constants.SP_ER_ERROR, "Must select exactly one BUY and one SELL Order");
            ErrorMgr.addError(badOrder);
            throw badOrder;
        }

        if (cntOrderForBuy > 1) {
            badOrder.setWithParams(Framework.Constants.SP_ER_ERROR, "User has selected more than 1 BUY Order");
            ErrorMgr.addError(badOrder);
            throw badOrder;
        }

        if (cntOrderForSell > 1) {
            badOrder.setWithParams(Framework.Constants.SP_ER_ERROR, "User has selected more than 1 SELL Order");
            ErrorMgr.addError(badOrder);
            throw badOrder;
        }

        if (((Order)pBuyOrder.getObject()).getQuantity() != ((Order)pSellOrder.getObject()).getQuantity() || ((Order)pBuyOrder.getObject()).getPrice() != ((Order)pSellOrder.getObject()).getPrice() || StringUtils.notEquals(((Order)pBuyOrder.getObject()).getStockName(), ((Order)pSellOrder.getObject()).getStockName())) {
            badOrder.setWithParams(Framework.Constants.SP_ER_ERROR, "Quantity, Price and StockName of BUY/SELL Order must be exact match");
            ErrorMgr.addError(badOrder);
            throw badOrder;
        }
    }

    // ------------------
    // 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 ArrayField qq_OrderList;
    public DataField qq_OrderListArray_CustomerName;
    public DataField qq_OrderListArray_Price;
    public DataField qq_OrderListArray_Quantity;
    public DataField qq_OrderListArray_StockName;
    public DataField qq_OrderListArray_Type;
    public DataField qq_StatusLine;
    public DataField qq_TraderName;
    public GridField qq_GridField44;
    public GridField qq_GridField45;
    public GridField qq_GridField46;
    public GridField qq_GridField48;
    public JButton qq_ExitBtn;
    public JButton qq_MakeTradeBtn;
    public JButton qq_ViewHoldingsBtn;
    public JCheckBox qq_OrderListArray_SelectedForTrade;
    public JPanel Form;
    public JScrollPane qq_OrderList_sp;
    public TextGraphic qq_TraderNameLbl;

    /**
     * qq_StatusLine: transformed from: qqds_DataField
     * TagId=49
     * isInherited=FALSE
     */
    public DataField getqq_StatusLine() {
        if (qq_StatusLine == null) {
            // Mask type: MK_NONE
            qq_StatusLine = DataFieldFactory.newDataField("StatusLine", 83, TextData.class, Constants.MK_NONE);
            qq_StatusLine.setValue("");
            qq_StatusLine.setHorizontalAlignment(JTextField.LEFT);
            getBindingManager().bindComponent(qq_StatusLine, "statusLine");
            WidthPolicy.set(qq_StatusLine, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_StatusLine, Constants.SP_NATURAL);
            qq_StatusLine.setMinimumSize(new Dimension(507, 19));
            qq_StatusLine.setSize(new Dimension(507, 19));
            qq_StatusLine.setLocation(9, 386);
            ColourChange.setBackground(qq_StatusLine, Constants.C_PALEGREEN);
        }
        return qq_StatusLine;
    }


    /**
     * qq_TraderNameLbl: transformed from: qqds_TextGraphic
     * TagId=47
     * isInherited=FALSE
     */
    public TextGraphic getqq_TraderNameLbl() {
        if (qq_TraderNameLbl == null) {
            qq_TraderNameLbl = GraphicFactory.newTextGraphic("Trader Name\n", "");
            // OPTIONAL UIutils.reloadLabelText(qq_TraderNameLbl, mcat);
            WidthPolicy.set(qq_TraderNameLbl, Constants.SP_NATURAL);
            HeightPolicy.set(qq_TraderNameLbl, Constants.SP_NATURAL);
            qq_TraderNameLbl.setMinimumSize(new Dimension(67, 14));
        }
        return qq_TraderNameLbl;
    }


    /**
     * qq_TraderName: transformed from: qqds_DataField
     * TagId=18
     * isInherited=FALSE
     */
    public DataField getqq_TraderName() {
        if (qq_TraderName == null) {
            // Mask type: MK_NONE
            qq_TraderName = DataFieldFactory.newDataField("TraderName", 19, TextData.class, Constants.MK_NONE);
            qq_TraderName.setValue("");
            qq_TraderName.setHorizontalAlignment(JTextField.LEFT);
            getBindingManager().bindComponent(qq_TraderName, "traderName");
            WidthPolicy.set(qq_TraderName, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_TraderName, Constants.SP_NATURAL);
            qq_TraderName.setMinimumSize(new Dimension(127, 19));
            qq_TraderName.setSize(new Dimension(127, 19));
        }
        return qq_TraderName;
    }


    /**
     * qq_GridField46: transformed from: qqds_GridField
     * TagId=46
     * isInherited=FALSE
     * In forte this was a 2x1 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_GridField46Properties() {
        qq_GridField46.setCellTopMargin(50);
        qq_GridField46.setCellBottomMargin(50);
        qq_GridField46.setCellLeftMargin(50);
        qq_GridField46.setCellRightMargin(50);
        qq_GridField46.setCellGravity(Constants.CG_CENTER);
        qq_GridField46.setCollapsed(true);
        qq_GridField46.setHeightPolicy(Constants.SP_NATURAL);
        qq_GridField46.setWidthPolicy(Constants.SP_NATURAL);
        qq_GridField46.setBackground(null);
        qq_GridField46.setMinimumSize(new Dimension(225, 38));
    }

    public GridField getqq_GridField46() {
        if (qq_GridField46 == null) {
            qq_GridField46 = CompoundFieldFactory.newGridField("qq_GridField46", true);
            setqq_GridField46Properties();
            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_GridField46.add( getqq_TraderNameLbl(), 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, 4, 4, 4); // Top, Left, Bottom, Right Margin
            qq_GridField46.add( getqq_TraderName(), qq_gbc1 );

        }
        return qq_GridField46;
    }


    /**
     * qq_OrderList_sp: transformed from: qqds_ArrayField
     * TagId=29
     * isInherited=FALSE
     */
    public JScrollPane getqq_OrderList_sp() {
        if (qq_OrderList_sp == null) {
            qq_OrderList_sp = CompoundFieldFactory.newScrollPane();
            qq_OrderList_sp.setName("OrderList");
            qq_OrderList_sp.setViewportView(getqq_OrderList());
            qq_OrderList_sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
            qq_OrderList_sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            qq_OrderList_sp.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
            qq_OrderList_sp.setBackground(null);
            qq_OrderList_sp.getViewport().setBackground(null);
            FrameColor.set(qq_OrderList_sp, Constants.C_INHERIT);
            WidthPolicy.set(qq_OrderList_sp, Constants.SP_NATURAL);
            HeightPolicy.set(qq_OrderList_sp, Constants.SP_NATURAL);
            // OPTIONAL qq_OrderList_sp.setSize(new Dimension(463, 175));
            qq_OrderList_sp.setMinimumSize(new Dimension(463, 175));
            qq_OrderList_sp.setPreferredSize(new Dimension(463, 175));
        }
        return qq_OrderList_sp;
    }


    /**
     * qq_OrderList: transformed from: qqds_ArrayField
     * TagId=29
     * isInherited=FALSE
     */
    public ArrayField getqq_OrderList() {
        if (qq_OrderList == null) {
            qq_OrderList = TableFactory.newArrayField("OrderList", 19);
            this.getBindingManager().bindComponent(qq_OrderList, "orderList", Order.class,
                    new String[] { "customerName",
                                "stockName",
                                "quantity",
                                "price",
                                "type",
                                "selectedForTrade" });
            qq_OrderList.setVisibleRows(8);

            //  === Column model setup ===

            // CustomerName converted from qqds_DataField
            ArrayColumn qq_OrderListArray_CustomerName_Column = new ArrayColumn("CustomerName", 0, new FormattedCellRenderer(getqq_OrderListArray_CustomerName()), new FormattedCellEditor(getqq_OrderListArray_CustomerName()), false);
            qq_OrderListArray_CustomerName_Column.setHeaderValue("CustomerName");
            qq_OrderListArray_CustomerName_Column.setVisible(true);
            qq_OrderList.addColumn(qq_OrderListArray_CustomerName_Column);

            // StockName converted from qqds_DataField
            ArrayColumn qq_OrderListArray_StockName_Column = new ArrayColumn("StockName", 1, new FormattedCellRenderer(getqq_OrderListArray_StockName()), new FormattedCellEditor(getqq_OrderListArray_StockName()), true);
            qq_OrderListArray_StockName_Column.setHeaderValue("StockName");
            qq_OrderListArray_StockName_Column.setVisible(true);
            qq_OrderList.addColumn(qq_OrderListArray_StockName_Column);

            // Quantity converted from qqds_DataField
            ArrayColumn qq_OrderListArray_Quantity_Column = new ArrayColumn("Quantity", 2, new FormattedCellRenderer(getqq_OrderListArray_Quantity()), new FormattedCellEditor(getqq_OrderListArray_Quantity()), true);
            qq_OrderListArray_Quantity_Column.setHeaderValue("Quantity");
            qq_OrderListArray_Quantity_Column.setVisible(true);
            qq_OrderList.addColumn(qq_OrderListArray_Quantity_Column);

            // Price converted from qqds_DataField
            ArrayColumn qq_OrderListArray_Price_Column = new ArrayColumn("Price", 3, new FormattedCellRenderer(getqq_OrderListArray_Price()), new FormattedCellEditor(getqq_OrderListArray_Price()), true);
            qq_OrderListArray_Price_Column.setHeaderValue("Price");
            qq_OrderListArray_Price_Column.setVisible(true);
            qq_OrderList.addColumn(qq_OrderListArray_Price_Column);

            // Type converted from qqds_DataField
            ArrayColumn qq_OrderListArray_Type_Column = new ArrayColumn("Type", 4, new FormattedCellRenderer(getqq_OrderListArray_Type()), new FormattedCellEditor(getqq_OrderListArray_Type()), true);
            qq_OrderListArray_Type_Column.setHeaderValue("Type");
            qq_OrderListArray_Type_Column.setVisible(true);
            qq_OrderList.addColumn(qq_OrderListArray_Type_Column);

            // SelectedForTrade converted from qqds_ToggleField
            ArrayColumn qq_OrderListArray_SelectedForTrade_Column = new ArrayColumn("SelectedForTrade", 5, new CheckBoxCellRenderer(getqq_OrderListArray_SelectedForTrade()), new CheckBoxCellEditor(getqq_OrderListArray_SelectedForTrade()), true);
            qq_OrderListArray_SelectedForTrade_Column.setHeaderValue("Trade");
            qq_OrderListArray_SelectedForTrade_Column.setVisible(true);
            qq_OrderList.addColumn(qq_OrderListArray_SelectedForTrade_Column);

            //  === End column model ===

            TableFactory.postModelArrayField(qq_OrderList);
        }
        return qq_OrderList;
    }


    /**
     * qq_GridField45: transformed from: qqds_GridField
     * TagId=45
     * 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_GridField45Properties() {
        qq_GridField45.setCellTopMargin(50);
        qq_GridField45.setCellBottomMargin(50);
        qq_GridField45.setCellLeftMargin(50);
        qq_GridField45.setCellRightMargin(50);
        qq_GridField45.setCellGravity(Constants.CG_CENTER);
        qq_GridField45.setCollapsed(true);
        qq_GridField45.setHeightPolicy(Constants.SP_NATURAL);
        qq_GridField45.setWidthPolicy(Constants.SP_NATURAL);
        qq_GridField45.setBackground(null);
        qq_GridField45.setMinimumSize(new Dimension(483, 244));
    }

    public GridField getqq_GridField45() {
        if (qq_GridField45 == null) {
            qq_GridField45 = CompoundFieldFactory.newGridField("qq_GridField45", true);
            setqq_GridField45Properties();
            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.WEST; // Gravity - original: CG_MIDDLELEFT
            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_GridField45.add( getqq_GridField46(), 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_GridField45.add( getqq_OrderList_sp(), qq_gbc1 );

        }
        return qq_GridField45;
    }


    /**
     * qq_ViewHoldingsBtn: transformed from: qqds_PushButton
     * TagId=25
     * isInherited=FALSE
     */
    public JButton getqq_ViewHoldingsBtn() {
        if (qq_ViewHoldingsBtn == null) {
            qq_ViewHoldingsBtn = PushButtonFactory.newInstance("ViewHoldingsBtn", "View Holdings");
            qq_ViewHoldingsBtn.setVerifyInputWhenFocusTarget(true);
            WidthPolicy.set(qq_ViewHoldingsBtn, Constants.SP_NATURAL);
            HeightPolicy.set(qq_ViewHoldingsBtn, Constants.SP_NATURAL);
            qq_ViewHoldingsBtn.setMinimumSize(new Dimension(81, 26));
            // FloatOverText
            qq_ViewHoldingsBtn.setToolTipText("Show Holdings");
            // StatusText
            StatusText.set(qq_ViewHoldingsBtn, "Click to show the Trader's holdings");
        }
        return qq_ViewHoldingsBtn;
    }


    /**
     * qq_MakeTradeBtn: transformed from: qqds_PushButton
     * TagId=26
     * isInherited=FALSE
     */
    public JButton getqq_MakeTradeBtn() {
        if (qq_MakeTradeBtn == null) {
            qq_MakeTradeBtn = PushButtonFactory.newInstance("MakeTradeBtn", "Make Trade");
            qq_MakeTradeBtn.setVerifyInputWhenFocusTarget(true);
            WidthPolicy.set(qq_MakeTradeBtn, Constants.SP_NATURAL);
            HeightPolicy.set(qq_MakeTradeBtn, Constants.SP_NATURAL);
            qq_MakeTradeBtn.setMinimumSize(new Dimension(72, 26));
            // FloatOverText
            qq_MakeTradeBtn.setToolTipText("Trade 2 active orders");
            // StatusText
            StatusText.set(qq_MakeTradeBtn, "Click to trade two selected orders");
        }
        return qq_MakeTradeBtn;
    }


    /**
     * qq_ExitBtn: transformed from: qqds_PushButton
     * TagId=27
     * isInherited=FALSE
     */
    public JButton getqq_ExitBtn() {
        if (qq_ExitBtn == null) {
            qq_ExitBtn = PushButtonFactory.newInstance("ExitBtn", "Exit");
            qq_ExitBtn.setVerifyInputWhenFocusTarget(true);
            WidthPolicy.set(qq_ExitBtn, Constants.SP_NATURAL);
            HeightPolicy.set(qq_ExitBtn, Constants.SP_NATURAL);
            qq_ExitBtn.setMinimumSize(new Dimension(31, 26));
        }
        return qq_ExitBtn;
    }


    /**
     * qq_GridField48: transformed from: qqds_GridField
     * TagId=48
     * isInherited=FALSE
     * In forte this was a 3x1 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_GridField48Properties() {
        qq_GridField48.setCellTopMargin(50);
        qq_GridField48.setCellBottomMargin(50);
        qq_GridField48.setCellLeftMargin(50);
        qq_GridField48.setCellRightMargin(50);
        qq_GridField48.setCellGravity(Constants.CG_CENTER);
        qq_GridField48.setCollapsed(true);
        qq_GridField48.setHeightPolicy(Constants.SP_NATURAL);
        qq_GridField48.setWidthPolicy(Constants.SP_NATURAL);
        qq_GridField48.setBackground(null);
        qq_GridField48.setMinimumSize(new Dimension(226, 45));
    }

    public GridField getqq_GridField48() {
        if (qq_GridField48 == null) {
            qq_GridField48 = CompoundFieldFactory.newGridField("qq_GridField48", true);
            setqq_GridField48Properties();
            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_GridField48.add( getqq_ViewHoldingsBtn(), 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, 4, 4, 4); // Top, Left, Bottom, Right Margin
            qq_GridField48.add( getqq_MakeTradeBtn(), qq_gbc1 );

            GridBagConstraints qq_gbc2 = new GridBagConstraints();
            qq_gbc2.gridx = 2; // Column 3
            qq_gbc2.gridy = 0; // Row 1
            qq_gbc2.weightx = 0;
            qq_gbc2.weighty = 0;
            qq_gbc2.anchor = GridBagConstraints.CENTER; // Gravity - original: CG_CENTER gf
            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_GridField48.add( getqq_ExitBtn(), qq_gbc2 );

        }
        return qq_GridField48;
    }


    /**
     * qq_GridField44: transformed from: qqds_GridField
     * TagId=44
     * 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_GridField44Properties() {
        qq_GridField44.setCellTopMargin(50);
        qq_GridField44.setCellBottomMargin(50);
        qq_GridField44.setCellLeftMargin(50);
        qq_GridField44.setCellRightMargin(50);
        qq_GridField44.setCellGravity(Constants.CG_CENTER);
        qq_GridField44.setCollapsed(true);
        qq_GridField44.setHeightPolicy(Constants.SP_NATURAL);
        qq_GridField44.setWidthPolicy(Constants.SP_NATURAL);
        qq_GridField44.setBackground(null);
        qq_GridField44.setMinimumSize(new Dimension(504, 321));
        qq_GridField44.setLocation(4, 2);
    }

    public GridField getqq_GridField44() {
        if (qq_GridField44 == null) {
            qq_GridField44 = CompoundFieldFactory.newGridField("qq_GridField44", true);
            setqq_GridField44Properties();
            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_GridField44.add( getqq_GridField45(), 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_GridField44.add( getqq_GridField48(), qq_gbc1 );

        }
        return qq_GridField44;
    }


    /**
     * 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_GridField44() );
            Form.add( getqq_StatusLine() );
        }
        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);
        }
    }


    /**
     * qq_OrderListArray_CustomerName: transformed from: qqds_DataField
     * TagId=30
     * isInherited=FALSE
     */
    public DataField getqq_OrderListArray_CustomerName() {
        if (qq_OrderListArray_CustomerName == null) {
            // Mask type: MK_NONE
            qq_OrderListArray_CustomerName = DataFieldFactory.newDataField("CustomerName", 14, TextData.class, Constants.MK_NONE);
            qq_OrderListArray_CustomerName.setValue("");
            qq_OrderListArray_CustomerName.setHorizontalAlignment(JTextField.LEFT);
            WidthPolicy.set(qq_OrderListArray_CustomerName, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_OrderListArray_CustomerName, Constants.SP_NATURAL);
            qq_OrderListArray_CustomerName.setMinimumSize(new Dimension(95, 19));
            qq_OrderListArray_CustomerName.setSize(new Dimension(95, 19));
            qq_OrderListArray_CustomerName.setLocation(36, 74);
            ArrayFieldCellHelper.setUpCellEditor(qq_OrderListArray_CustomerName, qq_OrderList, 0, false);
        }
        return qq_OrderListArray_CustomerName;
    }


    /**
     * qq_OrderListArray_StockName: transformed from: qqds_DataField
     * TagId=32
     * isInherited=FALSE
     */
    public DataField getqq_OrderListArray_StockName() {
        if (qq_OrderListArray_StockName == null) {
            // Mask type: MK_NONE
            qq_OrderListArray_StockName = DataFieldFactory.newDataField("StockName", 16, Constants.MK_NONE);
            qq_OrderListArray_StockName.setHorizontalAlignment(JTextField.LEFT);
            WidthPolicy.set(qq_OrderListArray_StockName, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_OrderListArray_StockName, Constants.SP_NATURAL);
            qq_OrderListArray_StockName.setMinimumSize(new Dimension(108, 19));
            qq_OrderListArray_StockName.setSize(new Dimension(108, 19));
            qq_OrderListArray_StockName.setLocation(139, 74);
            ArrayFieldCellHelper.setUpCellEditor(qq_OrderListArray_StockName, qq_OrderList, 1, false);
        }
        return qq_OrderListArray_StockName;
    }


    /**
     * qq_OrderListArray_Quantity: transformed from: qqds_DataField
     * TagId=34
     * isInherited=FALSE
     */
    public DataField getqq_OrderListArray_Quantity() {
        if (qq_OrderListArray_Quantity == null) {
            // Mask type: MK_NONE
            qq_OrderListArray_Quantity = DataFieldFactory.newDataField("Quantity", 13, Constants.MK_NONE);
            qq_OrderListArray_Quantity.setValue(Integer.valueOf(0));
            qq_OrderListArray_Quantity.setHorizontalAlignment(JTextField.RIGHT);
            WidthPolicy.set(qq_OrderListArray_Quantity, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_OrderListArray_Quantity, Constants.SP_NATURAL);
            qq_OrderListArray_Quantity.setMinimumSize(new Dimension(88, 19));
            qq_OrderListArray_Quantity.setSize(new Dimension(88, 19));
            qq_OrderListArray_Quantity.setLocation(256, 74);
            ArrayFieldCellHelper.setUpCellEditor(qq_OrderListArray_Quantity, qq_OrderList, 2, false);
        }
        return qq_OrderListArray_Quantity;
    }


    /**
     * qq_OrderListArray_Price: transformed from: qqds_DataField
     * TagId=36
     * isInherited=FALSE
     */
    public DataField getqq_OrderListArray_Price() {
        if (qq_OrderListArray_Price == null) {
            // Mask type: MK_TEMPLATE
            // original Forte format string -->$#,##0<--
            this.qq_OrderListArray_Price = DataFieldFactory.newDataField("Price", 9, "$#,##0", Float.TYPE);
            qq_OrderListArray_Price.setOriginalFormatText("$#,##0");
            qq_OrderListArray_Price.setHorizontalAlignment(JTextField.RIGHT);
            WidthPolicy.set(qq_OrderListArray_Price, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_OrderListArray_Price, Constants.SP_NATURAL);
            qq_OrderListArray_Price.setMinimumSize(new Dimension(64, 19));
            qq_OrderListArray_Price.setSize(new Dimension(64, 19));
            qq_OrderListArray_Price.setLocation(355, 69);
            ArrayFieldCellHelper.setUpCellEditor(qq_OrderListArray_Price, qq_OrderList, 3, false);
        }
        return qq_OrderListArray_Price;
    }


    /**
     * qq_OrderListArray_Type: transformed from: qqds_DataField
     * TagId=38
     * isInherited=FALSE
     */
    public DataField getqq_OrderListArray_Type() {
        if (qq_OrderListArray_Type == null) {
            // Mask type: MK_NONE
            qq_OrderListArray_Type = DataFieldFactory.newDataField("Type", 7, Constants.MK_NONE);
            qq_OrderListArray_Type.setHorizontalAlignment(JTextField.LEFT);
            WidthPolicy.set(qq_OrderListArray_Type, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_OrderListArray_Type, Constants.SP_NATURAL);
            qq_OrderListArray_Type.setMinimumSize(new Dimension(55, 19));
            qq_OrderListArray_Type.setSize(new Dimension(55, 19));
            qq_OrderListArray_Type.setLocation(423, 72);
            ArrayFieldCellHelper.setUpCellEditor(qq_OrderListArray_Type, qq_OrderList, 4, false);
        }
        return qq_OrderListArray_Type;
    }


    /**
     * qq_OrderListArray_SelectedForTrade: transformed from: qqds_ToggleField
     * TagId=40
     * isInherited=FALSE
     */
    public JCheckBox getqq_OrderListArray_SelectedForTrade() {
        if (qq_OrderListArray_SelectedForTrade == null) {
            qq_OrderListArray_SelectedForTrade = ToggleFieldFactory.newToggleField("", "SelectedForTrade");
            // OPTIONAL UIutils.reloadLabelText(qq_OrderListArray_SelectedForTrade, mcat);
            ArrayFieldCellHelper.setUpCellEditor(qq_OrderListArray_SelectedForTrade, qq_OrderList, 5, false);
            qq_OrderListArray_SelectedForTrade.setLocation(499, 74);
        }
        return qq_OrderListArray_SelectedForTrade;
    }



    /**
     * Initialise the window and all its children.
     */
    protected void initialize() {
        if (this.Form == null) {
            this.setName( "TraderWindow" );
            this.setTitle( "Trader Window" );
            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_StatusLine(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_GridField44(), Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_GridField45(), Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_GridField46(), Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_TraderNameLbl(), Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
        this.qq_usage.add(getqq_TraderName(), Constants.FS_VIEWONLY, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_OrderList(), Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_OrderListArray_CustomerName(), Constants.FS_DRAG, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_OrderListArray_StockName(), Constants.FS_VIEWONLY, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_OrderListArray_Quantity(), Constants.FS_VIEWONLY, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_OrderListArray_Price(), Constants.FS_VIEWONLY, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_OrderListArray_Type(), Constants.FS_VIEWONLY, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_OrderListArray_SelectedForTrade(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_GridField48(), Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_ViewHoldingsBtn(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
        this.qq_usage.add(getqq_MakeTradeBtn(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
        this.qq_usage.add(getqq_ExitBtn(), 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);
        TraderWindow myClass = new TraderWindow();
        myClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        myClass.setVisible(true);
        UIutils.processGUIActions();
    }
// end class TraderWindow
// c Pass 2 Conversion Time: 812 milliseconds
TOP

Related Classes of StockTradeWindows.TraderWindow$AsyncRunner

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.