Working with Dimension Panel Container (Example 1)

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example creates and displays a dimension panel container. After starting the example the following operations are executed:

Required Files

It is required to add the following file to the base example Displaying of Express Report:

Source Code

Executing the example requires to create a class implementing a protocol for working with dimension panel container, and also to add a class header file to source code of the ViewController class (see the Displaying of Express Report section). Then it is required to place the following code instead of the executeExample method of the ViewController class:

-(void)executeExample {
    // Create a dimension panel container controller
    PanelViewController *panelViewCtrl = [PanelViewController new];
    
    // Set container title
    [panelViewCtrl setPanelTitle: @"Prognoz"];
    NSLog(@"Dimension panel container title: %@", [PanelViewController text]);
    
    // Create a dimension panel controller
    MADimensionsPanelTableViewController *tableViewCtrl = [self createDimensionsPanelTableViewController];
    // Set dimension panel controller
    [panelViewCtrl setContentViewController: tableViewCtrl];
        
    // Create and set dimension panel delegate
    PanelViewDelegateImpl *delegate = [PanelViewDelegateImpl new];
    [panelViewCtrl setDelegate: delegate];
    
    // Get separator between two data views
    MASeparatorView *separatorView = [panelViewCtrl separatorView];
    // Inform that dimension panel container is displayed
    [panelViewCtrl updateForVisibility: NO];
    
    // Display top arrow on separator between two data views
    [separatorView setUpArrowVisible: YES];
    // Display bottom arrow on separator between two data views
    [separatorView setDownArrowVisible: YES];
    // Displays dimension panel container controller
    [self showViewControllerInNavigationController: panelViewCtrl];
}
// Creates a dimension panel controller
-(MADimensionsPanelTableViewController *) createDimensionsPanelTableViewController {
    // Get express report controller
    MAExpressAnalysisReportViewController *contr = (MAExpressAnalysisReportViewController *)m_controller;
    // Get express report controller
    EAReportDelegateImpl *delegate = [contr delegate];
    
    // Get pivot object for building data tables
    SPPLPivot pivot = PPLPivot::pivot([delegate olapReport]);
    
    // Create a dimension panel 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];
    return tableViewCtrl;
}

After executing the example the mobile device screen displays the dimension panel container. The container includes title, dimension panel and separator. The data view separator displays top and bottom arrows:

Example execution result remains the same if the code string:

[panelViewCtrl updateForVisibility: NO];

is replaced with the following fragment:

[separatorView setPanelVisible: YES];
if ([separatorView isPanelVisible] && [delegate respondsToSelector:@selector(panelViewDidHide:)]) {
    [delegate panelViewDidShow: panelViewCtrl];
}
if (![separatorView isPanelVisible] && [delegate respondsToSelector:@selector(panelViewDidShow:)]) {
    [delegate panelViewDidHide: panelViewCtrl];
}

The development environment console displays dimension panel container title and a message that this container is displayed:

Dimension panel container title: Prognoz

Dimension panel container is displayed

See also:

Examples of Component Use