Beispiel #1
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            if (!StructureChanged)
            {
                return;
            }

            QueryColumn qc = ColInfo.Qc;

            if (String.IsNullOrEmpty(StructureRenditor.MolfileString))
            {
                qc.SecondaryCriteria = qc.SecondaryCriteriaDisplay = "";
            }

            else
            {
                // Chime: CYAAFQwAncwQGj8h7GZ^yjgsajoFd0PQ1OYrnIdaPTl0lGnQYLHH2prJeJi$BhUHcMsE1TyQisJflsW2r293v92iC1^wVm$8wwLM7^krIFa8A1X6Jvu8VIYgCgJ8$y1RuqgCc5ifKbMAflB
                string chimeString = MoleculeMx.MolfileStringToChimeString(StructureRenditor.MolfileString);
                qc.SecondaryCriteria        = "SSS ( " + qc.MetaColumn.Name + ", " + Lex.AddSingleQuotes(chimeString) + ") = 1";
                qc.SecondaryCriteriaDisplay = qc.ActiveLabel + " contains substructure";
            }

            qc.SecondaryFilterType = FilterType.StructureSearch;

            QueryManager.QueryResultsControl.UpdateFiltering(ColInfo);
            FilterBasicCriteriaControl.SyncBaseQuerySecondaryCriteria(qc);             // sync any base query

            StructureChanged = false;
            return;
        }
Beispiel #2
0
        /// <summary>
/// Update the secondary criteria to match the slider
/// </summary>

        void UpdateSecondaryCriteria()
        {
            QueryColumn qc = ColInfo.Qc;

            if (ItemFilter.Value == 0)
            {
                ValueLabel.Text      = "(All)";
                qc.SecondaryCriteria = qc.SecondaryCriteriaDisplay = "";
            }

            else if (ItemFilter.Value == Stats.DistinctValueList.Count + 1)
            {
                ValueLabel.Text             = "(Blanks)";
                qc.SecondaryCriteria        = qc.MetaColumn.Name + " is null";
                qc.SecondaryCriteriaDisplay = qc.ActiveLabel + " is null";
            }

            else
            {
                MobiusDataType mdt = Stats.DistinctValueList[ItemFilter.Value - 1];
                ValueLabel.Text = mdt.FormattedText;
                string normalizedString = mdt.FormatForCriteria();
                qc.SecondaryCriteria        = qc.MetaColumn.Name + " = " + Lex.AddSingleQuotes(normalizedString);
                qc.SecondaryCriteriaDisplay = qc.ActiveLabel + " = " + Lex.AddSingleQuotes(ValueLabel.Text);
            }

            qc.SecondaryFilterType = FilterType.ItemSlider;
            FilterBasicCriteriaControl.SyncBaseQuerySecondaryCriteria(qc);             // sync any base query
        }
Beispiel #3
0
        private void RemoveFilterMenuItem_Click(object sender, EventArgs e)
        {
            ActiveQueryColumn.SecondaryFilterType = FilterType.Unknown;
            ActiveQueryColumn.SecondaryCriteria   = ActiveQueryColumn.SecondaryCriteriaDisplay = "";
            if (QueryResultsControl.GetQrcThatContainsControl(this) != null)
            {
                ColumnInfo colInfo = ResultsFormat.GetColumnInfo(Qm, ActiveQueryColumn);
                QueryResultsControl.GetQrcThatContainsControl(this).UpdateFiltering(colInfo);
            }

            FilterBasicCriteriaControl.SyncBaseQuerySecondaryCriteria(ActiveQueryColumn);             // sync any base query

            Render();
        }
Beispiel #4
0
        private void Cancel_Click(object sender, EventArgs e)
        {         // restore previous criteria state
            QueryColumn qc = ColInfo.Qc;

            qc.SecondaryCriteria        = InitialQcState.SecondaryCriteria;
            qc.SecondaryCriteriaDisplay = InitialQcState.SecondaryCriteriaDisplay;
            qc.SecondaryFilterType      = InitialQcState.SecondaryFilterType;

            Qm.QueryResultsControl.UpdateFiltering(ColInfo);               // reapply any previous filter
            FilterBasicCriteriaControl.SyncBaseQuerySecondaryCriteria(qc); // sync any base query

            Hide();
            if (CallingActiveForm != null)
            {
                CallingActiveForm.Focus();
            }
        }
