Search in sources :

Example 1 with TableEntityPart

use of org.talend.designer.gefabstractmap.part.TableEntityPart in project tdi-studio-se by Talend.

the class RowSelectionEditPolicy method getLocatorFigure.

private IFigure getLocatorFigure(GraphicalEditPart owner) {
    IFigure figure = owner.getFigure();
    if (owner instanceof TableEntityPart) {
        TableEntityFigure treeNodeFigure = (TableEntityFigure) figure;
        // table figure to restrict the width
        MapperTablePart abstractInOutTreePart = MapperUtils.getMapperTablePart((TableEntityPart) owner);
        IFigure parentFigure = ((GraphicalEditPart) abstractInOutTreePart).getFigure();
        Rectangle treeBounds = parentFigure.getBounds();
        Rectangle rowBounds = treeNodeFigure.getElement().getBounds();
        Rectangle treeNodeBounds = figure.getBounds();
        figure = new Figure();
        if (treeBounds.x + 1 != treeNodeBounds.x || treeNodeBounds.width > treeBounds.width) {
            figure.setBounds(new Rectangle(treeBounds.x + 1, treeNodeBounds.y, treeBounds.width - 2, rowBounds.height));
            return figure;
        } else {
            figure.setBounds(owner.getFigure().getBounds().getCopy());
            figure.getBounds().height = rowBounds.height;
            return figure;
        }
    } else if (figure instanceof VarEntityFigure) {
        Rectangle copy = figure.getBounds().getCopy();
        figure = new Figure();
        figure.setBounds(copy);
        return figure;
    }
    return owner.getFigure();
}
Also used : VarEntityFigure(org.talend.designer.gefabstractmap.figures.var.VarEntityFigure) TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) Rectangle(org.eclipse.draw2d.geometry.Rectangle) MapperTablePart(org.talend.designer.gefabstractmap.part.MapperTablePart) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IFigure(org.eclipse.draw2d.IFigure) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) IFigure(org.eclipse.draw2d.IFigure) VarEntityFigure(org.talend.designer.gefabstractmap.figures.var.VarEntityFigure) Figure(org.eclipse.draw2d.Figure)

Example 2 with TableEntityPart

use of org.talend.designer.gefabstractmap.part.TableEntityPart in project tdi-studio-se by Talend.

the class TreeExpandSupportEditPolicy method activate.

@Override
public void activate() {
    super.activate();
    TableEntityPart host = (TableEntityPart) getHost();
    if (host.getFigure() instanceof TableEntityFigure) {
        TableTreeEntityFigure treeNodeFigure = (TableTreeEntityFigure) host.getFigure();
        if (treeNodeFigure.getTreeBranch() != null) {
            ExpandCollapseFigure ecFigure = treeNodeFigure.getTreeBranch().getExpandCollapseFigure();
            if (ecFigure != null) {
                ecFigure.addMouseListener(l);
            }
        }
    }
}
Also used : TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) ExpandCollapseFigure(org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure)

Example 3 with TableEntityPart

use of org.talend.designer.gefabstractmap.part.TableEntityPart in project tdi-studio-se by Talend.

the class TreeExpandSupportEditPolicy method deactivate.

@Override
public void deactivate() {
    TableEntityPart host = (TableEntityPart) getHost();
    if (host.getFigure() instanceof TableTreeEntityFigure) {
        TableTreeEntityFigure treeNodeFigure = (TableTreeEntityFigure) host.getFigure();
        if (treeNodeFigure.getTreeBranch() != null) {
            ExpandCollapseFigure ecFigure = treeNodeFigure.getTreeBranch().getExpandCollapseFigure();
            if (ecFigure != null) {
                ecFigure.removeMouseListener(l);
            }
        }
    }
    super.deactivate();
}
Also used : TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) ExpandCollapseFigure(org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure)

Example 4 with TableEntityPart

use of org.talend.designer.gefabstractmap.part.TableEntityPart in project tdi-studio-se by Talend.

the class MapperSelectEditPartTracker method getShiftAffactedEditPart.

