use of org.eclipse.swt.widgets.Table 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.eclipse.swt.widgets.Table in project tdi-studio-se by Talend.
the class UIManager method getTableEntryPosition.
/**
* DOC amaumont Comment method "getTableEntryPosition".
*
* @param manager TODO
* @param tableEntry
* @param forceRecalculate TODO
* @return
*/
public Point getTableEntryPosition(ITableEntry tableEntry, boolean forceRecalculate) {
TableEntryProperties tableEntryProperties = mapperManager.getTableEntryProperties(tableEntry);
Point returnedPoint = tableEntryProperties.position;
if (forceRecalculate || returnedPoint == null) {
TableItem tableItem = mapperManager.retrieveTableItem(tableEntry);
DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(tableEntry);
Rectangle tableViewBounds = dataMapTableView.getBounds();
Table table = tableItem.getParent();
// FIX for issue 1225 ("1" parameter added)
Rectangle boundsTableItem = tableItem.getBounds(1);
int x = 0;
int y = boundsTableItem.y + table.getItemHeight() / 2 + dataMapTableView.getBorderWidth();
if (y < 0) {
y = 0;
}
Point point = new Point(x, y);
Display display = dataMapTableView.getDisplay();
Point pointFromTableViewOrigin = display.map(tableItem.getParent(), dataMapTableView, point);
if (pointFromTableViewOrigin.y > tableViewBounds.height - TableEntriesManager.HEIGHT_REACTION) {
pointFromTableViewOrigin.y = tableViewBounds.height - TableEntriesManager.HEIGHT_REACTION;
}
returnedPoint = convertPointToReferenceOrigin(getReferenceComposite(), pointFromTableViewOrigin, dataMapTableView);
tableEntryProperties.position = returnedPoint;
}
return returnedPoint;
}
use of org.eclipse.swt.widgets.Table in project tdi-studio-se by Talend.
the class MapperManager method isTableOfOutputMetadataEditor.
/**
* DOC amaumont Comment method "isTableOfOutputMetadataEditor".
*
* @param table
* @return
*/
public boolean isTableOfOutputMetadataEditor(Table table) {
MetadataTableEditorView outputEditorView = uiManager.getOutputMetaEditorView();
Table tableEditorView = outputEditorView.getTable();
return tableEditorView == table;
}
use of org.eclipse.swt.widgets.Table in project tdi-studio-se by Talend.
the class MergeOrderDialog method createDialogArea.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Composite tableComposite = new Composite(composite, SWT.None);
tableComposite.setLayout(new GridLayout());
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.widthHint = WIDTH;
gridData.minimumWidth = WIDTH;
gridData.heightHint = HEIGHT;
gridData.minimumHeight = HEIGHT;
tableComposite.setLayoutData(gridData);
final TableViewerCreator tableViewerCreator = new TableViewerCreator(tableComposite);
tableViewerCreator.setBorderVisible(true);
tableViewerCreator.setCheckboxInFirstColumn(false);
tableViewerCreator.setColumnsResizableByDefault(true);
tableViewerCreator.setColumnsSortableByDefault(true);
tableViewerCreator.setLayoutMode(LAYOUT_MODE.FILL_HORIZONTAL);
Table table = tableViewerCreator.createTable();
table.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
column.setTitle(Messages.getString("MergeOrderDialog.Order"));
column.setModifiable(true);
column.setWidth(50);
//$NON-NLS-1$
column.setToolTipHeader(Messages.getString("MergeOrderDialog.CurrentOrderConnection"));
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Connection, String>() {
public String get(Connection bean) {
return String.valueOf(connectionList.indexOf(bean) + 1);
}
public void set(Connection bean, String value) {
// bean.setName(value);
}
});
column = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
column.setTitle(Messages.getString("MergeOrderDialog.ConnectionName"));
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Connection, String>() {
public String get(Connection bean) {
return getDisplayStr(bean);
}
public void set(Connection bean, String value) {
// bean.setName(value);
}
});
column.setModifiable(false);
column.setWidth(200);
tableViewerCreator.init(connectionList);
Composite buttonComposite = new Composite(composite, SWT.None);
buttonComposite.setLayout(new RowLayout(SWT.HORIZONTAL));
Button moveUp = new Button(buttonComposite, SWT.PUSH);
//$NON-NLS-1$
moveUp.setToolTipText(Messages.getString("MergeOrderDialog.MoveUp"));
moveUp.setImage(ImageProvider.getImage(EImage.UP_ICON));
moveUp.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
IStructuredSelection selection = (IStructuredSelection) tableViewerCreator.getTableViewer().getSelection();
Connection connection = (Connection) selection.getFirstElement();
int connId = connectionList.indexOf(connection);
if (connId > 0) {
Collections.swap(connectionList, connId - 1, connId);
tableViewerCreator.getTableViewer().refresh();
}
}
});
Button moveDown = new Button(buttonComposite, SWT.PUSH);
//$NON-NLS-1$
moveDown.setToolTipText(Messages.getString("MergeOrderDialog.MoveDown"));
moveDown.setImage(ImageProvider.getImage(EImage.DOWN_ICON));
if (getMergeNode() != null && getMergeNode().isReadOnly()) {
moveUp.setEnabled(false);
moveDown.setEnabled(false);
}
final int nbConn = getConnectionQty();
moveDown.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
IStructuredSelection selection = (IStructuredSelection) tableViewerCreator.getTableViewer().getSelection();
if (selection.size() > 0) {
Connection connection = (Connection) selection.getFirstElement();
int connId = connectionList.indexOf(connection);
if (connId < (nbConn - 1)) {
Collections.swap(connectionList, connId + 1, connId);
tableViewerCreator.getTableViewer().refresh();
}
}
}
});
return composite;
}
use of org.eclipse.swt.widgets.Table in project tdi-studio-se by Talend.
the class DataMapTableView method createTableForColumns.
/**
* DOC amaumont Comment method "createTableForColumns".
*
* @param parent
*/
private void createTableForColumns(Composite parent) {
this.extendedTableViewerForColumns = new AbstractExtendedTableViewer<IColumnEntry>(abstractDataMapTable.getTableColumnsEntriesModel(), parent) {
@Override
protected void createColumns(TableViewerCreator<IColumnEntry> tableViewerCreator, Table table) {
initColumnsOfTableColumns(tableViewerCreator);
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer#initTableListeners()
*/
@Override
protected void initTableListeners() {
super.initTableListeners();
getTableViewerCreator().addCellValueModifiedListener(new ITableCellValueModifiedListener() {
@Override
public void cellValueModified(TableCellValueModifiedEvent e) {
// System.out.println();
// System.out.println(getTable().hashCode());
// System.out.println(e.tableItem.getParent().hashCode());
// if (e.tableItem.getParent().isFocusControl()) {
// only if table of item is actually the focus control
getTableViewerCreator().getSelectionHelper().deselectAll();
getTable().forceFocus();
// }
}
});
}
/*
* (non-Javadoc)
*
* @see
* org.talend.commons.ui.swt.extended.macrotable.AbstractExtendedTableViewer#setTableViewerCreatorOptions
* (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)
*/
@Override
protected void setTableViewerCreatorOptions(final TableViewerCreator<IColumnEntry> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setColumnsResizableByDefault(true);
newTableViewerCreator.setBorderVisible(false);
newTableViewerCreator.setLayoutMode(LAYOUT_MODE.FILL_HORIZONTAL);
newTableViewerCreator.setKeyboardManagementForCellEdition(false);
// tableViewerCreatorForColumns.setUseCustomItemColoring(this.getDataMapTable() instanceof
// AbstractInOutTable);
newTableViewerCreator.setFirstColumnMasked(true);
if (getDataMapTable() instanceof AbstractInOutTable) {
if (imageKey == null) {
imageKey = org.talend.commons.ui.runtime.image.ImageProvider.getImage(EImage.KEY_ICON);
}
if (imageEmpty == null) {
imageEmpty = org.talend.commons.ui.runtime.image.ImageProvider.getImage(EImage.EMPTY);
}
}
newTableViewerCreator.setLabelProvider(new DefaultTableLabelProvider(newTableViewerCreator) {
@Override
public Color getBackground(Object element, int columnIndex) {
Color backgroundCellColor = getBackgroundCellColor(newTableViewerCreator, element, columnIndex);
if (backgroundCellColor != null) {
return backgroundCellColor;
}
return super.getBackground(element, columnIndex);
}
@Override
public Color getForeground(Object element, int columnIndex) {
Color foregroundCellColor = getForegroundCellColor(newTableViewerCreator, element, columnIndex);
if (foregroundCellColor != null) {
return foregroundCellColor;
}
return getForegroundCellColor(newTableViewerCreator, element, columnIndex);
}
@Override
public Image getColumnImage(Object element, int columnIndex) {
return getColumnImageExecute(element, columnIndex);
}
/**
* DOC amaumont Comment method "getColumnImageExecute".
*
* @param element
* @param columnIndex
* @return
*/
private Image getColumnImageExecute(Object element, int columnIndex) {
if (getDataMapTable() instanceof AbstractInOutTable) {
AbstractInOutTableEntry entry = (AbstractInOutTableEntry) element;
TableViewerCreatorColumnNotModifiable column = newTableViewerCreator.getColumns().get(columnIndex);
if (column.getId().equals(ID_NAME_COLUMN)) {
if (entry.getMetadataColumn().isKey()) {
return imageKey;
} else {
return imageEmpty;
}
}
}
return null;
}
});
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer#initModelListeners()
*/
@Override
protected void initModelListeners() {
super.initModelListeners();
getExtendedTableModel().addAfterOperationListListener(100, new IListenableListListener<IColumnEntry>() {
@Override
public void handleEvent(ListenableListEvent<IColumnEntry> event) {
if (tableViewerCreator.getTable() != null && !tableViewerCreator.getTable().isDisposed()) {
if (event.type == TYPE.ADDED) {
Collection<IColumnEntry> addedObjects = event.addedObjects;
for (IColumnEntry tableEntry : addedObjects) {
mapperManager.getProblemsManager().checkProblemsForTableEntry(tableEntry, false);
}
}
}
}
});
}
};
tableViewerCreatorForColumns = this.extendedTableViewerForColumns.getTableViewerCreator();
this.extendedTableViewerForColumns.setCommandStack(mapperManager.getCommandStack());
tableForEntries = tableViewerCreatorForColumns.getTable();
GridData tableEntriesGridData = new GridData(GridData.FILL_BOTH);
tableEntriesGridData.grabExcessVerticalSpace = true;
tableEntriesGridData.minimumHeight = tableForEntries.getHeaderHeight() + tableForEntries.getItemHeight();
// tableEntriesGridData.heightHint = 50;
// tableEntriesGridData.grabExcessVerticalSpace = false;
tableForEntries.setLayoutData(tableEntriesGridData);
addTablesListeners();
}
Aggregations