Search in sources :

Example 1 with TableEntryProperties

use of org.talend.designer.dbmap.ui.visualmap.TableEntryProperties in project tdi-studio-se by Talend.

the class UIManager method getTableEntryPosition.

/**
     * DOC amaumont Comment method "getTableEntryPosition".
     * 
     * @param manager TODO
     * @param tableEntry
     * @param forceRecalculate TODO
     * @return
     */
public Point getTableEntryPosition(ITableEntry tableEntry, boolean forceRecalculate) {
    TableEntryProperties tableEntryProperties = mapperManager.getTableEntryProperties(tableEntry);
    Point returnedPoint = tableEntryProperties.position;
    if (forceRecalculate || returnedPoint == null) {
        TableItem tableItem = mapperManager.retrieveTableItem(tableEntry);
        DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(tableEntry);
        Rectangle tableViewBounds = dataMapTableView.getBounds();
        Table table = tableItem.getParent();
        // FIX for issue 1225 ("1" parameter added)
        Rectangle boundsTableItem = tableItem.getBounds(1);
        int x = 0;
        int y = boundsTableItem.y + table.getItemHeight() / 2 + dataMapTableView.getBorderWidth();
        if (y < 0) {
            y = 0;
        }
        Point point = new Point(x, y);
        Display display = dataMapTableView.getDisplay();
        Point pointFromTableViewOrigin = display.map(tableItem.getParent(), dataMapTableView, point);
        if (pointFromTableViewOrigin.y > tableViewBounds.height - TableEntriesManager.HEIGHT_REACTION) {
            pointFromTableViewOrigin.y = tableViewBounds.height - TableEntriesManager.HEIGHT_REACTION;
        }
        returnedPoint = convertPointToReferenceOrigin(getReferenceComposite(), pointFromTableViewOrigin, dataMapTableView);
        tableEntryProperties.position = returnedPoint;
    }
    return returnedPoint;
}
Also used : IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) AbstractInOutTable(org.talend.designer.dbmap.model.table.AbstractInOutTable) OutputTable(org.talend.designer.dbmap.model.table.OutputTable) InputTable(org.talend.designer.dbmap.model.table.InputTable) Table(org.eclipse.swt.widgets.Table) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) TableItem(org.eclipse.swt.widgets.TableItem) Rectangle(org.eclipse.swt.graphics.Rectangle) InputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView) OutputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView) DataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView) Point(org.eclipse.swt.graphics.Point) TableEntryProperties(org.talend.designer.dbmap.ui.visualmap.TableEntryProperties) Point(org.eclipse.swt.graphics.Point) Display(org.eclipse.swt.widgets.Display)

Example 2 with TableEntryProperties

use of org.talend.designer.dbmap.ui.visualmap.TableEntryProperties in project tdi-studio-se by Talend.

the class TableEntriesManager method getTableEntryProperties.

/**
     * DOC amaumont Comment method "getTableEntryProperties".
     * 
     * @param dataMapTableEntry
     * @return
     */
TableEntryProperties getTableEntryProperties(ITableEntry dataMapTableEntry) {
    TableEntryProperties tableEntryProperties = dataMapTableEntryToProperties.get(dataMapTableEntry);
    if (tableEntryProperties == null) {
        tableEntryProperties = new TableEntryProperties();
        dataMapTableEntryToProperties.put(dataMapTableEntry, tableEntryProperties);
    }
    return tableEntryProperties;
}
Also used : TableEntryProperties(org.talend.designer.dbmap.ui.visualmap.TableEntryProperties)

Aggregations

TableEntryProperties (org.talend.designer.dbmap.ui.visualmap.TableEntryProperties)2 Point (org.eclipse.swt.graphics.Point)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 Display (org.eclipse.swt.widgets.Display)1 Table (org.eclipse.swt.widgets.Table)1 TableItem (org.eclipse.swt.widgets.TableItem)1 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)1 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)1 AbstractInOutTable (org.talend.designer.dbmap.model.table.AbstractInOutTable)1 InputTable (org.talend.designer.dbmap.model.table.InputTable)1 OutputTable (org.talend.designer.dbmap.model.table.OutputTable)1 DataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView)1 InputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView)1 OutputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView)1