public override Group CreateGroup(SPRibbon ribbon,
                                          string id,
                                          GroupProperties properties,
                                          string title,
                                          string description,
                                          string command,
                                          Dictionary<string, List<Control>> controls,
                                          Dictionary<string, string> pars)
        {
            DeclarativeTemplateBuildContext bc = new DeclarativeTemplateBuildContext();
            bc.Ribbon = ribbon;
            bc.Controls = controls;
            bc.Parameters = pars;

            Group group = ribbon.CreateGroup(id, properties, title, description, command);

            // Loop through the Layouts for this group and create them.
            JSObject[] children = DataNodeWrapper.GetNodeChildren(_data);
            for (int i = 0; i < children.Length; i++)
            {
                Layout layout = CreateLayoutFromData(children[i], group, bc);
                if (!CUIUtility.IsNullOrUndefined(layout))
                    group.AddChild(layout);
            }
            return group;
        }
Exemple #2
0
        /// <summary>
        /// Tab constructor
        /// </summary>
        /// <param name="ribbon">the Ribbon that created this Tab and that it is a part of</param>
        /// <param name="id">Component id of the Tab</param>
        /// <param name="title">Title of the Tab</param>
        /// <param name="description">Description of the Tab</param>
        /// <param name="contextual">whether this Tab is a contextual Tab or not</param>
        /// <param name="command">the command for this Tab.  Used in enabling or disabling the tab.</param>
        /// <param name="contextualGroupId">the id of the ContextualGroup that this Tab is a part of.</param>
        internal Tab(SPRibbon ribbon,
                     string id,
                     string title,
                     string description,
                     string command,
                     bool contextual,
                     string contextualGroupId,
                     string cssClass)
            : base(ribbon, id, title, description)
        {
            _lastScalingIndex = -1;
            _scalingInfo = new Scaling();
            _contextual = contextual;
            _contextualGroupId = CUIUtility.SafeString(contextualGroupId);
            _command = CUIUtility.SafeString(command);
            _cssClass = CUIUtility.SafeString(cssClass);

            // Contextual tabs are invisible by default
            if (contextual)
                VisibleInternal = false;
#if DEBUG
            if (command == "DEBUG_ALWAYS_ENABLED")
                VisibleInternal = true;
#endif
        }
Exemple #3
0
        /// <summary>
        /// Section Constructor
        /// </summary>
        /// <param name="ribbon">the Ribbon that this Section was created by and is a part of</param>
        /// <param name="id">Component id of the Secton</param>
        /// <param name="type">type of the section</param>
        internal Section(SPRibbon ribbon, string id, SectionType type, SectionAlignment alignment)
            : base(ribbon, id, "", "")
        {
            _type = type;
            _alignment = alignment;

            switch (type)
            {
                case SectionType.ThreeRow:
                    AddChildInternal(new Row(ribbon, id + "-0"), false);
                    AddChildInternal(new Row(ribbon, id + "-1"), false);
                    AddChildInternal(new Row(ribbon, id + "-2"), false);
                    break;
                case SectionType.TwoRow:
                    AddChildInternal(new Row(ribbon, id + "-0"), false);
                    AddChildInternal(new Row(ribbon, id + "-1"), false);
                    break;
                case SectionType.OneRow:
                    AddChildInternal(new Row(ribbon, id + "-0"), false);
                    break;
                case SectionType.Divider:
                    break;
                default:
                    throw new ArgumentException("Invalid SectionType");
            }
        }
Exemple #4
0
 /// <summary>
 /// Creates a Group with this kind of template.
 /// </summary>
 /// <param name="ribbon">The Ribbon that this Group will be a part of.</param>
 /// <param name="id">Component id of the created Group</param>
 /// <param name="title">Title of the created Group</param>
 /// <param name="description">description of the created Group</param>
 /// <param name="command">command of the created Group(used for enabling/disabling through polling)</param>
 /// <param name="controls">array of Controls that will be used in the Temaplate(the order matters)</param>
 /// <param name="parameters">additional parameters for this Template</param>
 /// <returns>the created Group</returns>
 public abstract Group CreateGroup(SPRibbon ribbon,
                                   string id,
                                   GroupProperties properties,
                                   string title,
                                   string description,
                                   string command,
                                   Dictionary<string, List<Control>> controls,
                                   Dictionary<string, string> parameters);
