/// <summary> /// This method executes the build process /// </summary> /// <param name="jewelId">The CUI ID for this Jewel</param> /// <returns>The Jewel object</returns> public bool BuildJewel(string jewelId) { if (InQuery) { return(false); } if (IsIdTrimmed(jewelId)) { return(true); /* no error, so return true */ } JewelBuildContext jbc = new JewelBuildContext(); jbc.JewelId = jewelId; InQuery = true; DataQuery query = new DataQuery(); query.TabQuery = false; query.Id = jbc.JewelId; query.QueryType = DataQueryType.Root; query.Handler = new DataReturnedEventHandler(OnReturnJewel); query.Data = jbc; this.DataSource.RunQuery(query); return(true); }
private void OnReturnJewel(DataQueryResult dqr) { JewelBuildContext jbc = (JewelBuildContext)dqr.ContextData; // Apply any extensions to the data. dqr.QueryData = ApplyDataExtensions(dqr.QueryData); JSObject jewelNode = DataNodeWrapper.GetFirstChildNodeWithName(dqr.QueryData, DataNodeWrapper.JEWEL); Jewel = BuildJewelInternal(jewelNode, jbc); Jewel.JewelBuilder = this; BuildClient.OnComponentCreated(Jewel, Jewel.Id); if (JewelBuildOptions.AttachToDOM) { Jewel.AttachInternal(true); } else { Jewel.RefreshInternal(); Placeholder.AppendChild(Jewel.ElementInternal); Utility.EnsureCSSClassOnElement(Placeholder, "loaded"); } OnRootBuilt(Jewel); BuildClient.OnComponentBuilt(Jewel, Jewel.Id); }
internal void AttachAndBuildJewelFromData(object jewelData) { if (!_hasJewel) { return; } _elmJewelPlaceholder.Style.Display = "block"; JewelBuildContext jbc = new JewelBuildContext(); jbc.JewelId = DataNodeWrapper.GetAttribute(jewelData, "Id"); // Build Jewel JewelBuildOptions options = new JewelBuildOptions(); options.TrimmedIds = _builder.Options.TrimmedIds; JewelBuilder builder = new JewelBuilder(options, _elmJewelPlaceholder, _builder.BuildClient); builder.BuildJewelFromData(jewelData, jbc); this.Jewel = builder.Jewel; }
internal void BuildJewelFromData(object dataNode, JewelBuildContext jbc) { DataQueryResult dqr = new DataQueryResult(); dqr.Success = true; dqr.QueryData = dataNode; dqr.ContextData = jbc; OnReturnJewel(dqr); }
private Jewel BuildJewelInternal(object data, JewelBuildContext jbc) { if (CUIUtility.IsNullOrUndefined(data)) { throw new ArgumentNullException("No Jewel element was present in the data"); } Jewel = new Jewel(DataNodeWrapper.GetAttribute(data, "Id"), DataNodeWrapper.GetNodeAttributes(data).To <JewelProperties>()); // Handle the Jewel Menu Launcher control JewelMenuLauncher jml = BuildJewelMenuLauncher(data, jbc); Jewel.AddChild(jml.CreateComponentForDisplayMode("Default")); Jewel.JewelMenuLauncher = jml; return(Jewel); }
/// <summary> /// This method executes the build process /// </summary> /// <param name="jewelId">The CUI ID for this Jewel</param> /// <returns>The Jewel object</returns> public bool BuildJewel(string jewelId) { if (InQuery) return false; if (IsIdTrimmed(jewelId)) return true; /* no error, so return true */ JewelBuildContext jbc = new JewelBuildContext(); jbc.JewelId = jewelId; InQuery = true; DataQuery query = new DataQuery(); query.TabQuery = false; query.Id = jbc.JewelId; query.QueryType = DataQueryType.Root; query.Handler = new DataReturnedEventHandler(OnReturnJewel); query.Data = jbc; this.DataSource.RunQuery(query); return true; }
private JewelMenuLauncher BuildJewelMenuLauncher(object data, JewelBuildContext jbc) { JewelMenuLauncherProperties properties = DataNodeWrapper.GetNodeAttributes(data).To <JewelMenuLauncherProperties>(); JSObject[] children = DataNodeWrapper.GetNodeChildren(data); Menu menu = null; MenuLauncherControlProperties launcherProperties = DataNodeWrapper.GetNodeAttributes(data).To <MenuLauncherControlProperties>(); if (!Utility.IsTrue(launcherProperties.PopulateDynamically)) { menu = BuildMenu(children[0], jbc, false); } JewelMenuLauncher jml = new JewelMenuLauncher(Jewel, properties.Id, properties, menu); return(jml); }
private JewelMenuLauncher BuildJewelMenuLauncher(object data, JewelBuildContext jbc) { JewelMenuLauncherProperties properties = DataNodeWrapper.GetNodeAttributes(data).To<JewelMenuLauncherProperties>(); JSObject[] children = DataNodeWrapper.GetNodeChildren(data); Menu menu = null; MenuLauncherControlProperties launcherProperties = DataNodeWrapper.GetNodeAttributes(data).To<MenuLauncherControlProperties>(); if (!Utility.IsTrue(launcherProperties.PopulateDynamically)) menu = BuildMenu(children[0], jbc, false); JewelMenuLauncher jml = new JewelMenuLauncher(Jewel, properties.Id, properties, menu); return jml; }
private Jewel BuildJewelInternal(object data, JewelBuildContext jbc) { if (CUIUtility.IsNullOrUndefined(data)) throw new ArgumentNullException("No Jewel element was present in the data"); Jewel = new Jewel(DataNodeWrapper.GetAttribute(data, "Id"), DataNodeWrapper.GetNodeAttributes(data).To<JewelProperties>()); // Handle the Jewel Menu Launcher control JewelMenuLauncher jml = BuildJewelMenuLauncher(data, jbc); Jewel.AddChild(jml.CreateComponentForDisplayMode("Default")); Jewel.JewelMenuLauncher = jml; return Jewel; }