예제 #1
0
        public virtual ValueEditor GetValueEditor(DataType?type = null)
        {
            ValueEditor result = DefaultEditor;

            type = type ?? DataType;
            if (result == null)
            {
                switch (type.Value)
                {
                case DataType.Date:
                case DataType.Time:
                case DataType.DateTime:
                    result = new DateTimeValueEditor();
                    break;

                case DataType.Bool:
                    result = new CustomListValueEditor("BooleanValues", "MENU");
                    break;

                default:
                    result = new TextValueEditor();
                    break;
                }
            }

            if (result is DateTimeValueEditor)
            {
                ((DateTimeValueEditor)result).SubType = type.Value;
            }

            return(result);
        }
예제 #2
0
        public ValueEditor Create(string tag)
        {
            switch (tag)
            {
            case EditorTags.Text:
                return(new TextValueEditor());

            case EditorTags.DateTime:
                return(new DateTimeValueEditor());

            case EditorTags.Date:
                var dateEditor = new DateTimeValueEditor();
                dateEditor.SubType = DataType.Date;
                return(dateEditor);

            case EditorTags.Time:
                var timeEditor = new DateTimeValueEditor();
                timeEditor.SubType = DataType.Time;
                return(timeEditor);

            case EditorTags.CustomList:
                return(new CustomListValueEditor());

            case EditorTags.ConstList:
                return(new ConstListValueEditor());

            case EditorTags.ConstListBox:
                var listBoxEditor = new ConstListValueEditor();
                listBoxEditor.ControlType = "LISTBOX";
                return(listBoxEditor);

            case EditorTags.ConstListMulty:
                var multiListEditor = new ConstListValueEditor();
                multiListEditor.ControlType = "MULTILIST";
                return(multiListEditor);

            case EditorTags.Custom:
                return(new CustomValueEditor());

            default:
                return(null);
            }
        }