Beispiel #1
0
 public RuleViewModel(RuleViewer viewer, ITestCase testCase)
 {
     this.View     = viewer;
     this.testCase = testCase;
     this.Rules    = new ObservableCollection <IXMLTransformRule>(Utils.FlattenTransformRules(this.testCase.rules));
     Init();
 }
 public IncrementStringRuleProps(IncrementStringTransformRule rule, RuleViewer View)
 {
     InitializeComponent();
     Rule             = rule;
     Copy             = (IXMLTransformRule)Rule.Clone();
     this.View        = View;
     this.View.Props  = this;
     this.DataContext = Copy;
 }
Beispiel #3
0
 public RemoveNodeRuleProps(RemoveNodeTransformRule rule, RuleViewer View)
 {
     InitializeComponent();
     Rule             = rule;
     Copy             = (IXMLTransformRule)rule.Clone();
     this.View        = View;
     this.View.Props  = this;
     this.DataContext = Copy;
 }
 public SequenceStringRuleProps(SequenceTransformRule rule, RuleViewer View)
 {
     InitializeComponent();
     Rule                  = rule;
     Copy                  = (IXMLTransformRule)rule.Clone();
     this.View             = View;
     this.View.Props       = this;
     this.DataContext      = Copy;
     ObservableValues      = new ObservableCollection <string>(((SequenceTransformRule)Copy).Values);
     ListItems.ItemsSource = ObservableValues;
 }
Beispiel #5
0
 public RuleTreeControl(RuleViewer View)
 {
     InitializeComponent();
     this.View    = View;
     this.XmlRoot = View.testCase.TransformedDocument.Root;
     // Create the virtual tree
     Boolean.TryParse(View.testCase.GetOption("DefaultExpanded"), out bool expanded);
     this.Root = new NodeVisualTreeElement(this.XmlRoot, 0, expanded);
     docTreeViewer.ItemsSource = new List <ITreeElement>()
     {
         Root
     };
     NodeMap       = new Dictionary <string, TreeViewItem>();
     PreviousState = new Dictionary <string, ITreeElement>();
     ActionQueue   = new Stack <ITreeViewQueuedAction>();
 }
Beispiel #6
0
        public static void DrawRule(StackPanel panel, IXMLTransformRule rule, RuleViewer View)
        {
            switch (rule.RuleType)
            {
            case TransformRuleTypes.Fixed:
                DrawFixedRule(panel, (FixedStringTransformRule)rule, View);
                break;

            case TransformRuleTypes.Random:
                DrawRandomRule(panel, (RandomStringTransformRule)rule, View);
                break;

            case TransformRuleTypes.RandomInteger:
                DrawRandomIntRule(panel, (RandomIntegerTransformRule)rule, View);
                break;

            case TransformRuleTypes.RepeatNode:
                DrawRepeatNodeRule(panel, (RepeatNodeTransformRule)rule, View);
                break;

            case TransformRuleTypes.IncrementString:
                DrawIncrementRule(panel, (IncrementStringTransformRule)rule, View);
                break;

            case TransformRuleTypes.SequenceString:
                DrawSequenceRule(panel, (SequenceTransformRule)rule, View);
                break;

            case TransformRuleTypes.RemoveNode:
                DrawRemoveRule(panel, (RemoveNodeTransformRule)rule, View);
                break;

            default:
                break;
            }
        }
Beispiel #7
0
        private static void DrawIncrementRule(StackPanel panel, IncrementStringTransformRule rule, RuleViewer View)
        {
            TreeViewItem selected_item = View.docTreeViewControl.SelectedItem as TreeViewItem;

            if (selected_item != null)
            {
                rule.CurrentValue = ((XmlNode)selected_item.DataContext).InnerText;
            }
            IncrementStringRuleProps drawer = new IncrementStringRuleProps(rule, View);

            panel.Children.Clear();
            panel.Children.Add(drawer);
        }
Beispiel #8
0
        private static void DrawRemoveRule(StackPanel panel, RemoveNodeTransformRule rule, RuleViewer View)
        {
            RemoveNodeRuleProps drawer = new RemoveNodeRuleProps(rule, View);

            panel.Children.Clear();
            panel.Children.Add(drawer);
        }
Beispiel #9
0
        private static void DrawRandomIntRule(StackPanel panel, RandomIntegerTransformRule rule, RuleViewer View)
        {
            RandomIntegerRuleProps drawer = new RandomIntegerRuleProps(rule, View);

            panel.Children.Clear();
            panel.Children.Add(drawer);
        }
Beispiel #10
0
        private static void DrawFixedRule(StackPanel panel, FixedStringTransformRule rule, RuleViewer View)
        {
            FixedStringRuleProps drawer = new FixedStringRuleProps(rule, View);

            panel.Children.Clear();
            panel.Children.Add(drawer);
        }
Beispiel #11
0
        private static void DrawSequenceRule(StackPanel panel, SequenceTransformRule rule, RuleViewer View)
        {
            SequenceStringRuleProps drawer = new SequenceStringRuleProps(rule, View);

            panel.Children.Clear();
            panel.Children.Add(drawer);
        }