public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
    {
        boolean bFlag = super.doCommand(strCommand, sourceSField, iCommandOptions); // This will send the command to my view
        if (bFlag)
            return bFlag;   // Handled by my view
    
        int iIndex = strCommand.indexOf('=');
        if (iIndex != -1)
        	if (this instanceof BaseScreen)
        {   // only BaseScreens send commands
            if ((strCommand.indexOf(Param.TASK + '=') != -1) || (strCommand.indexOf(Params.APPLET + '=') != -1))
            { // Asking to start a job
                Task task = this.getTask();
                //xif (task == null)
                //x    task = BaseApplet.getSharedInstance();  // ??
                TaskScheduler js = ((Application)task.getApplication()).getTaskScheduler();
                js.addTask(strCommand);
                return true;
            }
            BasePanel parentScreen = this.getParentScreen();
            ScreenLocation itsLocation = null;
            if ((iCommandOptions & ScreenConstants.USE_NEW_WINDOW) == ScreenConstants.USE_SAME_WINDOW)	// Use same window
                itsLocation = this.getScreenLocation();
            else
                parentScreen = Screen.makeWindow(this.getTask().getApplication());

            Task task = parentScreen.getTask();//getAppletScreen().getScreenFieldView().getControl();
            if ((iCommandOptions & ScreenConstants.USE_NEW_WINDOW) == ScreenConstants.USE_SAME_WINDOW)	// Use same window
                this.free();        // Remove this screen
            task.setProperties(null);
            Map<String,Object> properties = new Hashtable<String,Object>();
            Util.parseArgs(properties, strCommand);        // Set these properties
            task.setProperties(properties);
            BaseScreen.makeScreenFromParams(task, itsLocation, parentScreen, iCommandOptions, properties);
            bFlag = true; // Handled
        }
        if (strCommand.equalsIgnoreCase(MenuConstants.RESET))
            bFlag = this.onRefresh();
        if (strCommand.equalsIgnoreCase(MenuConstants.DELETE))
            bFlag = this.onDelete();
        if (strCommand.equalsIgnoreCase(MenuConstants.BACK))
            bFlag = this.onBack();
        if (strCommand.equalsIgnoreCase(MenuConstants.CUT))
            bFlag = true; // Ignore this command (handled by CutActionHandler)
        if (strCommand.equalsIgnoreCase(MenuConstants.COPY))
            bFlag = true; // Ignore this command 
        if (strCommand.equalsIgnoreCase(MenuConstants.PASTE))
            bFlag = true; // Ignore this command 
                // Commands before this line do not validate the current field
        if (bFlag == false)     // Not yet handled
            if (strCommand.length() > 0)    // Valid command
                if (!(strCommand.equalsIgnoreCase(MenuConstants.UNDO)))   // Don't select first on undo
            this.selectField(null, DBConstants.SELECT_FIRST_FIELD);   // Validate current field
                // Commands after this line do validate the current field
        if (strCommand.equalsIgnoreCase(MenuConstants.FIRST))
            bFlag = this.onMove(Constants.FIRST_RECORD);
        if (strCommand.equalsIgnoreCase(MenuConstants.PREVIOUS))
            bFlag = this.onMove(Constants.PREVIOUS_RECORD);
        if (strCommand.equalsIgnoreCase(MenuConstants.NEXT))
            bFlag = this.onMove(Constants.NEXT_RECORD);
        if (strCommand.equalsIgnoreCase(MenuConstants.LAST))
            bFlag = this.onMove(Constants.LAST_RECORD);
        if (strCommand.equalsIgnoreCase(MenuConstants.SUBMIT))
            bFlag = this.onAdd();
        if (strCommand.equalsIgnoreCase(MenuConstants.LOOKUP))
            return (this.onForm(null, (((iCommandOptions & ScreenConstants.USE_NEW_WINDOW) == ScreenConstants.USE_SAME_WINDOW) ? ScreenConstants.DISPLAY_MODE : ScreenConstants.SELECT_MODE), true, iCommandOptions, null) != null);
        if (strCommand.equalsIgnoreCase(MenuConstants.FORM))
            bFlag = (this.onForm(null, ScreenConstants.MAINT_MODE, false, iCommandOptions, null) != null);
        if (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK))
            bFlag = (this.onForm(null, ScreenConstants.MAINT_MODE, true, iCommandOptions, null) != null);
        if (strCommand.equalsIgnoreCase(MenuConstants.LOOKUPCLONE))
            return (this.onForm(null, ScreenConstants.SELECT_MODE, true, ScreenConstants.USE_NEW_WINDOW, null) != null);
        if (strCommand.equalsIgnoreCase(MenuConstants.FORMCLONE))
            bFlag = (this.onForm(null, ScreenConstants.MAINT_MODE, true, ScreenConstants.USE_NEW_WINDOW, null) != null);
        if (strCommand.equalsIgnoreCase(MenuConstants.FORMDETAIL))
            bFlag = (this.onForm(null, ScreenConstants.DETAIL_MODE, true, iCommandOptions, null) != null);
        if (strCommand.equalsIgnoreCase(MenuConstants.POST))
            bFlag = (this.onForm(null, ScreenConstants.POST_MODE, true, iCommandOptions, null) != null);
        if (strCommand.equalsIgnoreCase(MenuConstants.HELP))
            bFlag = this.onHelp(iCommandOptions);
        if (strCommand.equalsIgnoreCase(MenuConstants.HOME))
            bFlag = this.onHome();
        if (strCommand.equalsIgnoreCase(MenuConstants.CLONE))
            bFlag = this.onClone();
        if (strCommand.equalsIgnoreCase(MenuConstants.NEW_WINDOW))
            bFlag = this.onNewWindow();
        if (strCommand.equalsIgnoreCase(MenuConstants.DISPLAY))
            bFlag = this.onDisplay();
        if (strCommand.equalsIgnoreCase(MenuConstants.LOGIN))
            bFlag = this.onLogin();
        if (strCommand.equalsIgnoreCase(MenuConstants.LOGON))
            bFlag = this.onLogon();
        if (strCommand.equalsIgnoreCase(MenuConstants.LOGOUT))
            bFlag = this.onLogout();
        if (strCommand.equalsIgnoreCase(MenuConstants.CHANGE_PASSWORD))
            bFlag = this.onChangePassword();
        if (strCommand.equalsIgnoreCase(MenuConstants.SETTINGS))
            bFlag = this.onChangeSettings();
        return bFlag;
    }
