use of org.talend.designer.core.ui.editor.jobletcontainer.JobletUtil in project tdi-studio-se by Talend.
the class SubjobContainer method refreshNodesLocation.
public void refreshNodesLocation(boolean jobletCollapsed, AbstractJobletContainer nc, int rightChangewidth, int downChangeheight, int leftChangewidth, int upChangeheight) {
JobletUtil util = new JobletUtil();
Node node = nc.getNode();
Rectangle jobletRec = new Rectangle(node.getLocation(), node.getSize());
boolean isJobletSubjob = nc.getSubjobContainer() == this;
for (NodeContainer container : nodeContainers) {
if (container.getNode().getUniqueName().equals(nc.getNode().getUniqueName())) {
continue;
}
Point nodePoint = container.getNode().getLocation().getCopy();
Rectangle jRec = util.getExpandRectangle(jobletRec);
// Rectangle jNodeConRec = util.getExpandRectangle(nodeConRec);
// Rectangle pointrec = util.getExpandRectangle(container.getNodeContainerRectangle());
jRec.width = jRec.width + rightChangewidth + leftChangewidth;
jRec.height = jRec.height + downChangeheight + upChangeheight;
// jNodeConRec.height = jNodeConRec.height + changeheight;
if (!jobletCollapsed) {
if (!nc.isUpdate()) {
Point origPoint = new Point(nodePoint.x, nodePoint.y);
pointMap.put(container.getNode().getUniqueName(), origPoint);
if (isJobletSubjob) {
if (nodePoint.x > jobletRec.x) {
nodePoint.x = nodePoint.x + rightChangewidth;
}
if (nodePoint.y > jobletRec.y) {
nodePoint.y = nodePoint.y + downChangeheight;
}
if (nodePoint.x < jobletRec.x) {
nodePoint.x = nodePoint.x - leftChangewidth;
}
if (nodePoint.y < jobletRec.y) {
nodePoint.y = nodePoint.y - upChangeheight;
}
} else {
Rectangle jobletSubRec = nc.getSubjobContainer().getSubjobContainerRectangle();
Rectangle currentRec = this.getSubjobContainerRectangle();
if (nodePoint.x > jobletRec.x && !(currentRec.y < jobletSubRec.y && currentRec.y + currentRec.height <= jobletSubRec.y + upChangeheight + node.getSize().height || jobletSubRec.y + jobletSubRec.height <= currentRec.y + downChangeheight + node.getSize().height && currentRec.y > jobletSubRec.y)) {
nodePoint.x = nodePoint.x + rightChangewidth;
}
if (nodePoint.y > jobletRec.y && !(currentRec.x < jobletSubRec.x && currentRec.x + currentRec.width <= jobletSubRec.x + leftChangewidth + node.getSize().width || jobletSubRec.x + jobletSubRec.width <= currentRec.x + rightChangewidth + node.getSize().width && currentRec.x > jobletSubRec.x)) {
nodePoint.y = nodePoint.y + downChangeheight;
}
if (nodePoint.x < jobletRec.x && !(currentRec.y < jobletSubRec.y && currentRec.y + currentRec.height <= jobletSubRec.y + upChangeheight + node.getSize().height || jobletSubRec.y + jobletSubRec.height <= currentRec.y + downChangeheight + node.getSize().height && currentRec.y > jobletSubRec.y)) {
nodePoint.x = nodePoint.x - leftChangewidth;
}
if (nodePoint.y < jobletRec.y && !(currentRec.x < jobletSubRec.x && currentRec.x + currentRec.width <= jobletSubRec.x + leftChangewidth + node.getSize().width || jobletSubRec.x + jobletSubRec.width <= currentRec.x + rightChangewidth + node.getSize().width && currentRec.x > jobletSubRec.x)) {
nodePoint.y = nodePoint.y - upChangeheight;
}
}
}
} else {
nodePoint = pointMap.get(container.getNode().getUniqueName());
// if (nodePoint.x > nodeRec.x && nodePoint.x > rightChangewidth) {
// nodePoint.x = nodePoint.x - rightChangewidth;
// }
// if (nodePoint.x < nodeRec.x) {
// nodePoint.x = nodePoint.x + leftChangewidth;
// }
// if (nodePoint.y > nodeRec.y && nodePoint.y > downChangeheight) {
// if ((nodePoint.y - downChangeheight) > (nodeRec.y + 64)) {
// nodePoint.y = nodePoint.y - downChangeheight;
// } else {
// nodePoint.y = nodeRec.y + 64;
// }
//
// }
}
container.getNode().setLocation(nodePoint);
}
}
use of org.talend.designer.core.ui.editor.jobletcontainer.JobletUtil in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method dispose.
/**
* The <code>MultiPageEditorPart</code> implementation of this <code>IWorkbenchPart</code> method disposes all
* nested editors. Subclasses may extend.
*/
@Override
public void dispose() {
getSite().setSelectionProvider(null);
getSite().getWorkbenchWindow().getSelectionService().removeSelectionListener(this);
/* after the release of eclipse3.6,this parameter can't be null */
// setInput(null);
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
getSite().getWorkbenchWindow().getPartService().removePartListener(partListener);
if (this.lockService != null) {
this.lockService.unregister();
}
super.dispose();
if (getProcess() != null && !getProcess().isReadOnly()) {
if (isKeepPropertyLocked()) {
return;
}
// Unlock the process :
IRepositoryService service = CorePlugin.getDefault().getRepositoryService();
IProxyRepositoryFactory repFactory = service.getProxyRepositoryFactory();
try {
getProcess().getProperty().eAdapters().remove(dirtyListener);
Property property = getProcess().getProperty();
if (property.eResource() == null || property.getItem().eResource() == null) {
property = repFactory.getUptodateProperty(property);
}
// fix for bug 12524 for db repository
// property = repFactory.reload(property);
JobletUtil jUtil = new JobletUtil();
jUtil.makeSureUnlockJoblet(getProcess());
Item item = getProcess().getProperty().getItem();
boolean keep = jUtil.keepLockJoblet(item);
if (keep) {
repFactory.unlock(property.getItem());
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
} catch (LoginException e) {
ExceptionHandler.process(e);
}
}
if (processEditorInput != null) {
processEditorInput.dispose();
processEditorInput = null;
}
designerEditor = null;
codeEditor = null;
if (processor instanceof IJavaBreakpointListener) {
JDIDebugModel.removeJavaBreakpointListener((IJavaBreakpointListener) processor);
}
processor = null;
dirtyListener = null;
NodeTransferDragSourceListener.getInstance().setEditPart(null);
}
Aggregations