use of org.talend.core.model.process.TraceData in project tdi-studio-se by Talend.
the class OutputDataMapTableView method initColumnsOfTableColumns.
@Override
public void initColumnsOfTableColumns(final TableViewerCreator tableViewerCreatorForColumns) {
IOConnection connection = ((OutputTable) getDataMapTable()).getConnection();
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
//$NON-NLS-1$
column.setTitle(Messages.getString("OutputDataMapTableView.columnTitle.expression"));
column.setId(DataMapTableView.ID_EXPRESSION_COLUMN);
expressionCellEditor = createExpressionCellEditor(tableViewerCreatorForColumns, column, new Zone[] { Zone.INPUTS, Zone.VARS }, false);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<OutputColumnTableEntry, String>() {
public String get(OutputColumnTableEntry bean) {
return bean.getExpression();
}
public void set(OutputColumnTableEntry bean, String value) {
bean.setExpression(value);
mapperManager.getProblemsManager().checkProblemsForTableEntry(bean, true);
tableViewerCreatorForColumns.getTableViewer().refresh(bean);
}
});
column.setModifiable(!mapperManager.componentIsReadOnly());
//$NON-NLS-1$
column.setDefaultInternalValue("");
column.setWeight(COLUMN_EXPRESSION_SIZE_WEIGHT);
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
column.setTitle(DataMapTableView.COLUMN_NAME);
column.setId(DataMapTableView.ID_NAME_COLUMN);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<OutputColumnTableEntry, String>() {
public String get(OutputColumnTableEntry bean) {
return bean.getMetadataColumn().getLabel();
}
public void set(OutputColumnTableEntry bean, String value) {
bean.getMetadataColumn().setLabel(value);
}
});
column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
if (PluginChecker.isTraceDebugPluginLoaded() && mapperManager.isTracesActive() && connection != null) {
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
column.setTitle("Preview");
column.setId(DataMapTableView.PREVIEW_COLUMN);
column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<OutputColumnTableEntry, String>() {
public String get(OutputColumnTableEntry bean) {
IMetadataColumn metadataColumn = bean.getMetadataColumn();
if (metadataColumn != null) {
String label = metadataColumn.getLabel();
TraceData preview = bean.getPreviewValue();
if (preview != null && preview.getData() != null) {
return preview.getData().get(label);
}
}
return "";
}
public void set(OutputColumnTableEntry bean, String value) {
// do nothing
}
});
}
configureCellModifier(tableViewerCreatorForColumns);
}
use of org.talend.core.model.process.TraceData in project tdi-studio-se by Talend.
the class InputDataMapTableView method initColumnsOfTableColumns.
@Override
public void initColumnsOfTableColumns(final TableViewerCreator tableViewerCreatorForColumns) {
boolean isMainConnection = ((InputTable) getDataMapTable()).isMainConnection();
TableViewerCreatorColumn column = null;
if (!isMainConnection) {
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
//$NON-NLS-1$
column.setTitle(Messages.getString("InputDataMapTableView.columnTitle.Expr"));
column.setId(DataMapTableView.ID_EXPRESSION_COLUMN);
expressionCellEditor = createExpressionCellEditor(tableViewerCreatorForColumns, column, new Zone[] { Zone.INPUTS }, false);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<InputColumnTableEntry, String>() {
public String get(InputColumnTableEntry bean) {
return bean.getExpression();
}
public void set(InputColumnTableEntry bean, String value) {
// System.out.println("value='" + value + "'");
bean.setExpression(value);
InputTable inputTable = getInputTable();
boolean tableHasAtLeastOneHashKey = mapperManager.isTableHasAtLeastOneHashKey(inputTable);
if (!tableHasAtLeastOneHashKey) {
IUIMatchingMode matchingMode = inputTable.getMatchingMode();
if (matchingMode != TMAP_MATCHING_MODE.ALL_ROWS) {
inputTable.setMatchingMode(TMAP_MATCHING_MODE.ALL_ROWS);
refreshCondensedImage(inputTable, MATCH_MODEL_SETTING);
}
} else {
IUIMatchingMode matchingMode = inputTable.getMatchingMode();
if (matchingMode == TMAP_MATCHING_MODE.ALL_ROWS) {
IUIMatchingMode newMatchModel = previousMatchingModeSelected == null || previousMatchingModeSelected == TMAP_MATCHING_MODE.ALL_ROWS ? TMAP_MATCHING_MODE.UNIQUE_MATCH : previousMatchingModeSelected;
inputTable.setMatchingMode(newMatchModel);
refreshCondensedImage(inputTable, MATCH_MODEL_SETTING);
}
mapperManager.getUiManager().setStatusBarValues(STATUS.EMPTY, null);
}
mapperManager.getProblemsManager().checkProblemsForTableEntry(bean, true, true);
if (!mapperManager.isCheckSyntaxEnabled()) {
mapperManager.getUiManager().applyActivatedCellEditors(tableViewerCreatorForColumns);
Display.getDefault().asyncExec(new Runnable() {
public void run() {
mapperManager.getProblemsManager().checkLookupExpressionProblem();
}
});
}
}
});
column.setModifiable(!mapperManager.componentIsReadOnly());
//$NON-NLS-1$
column.setDefaultInternalValue("");
column.setWeight(COLUMN_EXPRESSION_SIZE_WEIGHT);
column.setImageProvider(new IColumnImageProvider<InputColumnTableEntry>() {
public Image getImage(InputColumnTableEntry bean) {
if (bean.getExpression() != null && !bean.getExpression().trim().equals("")) {
//$NON-NLS-1$
if (mapperManager.isAdvancedMap()) {
return ImageProviderMapper.getImage(ImageInfo.LOOKUP_KEY_ICON);
} else {
return null;
}
} else {
return null;
}
}
});
}
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
column.setTitle(DataMapTableView.COLUMN_NAME);
column.setId(DataMapTableView.ID_NAME_COLUMN);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<InputColumnTableEntry, String>() {
public String get(InputColumnTableEntry bean) {
return bean.getMetadataColumn().getLabel();
}
public void set(InputColumnTableEntry bean, String value) {
bean.getMetadataColumn().setLabel(value);
}
});
column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
if (isMainConnection && PluginChecker.isTraceDebugPluginLoaded() && mapperManager.isTracesActive()) {
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
column.setTitle("Preview");
column.setId(DataMapTableView.PREVIEW_COLUMN);
column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<InputColumnTableEntry, String>() {
public String get(InputColumnTableEntry bean) {
IMetadataColumn metadataColumn = bean.getMetadataColumn();
if (metadataColumn != null) {
String label = metadataColumn.getLabel();
TraceData preview = bean.getPreviewValue();
if (preview != null && preview.getData() != null) {
return preview.getData().get(label);
}
}
return "";
}
public void set(InputColumnTableEntry bean, String value) {
// do nothing
}
});
}
}
use of org.talend.core.model.process.TraceData 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;
}
use of org.talend.core.model.process.TraceData in project tdi-studio-se by Talend.
the class ConnectionTraceEditPart method refreshVisuals.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
@Override
protected void refreshVisuals() {
ConnectionPart connectionPart;
connectionPart = (ConnectionPart) getParent();
Connection conn = (Connection) connectionPart.getModel();
IElementParameter element = conn.getElementParameter(EParameterName.TRACES_CONNECTION_ENABLE.getName());
Boolean flag = false;
if (element != null) {
flag = (Boolean) element.getValue();
}
ConnectionTraceFigure htmlFigure = (ConnectionTraceFigure) getFigure();
ConnectionTrace connectionTrace = (ConnectionTrace) getModel();
TraceData trace = connectionTrace.getTrace();
if (trace == null) {
Point offset = conn.getConnectionLabel().getOffset();
connectionTrace.getOffset().x = offset.x;
connectionTrace.getOffset().y = offset.y;
this.removeEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE);
} else {
this.installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new ConnTextMovePolicy());
}
htmlFigure.setTraceData(trace, flag, conn.checkTraceShowEnable());
Dimension size = htmlFigure.getPreferredSize();
connectionTrace.setSize(size);
String connectionName = ((Connection) connectionPart.getModel()).getConnectionLabel().getLabelText();
Point offset = ((ConnectionTrace) getModel()).getOffset();
ConnectionTraceConstraint constraint = new //$NON-NLS-1$
ConnectionTraceConstraint(//$NON-NLS-1$
connectionName, //$NON-NLS-1$
size, //$NON-NLS-1$
"center", //$NON-NLS-1$
offset, (PolylineConnection) connectionPart.getFigure());
connectionPart.setLayoutConstraint(this, getFigure(), constraint);
}
use of org.talend.core.model.process.TraceData in project tdi-studio-se by Talend.
the class ConnectionTest method testSetTraceData.
@Test
public void testSetTraceData() {
Map<String, TraceData> map = new HashMap<String, TraceData>();
TraceData data = new TraceData();
map.put("key", data);
connection.setTraceData(map);
TraceData value = connection.getTraceData().get("key");
assertEquals(data, value);
connection.setTraceData(null);
assertNull(connection.getTraceData());
}
Aggregations