<@doc alias="strategy" hierarchy="GMLDOM"> PortAdd is a strategy that handles the adding of a @DataPort! to a @Unit!. It results in adding a matching @Plug! to all the Usages of this unit. (See @ComponentUsage!). (c) SAP AG 2003-2006. All rights reserved. Class PortAdd inherit core.gml:ChangeStrategy; metadata title = '#TEXT[XTIT_PORT_ADDED]'; //printable name <@doc scope="private"> return a boolean to determine whether this strategy should be invoked override method needToHandleChange(evt) return (evt && evt.child && evt.type == 'oninsertelement' && evt.child.isa('core.gml:DataPort')); end <@doc scope="private"> return an array of objects that the strategy should be invoked on override method collectObjectsForChange(evt) //collect all usages to add plug to them var obj = evt.unit; var results = []; if(!ISA(obj, 'core.gml:Unit')) return null; var usages = obj.getUsages(); for( var i in usages) { results.push(usages[i]); } return results; end <@doc scope="private"> Create the plug for the corresponding port override method adjustObject(obj, evt); //obj is usage // evt is insert of port #DEVTIME[ if (!obj || !obj.isa('core.gml:Usage')) return; if (!evt || !evt.child || !evt.child.isa('core.gml:DataPort')) return; ] obj.createPlug(evt.child); end