public boolean doCommand ( String strCommand , ScreenField sourceSField , int iCommandOptions ) { boolean bFlag = super . doCommand ( strCommand , sourceSField , iCommandOptions ) ; if ( bFlag ) return bFlag ; int iIndex = strCommand . indexOf ( '=' ) ; if ( iIndex != - 1 ) if ( this instanceof BaseScreen ) { if ( ( strCommand . indexOf ( Param . TASK + '=' ) != - 1 ) || ( strCommand . indexOf ( Params . APPLET + '=' ) != - 1 ) ) { Task task = this . getTask ( ) ; TaskScheduler js = ( ( Application ) task . getApplication ( ) ) . getTaskScheduler ( ) ; js . addTask ( strCommand ) ; return true ; } BasePanel parentScreen = this . getParentScreen ( ) ; ScreenLocation itsLocation = null ; if ( ( iCommandOptions & ScreenConstants . USE_NEW_WINDOW ) == ScreenConstants . USE_SAME_WINDOW ) itsLocation = this . getScreenLocation ( ) ; else parentScreen = Screen . makeWindow ( this . getTask ( ) . getApplication ( ) ) ; Task task = parentScreen . getTask ( ) ; if ( ( iCommandOptions & ScreenConstants . USE_NEW_WINDOW ) == ScreenConstants . USE_SAME_WINDOW ) this . free ( ) ; task . setProperties ( null ) ; Map < String , Object > properties = new Hashtable < String , Object > ( ) ; Util . parseArgs ( properties , strCommand ) ; task . setProperties ( properties ) ; BaseScreen . makeScreenFromParams ( task , itsLocation , parentScreen , iCommandOptions , properties ) ; bFlag = true ; } if ( strCommand . equalsIgnoreCase ( MenuConstants . RESET ) ) bFlag = this . onRefresh ( ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . DELETE ) ) bFlag = this . onDelete ( ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . BACK ) ) bFlag = this . onBack ( ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . CUT ) ) bFlag = true ; if ( strCommand . equalsIgnoreCase ( MenuConstants . COPY ) ) bFlag = true ; if ( strCommand . equalsIgnoreCase ( MenuConstants . PASTE ) ) bFlag = true ; if ( bFlag == false ) if ( strCommand . length ( ) > 0 ) if ( ! ( strCommand . equalsIgnoreCase ( MenuConstants . UNDO ) ) ) this . selectField ( null , DBConstants . SELECT_FIRST_FIELD ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . FIRST ) ) bFlag = this . onMove ( Constants . FIRST_RECORD ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . PREVIOUS ) ) bFlag = this . onMove ( Constants . PREVIOUS_RECORD ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . NEXT ) ) bFlag = this . onMove ( Constants . NEXT_RECORD ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . LAST ) ) bFlag = this . onMove ( Constants . LAST_RECORD ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . SUBMIT ) ) bFlag = this . onAdd ( ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . LOOKUP ) ) return ( this . onForm ( null , ( ( ( iCommandOptions & ScreenConstants . USE_NEW_WINDOW ) == ScreenConstants . USE_SAME_WINDOW ) ? ScreenConstants . DISPLAY_MODE : ScreenConstants . SELECT_MODE ) , true , iCommandOptions , null ) != null ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . FORM ) ) bFlag = ( this . onForm ( null , ScreenConstants . MAINT_MODE , false , iCommandOptions , null ) != null ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . FORMLINK ) ) bFlag = ( this . onForm ( null , ScreenConstants . MAINT_MODE , true , iCommandOptions , null ) != null ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . LOOKUPCLONE ) ) return ( this . onForm ( null , ScreenConstants . SELECT_MODE , true , ScreenConstants . USE_NEW_WINDOW , null ) != null ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . FORMCLONE ) ) bFlag = ( this . onForm ( null , ScreenConstants . MAINT_MODE , true , ScreenConstants . USE_NEW_WINDOW , null ) != null ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . FORMDETAIL ) ) bFlag = ( this . onForm ( null , ScreenConstants . DETAIL_MODE , true , iCommandOptions , null ) != null ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . POST ) ) bFlag = ( this . onForm ( null , ScreenConstants . POST_MODE , true , iCommandOptions , null ) != null ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . HELP ) ) bFlag = this . onHelp ( iCommandOptions ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . HOME ) ) bFlag = this . onHome ( ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . CLONE ) ) bFlag = this . onClone ( ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . NEW_WINDOW ) ) bFlag = this . onNewWindow ( ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . DISPLAY ) ) bFlag = this . onDisplay ( ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . LOGIN ) ) bFlag = this . onLogin ( ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . LOGON ) ) bFlag = this . onLogon ( ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . LOGOUT ) ) bFlag = this . onLogout ( ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . CHANGE_PASSWORD ) ) bFlag = this . onChangePassword ( ) ; if ( strCommand . equalsIgnoreCase ( MenuConstants . SETTINGS ) ) bFlag = this . onChangeSettings ( ) ; return bFlag ; }
Process the command.
Step 1 - Process the command if possible and return true if processed.
Step 2 - If I can't process, pass to all children (with me as the source).
Step 3 - If children didn't process, pass to parent (with me as the source).
Note: Never pass to a parent or child that matches the source (to avoid an endless loop).
@param strCommand The command to process.
@param sourceSField The source screen field (to avoid echos).
@param iCommandOptions If this command creates a new screen, create in a new window?
@return true if success.