<@doc hierarchy="GMLDOM"> A Scenario is a component that represents an executable user interface component, such as a screen, a window, a dialog box, or a nested view. Child Elements @gml:ScenarioUsage, @gml:ServiceUsage, @gml:Interactor, @gml:State, @gml:Port, @gml:Link, @gml:Note (c) SAP AG 2003-2006. All rights reserved. /////////////////////////////////////////////////////////////////////// // CLASS HEADER Class Scenario inherit Component; attach ScenarioLayout; implement core.dev:IDESupport; metadata title = '#TEXT[XTIT_SCENARIO]'; metadata descr = '#TEXT[XTOL_SCENARIO]'; metadata icon16 = '#URL[~res:skins.neutral.symbols.scenario16.gif]'; metadata icon32 = '#URL[~res:skins.neutral.symbols.scenario32.gif]'; metadata childElements = ['core.gml:Configuration', 'core.gml:ScenarioUsage', 'core.gml:ServiceUsage', 'core.gml:Interactor', 'core.gml:State', 'core.gml:Port', 'core.gml:Link', 'core.gml:Note']; metadata usageElement = 'core.gml:ScenarioUsage'; /////////////////////////////////////////////////////////////////////// // PROPERTIES <@doc>Position, in format 'X Y', of this object in its parent UI container, in parent client coordinates. property pos = '0 0'; <@doc>Size, in format 'W H', of this object on the screen. property size = '640 480'; <@doc>Type of child objects arrangement. Can be 'VFLOW' (default), 'HFLOW' and 'ABSOLUTE'. property layoutType = 'VFLOW'; <@doc>Specifies if this object is drawn in the Layout Board. Design-time only. readonly property showInLayout = true; <@doc>Specifies if the layout inside this object is read-only (children cannot be moved/resized). property layoutReadonly = false; // user can/cannot change child order <@doc>Defines toolbar that can be shown for this Scenario, if any. strong property toolbar = ^Toolbar; virtual property translationTable = null; // For easy reference <@doc> Indicates whether to show the toolbar, if applicable Event if this property is ~false, the @toolbar property can have valid toolbar defintion. In such case, the toolbar will not be displayed. property showToolbar = false; <@doc>Column Layout specific. Gets or sets columns count that this scenario has property columns = 3; /////////////////////////////////////////////////////////////////////// // METHODS override method onCreate() this.supercall(); this.createElement('core.gml:Toolbar', 'toolbar'); this.translationTable = this.createElement('core.gml:Translation', 'resources'); end // // AP6: For AP5 model compatibitily - if there's no toolbar - create one. // NOTE: If this will be handled by a migration step - remove this method // override method onLoad() this.supercall(); if (this.toolbar == null) { this.createElement('core.gml:Toolbar', 'toolbar'); } for(var res in this.resources) { if(ISA(this.resources[res], 'Translation')) { this.translationTable = this.resources[res]; } } end //////////////////////////////// /////////// TRANSLATION METHODS: <@doc> Used for creating a new Text instance and an entry in the translation table The translation type The text to be translated A reference the GML Object The newly genenrated key override method insertTranslation(theType, theText, theObject) theObject = theObject || this; if(this.translationTable && theText && theType) { return this.translationTable.insertText({text:theText, type:theType, objID:theObject.id}); } return null; end <@doc> Used for retrieving Text from the translation table The key of the Text to retrieve Whether called from DE engine or not The translated text (and type in case of DE) override method getTranslation(key, isDE) var value = key; if(this.translationTable) { value = this.translationTable.getTranslationVal(key, isDE); } return value; end <@doc> Used for updating Text instance and an entry in the translation table The new text to be translated The key of the Text object to update Optional. Needed when the type is to be replaced The updated key override method updateTranslation(value, key, type) if(this.translationTable) { return this.translationTable.insertText(value, key, type); } return value; end <@doc> Used for removing Texts from the translation table One or more (array) of Texts to remove override method removeTranslation(keys) if(this.translationTable) { if(ISARRAY(keys)) { for(var i=0 ; i Check if the object or its children have translation implications - currently this means if it has links to Gml:Text objects ~true if it does have translation implications, ~false otherwise override method hasTranslation(deep) if (COUNT(this.translationTable.items) > 0) return(true); //check children if (deep && this.hasChildTranslation()) return(true); return(false); //nothing found end <@doc> Check if the object has personalization implications ~true if it does has personalization implications, ~false otherwise override method canBePersonalized() return(true); // This Class can be personalized in RT by the end user (ByD application user) end ////////////////////////////////////////////////// /// Implementing IDESupport override method getDynExpContext(propertyID) var ctx = this.dynExpContext; if(null == ctx) { // First time per Class: ctx = $ENV.createObject('core.dev:DynExpContext'); if(ctx) { if(false == ctx.setContext(this, null)) { // Non valid arguments: return null; } } else { return null; } this.dynExpContext = ctx; } var exprType; if (!this.Class.properties[propertyID]) { // Just in case there is no relevant property return null; } else { exprType = this.Class.properties[propertyID].exprType; } if(false == ctx.setExprType(exprType)) { // Non valid type: return null; } var transType = null; if(#SYS[SUPPORT_TRANSLATION]) { if(this.Class.properties[propertyID].metadata.translation && this.Class.properties[propertyID].metadata.translation.translate && this.Class.properties[propertyID].metadata.translation.type) { transType = this.Class.properties[propertyID].metadata.translation.type; } ctx.setTranslation(this, propertyID, transType); } return ctx; end