Package Express.windows

Source Code of Express.windows.PreferencesWindow

package Express.windows;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.KeyboardFocusManager;
import java.awt.event.ComponentListener;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.net.URL;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.ToolTipManager;
import javax.swing.UIManager;

import DisplayProject.CloseHideAdaptor;
import DisplayProject.Constants;
import DisplayProject.CursorMgr;
import DisplayProject.DataField;
import DisplayProject.GridField;
import DisplayProject.LayoutManagerHelper;
import DisplayProject.UIutils;
import DisplayProject.UsageMap;
import DisplayProject.WindowFormLayout;
import DisplayProject.WindowManager;
import DisplayProject.actions.DefaultButton;
import DisplayProject.actions.HeightPolicy;
import DisplayProject.actions.UserWindow;
import DisplayProject.actions.WidgetState;
import DisplayProject.actions.WidthPolicy;
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.factory.ToggleFieldFactory;
import Framework.Application;
import Framework.CloneHelper;
import Framework.ErrorMgr;
import Framework.EventHandle;
import Framework.EventManager;
import Framework.EventRegistration;
import Framework.File;
import Framework.ForteKeyboardFocusManager;
import Framework.IntegerData;
import Framework.RuntimeProperties;
import Framework.UsageException;

import com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel;

/**
* The PreferencesWindow class defines the window that provides the end user with access to the application preferences.
* <p>
* @author ITerative Consulting
* @since  26-Feb-2008
*/
@RuntimeProperties(isDistributed=false, isAnchored=false, isShared=false, isTransactional=false)
@SuppressWarnings("serial")
public class PreferencesWindow
        extends JFrame
        implements Serializable, Observable
{

    // ----------
    // Attributes
    // ----------
    protected File DefaultHelpFile;
    protected BindingManager bindingManager = null;
    public PropertyChangeSupport qq_Listeners = new ExtendedPropertyChangeSupport(this, true);
    private ApplicationBroker appBroker;
    private PreferencesDesc preferences;

    // ------------
    // Constructors
    // ------------
    public PreferencesWindow() {
        // Explicitly call the superclass constructor to prevent the implicit call
        super();
        this.initialize();
        this.appBroker = null;
        this.preferences = null;
    }

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

    public void setDefaultHelpFile(File defaultHelpFile) {
        DefaultHelpFile = defaultHelpFile;
        //this.getForm().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), "VK_HELP");
        //this.getForm().getActionMap().put("VK_HELP", new HelpAction(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 setAppBroker(ApplicationBroker appBroker) {
        ApplicationBroker oldValue = this.appBroker;
        this.appBroker = appBroker;
        this.qq_Listeners.firePropertyChange("appBroker", oldValue, this.appBroker);
    }

    public ApplicationBroker getAppBroker() {
        return this.appBroker;
    }

    public void setPreferences(PreferencesDesc preferences) {
        PreferencesDesc oldValue = this.preferences;
        this.preferences = preferences;
        this.qq_Listeners.firePropertyChange("preferences", oldValue, this.preferences);
    }

    public PreferencesDesc getPreferences() {
        return this.preferences;
    }

    // -------
    // 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>
     * Display<br>
     *     Display displays the Preferences dialog box to the<br>
     *     user and allows them to make changes.  If the user<br>
     *     selects cancel when done, the method undoes their<br>
     *     changes.  If the press OK, their changes remain.<br>
     * <p>
     * @param prefs Type: PreferencesDesc
     */
    public void display(ParameterHolder_PreferencesDesc prefs) {
        PreferencesDesc preferencesBackup = null;

        //
        // if passed a nil Preferences descriptor, make a new one.
        //
        if (((PreferencesDesc)prefs.getObject()) == null) {
            this.setPreferences(new PreferencesDesc());
        }
        else {
            //
            // otherwise, back up the existing one.
            //
            this.setPreferences((PreferencesDesc)prefs.getObject());
            preferencesBackup = CloneHelper.clone(this.getPreferences(), true);
        }

        if (Application.getMsgCatalog().isPresent()) {
            UIutils.reloadLabelText(this, Application.getMsgCatalog());
        }
        this.setTitle(this.getAppBroker().getLocalString(ApplicationBroker.MS_MESSAGE_SET, ApplicationBroker.MN_TITLE_PREFERENCES));

        //
        // open as a modal dialog
        //
        UserWindow.open(this, true);

        //
        // handle events
        //
        // ----------
        // Event Loop
        // ----------
        EventManager.startEventLoop();
        try {
            EventRegistration TaskHandle_Shutdown_TaskcurrentTask = ClientEventManager.register( Thread.currentThread(), "Shutdown" );
            EventRegistration PushButton_Click_getqq_OKPB = ClientEventManager.register( this.getqq_OKPB(), "Click" );
            EventRegistration PushButton_Click_getqq_CancelPB = ClientEventManager.register( this.getqq_CancelPB(), "Click" );

            while (true) {

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

                // -------------
                // task.shutdown
                // -------------
                if (qq_currentEvent.isEvent(TaskHandle_Shutdown_TaskcurrentTask)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        break;

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

                // ------------
                // <OKPB>.click
                // ------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_OKPB)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        break;

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

                // ----------------
                // <CancelPB>.click
                // ----------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_CancelPB)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        prefs.setObject(preferencesBackup);
                        break;

                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }
            }
            EventManager.deregister( TaskHandle_Shutdown_TaskcurrentTask );
            EventManager.deregister( PushButton_Click_getqq_OKPB );
            EventManager.deregister( PushButton_Click_getqq_CancelPB );
        }
        //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 int initialX;
    protected int initialY;
    protected int qq_SystemClosePolicy = Constants.SC_ENABLEDSHUTDOWN;
    protected int qq_initialPositionPolicy = Constants.PP_SYSTEMDEFAULT;
    public DataField qq_Preferences_MaxRecords;
    public GridField qq_GridField1;
    public GridField qq_GridField2;
    public GridField qq_GridField;
    public GridField qq_Preferences;
    public JButton qq_CancelPB;
    public JButton qq_OKPB;
    public JCheckBox qq_Preferences_ConfirmCancel;
    public JCheckBox qq_Preferences_ConfirmClear;
    public JCheckBox qq_Preferences_ConfirmClose;
    public JCheckBox qq_Preferences_ConfirmDelete;
    public JCheckBox qq_Preferences_ConfirmMode;
    public JCheckBox qq_Preferences_ConfirmRevert;
    public JPanel Form;
    public TextGraphic qq_Preferences_ConfirmLabel;
    public TextGraphic qq_Preferences_MaximumRecordsLabel;

    /**
     * qq_OKPB: transformed from: qqds_PushButton
     * TagId=65533
     */
    public JButton getqq_OKPB() {
        if (qq_OKPB == null) {
            qq_OKPB = PushButtonFactory.newInstance("OKPB", "OK");
            UIutils.setMsgSet(qq_OKPB, 60100);
            UIutils.setMsgNumber(qq_OKPB, 156);
            DefaultButton.set(qq_OKPB, true);
            qq_OKPB.setVerifyInputWhenFocusTarget(true);
            // OPTIONAL UIutils.reloadLabelText(qq_OKPB, mcat);
            WidthPolicy.set(qq_OKPB, Constants.SP_TO_PARTNER);
            HeightPolicy.set(qq_OKPB, Constants.SP_TO_PARTNER);
            LayoutManagerHelper.setHeightPartner(qq_OKPB, getqq_CancelPB());
            LayoutManagerHelper.setWidthPartner(qq_OKPB, getqq_CancelPB());
            // OPTIONAL qq_OKPB.setSize(new Dimension(48, 21));
            qq_OKPB.setMinimumSize(new Dimension(48, 21));
            qq_OKPB.setPreferredSize(new Dimension(48, 21));
        }
        return qq_OKPB;
    }


    /**
     * qq_CancelPB: transformed from: qqds_PushButton
     * TagId=65532
     */
    public JButton getqq_CancelPB() {
        if (qq_CancelPB == null) {
            qq_CancelPB = PushButtonFactory.newInstance("CancelPB", "Cancel");
            UIutils.setMsgSet(qq_CancelPB, 60100);
            UIutils.setMsgNumber(qq_CancelPB, 151);
            qq_CancelPB.setVerifyInputWhenFocusTarget(true);
            // OPTIONAL UIutils.reloadLabelText(qq_CancelPB, mcat);
            WidthPolicy.set(qq_CancelPB, Constants.SP_TO_PARTNER);
            HeightPolicy.set(qq_CancelPB, Constants.SP_TO_PARTNER);
            LayoutManagerHelper.setHeightPartner(qq_CancelPB, getqq_OKPB());
            LayoutManagerHelper.setWidthPartner(qq_CancelPB, getqq_OKPB());
            // OPTIONAL qq_CancelPB.setSize(new Dimension(48, 21));
            qq_CancelPB.setMinimumSize(new Dimension(48, 21));
            qq_CancelPB.setPreferredSize(new Dimension(48, 21));
        }
        return qq_CancelPB;
    }


    /**
     * qq_GridField1: transformed from: qqds_GridField
     * TagId=65534
     * In forte this was a 2x1 grid field.
     * The cell margins are all 100 mils
     * The width policy is set to Natural, and the height policy is set to Natural.
     */
    public GridField getqq_GridField1() {
        if (qq_GridField1 == null) {
            qq_GridField1 = CompoundFieldFactory.newGridField("");
            qq_GridField1.setCellTopMargin(50);
            qq_GridField1.setCellBottomMargin(50);
            qq_GridField1.setCellLeftMargin(50);
            qq_GridField1.setCellRightMargin(50);
            qq_GridField1.setCellGravity(Constants.CG_CENTER);
            qq_GridField1.setCollapsed(true);
            qq_GridField1.setInsertPolicy(Constants.IP_EXPAND);
            qq_GridField1.setHeightPolicy(Constants.SP_NATURAL);
            qq_GridField1.setWidthPolicy(Constants.SP_NATURAL);
            // OPTIONAL UIutils.reloadLabelText(qq_GridField1, mcat);
            qq_GridField1.setBackground(null);
            // OPTIONAL qq_GridField1.setSize(new Dimension(125, 42));
            // OPTIONAL qq_GridField1.setMinimumSize(new Dimension(125, 42));
            // OPTIONAL qq_GridField1.setPreferredSize(new Dimension(125, 42));
            GridBagConstraints qq_gbc = new GridBagConstraints();
            qq_gbc.gridx = 0; // Column 1
            qq_gbc.gridy = 0; // Row 1
            qq_gbc.weightx = 0;
            qq_gbc.weighty = 0;
            qq_gbc.anchor = GridBagConstraints.CENTER; // Gravity - original: CG_CENTER gf
            qq_gbc.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc.insets = new Insets(4, 4, 4, 4); // Top, Left, Bottom, Right Margin
            qq_GridField1.add( getqq_OKPB(), qq_gbc );

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

        }
        return qq_GridField1;
    }


    /**
     * qq_Preferences_ConfirmLabel: transformed from: qqds_TextGraphic
     * TagId=1
     */
    public TextGraphic getqq_Preferences_ConfirmLabel() {
        if (qq_Preferences_ConfirmLabel == null) {
            qq_Preferences_ConfirmLabel = GraphicFactory.newTextGraphic("Confirm When Destructive:\n", "ConfirmLabel");
            UIutils.setMsgSet(qq_Preferences_ConfirmLabel, 60100);
            UIutils.setMsgNumber(qq_Preferences_ConfirmLabel, 603);
            qq_Preferences_ConfirmLabel.setHorizontalAlignment( javax.swing.SwingConstants.LEFT );
            // OPTIONAL UIutils.reloadLabelText(qq_Preferences_ConfirmLabel, mcat);
            WidthPolicy.set(qq_Preferences_ConfirmLabel, Constants.SP_NATURAL);
            HeightPolicy.set(qq_Preferences_ConfirmLabel, Constants.SP_NATURAL);
            qq_Preferences_ConfirmLabel.setPreferredSize(UIutils.labelWidth(qq_Preferences_ConfirmLabel));
        }
        return qq_Preferences_ConfirmLabel;
    }


    /**
     * qq_Preferences_MaximumRecordsLabel: transformed from: qqds_TextGraphic
     * TagId=2
     */
    public TextGraphic getqq_Preferences_MaximumRecordsLabel() {
        if (qq_Preferences_MaximumRecordsLabel == null) {
            qq_Preferences_MaximumRecordsLabel = GraphicFactory.newTextGraphic("Maximum Records In Result:\n", "MaximumRecordsLabel");
            UIutils.setMsgSet(qq_Preferences_MaximumRecordsLabel, 60100);
            UIutils.setMsgNumber(qq_Preferences_MaximumRecordsLabel, 605);
            qq_Preferences_MaximumRecordsLabel.setHorizontalAlignment( javax.swing.SwingConstants.LEFT );
            // OPTIONAL UIutils.reloadLabelText(qq_Preferences_MaximumRecordsLabel, mcat);
            WidthPolicy.set(qq_Preferences_MaximumRecordsLabel, Constants.SP_NATURAL);
            HeightPolicy.set(qq_Preferences_MaximumRecordsLabel, Constants.SP_NATURAL);
            qq_Preferences_MaximumRecordsLabel.setPreferredSize(UIutils.labelWidth(qq_Preferences_MaximumRecordsLabel));
        }
        return qq_Preferences_MaximumRecordsLabel;
    }


    /**
     * qq_Preferences_MaxRecords: transformed from: qqds_DataField
     * TagId=3
     */
    public DataField getqq_Preferences_MaxRecords() {
        if (qq_Preferences_MaxRecords == null) {
            // Mask type: MK_NONE
            qq_Preferences_MaxRecords = DataFieldFactory.newDataField("MaxRecords", 7, IntegerData.class, DisplayProject.Constants.MK_NONE);
            qq_Preferences_MaxRecords.setOriginalFormatText(null);
            qq_Preferences_MaxRecords.setHorizontalAlignment(JTextField.LEFT);
            getBindingManager().bindComponent(qq_Preferences_MaxRecords, "preferences.maxRecords");
            WidthPolicy.set(qq_Preferences_MaxRecords, Constants.SP_EXPLICIT);
            HeightPolicy.set(qq_Preferences_MaxRecords, Constants.SP_NATURAL);
            // OPTIONAL qq_Preferences_MaxRecords.setSize(new Dimension(52, 19));
            qq_Preferences_MaxRecords.setMinimumSize(new Dimension(52, 19));
            qq_Preferences_MaxRecords.setPreferredSize(new Dimension(52, 19));
        }
        return qq_Preferences_MaxRecords;
    }


    /**
     * qq_Preferences_ConfirmRevert: transformed from: qqds_ToggleField
     * TagId=5
     */
    public JCheckBox getqq_Preferences_ConfirmRevert() {
        if (qq_Preferences_ConfirmRevert == null) {
            qq_Preferences_ConfirmRevert = ToggleFieldFactory.newToggleField("Revert To Saved", "ConfirmRevert");
            getBindingManager().bindComponent(qq_Preferences_ConfirmRevert, "preferences.confirmRevert");
            UIutils.setMsgSet(qq_Preferences_ConfirmRevert, 60100);
            UIutils.setMsgNumber(qq_Preferences_ConfirmRevert, 607);
            // OPTIONAL UIutils.reloadLabelText(qq_Preferences_ConfirmRevert, mcat);
        }
        return qq_Preferences_ConfirmRevert;
    }


    /**
     * qq_Preferences_ConfirmCancel: transformed from: qqds_ToggleField
     * TagId=6
     */
    public JCheckBox getqq_Preferences_ConfirmCancel() {
        if (qq_Preferences_ConfirmCancel == null) {
            qq_Preferences_ConfirmCancel = ToggleFieldFactory.newToggleField("Cancel", "ConfirmCancel");
            getBindingManager().bindComponent(qq_Preferences_ConfirmCancel, "preferences.confirmCancel");
            UIutils.setMsgSet(qq_Preferences_ConfirmCancel, 60100);
            UIutils.setMsgNumber(qq_Preferences_ConfirmCancel, 151);
            // OPTIONAL UIutils.reloadLabelText(qq_Preferences_ConfirmCancel, mcat);
        }
        return qq_Preferences_ConfirmCancel;
    }


    /**
     * qq_Preferences_ConfirmClose: transformed from: qqds_ToggleField
     * TagId=7
     */
    public JCheckBox getqq_Preferences_ConfirmClose() {
        if (qq_Preferences_ConfirmClose == null) {
            qq_Preferences_ConfirmClose = ToggleFieldFactory.newToggleField("Close", "ConfirmClose");
            getBindingManager().bindComponent(qq_Preferences_ConfirmClose, "preferences.confirmClose");
            UIutils.setMsgSet(qq_Preferences_ConfirmClose, 60100);
            UIutils.setMsgNumber(qq_Preferences_ConfirmClose, 602);
            // OPTIONAL UIutils.reloadLabelText(qq_Preferences_ConfirmClose, mcat);
        }
        return qq_Preferences_ConfirmClose;
    }


    /**
     * qq_Preferences_ConfirmMode: transformed from: qqds_ToggleField
     * TagId=8
     */
    public JCheckBox getqq_Preferences_ConfirmMode() {
        if (qq_Preferences_ConfirmMode == null) {
            qq_Preferences_ConfirmMode = ToggleFieldFactory.newToggleField("Change Mode", "ConfirmMode");
            getBindingManager().bindComponent(qq_Preferences_ConfirmMode, "preferences.confirmMode");
            UIutils.setMsgSet(qq_Preferences_ConfirmMode, 60100);
            UIutils.setMsgNumber(qq_Preferences_ConfirmMode, 601);
            // OPTIONAL UIutils.reloadLabelText(qq_Preferences_ConfirmMode, mcat);
        }
        return qq_Preferences_ConfirmMode;
    }


    /**
     * qq_Preferences_ConfirmClear: transformed from: qqds_ToggleField
     * TagId=9
     */
    public JCheckBox getqq_Preferences_ConfirmClear() {
        if (qq_Preferences_ConfirmClear == null) {
            qq_Preferences_ConfirmClear = ToggleFieldFactory.newToggleField("Clear Result Set", "ConfirmClear");
            getBindingManager().bindComponent(qq_Preferences_ConfirmClear, "preferences.confirmClear");
            UIutils.setMsgSet(qq_Preferences_ConfirmClear, 60100);
            UIutils.setMsgNumber(qq_Preferences_ConfirmClear, 608);
            // OPTIONAL UIutils.reloadLabelText(qq_Preferences_ConfirmClear, mcat);
        }
        return qq_Preferences_ConfirmClear;
    }


    /**
     * qq_Preferences_ConfirmDelete: transformed from: qqds_ToggleField
     * TagId=10
     */
    public JCheckBox getqq_Preferences_ConfirmDelete() {
        if (qq_Preferences_ConfirmDelete == null) {
            qq_Preferences_ConfirmDelete = ToggleFieldFactory.newToggleField("Delete Record", "ConfirmDelete");
            getBindingManager().bindComponent(qq_Preferences_ConfirmDelete, "preferences.confirmDelete");
            UIutils.setMsgSet(qq_Preferences_ConfirmDelete, 60100);
            UIutils.setMsgNumber(qq_Preferences_ConfirmDelete, 609);
            // OPTIONAL UIutils.reloadLabelText(qq_Preferences_ConfirmDelete, mcat);
        }
        return qq_Preferences_ConfirmDelete;
    }


    /**
     * qq_GridField2: transformed from: qqds_GridField
     * TagId=4
     * In forte this was a 1x6 grid field.
     * The cell margins are all 50 mils
     * The width policy is set to Natural, and the height policy is set to Natural.
     */
    public GridField getqq_GridField2() {
        if (qq_GridField2 == null) {
            qq_GridField2 = CompoundFieldFactory.newGridField("");
            qq_GridField2.setFrameWeight(Constants.W_DEFAULT);
            qq_GridField2.setCellTopMargin(25);
            qq_GridField2.setCellBottomMargin(25);
            qq_GridField2.setCellLeftMargin(25);
            qq_GridField2.setCellRightMargin(25);
            qq_GridField2.setCellGravity(Constants.CG_TOPLEFT);
            qq_GridField2.setCollapsed(true);
            qq_GridField2.setInsertPolicy(Constants.IP_EXPAND);
            qq_GridField2.setHeightPolicy(Constants.SP_NATURAL);
            qq_GridField2.setWidthPolicy(Constants.SP_NATURAL);
            // OPTIONAL UIutils.reloadLabelText(qq_GridField2, mcat);
            qq_GridField2.setBackground(null);
            // OPTIONAL qq_GridField2.setSize(new Dimension(115, 153));
            // OPTIONAL qq_GridField2.setMinimumSize(new Dimension(115, 153));
            // OPTIONAL qq_GridField2.setPreferredSize(new Dimension(115, 153));
            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.NORTHWEST; // Gravity - original: CG_TOPLEFT gf
            qq_gbc.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc.insets = new Insets(2, 2, 2, 2); // Top, Left, Bottom, Right Margin
            qq_GridField2.add( getqq_Preferences_ConfirmRevert(), 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.NORTHWEST; // Gravity - original: CG_TOPLEFT gf
            qq_gbc1.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc1.insets = new Insets(2, 2, 2, 2); // Top, Left, Bottom, Right Margin
            qq_GridField2.add( getqq_Preferences_ConfirmCancel(), qq_gbc1 );

            GridBagConstraints qq_gbc2 = new GridBagConstraints();
            qq_gbc2.gridx = 0; // Column 1
            qq_gbc2.gridy = 2; // Row 3
            qq_gbc2.weightx = 0;
            qq_gbc2.weighty = 0;
            qq_gbc2.anchor = GridBagConstraints.NORTHWEST; // Gravity - original: CG_TOPLEFT gf
            qq_gbc2.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc2.insets = new Insets(2, 2, 2, 2); // Top, Left, Bottom, Right Margin
            qq_GridField2.add( getqq_Preferences_ConfirmClose(), qq_gbc2 );

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

            GridBagConstraints qq_gbc4 = new GridBagConstraints();
            qq_gbc4.gridx = 0; // Column 1
            qq_gbc4.gridy = 4; // Row 5
            qq_gbc4.weightx = 0;
            qq_gbc4.weighty = 0;
            qq_gbc4.anchor = GridBagConstraints.NORTHWEST; // Gravity - original: CG_TOPLEFT gf
            qq_gbc4.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc4.insets = new Insets(2, 2, 2, 2); // Top, Left, Bottom, Right Margin
            qq_GridField2.add( getqq_Preferences_ConfirmClear(), qq_gbc4 );

            GridBagConstraints qq_gbc5 = new GridBagConstraints();
            qq_gbc5.gridx = 0; // Column 1
            qq_gbc5.gridy = 5; // Row 6
            qq_gbc5.weightx = 0;
            qq_gbc5.weighty = 0;
            qq_gbc5.anchor = GridBagConstraints.NORTHWEST; // Gravity - original: CG_TOPLEFT gf
            qq_gbc5.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc5.insets = new Insets(2, 2, 2, 2); // Top, Left, Bottom, Right Margin
            qq_GridField2.add( getqq_Preferences_ConfirmDelete(), qq_gbc5 );

        }
        return qq_GridField2;
    }


    /**
     * qq_Preferences: transformed from: qqds_GridField
     * TagId=65531
     * In forte this was a 2x2 grid field, displaying a PreferencesDesc object.
     * The cell margins are all 100 mils
     * The width policy is set to Natural, and the height policy is set to Natural.
     */
    public GridField getqq_Preferences() {
        if (qq_Preferences == null) {
            qq_Preferences = CompoundFieldFactory.newGridField("Preferences");
            qq_Preferences.setCellTopMargin(50);
            qq_Preferences.setCellBottomMargin(50);
            qq_Preferences.setCellLeftMargin(50);
            qq_Preferences.setCellRightMargin(50);
            qq_Preferences.setCellGravity(Constants.CG_TOPLEFT);
            qq_Preferences.setIgnoreInvisibleChildren(true);
            qq_Preferences.setCollapsed(true);
            qq_Preferences.setInsertPolicy(Constants.IP_EXPAND);
            qq_Preferences.setHeightPolicy(Constants.SP_NATURAL);
            qq_Preferences.setWidthPolicy(Constants.SP_NATURAL);
            // OPTIONAL UIutils.reloadLabelText(qq_Preferences, mcat);
            qq_Preferences.setBackground(null);
            // OPTIONAL qq_Preferences.setSize(new Dimension(297, 201));
            // OPTIONAL qq_Preferences.setMinimumSize(new Dimension(297, 201));
            // OPTIONAL qq_Preferences.setPreferredSize(new Dimension(297, 201));
            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.NORTHWEST; // Gravity - original: CG_TOPLEFT 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_Preferences.add( getqq_Preferences_MaximumRecordsLabel(), 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.NORTHWEST; // Gravity - original: CG_TOPLEFT 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_Preferences.add( getqq_Preferences_MaxRecords(), 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.WEST; // Gravity - original: CG_MIDDLELEFT
            qq_gbc2.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc2.insets = new Insets(4, 24, 4, 4); // Top, Left, Bottom, Right Margin
            qq_Preferences.add( getqq_Preferences_ConfirmLabel(), qq_gbc2 );

            GridBagConstraints qq_gbc3 = new GridBagConstraints();
            qq_gbc3.gridx = 1; // Column 2
            qq_gbc3.gridy = 1; // Row 2
            qq_gbc3.weightx = 0;
            qq_gbc3.weighty = 0;
            qq_gbc3.anchor = GridBagConstraints.WEST; // Gravity - original: CG_MIDDLELEFT
            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_Preferences.add( getqq_GridField2(), qq_gbc3 );

        }
        return qq_Preferences;
    }


    /**
     * qq_GridField: transformed from: qqds_GridField
     * TagId=65535
     * 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.
     */
    public GridField getqq_GridField() {
        if (qq_GridField == null) {
            qq_GridField = CompoundFieldFactory.newGridField("");
            qq_GridField.setCellGravity(Constants.CG_TOPLEFT);
            qq_GridField.setIgnoreInvisibleChildren(true);
            qq_GridField.setCollapsed(true);
            qq_GridField.setInsertPolicy(Constants.IP_EXPAND);
            qq_GridField.setHeightPolicy(Constants.SP_NATURAL);
            qq_GridField.setWidthPolicy(Constants.SP_NATURAL);
            // OPTIONAL UIutils.reloadLabelText(qq_GridField, mcat);
            qq_GridField.setBackground(null);
            // OPTIONAL qq_GridField.setSize(new Dimension(297, 244));
            // OPTIONAL qq_GridField.setMinimumSize(new Dimension(297, 244));
            // OPTIONAL qq_GridField.setPreferredSize(new Dimension(297, 244));
            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.NORTHWEST; // Gravity - original: CG_TOPLEFT 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_GridField.add( getqq_Preferences(), qq_gbc );

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

        }
        return qq_GridField;
    }


    /**
     * Form: transformed from: qqds_Panel
     * TagId=1
     */
    public JPanel getForm() {
        if (Form == null) {
            Form = CompoundFieldFactory.newForm();
            Form.setLayout(new WindowFormLayout(this));
            Form.setOpaque( true );
            Form.add( getqq_GridField() );
        }
        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;
    UserWindow.setInitialPositionPolicy(this, policy);
}

/**
* 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.
     */
    private void initialize() {
        this.setName( "PreferencesWindow" );
        this.setTitle( "Preferences" );
        this.setSystemClosePolicy(Constants.SC_DISABLED);
        if (this.getContentPane() != this.getForm()) {
            this.setContentPane(getForm());
        }
        this.setResizable( false );
        this.setAlwaysOnTop(false);
        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_PRIMARYCENTERED);
    }


    // ----------------
    //  Window usage
    //-----------------
    private UsageMap[] usageUpdate;
    public UsageMap[] getUsageUpdate() {
        if (usageUpdate == null) {
            usageUpdate = new UsageMap[] {
                new UsageMap(getqq_GridField(), Constants.FS_UPDATE),
                new UsageMap(getqq_GridField1(), Constants.FS_UPDATE),
                new UsageMap(getqq_OKPB(), Constants.FS_UPDATE),
                new UsageMap(getqq_CancelPB(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmLabel(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences_MaximumRecordsLabel(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences_MaxRecords(), Constants.FS_UPDATE),
                new UsageMap(getqq_GridField2(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmRevert(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmCancel(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmClose(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmMode(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmClear(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmDelete(), Constants.FS_UPDATE),

            };
        }
        return usageUpdate;
    }
    private UsageMap[] usageView;
    public UsageMap[] getUsageView() {
        if (usageView == null) {
            usageView = new UsageMap[] {
                new UsageMap(getqq_GridField(), Constants.FS_UPDATE),
                new UsageMap(getqq_GridField1(), Constants.FS_UPDATE),
                new UsageMap(getqq_OKPB(), Constants.FS_VIEWONLY),
                new UsageMap(getqq_CancelPB(), Constants.FS_VIEWONLY),
                new UsageMap(getqq_Preferences(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmLabel(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences_MaximumRecordsLabel(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences_MaxRecords(), Constants.FS_VIEWONLY),
                new UsageMap(getqq_GridField2(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmRevert(), Constants.FS_VIEWONLY),
                new UsageMap(getqq_Preferences_ConfirmCancel(), Constants.FS_VIEWONLY),
                new UsageMap(getqq_Preferences_ConfirmClose(), Constants.FS_VIEWONLY),
                new UsageMap(getqq_Preferences_ConfirmMode(), Constants.FS_VIEWONLY),
                new UsageMap(getqq_Preferences_ConfirmClear(), Constants.FS_VIEWONLY),
                new UsageMap(getqq_Preferences_ConfirmDelete(), Constants.FS_VIEWONLY),

            };
        }
        return usageView;
    }
    private UsageMap[] usageQuery;
    public UsageMap[] getUsageQuery() {
        if (usageQuery == null) {
            usageQuery = new UsageMap[] {
                new UsageMap(getqq_GridField(), Constants.FS_UPDATE),
                new UsageMap(getqq_GridField1(), Constants.FS_UPDATE),
                new UsageMap(getqq_OKPB(), Constants.FS_UPDATE),
                new UsageMap(getqq_CancelPB(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmLabel(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences_MaximumRecordsLabel(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences_MaxRecords(), Constants.FS_UPDATE),
                new UsageMap(getqq_GridField2(), Constants.FS_QUERY),
                new UsageMap(getqq_Preferences_ConfirmRevert(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmCancel(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmClose(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmMode(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmClear(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmDelete(), Constants.FS_UPDATE),

            };
        }
        return usageQuery;
    }
    private UsageMap[] usageUser1;
    public UsageMap[] getUsageUser1() {
        if (usageUser1 == null) {
            usageUser1 = new UsageMap[] {
                new UsageMap(getqq_GridField(), Constants.FS_UPDATE),
                new UsageMap(getqq_GridField1(), Constants.FS_UPDATE),
                new UsageMap(getqq_OKPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_CancelPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmLabel(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences_MaximumRecordsLabel(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences_MaxRecords(), Constants.FS_UPDATE),
                new UsageMap(getqq_GridField2(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmRevert(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmCancel(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmClose(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmMode(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmClear(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmDelete(), Constants.FS_UPDATE),

            };
        }
        return usageUser1;
    }
    private UsageMap[] usageUser2;
    public UsageMap[] getUsageUser2() {
        if (usageUser2 == null) {
            usageUser2 = new UsageMap[] {
                new UsageMap(getqq_GridField(), Constants.FS_UPDATE),
                new UsageMap(getqq_GridField1(), Constants.FS_UPDATE),
                new UsageMap(getqq_OKPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_CancelPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmLabel(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences_MaximumRecordsLabel(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences_MaxRecords(), Constants.FS_UPDATE),
                new UsageMap(getqq_GridField2(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmRevert(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmCancel(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmClose(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmMode(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmClear(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmDelete(), Constants.FS_UPDATE),

            };
        }
        return usageUser2;
    }
    private UsageMap[] usageUser3;
    public UsageMap[] getUsageUser3() {
        if (usageUser3 == null) {
            usageUser3 = new UsageMap[] {
                new UsageMap(getqq_GridField(), Constants.FS_UPDATE),
                new UsageMap(getqq_GridField1(), Constants.FS_UPDATE),
                new UsageMap(getqq_OKPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_CancelPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmLabel(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences_MaximumRecordsLabel(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Preferences_MaxRecords(), Constants.FS_UPDATE),
                new UsageMap(getqq_GridField2(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmRevert(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmCancel(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmClose(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmMode(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmClear(), Constants.FS_UPDATE),
                new UsageMap(getqq_Preferences_ConfirmDelete(), Constants.FS_UPDATE),

            };
        }
        return usageUser3;
    }
    protected int Usage = 0;
    public int getUsage() {
        if (Usage == 0) {
            this.setUsage(DisplayProject.Constants.WU_UPDATE);
        }
        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 u) {
        if (this.Usage != u) {
            this.Usage = u;
            UsageMap[] usage = null;
            switch (u) {
                case  DisplayProject.Constants.WU_UPDATE:
                    usage = this.getUsageUpdate();
                    break;
                case  DisplayProject.Constants.WU_VIEW:
                    usage = this.getUsageView();
                    break;
                case  DisplayProject.Constants.WU_QUERY:
                    usage = this.getUsageQuery();
                    break;
                case  DisplayProject.Constants.WU_USER1:
                    usage = this.getUsageUser1();
                    break;
                case  DisplayProject.Constants.WU_USER2:
                    usage = this.getUsageUser2();
                    break;
                case  DisplayProject.Constants.WU_USER3:
                    usage = this.getUsageUser3();
                    break;
                default:
                    throw new UsageException("Window usage " + u + " is unknown." );
            }
            for (int i = 0 ; i < usage.length; i++) {
                WidgetState.set((JComponent)usage[i].getComponent(), usage[i].getState());
            }
        }
    }
    // </editor-fold>

    // -----------
    // Main method
    // -----------
    public static void main(String []args) {
        KeyboardFocusManager.setCurrentKeyboardFocusManager(new ForteKeyboardFocusManager());
        try {
            // To change to platform look and feel, uncomment the following line,
            // and remove the WindowsClassicLookAndFeel
            // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            // Forte displayed windows with a clasic Look and Feel
            UIManager.setLookAndFeel(new WindowsClassicLookAndFeel());
        }
        catch (Exception e) {}
        ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);
        PreferencesWindow myClass = new PreferencesWindow();
        myClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        myClass.setVisible(true);
        UIutils.processGUIActions();
    }
// end class PreferencesWindow
// c Pass 2 Conversion Time: 672 milliseconds
TOP

Related Classes of Express.windows.PreferencesWindow

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.