Beispiel #5
0
/// <summary>
/// Update the secondary criteria to match the slider
/// </summary>

        void UpdateSecondaryCriteria()
        {
            string lowCriteriaDisplayText, lowCriteriaText, highCriteriaDisplayText, highCriteriaText;

            QueryColumn qc = ColInfo.Qc;

            UpdateLabels(out lowCriteriaDisplayText, out lowCriteriaText, out highCriteriaDisplayText, out highCriteriaText);

            qc.SecondaryCriteria = qc.MetaColumn.Name + " between " + Lex.AddSingleQuotes(lowCriteriaText) +
                                   " and " + Lex.AddSingleQuotes(highCriteriaText);

            qc.SecondaryCriteriaDisplay = qc.ActiveLabel + " between " + Lex.AddSingleQuotes(lowCriteriaDisplayText) +
                                          " and " + Lex.AddSingleQuotes(highCriteriaDisplayText);

            qc.SecondaryFilterType = FilterType.RangeSlider;
            FilterBasicCriteriaControl.SyncBaseQuerySecondaryCriteria(qc);             // sync any base query
        }
Beispiel #6
0
        /// <summary>
        /// Store new filter type for column updating filtering as needed
        /// </summary>
        /// <param name="colInfo"></param>
        /// <param name="ft"></param>

        internal void ChangeFilterType(ColumnInfo colInfo, FilterType ft)
        {
            QueryColumn qc = colInfo.Qc;

            if (qc.SecondaryFilterType != FilterType.Unknown &&
                qc.SecondaryFilterType != ft)
            {             // changing filter types, clear current criteria & update the filtering
                qc.SecondaryFilterType = FilterType.Unknown;
                qc.SecondaryCriteria   = qc.SecondaryCriteriaDisplay = "";
                UpdateFiltering(colInfo);
            }

            qc.SecondaryFilterType = ft;

            FilterBasicCriteriaControl.SyncBaseQuerySecondaryCriteria(qc);             // sync any base query

            return;
        }
Beispiel #7
0
/// <summary>
/// When check state changes update the display to reflect
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void ItemList_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e)
        {
            if (InSetup)
            {
                return;
            }

            InSetup = true;
            ItemList.BeginUpdate();

            CheckedListBoxItemCollection items = ItemList.Items;
            string txt       = items[e.Index].Description;
            bool   isChecked = (e.State == CheckState.Checked);

            if (txt == "(All)")             // check/uncheck everything
            {
                foreach (CheckedListBoxItem i in items)
                {
                    i.CheckState = e.State;
                }
            }

            else if (txt == "(Non blanks)")
            {
                foreach (CheckedListBoxItem i in items)
                {
                    if (i.Description == "(All)" || i.Description == "(Blanks)")
                    {
                        continue;
                    }
                    i.CheckState = e.State;
                }
            }

            else if (e.State == CheckState.Unchecked)             // turned item off; turn off All & Non blanks as well
            {
                items[AllPos].CheckState = CheckState.Unchecked;
                if (NonBlanksPos >= 0 && txt != "(Blanks)")
                {
                    items[NonBlanksPos].CheckState = CheckState.Unchecked;
                }
            }

            if (BlanksPos >= 0)             // if blanks allowed set (All) based on Blanks/Non blanks settings
            {
                if (items[BlanksPos].CheckState == CheckState.Checked &&
                    items[NonBlanksPos].CheckState == CheckState.Checked)
                {
                    items[AllPos].CheckState = CheckState.Checked;
                }
                else
                {
                    items[AllPos].CheckState = CheckState.Unchecked;
                }
            }

            ItemList.EndUpdate();
            InSetup = false;

// Generate new criteria from set of checks

            QueryColumn qc = ColInfo.Qc;

            if (items[AllPos].CheckState == CheckState.Checked)             // everything
            {
                qc.SecondaryCriteria        = qc.MetaColumn.Name + " in ('(All)')";
                qc.SecondaryCriteriaDisplay = qc.ActiveLabel + " in list (All)";
            }

            //else if (NonBlanksPos >= 0 && items[NonBlanksPos].CheckState == CheckState.Checked)
            //{ // just non-null
            //  qc.SecondaryCriteria = qc.MetaColumn.Name + " is not null";
            //  qc.SecondaryCriteriaDisplay = qc.ActiveLabel + " is not null";
            //}

            else             // build list of checked items possibly including "(Blanks)" and "(Non blanks)"
            {
                int itemsChecked = 0;
                qc.SecondaryCriteria = qc.MetaColumn.Name + " in (";

                foreach (CheckedListBoxItem i in items)
                {
                    string normalizedString;

                    if (i.CheckState != CheckState.Checked)
                    {
                        continue;
                    }

                    if (itemsChecked > 0)
                    {
                        qc.SecondaryCriteria += ", ";
                    }

                    normalizedString = i.Description;
                    if (i.Description == "(All)" || i.Description == "(Blanks)" || i.Description == "(Non blanks)")
                    {
                    }                       // these are always ok as is
                    else if (qc.MetaColumn.DataType == MetaColumnType.CompoundId ||
                             qc.MetaColumn.DataType == MetaColumnType.Date)
                    {                     // store these in internal format
                        MobiusDataType mdt = MobiusDataType.New(qc.MetaColumn.DataType, i.Description);
                        normalizedString = mdt.FormatForCriteria();
                    }
                    qc.SecondaryCriteria += Lex.AddSingleQuotes(normalizedString);
                    itemsChecked++;
                }

                qc.SecondaryCriteria       += ")";
                qc.SecondaryCriteriaDisplay = qc.ActiveLabel + " in list";
            }

            qc.SecondaryFilterType = FilterType.CheckBoxList;

            QueryManager.QueryResultsControl.UpdateFiltering(ColInfo);
            FilterBasicCriteriaControl.SyncBaseQuerySecondaryCriteria(qc);             // sync any base query

            return;
        }
