Search in sources :

Example 16 with AbstractInOutTable

use of org.talend.designer.mapper.model.table.AbstractInOutTable in project tdi-studio-se by Talend.

the class DataMapTableEntry method getPreviewValue.

public TraceData getPreviewValue() {
    if (getParent() instanceof AbstractInOutTable) {
        AbstractInOutTable abstractTable = (AbstractInOutTable) getParent();
        if (abstractTable.getConnection() != null) {
            IConnection connection = abstractTable.getConnection().getConnecion();
            if (connection != null) {
                Map<String, TraceData> traceData = connection.getTraceData();
                if (traceData != null) {
                    if (abstractTable instanceof OutputTable) {
                        OutputTable output = (OutputTable) abstractTable;
                        String key = null;
                        if (output.getIsJoinTableOf() != null) {
                            key = output.getIsJoinTableOf() + ":" + output.getName();
                        } else if (hasJoinedTable(output)) {
                            key = output.getName() + "[MAIN]";
                        } else {
                            // single output
                            key = output.getName();
                        }
                        return traceData.get(key);
                    } else {
                        return traceData.get(abstractTable.getName());
                    }
                }
            }
        }
    }
    return null;
}
Also used : AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) TraceData(org.talend.core.model.process.TraceData) IConnection(org.talend.core.model.process.IConnection) OutputTable(org.talend.designer.mapper.model.table.OutputTable)

Example 17 with AbstractInOutTable

use of org.talend.designer.mapper.model.table.AbstractInOutTable in project tdi-studio-se by Talend.

the class CompleteDropTargetStyledTextListener method drop.

// private void showInfos(DropTargetEvent event) {
// System.out.println(event);
// System.out.println("event.feedback=" + event.feedback);
// System.out.println("event.detail=" + event.detail);
// System.out.println("event.operations=" + event.operations);
//
// System.out.println("DND.DROP_DEFAULT=" + DND.DROP_DEFAULT);
// System.out.println("DND.DROP_COPY=" + DND.DROP_COPY);
// System.out.println("DND.DROP_MOVE=" + DND.DROP_MOVE);
// System.out.println("DND.DROP_LINK=" + DND.DROP_LINK);
// System.out.println("DND.DROP_TARGET_MOVE=" + DND.DROP_TARGET_MOVE);
// }
//
public void drop(DropTargetEvent event) {
    super.drop(event);
    UIManager uiManager = getUiManager();
    DraggedData draggedData = TableEntriesTransfer.getInstance().getDraggedData();
    DropContextAnalyzer analyzer = analyzeDropTarget(event, draggedData);
    // System.out.println("\n>>drop");
    // System.out.println(event);
    ILanguage currentLanguage = LanguageProvider.getCurrentLanguage();
    DataMapTableView dataMapTableViewTarget = getMapperManager().retrieveDataMapTableView(draggableTargetControl);
    uiManager.selectDataMapTableView(dataMapTableViewTarget, true, false);
    List<TransferableEntry> transferableEntryList = draggedData.getTransferableEntryList();
    ITableEntry currentEntryTarget = ((AbstractInOutTable) dataMapTableViewTarget.getDataMapTable()).getExpressionFilter();
    boolean overwrite = false;
    if (analyzer.isOverwriteExpression()) {
        //$NON-NLS-1$
        currentEntryTarget.setExpression("");
    }
    for (TransferableEntry transferableEntry : transferableEntryList) {
        ITableEntry tableEntrySource = transferableEntry.getTableEntrySource();
        Zone zoneSourceEntry = (Zone) transferableEntry.getZoneSourceEntry();
        modifyExistingExpression(currentLanguage, currentEntryTarget, tableEntrySource, overwrite, zoneSourceEntry);
    }
    // for TransferableEntry transferableEntry : transferableEntryList
    uiManager.parseExpression(currentEntryTarget.getExpression(), currentEntryTarget, false, true, true);
    ControlUtils.setText(draggableTargetControl, currentEntryTarget.getExpression());
    uiManager.refreshBackground(true, false);
    uiManager.unselectAllInputMetaDataEntries();
    // uiManager.parseAllExpressionsForAllTables();
    getMapperManager().getProblemsManager().checkProblemsForTableEntry(currentEntryTarget, true);
    uiManager.selectLinks(dataMapTableViewTarget, Arrays.<ITableEntry>asList(currentEntryTarget), true, false);
    uiManager.setDragging(false);
}
Also used : ILanguage(org.talend.designer.mapper.language.ILanguage) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) Zone(org.talend.designer.mapper.ui.visualmap.zone.Zone) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) UIManager(org.talend.designer.mapper.managers.UIManager) DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) DraggedData(org.talend.designer.abstractmap.ui.dnd.DraggedData) TransferableEntry(org.talend.designer.abstractmap.ui.dnd.TransferableEntry)

Aggregations

AbstractInOutTable (org.talend.designer.mapper.model.table.AbstractInOutTable)17 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)9 OutputTable (org.talend.designer.mapper.model.table.OutputTable)8 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)6 TableViewer (org.eclipse.jface.viewers.TableViewer)5 Table (org.eclipse.swt.widgets.Table)5 DataMapTableView (org.talend.designer.mapper.ui.visualmap.table.DataMapTableView)5 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)4 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)4 FocusEvent (org.eclipse.swt.events.FocusEvent)4 FocusListener (org.eclipse.swt.events.FocusListener)4 GridData (org.eclipse.swt.layout.GridData)4 AbstractExtendedTableViewer (org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer)4 InputTable (org.talend.designer.mapper.model.table.InputTable)4 GlobalMapEntry (org.talend.designer.mapper.model.tableentry.GlobalMapEntry)4 Point (org.eclipse.swt.graphics.Point)3 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)3 AbstractMetadataTableEditorView (org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView)3 MetadataTableEditorView (org.talend.core.ui.metadata.editor.MetadataTableEditorView)3 ExpressionFilterEntry (org.talend.designer.mapper.model.tableentry.ExpressionFilterEntry)3