Package Express.windows

Source Code of Express.windows.ConfirmationWindow

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.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.ToolTipManager;
import javax.swing.UIManager;

import DisplayProject.CloseHideAdaptor;
import DisplayProject.Constants;
import DisplayProject.CursorMgr;
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.Focus;
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.PictureGraphic;
import DisplayProject.controls.TextGraphic;
import DisplayProject.events.ClientEventManager;
import DisplayProject.factory.CompoundFieldFactory;
import DisplayProject.factory.GraphicFactory;
import DisplayProject.factory.PushButtonFactory;
import DisplayProject.factory.ToggleFieldFactory;
import Framework.Application;
import Framework.BooleanData;
import Framework.ErrorMgr;
import Framework.EventHandle;
import Framework.EventManager;
import Framework.EventRegistration;
import Framework.File;
import Framework.ForteKeyboardFocusManager;
import Framework.ImageData;
import Framework.RuntimeProperties;
import Framework.TextData;
import Framework.UsageException;

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

/**
* The ConfirmationWindow class defines a message dialog with a set of predefined buttons that allow the end user to confirm an operation, accept or deny an optional behavior in that operation, or cancel the operation.
* <p>
* @author ITerative Consulting
* @since  26-Feb-2008
*/
@RuntimeProperties(isDistributed=false, isAnchored=false, isShared=false, isTransactional=false)
@SuppressWarnings("serial")
public class ConfirmationWindow
        extends JFrame
        implements Serializable, Observable
{

    // ----------
    // Attributes
    // ----------
    protected File DefaultHelpFile;
    protected BindingManager bindingManager = null;
    public PropertyChangeSupport qq_Listeners = new ExtendedPropertyChangeSupport(this, true);
    private boolean stopMessage;

    // ------------
    // Constructors
    // ------------
    public ConfirmationWindow() {
        // Explicitly call the superclass constructor to prevent the implicit call
        super();
        this.initialize();
        this.stopMessage = false;
    }

    // ----------------------
    // 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 setStopMessage(boolean stopMessage) {
        boolean oldValue = this.stopMessage;
        this.stopMessage = stopMessage;
        this.qq_Listeners.firePropertyChange("stopMessage", oldValue, this.stopMessage);
    }

    public boolean getStopMessage() {
        return this.stopMessage;
    }

    // -------
    // 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>
     * @param messageText Type: TextData
     * @param windowName Type: TextData
     * @param buttonSet Type: int
     * @param defaultButton Type: int
     * @param wrapWidth Type: int (Input) (default in Forte: 50)
     * @param confirmAgain Type: BooleanData
     * @param appBroker Type: ApplicationBroker
     * @return int
     */
    public int display(TextData messageText, TextData windowName, int buttonSet, int defaultButton, int wrapWidth, BooleanData confirmAgain, ApplicationBroker appBroker) {
        int retButton = 0;

        if (Application.getMsgCatalog().isPresent()) {
            UIutils.reloadLabelText(this, Application.getMsgCatalog());
        }
        TextData.bind(this, "title").setValue( appBroker.getLocalString(ApplicationBroker.MS_MESSAGE_SET, ApplicationBroker.MN_TITLE_CONFIRM_WIN) );
        TextData.bind(this, "title").replaceParameters(TextData.bind(this, "title"), windowName);
        TextData.bind(this.getqq_Message(), "text").setValue( messageText.wrapText(50, 4) );

        switch (buttonSet) {
            case JOptionPane.OK_CANCEL_OPTION: {
                WidgetState.set(this.getqq_YesPB(), Constants.FS_INVISIBLE);
                WidgetState.set(this.getqq_NoPB(), Constants.FS_INVISIBLE);

                break;
            }
            case JOptionPane.YES_NO_OPTION: {
                WidgetState.set(this.getqq_OKPB(), Constants.FS_INVISIBLE);
                WidgetState.set(this.getqq_CancelPB(), Constants.FS_INVISIBLE);

                break;
            }
            case JOptionPane.YES_NO_CANCEL_OPTION: {
                WidgetState.set(this.getqq_OKPB(), Constants.FS_INVISIBLE);

                break;
            }
        }

        UserWindow.open(this, true);

        switch (defaultButton) {
// AGD 26/2/2008 Commented out in because duplicate
// It had been commented out in the last release 
//            case JOptionPane.OK_OPTION: {
//                DefaultButton.set(this.getqq_OKPB(), true);
//                Focus.set(this.getqq_OKPB());
//
//                break;
//            }
            case JOptionPane.YES_OPTION: {
                DefaultButton.set(this.getqq_YesPB(), true);
                Focus.set(this.getqq_YesPB());

                break;
            }
            case JOptionPane.NO_OPTION: {
                DefaultButton.set(this.getqq_NoPB(), true);
                Focus.set(this.getqq_NoPB());

                break;
            }
            case JOptionPane.CANCEL_OPTION: {
                DefaultButton.set(this.getqq_CancelPB(), true);
                Focus.set(this.getqq_CancelPB());

                break;
            }
        }

        // ----------
        // Event Loop
        // ----------
        EventManager.startEventLoop();
        try {
            EventRegistration TaskHandle_Shutdown_TaskcurrentTask = ClientEventManager.register( Thread.currentThread(), "Shutdown" );
            EventRegistration PushButton_Click_getqq_YesPB = ClientEventManager.register( this.getqq_YesPB(), "Click" );
            EventRegistration PushButton_Click_getqq_NoPB = ClientEventManager.register( this.getqq_NoPB(), "Click" );
            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();
                    }
                }

                // -------------
                // <YesPB>.click
                // -------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_YesPB)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        retButton = JOptionPane.YES_OPTION;
                        break;

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

                // ------------
                // <NoPB>.click
                // ------------
                else if (qq_currentEvent.isEvent(PushButton_Click_getqq_NoPB)) {
                    try {
                        CursorMgr.startEvent();
                        // ================ Begin Forte Event Handler Translation ================
                        retButton = JOptionPane.NO_OPTION;
                        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 ================
                        retButton = JOptionPane.OK_OPTION;
                        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 ================
                        retButton = JOptionPane.CANCEL_OPTION;
                        break;
                        // ================ End Forte Event Handler Translation ================
                    }
                    finally {
                        CursorMgr.endEvent();
                    }
                }
            }
            EventManager.deregister( TaskHandle_Shutdown_TaskcurrentTask );
            EventManager.deregister( PushButton_Click_getqq_YesPB );
            EventManager.deregister( PushButton_Click_getqq_NoPB );
            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);
        }

        if (confirmAgain != null) {
            if (this.getStopMessage() == true) {
                confirmAgain.setValue(false);
            }
        }

        return retButton;
    }

    // ------------------
    // 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 GridField qq_GridField1;
    public GridField qq_GridField2;
    public GridField qq_GridField;
    public JButton qq_CancelPB;
    public JButton qq_NoPB;
    public JButton qq_OKPB;
    public JButton qq_YesPB;
    public JCheckBox qq_StopMessage;
    public JPanel Form;
    public PictureGraphic qq_PictureGraphic;
    public TextGraphic qq_Message;

    /**
     * qq_PictureGraphic: transformed from: qqds_PictureGraphic
     * TagId=1
     */
    public PictureGraphic getqq_PictureGraphic() {
        if (qq_PictureGraphic == null) {
            qq_PictureGraphic = GraphicFactory.newPictureGraphic("", Constants.CG_CENTER);
            qq_PictureGraphic.setImageValue(new ImageData(new ImageIcon(getClass().getClassLoader().getResource("Express/windows/ConfirmationWindow.qq_PictureGraphic.png"))));
            qq_PictureGraphic.setName("");
            qq_PictureGraphic.setWidthPolicy(Constants.SP_NATURAL);
            qq_PictureGraphic.setHeightPolicy(Constants.SP_NATURAL);
            qq_PictureGraphic.setImageSizePolicy(Constants.IS_FIELD);
            qq_PictureGraphic.setOpaque( true );
            qq_PictureGraphic.setSize(new Dimension(33, 33));
            qq_PictureGraphic.setMinimumSize(new Dimension(33, 33));
            qq_PictureGraphic.setPreferredSize(new Dimension(33, 33));
        }
        return qq_PictureGraphic;
    }


    /**
     * qq_Message: transformed from: qqds_TextGraphic
     * TagId=65532
     */
    public TextGraphic getqq_Message() {
        if (qq_Message == null) {
            qq_Message = GraphicFactory.newTextGraphic("Message text goes here.\n", "Message");
            // OPTIONAL UIutils.reloadLabelText(qq_Message, mcat);
            WidthPolicy.set(qq_Message, Constants.SP_NATURAL);
            HeightPolicy.set(qq_Message, Constants.SP_NATURAL);
            qq_Message.setPreferredSize(UIutils.labelWidth(qq_Message));
        }
        return qq_Message;
    }


    /**
     * qq_GridField1: transformed from: qqds_GridField
     * TagId=65534
     * In forte this was a 2x1 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_GridField1() {
        if (qq_GridField1 == null) {
            qq_GridField1 = CompoundFieldFactory.newGridField("");
            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(259, 71));
            // OPTIONAL qq_GridField1.setMinimumSize(new Dimension(259, 71));
            // OPTIONAL qq_GridField1.setPreferredSize(new Dimension(259, 71));
            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
            qq_gbc.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc.insets = new Insets(19, 19, 19, 19); // Top, Left, Bottom, Right Margin
            qq_GridField1.add( getqq_PictureGraphic(), 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
            qq_gbc1.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc1.insets = new Insets(0, 19, 0, 19); // Top, Left, Bottom, Right Margin
            qq_GridField1.add( getqq_Message(), qq_gbc1 );

        }
        return qq_GridField1;
    }


    /**
     * qq_YesPB: transformed from: qqds_PushButton
     * TagId=65530
     */
    public JButton getqq_YesPB() {
        if (qq_YesPB == null) {
            qq_YesPB = PushButtonFactory.newInstance("YesPB", "Yes");
            UIutils.setMsgSet(qq_YesPB, 60100);
            UIutils.setMsgNumber(qq_YesPB, 158);
            qq_YesPB.setVerifyInputWhenFocusTarget(true);
            // OPTIONAL UIutils.reloadLabelText(qq_YesPB, mcat);
            WidthPolicy.set(qq_YesPB, Constants.SP_TO_PARTNER);
            HeightPolicy.set(qq_YesPB, Constants.SP_TO_PARTNER);
            LayoutManagerHelper.setHeightPartner(qq_YesPB, getqq_NoPB());
            LayoutManagerHelper.setWidthPartner(qq_YesPB, getqq_NoPB());
            // OPTIONAL qq_YesPB.setSize(new Dimension(64, 31));
            qq_YesPB.setMinimumSize(new Dimension(64, 31));
            qq_YesPB.setPreferredSize(new Dimension(64, 31));
        }
        return qq_YesPB;
    }


    /**
     * qq_NoPB: transformed from: qqds_PushButton
     * TagId=65529
     */
    public JButton getqq_NoPB() {
        if (qq_NoPB == null) {
            qq_NoPB = PushButtonFactory.newInstance("NoPB", "No");
            UIutils.setMsgSet(qq_NoPB, 60100);
            UIutils.setMsgNumber(qq_NoPB, 155);
            qq_NoPB.setVerifyInputWhenFocusTarget(true);
            // OPTIONAL UIutils.reloadLabelText(qq_NoPB, mcat);
            WidthPolicy.set(qq_NoPB, Constants.SP_TO_PARTNER);
            HeightPolicy.set(qq_NoPB, Constants.SP_TO_PARTNER);
            LayoutManagerHelper.setHeightPartner(qq_NoPB, getqq_OKPB());
            LayoutManagerHelper.setWidthPartner(qq_NoPB, getqq_OKPB());
            // OPTIONAL qq_NoPB.setSize(new Dimension(64, 31));
            qq_NoPB.setMinimumSize(new Dimension(64, 31));
            qq_NoPB.setPreferredSize(new Dimension(64, 31));
        }
        return qq_NoPB;
    }


    /**
     * qq_OKPB: transformed from: qqds_PushButton
     * TagId=65528
     */
    public JButton getqq_OKPB() {
        if (qq_OKPB == null) {
            qq_OKPB = PushButtonFactory.newInstance("OKPB", "OK");
            UIutils.setMsgSet(qq_OKPB, 60100);
            UIutils.setMsgNumber(qq_OKPB, 156);
            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(64, 31));
            qq_OKPB.setMinimumSize(new Dimension(64, 31));
            qq_OKPB.setPreferredSize(new Dimension(64, 31));
        }
        return qq_OKPB;
    }


    /**
     * qq_CancelPB: transformed from: qqds_PushButton
     * TagId=65527
     */
    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_YesPB());
            LayoutManagerHelper.setWidthPartner(qq_CancelPB, getqq_YesPB());
            // OPTIONAL qq_CancelPB.setSize(new Dimension(64, 31));
            qq_CancelPB.setMinimumSize(new Dimension(64, 31));
            qq_CancelPB.setPreferredSize(new Dimension(64, 31));
        }
        return qq_CancelPB;
    }


    /**
     * qq_GridField2: transformed from: qqds_GridField
     * TagId=65531
     * In forte this was a 4x1 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_GridField2() {
        if (qq_GridField2 == null) {
            qq_GridField2 = CompoundFieldFactory.newGridField("");
            qq_GridField2.setCellTopMargin(50);
            qq_GridField2.setCellBottomMargin(50);
            qq_GridField2.setCellLeftMargin(50);
            qq_GridField2.setCellRightMargin(50);
            qq_GridField2.setCellGravity(Constants.CG_CENTER);
            qq_GridField2.setIgnoreInvisibleChildren(true);
            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(309, 52));
            // OPTIONAL qq_GridField2.setMinimumSize(new Dimension(309, 52));
            // OPTIONAL qq_GridField2.setPreferredSize(new Dimension(309, 52));
            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_GridField2.add( getqq_YesPB(), 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_GridField2.add( getqq_NoPB(), qq_gbc1 );

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

            GridBagConstraints qq_gbc3 = new GridBagConstraints();
            qq_gbc3.gridx = 3; // Column 4
            qq_gbc3.gridy = 0; // Row 1
            qq_gbc3.weightx = 0;
            qq_gbc3.weighty = 0;
            qq_gbc3.anchor = GridBagConstraints.CENTER; // Gravity - original: CG_CENTER 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_GridField2.add( getqq_CancelPB(), qq_gbc3 );

        }
        return qq_GridField2;
    }


    /**
     * qq_StopMessage: transformed from: qqds_ToggleField
     * TagId=65526
     */
    public JCheckBox getqq_StopMessage() {
        if (qq_StopMessage == null) {
            qq_StopMessage = ToggleFieldFactory.newToggleField("Do not confirm this operation in the future.", "StopMessage");
            getBindingManager().bindComponent(qq_StopMessage, "stopMessage");
            UIutils.setMsgSet(qq_StopMessage, 60100);
            UIutils.setMsgNumber(qq_StopMessage, 604);
            // OPTIONAL UIutils.reloadLabelText(qq_StopMessage, mcat);
        }
        return qq_StopMessage;
    }


    /**
     * qq_GridField: transformed from: qqds_GridField
     * TagId=65535
     * In forte this was a 1x3 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_CENTER);
            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(309, 146));
            // OPTIONAL qq_GridField.setMinimumSize(new Dimension(309, 146));
            // OPTIONAL qq_GridField.setPreferredSize(new Dimension(309, 146));
            GridBagConstraints qq_gbc = new GridBagConstraints();
            qq_gbc.gridx = 0; // Column 1
            qq_gbc.gridy = 0; // Row 1
            qq_gbc.weightx = 0;
            qq_gbc.weighty = 0;
            qq_gbc.anchor = GridBagConstraints.WEST; // Gravity - original: CG_MIDDLELEFT
            qq_gbc.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc.insets = new Insets(0, 0, 0, 0); // Top, Left, Bottom, Right Margin
            qq_GridField.add( getqq_GridField1(), qq_gbc );

            GridBagConstraints qq_gbc1 = new GridBagConstraints();
            qq_gbc1.gridx = 0; // Column 1
            qq_gbc1.gridy = 1; // Row 2
            qq_gbc1.weightx = 0;
            qq_gbc1.weighty = 0;
            qq_gbc1.anchor = GridBagConstraints.CENTER; // Gravity - original: CG_CENTER gf
            qq_gbc1.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc1.insets = new Insets(0, 0, 0, 0); // Top, Left, Bottom, Right Margin
            qq_GridField.add( getqq_GridField2(), 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.WEST; // Gravity - original: CG_MIDDLELEFT
            qq_gbc2.fill = GridBagConstraints.NONE; // Size to parent - original: No size to parent
            qq_gbc2.insets = new Insets(0, 4, 0, 0); // Top, Left, Bottom, Right Margin
            qq_GridField.add( getqq_StopMessage(), qq_gbc2 );

        }
        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( "ConfirmationWindow" );
        this.setTitle( "Question" );
        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_PictureGraphic(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Message(), Constants.FS_INACTIVE),
                new UsageMap(getqq_GridField2(), Constants.FS_UPDATE),
                new UsageMap(getqq_YesPB(), Constants.FS_UPDATE),
                new UsageMap(getqq_NoPB(), Constants.FS_UPDATE),
                new UsageMap(getqq_OKPB(), Constants.FS_UPDATE),
                new UsageMap(getqq_CancelPB(), Constants.FS_UPDATE),
                new UsageMap(getqq_StopMessage(), 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_PictureGraphic(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Message(), Constants.FS_INACTIVE),
                new UsageMap(getqq_GridField2(), Constants.FS_UPDATE),
                new UsageMap(getqq_YesPB(), Constants.FS_VIEWONLY),
                new UsageMap(getqq_NoPB(), Constants.FS_VIEWONLY),
                new UsageMap(getqq_OKPB(), Constants.FS_VIEWONLY),
                new UsageMap(getqq_CancelPB(), Constants.FS_VIEWONLY),
                new UsageMap(getqq_StopMessage(), Constants.FS_VIEWONLY),

            };
        }
        return usageView;
    }
    private UsageMap[] usageQuery;
    public UsageMap[] getUsageQuery() {
        if (usageQuery == null) {
            usageQuery = new UsageMap[] {
                new UsageMap(getqq_GridField(), Constants.FS_QUERY),
                new UsageMap(getqq_GridField1(), Constants.FS_QUERY),
                new UsageMap(getqq_PictureGraphic(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Message(), Constants.FS_INACTIVE),
                new UsageMap(getqq_GridField2(), Constants.FS_QUERY),
                new UsageMap(getqq_YesPB(), Constants.FS_QUERY),
                new UsageMap(getqq_NoPB(), Constants.FS_QUERY),
                new UsageMap(getqq_OKPB(), Constants.FS_QUERY),
                new UsageMap(getqq_CancelPB(), Constants.FS_QUERY),
                new UsageMap(getqq_StopMessage(), Constants.FS_QUERY),

            };
        }
        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_PictureGraphic(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Message(), Constants.FS_INACTIVE),
                new UsageMap(getqq_GridField2(), Constants.FS_UPDATE),
                new UsageMap(getqq_YesPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_NoPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_OKPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_CancelPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_StopMessage(), 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_PictureGraphic(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Message(), Constants.FS_INACTIVE),
                new UsageMap(getqq_GridField2(), Constants.FS_UPDATE),
                new UsageMap(getqq_YesPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_NoPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_OKPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_CancelPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_StopMessage(), 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_PictureGraphic(), Constants.FS_INACTIVE),
                new UsageMap(getqq_Message(), Constants.FS_INACTIVE),
                new UsageMap(getqq_GridField2(), Constants.FS_UPDATE),
                new UsageMap(getqq_YesPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_NoPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_OKPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_CancelPB(), Constants.FS_INACTIVE),
                new UsageMap(getqq_StopMessage(), 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);
        ConfirmationWindow myClass = new ConfirmationWindow();
        myClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        myClass.setVisible(true);
        UIutils.processGUIActions();
    }
// end class ConfirmationWindow
// c Pass 2 Conversion Time: 844 milliseconds
TOP

Related Classes of Express.windows.ConfirmationWindow

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.