Package SUN_78

Source Code of SUN_78.MainForm

package SUN_78;

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.AppletConnectionInfo;
import DisplayProject.actions.Column;
import DisplayProject.actions.HeightPolicy;
import DisplayProject.actions.Parent;
import DisplayProject.actions.Row;
import DisplayProject.actions.UserWindow;
import DisplayProject.actions.WidthPolicy;
import DisplayProject.actions.WindowFrameWeight;
import DisplayProject.binding.BindingManager;
import DisplayProject.binding.beans.ExtendedPropertyChangeSupport;
import DisplayProject.binding.beans.Observable;
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.plaf.Win32LookAndFeel;
import Framework.ErrorMgr;
import Framework.EventHandle;
import Framework.EventManager;
import Framework.EventRegistration;
import Framework.File;
import Framework.ForteKeyboardFocusManager;
import Framework.FrameworkUtils;
import Framework.ParameterHolder;
import Framework.RuntimeProperties;
import Framework.TextData;
import Framework.UsageException;
import SUN_78.Family;
import SUN_78.NestedForm;
import SUN_78.Pets;
import SUN_78.Popup;
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.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.lang.String;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.UIManager;

/**
* MainForm<p>
* <p>
* @author Generated from Forte
* @since  19-Nov-2008
*/
@RuntimeProperties(isDistributed=false, isAnchored=false, isShared=false, isTransactional=false)
@UDSWindow()
@SuppressWarnings("serial")
public class MainForm
        extends JFrame
        implements Serializable, Observable
{

    // ----------
    // Attributes
    // ----------
    protected File DefaultHelpFile;
    protected BindingManager bindingManager = null;
    public PropertyChangeSupport qq_Listeners = new ExtendedPropertyChangeSupport(this, true);
    private NestedForm aNested;
    private Family myFamily;

    // ------------
    // Constructors
    // ------------
    public MainForm() {
        // Explicitly call the superclass constructor to prevent the implicit call
        super();
        this.initialize();

    }

    // ----------------------
    // Accessors and Mutators
    // ----------------------
    public File getDefaultHelpFile() {
        return DefaultHelpFile;
    }

    public void setDefaultHelpFile(File defaultHelpFile) {
        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 setANested(NestedForm aNested) {
        NestedForm oldValue = this.aNested;
        this.aNested = aNested;
        this.qq_Listeners.firePropertyChange("ANested", oldValue, this.aNested);
    }

    public NestedForm getANested() {
        return this.aNested;
    }

    public void setMyFamily(Family myFamily) {
        Family oldValue = this.myFamily;
        this.myFamily = myFamily;
        this.qq_Listeners.firePropertyChange("myFamily", oldValue, this.myFamily);
    }

    public Family getMyFamily() {
        return this.myFamily;
    }

    // -------
    // Methods
    // -------
    public void addPropertyChangeListener(String property, PropertyChangeListener listener) {
        qq_Listeners.addPropertyChangeListener(property, listener);
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        qq_Listeners.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(String property, PropertyChangeListener listener) {
        qq_Listeners.removePropertyChangeListener(property, listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        qq_Listeners.removePropertyChangeListener(listener);
    }

    /**
     * display<p>
     * <p>
     */
    public void display() {
        this.setMyFamily(new Family());
        //nest : NestedForm = new;
        //Nest.window.row = 1;
        //Nest.window.column = 2;
        //Nest.window.parent = <outergrid>;
        //Nest.mypets = new;
        this.setANested(new NestedForm());
        Row.set(this.getANested(), 1);
        Column.set(this.getANested(), 2);
        WindowFrameWeight.set(this.getANested(), Constants.W_NONE);
        Parent.set(this.getANested(), this.getqq_outergrid());
        this.getANested().setMypets(new Pets());

        UserWindow.open(this);
        // ----------
        // Event Loop
        // ----------
        EventManager.startEventLoop();
        try {
            EventRegistration DataField_AfterFocusGain_getqq_myFamily_son = ClientEventManager.register( this.getqq_myFamily_son(), "AfterFocusGain" );
            EventRegistration DataField_Click_getqq_myFamily_son = ClientEventManager.register( this.getqq_myFamily_son(), "Click" );
            EventRegistration DataField_AfterFocusGain_getqq_myFamily_daughter = ClientEventManager.register( this.getqq_myFamily_daughter(), "AfterFocusGain" );
            EventRegistration DataField_Click_getqq_myFamily_daughter = ClientEventManager.register( this.getqq_myFamily_daughter(), "Click" );
            EventRegistration TaskHandle_Shutdown_langThreadcurrentThread = ClientEventManager.register( Thread.currentThread(), "Shutdown" );
            EventRegistration PushButton_Click_getqq_doSomething = ClientEventManager.register( this.getqq_doSomething(), "Click" );

            while (true) {

                UIutils.processGUIActions();
                EventHandle qq_currentEvent = EventManager.waitForEvent();
                if (qq_currentEvent == null)
                    break;

                // -----------------------------
                // <myFamily.son>.AfterFocusGain
                // -----------------------------
                if (qq_currentEvent.isEvent(DataField_AfterFocusGain_getqq_myFamily_son)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        int reason = ((ParameterHolder)qq_currentEvent.getParameter("reason")).getInt();
                        if (reason != Constants.FC_MOUSECLICK) {
                            new Popup().display();
                        }
                        UIutils.processGUIActions();
                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // --------------------
                // <myFamily.son>.click
                // --------------------
                else if (qq_currentEvent.isEvent(DataField_Click_getqq_myFamily_son)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        new Popup().display();
                        UIutils.processGUIActions();
                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // ----------------------------------
                // <myFamily.daughter>.AfterFocusGain
                // ----------------------------------
                else if (qq_currentEvent.isEvent(DataField_AfterFocusGain_getqq_myFamily_daughter)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        int reason = ((ParameterHolder)qq_currentEvent.getParameter("reason")).getInt();
                        if (reason != Constants.FC_MOUSECLICK) {
                            new Popup().display();
                        }
                        UIutils.processGUIActions();
                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // -------------------------
                // <myFamily.daughter>.click
                // -------------------------
                else if (qq_currentEvent.isEvent(DataField_Click_getqq_myFamily_daughter)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        new Popup().display();
                        UIutils.processGUIActions();
                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // -------------
                // task.Shutdown
                // -------------
                else if (qq_currentEvent.isEvent(TaskHandle_Shutdown_langThreadcurrentThread)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        break;
                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }

                // -------------------
                // <doSomething>.click
                // -------------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_doSomething)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        new Popup().display();
                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }
            }
            EventManager.deregister( DataField_AfterFocusGain_getqq_myFamily_son );
            EventManager.deregister( DataField_Click_getqq_myFamily_son );
            EventManager.deregister( DataField_AfterFocusGain_getqq_myFamily_daughter );
            EventManager.deregister( DataField_Click_getqq_myFamily_daughter );
            EventManager.deregister( TaskHandle_Shutdown_langThreadcurrentThread );
            EventManager.deregister( PushButton_Click_getqq_doSomething );
        }
        //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 = 1;
    private int qq_msgNumber = 0;
    private int qq_msgSet = 0;
    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_myFamily_daughter;
    public DataField qq_myFamily_son;
    public GridField qq_myFamily;
    public GridField qq_outergrid;
    public JButton qq_doSomething;
    public JPanel Form;
    public TextGraphic qq_DaughterLbl;
    public TextGraphic qq_SonLbl;

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

    public void setqq_SonLbl(TextGraphic value) {
        TextGraphic oldValue = qq_SonLbl;
        qq_SonLbl = value;
        this.qq_Listeners.firePropertyChange("qq_SonLbl", oldValue, value);
    }

    /**
     * qq_myFamily_son: transformed from: qqds_DataField
     * TagId=15
     * isInherited=FALSE
     */
    public DataField getqq_myFamily_son() {
        if (qq_myFamily_son == null) {
            // Mask type: MK_NONE
            qq_myFamily_son = DataFieldFactory.newDataField("son", 14, TextData.class, Constants.MK_NONE);
            qq_myFamily_son.setOriginalFormatText(null);
            qq_myFamily_son.setHorizontalAlignment(JTextField.LEFT);
            getBindingManager().bindComponent(qq_myFamily_son, "myFamily.son");
            WidthPolicy.set(qq_myFamily_son, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_myFamily_son, Constants.SP_NATURAL);
            qq_myFamily_son.setMinimumSize(new Dimension(98, 19));
            qq_myFamily_son.setSize(new Dimension(98, 19));
        }
        return qq_myFamily_son;
    }

    public void setqq_myFamily_son(DataField value) {
        DataField oldValue = qq_myFamily_son;
        qq_myFamily_son = value;
        this.qq_Listeners.firePropertyChange("qq_myFamily_son", oldValue, value);
    }

    /**
     * qq_DaughterLbl: transformed from: qqds_TextGraphic
     * TagId=16
     * isInherited=FALSE
     */
    public TextGraphic getqq_DaughterLbl() {
        if (qq_DaughterLbl == null) {
            qq_DaughterLbl = GraphicFactory.newTextGraphic("Daughter\n", "");
            // OPTIONAL UIutils.reloadLabelText(qq_DaughterLbl, mcat);
            WidthPolicy.set(qq_DaughterLbl, Constants.SP_NATURAL);
            HeightPolicy.set(qq_DaughterLbl, Constants.SP_NATURAL);
            qq_DaughterLbl.setMinimumSize(new Dimension(50, 14));
        }
        return qq_DaughterLbl;
    }

    public void setqq_DaughterLbl(TextGraphic value) {
        TextGraphic oldValue = qq_DaughterLbl;
        qq_DaughterLbl = value;
        this.qq_Listeners.firePropertyChange("qq_DaughterLbl", oldValue, value);
    }

    /**
     * qq_myFamily_daughter: transformed from: qqds_DataField
     * TagId=17
     * isInherited=FALSE
     */
    public DataField getqq_myFamily_daughter() {
        if (qq_myFamily_daughter == null) {
            // Mask type: MK_NONE
            qq_myFamily_daughter = DataFieldFactory.newDataField("daughter", 14, TextData.class, Constants.MK_NONE);
            qq_myFamily_daughter.setOriginalFormatText(null);
            qq_myFamily_daughter.setHorizontalAlignment(JTextField.LEFT);
            getBindingManager().bindComponent(qq_myFamily_daughter, "myFamily.daughter");
            WidthPolicy.set(qq_myFamily_daughter, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_myFamily_daughter, Constants.SP_NATURAL);
            qq_myFamily_daughter.setMinimumSize(new Dimension(96, 19));
            qq_myFamily_daughter.setSize(new Dimension(96, 19));
        }
        return qq_myFamily_daughter;
    }

    public void setqq_myFamily_daughter(DataField value) {
        DataField oldValue = qq_myFamily_daughter;
        qq_myFamily_daughter = value;
        this.qq_Listeners.firePropertyChange("qq_myFamily_daughter", oldValue, value);
    }

    /**
     * qq_myFamily: transformed from: qqds_GridField
     * TagId=13
     * isInherited=FALSE
     * In forte this was a 2x2 grid field, displaying a family object.
     * The cell margins are all 100 mils
     * The width policy is set to Natural, and the height policy is set to Natural.
     */
    protected void setqq_myFamilyProperties() {
        qq_myFamily.setCellTopMargin(50);
        qq_myFamily.setCellBottomMargin(50);
        qq_myFamily.setCellLeftMargin(50);
        qq_myFamily.setCellRightMargin(50);
        qq_myFamily.setCollapsed(true);
        qq_myFamily.setHeightPolicy(Constants.SP_NATURAL);
        qq_myFamily.setWidthPolicy(Constants.SP_NATURAL);
        qq_myFamily.setBackground(null);
    }

    public GridField getqq_myFamily() {
        if (qq_myFamily == null) {
            qq_myFamily = CompoundFieldFactory.newGridField("myFamily", false);
            getBindingManager().bindComponent(qq_myFamily, "myFamily");
            setqq_myFamilyProperties();
            qq_myFamily.setMinimumSize(new Dimension(179, 67));
            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_DEFAULT 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_myFamily.add( getqq_SonLbl(), 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_DEFAULT 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_myFamily.add( getqq_myFamily_son(), qq_gbc1 );

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

            GridBagConstraints qq_gbc3 = new GridBagConstraints();
            qq_gbc3.gridx = 1; // Column 2
            qq_gbc3.gridy = 1; // Row 2
            qq_gbc3.weightx = 0;
            qq_gbc3.weighty = 0;
            qq_gbc3.anchor = GridBagConstraints.CENTER; // Gravity - original: CG_DEFAULT gf
            qq_gbc3.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc3.insets = new Insets(4, 4, 4, 4); // Top, Left, Bottom, Right Margin
            qq_myFamily.add( getqq_myFamily_daughter(), qq_gbc3 );

        }
        return qq_myFamily;
    }

    public void setqq_myFamily(GridField value) {
        GridField oldValue = qq_myFamily;
        qq_myFamily = value;
        this.qq_Listeners.firePropertyChange("qq_myFamily", oldValue, value);
    }

    /**
     * qq_doSomething: transformed from: qqds_PushButton
     * TagId=18
     * isInherited=FALSE
     */
    public JButton getqq_doSomething() {
        if (qq_doSomething == null) {
            qq_doSomething = PushButtonFactory.newInstance("doSomething", "Button");
            qq_doSomething.setVerifyInputWhenFocusTarget(true);
            WidthPolicy.set(qq_doSomething, Constants.SP_NATURAL);
            HeightPolicy.set(qq_doSomething, Constants.SP_NATURAL);
            qq_doSomething.setMinimumSize(new Dimension(47, 21));
        }
        return qq_doSomething;
    }

    public void setqq_doSomething(JButton value) {
        JButton oldValue = qq_doSomething;
        qq_doSomething = value;
        this.qq_Listeners.firePropertyChange("qq_doSomething", oldValue, value);
    }

    /**
     * qq_outergrid: transformed from: qqds_GridField
     * TagId=12
     * isInherited=FALSE
     * In forte this was a 1x2 grid field.
     * There are no cell margins set
     * The width policy is set to Natural, and the height policy is set to Natural.
     */
    protected void setqq_outergridProperties() {
        qq_outergrid.setCollapsed(true);
        qq_outergrid.setHeightPolicy(Constants.SP_NATURAL);
        qq_outergrid.setWidthPolicy(Constants.SP_NATURAL);
        qq_outergrid.setBackground(null);
    }

    public GridField getqq_outergrid() {
        if (qq_outergrid == null) {
            qq_outergrid = CompoundFieldFactory.newGridField("outergrid", false);
            setqq_outergridProperties();
            qq_outergrid.setMinimumSize(new Dimension(179, 89));
            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_DEFAULT gf
            qq_gbc.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc.insets = new Insets(0, 0, 0, 0); // Top, Left, Bottom, Right Margin
            qq_outergrid.add( getqq_myFamily(), 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_DEFAULT gf
            qq_gbc1.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc1.insets = new Insets(0, 0, 0, 0); // Top, Left, Bottom, Right Margin
            qq_outergrid.add( getqq_doSomething(), qq_gbc1 );

        }
        return qq_outergrid;
    }

    public void setqq_outergrid(GridField value) {
        GridField oldValue = qq_outergrid;
        qq_outergrid = value;
        this.qq_Listeners.firePropertyChange("qq_outergrid", oldValue, value);
    }

    /**
     * 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_outergrid() );
        }
        return Form;
    }

    public void setForm(JPanel value) {
        JPanel oldValue = Form;
        Form = value;
        this.qq_Listeners.firePropertyChange("Form", oldValue, value);
    }

    /**
     * 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) {
        this.qq_defaultSet = value;
    }

    /**
     * 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) {
        this.qq_msgSet = value;
    }

    /**
     * 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) {
        this.qq_msgNumber = value;
    }



    /**
     * Initialise the window and all its children.
     */
    protected void initialize() {
        if (this.Form == null) {
            this.setName( "MainForm" );
            this.setTitle( "" );
            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(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
            this.setUsage(DisplayProject.Constants.WU_UPDATE);
            UIutils.processGUIActions();
            this.pack();
            this.setInitialX(0);
            this.setInitialY(0);
            this.setInitialPositionPolicy(Constants.PP_SYSTEMDEFAULT);
        }
    }


    // ----------------
    //  Window usage
    //-----------------
    protected WindowUsageMap usage = new WindowUsageMap();
    public int getUsage() {
        return this.usage.getUsage();
    }
    public WindowUsageMap getUsageMap() {
        return this.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.usage.setUsage(usage);
    }
    public void qq_setupWindowUsage() {
        this.usage = new WindowUsageMap();
        this.usage.add(getqq_outergrid(), Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.usage.add(getqq_myFamily(), Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.usage.add(getqq_SonLbl(), Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
        this.usage.add(getqq_myFamily_son(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.usage.add(getqq_DaughterLbl(), Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE, Constants.FS_INACTIVE);
        this.usage.add(getqq_myFamily_daughter(), Constants.FS_UPDATE, Constants.FS_VIEWONLY, Constants.FS_QUERY, Constants.FS_UPDATE, Constants.FS_UPDATE, Constants.FS_UPDATE);
        this.usage.add(getqq_doSomething(), 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 ) {
            FrameworkUtils.setCmdLineArgs(args);
            AppletConnectionInfo client = null;
            try {
                // Install our own focus manager. MUST be done prior to setting the
                // UIManager, otherwise you'll run into issues like things have the wrong focus.
                KeyboardFocusManager.setCurrentKeyboardFocusManager(new ForteKeyboardFocusManager());

                UIManager.setLookAndFeel(new Win32LookAndFeel());

                client = UserWindow.postAPPLETStarted();
                MainForm mainForm_start = new MainForm();
                mainForm_start.display();
                UserWindow.postAPPLETStopped(client);
                System.exit(0);
            } catch (Throwable e) {
                ErrorMgr.showErrors(null, "Unhandled exception", e);
                UserWindow.postAPPLETStopped(client);
                System.exit(0);
            }
        }
// end class MainForm
// c Pass 2 Conversion Time: 359 milliseconds
TOP

Related Classes of SUN_78.MainForm

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.