Beispiel #8
0
        /// <summary>
        /// Add a filter item
        /// </summary>
        /// <param name="qc"></param>
        /// <param name="criteriaText"></param>

        void AddFilter(QueryColumn qc)
        {
            Control    control = null, focusControl = null;
            ColumnInfo colInfo;


            try { colInfo = ResultsFormat.GetColumnInfo(Qm, qc); }
            catch { return; }             // ignore if col no longer in query

            int buttonDy = 4;

            if (qc.SecondaryFilterType == FilterType.BasicCriteria)
            {
                FilterBasicCriteriaControl fbc = new FilterBasicCriteriaControl();
                fbc.Setup(colInfo, this);
                if (qc == ActiveQueryColumn)
                {
                    focusControl = fbc.Value;                                          // put focus on value if this is the active column
                }
                control = fbc;
            }

            else if (qc.SecondaryFilterType == FilterType.CheckBoxList)
            {
                FilterCheckBoxListControl flc = new FilterCheckBoxListControl();
                flc.Setup(colInfo);
                control = flc;
            }

            else if (qc.SecondaryFilterType == FilterType.ItemSlider)
            {
                FilterItemSliderControl fis = new FilterItemSliderControl();
                fis.Setup(colInfo);
                control  = fis;
                buttonDy = 16;
            }

            else if (qc.SecondaryFilterType == FilterType.RangeSlider)
            {
                FilterRangeSliderControl frs = new FilterRangeSliderControl();
                frs.Setup(colInfo);
                control  = frs;
                buttonDy = 16;
            }

            else if (qc.SecondaryFilterType == FilterType.StructureSearch)
            {
                FilterStructureControl fss = new FilterStructureControl();
                fss.Setup(colInfo);
                control = fss;
            }

            control.Top   = PanelYPos;
            control.Left  = 0;
            control.Width = ScrollablePanel.Width - 34;
            ScrollablePanel.Controls.Add(control);
            if (focusControl != null)
            {
                focusControl.Focus();
            }

//			if (qc.SecondaryFilterType != FilterType.StructureSearch)
            AddFilterDropDownButton(qc, ScrollablePanel.Width - 32, PanelYPos + buttonDy);

            PanelYPos += control.Height + 2;

            return;
        }