use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject in project convertigo by convertigo.
the class ClipboardManager method paste.
public void paste(String xmlData, Object parentObject, boolean bChangeName) throws EngineException, SAXException, IOException {
Document document = XMLUtils.getDefaultDocumentBuilder().parse(new InputSource(new StringReader(xmlData)));
Element rootElement = document.getDocumentElement();
NodeList nodeList = rootElement.getChildNodes();
int len = nodeList.getLength();
Node node;
pastedSteps.clear();
pastedComponents.clear();
pastedObjects = new Object[] {};
if (len > 0) {
pastedObjects = new Object[len];
}
Object object = null;
for (int i = 0; i < len; i++) {
node = (Node) nodeList.item(i);
if (node.getNodeType() != Node.TEXT_NODE) {
if (parentObject instanceof IPropertyTreeObject) {
object = paste(node, (IPropertyTreeObject) parentObject, bChangeName);
} else if (parentObject instanceof IDesignTreeObject) {
object = paste(node, (IDesignTreeObject) parentObject, bChangeName);
} else {
object = paste(node, (DatabaseObject) parentObject, bChangeName);
}
pastedObjects[i] = object;
}
}
for (Entry<String, Step> entry : pastedSteps.entrySet()) {
Step step = entry.getValue();
step.getSequence().fireStepCopied(new StepEvent(step, entry.getKey()));
}
for (Object ob : pastedObjects) {
// MOBILE COMPONENTS
if (ob instanceof com.twinsoft.convertigo.beans.mobile.components.MobileComponent) {
if (ob instanceof com.twinsoft.convertigo.beans.mobile.components.PageComponent) {
com.twinsoft.convertigo.beans.mobile.components.PageComponent page = GenericUtils.cast(ob);
for (Entry<String, MobileObject> entry : pastedComponents.entrySet()) {
if (page.updateSmartSources(entry.getKey(), String.valueOf(entry.getValue().priority))) {
page.markPageAsDirty();
}
}
} else if (ob instanceof com.twinsoft.convertigo.beans.mobile.components.UIComponent) {
com.twinsoft.convertigo.beans.mobile.components.UIComponent uic = GenericUtils.cast(ob);
for (Entry<String, MobileObject> entry : pastedComponents.entrySet()) {
if (uic.updateSmartSources(entry.getKey(), String.valueOf(entry.getValue().priority))) {
uic.markAsDirty();
}
}
}
}
// NGX COMPONENTS
if (ob instanceof com.twinsoft.convertigo.beans.ngx.components.MobileComponent) {
if (ob instanceof com.twinsoft.convertigo.beans.ngx.components.PageComponent) {
com.twinsoft.convertigo.beans.ngx.components.PageComponent page = GenericUtils.cast(ob);
for (Entry<String, MobileObject> entry : pastedComponents.entrySet()) {
if (page.updateSmartSources(entry.getKey(), String.valueOf(entry.getValue().priority))) {
page.markPageAsDirty();
}
}
} else if (ob instanceof com.twinsoft.convertigo.beans.ngx.components.UIComponent) {
com.twinsoft.convertigo.beans.ngx.components.UIComponent uic = GenericUtils.cast(ob);
for (Entry<String, MobileObject> entry : pastedComponents.entrySet()) {
if (uic.updateSmartSources(entry.getKey(), String.valueOf(entry.getValue().priority))) {
uic.markAsDirty();
}
}
}
}
}
}
Aggregations