private Component DelayInitTab(Component component, object data, object buildContext) { RibbonBuildContext rbc = (RibbonBuildContext)buildContext; Tab tab = (Tab)component; rbc.InitializedTab = (Tab)component; // If the data node does not have children, then it means that this tab // was shallowly fetched from the server. In this case we need to run // a query to get the whole node with all of its controls from the server. JSObject[] children = DataNodeWrapper.GetNodeChildren(data); if (children.Length == 0) { // TODO: implement this so that the asynchronous part works // Find out if we even need to fetch the tabs asynchronously // or if we can get away with just initializing them asynchronously DataQuery query = new DataQuery(); query.TabQuery = true; query.Id = rbc.InitializedTab.Id; query.QueryType = DataQueryType.RibbonTab; query.Handler = new DataReturnedEventHandler(this.OnReturnTab); query.Data = rbc; DataSource.RunQuery(query); return(null); } FillTab(tab, data, rbc); tab.OnDelayedInitFinished(true); // TODO(josefl): this should later be an idle task registration instead of a hard call Ribbon.Refresh(); return(tab); }
/// <summary> /// This method executes the build process /// </summary> /// <param name="qatId">The CUI ID for this QAT</param> /// <returns>The QAT object</returns> public bool BuildQAT(string qatId) { if (InQuery) { return(false); } if (IsIdTrimmed(qatId)) { return(true); /* no error, so return true */ } QATBuildContext qbc = new QATBuildContext(); qbc.QATId = qatId; InQuery = true; DataQuery query = new DataQuery(); query.TabQuery = false; query.Id = qbc.QATId; query.QueryType = DataQueryType.Root; query.Handler = new DataReturnedEventHandler(OnReturnQAT); query.Data = qbc; DataSource.RunQuery(query); return(true); }
/// <summary> /// The public method to create a toolbar using the datasource specified in the .DataSource property /// </summary> public void BuildToolbar() { ToolbarBuildContext context = new ToolbarBuildContext(); DataQuery query = new DataQuery(); query.TabQuery = false; query.Id = "toolbar"; query.QueryType = DataQueryType.All; query.Handler = new DataReturnedEventHandler(OnReturnToolbarData); query.Data = context; DataSource.RunQuery(query); }
public bool BuildRibbonAndInitialTab(string initialTabId) { if (string.IsNullOrEmpty(initialTabId)) { throw new ArgumentNullException("Initial tab for ribbon is null or undefined"); } if (InQuery) { return(false); } RibbonBuildContext rbc = new RibbonBuildContext(); rbc.InitialTabId = initialTabId; // If this is server rendered, then we want to set and use the initial // scaling index for this first tab. if (!CUIUtility.IsNullOrUndefined(RibbonBuildOptions.AttachToDOM) && RibbonBuildOptions.AttachToDOM) { rbc.InitialScalingIndex = this.RibbonBuildOptions.InitialScalingIndex; } InQuery = true; DataQuery query = new DataQuery(); query.TabQuery = false; query.Id = rbc.InitialTabId; query.QueryType = DataQueryType.RibbonVisibleTabDeep; query.Handler = new DataReturnedEventHandler(OnReturnRibbonAndInitialTab); query.Data = rbc; DataSource.RunQuery(query); return(true); }