Package StockTradeWindows

Source Code of StockTradeWindows.LogonWindow

package StockTradeWindows;

import DisplayProject.CloseHideAdaptor;
import DisplayProject.Constants;
import DisplayProject.CursorMgr;
import DisplayProject.DataField;
import DisplayProject.PasswordDataField;
import DisplayProject.UDSWindow;
import DisplayProject.UIutils;
import DisplayProject.WindowManager;
import DisplayProject.WindowUsageMap;
import DisplayProject.actions.AppletConnectionInfo;
import DisplayProject.actions.CommandType;
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.PictureGraphic;
import DisplayProject.controls.TextGraphic;
import DisplayProject.events.ClientEventManager;
import DisplayProject.factory.CompoundFieldFactory;
import DisplayProject.factory.DataFieldFactory;
import DisplayProject.factory.GraphicFactory;
import DisplayProject.factory.MenuFactory;
import DisplayProject.factory.PushButtonFactory;
import Framework.ErrorMgr;
import Framework.EventHandle;
import Framework.EventManager;
import Framework.EventRegistration;
import Framework.File;
import Framework.FrameworkUtils;
import Framework.ImageData;
import Framework.Partition;
import Framework.RuntimeProperties;
import Framework.TextData;
import Framework.UsageException;
import StockTradeWindows.CustomerWindow;
import StockTradeWindows.TraderWindow;
import java.awt.Dimension;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ComponentListener;
import java.awt.event.KeyEvent;
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.lang.System;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.WindowConstants;
import org.fest.swing.fixture.FrameFixture;
import org.fest.swing.fixture.JTextComponentFixture;

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

    // ----------
    // Attributes
    // ----------
    protected File defaultHelpFile;
    protected BindingManager bindingManager = null;
    public PropertyChangeSupport qq_Listeners = null;
    private TextData loginName;
    private String password;

    // ------------
    // Constructors
    // ------------
    public LogonWindow() {
        // Explicitly call the superclass constructor to prevent the implicit call
        super();
        this.initialize();
        this.setLoginName(new TextData());
        this.getLoginName().setValue( "Natasha" );

    }

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

    /**
     * Getter for the attribute LoginName
    */
    public TextData getLoginName() {
        return this.loginName;
    }

    public void setPassword(String password) {
        String oldValue = this.password;
        this.password = password;
        this.firePropertyChange("password", oldValue, this.password);
    }

    /**
     * Getter for the attribute Password
    */
    public String getPassword() {
        return this.password;
    }

    // -------
    // 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>
     */
    public void display() {
        UserWindow.open(this);
        // ----------
        // Event Loop
        // ----------
        EventManager.startEventLoop();
        try {
            EventRegistration TaskHandle_Shutdown_langThreadcurrentThread = ClientEventManager.register( Thread.currentThread(), "Shutdown" );
            EventRegistration PushButton_Click_getqq_AsCustomerBtn = ClientEventManager.register( this.getqq_AsCustomerBtn(), "Click" );
            EventRegistration PushButton_Click_getqq_AsTraderBtn = ClientEventManager.register( this.getqq_AsTraderBtn(), "Click" );
            EventRegistration MenuCommand_Activate_getqq_AsCustomerMC = ClientEventManager.register( this.getqq_AsCustomerMC(), "Activate" );
            EventRegistration MenuCommand_Activate_getqq_AsTraderMC = ClientEventManager.register( this.getqq_AsTraderMC(), "Activate" );
            EventRegistration MenuCommand_Activate_getqq_fileExit = ClientEventManager.register( this.getqq_fileExit(), "Activate" );

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

                // ---------------------
                // <AsCustomerBtn>.Click
                // ---------------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_AsCustomerBtn)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        CustomerWindow customerWin = new CustomerWindow();
                        new CustomerWindow.AsyncRunner().display(customerWin, this.getLoginName());

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

                // -------------------
                // <AsTraderBtn>.Click
                // -------------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_AsTraderBtn)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        TraderWindow traderWin = new TraderWindow();
                        new TraderWindow.AsyncRunner().display(traderWin, this.getLoginName());

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

                // -----------------------
                // <AsCustomerMC>.Activate
                // -----------------------
                else if (qq_currentEvent.isEvent(MenuCommand_Activate_getqq_AsCustomerMC)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        CustomerWindow customerWin = new CustomerWindow();
                        new CustomerWindow.AsyncRunner().display(customerWin, this.getLoginName());

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

                // ---------------------
                // <AsTraderMC>.Activate
                // ---------------------
                else if (qq_currentEvent.isEvent(MenuCommand_Activate_getqq_AsTraderMC)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        TraderWindow traderWin = new TraderWindow();
                        new TraderWindow.AsyncRunner().display(traderWin, this.getLoginName());

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

                // -------------------
                // <fileExit>.Activate
                // -------------------
                else if (qq_currentEvent.isEvent(MenuCommand_Activate_getqq_fileExit)) {
                    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_AsCustomerBtn );
            EventManager.deregister( PushButton_Click_getqq_AsTraderBtn );
            EventManager.deregister( MenuCommand_Activate_getqq_AsCustomerMC );
            EventManager.deregister( MenuCommand_Activate_getqq_AsTraderMC );
            EventManager.deregister( MenuCommand_Activate_getqq_fileExit );
        }
        //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_LoginName;
    public JButton qq_AsCustomerBtn;
    public JButton qq_AsTraderBtn;
    public JMenu qq_LogonMenu;
    public JMenu qq_file;
    public JMenuBar qq_MainMenuBar;
    public JMenuItem qq_AsCustomerMC;
    public JMenuItem qq_AsTraderMC;
    public JMenuItem qq_fileExit;
    public JPanel Form;
    public PasswordDataField qq_Password;
    public PictureGraphic qq_PictureGraphic29;
    public TextGraphic qq_LoginNameLbl;
    public TextGraphic qq_PasswordLbl;

    /**
     * qq_fileExit: transformed from: qqds_MenuCommand
     */
    public JMenuItem getqq_fileExit() {
        if (qq_fileExit == null) {
            qq_fileExit = MenuFactory.newMenuItem("fileExit", true);
            qq_fileExit.setVerifyInputWhenFocusTarget(true);
            qq_fileExit.setMnemonic( 'x' );
            qq_fileExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK));
            CommandType.set(qq_fileExit, Constants.CT_EXIT);
            qq_fileExit.setText( "Exit" );
            qq_fileExit.setVisible(true);
        }
        return qq_fileExit;
    }


    /**
     * qq_file: transformed from: qqds_Submenu
     */
    public JMenu getqq_file() {
        if (qq_file == null) {
            qq_file = new JMenu();
            qq_file.setName("file");
            qq_file.setMnemonic( 'f' );
            qq_file.setText( "File" );
            qq_file.setVisible(true);
            qq_file.add(getqq_fileExit());
        }
        return qq_file;
    }


    /**
     * qq_AsCustomerMC: transformed from: qqds_MenuCommand
     */
    public JMenuItem getqq_AsCustomerMC() {
        if (qq_AsCustomerMC == null) {
            qq_AsCustomerMC = MenuFactory.newMenuItem("AsCustomerMC", true);
            qq_AsCustomerMC.setVerifyInputWhenFocusTarget(true);
            CommandType.set(qq_AsCustomerMC, Constants.CT_CUSTOM);
            qq_AsCustomerMC.setText( "As Customer" );
            qq_AsCustomerMC.setVisible(true);
        }
        return qq_AsCustomerMC;
    }


    /**
     * qq_AsTraderMC: transformed from: qqds_MenuCommand
     */
    public JMenuItem getqq_AsTraderMC() {
        if (qq_AsTraderMC == null) {
            qq_AsTraderMC = MenuFactory.newMenuItem("AsTraderMC", true);
            qq_AsTraderMC.setVerifyInputWhenFocusTarget(true);
            CommandType.set(qq_AsTraderMC, Constants.CT_CUSTOM);
            qq_AsTraderMC.setText( "As Trader" );
            qq_AsTraderMC.setVisible(true);
        }
        return qq_AsTraderMC;
    }


    /**
     * qq_LogonMenu: transformed from: qqds_Submenu
     */
    public JMenu getqq_LogonMenu() {
        if (qq_LogonMenu == null) {
            qq_LogonMenu = new JMenu();
            qq_LogonMenu.setName("LogonMenu");
            qq_LogonMenu.setText( "Logon" );
            qq_LogonMenu.setVisible(true);
            qq_LogonMenu.add(getqq_AsCustomerMC());
            qq_LogonMenu.add(getqq_AsTraderMC());
        }
        return qq_LogonMenu;
    }


    /**
     * qq_MainMenuBar: transformed from: qqds_MenuBar
     */
    public JMenuBar getqq_MenuBar() {
        if (qq_MainMenuBar == null) {
            qq_MainMenuBar = MenuFactory.newMenuBar();
            qq_MainMenuBar.setName("MainMenuBar");
            qq_MainMenuBar.setBorderPainted(false);
            this.qq_MainMenuBar.add(getqq_file());
            this.qq_MainMenuBar.add(getqq_LogonMenu());
        }
        return qq_MainMenuBar;
    }


    /**
     * qq_PictureGraphic29: transformed from: qqds_PictureGraphic
     * TagId=29
     * isInherited=FALSE
     */
    public PictureGraphic getqq_PictureGraphic29() {
        if (qq_PictureGraphic29 == null) {
            qq_PictureGraphic29 = GraphicFactory.newPictureGraphic("", Constants.CG_CENTER);
            qq_PictureGraphic29.setImageValue(new ImageData(new ImageIcon(LogonWindow.class.getResource("LogonWindow.qq_PictureGraphic29.png"))));
            qq_PictureGraphic29.setWidthPolicy(Constants.SP_NATURAL);
            qq_PictureGraphic29.setHeightPolicy(Constants.SP_NATURAL);
            qq_PictureGraphic29.setImageSizePolicy(Constants.IS_NATURAL);
            qq_PictureGraphic29.setOpaque( true );
            qq_PictureGraphic29.setSize(new Dimension(379, 261));
            qq_PictureGraphic29.setMinimumSize(new Dimension(379, 261));
            qq_PictureGraphic29.setPreferredSize(new Dimension(379, 261));
            qq_PictureGraphic29.setLocation(9, 7);
        }
        return qq_PictureGraphic29;
    }


    /**
     * qq_LoginNameLbl: transformed from: qqds_TextGraphic
     * TagId=30
     * isInherited=FALSE
     */
    public TextGraphic getqq_LoginNameLbl() {
        if (qq_LoginNameLbl == null) {
            qq_LoginNameLbl = GraphicFactory.newTextGraphic("Login Name:\n", "");
            qq_LoginNameLbl.setOpaque( true );
            // OPTIONAL UIutils.reloadLabelText(qq_LoginNameLbl, mcat);
            WidthPolicy.set(qq_LoginNameLbl, Constants.SP_NATURAL);
            HeightPolicy.set(qq_LoginNameLbl, Constants.SP_NATURAL);
            qq_LoginNameLbl.setMinimumSize(new Dimension(65, 14));
            qq_LoginNameLbl.setLocation(60, 55);
        }
        return qq_LoginNameLbl;
    }


    /**
     * qq_PasswordLbl: transformed from: qqds_TextGraphic
     * TagId=31
     * isInherited=FALSE
     */
    public TextGraphic getqq_PasswordLbl() {
        if (qq_PasswordLbl == null) {
            qq_PasswordLbl = GraphicFactory.newTextGraphic("Password:\n", "");
            qq_PasswordLbl.setOpaque( true );
            // OPTIONAL UIutils.reloadLabelText(qq_PasswordLbl, mcat);
            WidthPolicy.set(qq_PasswordLbl, Constants.SP_NATURAL);
            HeightPolicy.set(qq_PasswordLbl, Constants.SP_NATURAL);
            qq_PasswordLbl.setMinimumSize(new Dimension(55, 14));
            qq_PasswordLbl.setLocation(72, 98);
        }
        return qq_PasswordLbl;
    }


    /**
     * qq_LoginName: transformed from: qqds_DataField
     * TagId=15
     * isInherited=FALSE
     */
    public DataField getqq_LoginName() {
        if (qq_LoginName == null) {
            // Mask type: MK_NONE
            qq_LoginName = DataFieldFactory.newDataField("LoginName", 19, TextData.class, Constants.MK_NONE);
            qq_LoginName.setValue("");
            qq_LoginName.setHorizontalAlignment(JTextField.LEFT);
            getBindingManager().bindComponent(qq_LoginName, "loginName");
            WidthPolicy.set(qq_LoginName, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_LoginName, Constants.SP_NATURAL);
            qq_LoginName.setMinimumSize(new Dimension(124, 19));
            qq_LoginName.setSize(new Dimension(124, 19));
            qq_LoginName.setLocation(154, 52);
        }
        return qq_LoginName;
    }


    /**
     * qq_Password: transformed from: qqds_DataField
     * TagId=16
     * isInherited=FALSE
     */
    public PasswordDataField getqq_Password() {
        if (qq_Password == null) {
            qq_Password = DataFieldFactory.newPasswordField("Password", 18);
            qq_Password.setValue("");
            qq_Password.setOpaque( true );
            qq_Password.setHorizontalAlignment(JTextField.LEFT);
            getBindingManager().bindComponent(qq_Password, "password");
            WidthPolicy.set(qq_Password, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_Password, Constants.SP_NATURAL);
            qq_Password.setMinimumSize(new Dimension(122, 19));
            qq_Password.setSize(new Dimension(122, 19));
            qq_Password.setLocation(160, 98);
        }
        return qq_Password;
    }


    /**
     * qq_AsCustomerBtn: transformed from: qqds_PushButton
     * TagId=17
     * isInherited=FALSE
     */
    public JButton getqq_AsCustomerBtn() {
        if (qq_AsCustomerBtn == null) {
            qq_AsCustomerBtn = PushButtonFactory.newInstance("AsCustomerBtn", "As Customer");
            qq_AsCustomerBtn.setVerifyInputWhenFocusTarget(true);
            WidthPolicy.set(qq_AsCustomerBtn, Constants.SP_NATURAL);
            HeightPolicy.set(qq_AsCustomerBtn, Constants.SP_NATURAL);
            qq_AsCustomerBtn.setMinimumSize(new Dimension(74, 26));
            qq_AsCustomerBtn.setLocation(101, 182);
        }
        return qq_AsCustomerBtn;
    }


    /**
     * qq_AsTraderBtn: transformed from: qqds_PushButton
     * TagId=18
     * isInherited=FALSE
     */
    public JButton getqq_AsTraderBtn() {
        if (qq_AsTraderBtn == null) {
            qq_AsTraderBtn = PushButtonFactory.newInstance("AsTraderBtn", "As Trader");
            qq_AsTraderBtn.setVerifyInputWhenFocusTarget(true);
            WidthPolicy.set(qq_AsTraderBtn, Constants.SP_NATURAL);
            HeightPolicy.set(qq_AsTraderBtn, Constants.SP_NATURAL);
            qq_AsTraderBtn.setMinimumSize(new Dimension(60, 26));
            qq_AsTraderBtn.setLocation(192, 180);
        }
        return qq_AsTraderBtn;
    }


    /**
     * Form: transformed from: qqds_Panel
     * TagId=1
     * isInherited=FALSE
     */
    protected void setFormProperties() {
        Form.setOpaque( true );
    }

    public JPanel getForm() {
        if (Form == null) {
            Form = CompoundFieldFactory.newForm();
            this.setFormProperties();
            Form.add( getqq_AsTraderBtn() );
            Form.add( getqq_AsCustomerBtn() );
            Form.add( getqq_Password() );
            Form.add( getqq_LoginName() );
            Form.add( getqq_PasswordLbl() );
            Form.add( getqq_LoginNameLbl() );
            Form.add( getqq_PictureGraphic29() );
        }
        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( "LogonWindow" );
            this.setTitle( "Logon Window" );
            this.setSetNum(1);
            this.setTitleMsgNum(0);
            this.setTitleSetNum(0);
            this.setSystemClosePolicy(Constants.SC_DISABLED);
            this.setJMenuBar( getqq_MenuBar() );
            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_fileExit(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.qq_usage.add(getqq_file(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.qq_usage.add(getqq_AsCustomerMC(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.qq_usage.add(getqq_AsTraderMC(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.qq_usage.add(getqq_LogonMenu(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.qq_usage.add(getqq_PictureGraphic29(), Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
        this.qq_usage.add(getqq_LoginNameLbl(), Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
        this.qq_usage.add(getqq_PasswordLbl(), Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
        this.qq_usage.add(getqq_LoginName(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_Password(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.qq_usage.add(getqq_AsCustomerBtn(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
        this.qq_usage.add(getqq_AsTraderBtn(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
    }
    // </editor-fold>

    // -----------
    // Main method
    // -----------
        /**
         * The launch method contains the start class method as descibed in Forte. It is separated
         * out from the main method in order to be re-used by unit tests, for example.
        */
        public static void launch() {
            new LogonWindow().display();
        }
        public static void main( String[] args ) {
            FrameworkUtils.setCmdLineArgs(args);
            AppletConnectionInfo client = null;
            try {
                client = UIutils.initialiseGuiSystem();
                launch();
            } catch (Throwable e) {
                ErrorMgr.showErrors(null, "Unhandled exception", e);
            } finally {
                UserWindow.postAPPLETStopped(client);
                System.exit(Partition.getExitStatus());
            }
        }
// end class LogonWindow
// c Pass 2 Conversion Time: 1328 milliseconds
TOP

Related Classes of StockTradeWindows.LogonWindow

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.