use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class SearchZoneMapper method hightlightAll.
public void hightlightAll(Map<Integer, Map<Integer, ITableEntry>> searchMaps, boolean isHightlight) {
Iterator iter = searchMaps.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Map<Integer, ITableEntry> map = (Map<Integer, ITableEntry>) entry.getValue();
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry e = (Map.Entry) it.next();
if (isHightlight) {
setEntryState(mapperManager, EntryState.HIGHLIGHTALL, (ITableEntry) e.getValue());
} else {
setEntryState(mapperManager, EntryState.NONE, (ITableEntry) e.getValue());
}
}
}
}
use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class VarsDataMapTableView method initColumnsOfTableColumns.
@Override
public void initColumnsOfTableColumns(final TableViewerCreator tableViewerCreatorForColumns) {
ECodeLanguage codeLanguage = LanguageProvider.getCurrentLanguage().getCodeLanguage();
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
//$NON-NLS-1$
column.setTitle(Messages.getString("VarsDataMapTableView.columnTitle.expression"));
column.setId(DataMapTableView.ID_EXPRESSION_COLUMN);
expressionCellEditor = createExpressionCellEditor(tableViewerCreatorForColumns, column, new Zone[] { Zone.INPUTS, Zone.VARS }, false);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<VarTableEntry, String>() {
public String get(VarTableEntry bean) {
return bean.getExpression();
}
public void set(VarTableEntry bean, String value) {
bean.setExpression(value);
mapperManager.getProblemsManager().checkProblemsForTableEntry(bean, true);
}
});
column.setModifiable(!mapperManager.componentIsReadOnly());
//$NON-NLS-1$
column.setDefaultInternalValue("");
if (codeLanguage == ECodeLanguage.JAVA) {
column.setWeight(40);
} else {
column.setWeight(COLUMN_EXPRESSION_SIZE_WEIGHT);
}
if (codeLanguage == ECodeLanguage.JAVA) {
String[] arrayTalendTypes = new String[0];
try {
arrayTalendTypes = MetadataTalendType.getTalendTypesLabels();
arrayTalendTypes = this.talendTypeFilter.filter(arrayTalendTypes);
} catch (NoClassDefFoundError e) {
// shouln't be happend
// e.printStackTrace();
ExceptionHandler.process(e);
} catch (ExceptionInInitializerError e) {
// shouln't be happend
// e.printStackTrace();
ExceptionHandler.process(e);
}
IBeanPropertyAccessors<VarTableEntry, Boolean> nullableAccessors = new IBeanPropertyAccessors<VarTableEntry, Boolean>() {
public Boolean get(VarTableEntry bean) {
return bean.isNullable() ? Boolean.TRUE : Boolean.FALSE;
}
public void set(VarTableEntry bean, Boolean value) {
bean.setNullable(value.booleanValue());
}
};
CellEditorValueAdapter comboValueAdapter = new JavaTypeComboValueAdapter(JavaTypesManager.getDefaultJavaType(), nullableAccessors, this.talendTypeFilter);
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
//$NON-NLS-1$
column.setTitle(Messages.getString("VarsDataMapTableView.columnTitle.type"));
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<VarTableEntry, String>() {
public String get(VarTableEntry bean) {
return bean.getType();
}
public void set(VarTableEntry bean, String value) {
bean.setType(value);
mapperManager.getProblemsManager().checkProblemsForAllEntriesOfAllTables(true);
}
});
column.setModifiable(!mapperManager.componentIsReadOnly());
column.setWeight(18);
column.setCellEditor(new ComboBoxCellEditor(tableViewerCreatorForColumns.getTable(), arrayTalendTypes), comboValueAdapter);
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
//$NON-NLS-1$
column.setTitle("Nullable");
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<VarTableEntry, Boolean>() {
public Boolean get(VarTableEntry bean) {
return bean.isNullable();
}
public void set(VarTableEntry bean, Boolean value) {
bean.setNullable(value);
mapperManager.getProblemsManager().checkProblemsForAllEntriesOfAllTables(true);
}
});
column.setModifiable(!mapperManager.componentIsReadOnly());
column.setWidth(WindowSystem.isWIN32() ? 12 : 20);
//$NON-NLS-1$
column.setDisplayedValue("");
column.setResizable(false);
CheckboxTableEditorContent checkboxTableEditorContent = new CheckboxTableEditorContent();
//$NON-NLS-1$
String nullable = Messages.getString("VarsDataMapTableView.nullable");
checkboxTableEditorContent.setToolTipText(nullable);
column.setTableEditorContent(checkboxTableEditorContent);
column.setToolTipHeader(nullable);
}
column = new TableViewerCreatorColumn(tableViewerCreatorForColumns);
//$NON-NLS-1$
column.setTitle(Messages.getString("VarsDataMapTableView.columnTitle.variable"));
column.setId(DataMapTableView.ID_NAME_COLUMN);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<VarTableEntry, String>() {
public String get(VarTableEntry bean) {
return bean.getName();
}
public void set(VarTableEntry bean, String value) {
bean.setName(value);
}
});
column.setModifiable(!mapperManager.componentIsReadOnly());
if (codeLanguage == ECodeLanguage.JAVA) {
column.setWeight(25);
} else {
column.setWeight(COLUMN_NAME_SIZE_WEIGHT);
}
final TextCellEditor cellEditor = new TextCellEditor(tableViewerCreatorForColumns.getTable());
cellEditor.addListener(new DialogErrorForCellEditorListener(cellEditor, column) {
@Override
public void newValidValueTyped(int itemIndex, Object previousValue, Object newValue, CELL_EDITOR_STATE state) {
if (state == CELL_EDITOR_STATE.APPLYING) {
ModifiedObjectInfo modifiedObjectInfo = tableViewerCreatorForColumns.getModifiedObjectInfo();
String originalValue = (String) modifiedObjectInfo.getOriginalPropertyBeanValue();
Object currentModifiedBean = modifiedObjectInfo.getCurrentModifiedBean();
mapperManager.getUiManager().processColumnNameChanged(originalValue.toString(), newValue.toString(), VarsDataMapTableView.this, (ITableEntry) currentModifiedBean);
}
}
@Override
public String validateValue(String newValue, int beanPosition) {
return ((VarsTable) getDataMapTable()).validateColumnName(newValue, beanPosition);
}
});
column.setCellEditor(cellEditor);
}
use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class InputDataMapTableView method checkValidName.
/**
* Check if the given name will be unique in the process. If already exists with that name, false will be returned.
*
* @param uniqueName
* @return true if the name is unique
*/
public boolean checkValidName(String name) {
for (ITableEntry entry : getInputTable().getGlobalMapEntries()) {
if (TalendQuoteUtils.removeQuotesIfExist(entry.getName()).equals(name)) {
return false;
}
}
Perl5Matcher matcher = new Perl5Matcher();
Perl5Compiler compiler = new Perl5Compiler();
Pattern pattern;
try {
//$NON-NLS-1$
pattern = compiler.compile("^[A-Za-z_][A-Za-z0-9_]*$");
if (!matcher.matches(name, pattern)) {
return false;
}
} catch (MalformedPatternException e) {
throw new RuntimeException(e);
}
return true;
}
use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class StyleLinkFactory method getStyleLink.
// public static DrawableLinkFactory getInstance() {
// if (instance == null) {
// instance = new DrawableLinkFactory();
// }
// return instance;
// }
//
// public IDrawableLink getDrawableLink(IMapperLink link) {
// IDrawableLink drawableLink = null;
// PointLinkDescriptor pointLinkDescriptorSource = link.getPointLinkDescriptorSource();
// PointLinkDescriptor pointLinkDescriptorTarget = link.getPointLinkDescriptorTarget();
// if (pointLinkDescriptorSource.getZone() != pointLinkDescriptorTarget.getZone()) {
// drawableLink = new HorizontalBezierLink();
// } else if (pointLinkDescriptorSource.getZone() == pointLinkDescriptorTarget.getZone()) {
// drawableLink = new VerticalRoundedCornerLink();
// }
// return drawableLink;
// }
//
public IStyleLink getStyleLink(IMapperLink link) {
ILinkState linkState = link.getState();
PointLinkDescriptor pointLinkDescriptorSource = link.getPointLinkDescriptor1();
PointLinkDescriptor pointLinkDescriptorTarget = link.getPointLinkDescriptor2();
ITableEntry targetTableEntry = pointLinkDescriptorTarget.getTableEntry();
boolean targetIsConstraint = false;
if (targetTableEntry instanceof FilterTableEntry || targetTableEntry instanceof ExpressionFilterEntry) {
targetIsConstraint = true;
}
boolean targetIsGlobalMap = false;
if (targetTableEntry instanceof GlobalMapEntry) {
targetIsGlobalMap = true;
}
IStyleLink style = null;
if (pointLinkDescriptorSource.getZone() != pointLinkDescriptorTarget.getZone()) {
if (linkState == LinkState.SELECTED) {
if (targetIsConstraint) {
style = selectedZoneToZoneFilterStyle;
} else {
style = selectedZoneToZoneStyle;
}
} else if (linkState == LinkState.UNSELECTED) {
if (targetIsConstraint) {
style = unselectedZoneToZoneFilterStyle;
} else {
style = unselectedZoneToZoneStyle;
}
}
} else if (pointLinkDescriptorSource.getZone() == Zone.INPUTS && pointLinkDescriptorSource.getZone() == pointLinkDescriptorTarget.getZone()) {
if (linkState == LinkState.SELECTED) {
if (pointLinkDescriptorTarget.getTableEntry() instanceof ExpressionFilterEntry) {
style = selectedSameZoneFilterStyle;
} else if (pointLinkDescriptorTarget.getTableEntry() instanceof GlobalMapEntry) {
style = selectedSameZoneGlobalMapStyle;
} else {
style = selectedSameInputZoneStyle;
}
} else if (linkState == LinkState.UNSELECTED) {
if (pointLinkDescriptorTarget.getTableEntry() instanceof ExpressionFilterEntry) {
style = unselectedSameZoneFilterStyle;
} else if (pointLinkDescriptorTarget.getTableEntry() instanceof GlobalMapEntry) {
style = unselectedSameZoneGlobalMapStyle;
} else {
style = unselectedSameInputZoneStyle;
}
}
} else if (pointLinkDescriptorSource.getZone() == Zone.VARS && pointLinkDescriptorSource.getZone() == pointLinkDescriptorTarget.getZone()) {
if (linkState == LinkState.SELECTED) {
style = selectedSameVarsZoneStyle;
} else if (linkState == LinkState.UNSELECTED) {
style = unselectedSameVarsZoneStyle;
}
}
return style;
}
use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class CompleteDropTargetListener method updateExpressionsOfInsertedEntries.
/**
* DOC amaumont Comment method "updateExpressionsOfInsertedEntries".
*
* @param uiManager
* @param currentLanguage
* @param metadataEditorView
* @param currentIndex
* @param sourceEntriesOfEntriesBeingAdded
* @param targetTableIsConstraintsTable
* @param tableViewerCreatorTarget
* @param metadataColumnsBeingAdded
* @param metadataEditorEvent
*/
@SuppressWarnings("unchecked")
private void updateExpressionsOfInsertedEntries(IDbLanguage currentLanguage, MetadataTableEditorView metadataEditorView, int currentIndex, ArrayList<ITableEntry> sourceEntriesOfEntriesBeingAdded, boolean targetTableIsConstraintsTable, TableViewerCreator tableViewerCreatorTarget, ArrayList<IMetadataColumn> metadataColumnsBeingAdded) // , MetadataEditorEvent metadataEditorEvent
{
UIManager uiManager = getUiManager();
if (metadataEditorView != null && !targetTableIsConstraintsTable) {
metadataEditorView.getMetadataTableEditor().addAll(currentIndex, metadataColumnsBeingAdded);
// metadataEditorEvent.indexStartInsert = currentIndex;
// IAction action = MetadataEditorActionFactory.getInstance().getAction(metadataEditorView,
// metadataEditorEvent);
// action.run(metadataEditorEvent);
Zone zoneTarget = getMapperManager().retrieveDataMapTableView(tableViewerCreatorTarget.getTable()).getZone();
List<IColumnEntry> lastCreatedTableEntries = uiManager.getLastCreatedInOutColumnEntries();
for (int i = 0; i < lastCreatedTableEntries.size(); i++) {
ITableEntry tableEntrySource = sourceEntriesOfEntriesBeingAdded.get(i);
ITableEntry dataMapTableEntry = lastCreatedTableEntries.get(i);
if (zoneTarget == Zone.INPUTS) {
setDefaultOperator((InputColumnTableEntry) dataMapTableEntry);
}
DataMapTableView dataMapTableView = getMapperManager().retrieveIDataMapTableView(tableEntrySource.getParent());
Zone zoneSource = dataMapTableView.getZone();
String location = null;
if (zoneSource == Zone.OUTPUTS) {
location = tableEntrySource.getExpression();
} else {
location = currentLanguage.getLocation(tableEntrySource.getParentName(), tableEntrySource.getName());
}
if (location != null) {
//$NON-NLS-1$
dataMapTableEntry.setExpression(location + " ");
}
}
}
tableViewerCreatorTarget.getTableViewer().refresh();
List<ITableEntry> refreshedTableEntriesList = tableViewerCreatorTarget.getInputList();
for (ITableEntry tableEntry : refreshedTableEntriesList) {
uiManager.parseExpression(tableEntry.getExpression(), tableEntry, false, true, false);
}
}
Aggregations