예제 #1
0
 ILayoutCellEditor ListParamsRetriveCellEditor(object listItem, object value, ILayoutCell cell)
 {
     if (cell.Name == nameof(QParam.Value))
     {
         QParam            param  = (QParam)listItem;
         ILayoutCellEditor editor = null;
         if (param != null && param.Column != null && !editors.TryGetValue(param, out editor))
         {
             if ((param.Column.IsPrimaryKey || param.Column.IsReference) && param.Comparer.Type == CompareTypes.In)
             {
                 if (!(param.Value is QQuery) && param.Column.IsReference && param.Value == null)
                 {
                     var sub = new QQuery(string.Empty, param.Column.ReferenceTable);
                     sub.BuildColumn(param.Column.ReferenceTable.PrimaryKey);
                     param.ValueRight = sub;
                 }
                 editor = new CellEditorQuery();
             }
             else
             {
                 editor = TableLayoutList.InitCellEditor(param.Column);
                 if (param.Column.DataType == typeof(DateTime) && param.Comparer.Equals(CompareType.Between))
                 {
                     ((CellEditorDate)editor).TwoDate = true;
                 }
             }
             editors[param] = editor;
         }
         return(editor);
     }
     return(null);
 }
예제 #2
0
 public void BindData(DBItem dataSource, DBColumn column, DBTable refer = null)
 {
     if (Column != column && dataSource?.GetType() != DataSource.GetType())
     {
         Binding?.Dispose();
         if (column != null)
         {
             CellEditor = TableLayoutList.InitCellEditor(column);
             if (CellEditor is CellEditorTable && refer != null)
             {
                 ((CellEditorTable)CellEditor).Table = refer;
             }
             Binding = new InvokeBinder <DBItem, FieldEditor>(dataSource, column, this, EmitInvoker.Initialize <FieldEditor>(nameof(Value)));
         }
     }
     DataSource = dataSource;
 }
예제 #3
0
파일: TableView.cs 프로젝트: radtek/datawf
        public TableView()
            : base()
        {
            list = new TableLayoutList()
            {
                EditState        = EditListState.ReadOnly,
                GenerateToString = false,
                Name             = "list"
            };
            list.PositionChanged  += OnNotifyPositionChangedEV;
            list.SelectionChanged += OnSelectionChanged;
            list.CellDoubleClick  += TableViewCellDoubleClick;

            lable = new ToolLabel {
                Name = "lable", Text = "_"
            };

            toolLoad = new ToolItem(ToolLoadClick)
            {
                DisplayStyle = ToolItemDisplayStyle.Text,
                Name         = "Load",
                Text         = "Load"
            };

            toolProgress = new ToolTableLoader {
                Loader = loader
            };

            bar = new Toolsbar(
                lable,
                toolLoad,
                toolProgress)
            {
                Name = "Bar"
            };

            Name = "TableView";
            PackStart(bar, false, false);
            PackStart(list, true, true);
        }
예제 #4
0
파일: QueryList.cs 프로젝트: radtek/datawf
        protected override ILayoutCellEditor GetCellEditor(object listItem, object itemValue, ILayoutCell cell)
        {
            if (cell.Name == "Column" && cell.GetEditor(listItem) == null)
            {
                if (query.Table == null)
                {
                    return(null);
                }

                return(new CellEditorList {
                    DataSource = query.Table.Columns
                });
            }
            if (cell == colValue)
            {
                QParam            param  = (QParam)listItem;
                ILayoutCellEditor editor = null;
                if (param.Column != null)
                {
                    if ((param.Column.IsPrimaryKey || param.Column.IsReference) && param.Comparer.Type == CompareTypes.In)
                    {
                        if (param.Column.IsReference && param.Value == null)
                        {
                            param.ValueRight = new QQuery(string.Empty, param.Column.ReferenceTable);
                        }
                        editor = new CellEditorQuery();
                    }
                    else
                    {
                        editor = TableLayoutList.InitCellEditor(param.Column);
                    }
                    return(editor);
                }
            }
            return(base.GetCellEditor(listItem, itemValue, cell));
        }