private void getShiftAffactedEditPart(List toSelect, List deSelect) {
    if (lastSelectedShiftPart == null || lastSelectedShiftPart == getSourceEditPart()) {
        toSelect.add(getSourceEditPart());
        return;
    }
    List<TableEntityPart> partList = new ArrayList<TableEntityPart>();
    if (lastSelectedShiftPart instanceof TableEntityPart) {
        MapperTablePart treePart = MapperUtils.getMapperTablePart((TableEntityPart) lastSelectedShiftPart);
        if (treePart != null) {
            partList = MapperUtils.getFlatChildrenPartList(treePart);
        }
    }
    int index = partList.indexOf(lastSelectedShiftPart);
    int index2 = partList.indexOf(getSourceEditPart());
    if (index2 != -1) {
        for (int i = Math.min(index, index2); i < Math.max(index, index2) + 1; i++) {
            if (!toSelect.contains(partList.get(i))) {
                toSelect.add(partList.get(i));
            }
        }
        List selectedEditParts = getCurrentViewer().getSelectedEditParts();
        for (int i = 0; i < selectedEditParts.size(); i++) {
            if (partList.contains(selectedEditParts.get(i)) && !toSelect.contains(selectedEditParts.get(i))) {
                deSelect.add(selectedEditParts.get(i));
            }
        }
    }
}
Also used : TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) MapperTablePart(org.talend.designer.gefabstractmap.part.MapperTablePart)

Example 5 with TableEntityPart

use of org.talend.designer.gefabstractmap.part.TableEntityPart in project tdi-studio-se by Talend.

the class MapperSelectEditPartTracker method performSelection.

@Override
protected void performSelection() {
    if (hasSelectionOccurred()) {
        return;
    }
    setFlag(FLAG_SELECTION_PERFORMED, true);
    EditPartViewer viewer = getCurrentViewer();
    List selectedObjects = viewer.getSelectedEditParts();
    if (getCurrentInput().isModKeyDown(SWT.MOD1)) {
        lastSelectedShiftPart = null;
        if (selectedObjects.contains(getSourceEditPart())) {
            viewer.deselect(getSourceEditPart());
        } else if (canAppend()) {
            viewer.appendSelection(getSourceEditPart());
        } else {
            viewer.select(getSourceEditPart());
        }
    } else if (getCurrentInput().isShiftKeyDown()) {
        if (lastSelectedShiftPart == null) {
            if (!selectedObjects.isEmpty()) {
                Object object = selectedObjects.get(selectedObjects.size() - 1);
                if (object instanceof TableEntityPart) {
                    lastSelectedShiftPart = (EditPart) object;
                }
            } else {
                lastSelectedShiftPart = getSourceEditPart();
            }
        }
        if (canAppend()) {
            List<EditPart> toselect = new ArrayList<EditPart>();
            List<EditPart> deSelect = new ArrayList<EditPart>();
            getShiftAffactedEditPart(toselect, deSelect);
            for (EditPart part : deSelect) {
                viewer.deselect(part);
            }
            for (EditPart part : toselect) {
                if (!viewer.getSelectedEditParts().contains(part)) {
                    viewer.appendSelection(part);
                }
            }
        } else {
            viewer.select(getSourceEditPart());
        }
    } else {
        lastSelectedShiftPart = null;
        viewer.select(getSourceEditPart());
    }
}
Also used : TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) EditPart(org.eclipse.gef.EditPart) EditPartViewer(org.eclipse.gef.EditPartViewer) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

TableEntityPart (org.talend.designer.gefabstractmap.part.TableEntityPart)15 List (java.util.List)8 ArrayList (java.util.ArrayList)7 MapperTablePart (org.talend.designer.gefabstractmap.part.MapperTablePart)7 EditPart (org.eclipse.gef.EditPart)5 IFigure (org.eclipse.draw2d.IFigure)3 TransferedObject (org.talend.designer.gefabstractmap.dnd.TransferedObject)3 TableEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure)3 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)3 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)3 OutputTreeNodeEditPart (org.talend.designer.xmlmap.parts.OutputTreeNodeEditPart)3 HashMap (java.util.HashMap)2 Figure (org.eclipse.draw2d.Figure)2 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)2 ExpandCollapseFigure (org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure)2 TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)2 VarEntityFigure (org.talend.designer.gefabstractmap.figures.var.VarEntityFigure)2 InputTablePart (org.talend.designer.gefabstractmap.part.InputTablePart)2 OutputTablePart (org.talend.designer.gefabstractmap.part.OutputTablePart)2 AbstractNode (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractNode)2