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) return;
|
---|
52 | var content = graphNode.Data;
|
---|
53 | if (content == null) return;
|
---|
54 | viewHost.Content = content;
|
---|
55 | }
|
---|
56 | public virtual void graphChart_GenealogyGraphNodeDoubleClicked(object sender, MouseEventArgs arcs) {
|
---|
57 | }
|
---|
58 | #endregion
|
---|
59 |
|
---|
60 | #region events for configuring the behavior of the genealogy chart (trace/match, simple lineages, etc)
|
---|
61 | private void trace_checkBox_CheckedChanged(object sender, System.EventArgs e) {
|
---|
62 | genealogyGraphChart.TraceFragments = trace_checkBox.Checked;
|
---|
63 | }
|
---|
64 |
|
---|
65 | private void simpleLineages_checkBox_CheckedChanged(object sender, System.EventArgs e) {
|
---|
66 | genealogyGraphChart.SimpleLineages = simpleLineages_checkBox.Checked;
|
---|
67 | }
|
---|
68 |
|
---|
69 | private void lockGraph_checkBox_CheckedChanged(object sender, System.EventArgs e) {
|
---|
70 | genealogyGraphChart.LockGenealogy = lockGraph_checkBox.Checked;
|
---|
71 | }
|
---|
72 | #endregion
|
---|
73 | }
|
---|
74 | }
|
---|