[10302] | 1 | using System.Windows.Forms;
|
---|
[11817] | 2 | using HeuristicLab.Core;
|
---|
[10302] | 3 | using HeuristicLab.Core.Views;
|
---|
[10264] | 4 | using HeuristicLab.MainForm;
|
---|
| 5 |
|
---|
[10271] | 6 | namespace HeuristicLab.EvolutionTracking.Views {
|
---|
[10300] | 7 | [View("GenealogyGraphView")]
|
---|
[11817] | 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; }
|
---|
[10264] | 12 | set { base.Content = value; }
|
---|
| 13 | }
|
---|
| 14 |
|
---|
[10300] | 15 | public GenealogyGraphView() {
|
---|
[10264] | 16 | InitializeComponent();
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | protected override void DeregisterContentEvents() {
|
---|
| 20 | // TODO: Deregister your event handlers here
|
---|
[10501] | 21 | genealogyGraphChart.GenealogyGraphNodeClicked -= graphChart_GenealogyGraphNodeClicked;
|
---|
[11817] | 22 | genealogyGraphChart.GenealogyGraphNodeDoubleClicked -= graphChart_GenealogyGraphNodeDoubleClicked;
|
---|
[10264] | 23 | base.DeregisterContentEvents();
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | protected override void RegisterContentEvents() {
|
---|
| 27 | base.RegisterContentEvents();
|
---|
| 28 | // TODO: Register your event handlers here
|
---|
[10501] | 29 | genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked;
|
---|
[11817] | 30 | genealogyGraphChart.GenealogyGraphNodeDoubleClicked += graphChart_GenealogyGraphNodeDoubleClicked;
|
---|
[10264] | 31 | }
|
---|
| 32 |
|
---|
| 33 | #region Event Handlers (Content)
|
---|
| 34 | // TODO: Put event handlers of the content here
|
---|
| 35 | protected override void OnContentChanged() {
|
---|
| 36 | base.OnContentChanged();
|
---|
[10501] | 37 | if (Content != null) { genealogyGraphChart.GenealogyGraph = Content; }
|
---|
[10264] | 38 | }
|
---|
[10501] | 39 | #endregion
|
---|
[10300] | 40 |
|
---|
[10264] | 41 | protected override void SetEnabledStateOfControls() {
|
---|
| 42 | base.SetEnabledStateOfControls();
|
---|
[10300] | 43 | // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
|
---|
[10264] | 44 | }
|
---|
| 45 |
|
---|
| 46 | #region Event Handlers (child controls)
|
---|
[10300] | 47 | // TODO: Put event handlers of child controls here.
|
---|
[10501] | 48 | public virtual void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs args) {
|
---|
[11817] | 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;
|
---|
[10501] | 55 | }
|
---|
[11817] | 56 | public virtual void graphChart_GenealogyGraphNodeDoubleClicked(object sender, MouseEventArgs arcs) {
|
---|
| 57 | }
|
---|
[10264] | 58 | #endregion
|
---|
[11817] | 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
|
---|
[10264] | 73 | }
|
---|
| 74 | }
|
---|