'use strict' ; import * as path from 'path' ; import { ALPageWizardData } from './alPageWizardData' ; import { ALTableBasedWizardPage } from './alTableBasedWizardPage' ; import { ALPageWizardFastTabData } from './alPageWizardFastTabData' ; import { ALPageSyntaxBuilder } from '../syntaxbuilders/alPageSyntaxBuilder' ; import { DevToolsExtensionContext } from '../../devToolsExtensionContext' ; import { ALObjectWizardSettings } from './alObjectWizardSettings' ; export class ALPageWizardPage extends ALTableBasedWizardPage { protected _pageWizardData : ALPageWizardData ; constructor ( toolsExtensionContext , settings , data ) { super ( toolsExtensionContext , "AL Page Wizard" , settings , data ) ; this . _pageWizardData = data ; this . _includeToolTips = data . reuseToolTips ; this . _toolTipsSourceDependencies = data . toolTipsSource ; } protected getHtmlContentPath ( ) { return path . join ( 'htmlresources' , 'alpagewizard' , 'alpagewizard.html' ) ; } protected getViewType ( ) { return "azALDevTools.ALPageWizard" ; } protected async finishWizard ( data ) { this . _pageWizardData . objectId = data . objectId ; this . _pageWizardData . objectName = data . objectName ; this . _pageWizardData . selectedTable = data . selectedTable ; this . _pageWizardData . pageType = data . pageType ; this . _pageWizardData . fastTabs = data . fastTabs ; this . _pageWizardData . applicationArea = data . applicationArea ; this . _pageWizardData . usageCategory = data . usageCategory ; this . _pageWizardData . caption = data . caption ; this . _pageWizardData . apiPublisher = data . apiPublisher ; this . _pageWizardData . apiGroup = data . apiGroup ; this . _pageWizardData . apiVersion = data . apiVersion ; this . _pageWizardData . entityName = data . entityName ; this . _pageWizardData . entitySetName = data . entitySetName ; this . _pageWizardData . createTooltips = data . createTooltips ; this . _pageWizardData . selectedFieldList = [ ] ; if ( data . fields ) { for ( var i = 0 ; i < data . fields . length ; i ++ ) { this . _pageWizardData . selectedFieldList . push ( data . fields [ i ] ) ; } } this . _pageWizardData . fastTabsData = [ ] ; if ( data . fastTabsData ) { for ( var i = 0 ; i < data . fastTabsData . length ; i ++ ) { var sourceFastTabDetails = data . fastTabsData [ i ] ; var fastTabDetails = new ALPageWizardFastTabData ( sourceFastTabDetails . name ) ; if ( sourceFastTabDetails . fields ) { for ( var fld = 0 ; fld < sourceFastTabDetails . fields . length ; fld ++ ) fastTabDetails . fields . push ( sourceFastTabDetails . fields [ fld ] ) ; } this . _pageWizardData . fastTabsData . push ( fastTabDetails ) ; } } this . _pageWizardData . projectSettings = await this . getProjectSettings ( ) ; let builder = new ALPageSyntaxBuilder ( ) ; let source = builder . buildFromPageWizardData ( this . _settings . getDestDirectoryUri ( ) , this . _pageWizardData ) ; this . createObjectFile ( 'Page' , this . _pageWizardData . objectId , this . _pageWizardData . objectName , source ) ; return true ; } }