package kr.co.icontrols.ilp300_700.admin.setting;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.widget.RelativeLayout;

import java.util.Calendar;

import kr.co.icontrols.ilp300_700.MainActivity;
import kr.co.icontrols.ilp300_700.R;
import kr.co.icontrols.ilp300_700.global.Configure.ConfigValue;
import kr.co.icontrols.ilp300_700.global.DataClasses.POSITION;
import kr.co.icontrols.ilp300_700.global.Declare;
import kr.co.icontrols.ilp300_700.global.Enumeration.DATAINPUTSTEP;
import kr.co.icontrols.ilp300_700.global.Global;
import kr.co.icontrols.ilp300_700.global.ID;
import kr.co.icontrols.wallpadsupport.WpadImageView;
import kr.co.icontrols.wallpadsupport.WpadScreen;
import kr.co.icontrols.wallpadsupport.WpadTextView;

public class AdminSet_Setting_Calendar extends WpadScreen {

    String TAG = "AdminSet_Setting_Calendar";

    boolean bLOG = true;   // true, false
    boolean bLOG_DEBUG = false;   // true, false
    boolean bLOG_INFO = true;   // true, false
    Context mContext;
    WpadImageView Image_Background;
    WpadTextView Text_Title;
    WpadTextView Text_Line_01_Item;
    WpadTextView Text_Line_02_Item;
    WpadTextView Text_Line_03_Item;
    WpadTextView Text_Line_04_Item;
    WpadTextView Text_Line_05_Item;
    WpadTextView Text_Line_06_Item;
    WpadTextView Text_Line_07_Item;
    WpadTextView Text_Line_08_Item;
    WpadTextView Text_Line_09_Item;
    WpadTextView Text_Line_01_Input;
    WpadTextView Text_Line_02_Input;
    WpadTextView Text_Line_03_Input;
    WpadTextView Text_Line_04_Input;
    WpadTextView Text_Line_05_Input;
    int TextColor_Normal = Color.WHITE;
    int TextColor_Highlight = Color.GREEN;
    int nFontSize_Instruction = 28;
    boolean bFontNonBold = false;
    boolean bFontBold = true;
    String strText_Title = "시간설정";
    String strText_Line_01_Item = "년/월/일";
    String strText_Line_02_Item = "시간";
    String strText_Line_03_Item = "[ ";
    String strText_Line_04_Item = "/";
    String strText_Line_05_Item = "/";
    String strText_Line_06_Item = " ]";
    String strText_Line_07_Item = "[ ";
    String strText_Line_08_Item = ":";
    String strText_Line_09_Item = " ]";
    String strText_Line_01_Input = "";
    String strText_Line_02_Input = "";
    String strText_Line_03_Input = "";
    String strText_Line_04_Input = "";
    String strText_Line_05_Input = "";
    public AdminSet_Setting_Calendar(Context context, RelativeLayout layout) {
        super(context, layout);
        try {
            LOG("------------------ [START - AdminSet_Setting_Calendar] -------------------");

            mContext = context;
            Initialize();

            Image_Background = new WpadImageView(context, 0, Declare.DeviceInfo.getScreenSizeFullW(ConfigValue.DEVICE_MODELTYPE), Declare.DeviceInfo.getScreenSizeFullH(ConfigValue.DEVICE_MODELTYPE), R.drawable.bg_back, 0, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.IMAGES.BACKGROUND);
            ViewRegistration(layout, Image_Background, 0, 0);

            Text_Title = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.TITLE).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.TITLE).H, Gravity.CENTER, Color.WHITE, nFontSize_Instruction, bFontBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.TITLE);
            ViewRegistration(layout, Text_Title, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.TITLE).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.TITLE).Y);
            Text_Title.setText(strText_Title);

            Text_Line_01_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_01_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_01_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_01_Item);
            ViewRegistration(layout, Text_Line_01_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_01_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_01_Item).Y);
            Text_Line_01_Item.setText(strText_Line_01_Item);

            Text_Line_02_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_02_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_02_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_02_Item);
            ViewRegistration(layout, Text_Line_02_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_02_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_02_Item).Y);
            Text_Line_02_Item.setText(strText_Line_02_Item);

            Text_Line_03_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_03_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_03_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_03_Item);
            ViewRegistration(layout, Text_Line_03_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_03_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_03_Item).Y);
            Text_Line_03_Item.setText(strText_Line_03_Item);

            Text_Line_04_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_04_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_04_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_04_Item);
            ViewRegistration(layout, Text_Line_04_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_04_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_04_Item).Y);
            Text_Line_04_Item.setText(strText_Line_04_Item);

            Text_Line_05_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_05_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_05_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_05_Item);
            ViewRegistration(layout, Text_Line_05_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_05_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_05_Item).Y);
            Text_Line_05_Item.setText(strText_Line_05_Item);

            Text_Line_06_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_06_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_06_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_06_Item);
            ViewRegistration(layout, Text_Line_06_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_06_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_06_Item).Y);
            Text_Line_06_Item.setText(strText_Line_06_Item);

            Text_Line_07_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_07_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_07_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_07_Item);
            ViewRegistration(layout, Text_Line_07_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_07_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_07_Item).Y);
            Text_Line_07_Item.setText(strText_Line_07_Item);

            Text_Line_08_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_08_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_08_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_08_Item);
            ViewRegistration(layout, Text_Line_08_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_08_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_08_Item).Y);
            Text_Line_08_Item.setText(strText_Line_08_Item);

            Text_Line_09_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_09_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_09_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_09_Item);
            ViewRegistration(layout, Text_Line_09_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_09_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_09_Item).Y);
            Text_Line_09_Item.setText(strText_Line_09_Item);

            Text_Line_01_Input = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_01_Input).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_01_Input).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_01_Input);
            ViewRegistration(layout, Text_Line_01_Input, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_01_Input).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_01_Input).Y);
            Text_Line_01_Input.setText(strText_Line_01_Input);

            Text_Line_02_Input = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_02_Input).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_02_Input).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_02_Input);
            ViewRegistration(layout, Text_Line_02_Input, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_02_Input).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_02_Input).Y);
            Text_Line_02_Input.setText(strText_Line_02_Input);

            Text_Line_03_Input = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_03_Input).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_03_Input).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_03_Input);
            ViewRegistration(layout, Text_Line_03_Input, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_03_Input).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_03_Input).Y);
            Text_Line_03_Input.setText(strText_Line_03_Input);

            Text_Line_04_Input = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_04_Input).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_04_Input).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_04_Input);
            ViewRegistration(layout, Text_Line_04_Input, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_04_Input).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_04_Input).Y);
            Text_Line_04_Input.setText(strText_Line_04_Input);

            Text_Line_05_Input = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_05_Input).W, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_05_Input).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_05_Input);
            ViewRegistration(layout, Text_Line_05_Input, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_05_Input).X, getPosition(ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_05_Input).Y);
            Text_Line_05_Input.setText(strText_Line_05_Input);

            UpdateScreen();

            ((MainActivity) mContext).setAutoScreenChange(ID.SCREENS.Main, MainActivity.nAdminScreenTimeout);
        } catch (Exception e) {
            Log.e(TAG, "[Exception] AdminSet_Setting_Calendar(...) : " + e);
            e.printStackTrace();
        }
    }

    private void LOG(String log) {
        if (bLOG) Log.v(TAG, log);
    }

    private void LOG_DEBUG(String log) {
        if (bLOG_DEBUG) Log.d(TAG, log);
    }

    private void LOG_INFO(String log) {
        if (bLOG_INFO) Log.i(TAG, log);
    }

    protected void Initialize() {
        try {
            LOG("[Initialize] =====START =====");
            getCalendar();

            Global.DataInputStep = DATAINPUTSTEP.INPUT_01;

            strText_Line_01_Input = Integer.toString(SetCal.nYear);
            strText_Line_02_Input = Global.ZeroPadding_Head(2, Integer.toString(SetCal.nMonth + 1));
            strText_Line_03_Input = Global.ZeroPadding_Head(2, Integer.toString(SetCal.nDate));
            strText_Line_04_Input = Global.ZeroPadding_Head(2, Integer.toString(SetCal.nHour));
            strText_Line_05_Input = Global.ZeroPadding_Head(2, Integer.toString(SetCal.nMin));

        } catch (Exception e) {
            Log.e(TAG, "[Exception] Initialize() : " + e);
            e.printStackTrace();
        }
    }

    @Override
    protected void onClose() {
        try {
            LOG("------------------ [onClose - AdminSet_Setting_Calendar] -------------------");
        } catch (Exception e) {
            Log.e(TAG, "[Exception] onClose() : " + e);
            e.printStackTrace();
        }
        super.onClose();
    }

    @Override
    protected void onBrReceive(Intent intent) {
        try {
            LOG("[onBrReceive] Intent : " + intent);
        } catch (Exception e) {
            Log.e(TAG, "[Exception] onBrReceive(...) : " + e);
            e.printStackTrace();
        }
        super.onBrReceive(intent);
    }

    @Override
    protected void onKeyDown(int keyCode, KeyEvent event) {
        try {
//            LOG("[onKeyDown] keyCode [" + keyCode + "], event [" + event + "]");
            if (Declare.Button.NUMBER_00 <= keyCode && keyCode <= Declare.Button.NUMBER_09) {
                if (Global.DataInputStep == DATAINPUTSTEP.INPUT_01) {
                    strText_Line_01_Input += keyCode - 7;

                    if (strText_Line_01_Input.length() > 4) {
                        strText_Line_01_Input = strText_Line_01_Input.substring(1);
                    }
                } else if (Global.DataInputStep == DATAINPUTSTEP.INPUT_02) {
                    strText_Line_02_Input += keyCode - 7;

                    if (strText_Line_02_Input.length() > 2) {
                        strText_Line_02_Input = strText_Line_02_Input.substring(1);
                    }
                } else if (Global.DataInputStep == DATAINPUTSTEP.INPUT_03) {
                    strText_Line_03_Input += keyCode - 7;

                    if (strText_Line_03_Input.length() > 2) {
                        strText_Line_03_Input = strText_Line_03_Input.substring(1);
                    }
                } else if (Global.DataInputStep == DATAINPUTSTEP.INPUT_04) {
                    strText_Line_04_Input += keyCode - 7;

                    if (strText_Line_04_Input.length() > 2) {
                        strText_Line_04_Input = strText_Line_04_Input.substring(1);
                    }
                } else if (Global.DataInputStep == DATAINPUTSTEP.INPUT_05) {
                    strText_Line_05_Input += keyCode - 7;

                    if (strText_Line_05_Input.length() > 2) {
                        strText_Line_05_Input = strText_Line_05_Input.substring(1);
                    }
                }
                UpdateScreen();
            } else if (keyCode == Declare.Button.STAR) {
                if (Global.DataInputStep == DATAINPUTSTEP.INPUT_01) {
                    Global.DataInputStep = DATAINPUTSTEP.INPUT_02;
                } else if (Global.DataInputStep == DATAINPUTSTEP.INPUT_02) {
                    Global.DataInputStep = DATAINPUTSTEP.INPUT_03;
                } else if (Global.DataInputStep == DATAINPUTSTEP.INPUT_03) {
                    Global.DataInputStep = DATAINPUTSTEP.INPUT_04;
                } else if (Global.DataInputStep == DATAINPUTSTEP.INPUT_04) {
                    Global.DataInputStep = DATAINPUTSTEP.INPUT_05;
                } else if (Global.DataInputStep == DATAINPUTSTEP.INPUT_05) {
                    Global.DataInputStep = DATAINPUTSTEP.INPUT_01;
                }
                UpdateScreen();
            } else if (keyCode == Declare.Button.GUARD) {
                // 시간정보를 저장하는 기능을 정의한다.
                if (setCalendar(strText_Line_01_Input, strText_Line_02_Input, strText_Line_03_Input, strText_Line_04_Input, strText_Line_05_Input)) {
                    MainActivity.mSound.PlayMent_lobby(R.raw.setting);
                    super.setChangeScreen(ID.SCREENS.AdminSet_Setting);
                } else {
                    MainActivity.mSound.PlayMent_lobby(R.raw.retryinput);
                    Initialize();
                    UpdateScreen();
                }
            } else if (keyCode == Declare.Button.CANCEL || keyCode == Declare.Button.TACT_CANCEL) {
                super.setChangeScreen(ID.SCREENS.AdminSet_Setting);
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] onKeyDown(...) : " + e);
            e.printStackTrace();
        }
        super.onKeyDown(keyCode, event);
    }

    private void UpdateScreen() {
        try {
            LOG("[updateScreen] Start!!");
            Text_Line_01_Input.setText(strText_Line_01_Input);
            Text_Line_02_Input.setText(strText_Line_02_Input);
            Text_Line_03_Input.setText(strText_Line_03_Input);
            Text_Line_04_Input.setText(strText_Line_04_Input);
            Text_Line_05_Input.setText(strText_Line_05_Input);

            if (Global.DataInputStep == DATAINPUTSTEP.INPUT_01) {
                Text_Line_01_Input.setTextColor(TextColor_Highlight);
                Text_Line_02_Input.setTextColor(TextColor_Normal);
                Text_Line_03_Input.setTextColor(TextColor_Normal);
                Text_Line_04_Input.setTextColor(TextColor_Normal);
                Text_Line_05_Input.setTextColor(TextColor_Normal);
            } else if (Global.DataInputStep == DATAINPUTSTEP.INPUT_02) {
                Text_Line_01_Input.setTextColor(TextColor_Normal);
                Text_Line_02_Input.setTextColor(TextColor_Highlight);
                Text_Line_03_Input.setTextColor(TextColor_Normal);
                Text_Line_04_Input.setTextColor(TextColor_Normal);
                Text_Line_05_Input.setTextColor(TextColor_Normal);
            } else if (Global.DataInputStep == DATAINPUTSTEP.INPUT_03) {
                Text_Line_01_Input.setTextColor(TextColor_Normal);
                Text_Line_02_Input.setTextColor(TextColor_Normal);
                Text_Line_03_Input.setTextColor(TextColor_Highlight);
                Text_Line_04_Input.setTextColor(TextColor_Normal);
                Text_Line_05_Input.setTextColor(TextColor_Normal);
            } else if (Global.DataInputStep == DATAINPUTSTEP.INPUT_04) {
                Text_Line_01_Input.setTextColor(TextColor_Normal);
                Text_Line_02_Input.setTextColor(TextColor_Normal);
                Text_Line_03_Input.setTextColor(TextColor_Normal);
                Text_Line_04_Input.setTextColor(TextColor_Highlight);
                Text_Line_05_Input.setTextColor(TextColor_Normal);
            } else if (Global.DataInputStep == DATAINPUTSTEP.INPUT_05) {
                Text_Line_01_Input.setTextColor(TextColor_Normal);
                Text_Line_02_Input.setTextColor(TextColor_Normal);
                Text_Line_03_Input.setTextColor(TextColor_Normal);
                Text_Line_04_Input.setTextColor(TextColor_Normal);
                Text_Line_05_Input.setTextColor(TextColor_Highlight);
            } else {
                Text_Line_01_Input.setTextColor(TextColor_Normal);
                Text_Line_02_Input.setTextColor(TextColor_Normal);
                Text_Line_03_Input.setTextColor(TextColor_Normal);
                Text_Line_04_Input.setTextColor(TextColor_Normal);
                Text_Line_05_Input.setTextColor(TextColor_Normal);
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] updateScreen() : " + e);
            e.printStackTrace();
        }
    }

    private void getCalendar() {
        try {
//            LOG("[getCalendar] Start!!");

            final Calendar Cal = Calendar.getInstance();

            SetCal.nYear = Cal.get(Calendar.YEAR);   // 년도
            SetCal.nMonth = Cal.get(Calendar.MONTH);   // 월 (1월 ~ 12월 : 0 ~ 11)
            SetCal.nDate = Cal.get(Calendar.DATE);   // 일
            SetCal.nAMPM = Cal.get(Calendar.AM_PM);   // 오전, 오후 (0 : 오전, 1 : 오후)
            SetCal.nHour = Cal.get(Calendar.HOUR_OF_DAY);   // 시
            SetCal.nMin = Cal.get(Calendar.MINUTE);   // 분

            LOG("[getCalendar] CALENDAR [" + SetCal.nYear + "." + Global.ZeroPadding_Head(2, Integer.toString(SetCal.nMonth + 1)) + "." + Global.ZeroPadding_Head(2, Integer.toString(SetCal.nDate)) + "]");
            LOG("[getCalendar] CALENDAR [" + SetCal.nAMPM + " " + Global.ZeroPadding_Head(2, Integer.toString(SetCal.nHour)) + ":" + Global.ZeroPadding_Head(2, Integer.toString(SetCal.nMin)) + "]");

        } catch (Exception e) {
            Log.e(TAG, "[Exception] getCalendar() : " + e);
            e.printStackTrace();
        }
    }

    private POSITION getPosition(int nID) {
//        LOG("[getPosition] Start!!");
        POSITION position = new POSITION();
        position.SetPosition(0, 0, 480, 272);
        try {
            switch (nID) {
                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.IMAGES.BACKGROUND:
                    position.SetPosition(0, 0, 480, 272);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.TITLE:
                    position.SetPosition(0, 24, 480, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_01_Item:
                    position.SetPosition(30, 104, 165, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_02_Item:
                    position.SetPosition(30, 154, 165, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_03_Item:
                    position.SetPosition(205, 104, 20, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_04_Item:
                    position.SetPosition(300, 104, 15, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_05_Item:
                    position.SetPosition(355, 104, 15, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_06_Item:
                    position.SetPosition(400, 104, 40, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_07_Item:
                    position.SetPosition(205, 154, 20, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_08_Item:
                    position.SetPosition(260, 154, 10, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_09_Item:
                    position.SetPosition(300, 154, 40, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_01_Input:
                    position.SetPosition(225, 104, 95, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_02_Input:
                    position.SetPosition(315, 104, 50, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_03_Input:
                    position.SetPosition(370, 104, 50, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_04_Input:
                    position.SetPosition(225, 154, 45, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_CALENDAR.ELEMENTS.TEXTS.LINE_05_Input:
                    position.SetPosition(270, 154, 45, 40);
                    return position;

                default:
                    return position;
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] getPosition() : " + e);
            e.printStackTrace();
            return position;
        }
    }

    private boolean setCalendar(String year, String month, String date, String hour, String min) {
        try {
            LOG("[setCalendar] Cal Values [" + year + "/" + month + "/" + date + " " + hour + ":" + min + "]");
            int nYear = 0, nMonth = 0, nDate = 0, nHour = 0, nMin = 0;
            nYear = Integer.parseInt(year);
            nMonth = Integer.parseInt(month);
            nDate = Integer.parseInt(date);
            nHour = Integer.parseInt(hour);
            nMin = Integer.parseInt(min);
            LOG("[setCalendar] Cal Values [" + nYear + "/" + nMonth + "/" + nDate + " " + nHour + ":" + nMin + "]");
            return Global.setSystemTime(nYear, nMonth, nDate, nHour, nMin);
        } catch (Exception e) {
            Log.e(TAG, "[Exception] setCalendar(year, month, date, hour, min)");
            e.printStackTrace();
            return false;
        }
    }

    static class SetCal {
        static int nYear;   // 년도
        static int nMonth;   // 월
        static int nDate;   // 일
        static int nAMPM;   // 오전, 오후
        static int nHour;   // 시
        static int nMin;   // 분
    }


}