<@doc alias="elem" hierarchy="GMLDOM" also="@Connectable"> A link between two plugs in the same unit. (c) SAP AG 2003-2006. All rights reserved. /////////////////////////////////////////////////////////////////////// // CLASS HEADER Class Link inherit Element; metadata title = '#TEXT[XTIT_LINK]'; metadata descr = '#TEXT[XTOL_LINK]'; metadata icon16 = '#URL[~res:skins.neutral.symbols.link16.gif]'; attach svg:Line; /////////////////////////////////////////////////////////////////////// // PROPERTIES <@doc>Gets the source plug of the link readonly property source = ^Plug; <@doc>Gets the target plug of the link readonly property target = ^Plug; /////////////////////////////////////////////////////////////////////// // METHODS /* override method onPropagate(evt) this.supercall(evt); var model = (this.unit? this.unit.model: $ENV.context.model); if(evt.type == 'onRemoveElement') { // If this link is source or target of the removed element, so remove the Link as well if( (evt.child.isa('core.gml:Port')) && ( (this.source.getTargetFullId() == model.getFullId(evt.child, evt.unit)) ||(this.target.getTargetFullId() == model.getFullId(evt.child, evt.unit)) ) ) { this.parent.removeElement(this, 'elements'); } else if ( (evt.child.isa('core.gml:Connectable')) && ( (this.source.parent.id == evt.child.id) ||(this.target.parent.id == evt.child.id) ) ) { this.parent.removeElement(this, 'elements'); } } end */ <@doc> A callback method that is called when the @RefInfoshape! or related @BOInfoshape! is modified on the source or target elements on this Link. the type of change of infoshape An object containing data related to the change in the infoshape See more details on the parameters passed to this method in @Infoshape!notifyOnChange. Override this method to handle changes in this object as a result of changes in the related infoshape. method notifyOnInfoshapeChange(changeType, changeData) //nothing to do end /////////////////////////////////////////////////////////////////////// // EVENT LISTENERS listen onShapeMenu for core.gml:Link menu.append({button:'EDIT_PROPERTIES'}); menu.append({button:'EDIT_RENAME'}); menu.append({button:'EDIT_DELETE'}); end listen canCloneElement for core.gml:Link var sourceplug_parent = evt && evt.object && evt.object.source && evt.object.source.parent || null ; var targetplug_parent = evt && evt.object && evt.object.target && evt.object.target.parent || null ; var source_ok = (sourceplug_parent.id in evt.objectset) && (evt.objectset[sourceplug_parent.id] == sourceplug_parent); var target_ok = (targetplug_parent.id in evt.objectset) && (evt.objectset[targetplug_parent.id] == targetplug_parent); if (!source_ok || !target_ok) { evt.cancelme = true; } end if (!source_ok || !target_ok) { evt.cancelme = true; } end