Beispiel #1
0
 public DefineAnnotationDlg(IEnumerable <AnnotationDef> existing)
 {
     InitializeComponent();
     Icon = Resources.Skyline;
     checkedListBoxAppliesTo.Items.Clear();
     comboAppliesTo.Items.Clear();
     foreach (var annotationTarget in new[]
     {
         AnnotationDef.AnnotationTarget.protein,
         AnnotationDef.AnnotationTarget.peptide,
         AnnotationDef.AnnotationTarget.precursor,
         AnnotationDef.AnnotationTarget.transition,
         AnnotationDef.AnnotationTarget.replicate,
         AnnotationDef.AnnotationTarget.precursor_result,
         AnnotationDef.AnnotationTarget.transition_result,
     })
     {
         var item = new AnnotationTargetItem(annotationTarget, ModeUI);
         checkedListBoxAppliesTo.Items.Add(item);
         comboAppliesTo.Items.Add(item);
     }
     comboType.Items.AddRange(ListPropertyType.ListPropertyTypes().ToArray());
     comboType.SelectedIndex = 0;
     ComboHelper.AutoSizeDropDown(comboType);
     _existing   = existing;
     _dataSchema = BrowsingDataSchema.GetBrowsingDataSchema();
     availableFieldsTree1.RootColumn = NullRootColumn;
 }
Beispiel #2
0
        protected override void DoTest()
        {
            Assert.AreEqual(0, SkylineWindow.Document.Settings.DataSettings.Lists.Count);
            var documentSettingsDlg = ShowDialog <DocumentSettingsDlg>(SkylineWindow.ShowDocumentSettingsDialog);
            var listDesigner        = ShowDialog <ListDesigner>(documentSettingsDlg.AddList);

            RunUI(() =>
            {
                listDesigner.ListName = "Planets";
            });
            SetCellValue(listDesigner.ListPropertiesGrid, 0, 0, "Name");
            SetCellValue(listDesigner.ListPropertiesGrid, 1, 0, "Symbol");
            SetCellValue(listDesigner.ListPropertiesGrid, 2, 0, "Distance");
            SetCellValue(listDesigner.ListPropertiesGrid, 2, 1, ListPropertyType.GetAnnotationTypeName(AnnotationDef.AnnotationType.number));
            SetCellValue(listDesigner.ListPropertiesGrid, 3, 0, "Rings");
            SetCellValue(listDesigner.ListPropertiesGrid, 3, 1, ListPropertyType.GetAnnotationTypeName(AnnotationDef.AnnotationType.true_false));
            RunUI(() =>
            {
                listDesigner.IdProperty = "Name";
            });
            OkDialog(listDesigner, listDesigner.OkDialog);
            OkDialog(documentSettingsDlg, documentSettingsDlg.OkDialog);
            RunUI(() => SkylineWindow.ShowList("Planets"));
            var listGridForm = FindOpenForm <ListGridForm>();

            WaitForConditionUI(() => listGridForm.IsComplete);
            SetCellAddress(listGridForm.DataGridView, 0, 0);
            SetClipboardText(string.Join(TextUtil.SEPARATOR_TSV_STR, "Earth", "\u2641", 1.00000011, false));
            RunUI(listGridForm.DataGridView.SendPaste);
            SetCellAddress(listGridForm.DataGridView, 0, 0);
            WaitForConditionUI(() => listGridForm.IsComplete);
            var listData = SkylineWindow.Document.Settings.DataSettings.Lists.First();

            Assert.AreEqual(1, listData.RowCount);
            SetClipboardText(TextUtil.LineSeparate(
                                 string.Join(TextUtil.SEPARATOR_TSV_STR, "Mercury", "\u263F", 0.38709893, false),
                                 string.Join(TextUtil.SEPARATOR_TSV_STR, "Venus", "\u2640", 0.72333199, false),
                                 string.Join(TextUtil.SEPARATOR_TSV_STR, "Mars", "\u2642", 1.52366231, false),
                                 string.Join(TextUtil.SEPARATOR_TSV_STR, "Jupiter", "\u2643", 5.20336301, true),
                                 string.Join(TextUtil.SEPARATOR_TSV_STR, "Saturn", "\u2644", 9.53707032, true),
                                 string.Join(TextUtil.SEPARATOR_TSV_STR, "Uranus", "\u2645", 19.19126393, true),
                                 string.Join(TextUtil.SEPARATOR_TSV_STR, "Neptune", "\u2646", 30.06896348, true),
                                 string.Join(TextUtil.SEPARATOR_TSV_STR, "Pluto", "\u2647", 39.482, false)
                                 ));
            SetCellAddress(listGridForm.DataGridView, 1, 0);
            RunUI(listGridForm.DataGridView.SendPaste);
            SetCellAddress(listGridForm.DataGridView, 0, 0);
            listData = SkylineWindow.Document.Settings.DataSettings.Lists.First();
            Assert.AreEqual(9, listData.RowCount);
            SetCellAddress(listGridForm.DataGridView, 8, 0);
            var alertDlg = ShowDialog <AlertDlg>(listGridForm.DataboundGridControl.NavBar.ViewContext.Delete);

            OkDialog(alertDlg, alertDlg.ClickOk);
            SetCellAddress(listGridForm.DataGridView, 0, 0);
            listData = SkylineWindow.Document.Settings.DataSettings.Lists.First();
            Assert.AreEqual(8, listData.RowCount);
            OkDialog(listGridForm, listGridForm.Close);
            AssertEx.Serializable(SkylineWindow.Document);
        }
