@doc hierarchy="GMLDOM">
The Clipboard is an object used for cut and paste
Instances of this class are created automatically by the system, and should
not be created directly.
(c) SAP AG 2003-2008. All rights reserved.
#INCLUDE[dev:defs.inc]
#INCLUDE[gml:defs.inc]
///////////////////////////////////////////////////////////////////////
// CLASS HEADER
Class Clipboard inherit Object;
///////////////////////////////////////////////////////////////////////
// PROPERTIES
<@doc scope="public">elements
virtual property element = ^Element;
<@doc scope="public">externalRef
virtual property control = ^Control;
constructor()
this.element = null;
this.control = null;
end
/////////////////////////////////////////////////////////////////////
// METHODS
<@doc>
Clear the clipboard
name of the property to clean - either "element" or "control"
If this parameter is ommitted, the whole clipboard is cleared
The newly created element, or ~null in case of any error
method clear(prop)
var oldVal;
if (prop) {
oldVal = this.getProperty(prop);
if (!oldVal) return; // already empty...
if (prop=="element"){
//if clipboard not empty , color the previously cut element back to normal
if (this.element) this.element.modifySVGProperty("g$strokeColor","#6183A9");
}
this.setProperty(prop, null); //empty it
this.sendUpdateEvent(prop, oldVal, null);
}
else {
if (this.isEmpty()) return;
this.clear("element");
this.clear("control");
}
end
<@doc>
Send an onUpdateObject event. IT is needed because the clipboard properties are virtual
name of the property "element" or "control"
If this parameter is ommitted, the whole clipboard is cleared
The old contents of the clipboard
The new contents of the clipboard.
It is actually today always ~null, because we only sendthe event when we clear the clipboard
method sendUpdateEvent(prop, oldVal, newVal)
var evt = document.createEventObject();
evt.type = 'onUpdateObject';
evt.object = this;
evt.name = prop;
evt.value = newVal;
evt.oldval = oldVal;
$ENV.fireModelEvent(evt);
end
<@doc>
checks if the clipboard is occupied with something
~true if the clipboard is emapy, ~false otherwise
method isEmpty()
return(!this.getProperty("element") && !this.getProperty("control"));
end