/// <summary>
        /// Record down the previous data.
        /// </summary>
        private void RecordPrevData()
        {
            switch (mGUIType)
            {
            case JCS_GUIType.INPUT_FIELD:
            {
                mPrevInputFieldData = new JCS_InputFieldData
                {
                    text = mInputField.text
                };
            }
            break;

            case JCS_GUIType.DROP_DOWN:
            {
                mPrevDropdownData = new JCS_DropdownData
                {
                    value = mDropdown.value
                };
            }
            break;

            case JCS_GUIType.SLIDER:
            {
                mPrevSliderData = new JCS_SliderData
                {
                    value = mSlider.value
                };
            }
            break;

            case JCS_GUIType.SCROLL_BAR:
            {
                mPrevScrollbarData = new JCS_ScrollbarData
                {
                    value = mScrollBar.value
                };
            }
            break;

            case JCS_GUIType.TOGGLE:
            {
                mPrevToggleData = new JCS_ToggleData
                {
                    isOn = mToggle.isOn
                };
            }
            break;
            }
        }
 /// <summary>
 /// Check if the data are the same?
 /// </summary>
 /// <param name="ddd"></param>
 /// <returns>
 /// true, same data.
 /// false, not same data.
 /// </returns>
 private bool CheckSameData(JCS_DropdownData ddd)
 {
     return(mDropdown.value == ddd.value);
 }
 /// <summary>
 /// Paste the data.
 /// </summary>
 /// <param name="ddd"></param>
 private void PasteData(JCS_DropdownData ddd)
 {
     mDropdown.value = ddd.value;
 }
        /// <summary>R
        /// Record down the GUI component once.
        /// </summary>
        private void RecordOnce()
        {
            if (mIsFocused)
            {
                mIsFocused = false;

                if (CheckSameData(GetCurrentUIPrevData()))
                {
                    return;
                }
            }

            if (!IsRecording())
            {
                return;
            }

            mUndoRedoSystem.ClearRedoComp();
            ClearAllRedo();

            switch (mGUIType)
            {
            case JCS_GUIType.INPUT_FIELD:
            {
                mIF_Undo.Add(mPrevInputFieldData);


                JCS_InputFieldData ifd = new JCS_InputFieldData
                {
                    text = mInputField.text
                };

                mPrevInputFieldData = ifd;

                mIF_Redo.Add(ifd);
            }
            break;

            case JCS_GUIType.DROP_DOWN:
            {
                mDD_Undo.Add(mPrevDropdownData);


                JCS_DropdownData ddd = new JCS_DropdownData
                {
                    value = mDropdown.value
                };

                mPrevDropdownData = ddd;

                mDD_Redo.Add(ddd);
            }
            break;

            case JCS_GUIType.SLIDER:
            {
                mSli_Undo.Add(mPrevSliderData);


                JCS_SliderData sd = new JCS_SliderData
                {
                    value = mSlider.value
                };

                mPrevSliderData = sd;

                mSli_Redo.Add(sd);
            }
            break;

            case JCS_GUIType.SCROLL_BAR:
            {
                mSB_Undo.Add(mPrevScrollbarData);


                JCS_ScrollbarData sbd = new JCS_ScrollbarData
                {
                    value = mScrollBar.value
                };

                mPrevScrollbarData = sbd;

                mSB_Redo.Add(sbd);
            }
            break;

            case JCS_GUIType.TOGGLE:
            {
                mTog_Undo.Add(mPrevToggleData);


                JCS_ToggleData td = new JCS_ToggleData();

                if (mToggle != null)
                {
                    td.isOn = mToggle.isOn;
                }
                else if (mJCSToggle != null)
                {
                    td.isOn = mJCSToggle.IsOn;
                }
                else
                {
                    JCS_Debug.LogError("Cannot record toggle object " +
                                       "without any toggle object component attached..");
                }

                mPrevToggleData = td;

                mTog_Redo.Add(td);
            }
            break;
            }

            // Add it to next undo component.
            mUndoRedoSystem.AddUndoComponent(this);
        }
        /// <summary>
        /// Record down the previous data before we do
        /// undo/redo action.
        /// </summary>
        public void RecordPrevData()
        {
            switch (mGUIType)
            {
            case JCS_GUIType.INPUT_FIELD:
            {
                mPrevInputFieldData = new JCS_InputFieldData
                {
                    text = mInputField.text
                };
            }
            break;

            case JCS_GUIType.DROP_DOWN:
            {
                mPrevDropdownData = new JCS_DropdownData
                {
                    value = mDropdown.value
                };
            }
            break;

            case JCS_GUIType.SLIDER:
            {
                mPrevSliderData = new JCS_SliderData
                {
                    value = mSlider.value
                };
            }
            break;

            case JCS_GUIType.SCROLL_BAR:
            {
                mPrevScrollbarData = new JCS_ScrollbarData
                {
                    value = mScrollBar.value
                };
            }
            break;

            case JCS_GUIType.TOGGLE:
            {
                bool tmpIsOn = false;

                if (mToggle != null)
                {
                    tmpIsOn = mToggle.isOn;
                }
                else if (mJCSToggle != null)
                {
                    tmpIsOn = mJCSToggle.IsOn;
                }

                mPrevToggleData = new JCS_ToggleData
                {
                    isOn = tmpIsOn
                };
            }
            break;
            }
        }
        /// <summary>
        /// Redo this compnent.
        /// </summary>
        public void Redo()
        {
            // What ever we do in undo/redo, we don't
            // record anything down.
            StopRecording();

            bool sameData = false;

            switch (mGUIType)
            {
            case JCS_GUIType.INPUT_FIELD:
            {
                JCS_InputFieldData ifd = JCS_Util.ListPopBack(mIF_Redo);

                if (ifd == null)
                {
                    break;
                }

                sameData = CheckSameData(ifd);

                PasteData(ifd);

                mIF_Undo.Add(ifd);
            }
            break;

            case JCS_GUIType.DROP_DOWN:
            {
                JCS_DropdownData ddd = JCS_Util.ListPopBack(mDD_Redo);

                if (ddd == null)
                {
                    break;
                }

                sameData = CheckSameData(ddd);

                PasteData(ddd);

                mDD_Undo.Add(ddd);
            }
            break;

            case JCS_GUIType.SLIDER:
            {
                JCS_SliderData sd = JCS_Util.ListPopBack(mSli_Redo);

                if (sd == null)
                {
                    break;
                }

                sameData = CheckSameData(sd);

                PasteData(sd);

                mSli_Undo.Add(sd);
            }
            break;

            case JCS_GUIType.SCROLL_BAR:
            {
                JCS_ScrollbarData sbd = JCS_Util.ListPopBack(mSB_Redo);

                if (sbd == null)
                {
                    break;
                }

                sameData = CheckSameData(sbd);

                PasteData(sbd);

                mSB_Undo.Add(sbd);
            }
            break;

            case JCS_GUIType.TOGGLE:
            {
                JCS_ToggleData td = JCS_Util.ListPopBack(mTog_Redo);

                if (td == null)
                {
                    break;
                }

                sameData = CheckSameData(td);

                PasteData(td);

                mTog_Undo.Add(td);
            }
            break;
            }

            if (sameData)
            {
                Redo();
            }

            RecordPrevData();

            if (mFocusAfterRedo)
            {
                DoFocusAfterUndoRedoAction();
            }

            // Unlock ignore record.
            StartRecording();
        }
        /// <summary>R
        /// Record down the GUI component once.
        /// </summary>
        private void RecordOnce()
        {
            if (mIgnoreRecord)
            {
                return;
            }

            mUndoRedoSystem.ClearRedoComp();
            ClearAllRedo();

            switch (mGUIType)
            {
            case JCS_GUIType.INPUT_FIELD:
            {
                mIF_Undo.Add(mPrevInputFieldData);


                JCS_InputFieldData ifd = new JCS_InputFieldData
                {
                    text = mInputField.text
                };

                mPrevInputFieldData = ifd;

                mIF_Redo.Add(ifd);
            }
            break;

            case JCS_GUIType.DROP_DOWN:
            {
                mDD_Undo.Add(mPrevDropdownData);


                JCS_DropdownData ddd = new JCS_DropdownData
                {
                    value = mDropdown.value
                };

                mPrevDropdownData = ddd;

                mDD_Redo.Add(ddd);
            }
            break;

            case JCS_GUIType.SLIDER:
            {
                mSli_Undo.Add(mPrevSliderData);


                JCS_SliderData sd = new JCS_SliderData
                {
                    value = mSlider.value
                };

                mPrevSliderData = sd;

                mSli_Redo.Add(sd);
            }
            break;

            case JCS_GUIType.SCROLL_BAR:
            {
                mSB_Undo.Add(mPrevScrollbarData);


                JCS_ScrollbarData sbd = new JCS_ScrollbarData
                {
                    value = mScrollBar.value
                };

                mPrevScrollbarData = sbd;

                mSB_Redo.Add(sbd);
            }
            break;

            case JCS_GUIType.TOGGLE:
            {
                mTog_Undo.Add(mPrevToggleData);


                JCS_ToggleData td = new JCS_ToggleData
                {
                    isOn = mToggle.isOn
                };

                mPrevToggleData = td;

                mTog_Redo.Add(td);
            }
            break;
            }

            // Add it to next undo component.
            mUndoRedoSystem.AddUndoComponent(this);
        }