Exemple #5
0
 /// <summary>
 /// Creates a new Group.
 /// </summary>
 /// <param name="ribbon">The Ribbon that this Group is created by and is a part of.</param>
 /// <param name="id">The unique Component id of this Group.</param>
 /// <param name="title">The Title of this Group.</param>
 /// <param name="description">The Description of this Group.</param>
 internal Group(SPRibbon ribbon,
                string id,
                string title,
                string description,
                string command,
                GroupProperties properties)
     : base(ribbon, id, title, description)
 {
     _command = command;
     _properties = properties;
 }
 internal GroupPopupLayout(SPRibbon ribbon, string id, Group group)
     : base(ribbon, id, "Popup")
 {
     _group = group;
 }
Exemple #7
0
 internal GroupPopup(SPRibbon ribbon, string id, Group group)
     : base(ribbon, id, "", "")
 {
     _group = group;
 }
Exemple #8
0
 /// <summary>
 /// Creates a new Strip.
 /// </summary>
 /// <param name="ribbon">The Ribbon that this Strip was created by and is a part of.</param>
 /// <param name="id">The Component id of this Strip.</param>
 public Strip(SPRibbon ribbon, string id)
     : base(ribbon, id, "", "")
 {
 }
Exemple #9
0
        private SPRibbon BuildRibbon(object data, RibbonBuildContext rbc)
        {
            JSObject ribbonElement = DataNodeWrapper.GetFirstChildNodeWithName(data,
                                                                             DataNodeWrapper.RIBBON);

            if (CUIUtility.IsNullOrUndefined(ribbonElement))
                throw new ArgumentNullException("No ribbon element was present in the data");

            Ribbon = new SPRibbon(DataNodeWrapper.GetAttribute(ribbonElement, "Id"),
                                  DataNodeWrapper.GetNodeAttributes(ribbonElement).To<RibbonProperties>());

            //REVIEW(josefl) Should this be configurable?
            Ribbon.UseDataCookie = true;

            // Handle the Tabs
            // The XML structure that we are looking at is <Ribbon><Tabs><Tab/><Tab/>...
            JSObject[] tabChildren = DataNodeWrapper.GetNodeChildren(
                DataNodeWrapper.GetFirstChildNodeWithName(ribbonElement, DataNodeWrapper.TABS));

            AddTabsToRibbon(tabChildren, "", rbc);

            // Handle the Contextual Tab Groups
            // The XML structure that we are looking at is <Ribbon><ContextualTabs><ContextualGroup>...
            object contextualTabs = DataNodeWrapper.GetFirstChildNodeWithName(ribbonElement, DataNodeWrapper.CONTEXTUALTABS);
            if (!CUIUtility.IsNullOrUndefined(contextualTabs))
            {
                JSObject[] cgChildren = DataNodeWrapper.GetNodeChildren(contextualTabs);
                bool shownContextualGroupsSpecified =
                    !CUIUtility.IsNullOrUndefined(RibbonBuildOptions.ShownContextualGroups);
                for (int j = 0; j < cgChildren.Length; j++)
                {
                    if (shownContextualGroupsSpecified)
                    {
                        // Show the contextual group if it has been explicitly requested/ made available
                        string cgId = DataNodeWrapper.GetAttribute(cgChildren[j], DataNodeWrapper.ID);
                        if (!string.IsNullOrEmpty(cgId))
                        {
                            if (!RibbonBuildOptions.ShownContextualGroups.ContainsKey(cgId) || 
                                    CUIUtility.IsNullOrUndefined(RibbonBuildOptions.ShownContextualGroups[cgId]))
                                continue;
                        }
                    }
                    AddContextualGroup(cgChildren[j], rbc);
                }
            }

            return Ribbon;
        }
Exemple #10
0
 /// <summary>
 /// Creates a Layout.
 /// </summary>
 /// <param name="ribbon">The Ribbon that this Layout was created by and is a part of.</param>
 /// <param name="id">The Component id of this Layout.</param>
 /// <param name="title">The Title of this Layout. ie "Large", "Medium", "Small" etc.</param>
 internal Layout(SPRibbon ribbon, string id, string title)
     : base(ribbon, id, title, "")
 {
 }
Exemple #11
0
 /// <summary>
 /// Row constructor.
 /// </summary>
 /// <param name="ribbon">the Ribbon that created this Row and that it is a part of</param>
 /// <param name="id">Component id of the Row</param>
 internal Row(SPRibbon ribbon, string id)
     : base(ribbon, id, "", "")
 {
 }