public PropertySettingGroup Deserialize() { PropertySettingGroup propertySettingGroup = new PropertySettingGroup(); propertySettingGroup.BasedOn = this.basedOn; if (this.propertySettings != null) { for (int index = 0; index < this.PropertySettings.Count; ++index) { IPropertySetting propertySetting = this.PropertySettings[index].Deserialize(); if (propertySetting is PropertySetting) { propertySettingGroup.PropertySettings.Add(propertySetting as PropertySetting); } } } if (this.selectors != null) { for (int index = 0; index < this.Selectors.Count; ++index) { IElementSelector internalSelector = this.Selectors[index].Deserialize(); propertySettingGroup.Selector = (ElementSelector) new WrapSelector(internalSelector); } } return(propertySettingGroup); }
public void ProcessStyle(RadElement rootElement, bool isDynamicallyAddedElement) { PrepareCache(rootElement); for (int i = 0; i < this.PropertySettingGroups.Count; i++) { PropertySettingGroup group = this.PropertySettingGroups[i]; group.SetIsFromStyleSheet(); for (int k = 0; k < group.Selectors.Count; k++) { IElementSelector selector = group.Selectors[k]; if (selector is HierarchicalSelector) { ((HierarchicalSelector)selector).SetCache(this.cachedChildrenHierarchyByElement); } //if (isDynamicallyAddedElement && selector is GeneralSelector) //{ // continue; //} LinkedList <RadElement> selectedElements = selector.GetSelectedElements(rootElement); foreach (RadElement selected in selectedElements) { selected.AddRangeBehavior(selector.GetBehaviors(group)); selected.RoutedEventBehaviors.AddRange(selector.GetRoutedEventBehaviors(group)); } } } }
public IElementSelector Deserialize() { IElementSelector instance = this.CreateInstance(); this.DeserializeProperties(instance); return(instance); }
public XmlPropertySettingGroup Serialize() { XmlPropertySettingGroup xmlGroup = new XmlPropertySettingGroup(); xmlGroup.BasedOn = this.basedOn; for (int settingIndex = 0; settingIndex < this.PropertySettings.OriginalPropertySettings.Count; settingIndex++) { IPropertySetting setting = this.PropertySettings.OriginalPropertySettings[settingIndex]; //serialize value; XmlPropertySetting xmlSetting = setting.Serialize(); xmlGroup.PropertySettings.Add(xmlSetting); } if (this.Selectors.Count > 0) { for (int selectorIndex = 0; selectorIndex < this.Selectors.Count; selectorIndex++) { IElementSelector selector = this.Selectors[selectorIndex]; xmlGroup.Selectors.Add(selector.Serialize()); } } return(xmlGroup); }
public NeuralNetworkVisualizerControl() { InitializeComponent(); var selectableElementRegisterResolver = new SelectableElementRegister(); _selector = new ElementSelector(selectableElementRegisterResolver); _controlDrawing = new ControlDrawing(new ControlCanvas(this.picCanvas, this), _selector, selectableElementRegisterResolver, selectableElementRegisterResolver); _toolTipFiring = new ToolTipFiring(this, picCanvas, selectableElementRegisterResolver); _selectionEventFiring = new SelectionEventFiring(this, _selector, () => this.SelectInputLayer, () => this.SelectPerceptronLayer, () => this.SelectBias, () => this.SelectInput, () => this.SelectPerceptron, () => this.SelectEdge); Control.CheckForIllegalCrossThreadCalls = true; this.BackColor = Color.White; picCanvas.MouseDown += PicCanvas_MouseDown; picCanvas.MouseMove += PicCanvas_MouseMove; picCanvas.MouseLeave += PicCanvas_MouseLeave; }
public virtual IElementSelector CreateSelectorForChildMetadata(VsbElementMetadata child, string state) { if (child.UserSelector != null) { return(child.UserSelector); } IElementSelector defaultSelector = CreateDefaultSelector(child); if (!child.CanHaveChildSelector) { // Element metadata equals our theme type. For example GridDataCellElement. if (child.ElementThemeType == this.ElementThemeType) { return(this.CreateOwnSelector(state)); } return(defaultSelector); } IElementSelector ownSelector = this.CreateOwnSelector(state); if (ownSelector != null) { ownSelector.ChildSelector = defaultSelector; return(ownSelector); } return(defaultSelector); }
public PropertySettingGroup Deserialize() { PropertySettingGroup group = new PropertySettingGroup(); group.BasedOn = this.basedOn; if (this.propertySettings != null) { for (int settingIndex = 0; settingIndex < this.PropertySettings.Count; settingIndex++) { XmlPropertySetting xmlPropertySetting = this.PropertySettings[settingIndex]; IPropertySetting setting = xmlPropertySetting.Deserialize(); group.PropertySettings.Add(setting); } } if (this.selectors != null) { for (int selectorIndex = 0; selectorIndex < this.Selectors.Count; selectorIndex++) { XmlElementSelector xmlSelector = this.Selectors[selectorIndex]; IElementSelector selector = xmlSelector.Deserialize(); group.Selectors.Add(selector); } } return(group); }
public void DeleteFromBlackList(IElementSelector <User> sel) { if (_blackListSelectors.Contains(sel)) { _blackListSelectors.Remove(sel); var remItems = new List <User>(); foreach (var item in _blackList) { var flag = false; foreach (var s in _blackListSelectors) { if (s.isOk(item)) { flag = true; break; } } if (!flag) { remItems.Add(item); } } foreach (var rem in remItems) { _blackList.Remove(rem); } } }
public void RemoveDeselector(IElementSelector <T> sel) { _Deselectors.Remove(sel); if (CollectionChanged != null) { CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } }
public IElementSelector Deserialize() { IElementSelector selector = this.CreateInstance(); this.DeserializeProperties(selector); return(selector); }
public virtual void Unapply(RadElement radElement) { if (cachedChildrenHierarchyByElement.Count == 0) { PrepareCache(radElement); } for (int i = 0; i < this.PropertySettingGroups.Count; i++) { PropertySettingGroup group = this.PropertySettingGroups[i]; for (int k = 0; k < group.Selectors.Count; k++) { IElementSelector selector = group.Selectors[k]; if (selector is HierarchicalSelector) { ((HierarchicalSelector)selector).SetCache(this.cachedChildrenHierarchyByElement); } LinkedList <RadElement> selectedElements = selector.GetSelectedElements(radElement); foreach (RadElement selected in selectedElements) { selector.Unregister(selected, group.PropertySettings); } } } for (int i = 0; i < this.PropertySettingGroups.Count; i++) { PropertySettingGroup group = this.PropertySettingGroups[i]; for (int k = 0; k < group.Selectors.Count; k++) { IElementSelector selector = group.Selectors[k]; LinkedList <RadElement> selectedElements = selector.GetSelectedElements(radElement); foreach (RadElement selected in selectedElements) { PropertyChangeBehaviorCollection propertyChangeBehaviors = selector.GetBehaviors(group); for (int behaviorIndex = 0; behaviorIndex < propertyChangeBehaviors.Count; behaviorIndex++) { PropertyChangeBehavior toRemove = propertyChangeBehaviors[behaviorIndex]; toRemove.BehaviorRemoving(selected); } RoutedEventBehaviorCollection routedEventBehaviors = selector.GetRoutedEventBehaviors(group); for (int eventIndex = 0; eventIndex < routedEventBehaviors.Count; eventIndex++) { RoutedEventBehavior routedEventBehavior = routedEventBehaviors[eventIndex]; routedEventBehavior.BehaviorRemoving(selected); } selected.RemoveRangeBehaviors(propertyChangeBehaviors); selected.RemoveRangeRoutedEventBehaviors(routedEventBehaviors); } } } this.cachedChildrenHierarchyByElement.Clear(); }
public string SelectDocument(ISelector selector) { IElementSelector elementSelector = selector as IElementSelector; if (elementSelector != null) { return(elementSelector.Select(Document)); } return(selector?.Select(GetFirstSourceText())); }
public override bool Equals(IElementSelector elementSelector) { TypeSelector typeSelector = elementSelector as TypeSelector; if (typeSelector != null) { return((object)typeSelector.elementType == (object)this.elementType); } return(false); }
public override bool Equals(IElementSelector elementSelector) { VisualStateSelector visualStateSelector = elementSelector as VisualStateSelector; if (visualStateSelector != null) { return(visualStateSelector.visualState == this.visualState); } return(false); }
public override bool Equals(IElementSelector elementSelector) { ClassSelector classSelector = elementSelector as ClassSelector; if (classSelector != null) { return(classSelector.elementClass == this.elementClass); } return(false); }
public override bool Equals(IElementSelector elementSelector) { NameSelector nameSelector = elementSelector as NameSelector; if (nameSelector != null) { return(nameSelector.elementName == this.elementName); } return(false); }
public StylesheetTreeNode(StylesheetTree ownerTree, IElementSelector selector) { this.ownerTree = ownerTree; this.selector = selector; this.nodes = new StylesheetTreeNodeCollection(this); int selectorKey = 0; //Generally RootNode registers with if (selector != null) { selectorKey = selector.Key; } ownerTree.RegisterNodeWithKey(selectorKey, this); }
/// <summary> /// Adds tree nodes from the PropertySettingGroups in the stylesheet. Root nodes are grouped by groups' Selector Key. /// Child nodes correspond to child selectors. /// </summary> /// <param name="styleSheet"></param> public void CreateNodesFromStyle(StyleSheet styleSheet) { for (int i = 0; i < styleSheet.PropertySettingGroups.Count; i++) { PropertySettingGroup group = styleSheet.PropertySettingGroups[i]; group.SetIsFromStyleSheet(); for (int k = 0; k < group.Selectors.Count; k++) { IElementSelector selector = group.Selectors[k]; this.RootNode.Nodes.AddElementSelector(group, selector); } } }
public void ApplyStyle(RadElement rootElement, bool isDynamicallyAddedElement) { //bool animationsEnabled = AnimatedPropertySetting.AnimationsEnabled; //AnimatedPropertySetting.AnimationsEnabled = false; //first should be applied selectors without any apply conditions LinkedList <NotAppliedSelector> selectorsWithConditions = new LinkedList <NotAppliedSelector>(); for (int i = 0; i < this.PropertySettingGroups.Count; i++) { PropertySettingGroup group = this.PropertySettingGroups[i]; for (int k = 0; k < group.Selectors.Count; k++) { IElementSelector selector = group.Selectors[k]; //if (isDynamicallyAddedElement && selector is GeneralSelector) //{ // continue; //} if (selector.HasApplyCondition) { selectorsWithConditions.AddLast(new NotAppliedSelector(selector, group.PropertySettings)); } else { //Selector selects internally all applicable elements //selector.Apply(rootElement, group.PropertySettings); LinkedList <RadElement> selectedElements = selector.GetSelectedElements(rootElement); foreach (RadElement selected in selectedElements) { selector.Apply(selected, group.PropertySettings); } } } } foreach (NotAppliedSelector notApplied in selectorsWithConditions) { //Selector selects internally all applicable elements //notApplied.Selector.Apply(rootElement, notApplied.PropertySettings); foreach (RadElement selected in notApplied.Selector.GetSelectedElements(rootElement)) { notApplied.Selector.Apply(selected, notApplied.PropertySettings); } } //Temp optimization this.cachedChildrenHierarchyByElement.Clear(); }
public static IDisposable UseFrame(this IWebDriver driver, IElementSelector selector) { if (driver == null) { throw new ArgumentNullException(nameof(driver)); } if (selector == null) { throw new ArgumentNullException(nameof(selector)); } driver.SwitchTo().Frame(selector.Find(driver, driver)); return(new DisposableAction(() => driver.SwitchTo().DefaultContent())); }
public bool CheckKeyMatches(IElementSelector elementSelector) { return(this.selector != null && this.selector.Equals(elementSelector)); //if (this.key.GetType() == typeof(string)) //{ // //TODO: multi-class selector logic // return elementSelector.Key is string && string.CompareOrdinal((string)this.key, (string)elementSelector.Key) == 0; //} //else if (this.key is Type) //{ // return elementSelector.Key is Type && (Type)this.key == (Type)elementSelector.Key; //} //return false; }
public ComposedElementModifier( IElementSelector elementSelector, IElementModifier elementModifier) { if (elementSelector == null) { throw new ArgumentNullException("elementSelector"); } if (elementModifier == null) { throw new ArgumentNullException("elementModifier"); } this.elementSelector = elementSelector; this.elementModifier = elementModifier; }
internal SelectionEventFiring(NeuralNetworkVisualizerControl control, IElementSelector selector, SelectInputLayer selectInputLayer, SelectNeuronLayer selectNeuronLayer, SelectBias selectBias, SelectInput selectInput, SelectNeuron selectNeuron, SelectEdge selectEdge) { _control = control; _selector = selector; _selectInputLayer = selectInputLayer; this._selectNeuronLayer = selectNeuronLayer; _selectBias = selectBias; _selectInput = selectInput; _selectNeuron = selectNeuron; _selectEdge = selectEdge; }
protected override void DeserializeProperties(IElementSelector selector) { SelectorBase selectorBase = (SelectorBase)selector; if (this.Condition != null) { selectorBase.Condition = this.Condition.Deserialize(); } if (this.UnapplyCondition != null) { selectorBase.UnapplyCondition = this.UnapplyCondition.Deserialize(); } if (this.ChildSelector != null) { selectorBase.ChildSelector = this.ChildSelector.Deserialize(); } selectorBase.AutoUnapply = this.AutoUnapply; }
private static String checkForSuitableElement(IHTMLElement element) { IElementTraversal el = element as IElementTraversal; if (el.previousElementSibling != null) { if (el.previousElementSibling.tagName == "LABEL") { return(el.previousElementSibling.innerText); } IElementSelector selector = el.previousElementSibling as IElementSelector; if (selector.querySelector("label") != null) { return(selector.querySelector("label").innerText); } selector = element.parentElement as IElementSelector; if (selector.querySelector("label") != null) { return(selector.querySelector("label").innerText); } } return(null); }
public ComposedElementModifier( IElementSelector elementSelector, IElementAttributeSelector attributeSelector, IAttributeModifier attributeModifier) { if (elementSelector == null) { throw new ArgumentNullException("elementSelector"); } if (attributeSelector == null) { throw new ArgumentNullException("attributeSelector"); } if (attributeModifier == null) { throw new ArgumentNullException("attributeModifier"); } this.elementSelector = elementSelector; this.attributeSelector = attributeSelector; this.attributeModifier = attributeModifier; }
public SubmitAction(IElementSelector elementSelector) { _elementSelector = elementSelector ?? throw new ArgumentNullException(nameof(elementSelector)); }
public override bool Equals(IElementSelector elementSelector) { NameSelector selector = elementSelector as NameSelector; return(selector != null && selector.elementName == this.elementName); }
public abstract bool Equals(IElementSelector elementSelector);
public ClickAction(IElementSelector selector) { _selector = selector ?? throw new ArgumentNullException(nameof(selector)); }