Package MenuTest

Source Code of MenuTest.RunMe

package MenuTest;

import DisplayProject.CloseHideAdaptor;
import DisplayProject.Constants;
import DisplayProject.CursorMgr;
import DisplayProject.UDSWindow;
import DisplayProject.UIutils;
import DisplayProject.WindowManager;
import DisplayProject.WindowUsageMap;
import DisplayProject.actions.AppletConnectionInfo;
import DisplayProject.actions.CommandType;
import DisplayProject.actions.FieldPopupMenu;
import DisplayProject.actions.HeightPolicy;
import DisplayProject.actions.IntegerValue;
import DisplayProject.actions.TextValue;
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.MenuList;
import DisplayProject.events.ClientEventManager;
import DisplayProject.factory.CompoundFieldFactory;
import DisplayProject.factory.MenuFactory;
import DisplayProject.factory.PushButtonFactory;
import DisplayProject.plaf.Win32LookAndFeel;
import Framework.Array_Of_ListElement;
import Framework.ErrorMgr;
import Framework.EventHandle;
import Framework.EventManager;
import Framework.EventRegistration;
import Framework.File;
import Framework.ForteKeyboardFocusManager;
import Framework.FrameworkUtils;
import Framework.ListElement;
import Framework.RuntimeProperties;
import Framework.TextData;
import Framework.UsageException;
import java.awt.Dimension;
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.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.UIManager;
import org.apache.log4j.Logger;

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

    // ----------
    // Attributes
    // ----------
    protected File DefaultHelpFile;
    protected BindingManager bindingManager = null;
    public PropertyChangeSupport qq_Listeners = new ExtendedPropertyChangeSupport(this, true);
    private int menu1;
    private TextData menu2;

    // ------------
    // Constructors
    // ------------
    public RunMe() {
        // 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 setMenu1(int menu1) {
        int oldValue = this.menu1;
        this.menu1 = menu1;
        this.qq_Listeners.firePropertyChange("menu1", oldValue, this.menu1);
    }

    public int getMenu1() {
        return this.menu1;
    }

    public void setMenu2(TextData menu2) {
        TextData oldValue = this.menu2;
        this.menu2 = menu2;
        this.qq_Listeners.firePropertyChange("menu2", oldValue, this.menu2);
    }

    public TextData getMenu2() {
        return this.menu2;
    }

    // -------
    // 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.setMenu1(0);
        this.setMenu2(new TextData("One"));

        UserWindow.open(this);
        FieldPopupMenu.set(this.getqq_btnSet(), this.getqq_Popup1());

        // ----------
        // Event Loop
        // ----------
        EventManager.startEventLoop();
        try {
            EventRegistration PushButton_Click_getqq_btnSet = ClientEventManager.register( this.getqq_btnSet(), "Click" );
            EventRegistration TaskHandle_Shutdown_langThreadcurrentThread = ClientEventManager.register( Thread.currentThread(), "Shutdown" );

            while (true) {

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

                // --------------
                // <btnSet>.click
                // --------------
                if (qq_currentEvent.isEvent(PushButton_Click_getqq_btnSet)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        Logger.getLogger("task.part.logmgr").info( Integer.toString(this.getMenu1()));
                        Logger.getLogger("task.part.logmgr").info(this.getMenu2());
                        Logger.getLogger("task.part.logmgr").info( Integer.toString(IntegerValue.get(this.getqq_menu1())));
                        Logger.getLogger("task.part.logmgr").info(TextValue.get(this.getqq_menu1()));
                        this.setMenu1(1);
                        this.setMenu2(new TextData("Two"));

                        // ================ 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();
                    }
                }
            }
            EventManager.deregister( PushButton_Click_getqq_btnSet );
            EventManager.deregister( TaskHandle_Shutdown_langThreadcurrentThread );
        }
        //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 JButton qq_btnSet;
    public JMenu qq_SubMenu1;
    public JMenu qq_SubMenu;
    public JMenu qq_aSubMenu;
    public JMenuBar qq_MainMenuBar;
    public JMenuItem qq_aChildItem;
    public JMenuItem qq_aMenu;
    public JPanel Form;
    public JPopupMenu qq_Popup1;
    public MenuList qq_menu1;
    public MenuList qq_menu2;

    /**
     * qq_menu1: transformed from: qqds_MenuList
     */
    public MenuList getqq_menu1() {
        if (qq_menu1 == null) {
            qq_menu1 = new MenuList();
            qq_menu1.setName("menu1");
            String[] names = {"New MenuList Item 1", "New MenuList Item 2", "New MenuList Item 3"};
            Array_Of_ListElement<ListElement> elements = new Array_Of_ListElement<ListElement>();
            elements.add( new ListElement( 0, names[0], ListElement.qq_Resolver.cINTEGERVALUE_TEXTVALUE ) );
            elements.add( new ListElement( 1, names[1], ListElement.qq_Resolver.cINTEGERVALUE_TEXTVALUE ) );
            elements.add( new ListElement( 2, names[2], ListElement.qq_Resolver.cINTEGERVALUE_TEXTVALUE ) );
            getBindingManager().bindComponent(qq_menu1, "menu1", elements);
        }
        return qq_menu1;
    }

    public void setqq_menu1(MenuList value) {
        MenuList oldValue = qq_menu1;
        qq_menu1 = value;
        this.qq_Listeners.firePropertyChange("qq_menu1", oldValue, value);
    }


    /**
     * qq_SubMenu: transformed from: qqds_Submenu
     */
    public JMenu getqq_SubMenu() {
        if (qq_SubMenu == null) {
            qq_SubMenu = new JMenu();
            qq_SubMenu.setName("");
            qq_SubMenu.setText( "Int" );
            qq_SubMenu.setVisible(true);
            qq_SubMenu.add(getqq_menu1());
        }
        return qq_SubMenu;
    }


    /**
     * qq_menu2: transformed from: qqds_MenuList
     */
    public MenuList getqq_menu2() {
        if (qq_menu2 == null) {
            qq_menu2 = new MenuList();
            qq_menu2.setName("menu2");
            String[] names = {"One", "Two", "Three"};
            Array_Of_ListElement<ListElement> elements = new Array_Of_ListElement<ListElement>();
            elements.add( new ListElement( 0, names[0], ListElement.qq_Resolver.cINTEGERVALUE_TEXTVALUE ) );
            elements.add( new ListElement( 0, names[1], ListElement.qq_Resolver.cINTEGERVALUE_TEXTVALUE ) );
            elements.add( new ListElement( 0, names[2], ListElement.qq_Resolver.cINTEGERVALUE_TEXTVALUE ) );
            getBindingManager().bindComponent(qq_menu2, "menu2", elements);
        }
        return qq_menu2;
    }

    public void setqq_menu2(MenuList value) {
        MenuList oldValue = qq_menu2;
        qq_menu2 = value;
        this.qq_Listeners.firePropertyChange("qq_menu2", oldValue, value);
    }


    /**
     * qq_SubMenu1: transformed from: qqds_Submenu
     */
    public JMenu getqq_SubMenu1() {
        if (qq_SubMenu1 == null) {
            qq_SubMenu1 = new JMenu();
            qq_SubMenu1.setName("");
            qq_SubMenu1.setText( "TextData" );
            qq_SubMenu1.setVisible(true);
            qq_SubMenu1.add(getqq_menu2());
        }
        return qq_SubMenu1;
    }


    /**
     * qq_aMenu: transformed from: qqds_MenuCommand
     */
    public JMenuItem getqq_aMenu() {
        if (qq_aMenu == null) {
            qq_aMenu = MenuFactory.newMenuItem("aMenu", true);
            qq_aMenu.setVerifyInputWhenFocusTarget(true);
            CommandType.set(qq_aMenu, Constants.CT_CUSTOM);
            qq_aMenu.setText( "aChildMenu" );
            qq_aMenu.setVisible(true);
        }
        return qq_aMenu;
    }

    public void setqq_aMenu(JMenuItem value) {
        JMenuItem oldValue = qq_aMenu;
        qq_aMenu = value;
        this.qq_Listeners.firePropertyChange("qq_aMenu", oldValue, value);
    }


    /**
     * qq_aChildItem: transformed from: qqds_MenuCommand
     */
    public JMenuItem getqq_aChildItem() {
        if (qq_aChildItem == null) {
            qq_aChildItem = MenuFactory.newMenuItem("aChildItem", true);
            qq_aChildItem.setVerifyInputWhenFocusTarget(true);
            CommandType.set(qq_aChildItem, Constants.CT_CUSTOM);
            qq_aChildItem.setText( "Child item on a popup sub menu" );
            qq_aChildItem.setVisible(true);
        }
        return qq_aChildItem;
    }

    public void setqq_aChildItem(JMenuItem value) {
        JMenuItem oldValue = qq_aChildItem;
        qq_aChildItem = value;
        this.qq_Listeners.firePropertyChange("qq_aChildItem", oldValue, value);
    }


    /**
     * qq_aSubMenu: transformed from: qqds_Submenu
     */
    public JMenu getqq_aSubMenu() {
        if (qq_aSubMenu == null) {
            qq_aSubMenu = new JMenu();
            qq_aSubMenu.setName("aSubMenu");
            qq_aSubMenu.setText( "aSubMenu" );
            qq_aSubMenu.setVisible(true);
            qq_aSubMenu.add(getqq_aChildItem());
        }
        return qq_aSubMenu;
    }


    /**
     * qq_Popup1: transformed from: qqds_Submenu
     */
    public JPopupMenu getqq_Popup1() {
        if (qq_Popup1 == null) {
            qq_Popup1 = new JPopupMenu();
            qq_Popup1.setName("Popup1");
            qq_Popup1.setVisible(true);
            qq_Popup1.add(getqq_aMenu());
            qq_Popup1.add(getqq_aSubMenu());
        }
        return qq_Popup1;
    }


    /**
     * 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_SubMenu());
            this.qq_MainMenuBar.add(getqq_SubMenu1());
        }
        return qq_MainMenuBar;
    }

    public void setqq_MainMenuBar(JMenuBar value) {
        JMenuBar oldValue = qq_MainMenuBar;
        qq_MainMenuBar = value;
        this.qq_Listeners.firePropertyChange("qq_MainMenuBar", oldValue, value);
    }


    /**
     * qq_btnSet: transformed from: qqds_PushButton
     * TagId=20
     * isInherited=FALSE
     */
    public JButton getqq_btnSet() {
        if (qq_btnSet == null) {
            qq_btnSet = PushButtonFactory.newInstance("btnSet", "Click on me for a popup menu");
            qq_btnSet.setVerifyInputWhenFocusTarget(true);
            WidthPolicy.set(qq_btnSet, Constants.SP_NATURAL);
            HeightPolicy.set(qq_btnSet, Constants.SP_NATURAL);
            qq_btnSet.setMinimumSize(new Dimension(156, 21));
            qq_btnSet.setLocation(69, 50);
        }
        return qq_btnSet;
    }

    public void setqq_btnSet(JButton value) {
        JButton oldValue = qq_btnSet;
        qq_btnSet = value;
        this.qq_Listeners.firePropertyChange("qq_btnSet", 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_btnSet() );
        }
        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( "RunMe" );
            this.setTitle( "" );
            this.setSystemClosePolicy(Constants.SC_ENABLEDSHUTDOWN);
            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(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_menu1(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.usage.add(getqq_SubMenu(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.usage.add(getqq_menu2(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.usage.add(getqq_SubMenu1(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.usage.add(getqq_aMenu(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.usage.add(getqq_aChildItem(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.usage.add(getqq_aSubMenu(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.usage.add(getqq_Popup1(), Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED, Constants.MS_ENABLED);
        this.usage.add(getqq_btnSet(), 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();
                RunMe runMe_start = new RunMe();
                runMe_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 RunMe
// c Pass 2 Conversion Time: 296 milliseconds
TOP

Related Classes of MenuTest.RunMe

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.