private String typedHistoryChange(final String componentName, final String currentStr, final boolean undoCommand){
        String popedStr = currentStr; //just for more clarity

        java.util.Stack<String> typedHistoryUndoStack = typedHistoryByPanelsMap.get(componentName);
        java.util.Stack<String> typedHistoryRedoStack = typedHistoryByPanelsMap.get(componentName+TYPED_HISTORY_REDO_POSTFIX);
        if( typedHistoryUndoStack == null || typedHistoryRedoStack == null ){
            return currentStr;
        }

        //operate stacks according to action
        if( undoCommand ) {

            if( !typedHistoryUndoStack.empty() ){
                    typedHistoryRedoStack.add(currentStr);
                    popedStr = typedHistoryUndoStack.pop();

                    //avoid stack overflow
                    if( typedHistoryRedoStack.size() >= TYPED_HISTORY_REG_NUM_MAX){
                        typedHistoryRedoStack.removeElementAt(0);
                    }
            }
            
        }else if( !typedHistoryRedoStack.empty() ){

            typedHistoryUndoStack.add(currentStr);
            popedStr = typedHistoryRedoStack.pop();

            //avoid stack overflow
            if( typedHistoryUndoStack.size() >= TYPED_HISTORY_REG_NUM_MAX){
                typedHistoryUndoStack.removeElementAt(0);
            }
            
        }

        return popedStr;
    }