1 | using System.Windows.Forms;
|
---|
2 | using HeuristicLab.Core;
|
---|
3 | using HeuristicLab.Core.Views;
|
---|
4 | using HeuristicLab.MainForm;
|
---|
5 |
|
---|
6 | namespace HeuristicLab.EvolutionTracking.Views {
|
---|
7 | [View("GenealogyGraphView")]
|
---|
8 | [Content(typeof(IGenealogyGraph<>), IsDefaultView = false)]
|
---|
9 | public partial class GenealogyGraphView<T> : ItemView where T : class, IItem {
|
---|
10 | public new IGenealogyGraph<T> Content {
|
---|
11 | get { return (IGenealogyGraph<T>)base.Content; }
|
---|
12 | set { base.Content = value; }
|
---|
13 | }
|
---|
14 |
|
---|
15 | public GenealogyGraphView() {
|
---|
16 | InitializeComponent();
|
---|
17 | }
|
---|
18 |
|
---|
19 | protected override void DeregisterContentEvents() {
|
---|
20 | // TODO: Deregister your event handlers here
|
---|
21 | genealogyGraphChart.GenealogyGraphNodeClicked -= graphChart_GenealogyGraphNodeClicked;
|
---|
22 | genealogyGraphChart.GenealogyGraphNodeDoubleClicked -= graphChart_GenealogyGraphNodeDoubleClicked;
|
---|
23 | base.DeregisterContentEvents();
|
---|
24 | }
|
---|
25 |
|
---|
26 | protected override void RegisterContentEvents() {
|
---|
27 | base.RegisterContentEvents();
|
---|
28 | // TODO: Register your event handlers here
|
---|
29 | genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked;
|
---|
30 | genealogyGraphChart.GenealogyGraphNodeDoubleClicked += graphChart_GenealogyGraphNodeDoubleClicked;
|
---|
31 | }
|
---|
32 |
|
---|
33 | #region Event Handlers (Content)
|
---|
34 | // TODO: Put event handlers of the content here
|
---|
35 | protected override void OnContentChanged() {
|
---|
36 | base.OnContentChanged();
|
---|
37 | if (Content != null && Content != genealogyGraphChart.GenealogyGraph) { genealogyGraphChart.GenealogyGraph = Content; }
|
---|
38 | }
|
---|
39 | #endregion
|
---|
40 |
|
---|
41 | protected override void SetEnabledStateOfControls() {
|
---|
42 | base.SetEnabledStateOfControls();
|
---|
43 | // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
|
---|
44 | }
|
---|
45 |
|
---|
46 | #region Event Handlers (child controls)
|
---|
47 | // TODO: Put event handlers of child controls here.
|
---|
48 | public virtual void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs args) {
|
---|
49 | var visualNode = (VisualGenealogyGraphNode)sender;
|
---|
50 | var graphNode = (IGenealogyGraphNode<T>)visualNode.Data;
|
---|
51 | if (graphNode == null || graphNode.Data == null) return;
|
---|
52 | viewHost.Content = graphNode.Data;
|
---|
53 | }
|
---|
54 | public virtual void graphChart_GenealogyGraphNodeDoubleClicked(object sender, MouseEventArgs arcs) {
|
---|
55 | }
|
---|
56 | #endregion
|
---|
57 |
|
---|
58 | #region events for configuring the behavior of the genealogy chart (trace/match, simple lineages, etc)
|
---|
59 | private void trace_checkBox_CheckedChanged(object sender, System.EventArgs e) {
|
---|
60 | //genealogyGraphChart.TraceFragments = trace_checkBox.Checked;
|
---|
61 | }
|
---|
62 |
|
---|
63 | private void simpleLineages_checkBox_CheckedChanged(object sender, System.EventArgs e) {
|
---|
64 | //genealogyGraphChart.SimpleLineages = simpleLineages_checkBox.Checked;
|
---|
65 | }
|
---|
66 |
|
---|
67 | private void lockGraph_checkBox_CheckedChanged(object sender, System.EventArgs e) {
|
---|
68 | //genealogyGraphChart.LockGenealogy = lockGraph_checkBox.Checked;
|
---|
69 | }
|
---|
70 | #endregion
|
---|
71 | }
|
---|
72 | }
|
---|