Beispiel #3
0
 private void SetListDef(ListDef listDef)
 {
     tbxListName.Text = listDef.Name;
     if (!string.IsNullOrEmpty(listDef.Name))
     {
         tbxListName.ReadOnly = true;
     }
     foreach (var property in listDef.Properties)
     {
         _listProperties.Add(new ListProperty(property));
     }
     colPropertyType.Items.Clear();
     foreach (var propertyType in ListPropertyType.ListPropertyTypes(_existing))
     {
         colPropertyType.Items.Add(propertyType);
     }
     PopulatePropertyDropdown(comboIdProperty, listDef.IdProperty);
     PopulatePropertyDropdown(comboDisplayProperty, listDef.DisplayProperty);
 }
Beispiel #4
0
 public DefineAnnotationDlg(IEnumerable <AnnotationDef> existing)
 {
     InitializeComponent();
     Icon = Resources.Skyline;
     checkedListBoxAppliesTo.Items.Clear();
     foreach (var annotationTarget in new[]
     {
         AnnotationDef.AnnotationTarget.protein,
         AnnotationDef.AnnotationTarget.peptide,
         AnnotationDef.AnnotationTarget.precursor,
         AnnotationDef.AnnotationTarget.transition,
         AnnotationDef.AnnotationTarget.replicate,
         AnnotationDef.AnnotationTarget.precursor_result,
         AnnotationDef.AnnotationTarget.transition_result,
     })
     {
         checkedListBoxAppliesTo.Items.Add(new AnnotationTargetItem(annotationTarget, GetModeUIHelper().ModeUI));
     }
     comboType.Items.AddRange(ListPropertyType.ListPropertyTypes().ToArray());
     comboType.SelectedIndex = 0;
     ComboHelper.AutoSizeDropDown(comboType);
     _existing = existing;
 }
