Esempio n. 1
0
        public virtual void ReportChildDeselected(Stack <ITreeSelector <VM, T> > path)
        {
            Debug.Print("Child deselected: " + Value);

            path.Push(this);
            ParentSelector?.ReportChildDeselected(path);

            if (EntryHelper.IsLoaded)
            {
                //Clear child node selection.
                SetSelectedChild(default(T));
                //And just in case if the new selected value is child of this node.

                /*if (RootSelector.SelectedValue != null)
                 *  LookupAsync(RootSelector.SelectedValue,
                 *      new SearchNextUsingReverseLookup<VM, T>(RootSelector.SelectedSelector),
                 *      new TreeLookupProcessor<VM, T>(HierarchicalResult.All, (hr, p, c) =>
                 *      {
                 *          SetSelectedChild(c == null ? default(T) : c.Value);
                 *          return true;
                 *      })
                 *      ).Forget();*/
                //SetSelectedChild(lookupResult == null ? default(T) : lookupResult.Value);
                //OnPropertyChanged(nameof(IsChildSelected));
                //OnPropertyChanged(nameof(SelectedChild));
            }
        }
Esempio n. 2
0
 public virtual void ReportChildDeselected(Stack <ITreeSelector <VM, T> > path)
 {
     if (EntryHelper.IsLoaded)
     {
         //Clear child node selection.
         SetSelectedChild(default(T));
         //And just in case if the new selected value is child of this node.
         if (RootSelector.SelectedValue != null)
         {
             this.LookupAsync(RootSelector.SelectedValue,
                              new SearchNextUsingReverseLookup <VM, T>(RootSelector.SelectedSelector),
                              new TreeLookupProcessor <VM, T>(HierarchicalResult.All, (hr, p, c) =>
             {
                 SetSelectedChild(c == null ? default(T) : c.Value);
                 return(true);
             })
                              );
         }
         //SetSelectedChild(lookupResult == null ? default(T) : lookupResult.Value);
         NotifyOfPropertyChanged(() => IsChildSelected);
         NotifyOfPropertyChanged(() => SelectedChild);
     }
     path.Push(this);
     if (ParentSelector != null)
     {
         ParentSelector.ReportChildDeselected(path);
     }
 }
Esempio n. 3
0
        public override string BuildGremlinQuery()
        {
            if (_value is string)
            {
                return(ParentSelector.BuildGremlinQuery() + $".has('{_hasField}', '{_value}')");
            }

            return(ParentSelector.BuildGremlinQuery() + $".has('{_hasField}', {_value})");
        }
Esempio n. 4
0
        public override bool Matches(HtmlElement element)
        {
            if (element.Parent is HtmlElement parentElement)
            {
                return(ParentSelector.Matches(parentElement) && TargetSelector.Matches(element));
            }

            return(false);
        }
Esempio n. 5
0
        public void DifferentParentsAreSelected()
        {
            var pop = new Genotype[] {
                new Genotype(10), new Genotype(5), new Genotype(12), new Genotype(23)
            };
            var selector = new ParentSelector();

            selector.SelectParents(pop, out var parent1, out var parent2);
            Assert.AreNotSame(parent1, parent2);
        }
        public override string BuildGremlinQuery()
        {
            var vertexLabel = typeof(T).GetLabel();

            if (!string.IsNullOrEmpty(_edgeLabel))
            {
                return(ParentSelector.BuildGremlinQuery() + $".in('{_edgeLabel}').has('label','{vertexLabel}')");
            }
            return(ParentSelector.BuildGremlinQuery() + $".in().has('label','{vertexLabel}')");
        }
        public override string BuildGremlinQuery()
        {
            var result = ParentSelector.BuildGremlinQuery() + $".inV().has('label','{typeof(TEntity).Name}')";

            if (!string.IsNullOrEmpty(_alias))
            {
                result = result + $".as('{_alias}')";
            }
            return(result);
        }
Esempio n. 8
0
        public override string BuildGremlinQuery()
        {
            var exp = _expression;

            if (exp == null)
            {
                throw new ArgumentException($"Expression is not valid - {_expression}");
            }

            var prop = ((MemberExpression)exp.Body).Member.Name;

            return(ParentSelector.BuildGremlinQuery() +
                   $".has('{prop}',within({_values.Aggregate(string.Empty, (acc, a) => acc + "'" + a + "',", a => a.Substring(0, a.Length - 1))}))");
        }
