use of org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure in project tdi-studio-se by Talend.
the class VarColumnAnchor method getReferencePoint.
@Override
public Point getReferencePoint() {
Point ref = null;
final VarTablePart varTablePart = (VarTablePart) MapperUtils.getMapperTablePart(entityManager.getEditPart());
if (entityManager.isTableMinimized()) {
if (isSource) {
ref = varTablePart.getFigure().getBounds().getRight();
} else {
ref = varTablePart.getFigure().getBounds().getLeft();
}
} else if (getOwner() instanceof TableTreeEntityFigure) {
TableTreeEntityFigure nodeFigure = (TableTreeEntityFigure) getOwner();
// normal column
if (nodeFigure.getTreeBranch() == null) {
if (isSource) {
ref = getOwner().getBounds().getRight();
} else {
if (nodeFigure.getElement() != null) {
ref = nodeFigure.getElement().getBounds().getLeft();
} else {
ref = getOwner().getBounds().getLeft();
}
}
getOwner().translateToAbsolute(ref);
}
} else if (getOwner() instanceof VarEntityFigure) {
VarEntityFigure varNodeFigure = (VarEntityFigure) getOwner();
if (isSource) {
ref = getOwner().getBounds().getRight();
ref.x = varTablePart.getFigure().getBounds().getRight().x;
} else {
if (varNodeFigure.getExpression() != null) {
ref = varNodeFigure.getExpression().getBounds().getLeft();
} else {
ref = getOwner().getBounds().getLeft();
}
}
getOwner().translateToAbsolute(ref);
} else {
ref = getOwner().getBounds().getCenter();
getOwner().translateToAbsolute(ref);
}
return ref;
}
use of org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure in project tdi-studio-se by Talend.
the class ConnectionColumnAnchor method getReferencePoint.
@Override
public Point getReferencePoint() {
if (connectionPart == null) {
return getOwner().getBounds().getLeft();
}
MapperTablePart mapperTablePart = MapperUtils.getMapperTablePart(entityManager.getEditPart());
boolean loctionRight = false;
if (mapperTablePart instanceof InputTablePart) {
loctionRight = true;
}
Point ref = null;
if (mapperTablePart != null && entityManager.isTableMinimized()) {
if (loctionRight) {
ref = mapperTablePart.getFigure().getBounds().getRight();
} else {
ref = mapperTablePart.getFigure().getBounds().getLeft();
}
} else {
if (getOwner() == null) {
return null;
} else if (getOwner() instanceof TableTreeEntityFigure) {
TableTreeEntityFigure nodeFigure = (TableTreeEntityFigure) getOwner();
if (nodeFigure.getElement() != null) {
if (loctionRight) {
ref = nodeFigure.getElement().getBounds().getRight();
} else {
ref = nodeFigure.getElement().getBounds().getLeft();
}
getOwner().translateToAbsolute(ref);
}
} else {
ref = getOwner().getBounds().getCenter();
getOwner().translateToAbsolute(ref);
}
}
if (mapperTablePart != null && ref != null) {
IFigure treeFigure = mapperTablePart.getFigure();
if (loctionRight) {
int avialableX = treeFigure.getBounds().getRight().x;
if (ref.x > avialableX) {
ref.x = avialableX;
}
} else {
int avialableX = treeFigure.getBounds().x;
if (ref.x < avialableX) {
ref.x = avialableX;
}
}
}
if (connectionPart instanceof BaseConnectionEditPart && connectionPart.getFigure() instanceof PolylineConnection) {
BaseConnectionEditPart baseConnectionPart = (BaseConnectionEditPart) connectionPart;
PolylineConnection connFigure = (PolylineConnection) connectionPart.getFigure();
org.eclipse.swt.graphics.Point avilableSize = entityManager.getGraphicalViewer().getControl().getSize();
if (forceDarshDot) {
connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
} else if (ref != null) {
if (ref.y < 0) {
if (!(baseConnectionPart instanceof LookupConnectionPart)) {
ref.y = 0;
}
if (loctionRight) {
baseConnectionPart.setSourceConcained(false);
} else {
baseConnectionPart.setTargetContained(false);
}
if (baseConnectionPart.isDOTStyle()) {
connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
} else {
connFigure.setLineStyle(SWT.LINE_SOLID);
}
} else if (ref.y > avilableSize.y) {
if (!(baseConnectionPart instanceof LookupConnectionPart)) {
ref.y = avilableSize.y;
}
if (loctionRight) {
baseConnectionPart.setSourceConcained(false);
} else {
baseConnectionPart.setTargetContained(false);
}
if (baseConnectionPart.isDOTStyle()) {
connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
} else {
connFigure.setLineStyle(SWT.LINE_SOLID);
}
} else {
if (loctionRight) {
baseConnectionPart.setSourceConcained(true);
} else {
baseConnectionPart.setTargetContained(true);
}
if (!baseConnectionPart.isDOTStyle()) {
connFigure.setLineStyle(SWT.LINE_SOLID);
}
}
}
}
return ref;
}
use of org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure in project tdi-studio-se by Talend.
the class FilterColumnAnchor method getReferencePoint.
@Override
public Point getReferencePoint() {
if (connectionPart == null) {
return getOwner().getBounds().getLeft();
}
MapperTablePart mapperTablePart = MapperUtils.getMapperTablePart(entityManager.getEditPart());
boolean loctionRight = true;
if (connectionPart.getTarget() instanceof InputTablePart) {
loctionRight = false;
}
Point ref = null;
if (mapperTablePart != null && entityManager.isTableMinimized()) {
if (loctionRight) {
ref = mapperTablePart.getFigure().getBounds().getRight();
} else {
ref = mapperTablePart.getFigure().getBounds().getLeft();
}
} else {
if (getOwner() == null) {
return null;
} else if (getOwner() instanceof TableTreeEntityFigure) {
TableTreeEntityFigure nodeFigure = (TableTreeEntityFigure) getOwner();
if (nodeFigure.getElement() != null) {
if (loctionRight) {
ref = nodeFigure.getElement().getBounds().getRight();
} else {
ref = nodeFigure.getElement().getBounds().getLeft();
}
getOwner().translateToAbsolute(ref);
}
} else {
ref = getOwner().getBounds().getCenter();
getOwner().translateToAbsolute(ref);
}
}
if (mapperTablePart != null && ref != null) {
IFigure treeFigure = mapperTablePart.getFigure();
if (loctionRight) {
int avialableX = treeFigure.getBounds().getRight().x;
if (ref.x > avialableX) {
ref.x = avialableX;
}
} else {
int avialableX = treeFigure.getBounds().x;
if (ref.x < avialableX) {
ref.x = avialableX;
}
}
}
if (connectionPart instanceof BaseConnectionEditPart && connectionPart.getFigure() instanceof PolylineConnection) {
BaseConnectionEditPart baseConnectionPart = (BaseConnectionEditPart) connectionPart;
PolylineConnection connFigure = (PolylineConnection) connectionPart.getFigure();
org.eclipse.swt.graphics.Point avilableSize = entityManager.getGraphicalViewer().getControl().getSize();
if (ref != null) {
if (ref.y < 0) {
ref.y = 0;
baseConnectionPart.setSourceConcained(false);
if (baseConnectionPart.isDOTStyle()) {
connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
} else {
connFigure.setLineStyle(SWT.LINE_SOLID);
}
} else if (ref.y > avilableSize.y) {
ref.y = avilableSize.y;
baseConnectionPart.setSourceConcained(false);
if (baseConnectionPart.isDOTStyle()) {
connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
} else {
connFigure.setLineStyle(SWT.LINE_SOLID);
}
} else {
baseConnectionPart.setSourceConcained(true);
if (!baseConnectionPart.isDOTStyle()) {
connFigure.setLineStyle(SWT.LINE_SOLID);
}
}
}
}
return ref;
}
use of org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure in project tdi-studio-se by Talend.
the class TreeNodeEditPart method notifyChanged.
@Override
public void notifyChanged(Notification notification) {
int type = notification.getEventType();
int featureId = notification.getFeatureID(XmlmapPackage.class);
XmlmapTreeNodeFigure treeNodeFigure = (XmlmapTreeNodeFigure) getFigure();
switch(type) {
case Notification.SET:
switch(featureId) {
case XmlmapPackage.TREE_NODE__LOOP:
case XmlmapPackage.OUTPUT_TREE_NODE__GROUP:
case XmlmapPackage.OUTPUT_TREE_NODE__AGGREGATE:
case XmlmapPackage.TREE_NODE__OPTIONAL:
treeNodeFigure.getBranchContent().updateStatus();
break;
case XmlmapPackage.TREE_NODE__NAME:
treeNodeFigure.getBranchContent().updataNameFigure();
break;
case XmlmapPackage.TREE_NODE__DEFAULT_VALUE:
treeNodeFigure.getBranchContent().updateDefaultValueFigure();
break;
case XmlmapPackage.TREE_NODE__TYPE:
refreshChildren();
break;
case XmlmapPackage.TREE_NODE__EXPRESSION:
if (getModel() instanceof TreeNode && !(getModel() instanceof OutputTreeNode)) {
TreeNode inputTreeNodeRoot = XmlMapUtil.getTreeNodeRoot((TreeNode) getModel());
if (inputTreeNodeRoot != null && inputTreeNodeRoot.eContainer() instanceof InputXmlTree) {
InputXmlTree inputTree = (InputXmlTree) inputTreeNodeRoot.eContainer();
if (inputTree.isLookup()) {
if (((TreeNode) getModel()).getExpression() != null && !((TreeNode) getModel()).getExpression().trim().equals("")) {
if (MATCHING_MODE.ALL_ROWS.toString().equals(inputTree.getMatchingMode())) {
inputTree.setMatchingMode(MATCHING_MODE.UNIQUE_MATCH.toString());
}
} else {
boolean hasAtLeastOneHashKey = XmlMapUtil.hasAtLeastOneHashKey(inputTree);
if (!hasAtLeastOneHashKey) {
if (!MATCHING_MODE.ALL_ROWS.toString().equals(inputTree.getMatchingMode())) {
inputTree.setMatchingMode(MATCHING_MODE.ALL_ROWS.toString());
}
}
}
}
}
}
if (getFigure() instanceof TableTreeEntityFigure) {
XmlmapTreeNodeFigure outputFigure = (XmlmapTreeNodeFigure) getFigure();
outputFigure.updateExpression();
}
break;
case XmlmapPackage.INPUT_XML_TREE__MINIMIZED:
refreshSourceConnections();
refreshTargetConnections();
break;
case XmlmapPackage.ABSTRACT_IN_OUT_TREE__MULTI_LOOPS:
break;
}
break;
case Notification.ADD:
case Notification.ADD_MANY:
switch(featureId) {
case XmlmapPackage.TREE_NODE__CHILDREN:
refreshChildren();
boolean expressionEditable = XmlMapUtil.isExpressionEditable((TreeNode) getModel());
if (!expressionEditable) {
ExpressionFigure expression = treeNodeFigure.getExpressionFigure();
if (expression != null) {
expression.setOpaque(true);
expression.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_EXPREESION_DISABLE));
}
}
break;
case XmlmapPackage.TREE_NODE__OUTGOING_CONNECTIONS:
case XmlmapPackage.TREE_NODE__LOOKUP_OUTGOING_CONNECTIONS:
case XmlmapPackage.TREE_NODE__FILTER_OUT_GOING_CONNECTIONS:
refreshSourceConnections();
break;
case XmlmapPackage.OUTPUT_TREE_NODE__INCOMING_CONNECTIONS:
case XmlmapPackage.TREE_NODE__LOOKUP_INCOMING_CONNECTIONS:
refreshTargetConnections();
break;
}
break;
case Notification.REMOVE:
case Notification.REMOVE_MANY:
switch(featureId) {
case XmlmapPackage.TREE_NODE__CHILDREN:
refreshChildren();
ExpressionFigure expression = treeNodeFigure.getExpressionFigure();
if (expression != null) {
if (XmlMapUtil.isExpressionEditable((TreeNode) getModel())) {
expression.setOpaque(false);
}
}
case XmlmapPackage.TREE_NODE__OUTGOING_CONNECTIONS:
case XmlmapPackage.TREE_NODE__LOOKUP_OUTGOING_CONNECTIONS:
case XmlmapPackage.TREE_NODE__FILTER_OUT_GOING_CONNECTIONS:
refreshSourceConnections();
break;
case XmlmapPackage.OUTPUT_TREE_NODE__INCOMING_CONNECTIONS:
case XmlmapPackage.TREE_NODE__LOOKUP_INCOMING_CONNECTIONS:
refreshTargetConnections();
}
break;
}
}
Aggregations