Beispiel #5
0
        protected override void DoTest()
        {
            const string listName     = "MyList";
            var          listDesigner = ShowDialog <ListDesigner>(SkylineWindow.AddListDefinition);

            RunUI(() => listDesigner.ListName = listName);
            SetCellValue(listDesigner.ListPropertiesGrid, 0, 0, "Name");
            SetCellValue(listDesigner.ListPropertiesGrid, 1, 0, "X");
            SetCellValue(listDesigner.ListPropertiesGrid, 1, 1, ListPropertyType.GetAnnotationTypeName(AnnotationDef.AnnotationType.number));
            SetCellValue(listDesigner.ListPropertiesGrid, 2, 0, "Y");
            SetCellValue(listDesigner.ListPropertiesGrid, 2, 1, ListPropertyType.GetAnnotationTypeName(AnnotationDef.AnnotationType.number));
            RunUI(() => listDesigner.ListPropertiesGrid.CurrentCell = listDesigner.ListPropertiesGrid.Rows[0].Cells[0]);
            OkDialog(listDesigner, listDesigner.OkDialog);
            RunUI(() => SkylineWindow.ShowList(listName));
            var listGrid = FindOpenForm <ListGridForm>();

            WaitForCondition(() => listGrid.IsComplete);
            // Add some values to the "Name" and "X" columns
            SetClipboardText(TextUtil.LineSeparate("A\t-4", "B\t2", "C\t0", "D\t3", "E\t-3"));
            RunUI(() =>
            {
                listGrid.DataGridView.CurrentCell = listGrid.DataGridView.Rows[0].Cells[0];
                listGrid.DataGridView.SendPaste();
                listGrid.DataGridView.CurrentCell = listGrid.DataGridView.Rows[0].Cells[0];
            });
            WaitForCondition(() => listGrid.IsComplete);
            Assert.AreEqual("ABCDE", GetNameValues(listGrid.DataGridView));

            // Press the "Cluster" button and see that the order changes
            RunUI(() => listGrid.DataboundGridControl.NavBar.ClusterSplitButton.PerformButtonClick());
            WaitForCondition(() => listGrid.IsComplete);
            Assert.AreEqual("AECBD", GetNameValues(listGrid.DataGridView));

            // Press the "Cluster" button again and the order goes back to the original
            RunUI(() => listGrid.DataboundGridControl.NavBar.ClusterSplitButton.PerformButtonClick());
            WaitForCondition(() => listGrid.IsComplete);
            Assert.AreEqual("ABCDE", GetNameValues(listGrid.DataGridView));

            // Add some numbers to the "Y" column
            SetClipboardText(TextUtil.LineSeparate("1", "1", "0", "3", "3"));
            RunUI(() =>
            {
                listGrid.DataGridView.CurrentCell = listGrid.DataGridView.Rows[0].Cells[2];
                listGrid.DataGridView.SendPaste();
                listGrid.DataGridView.CurrentCell = listGrid.DataGridView.Rows[0].Cells[0];
            });
            // Press the Cluster button
            RunUI(() => listGrid.DataboundGridControl.NavBar.ClusterSplitButton.PerformButtonClick());
            WaitForCondition(() => listGrid.IsComplete);
            Assert.AreEqual("BDCAE", GetNameValues(listGrid.DataGridView));

            // set to city block distance metric, which will change the clustering of the items
            var clusteringEditor = ShowDialog <ClusteringEditor>(listGrid.NavBar.ShowClusteringEditor);

            RunUI(() =>
            {
                Assert.AreEqual(ClusterMetricType.EUCLIDEAN, clusteringEditor.DistanceMetric);
                clusteringEditor.DistanceMetric = ClusterMetricType.MANHATTAN;
            });
            OkDialog(clusteringEditor, () => clusteringEditor.DialogResult = DialogResult.OK);
            WaitForCondition(() => listGrid.IsComplete);
            Assert.AreEqual("AEDBC", GetNameValues(listGrid.DataGridView));

            const string reportName = "ListClusteringReport";

            RunDlg <ViewEditor>(listGrid.NavBar.CustomizeView, viewEditor =>
            {
                viewEditor.ViewName = reportName;
                viewEditor.OkDialog();
            });

            WaitForCondition(() => listGrid.IsComplete);
            Assert.AreEqual("AEDBC", GetNameValues(listGrid.DataGridView));
            RunDlg <NameLayoutForm>(listGrid.NavBar.RememberCurrentLayout, nameLayoutForm =>
            {
                nameLayoutForm.LayoutName = "MyLayout";
                nameLayoutForm.OkDialog();
            });

            RunDlg <DocumentSettingsDlg>(SkylineWindow.ShowDocumentSettingsDialog, documentSettingsDlg =>
            {
                documentSettingsDlg.SelectTab(DocumentSettingsDlg.TABS.reports);
                documentSettingsDlg.ChooseViewsControl.CheckedViews =
                    new[] { PersistedViews.MainGroup.Id.ViewName(reportName) };
                documentSettingsDlg.OkDialog();
            });
            RunUI(() => SkylineWindow.SaveDocument(Path.Combine(TestContext.TestDir, "ListClusteringTest.sky")));
            AssertEx.Serializable(SkylineWindow.Document);
            OkDialog(listGrid, listGrid.Close);
        }