Exemple #1
0
        public void MergeTo(VDWidget targetWidget, ElementGroup elementGroup)
        {
            targetWidget.Children.Add(this);

            // the order of creating children is import, why??
            // first children, then grand-children???
            VDHoriContainer headContainer = this.Store.ElementFactory.CreateElement(VDHoriContainer.DomainClassId,
                new PropertyAssignment(VDContainer.TagDomainPropertyId, HEADS_CONTAINER_TAG),
                new PropertyAssignment(VDContainer.HasLeftAnchorDomainPropertyId, true),
                new PropertyAssignment(VDContainer.HasRightAnchorDomainPropertyId, true),
                new PropertyAssignment(VDContainer.HasTopAnchorDomainPropertyId, true)) as VDHoriContainer;
            VDFullFilledContainer bodyContainer = this.Store.ElementFactory.CreateElement(VDFullFilledContainer.DomainClassId,
                new PropertyAssignment(VDContainer.TagDomainPropertyId, BODYS_CONTAINER_TAG),
                new PropertyAssignment(VDContainer.HasLeftAnchorDomainPropertyId, true),
                new PropertyAssignment(VDContainer.HasRightAnchorDomainPropertyId, true),
                new PropertyAssignment(VDContainer.HasBottomAnchorDomainPropertyId, true)) as VDFullFilledContainer;

            VDHoriSeparator hSeparator = this.Store.ElementFactory.CreateElement(VDHoriSeparator.DomainClassId,
                new PropertyAssignment(VDHoriSeparator.DefaultYDomainPropertyId, 0.5)) as VDHoriSeparator;
            hSeparator.TopWidget = headContainer;
            hSeparator.BottomWidget = bodyContainer;

            this.Children.Add(headContainer);
            this.Children.Add(bodyContainer);
            this.Children.Add(hSeparator);

            VDTabHead head = this.Store.ElementFactory.CreateElement(
                VDTabHead.DomainClassId,
                new PropertyAssignment(VDTabHead.TabTitleDomainPropertyId, "New Tab")) as VDTabHead;
            VDTabBody body = this.Store.ElementFactory.CreateElement(VDTabBody.DomainClassId) as VDTabBody;
            this.ActiveHead = head;
            head.Body = body;
            headContainer.Children.Add(head);
            bodyContainer.Children.Add(body);
        }
        // targetWidget = sourceWidget.Selector()
        public static Selector FromWidgets(VDWidget sourceWidget, VDWidget targetWidget)
        {
            string identifierSelector = string.Empty;

            //    if (string.IsNullOrEmpty(widget.WidgetName))
            //    {
            //        // todo: if use as id identifier
            //        //return "#" + widget.WidgetName;
            //        // todo: if use as class identifier
            //        //return "." + widget.WidgetName;
            //        // todo: if use as normal class
            //    }

            //    if (widget.Parent != null)
            //    {
            //        string parentIdentifier = GetIdentifierSelector(widget.Parent);
            //        if (!string.IsNullOrEmpty(parentIdentifier))
            //        {
            //        }
            //    }

            //    // get selecctor relative to prev widget/prev of prev/ prev of prev of prev

            //    // get selector relative to next widget/next of next/next of next

            //    // get selector relative to children

            //return identifierSelector;
            return null;
        }
 /// <summary> Get client event list supported by specified source widget </summary>
 /// <param name="sourceWidget"></param>
 /// <returns></returns>
 public List<string> GetClientEventList(VDWidget sourceWidget)
 {
     return new List<string>()
     {
         "click",
         "change",
         "onSuccess",
     };
 }
 /// <summary> Get client action list supported by specified target widget </summary>
 /// <param name="targetWidget"></param>
 /// <returns></returns>
 public List<string> GetClientActionList(VDWidget targetWidget)
 {
     return new List<string>()
     {
         "Delete",
         "Replace",
         "AjaxGet",
         "AjaxPost"
     };
 }
        public void ShowActionModel(VDActionBase action)
        {
            m_selectedWidget = action;

            setToolWindowTitle(string.Format("Action Data - {0} [{1} Action]", action.Name, action is VDClientAction ? "Client" : "Server"));

            if (this.Window != null)
            {
                ModelToolWindowForm.ActionDataHandler.Show(action);
            }
        }
        public void Init(VDWidget anchorWidget, string selector, string resolvedWidget)
        {
            m_anchorWidget = anchorWidget;
            m_selector = selector;
            m_resolvedWidget = resolvedWidget;

            if (anchorWidget != null)
            {
                this.cmbAnchorWidget.Text = anchorWidget.WidgetName + "[" + anchorWidget.WidgetType.ToString() + "]";
            }
            this.txtSelectorFunction.Text = selector;
            this.lblResolvedWidget.Text = resolvedWidget;
        }
 public abstract VDWidget Resolve(VDWidget sourceWidget);
            private static void setAnchor(VDWidgetShape parentShape, VDContainer thisMEL, VDContainerShape thisPEL, 
                bool setAnchor, VDWidget sibling, AnchoringBehavior.Edge edge)
            {
                if (!setAnchor) return;

                if (sibling != null) // anchor to sibling
                {
                    VDWidgetShape siblingShape = parentShape.GetChildShape<VDWidgetShape>(sibling);
                    if (siblingShape != null)
                    {
                        switch (edge)
                        {
                            case AnchoringBehavior.Edge.Bottom:
                                thisPEL.Anchoring.SetBottomAnchor(siblingShape, AnchoringBehavior.Edge.Top, thisMEL.BottomMargin);
                                break;
                            case AnchoringBehavior.Edge.Left:
                                thisPEL.Anchoring.SetLeftAnchor(siblingShape, AnchoringBehavior.Edge.Right, thisMEL.LeftMargin);
                                break;
                            case AnchoringBehavior.Edge.Right:
                                thisPEL.Anchoring.SetRightAnchor(siblingShape, AnchoringBehavior.Edge.Left, thisMEL.RightMargin);
                                break;
                            case AnchoringBehavior.Edge.Top:
                                thisPEL.Anchoring.SetTopAnchor(siblingShape, AnchoringBehavior.Edge.Bottom, thisMEL.TopMargin);
                                break;
                        }
                    }
                }
                else // anchor to parent
                {
                    switch (edge)
                    {
                        case AnchoringBehavior.Edge.Bottom:
                            thisPEL.Anchoring.SetBottomAnchor(edge, thisMEL.BottomMargin);
                            break;
                        case AnchoringBehavior.Edge.Left:
                            thisPEL.Anchoring.SetLeftAnchor(edge, thisMEL.LeftMargin);
                            break;
                        case AnchoringBehavior.Edge.Right:
                            thisPEL.Anchoring.SetRightAnchor(edge, thisMEL.RightMargin);
                            break;
                        case AnchoringBehavior.Edge.Top:
                            thisPEL.Anchoring.SetTopAnchor(edge, thisMEL.TopMargin);
                            break;
                    }
                }
            }
            public NewActionHandler SetSource(VDWidget source)
            {
                m_cmbEvent.Items.Clear();

                if (source != null)
                {
                    m_txtSource.Text = string.Format("[{1}] {0}", source.WidgetName, source.WidgetType.ToString());
                    if (source.SupportedEvents != null)
                    {
                        m_cmbEvent.Items.AddRange(source.SupportedEvents.ToArray());
                        if (m_cmbEvent.Items.Count > 0) m_cmbEvent.SelectedIndex = 0;
                    }
                }
                else
                {
                    m_txtSource.Text = string.Empty;
                }

                m_cmbEvent.Enabled = true;
                return this;
            }
        public void ShowViewModel(VDView view)
        {
            m_selectedWidget = view;

            setToolWindowTitle(string.Format("View Model - {0} [{1}]", view.WidgetName, view.WidgetType.ToString()));

            if (this.Window != null)
            {
                ModelToolWindowForm.ViewModelHandler.Show(view);
            }
        }
        public void ShowWidgetModel(VDWidget widget)
        {
            m_selectedWidget = widget;

            setToolWindowTitle(string.Format("Widget Value - {0} [{1}]", widget.WidgetName, widget.WidgetType.ToString()));

            if (this.Window != null)
            {
                ModelToolWindowForm.WidgetValueHandler.Show(widget);
            }
        }
 public List<WidgetClientMember> GetWidgetClientMemberList(VDWidget widget)
 {
     return new List<WidgetClientMember>();
 }
 /// <summary>
 /// for some actions, maybe there are some predefined model members
 /// </summary>
 /// <param name="sourceWidget"></param>
 /// <param name="targetWidget"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public List<ActionModelMemberInfo> GetActionModelCandidateMemberList(VDWidget sourceWidget, VDWidget targetWidget, VDClientAction action)
 {
     return new List<ActionModelMemberInfo>();
 }