예제 #5
0
        public DataQuery()
        {
            tw.Mode = ToolShowMode.Dialog;
            tw.ButtonAccept.Click += ButtonAccept_Click;

            timeInterval.Interval = 1000;
            timeInterval.Elapsed += TimeIntervalTick;

            toolSave = new ToolItem(ToolSaveClick)
            {
                Name = "Save", Glyph = GlyphType.SaveAlias
            };
            toolLoad = new ToolItem(ToolLoadClick)
            {
                Name = "Load", Glyph = GlyphType.FolderOpen
            };
            toolExecute = new ToolItem(ToolExecuteClick)
            {
                Name = "Execute", Glyph = GlyphType.Play
            };
            toolParser = new ToolItem(ToolParseClick)
            {
                Name = "Parse", Glyph = GlyphType.Code
            };
            toolGenerate = new ToolItem(ToolGenerateClick)
            {
                Name = "Generate", Glyph = GlyphType.GearAlias
            };
            toolStop = new ToolItem(ToolStopClick)
            {
                Name = "Stop", Glyph = GlyphType.Stop
            };
            toolResult = new ToolItem(ToolSpliterClick)
            {
                Name = "Result", CheckOnClick = true, Glyph = GlyphType.List
            };
            toolTimer = new ToolLabel {
                Name = "Timer", Text = "_:_"
            };
            toolSchems = new ToolFieldEditor
            {
                Name   = "toolSchems",
                Editor = new CellEditorList
                {
                    DataType   = typeof(DBSchema),
                    DataSource = DBService.Schems
                }
            };
            toolSchems.Field.BindData(this, nameof(CurrentSchema));
            //var fieldstring = new DataField<string>();
            //var fieldschema = new DataField<DBSchema>();
            //ListStore store = new ListStore(fieldstring, fieldschema);
            //foreach (var schema in DBService.Schems)
            //store.SetValues(store.AddRow(), fieldstring, schema.Name, fieldschema, schema);
            //toolSchems.ComboBox.Views.Add(new TextCellView(fieldstring));
            //toolSchems.ComboBox.ItemsSource = store;
            //toolSchems.ComboBox.DataSource = DBService.Schems;

            bar = new Toolsbar(
                toolSchems,
                toolLoad,
                toolSave,
                new ToolSeparator(),
                toolExecute,
                toolStop,
                new ToolSeparator(),
                toolGenerate,
                toolParser,
                new ToolSeparator()
            {
                FillWidth = true
            },
                toolResult,
                toolTimer)
            {
                Name = "bar"
            };

            queryText = new TextEditor {
                Name = "queryText", Text = ""
            };
            queryText.Document.MimeType = "text/x-sql";
            //queryText.TextArea.ColorStyle = Mono.TextEditor.Highlighting.ColorScheme.LoadFrom[""];

            var scroll = new ScrollView()
            {
                Content = queryText
            };

            list = new TableLayoutList()
            {
                GenerateToString = false,
                Visible          = false
            };

            container = new HPaned();
            container.Panel1.Content = scroll;
            container.Panel2.Content = list;

            Name = "DataQuery";
            PackStart(bar, false, false);
            PackStart(container, true, true);

            Localize();

            toolFind = new FindWindow {
                Editor = queryText
            };
            CurrentSchema = DBService.Schems.DefaultSchema;
        }
예제 #6
0
        public DataLogView()
        {
            toolModeDefault = new ToolMenuItem {
                Name = "Default", Tag = DataLogMode.Default
            };
            toolModeDocument = new ToolMenuItem {
                Name = "Document", Tag = DataLogMode.Document
            };
            toolModeTable = new ToolMenuItem {
                Name = "Table", Tag = DataLogMode.Table
            };

            toolMode = new ToolDropDown(
                toolModeDefault,
                toolModeDocument,
                toolModeTable)
            {
                DisplayStyle = ToolItemDisplayStyle.Text,
                Name         = "LogMode",
                Text         = "Mode: Default"
            };
            toolMode.ItemClick += ToolModeClick;

            toolRollback = new ToolItem(ToolRollbackClick)
            {
                Name = "Rollback", DisplayStyle = ToolItemDisplayStyle.Text
            };
            toolAccept = new ToolItem(ToolAcceptClick)
            {
                Name = "Accept", DisplayStyle = ToolItemDisplayStyle.Text
            };
            toolCheck = new ToolItem()
            {
                Name = "Check", DisplayStyle = ToolItemDisplayStyle.Text
            };
            toolDetails = new ToolItem(ToolDetailsClick)
            {
                Name = "Details", DisplayStyle = ToolItemDisplayStyle.Text
            };

            dateField = new ToolFieldEditor()
            {
                Editor = new CellEditorDate {
                    TwoDate = true, DataType = typeof(DateInterval)
                },
                Name            = "Date",
                ContentMinWidth = 200
            };
            dateField.Field.BindData(this, nameof(Date));

            dataField = new ToolFieldEditor()
            {
                Editor = new CellEditorDataTree {
                    DataType = typeof(DBTable)
                },
                Name            = "Table",
                ContentMinWidth = 200
            };
            dataField.Field.BindData(this, nameof(Table));

            toolProgress = new ToolTableLoader()
            {
            };

            bar = new Toolsbar(
                toolRollback,
                toolMode,
                toolDetails,
                new ToolSeparator {
                FillWidth = true
            },
                dateField,
                dataField,
                toolProgress)
            {
                Name = "BarLog"
            };

            list = new LayoutList()
            {
                AllowEditColumn  = false,
                EditMode         = EditModes.None,
                EditState        = EditListState.Edit,
                GenerateToString = false,
                Mode             = LayoutListMode.List,
                Name             = "list",
                ListSource       = listSource = new SelectableList <DBLogItem>()
            };
            list.GenerateColumns   = true;
            list.CellMouseClick   += ListCellMouseClick;
            list.CellDoubleClick  += ListCellDoubleClick;
            list.SelectionChanged += ListSelectionChanged;

            //if (logs.Table != null)
            //    logs.ApplySort(new DBRowComparer(logs.Table.DateKey, ListSortDirection.Ascending));
            detailList = new TableLayoutList()
            {
                GenerateToString = false,
                GenerateColumns  = false,
                ReadOnly         = true,
                EditMode         = EditModes.ByClick
            };
            detailList.ListInfo.Columns.Add("Column", 120).Editable     = false;
            detailList.ListInfo.Columns.Add("OldFormat", 100).FillWidth = true;
            detailList.ListInfo.Columns.Add("NewFormat", 100).FillWidth = true;
            detailList.ListInfo.StyleRowName  = "ChangeRow";
            detailList.ListInfo.HeaderVisible = false;

            detailRow = new TableLayoutList();

            map = new GroupBox(
                new GroupBoxItem {
                Name = "Details", Widget = detailList, Column = 0, FillWidth = true, FillHeight = true
            },
                //new GroupBoxItem { Name = "Difference", Widget = detailText, Col = 1, FillWidth = true, FillHeight = true },
                new GroupBoxItem {
                Name = "Record", Widget = detailRow, Column = 2, FillWidth = true, FillHeight = true
            });
            //list.ListInfo.Columns.Add(list.BuildColumn(null, "Text"));

            split = new VPaned();
            split.Panel1.Content = list;
            //split.Panel2.Content = map;

            PackStart(bar, false, false);
            PackStart(split, true, true);
            Name = "DataLog";
        }
