Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example displays dimension panel controller view. The following operations are executed after that:
The World dimension becomes fixed.
The root element of the World dimension is selected, and then is deselected.
Child elements of the first level of the World dimension are selected, and then are deselected.
Whether data and menu loading indicator is displayed on selecting dimension elements.
Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Displaying of Express Report section):
// Get dashboard controller MAExpressAnalysisReportViewController *contr = (MAExpressAnalysisReportViewController *)m_controller; // Get express report delegate EAReportDelegateImpl *delegate = [contr delegate]; // Get pivot object for building data tables SPPLPivot pivot = PPLPivot::pivot([delegate olapReport]); // Create a panel dimension delegate MADimensionsPanelTableViewDelegate *panelDelegate = [[MADimensionsPanelTableViewDelegate alloc] initWithPivot: pivot]; // Create a dimension panel data source MADimensionsPanelTableViewDataSource *panelDataSource = [[MADimensionsPanelTableViewDataSource alloc] initWithPivot: [panelDelegate pivot]]; // Create a dimension panel controller MADimensionsPanelTableViewController *tableViewCtrl = [MADimensionsPanelTableViewController new]; [tableViewCtrl setPanelDataSource: panelDataSource]; [tableViewCtrl setPanelDelegate: panelDelegate]; // Delete all window subviews NSArray *subviews = [self.view subviews]; for (UIView *subView in subviews) { [subView removeFromSuperview]; } // Display controller view UIView *view = [tableViewCtrl view]; [view setFrame: CGRectMake(0, 0, self.view.frame.size.width / 2, self.view.frame.size.height / 2)]; [[self view] addSubview: view]; // Get the Socio-Economic Indicators cube MADimensionsPanelDimensionDescriptor *dimension = nil; // Get number of dimensions NSUInteger dimensionsCount = [panelDataSource dimensionsPanelTableViewDimensionsCount: tableViewCtrl]; for (int i = 0; i < dimensionsCount; i++) { // Get first dimension description MADimensionsPanelDimensionDescriptor *dimDescriptor = [panelDataSource dimensionsPanelTableView: tableViewCtrl dimensionAtIndex:i]; NSString *title = [dimDescriptor title]; if ([title isEqualToString:@"World"] || [title isEqualToString:@"Countries"]) { dimension = dimDescriptor; } } if (dimension != nil) { // Fix dimension [panelDelegate dimensionsPanelTableView: tableViewCtrl didChangeRoleOfDimension:dimension toRole:kDRFixedHeader]; } else { return; } // Get first root element of dimension SPPLCommonTree dimensionElementsTree = [(MADimensionsPanelDimensionDescriptor *)dimension dimension]->elements()->itemsTree(); SNArray rootNodes = dimensionElementsTree->rootNodes(); MADimensionsPanelDimensionElementDescriptor *rootNode = [panelDataSource dimensionsPanelTableView: tableViewCtrl childElement:0 ofElement:NULL ofDimension:dimension]; // Deselect root element of specified dimension [panelDelegate dimensionsPanelTableView: tableViewCtrl didDeselectAllChildrenOfElement:NULL inDimension:dimension]; // Deselect all root element children of specified dimension [panelDelegate dimensionsPanelTableView: tableViewCtrl didDeselectAllChildrenOfChildrenOfElement: rootNode inDimension:dimension]; // Get bubble chart data source BubbleDataViewDatasource *bubbleDatasource = (BubbleDataViewDatasource *)[delegate bubbleDatasource]; // Create a controller for selecting mode of metric use by bubble chart MAElementDataSourceRoleSelectorViewController *bubbleElementRoleSelector = [[MAElementDataSourceRoleSelectorViewController alloc] initWithBubbleDataSource: bubbleDatasource]; // Set controller for selecting mode of metric use by bubble chart [panelDelegate setRoleSelector: bubbleElementRoleSelector]; // Specify metric element key of controller for selecting mode of metric used by bubble chart [bubbleElementRoleSelector dimensionsPanelTableView:tableViewCtrl setMetricElementKey:[rootNode key]]; // Determine whether menu should be displayed in dimension bool isShouldShowMenuInDimension = [bubbleElementRoleSelector dimensionsPanelTableView: tableViewCtrl shouldShowMenuInDimension:dimension]; if (isShouldShowMenuInDimension) { // Get element menu controller UIViewController *elementMenuController = [panelDelegate dimensionsPanelTableView: tableViewCtrl elementMenuViewControllerForElement:rootNode inDimension: dimension]; [[self view] addSubview: [elementMenuController view]]; } else { NSLog(@"Menu should not be displayed in the dimension %@", [dimension title]); }
After executing the example the mobile device screen displays the data source dimension panel. The root element of the World element is not selected:
The first level child elements are also not selected in the dimension root element:
The development environment console displays a notification that the menu should not be displayed for the World dimension.
Then select the root element and its child elements. To do this, add the following code fragment to the example:
// Select root elements of specified dimension [panelDelegate dimensionsPanelTableView: tableViewCtrl didSelectAllChildrenOfElement: NULL inDimension: dimension]; // Select all children of root elements in specified dimension [panelDelegate dimensionsPanelTableView: tableViewCtrl didSelectAllChildrenOfChildrenOfElement: rootNode inDimension: dimension];
After repeated executing the example with the added code fragment the root element of the World dimension is selected:
The first level child elements of the dimension root element are also selected:
See also: