Package Express.windows

Source Code of Express.windows.ButtonSetDesc

package Express.windows;

import java.io.Serializable;

import javax.swing.JButton;
import javax.swing.JComponent;

import DisplayProject.Array_Of_JComponent;
import DisplayProject.Constants;
import DisplayProject.GridField;
import DisplayProject.actions.DefaultButton;
import DisplayProject.actions.Parent;
import DisplayProject.actions.WidgetState;
import DisplayProject.binding.beans.Observable;
import Framework.RuntimeProperties;

/**
* The ButtonSetDesc class defines the common features of the push button commands for generated windows that use the push button command interface.
* The ButtonSetDesc class is always used in the context of a {@link CommandMgr} object. The window calls the {@link CommandMgr} to request actions on commands.
* The {@link CommandMgr} uses the ButtonSetDesc to carry out the requests if the window uses the push button command interface.
* <p>
* @author ITerative Consulting
* @since  26-Feb-2008
*/
@RuntimeProperties(isDistributed=false, isAnchored=false, isShared=false, isTransactional=false)
@SuppressWarnings("serial")
public class ButtonSetDesc
        extends CommandSetDesc
        implements Serializable, Observable
{

    // ----------
    // Attributes
    // ----------
    private GridField buttonGrid;
    private JButton cancelCMD;
    private JButton clearCMD;
    private JButton deleteCMD;
    private JButton firstCMD;
    private GridField indexesGrid;
    private JButton insertCMD;
    private JButton lastCMD;
    private JButton nextCMD;
    private JButton oKCMD;
    private JButton prevCMD;
    private GridField scrollBCGrid;
    private JButton searchCMD;
    private GridField sideBCGrid;

    // ------------
    // Constructors
    // ------------
    public ButtonSetDesc() {
        // Explicitly call the superclass constructor to prevent the implicit call
        super();
        this.buttonGrid = null;
        this.cancelCMD = null;
        this.clearCMD = null;
        this.deleteCMD = null;
        this.firstCMD = null;
        this.indexesGrid = null;
        this.insertCMD = null;
        this.lastCMD = null;
        this.nextCMD = null;
        this.oKCMD = null;
        this.prevCMD = null;
        this.scrollBCGrid = null;
        this.searchCMD = null;
        this.sideBCGrid = null;
    }

    // ----------------------
    // Accessors and Mutators
    // ----------------------
    public void setButtonGrid(GridField buttonGrid) {
        GridField oldValue = this.buttonGrid;
        this.buttonGrid = buttonGrid;
        this.qq_Listeners.firePropertyChange("buttonGrid", oldValue, this.buttonGrid);
    }

    public GridField getButtonGrid() {
        return this.buttonGrid;
    }

    public void setCancelCMD(JButton cancelCMD) {
        JButton oldValue = this.cancelCMD;
        this.cancelCMD = cancelCMD;
        this.qq_Listeners.firePropertyChange("cancelCMD", oldValue, this.cancelCMD);
    }

    public JButton getCancelCMD() {
        return this.cancelCMD;
    }

    public void setClearCMD(JButton clearCMD) {
        JButton oldValue = this.clearCMD;
        this.clearCMD = clearCMD;
        this.qq_Listeners.firePropertyChange("clearCMD", oldValue, this.clearCMD);
    }

    public JButton getClearCMD() {
        return this.clearCMD;
    }

    public void setDeleteCMD(JButton deleteCMD) {
        JButton oldValue = this.deleteCMD;
        this.deleteCMD = deleteCMD;
        this.qq_Listeners.firePropertyChange("deleteCMD", oldValue, this.deleteCMD);
    }

    public JButton getDeleteCMD() {
        return this.deleteCMD;
    }

    public void setFirstCMD(JButton firstCMD) {
        JButton oldValue = this.firstCMD;
        this.firstCMD = firstCMD;
        this.qq_Listeners.firePropertyChange("firstCMD", oldValue, this.firstCMD);
    }

    public JButton getFirstCMD() {
        return this.firstCMD;
    }

    public void setIndexesGrid(GridField indexesGrid) {
        GridField oldValue = this.indexesGrid;
        this.indexesGrid = indexesGrid;
        this.qq_Listeners.firePropertyChange("indexesGrid", oldValue, this.indexesGrid);
    }

    public GridField getIndexesGrid() {
        return this.indexesGrid;
    }

    public void setInsertCMD(JButton insertCMD) {
        JButton oldValue = this.insertCMD;
        this.insertCMD = insertCMD;
        this.qq_Listeners.firePropertyChange("insertCMD", oldValue, this.insertCMD);
    }

    public JButton getInsertCMD() {
        return this.insertCMD;
    }

    public void setLastCMD(JButton lastCMD) {
        JButton oldValue = this.lastCMD;
        this.lastCMD = lastCMD;
        this.qq_Listeners.firePropertyChange("lastCMD", oldValue, this.lastCMD);
    }

    public JButton getLastCMD() {
        return this.lastCMD;
    }

    public void setNextCMD(JButton nextCMD) {
        JButton oldValue = this.nextCMD;
        this.nextCMD = nextCMD;
        this.qq_Listeners.firePropertyChange("nextCMD", oldValue, this.nextCMD);
    }

    public JButton getNextCMD() {
        return this.nextCMD;
    }

    public void setOKCMD(JButton oKCMD) {
        JButton oldValue = this.oKCMD;
        this.oKCMD = oKCMD;
        this.qq_Listeners.firePropertyChange("OKCMD", oldValue, this.oKCMD);
    }

    public JButton getOKCMD() {
        return this.oKCMD;
    }

    public void setPrevCMD(JButton prevCMD) {
        JButton oldValue = this.prevCMD;
        this.prevCMD = prevCMD;
        this.qq_Listeners.firePropertyChange("prevCMD", oldValue, this.prevCMD);
    }

    public JButton getPrevCMD() {
        return this.prevCMD;
    }

    public void setScrollBCGrid(GridField scrollBCGrid) {
        GridField oldValue = this.scrollBCGrid;
        this.scrollBCGrid = scrollBCGrid;
        this.qq_Listeners.firePropertyChange("scrollBCGrid", oldValue, this.scrollBCGrid);
    }

    public GridField getScrollBCGrid() {
        return this.scrollBCGrid;
    }

    public void setSearchCMD(JButton searchCMD) {
        JButton oldValue = this.searchCMD;
        this.searchCMD = searchCMD;
        this.qq_Listeners.firePropertyChange("searchCMD", oldValue, this.searchCMD);
    }

    public JButton getSearchCMD() {
        return this.searchCMD;
    }

    public void setSideBCGrid(GridField sideBCGrid) {
        GridField oldValue = this.sideBCGrid;
        this.sideBCGrid = sideBCGrid;
        this.qq_Listeners.firePropertyChange("sideBCGrid", oldValue, this.sideBCGrid);
    }

    public GridField getSideBCGrid() {
        return this.sideBCGrid;
    }

    // -------
    // Methods
    // -------
    /**
     * getDefault<p>
     * GetDefault<br>
     *      GetDefault returns the ID of the default button.<br>
     * <p>
     * @return int
     */
    public int getDefault() {
        if (DefaultButton.is(this.getCancelCMD()) == true) {
            return CommandMgr.C_WC_CANCEL;

        }
        else if (DefaultButton.is(this.getClearCMD()) == true) {
            return CommandMgr.C_RS_CLEAR;

        }
        else if (DefaultButton.is(this.getInsertCMD()) == true) {
            return CommandMgr.C_RS_INSERT;

        }
        else if (DefaultButton.is(this.getDeleteCMD()) == true) {
            return CommandMgr.C_RS_DELETE;

        }
        else if (DefaultButton.is(this.getOKCMD()) == true) {
            return CommandMgr.C_WC_OK;

        }
        else if (DefaultButton.is(this.getFirstCMD()) == true) {
            return CommandMgr.C_RS_FIRST;

        }
        else if (DefaultButton.is(this.getLastCMD()) == true) {
            return CommandMgr.C_RS_LAST;

        }
        else if (DefaultButton.is(this.getNextCMD()) == true) {
            return CommandMgr.C_RS_NEXT;

        }
        else if (DefaultButton.is(this.getPrevCMD()) == true) {
            return CommandMgr.C_RS_PREV;

        }
        else if (DefaultButton.is(this.getSearchCMD()) == true) {
            return CommandMgr.C_RS_SEARCH;
        }

        return CommandMgr.C_NONE;
    }

    /**
     * getState<p>
     * GetState<br>
     *      GetState returns the enabled/disabled state of the<br>
     *     given button.<br>
     * <p>
     *     Returns TRUE if button enabled, FALSE if disabled.<br>
     * <p>
     * @param command Type: int
     * @return boolean
     */
    public boolean getState(int command) {
        switch (command) {
            case CommandMgr.C_WC_CANCEL: {
                if (this.getCancelCMD() != null && (WidgetState.get(this.getCancelCMD()) == Constants.FS_UPDATE || WidgetState.get(this.getCancelCMD()) == Constants.FS_USAGESTATE)) {
                    return true;
                }
                else {
                    return false;
                }

            }
            case CommandMgr.C_RS_CLEAR: {
                if (this.getClearCMD() != null && (WidgetState.get(this.getClearCMD()) == Constants.FS_UPDATE || WidgetState.get(this.getClearCMD()) == Constants.FS_USAGESTATE)) {
                    return true;
                }
                else {
                    return false;
                }

            }
            case CommandMgr.C_WC_OK: {
                if (this.getOKCMD() != null && WidgetState.get(this.getOKCMD()) == Constants.FS_UPDATE) {
                    return true;
                }
                else {
                    return false;
                }

            }
            case CommandMgr.C_RS_INSERT: {
                if (this.getInsertCMD() != null && (WidgetState.get(this.getInsertCMD()) == Constants.FS_UPDATE || WidgetState.get(this.getInsertCMD()) == Constants.FS_USAGESTATE)) {
                    return true;
                }
                else {
                    return false;
                }

            }
            case CommandMgr.C_RS_DELETE: {
                if (this.getDeleteCMD() != null && WidgetState.get(this.getDeleteCMD()) == Constants.FS_UPDATE) {
                    return true;
                }
                else {
                    return false;
                }

            }
            case CommandMgr.C_RS_FIRST: {
                if (this.getFirstCMD() != null && WidgetState.get(this.getFirstCMD()) == Constants.FS_UPDATE) {
                    return true;
                }
                else {
                    return false;
                }

            }
            case CommandMgr.C_RS_LAST: {
                if (this.getLastCMD() != null && WidgetState.get(this.getLastCMD()) == Constants.FS_UPDATE) {
                    return true;
                }
                else {
                    return false;
                }

            }
            case CommandMgr.C_RS_NEXT: {
                if (this.getNextCMD() != null && WidgetState.get(this.getNextCMD()) == Constants.FS_UPDATE) {
                    return true;
                }
                else {
                    return false;
                }

            }
            case CommandMgr.C_RS_PREV: {
                if (this.getPrevCMD() != null && WidgetState.get(this.getPrevCMD()) == Constants.FS_UPDATE) {
                    return true;
                }
                else {
                    return false;
                }

            }
            case CommandMgr.C_RS_SEARCH: {
                if (this.getSearchCMD() != null && WidgetState.get(this.getSearchCMD()) == Constants.FS_UPDATE) {
                    return true;
                }
                else {
                    return false;
                }

            }
        }

        //
        // Should never get here, but if we do, return FALSE
        //
        return false;
    }

    /**
     * hideCommand<p>
     * HideCommand<br>
     *      HideCommand makes the command invisible to the user.<br>
     * <p>
     * @param command Type: int
     */
    public void hideCommand(int command) {
        switch (command) {
            case CommandMgr.C_WC_CANCEL: {
                if (this.getCancelCMD() != null) {
                    this.hideCommand(this.getCancelCMD());
                }

                break;
            }
            case CommandMgr.C_RS_CLEAR: {
                if (this.getClearCMD() != null) {
                    this.hideCommand(this.getClearCMD());
                }

                break;
            }
            case CommandMgr.C_RS_INSERT: {
                if (this.getInsertCMD() != null) {
                    this.hideCommand(this.getInsertCMD());
                }

                break;
            }
            case CommandMgr.C_RS_DELETE: {
                if (this.getDeleteCMD() != null) {
                    this.hideCommand(this.getDeleteCMD());
                }

                break;
            }
            case CommandMgr.C_WC_OK: {
                if (this.getOKCMD() != null) {
                    this.hideCommand(this.getOKCMD());
                }

                break;
            }
            case CommandMgr.C_RS_FIRST: {
                if (this.getFirstCMD() != null) {
                    this.hideCommand(this.getFirstCMD());
                }

                break;
            }
            case CommandMgr.C_RS_INDEXES: {
                if (this.getIndexesGrid() != null) {
                    this.hideCommand(this.getIndexesGrid());
                    this.hideCommand(this.getScrollBCGrid());
                }

                break;
            }
            case CommandMgr.C_RS_LAST: {
                if (this.getLastCMD() != null) {
                    this.hideCommand(this.getLastCMD());
                }

                break;
            }
            case CommandMgr.C_RS_NEXT: {
                if (this.getNextCMD() != null) {
                    this.hideCommand(this.getNextCMD());
                }

                break;
            }
            case CommandMgr.C_RS_PREV: {
                if (this.getPrevCMD() != null) {
                    this.hideCommand(this.getPrevCMD());
                }

                break;
            }
            case CommandMgr.C_RS_SEARCH: {
                if (this.getSearchCMD() != null) {
                    this.hideCommand(this.getSearchCMD());
                }

                break;
            }
        }
    }

    /**
     * hideCommand<p>
     * HideCommand<br>
     *     HideCommand makes a command invisible and<br>
     *     makes it's parent GridFields invisible if<br>
     *     they have no visible children.<br>
     * <p>
     * @param command Type: JComponent
     */
    @SuppressWarnings("unchecked")
  public void hideCommand(JComponent command) {
        boolean foundVisible = false;
        GridField parent = null;

        //
        // make this command invisible
        //
        WidgetState.set(command, Constants.FS_INVISIBLE);

        //
        // if the command is in a grid field, we may want to
        // make the parent invisible too (if it has no visible
        // children.  Get a pointer to the parent.
        //
        if (command != null && ((JComponent)Parent.get(command)) != null && ((JComponent)Parent.get(command)) instanceof GridField) {
            parent = (GridField)((JComponent)Parent.get(command));
        }

        //
        // loop through successive parents, making each invisible
        // until we find a visible child.
        //
        //
        // look for a visible child in this parent.
        //
        while (foundVisible == false && parent != null) {
            Array_Of_JComponent<JComponent> qq_localVector = new Array_Of_JComponent(JComponent.class, parent.getComponents());
            if (qq_localVector != null) {
                for (JComponent c : qq_localVector) {
                    if (WidgetState.get(c) != Constants.FS_INVISIBLE) {
                        foundVisible = true;
                        break;
                    }
                }
            }

            //
            // if we find none visible, make this parent invisible
            // and look at it's parent (but only if it's a grid field).
            //
            if (foundVisible == false) {
                WidgetState.set(parent, Constants.FS_INVISIBLE);
                if (((JComponent)Parent.get(parent)) instanceof GridField) {
                    parent = (GridField)((JComponent)Parent.get(parent));
                }
                else {
                    parent = null;
                }
            }
        }
    }

    /**
     * removeCommand<p>
     * RemoveCommand<br>
     *      RemoveCommand makes the command invisible to the user.<br>
     * <p>
     * @param command Type: int
     */
    public void removeCommand(int command) {
        switch (command) {
            case CommandMgr.C_WC_CANCEL: {
                if (this.getCancelCMD() != null) {
                    this.removeCommand(this.getCancelCMD());
                }

                break;
            }
            case CommandMgr.C_RS_CLEAR: {
                if (this.getClearCMD() != null) {
                    this.removeCommand(this.getClearCMD());
                }

                break;
            }
            case CommandMgr.C_RS_INSERT: {
                if (this.getInsertCMD() != null) {
                    this.removeCommand(this.getInsertCMD());
                }

                break;
            }
            case CommandMgr.C_RS_DELETE: {
                if (this.getDeleteCMD() != null) {
                    this.removeCommand(this.getDeleteCMD());
                }

                break;
            }
            case CommandMgr.C_WC_OK: {
                if (this.getOKCMD() != null) {
                    this.removeCommand(this.getOKCMD());
                }

                break;
            }
            case CommandMgr.C_RS_FIRST: {
                if (this.getFirstCMD() != null) {
                    this.removeCommand(this.getFirstCMD());
                }

                break;
            }
            case CommandMgr.C_RS_INDEXES: {
                if (this.getIndexesGrid() != null) {
                    this.removeCommand(this.getIndexesGrid());
                    this.removeCommand(this.getScrollBCGrid());
                }

                break;
            }
            case CommandMgr.C_RS_LAST: {
                if (this.getLastCMD() != null) {
                    this.removeCommand(this.getLastCMD());
                }

                break;
            }
            case CommandMgr.C_RS_NEXT: {
                if (this.getNextCMD() != null) {
                    this.removeCommand(this.getNextCMD());
                }

                break;
            }
            case CommandMgr.C_RS_PREV: {
                if (this.getPrevCMD() != null) {
                    this.removeCommand(this.getPrevCMD());
                }

                break;
            }
            case CommandMgr.C_RS_SEARCH: {
                if (this.getSearchCMD() != null) {
                    this.removeCommand(this.getSearchCMD());
                }

                break;
            }
            case CommandMgr.C_RS_SCROLL: {
                this.removeCommand(CommandMgr.C_RS_FIRST);
                this.removeCommand(CommandMgr.C_RS_LAST);
                this.removeCommand(CommandMgr.C_RS_NEXT);
                this.removeCommand(CommandMgr.C_RS_PREV);
                this.removeCommand(CommandMgr.C_RS_INDEXES);
                break;
            }
        }
    }

    /**
     * removeCommand<p>
     * RemoveCommand<br>
     *     RemoveCommand removes a command from the window<br>
     *     and removees its parent GridField(s) if they have<br>
     *     no remaining children after the operation.<br>
     * <p>
     * @param command Type: JComponent
     */
    public void removeCommand(JComponent command) {
        GridField parent = null;

        //
        // if the command is in a grid field, we may want to
        // deparent the parent too.  Get a pointer to the parent.
        //
        if (command != null && ((JComponent)Parent.get(command)) != null && ((JComponent)Parent.get(command)) instanceof GridField) {
            parent = (GridField)((JComponent)Parent.get(command));
        }

        //
        // remove this command
        //
        if (command != null) {
            Parent.set(command, (JComponent)null);
        }

        //
        // loop through successive parents, removing each
        // until we find one with children.
        //
        //
        // if the parent has any children, then exit the loop
        //
        while (parent != null) {
            if (parent.getComponentCount() > 0) {
                parent = null;
                break;

            }
            else {
                //
                // keep a temporary pointer to the current parent
                //
                GridField temp = parent;

                //
                // find a pointer to the parent's parent
                //
                if (((JComponent)Parent.get(parent)) != null && ((JComponent)Parent.get(parent)) instanceof GridField) {
                    parent = (GridField)((JComponent)Parent.get(parent));
                }
                else {
                    parent = null;
                }

                //
                // deparent the current parent
                //
                Parent.set(temp, (JComponent)null);
            }
        }
    }

    /**
     * removeSet<p>
     * RemoveSet<br>
     *      RemoveSet makes the entire command set invisible<br>
     *     to the user.<br>
     * <p>
     */
    public void removeSet() {
        this.removeCommand(CommandMgr.C_RS_CLEAR);
        this.removeCommand(CommandMgr.C_RS_SAVE);
        this.removeCommand(CommandMgr.C_RS_INSERT);
        this.removeCommand(CommandMgr.C_RS_DELETE);
        this.removeCommand(CommandMgr.C_RS_FIRST);
        this.removeCommand(CommandMgr.C_RS_INDEXES);
        this.removeCommand(CommandMgr.C_RS_LAST);
        this.removeCommand(CommandMgr.C_RS_NEXT);
        this.removeCommand(CommandMgr.C_RS_PREV);
        this.removeCommand(CommandMgr.C_RS_SEARCH);
        this.removeCommand(CommandMgr.C_RS_REVERT);
        this.removeCommand(CommandMgr.C_WC_CANCEL);
        this.removeCommand(CommandMgr.C_WC_OK);
        this.removeCommand(CommandMgr.C_WC_PREFERENCES);
        this.removeCommand(CommandMgr.C_WC_MODE);
    }

    /**
     * setDefault<p>
     * SetDefault<br>
     *      SetDefault makes the given command the default button.<br>
     * <p>
     * @param command Type: int
     */
    public void setDefault(int command) {
        switch (command) {
            case CommandMgr.C_WC_CANCEL: {
                if (this.getCancelCMD() != null) {
                    DefaultButton.set(this.getCancelCMD(), true);
                }

                break;
            }
            case CommandMgr.C_RS_CLEAR: {
                if (this.getClearCMD() != null) {
                    DefaultButton.set(this.getClearCMD(), true);
                }

                break;
            }
            case CommandMgr.C_RS_INSERT: {
                if (this.getInsertCMD() != null) {
                    DefaultButton.set(this.getInsertCMD(), true);
                }

                break;
            }
            case CommandMgr.C_RS_DELETE: {
                if (this.getDeleteCMD() != null) {
                    DefaultButton.set(this.getDeleteCMD(), true);
                }

                break;
            }
            case CommandMgr.C_WC_OK: {
                if (this.getOKCMD() != null) {
                    DefaultButton.set(this.getOKCMD(), true);
                }

                break;
            }
            case CommandMgr.C_RS_FIRST: {
                if (this.getFirstCMD() != null) {
                    DefaultButton.set(this.getFirstCMD(), true);
                }

                break;
            }
            case CommandMgr.C_RS_LAST: {
                if (this.getLastCMD() != null) {
                    DefaultButton.set(this.getLastCMD(), true);
                }

                break;
            }
            case CommandMgr.C_RS_NEXT: {
                if (this.getNextCMD() != null) {
                    DefaultButton.set(this.getNextCMD(), true);
                }

                break;
            }
            case CommandMgr.C_RS_PREV: {
                if (this.getPrevCMD() != null) {
                    DefaultButton.set(this.getPrevCMD(), true);
                }

                break;
            }
            case CommandMgr.C_RS_SEARCH: {
                if (this.getSearchCMD() != null) {
                    DefaultButton.set(this.getSearchCMD(), true);
                }

                break;
            }
            case CommandMgr.C_NONE: {
                this.setNoDefault();
                break;
            }
        }
    }

    /**
     * setNoDefault<p>
     * SetNoDefault<br>
     *      SetNoDefault makes none of the buttons the default<br>
     *     button.<br>
     * <p>
     */
    public void setNoDefault() {
        if (this.getCancelCMD() != null) {
            DefaultButton.set(this.getCancelCMD(), false);
        }

        if (this.getClearCMD() != null) {
            DefaultButton.set(this.getClearCMD(), false);
        }

        if (this.getInsertCMD() != null) {
            DefaultButton.set(this.getInsertCMD(), false);
        }

        if (this.getDeleteCMD() != null) {
            DefaultButton.set(this.getDeleteCMD(), false);
        }

        if (this.getOKCMD() != null) {
            DefaultButton.set(this.getOKCMD(), false);
        }

        if (this.getFirstCMD() != null) {
            DefaultButton.set(this.getFirstCMD(), false);
        }

        if (this.getLastCMD() != null) {
            DefaultButton.set(this.getLastCMD(), false);
        }

        if (this.getNextCMD() != null) {
            DefaultButton.set(this.getNextCMD(), false);
        }

        if (this.getPrevCMD() != null) {
            DefaultButton.set(this.getPrevCMD(), false);
        }

        if (this.getSearchCMD() != null) {
            DefaultButton.set(this.getSearchCMD(), false);
        }
    }

    /**
     * setState<p>
     * SetState<br>
     *      SetState makes the given command enabled or disabled.<br>
     * <p>
     * @param command Type: int
     * @param state Type: boolean
     */
    public void setState(int command, boolean state) {
        switch (command) {
            case CommandMgr.C_WC_CANCEL: {
                if (this.getCancelCMD() != null) {
                    if (state == true) {
                        WidgetState.set(this.getCancelCMD(), Constants.FS_UPDATE);
                    }
                    else {
                        WidgetState.set(this.getCancelCMD(), Constants.FS_DISABLE);
                    }
                }

                break;
            }
            case CommandMgr.C_RS_CLEAR: {
                if (this.getClearCMD() != null) {
                    if (state == true) {
                        WidgetState.set(this.getClearCMD(), Constants.FS_UPDATE);
                    }
                    else {
                        WidgetState.set(this.getClearCMD(), Constants.FS_DISABLE);
                    }
                }

                break;
            }
            case CommandMgr.C_WC_OK: {
                if (this.getOKCMD() != null) {
                    if (state == true) {
                        WidgetState.set(this.getOKCMD(), Constants.FS_UPDATE);
                    }
                    else {
                        WidgetState.set(this.getOKCMD(), Constants.FS_DISABLE);
                    }
                }

                break;
            }
            case CommandMgr.C_RS_INSERT: {
                if (this.getInsertCMD() != null) {
                    if (state == true) {
                        WidgetState.set(this.getInsertCMD(), Constants.FS_UPDATE);
                    }
                    else {
                        WidgetState.set(this.getInsertCMD(), Constants.FS_DISABLE);
                    }
                }

                break;
            }
            case CommandMgr.C_RS_DELETE: {
                if (this.getDeleteCMD() != null) {
                    if (state == true) {
                        WidgetState.set(this.getDeleteCMD(), Constants.FS_UPDATE);
                    }
                    else {
                        WidgetState.set(this.getDeleteCMD(), Constants.FS_DISABLE);
                    }
                }

                break;
            }
            case CommandMgr.C_RS_FIRST: {
                if (this.getFirstCMD() != null) {
                    if (state == true) {
                        WidgetState.set(this.getFirstCMD(), Constants.FS_UPDATE);
                    }
                    else {
                        WidgetState.set(this.getFirstCMD(), Constants.FS_DISABLE);
                    }
                }

                break;
            }
            case CommandMgr.C_RS_INDEXES: {
                if (this.getIndexesGrid() != null) {
                    if (state == true) {
                        WidgetState.set(this.getIndexesGrid(), Constants.FS_UPDATE);
                    }
                    else {
                        WidgetState.set(this.getIndexesGrid(), Constants.FS_DISABLE);
                    }
                }

                break;
            }
            case CommandMgr.C_RS_LAST: {
                if (this.getLastCMD() != null) {
                    if (state == true) {
                        WidgetState.set(this.getLastCMD(), Constants.FS_UPDATE);
                    }
                    else {
                        WidgetState.set(this.getLastCMD(), Constants.FS_DISABLE);
                    }
                }

                break;
            }
            case CommandMgr.C_RS_NEXT: {
                if (this.getNextCMD() != null) {
                    if (state == true) {
                        WidgetState.set(this.getNextCMD(), Constants.FS_UPDATE);
                    }
                    else {
                        WidgetState.set(this.getNextCMD(), Constants.FS_DISABLE);
                    }
                }

                break;
            }
            case CommandMgr.C_RS_PREV: {
                if (this.getPrevCMD() != null) {
                    if (state == true) {
                        WidgetState.set(this.getPrevCMD(), Constants.FS_UPDATE);
                    }
                    else {
                        WidgetState.set(this.getPrevCMD(), Constants.FS_DISABLE);
                    }
                }

                break;
            }
            case CommandMgr.C_RS_SEARCH: {
                if (this.getSearchCMD() != null) {
                    if (state == true) {
                        WidgetState.set(this.getSearchCMD(), Constants.FS_UPDATE);
                    }
                    else {
                        WidgetState.set(this.getSearchCMD(), Constants.FS_DISABLE);
                    }
                }

                break;
            }
        }
    }

    /**
     * showCommand<p>
     * ShowCommand<br>
     *      ShowCommand makes the command visible to the user.<br>
     * <p>
     * @param command Type: int
     */
    public void showCommand(int command) {
        switch (command) {
            case CommandMgr.C_WC_CANCEL: {
                if (this.getCancelCMD() != null) {
                    WidgetState.set(this.getCancelCMD(), Constants.FS_UPDATE);
                }

                break;
            }
            case CommandMgr.C_RS_CLEAR: {
                if (this.getClearCMD() != null) {
                    WidgetState.set(this.getClearCMD(), Constants.FS_UPDATE);
                }

                break;
            }
            case CommandMgr.C_RS_INSERT: {
                if (this.getInsertCMD() != null) {
                    WidgetState.set(this.getInsertCMD(), Constants.FS_UPDATE);
                }

                break;
            }
            case CommandMgr.C_RS_DELETE: {
                if (this.getDeleteCMD() != null) {
                    WidgetState.set(this.getDeleteCMD(), Constants.FS_UPDATE);
                }

                break;
            }
            case CommandMgr.C_WC_OK: {
                if (this.getOKCMD() != null) {
                    WidgetState.set(this.getOKCMD(), Constants.FS_UPDATE);
                }

                break;
            }
            case CommandMgr.C_RS_FIRST: {
                if (this.getFirstCMD() != null) {
                    WidgetState.set(this.getFirstCMD(), Constants.FS_UPDATE);
                }

                break;
            }
            case CommandMgr.C_RS_INDEXES: {
                if (this.getIndexesGrid() != null) {
                    WidgetState.set(this.getIndexesGrid(), Constants.FS_UPDATE);
                    WidgetState.set(this.getScrollBCGrid(), Constants.FS_UPDATE);
                }

                break;
            }
            case CommandMgr.C_RS_LAST: {
                if (this.getLastCMD() != null) {
                    WidgetState.set(this.getLastCMD(), Constants.FS_UPDATE);
                }

                break;
            }
            case CommandMgr.C_RS_NEXT: {
                if (this.getNextCMD() != null) {
                    WidgetState.set(this.getNextCMD(), Constants.FS_UPDATE);
                }

                break;
            }
            case CommandMgr.C_RS_PREV: {
                if (this.getPrevCMD() != null) {
                    WidgetState.set(this.getPrevCMD(), Constants.FS_UPDATE);
                }

                break;
            }
            case CommandMgr.C_RS_SEARCH: {
                if (this.getSearchCMD() != null) {
                    WidgetState.set(this.getSearchCMD(), Constants.FS_UPDATE);
                }

                break;
            }
        }
    }
// end class ButtonSetDesc
// c Pass 2 Conversion Time: 2578 milliseconds
TOP

Related Classes of Express.windows.ButtonSetDesc

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.