use of org.talend.designer.hl7.ui.HL7MultiSchemaUI in project tdi-studio-se by Talend.
the class HL7MetadataEmfTableEditorView method getDbColumnNameAccessor.
@Override
protected IBeanPropertyAccessors<MetadataColumn, String> getDbColumnNameAccessor() {
return new IBeanPropertyAccessors<MetadataColumn, String>() {
public String get(MetadataColumn bean) {
return bean.getOriginalField();
}
public void set(MetadataColumn bean, String value) {
bean.setOriginalField(value);
IStructuredSelection selection = (IStructuredSelection) ((HL7MultiSchemaUI) linker.getMainui()).getMetaTableViewer().getSelection();
Object selectedObj = selection.getFirstElement();
if (selectedObj != null) {
String key = ((IModel) selectedObj).getDisplayName();
linker.getManager().updateRelationMapping(key, bean, false);
// if (columns.indexOf(bean) > 0) {
// columns.get(columns.indexOf(bean)).setOriginalField(value);
// }
}
}
};
}
use of org.talend.designer.hl7.ui.HL7MultiSchemaUI in project tdi-studio-se by Talend.
the class HL7Main method createUI.
/**
* create UI".
*
* @param parent
* @return
*/
public void createUI(Composite parent) {
if (connector.isHL7Output()) {
generatorUI = new HL7OutputLinkUI(parent, this.hl7Manager);
generatorUI.init();
return;
}
generatorUI = new HL7MultiSchemaUI(parent, hl7Manager);
generatorUI.init();
}
use of org.talend.designer.hl7.ui.HL7MultiSchemaUI in project tdi-studio-se by Talend.
the class HL7MetadataEmfToolbarEditor method createMoveUpPushButton.
@Override
protected MoveUpPushButton createMoveUpPushButton() {
return new MoveUpPushButtonForExtendedTable(toolbar, extendedTableViewer) {
@Override
protected void afterCommandExecution(Command executedCommand) {
MetadataEmfTableEditor tableEditorModel = (MetadataEmfTableEditor) getExtendedTableViewer().getExtendedControlModel();
IStructuredSelection selection = (IStructuredSelection) ((HL7MultiSchemaUI) linker.getMainui()).getMetaTableViewer().getSelection();
Object selectedObj = selection.getFirstElement();
if (selectedObj != null) {
String key = ((IModel) selectedObj).getDisplayName();
List<MetadataColumn> metadataColumnList = tableEditorModel.getMetadataColumnList();
Map<String, List<MetadataColumn>> schemaRelationMap = linker.getManager().getSchemaRelationMap();
if (schemaRelationMap != null) {
List<MetadataColumn> schemas = new ArrayList<MetadataColumn>();
schemas.addAll(metadataColumnList);
schemaRelationMap.put(key, schemas);
}
}
linker.getMainui().redrawLinkers();
linker.getBackgroundRefresher().refreshBackground();
}
@Override
public boolean getEnabledState() {
// 13749
return super.getEnabledState() && !isRepository;
}
};
}
use of org.talend.designer.hl7.ui.HL7MultiSchemaUI in project tdi-studio-se by Talend.
the class HL7MetadataEmfToolbarEditor method createPastePushButton.
/*
* (non-Javadoc)
*
* @see org.talend.core.ui.extended.ExtendedToolbarView#createPastButton()
*/
@Override
public PastePushButton createPastePushButton() {
return new PastePushButtonForExtendedTable(toolbar, extendedTableViewer) {
@Override
protected Command getCommandToExecute(ExtendedTableModel extendedTableModel, Integer indexWhereInsert) {
return new MetadataEmfPasteCommand(extendedTableModel, indexWhereInsert);
}
@Override
public boolean getEnabledState() {
// 13749
return super.getEnabledState() && !isRepository;
}
@Override
protected void afterCommandExecution(Command executedCommand) {
MetadataEmfTableEditor tableEditorModel = (MetadataEmfTableEditor) getExtendedTableViewer().getExtendedControlModel();
IStructuredSelection selection = (IStructuredSelection) ((HL7MultiSchemaUI) linker.getMainui()).getMetaTableViewer().getSelection();
Object selectedObj = selection.getFirstElement();
if (selectedObj != null) {
String key = ((IModel) selectedObj).getDisplayName();
List<MetadataColumn> metadataColumnList = tableEditorModel.getMetadataColumnList();
Map<String, List<MetadataColumn>> schemaRelationMap = linker.getManager().getSchemaRelationMap();
if (schemaRelationMap != null) {
List<MetadataColumn> schemas = new ArrayList<MetadataColumn>();
schemas.addAll(metadataColumnList);
schemaRelationMap.put(key, schemas);
}
}
}
};
}
use of org.talend.designer.hl7.ui.HL7MultiSchemaUI in project tdi-studio-se by Talend.
the class HL7MetadataEmfToolbarEditor method createAddPushButton.
/*
* (non-Javadoc)
*
* @see org.talend.core.ui.extended.ExtendedToolbarView#createAddPushButton()
*/
@Override
protected AddPushButton createAddPushButton() {
return new AddPushButtonForExtendedTable(this.toolbar, getExtendedTableViewer()) {
boolean hasSchema = false;
@Override
protected Object getObjectToAdd() {
if (hasSchema) {
MetadataEmfTableEditor tableEditorModel = (MetadataEmfTableEditor) getExtendedTableViewer().getExtendedControlModel();
if (tableEditorModel.getMetadataTable() == null) {
tableEditorModel.setMetadataTable(ConnectionFactory.eINSTANCE.createMetadataTable());
}
MetadataColumn metadatacolumn = tableEditorModel.createNewMetadataColumn(dbmsId);
metadatacolumn.setLength(226);
metadatacolumn.setPrecision(0);
updateCurrentTableModelAndMap(tableEditorModel);
return metadatacolumn;
}
return null;
}
@Override
protected void beforeCommandExecution() {
IStructuredSelection selection = (IStructuredSelection) ((HL7MultiSchemaUI) linker.getMainui()).getMetaTableViewer().getSelection();
Object selectedObj = selection.getFirstElement();
if (selectedObj != null) {
hasSchema = true;
super.beforeCommandExecution();
} else {
hasSchema = false;
MessageDialog.openError(HL7MetadataEmfToolbarEditor.this.getParentComposite().getShell(), "Can't add new column!", "Need to init a schema by choosing a file at first");
}
}
private void updateCurrentTableModelAndMap(MetadataEmfTableEditor tableEditorModel) {
IStructuredSelection selection = (IStructuredSelection) ((HL7MultiSchemaUI) linker.getMainui()).getMetaTableViewer().getSelection();
Object selectedObj = selection.getFirstElement();
if (selectedObj != null) {
String key = ((IModel) selectedObj).getDisplayName();
linker.getManager().updateRelationMapping(key, tableEditorModel.createNewMetadataColumn(dbmsId), true);
}
}
@Override
public boolean getEnabledState() {
// 13749
return super.getEnabledState() && !isRepository;
}
};
}
Aggregations