Esempio n. 9
0
        /// <summary>
        ///     Bubble up to TreeSelectionHelper for selection.
        /// </summary>
        /// <param name="path"></param>
        public virtual void ReportChildSelected(Stack <ITreeSelector <VM, T> > path)
        {
            Debug.Print("Child selected: " + Value);
            if (path.Any())
            {
                _selectedValue = path.Peek().Value;

                OnPropertyChanged(nameof(SelectedChild));
                OnPropertyChanged(nameof(IsChildSelected));
            }

            path.Push(this);
            ParentSelector?.ReportChildSelected(path);
        }
        public override string BuildGremlinQuery()
        {
            if (InsertCommand != null)
            {
                return(ParentSelector.BuildGremlinQuery() +
                       $".addE('{Relation}').to({InsertCommand.BuildGremlinQuery()}).inV()");
            }

            if (Selector != null)
            {
                return(ParentSelector.BuildGremlinQuery() +
                       $".addE('{Relation}').to({Selector.BuildGremlinQuery()}).inV()");
            }

            return(ParentSelector.BuildGremlinQuery());
        }
Esempio n. 11
0
        /// <summary>
        /// Bubble up to TreeSelectionHelper for selection.
        /// </summary>
        /// <param name="path"></param>
        public virtual void ReportChildSelected(Stack <ITreeSelector <VM, T> > path)
        {
            if (path.Count() > 0)
            {
                _selectedValue = path.Peek().Value;


                NotifyOfPropertyChanged(() => SelectedChild);
            }

            path.Push(this);
            if (ParentSelector != null)
            {
                ParentSelector.ReportChildSelected(path);
            }
        }
        private IHtmlContent SettingOverrideCheckboxInternal(StoreDependingSettingData data)
        {
            var fieldPrefix = HtmlHelper.ViewData.TemplateInfo.HtmlFieldPrefix;
            var settingKey  = For.Name;

            if (fieldPrefix.HasValue())
            {
                settingKey = fieldPrefix + "." + settingKey;
            }
            else if (data.RootSettingClass.HasValue() && !settingKey.StartsWith(data.RootSettingClass + '.', StringComparison.OrdinalIgnoreCase))
            {
                settingKey = data.RootSettingClass + '.' + settingKey;
            }

            var overrideForStore = data.OverrideSettingKeys.Contains(settingKey);
            var fieldId          = settingKey.EnsureEndsWith("_OverrideForStore");

            var switchLabel = new TagBuilder("label");

            switchLabel.AppendCssClass("switch switch-blue multi-store-override-switch");

            var overrideInput = new TagBuilder("input");

            overrideInput.Attributes["class"]   = "multi-store-override-option";
            overrideInput.Attributes["type"]    = "checkbox";
            overrideInput.Attributes["id"]      = fieldId;
            overrideInput.Attributes["name"]    = fieldId;
            overrideInput.Attributes["onclick"] = "Smartstore.Admin.checkOverriddenStoreValue(this)";
            overrideInput.Attributes["data-parent-selector"] = ParentSelector.EmptyNull();

            if (overrideForStore)
            {
                overrideInput.Attributes["checked"] = "checked";
            }

            var toggleSpan = new TagBuilder("span");

            toggleSpan.AppendCssClass("switch-toggle");
            toggleSpan.Attributes.Add("data-on", T("Common.On").Value.Truncate(3));
            toggleSpan.Attributes.Add("data-off", T("Common.Off").Value.Truncate(3));

            switchLabel.InnerHtml.AppendHtml(overrideInput);
            switchLabel.InnerHtml.AppendHtml(toggleSpan);

            return(switchLabel);
        }
        public override string BuildGremlinQuery()
        {
            string result;
            var    vertexLabel = typeof(TEntity).GetLabel();

            if (!string.IsNullOrEmpty(_edgeLabel))
            {
                result = ParentSelector.BuildGremlinQuery() + $".out('{_edgeLabel}').has('label','{vertexLabel}')";
            }
            else
            {
                result = ParentSelector.BuildGremlinQuery() + $".out().has('label','{vertexLabel}')";
            }
            if (!string.IsNullOrEmpty(_alias))
            {
                result += $".as('{_alias}')";
            }
            return(result);
        }
        public override string BuildGremlinQuery()
        {
            var vertexLabel = typeof(T).GetLabel();

            return(ParentSelector.BuildGremlinQuery() + $".out('{_relation}').hasLabel('{vertexLabel}')");
        }
Esempio n. 15
0
        public override string BuildGremlinQuery()
        {
            var value = ExpressionEvaluator.Evaluate(_expression.Body);

            return(ParentSelector.BuildGremlinQuery() + value);
        }
Esempio n. 16
0
 public override string BuildGremlinQuery()
 {
     return(ParentSelector.BuildGremlinQuery() + $".out('{_relation}')");
 }
Esempio n. 17
0
 public override string BuildGremlinQuery()
 {
     return(ParentSelector.BuildGremlinQuery() + $".in().has('label','{typeof(T).Name}')");
 }
        public override string BuildGremlinQuery()
        {
            var select = $".select(" + GetSelectors() + ")";

            return(ParentSelector.BuildGremlinQuery() + select);
        }
 public override string BuildGremlinQuery()
 {
     return(ParentSelector.BuildGremlinQuery() + $".out('{_relation}').hasLabel('{typeof(T).Name}')");
 }