Пример #1
0
 public AnatomyController()
 {
     luceneSearch        = new AnatomyLuceneSearch(this);
     currentTopLevelMode = luceneSearch.FilterEntries.First();
     selectedAnatomy.DisplaySelectedAnatomy += selectedAnatomy_DisplaySelectedAnatomy;
 }
Пример #2
0
        private void createGroup(AnatomyFilterEntry filterEntry, IEnumerable <String> items)
        {
            List <CheckButton> groupCheckButtons = new List <CheckButton>();
            List <String>      activeFacetValues = new List <string>();
            AnatomyFacet       facet             = new AnatomyFacet(filterEntry.FacetName, activeFacetValues);

            Button labelButton = scrollView.createWidgetT("Button", "Medical.AnatomyFilterButton", 0, 0, widget.Width, ScaleHelper.Scaled(25), Align.Left | Align.Top, "") as Button;

            labelButton.Caption = filterEntry.Caption;
            labelButton.ForwardMouseWheelToParent = true;
            labelButton.MouseButtonClick         += (sender, e) =>
            {
                anatomyController.TopLevelMode = filterEntry;
                fireTopLevelAnatomyChanged();
            };
            flowLayout.addChild(new MyGUILayoutContainer(labelButton));
            childWidgets.Add(labelButton);
            topLevelButtons.addButton(filterEntry, labelButton);

            Button button = scrollView.createWidgetT("Button", "CheckBox", 0, 0, widget.Width, ScaleHelper.Scaled(20), Align.Left | Align.Top, "") as Button;

            button.Caption = "Include All";
            button.ForwardMouseWheelToParent = true;
            CheckButton allCheckButton = new CheckButton(button);

            allCheckButton.Checked         = true;
            allCheckButton.CheckedChanged += (sender, e) =>
            {
                if (allCheckButton.Checked)
                {
                    foreach (var groupButton in groupCheckButtons)
                    {
                        groupButton.Checked = false;
                    }
                    activeFacets.Remove(facet);
                    fireFilterChanged();
                }
            };
            flowLayout.addChild(new MyGUILayoutContainer(button));
            childWidgets.Add(button);

            foreach (String item in items)
            {
                button         = scrollView.createWidgetT("Button", "CheckBox", 0, 0, widget.Width, ScaleHelper.Scaled(20), Align.Left | Align.Top, "") as Button;
                button.Caption = item;
                button.ForwardMouseWheelToParent = true;
                CheckButton checkButton = new CheckButton(button);
                checkButton.CheckedChanged += (sender, e) =>
                {
                    if (checkButton.Checked)
                    {
                        allCheckButton.Checked = false;
                        if (!activeFacets.Contains(facet))
                        {
                            activeFacets.Add(facet);
                        }
                        activeFacetValues.Add(item);
                        fireFilterChanged();
                    }
                    else
                    {
                        activeFacetValues.Remove(item);
                        if (activeFacetValues.Count == 0)
                        {
                            allCheckButton.Checked = true;
                            //The allCheckButton.CheckedChanged is triggered here
                        }
                        else
                        {
                            fireFilterChanged();
                        }
                    }
                };
                flowLayout.addChild(new MyGUILayoutContainer(button));
                childWidgets.Add(button);
                groupCheckButtons.Add(checkButton);
            }
        }