Package Express.windows

Source Code of Express.windows.ToolbarSetDesc

/*
Copyright (c) 2003-2009 ITerative Consulting Pty Ltd. All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:

o Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
 
o Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the distribution.
   
o This jcTOOL Helper Class software, whether in binary or source form may not be used within,
or to derive, any other product without the specific prior written permission of the copyright holder

 
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


*/
package Express.windows;

import java.io.Serializable;

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

import DisplayProject.Constants;
import DisplayProject.GridField;
import DisplayProject.PaletteList;
import DisplayProject.actions.Parent;
import DisplayProject.actions.PictureButtonImageValue;
import DisplayProject.actions.WidgetState;
import DisplayProject.binding.beans.Observable;
import Framework.ImageData;
import Framework.IntegerData;
import Framework.RuntimeProperties;

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

    // ----------
    // Attributes
    // ----------
    private JButton clearCMD;
    private ImageData clearDisabledIcon;
    private ImageData clearEnabledIcon;
    private JButton deleteCMD;
    private ImageData deleteDisabledIcon;
    private ImageData deleteEnabledIcon;
    private GridField editTCGrid;
    private JButton firstCMD;
    private GridField indexesGrid;
    private JButton insertCMD;
    private ImageData insertDisabledIcon;
    private ImageData insertEnabledIcon;
    private JButton lastCMD;
    private IntegerData mode;
    private PaletteList modeCMD;
    private JButton nextCMD;
    private JButton prevCMD;
    private JButton saveCMD;
    private ImageData saveDisabledIcon;
    private ImageData saveEnabledIcon;
    private GridField scrollTCGrid;
    private JButton searchCMD;
    private ImageData searchDisabledIcon;
    private ImageData searchEnabledIcon;
    private GridField toolbarGrid;

    // ------------
    // Constructors
    // ------------
    public ToolbarSetDesc() {
        // Explicitly call the superclass constructor to prevent the implicit call
        super();
        this.clearCMD = null;
        this.clearDisabledIcon = null;
        this.clearEnabledIcon = null;
        this.deleteCMD = null;
        this.deleteDisabledIcon = null;
        this.deleteEnabledIcon = null;
        this.editTCGrid = null;
        this.firstCMD = null;
        this.indexesGrid = null;
        this.insertCMD = null;
        this.insertDisabledIcon = null;
        this.insertEnabledIcon = null;
        this.lastCMD = null;
        this.mode = null;
        this.modeCMD = null;
        this.nextCMD = null;
        this.prevCMD = null;
        this.saveCMD = null;
        this.saveDisabledIcon = null;
        this.saveEnabledIcon = null;
        this.scrollTCGrid = null;
        this.searchCMD = null;
        this.searchDisabledIcon = null;
        this.searchEnabledIcon = null;
        this.toolbarGrid = null;
    }

    // ----------------------
    // Accessors and Mutators
    // ----------------------
    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 setClearDisabledIcon(ImageData clearDisabledIcon) {
        ImageData oldValue = this.clearDisabledIcon;
        this.clearDisabledIcon = clearDisabledIcon;
        this.qq_Listeners.firePropertyChange("clearDisabledIcon", oldValue, this.clearDisabledIcon);
    }

    public ImageData getClearDisabledIcon() {
        return this.clearDisabledIcon;
    }

    public void setClearEnabledIcon(ImageData clearEnabledIcon) {
        ImageData oldValue = this.clearEnabledIcon;
        this.clearEnabledIcon = clearEnabledIcon;
        this.qq_Listeners.firePropertyChange("clearEnabledIcon", oldValue, this.clearEnabledIcon);
    }

    public ImageData getClearEnabledIcon() {
        return this.clearEnabledIcon;
    }

    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 setDeleteDisabledIcon(ImageData deleteDisabledIcon) {
        ImageData oldValue = this.deleteDisabledIcon;
        this.deleteDisabledIcon = deleteDisabledIcon;
        this.qq_Listeners.firePropertyChange("deleteDisabledIcon", oldValue, this.deleteDisabledIcon);
    }

    public ImageData getDeleteDisabledIcon() {
        return this.deleteDisabledIcon;
    }

    public void setDeleteEnabledIcon(ImageData deleteEnabledIcon) {
        ImageData oldValue = this.deleteEnabledIcon;
        this.deleteEnabledIcon = deleteEnabledIcon;
        this.qq_Listeners.firePropertyChange("deleteEnabledIcon", oldValue, this.deleteEnabledIcon);
    }

    public ImageData getDeleteEnabledIcon() {
        return this.deleteEnabledIcon;
    }

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

    public GridField getEditTCGrid() {
        return this.editTCGrid;
    }

    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 setInsertDisabledIcon(ImageData insertDisabledIcon) {
        ImageData oldValue = this.insertDisabledIcon;
        this.insertDisabledIcon = insertDisabledIcon;
        this.qq_Listeners.firePropertyChange("insertDisabledIcon", oldValue, this.insertDisabledIcon);
    }

    public ImageData getInsertDisabledIcon() {
        return this.insertDisabledIcon;
    }

    public void setInsertEnabledIcon(ImageData insertEnabledIcon) {
        ImageData oldValue = this.insertEnabledIcon;
        this.insertEnabledIcon = insertEnabledIcon;
        this.qq_Listeners.firePropertyChange("insertEnabledIcon", oldValue, this.insertEnabledIcon);
    }

    public ImageData getInsertEnabledIcon() {
        return this.insertEnabledIcon;
    }

    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 setMode(IntegerData mode) {
        IntegerData oldValue = this.mode;
        this.mode = mode;
        this.qq_Listeners.firePropertyChange("mode", oldValue, this.mode);
    }

    public IntegerData getMode() {
        return this.mode;
    }

    public void setModeCMD(PaletteList modeCMD) {
        PaletteList oldValue = this.modeCMD;
        this.modeCMD = modeCMD;
        this.qq_Listeners.firePropertyChange("modeCMD", oldValue, this.modeCMD);
    }

    public PaletteList getModeCMD() {
        return this.modeCMD;
    }

    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 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 setSaveCMD(JButton saveCMD) {
        JButton oldValue = this.saveCMD;
        this.saveCMD = saveCMD;
        this.qq_Listeners.firePropertyChange("saveCMD", oldValue, this.saveCMD);
    }

    public JButton getSaveCMD() {
        return this.saveCMD;
    }

    public void setSaveDisabledIcon(ImageData saveDisabledIcon) {
        ImageData oldValue = this.saveDisabledIcon;
        this.saveDisabledIcon = saveDisabledIcon;
        this.qq_Listeners.firePropertyChange("saveDisabledIcon", oldValue, this.saveDisabledIcon);
    }

    public ImageData getSaveDisabledIcon() {
        return this.saveDisabledIcon;
    }

    public void setSaveEnabledIcon(ImageData saveEnabledIcon) {
        ImageData oldValue = this.saveEnabledIcon;
        this.saveEnabledIcon = saveEnabledIcon;
        this.qq_Listeners.firePropertyChange("saveEnabledIcon", oldValue, this.saveEnabledIcon);
    }

    public ImageData getSaveEnabledIcon() {
        return this.saveEnabledIcon;
    }

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

    public GridField getScrollTCGrid() {
        return this.scrollTCGrid;
    }

    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 setSearchDisabledIcon(ImageData searchDisabledIcon) {
        ImageData oldValue = this.searchDisabledIcon;
        this.searchDisabledIcon = searchDisabledIcon;
        this.qq_Listeners.firePropertyChange("searchDisabledIcon", oldValue, this.searchDisabledIcon);
    }

    public ImageData getSearchDisabledIcon() {
        return this.searchDisabledIcon;
    }

    public void setSearchEnabledIcon(ImageData searchEnabledIcon) {
        ImageData oldValue = this.searchEnabledIcon;
        this.searchEnabledIcon = searchEnabledIcon;
        this.qq_Listeners.firePropertyChange("searchEnabledIcon", oldValue, this.searchEnabledIcon);
    }

    public ImageData getSearchEnabledIcon() {
        return this.searchEnabledIcon;
    }

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

    public GridField getToolbarGrid() {
        return this.toolbarGrid;
    }

    // -------
    // Methods
    // -------
    /**
     * 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_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_RS_SAVE: {
                if (this.getSaveCMD() != null && WidgetState.get(this.getSaveCMD()) == 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_RS_CLEAR: {
                if (this.getClearCMD() != null) {
                    WidgetState.set(this.getClearCMD(), Constants.FS_INVISIBLE);
                }

                break;
            }
            case CommandMgr.C_RS_SAVE: {
                if (this.getSaveCMD() != null) {
                    WidgetState.set(this.getSaveCMD(), Constants.FS_INVISIBLE);
                }

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

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

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

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

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

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

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

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

                break;
            }
            case CommandMgr.C_WC_MODE: {
                if (this.getModeCMD() != null) {
                    WidgetState.set(this.getModeCMD(), Constants.FS_INVISIBLE);
                }

                break;
            }
        }
    }

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

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

                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_RS_FIRST: {
                if (this.getFirstCMD() != null) {
                    this.removeCommand(this.getFirstCMD());
                }

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

                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_WC_MODE: {
                if (this.getModeCMD() != null) {
                    this.removeCommand(this.getModeCMD());
                }

                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() {
        if (this.getToolbarGrid() != null) {
            Parent.set(this.getToolbarGrid(), (JComponent)null);
        }
    }

    /**
     * setState<p>
     * SetState<br>
     *      SetState sets the state of the given command.<br>
     * <p>
     * @param command Type: int
     * @param state Type: boolean
     */
    public void setState(int command, boolean state) {
        switch (command) {
            case CommandMgr.C_RS_CLEAR: {
                if (this.getClearCMD() != null) {
                    if (state == true) {
                        WidgetState.set(this.getClearCMD(), Constants.FS_UPDATE);
                        PictureButtonImageValue.set(this.getClearCMD(), this.getClearEnabledIcon());
                    }
                    else {
                        WidgetState.set(this.getClearCMD(), Constants.FS_INACTIVE);
                        PictureButtonImageValue.set(this.getClearCMD(), this.getClearDisabledIcon());
                    }
                }

                break;
            }
            case CommandMgr.C_RS_SAVE: {
                if (this.getSaveCMD() != null) {
                    if (state == true) {
                        WidgetState.set(this.getSaveCMD(), Constants.FS_UPDATE);
                        PictureButtonImageValue.set(this.getSaveCMD(), this.getSaveEnabledIcon());
                    }
                    else {
                        WidgetState.set(this.getSaveCMD(), Constants.FS_INACTIVE);
                        PictureButtonImageValue.set(this.getSaveCMD(), this.getSaveDisabledIcon());
                    }
                }

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

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

                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);
                        PictureButtonImageValue.set(this.getSearchCMD(), this.getSearchEnabledIcon());
                    }
                    else {
                        WidgetState.set(this.getSearchCMD(), Constants.FS_INACTIVE);
                        PictureButtonImageValue.set(this.getSearchCMD(), this.getSearchDisabledIcon());
                    }
                }

                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_RS_CLEAR: {
                if (this.getClearCMD() != null) {
                    WidgetState.set(this.getClearCMD(), Constants.FS_UPDATE);
                }

                break;
            }
            case CommandMgr.C_RS_SAVE: {
                if (this.getSaveCMD() != null) {
                    WidgetState.set(this.getSaveCMD(), 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_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);
                }

                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;
            }
            case CommandMgr.C_WC_MODE: {
                if (this.getModeCMD() != null) {
                    WidgetState.set(this.getModeCMD(), Constants.FS_UPDATE);
                }

                break;
            }
        }
    }
// end class ToolbarSetDesc
// c Pass 2 Conversion Time: 2172 milliseconds
TOP

Related Classes of Express.windows.ToolbarSetDesc

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.