use of org.talend.commons.utils.data.bean.IBeanPropertyAccessors 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.commons.utils.data.bean.IBeanPropertyAccessors in project tdi-studio-se by Talend.
the class OutputDataMapTableView method getMapSettingValueAccess.
@Override
protected IBeanPropertyAccessors<GlobalMapEntry, Object> getMapSettingValueAccess(final CellEditor cellEditor) {
return new IBeanPropertyAccessors<GlobalMapEntry, Object>() {
public Object get(GlobalMapEntry bean) {
IDataMapTable parent = bean.getParent();
OutputTable outputTable = (OutputTable) parent;
if (cellEditor instanceof ComboBoxCellEditor) {
ComboBoxCellEditor functComboBox = (ComboBoxCellEditor) cellEditor;
functComboBox.setItems(new String[] { "true", "false" });
if (OUTPUT_REJECT.equals(bean.getName())) {
return String.valueOf(outputTable.isReject());
} else if (LOOK_UP_INNER_JOIN_REJECT.equals(bean.getName())) {
return String.valueOf(outputTable.isRejectInnerJoin());
} else if (SCHEMA_TYPE.equals(bean.getName())) {
functComboBox.setItems(new String[] { BUILT_IN, REPOSITORY });
return outputTable.isRepository() ? REPOSITORY : BUILT_IN;
}
} else if (cellEditor instanceof CustomDialogCellEditor) {
CustomDialogCellEditor customDialogCellEditor = (CustomDialogCellEditor) cellEditor;
if (OUTPUT_REJECT.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.BOOL);
return String.valueOf(outputTable.isReject());
} else if (LOOK_UP_INNER_JOIN_REJECT.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.BOOL);
return String.valueOf(outputTable.isRejectInnerJoin());
} else if (SCHEMA_TYPE.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.SCHEMA_TYPE);
enableDiaplayViewer(outputTable.isRepository());
return outputTable.isRepository() ? REPOSITORY : BUILT_IN;
} else if (SCHEMA_ID.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.SCHEMA_ID);
return getSchemaDisplayName(outputTable.getId());
}
}
return "";
}
public void set(GlobalMapEntry bean, Object value) {
if (value == null) {
return;
}
IDataMapTable parent = bean.getParent();
OutputTable outputTable = (OutputTable) parent;
if (OUTPUT_REJECT.equals(bean.getName())) {
outputTable.setReject(Boolean.valueOf(value.toString()));
} else if (LOOK_UP_INNER_JOIN_REJECT.equals(bean.getName())) {
outputTable.setRejectInnerJoin(Boolean.valueOf(value.toString()));
} else if (SCHEMA_TYPE.equals(bean.getName())) {
outputTable.setRepository(REPOSITORY.equals(value));
showSchemaIDSetting(REPOSITORY.equals(value));
enableDiaplayViewer(REPOSITORY.equals(value));
} else if (SCHEMA_ID.equals(bean.getName())) {
outputTable.setId(String.valueOf(value));
}
refreshCondensedImage(outputTable, bean.getName());
}
};
}
use of org.talend.commons.utils.data.bean.IBeanPropertyAccessors in project tdi-studio-se by Talend.
the class RepositoryWebService method ctrate.
public void ctrate() {
wsdlComposite = new Composite(uiParent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginWidth = 20;
layout.marginHeight = 20;
wsdlComposite.setLayout(layout);
wsdlComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
// WSDL URL
Composite wsdlUrlcomposite = new Composite(wsdlComposite, SWT.NONE);
GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.verticalIndent = 2;
layoutData.verticalSpan = 1;
wsdlUrlcomposite.setLayoutData(layoutData);
layout = new GridLayout(4, false);
wsdlUrlcomposite.setLayout(layout);
wsdlField = new LabelledFileField(wsdlUrlcomposite, ExternalWebServiceUIProperties.FILE_LABEL, ExternalWebServiceUIProperties.FILE_EXTENSIONS, 1, SWT.BORDER) {
@Override
protected void setFileFieldValue(String result) {
if (result != null) {
getTextControl().setText(TalendTextUtils.addQuotes(PathUtils.getPortablePath(result)));
getDataFromNet();
isFirst = false;
}
}
};
wsdlField.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
// TODO Auto-generated method stub
URLValue = wsdlField.getText();
connection.setWSDL(URLValue);
}
});
// add a listener for ctrl+space.
TalendProposalUtils.installOn(wsdlField.getTextControl(), connector.getProcess(), connector);
//$NON-NLS-1$
String wsdlUrl = (String) connector.getElementParameter("ENDPOINT").getValue();
if (wsdlUrl != null) {
wsdlField.setText(wsdlUrl);
}
refreshbut = new Button(wsdlUrlcomposite, SWT.PUSH | SWT.CENTER);
refreshbut.setImage(ImageProvider.getImage(EImage.REFRESH_ICON));
GridData butData = new GridData();
butData.verticalSpan = 1;
refreshbut.setLayoutData(butData);
// add port name UI
Composite wsdlPortcomposite = new Composite(wsdlComposite, SWT.NONE);
GridData portlayoutData = new GridData(GridData.FILL_HORIZONTAL);
portlayoutData.verticalIndent = 2;
portlayoutData.verticalSpan = 3;
wsdlPortcomposite.setLayoutData(portlayoutData);
layout = new GridLayout(2, false);
layout.verticalSpacing = 1;
wsdlPortcomposite.setLayout(layout);
portNameLabel = new Label(wsdlPortcomposite, SWT.NONE);
//$NON-NLS-1$
portNameLabel.setText(Messages.getString("WebServiceUI.Port"));
GridData portLabelGridData = new GridData();
portLabelGridData.verticalAlignment = SWT.TOP;
portNameLabel.setLayoutData(portLabelGridData);
Composite portTabComposite = new Composite(wsdlPortcomposite, SWT.BORDER);
portTabComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
portTabComposite.setLayout(new FillLayout());
//$NON-NLS-1$
ExtendedTableModel<PortNames> portModel = new ExtendedTableModel<PortNames>("PORTNAMELIST", allPortNames);
portListTableView = new AbstractDataTableEditorView<PortNames>(portTabComposite, SWT.NONE, portModel, false, true, false) {
@Override
protected void setTableViewerCreatorOptions(TableViewerCreator<PortNames> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setHeaderVisible(false);
newTableViewerCreator.setVerticalScroll(true);
newTableViewerCreator.setReadOnly(true);
}
@Override
protected void createColumns(TableViewerCreator<PortNames> tableViewerCreator, Table table) {
TableViewerCreatorColumn rowColumn = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
rowColumn.setTitle(Messages.getString("WebServiceUI.COLUMN"));
rowColumn.setBeanPropertyAccessors(new IBeanPropertyAccessors<PortNames, String>() {
public String get(PortNames bean) {
return bean.getPortName();
}
public void set(PortNames bean, String value) {
bean.setPortName(value);
}
});
rowColumn.setWeight(60);
rowColumn.setModifiable(true);
rowColumn.setMinimumWidth(60);
rowColumn.setCellEditor(new TextCellEditor(tableViewerCreator.getTable()));
}
};
// WSDL Operation
Composite wsdlOperationcomposite = new Composite(wsdlComposite, SWT.NONE);
GridData operationlayoutData = new GridData(GridData.FILL_BOTH);
operationlayoutData.verticalIndent = 2;
operationlayoutData.verticalSpan = 5;
wsdlOperationcomposite.setLayoutData(operationlayoutData);
layout = new GridLayout(2, false);
layout.verticalSpacing = 3;
wsdlOperationcomposite.setLayout(layout);
// wsdlOperationcomposite.setLayoutData(new GridData(GridData.FILL_BOTH));
operationLabel = new Label(wsdlOperationcomposite, SWT.NONE);
//$NON-NLS-1$
operationLabel.setText(Messages.getString("WebServiceUI.Operation"));
GridData opertionLabelGridData = new GridData();
opertionLabelGridData.verticalAlignment = SWT.TOP;
operationLabel.setLayoutData(opertionLabelGridData);
Composite tabComposite = new Composite(wsdlOperationcomposite, SWT.BORDER);
GridData tabGridData = new GridData(GridData.FILL_BOTH);
// tabGridData.verticalSpan = 3;
tabComposite.setLayoutData(tabGridData);
tabComposite.setLayout(new FillLayout());
//$NON-NLS-1$
ExtendedTableModel<Function> funModel = new ExtendedTableModel<Function>("FUNCTIONLIST", allfunList);
listTableView = new AbstractDataTableEditorView<Function>(tabComposite, SWT.NONE, funModel, false, true, false) {
@Override
protected void setTableViewerCreatorOptions(TableViewerCreator<Function> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setHeaderVisible(false);
newTableViewerCreator.setVerticalScroll(true);
newTableViewerCreator.setReadOnly(true);
}
@Override
protected void createColumns(TableViewerCreator<Function> tableViewerCreator, Table table) {
TableViewerCreatorColumn rowColumn = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
rowColumn.setTitle(Messages.getString("WebServiceUI.COLUMN"));
rowColumn.setBeanPropertyAccessors(new IBeanPropertyAccessors<Function, String>() {
public String get(Function bean) {
return bean.getName();
}
public void set(Function bean, String value) {
bean.setName(value);
}
});
rowColumn.setWeight(60);
rowColumn.setModifiable(true);
rowColumn.setMinimumWidth(60);
rowColumn.setCellEditor(new TextCellEditor(tableViewerCreator.getTable()));
}
};
addListenerForWSDLCom();
}
use of org.talend.commons.utils.data.bean.IBeanPropertyAccessors in project tdi-studio-se by Talend.
the class CheckColumnSelectionListener method widgetSelected.
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent e) {
if (tableViewerCreator != null && tableViewerCreator.isReadOnly()) {
return;
}
// TableItem items[] = tableViewerCreator.getTable().getItems();
// String columnId = tableViewerCreatorColumn.getId();
// boolean modified = false;
// for (TableItem tableItem : items) {
// tableViewerCreator.getCellModifier().modify(tableItem, columnId, checked ? false : true);
// if (!modified) {
// modified = true;
// }
// }
// if (modified) {
// this.param.getValue();
// if (checked) {
// checked = false;
// } else {
// checked = true;
// }
// tableViewerCreatorColumn.getTableColumn().setImage(
// checked ? ImageProvider.getImage(EImage.CHECKED_ICON) : ImageProvider.getImage(EImage.UNCHECKED_ICON));
// this.param.setValue(new Boolean(checked));
// }
String columnId = tableViewerCreatorColumn.getId();
TableViewerCreatorColumnNotModifiable column = tableViewerCreator.getColumn(columnId);
IBeanPropertyAccessors accessor = column.getBeanPropertyAccessors();
List inputList = tableViewerCreator.getInputList();
for (int i = 0; i < inputList.size(); i++) {
if (tableViewerCreator instanceof TableViewerCreator && column instanceof TableViewerCreatorColumn) {
((TableViewerCreator) tableViewerCreator).setBeanValue((TableViewerCreatorColumn) column, inputList.get(i), checked ? false : true, true);
} else {
accessor.set(inputList.get(i), checked ? false : true);
}
}
if (checked) {
checked = false;
} else {
checked = true;
}
tableViewerCreatorColumn.getTableColumn().setImage(checked ? ImageProvider.getImage(EImage.CHECKED_ICON) : ImageProvider.getImage(EImage.UNCHECKED_ICON));
this.param.setValue(new Boolean(checked));
tableViewerCreator.refreshTableEditorControls();
}
use of org.talend.commons.utils.data.bean.IBeanPropertyAccessors in project tdi-studio-se by Talend.
the class AutoConversionTypesEditorView method configureTypeColumn.
private void configureTypeColumn(TableViewerCreator<AutoConversionType> tableViewerCreator, TableViewerCreatorColumn column) {
IBeanPropertyAccessors<AutoConversionType, Boolean> nullableAccessors = new IBeanPropertyAccessors<AutoConversionType, Boolean>() {
@Override
public Boolean get(AutoConversionType bean) {
return Boolean.TRUE;
}
@Override
public void set(AutoConversionType bean, Boolean value) {
return;
}
};
CellEditorValueAdapter comboValueAdapter = new JavaTypeComboValueAdapter(JavaTypesManager.getDefaultJavaType(), nullableAccessors);
String[] arrayTalendTypes = new String[0];
try {
arrayTalendTypes = MetadataTalendType.getTalendTypesLabels();
} catch (NoClassDefFoundError e) {
// shouln't be happend
// e.printStackTrace();
ExceptionHandler.process(e);
} catch (ExceptionInInitializerError e) {
// shouln't be happend
// e.printStackTrace();
ExceptionHandler.process(e);
}
ComboBoxCellEditor typeComboEditor = new ComboBoxCellEditor(tableViewerCreator.getTable(), arrayTalendTypes, SWT.READ_ONLY);
CCombo typeCombo = (CCombo) typeComboEditor.getControl();
typeCombo.setEditable(false);
column.setCellEditor(typeComboEditor, comboValueAdapter);
}
Aggregations