use of org.talend.designer.gefabstractmap.part.MapperTablePart in project tdi-studio-se by Talend.
the class MapperGraphicalViewer method primDeselectAll.
/*
* if partToAppend is inputTree , don't clean all outputTree in selection list , leave the first one by default . if
* partToAppend is outputTree , do the same for inputTree selections
*/
private void primDeselectAll(EditPart eidtPart) {
EditPart partToAppend = eidtPart;
List list = primGetSelectedEditParts();
if (partToAppend instanceof TableEntityPart) {
partToAppend = MapperUtils.getMapperTablePart((TableEntityPart) partToAppend);
}
EditPart part;
MapperTablePart abstractTreePart = null;
for (int i = 0; i < list.size(); i++) {
part = (EditPart) list.get(i);
if (partToAppend instanceof InputTablePart) {
if (abstractTreePart == null && part instanceof OutputTablePart) {
abstractTreePart = (MapperTablePart) part;
continue;
}
} else if (partToAppend instanceof OutputTablePart) {
if (abstractTreePart == null && part instanceof InputTablePart) {
abstractTreePart = (MapperTablePart) part;
continue;
}
}
part.setSelected(EditPart.SELECTED_NONE);
}
list.clear();
if (abstractTreePart != null) {
list.add(abstractTreePart);
}
}
use of org.talend.designer.gefabstractmap.part.MapperTablePart in project tdi-studio-se by Talend.
the class MapperSelectEditPartTracker method canAppend.
private boolean canAppend() {
if (getSourceEditPart() instanceof TableEntityPart) {
EditPart lastPart = lastSelectedShiftPart;
List selectedEditParts = getCurrentViewer().getSelectedEditParts();
if (lastPart == null && !selectedEditParts.isEmpty()) {
lastPart = (EditPart) selectedEditParts.get(selectedEditParts.size() - 1);
}
if (lastPart == null) {
return true;
} else if (lastPart instanceof TableEntityPart) {
MapperTablePart lastContaier = MapperUtils.getMapperTablePart((TableEntityPart) lastPart);
MapperTablePart toAppendContaier = MapperUtils.getMapperTablePart((TableEntityPart) getSourceEditPart());
if (lastContaier == toAppendContaier) {
return true;
}
}
}
lastSelectedShiftPart = null;
return false;
}
use of org.talend.designer.gefabstractmap.part.MapperTablePart 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.part.MapperTablePart 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.part.MapperTablePart in project tdi-studio-se by Talend.
the class XmlDragSourceListener method getTemplate.
/**
*
* DOC talend Comment method "getTemplate".
*
* @param event
* @return the validate drag able node list
*/
@Override
protected Object getTemplate(DragSourceEvent event) {
final RootEditPart rootEditPart = getViewer().getRootEditPart();
if (rootEditPart instanceof AbstractGraphicalEditPart) {
AbstractGraphicalEditPart graphicPart = (AbstractGraphicalEditPart) rootEditPart;
final IFigure figure = graphicPart.getFigure();
final IFigure findFigureAt = figure.findFigureAt(new Point(event.x, event.y));
if (findFigureAt instanceof ISash) {
return findFigureAt;
}
}
List<EditPart> filtedSelection = new ArrayList<EditPart>();
for (Object part : getViewer().getSelectedEditParts()) {
if (part instanceof TreeNodeEditPart || part instanceof VarNodeEditPart) {
filtedSelection.add((EditPart) part);
}
}
if (filtedSelection == null || filtedSelection.isEmpty()) {
return null;
}
List toTransfer = new ArrayList();
TransferdType type = null;
List<TableEntityPart> partList = new ArrayList<TableEntityPart>();
EditPart lastSelection = filtedSelection.get(filtedSelection.size() - 1);
if (lastSelection instanceof TreeNodeEditPart && !(lastSelection instanceof OutputTreeNodeEditPart)) {
type = TransferdType.INPUT;
} else if (lastSelection instanceof VarNodeEditPart) {
type = TransferdType.VAR;
}
if (type != null) {
if (filtedSelection.size() > 1) {
partList.addAll(lastSelection.getParent().getChildren());
Map<EditPart, Integer> partAndIndex = new HashMap<EditPart, Integer>();
if (type == TransferdType.INPUT) {
for (EditPart treePart : filtedSelection) {
if (!XmlMapUtil.isDragable((TreeNode) treePart.getModel())) {
return null;
}
}
MapperTablePart abstractInOutTreePart = MapperUtils.getMapperTablePart((TableEntityPart) lastSelection);
if (abstractInOutTreePart != null) {
partList = MapperUtils.getFlatChildrenPartList(abstractInOutTreePart);
}
} else {
partList.addAll(lastSelection.getParent().getChildren());
}
for (EditPart selected : filtedSelection) {
int indexOf = partList.indexOf(selected);
if (indexOf != -1) {
partAndIndex.put(selected, indexOf);
int index = 0;
for (int i = 0; i < toTransfer.size(); i++) {
if (indexOf > partAndIndex.get(toTransfer.get(i))) {
index = i + 1;
}
}
toTransfer.add(index, selected);
}
}
} else {
if (lastSelection.getModel() instanceof TreeNode && !XmlMapUtil.isDragable((TreeNode) lastSelection.getModel())) {
return null;
}
toTransfer.add(lastSelection);
}
return new TransferedObject(toTransfer, type);
}
return null;
}
Aggregations