예제 #7
0
파일: DataExport.cs 프로젝트: radtek/datawf
        public DataExport()
        {
            toolInit = new ToolItem(ToolInitClick)
            {
                Name = "Init", DisplayStyle = ToolItemDisplayStyle.Text
            };
            toolScript = new ToolItem(ToolScriptClick)
            {
                Name = "Script", DisplayStyle = ToolItemDisplayStyle.Text
            };
            toolCode = new ToolItem(ToolCodeClick)
            {
                Name = "Code", DisplayStyle = ToolItemDisplayStyle.Text
            };
            toolSchema = new ToolItem(ToolSchemaClick)
            {
                Name = "Schema", DisplayStyle = ToolItemDisplayStyle.Text
            };
            toolStart = new ToolItem(ToolStartClick)
            {
                Name = "Start", DisplayStyle = ToolItemDisplayStyle.Text
            };
            toolCancel = new ToolItem(ToolCancelClick)
            {
                Name = "Cancel", Sensitive = false, DisplayStyle = ToolItemDisplayStyle.Text
            };
            toolProgress = new ToolProgressBar {
                Name = "Progress"
            };

            tools = new Toolsbar(
                toolInit,
                toolScript,
                toolCode,
                toolSchema,
                toolStart,
                toolCancel,
                toolProgress)
            {
                Name = "tools"
            };


            listTables = new ListEditor()
            {
                Name = "listTables", ReadOnly = false
            };
            listTables.List.SelectionChanged += ListTablesOnSelectionChahged;
            listTables.List.AllowCheck        = true;
            listTables.List.AllowSort         = false;
            listTables.List.EditMode          = EditModes.ByF2;

            listColumns = new ListEditor()
            {
                Name = "listColumns", ReadOnly = false
            };
            listColumns.List.AllowCheck = true;
            listColumns.List.AllowSort  = false;
            listColumns.List.EditMode   = EditModes.ByF2;

            setting = new TableLayoutList()
            {
                EditMode  = EditModes.ByClick,
                EditState = EditListState.Edit,
                Mode      = LayoutListMode.List,
                Name      = "setting",
                Text      = "Settings"
            };

            var gSetting = new GroupBoxItem()
            {
                Name          = "Setting",
                Widget        = setting,
                Column        = 0,
                Row           = 0,
                Autosize      = false,
                DefaultHeight = 250,
                Width         = 300
            };

            var gTable = new GroupBoxItem()
            {
                Name          = "Tables",
                Widget        = listTables,
                Column        = 1,
                Row           = 0,
                Autosize      = false,
                FillWidth     = true,
                DefaultHeight = 250
            };

            var gColumn = new GroupBoxItem()
            {
                Name       = "Columns",
                Widget     = listColumns,
                Column     = 0,
                Row        = 1,
                FillWidth  = true,
                FillHeight = true
            };

            map = new GroupBox(gSetting, gTable, gColumn);

            Name = "DataExport";
            Text = "Export";

            PackStart(tools, false, false);
            PackStart(map, true, true);
        }