public NameColumn(ImageGetterDelegate imageGetterDelegate) { AspectName = "Name"; FillsFreeSpace = false; AspectGetter = item => ((ConnectionInfo)item).Name; ImageGetter = imageGetterDelegate; }
private void setDelegates() { //tell the control who can expand TreeListView.CanExpandGetterDelegate canExpandGetter = delegate(object x) { var checkGroup = x as CheckGroup; return(checkGroup != null && checkGroup.subItems.Any()); }; this.olvChecks.CanExpandGetter = canExpandGetter; //tell the control how to expand TreeListView.ChildrenGetterDelegate childrenGetter = delegate(object x) { var checkGroup = x as CheckGroup; return(checkGroup?.subItems); }; this.olvChecks.ChildrenGetter = childrenGetter; //tell the control which image to show ImageGetterDelegate imageGetter = delegate(object rowObject) { if (rowObject is Check) { return("Check"); } else { return("package"); } }; this.olvColName.ImageGetter = imageGetter; }
private void setDelegates() { //tell the control who can expand TreeListView.CanExpandGetterDelegate canExpandGetter = delegate(object x) { var mappingNode = (MappingNode)x; return(mappingNode.childNodes.Any()); }; this.sourceTreeView.CanExpandGetter = canExpandGetter; this.targetTreeView.CanExpandGetter = canExpandGetter; //tell the control how to expand TreeListView.ChildrenGetterDelegate childrenGetter = delegate(object x) { var mappingNode = (MappingNode)x; return(mappingNode.childNodes); }; this.sourceTreeView.ChildrenGetter = childrenGetter; this.targetTreeView.ChildrenGetter = childrenGetter; //parentgetter to be able to reveal deeply nested nodes TreeListView.ParentGetterDelegate parentGetter = delegate(object x) { var mappingNode = (MappingNode)x; return(mappingNode.parent); }; this.sourceTreeView.ParentGetter = parentGetter; this.targetTreeView.ParentGetter = parentGetter; //tell the control which image to show ImageGetterDelegate imageGetter = delegate(object rowObject) { if (rowObject is ElementMappingNode) { if (((ElementMappingNode)rowObject).source is UML.Classes.Kernel.Package) { return("packageNode"); } else { return("classifierNode"); } } if (rowObject is AttributeMappingNode) { return("attributeNode"); } if (rowObject is AssociationMappingNode) { return("associationNode"); } else { return(string.Empty); } }; this.sourceColumn.ImageGetter = imageGetter; this.targetColumn.ImageGetter = imageGetter; }
private void setDelegates() { //tell the control who can expand TreeListView.CanExpandGetterDelegate canExpandGetter = delegate(object x) { var checkGroup = x as CheckGroup; return(checkGroup != null && checkGroup.subItems.Any()); }; this.olvChecks.CanExpandGetter = canExpandGetter; //tell the control how to expand TreeListView.ChildrenGetterDelegate childrenGetter = delegate(object x) { var checkGroup = x as CheckGroup; return(checkGroup?.subItems); }; this.olvChecks.ChildrenGetter = childrenGetter; //set image for check ImageGetterDelegate checkImageGetter = delegate(object rowObject) { var checkObject = rowObject as Check; if (checkObject != null) { if (checkObject.canBeResolved) { return("CheckAutoResolve"); } return("Check"); } return("package"); }; this.olvColName.ImageGetter = checkImageGetter; //set image for validation ImageGetterDelegate validationImageGetter = delegate(object rowObject) { var validationObject = rowObject as Validation; if (validationObject != null) { if (validationObject.isResolved) { return("Check"); } if (validationObject.check.canBeResolved) { return("ErrorAutoResolve"); } return("Error"); } return(string.Empty); }; this.olvColCheck.ImageGetter = validationImageGetter; }
private void setDelegates() { //tell the control who can expand TreeListView.CanExpandGetterDelegate canExpandGetter = delegate(object o) { var scriptGroup = o as ScriptGroup; if (scriptGroup != null) { return(scriptGroup.scripts.Any()); } var script = o as Script; if (script != null) { return(script.includedScripts.Any()); } return(((ScriptInclude)o).hasIncludes); }; this.refdataTreeView.CanExpandGetter = canExpandGetter; //tell the control how to expand TreeListView.ChildrenGetterDelegate childrenGetter = delegate(object o) { var scriptGroup = o as ScriptGroup; if (scriptGroup != null) { return(scriptGroup.scripts.OrderBy(x => x.name)); } var script = o as Script; if (script != null) { return(script.includedScripts); } return(((ScriptInclude)o).scriptIncludes); }; this.refdataTreeView.ChildrenGetter = childrenGetter; //tell the control which image to show ImageGetterDelegate imageGetter = delegate(object rowObject) { if (rowObject is Script || rowObject is ScriptInclude) { return("Script"); } else { return("ScriptGroup"); } }; this.nameColumn.ImageGetter = imageGetter; }
private void setColumnsListViewDelegates() { //tell the control who can expand (only tables) TreeListView.CanExpandGetterDelegate canExpandGetter = delegate(object x) { return(x is EDDTable); }; this.columnsListView.CanExpandGetter = canExpandGetter; this.dColumnsListView.CanExpandGetter = canExpandGetter; //tell the control how to expand TreeListView.ChildrenGetterDelegate childrenGetter = delegate(object x) { var table = (EDDTable)x; return(table.columns); }; this.columnsListView.ChildrenGetter = childrenGetter; this.dColumnsListView.ChildrenGetter = childrenGetter; //tell the control which image to show ImageGetterDelegate imageGetter = delegate(object rowObject) { if (rowObject is EDDTable) { return("table"); } if (rowObject is EDDColumn) { return("column"); } else { return(string.Empty); } }; this.C_NameColumn.ImageGetter = imageGetter; this.dC_NameColumn.ImageGetter = imageGetter; }
private void AddColumns(ImageGetterDelegate imageGetterDelegate) { Columns.Add(new NameColumn(imageGetterDelegate)); }
/// <summary> /// Constructor for a MainView form object. /// </summary> /// <param name="logger">Message handler for all messages.</param> public MainView(Logger logger) { //TODO: split this into bits and see for code duplicate with duplicateview InitializeComponent(); //initialize logger _logger = logger; _logger.MessageHandler += LogEventHandler; //OVERRIDE _dbfilename = "..\\places.sqlite"; //OVERRIDE _duplicatesView = new DuplicatesView(_dbfilename); _duplicatesView.PathSelectionEvent += DuplicatesView_pathSelectionEvent; _dbc = new DbController(_dbfilename); _dbc.RefreshFoldersList(); _mainEditPanel = new EditPanel(_dbc); _mainInfoPanel = new InfoPanel(_dbc); Controls.Add(_mainEditPanel); Controls.Add(_mainInfoPanel); _mainEditPanel.Parent = editContainerPanel; _mainEditPanel.Dock = DockStyle.Fill; _mainInfoPanel.Parent = editContainerPanel; _mainInfoPanel.Dock = DockStyle.Fill; //set up delegates for mainTreeView mainTreeView.CanExpandGetter = x => _dbc.HasChildrenBookmarks(((BookmarkItem)x).Id); mainTreeView.ChildrenGetter = x => _dbc.GetBookmarksChildren(((BookmarkItem)x).Id, 2); //cell tooltip initialization delegate Action <ToolTipControl> initCellToolTip = delegate(ToolTipControl control) { control.IsBalloon = true; control.SetMaxWidth(400); control.StandardIcon = ToolTipControl.StandardIcons.InfoLarge; control.BackColor = Color.AliceBlue; control.ForeColor = Color.IndianRed; control.AutoPopDelay = 15000; control.InitialDelay = 750; control.ReshowDelay = 750; control.Font = new Font("Tahoma", 10.0f); }; initCellToolTip(mainContentsView.CellToolTip); initCellToolTip(mainTreeView.CellToolTip); initCellToolTip(_duplicatesView.mainTreeView.CellToolTip); EventHandler <ToolTipShowingEventArgs> tooltipDelegate = delegate(object x, ToolTipShowingEventArgs e) { var bi = (BookmarkItem)e.Model; if (bi.IsSeparator) { return; } e.Title = "INFO"; const string dateFormat = "dd/MM/yyyy HH:mm:ss"; e.Text = "ID:\t\t" + bi.Id + "\r\n" + (bi.Title != "" ? "Title:\t\t" + bi.Title + "\r\n" : "") + (bi.Location != "" ? "Location:\t" + bi.Location + "\r\n" : "") + (bi.Description != "" ? "Description:\t" + bi.Description + "\r\n" : "") + (bi.DateAdded != 0 ? "Date Created:\t" + bi.DateAddedDt.ToString(dateFormat) + "\r\n" : "") + (bi.LastModified != 0 ? "Last Modified:\t" + bi.LastModifiedDt.ToString(dateFormat) + "\r\n" : ""); }; mainTreeView.CellToolTipShowing += tooltipDelegate; mainContentsView.CellToolTipShowing += tooltipDelegate; ImageGetterDelegate dg = delegate(object x) { if (!((BookmarkItem)x).IsSeparator) { return(((BookmarkItem)x).IsDirectory ? 0 : 1); //0 - folder; 1 - bookmark } return(-1); }; titleColMCV.ImageGetter = dg; titleColMTV.ImageGetter = dg; //TODO: OPT - find a way to display a separator graphically const string separator = "----------"; titleColMCV.AspectGetter = x => ((BookmarkItem)x).Type != 3 ? ((BookmarkItem)x).Title : separator; locationColMCV.AspectGetter = x => ((BookmarkItem)x).Type != 3 ? ((BookmarkItem)x).Location : separator; InitContextMenuStrip(); //OVERRIDE mainTreeView.Roots = _dbc.GetBookmarksRoots(); if (mainTreeView.Items.Count > 0) { mainTreeView.SelectedIndex = 0; } _logger.LogInfo("Database connected."); UpdateInfoLabel(); //OVERRIDE }