use of org.eclipse.swt.widgets.TableItem in project tdi-studio-se by Talend.
the class PromptDefaultValueDialog method setInput.
public void setInput(List<ColumnInfo> inputs) {
table.setRedraw(false);
for (ColumnInfo row : inputs) {
final TableItem item = new TableItem(table, SWT.NONE);
//$NON-NLS-1$
item.setText(new String[] { row.name, "" });
IElementParameter param = row.parameter;
Object defaultValue = param.getValue();
item.setData(row);
if (param.getFieldType() == EParameterFieldType.CHECK) {
// create check box
createCheckboxEditor(item, 1, (Boolean) defaultValue);
} else if (param.getFieldType() == EParameterFieldType.TEXT) {
// create text input
createTextEditor(item, 1, (String) defaultValue);
} else if (param.getFieldType() == EParameterFieldType.CLOSED_LIST || param.getFieldType() == EParameterFieldType.PREV_COLUMN_LIST) {
// create combo
int selectIndex = 0;
Object[] values = param.getListItemsValue();
for (int i = 0; i < values.length; i++) {
if (values[i].equals(param.getDefaultClosedListValue())) {
selectIndex = i;
break;
}
}
createComboEditor(item, 1, param.getListItemsDisplayName(), selectIndex);
}
}
table.setRedraw(true);
}
use of org.eclipse.swt.widgets.TableItem in project tdi-studio-se by Talend.
the class SearchZoneMapper method moveScrollBarZoneAtSelectedTableItem.
public void moveScrollBarZoneAtSelectedTableItem(ITableEntry entry) {
if (entry != null) {
DataMapTableView dataMapTableView = mapperManager.retrieveIDataMapTableView(entry.getParent());
Rectangle tableViewBounds = dataMapTableView.getBounds();
IDataMapTable table = entry.getParent();
TableItem tableItem = mapperManager.retrieveTableItem(entry);
if (table != null && tableItem != null) {
Rectangle tableItemBounds = tableItem.getBounds();
int selection = tableViewBounds.y + tableItemBounds.y;
ScrolledComposite scrollComposite = null;
if (table instanceof InputTable) {
scrollComposite = uiManager.getScrolledCompositeViewInputs();
} else if (table instanceof OutputTable) {
scrollComposite = uiManager.getScrolledCompositeViewOutputs();
}
if (scrollComposite != null) {
setPositionOfVerticalScrollBarZone(scrollComposite, selection);
}
}
}
}
use of org.eclipse.swt.widgets.TableItem in project tdi-studio-se by Talend.
the class TabFolderEditors method addListenersToOutputButtons.
/**
* DOC amaumont Comment method "addListenersToInputButtons".
*/
private void addListenersToOutputButtons() {
MetadataToolbarEditorView toolBar = outputMetaEditor.getToolBar();
outputToolBarButtons = toolBar.getButtons();
beforeCommandListenerForOutputButtons = new IExtendedButtonListener() {
public void handleEvent(ExtendedButtonEvent event) {
TableViewerCreator tableViewerCreator = mapperManager.getUiManager().getCurrentSelectedOutputTableView().getTableViewerCreatorForColumns();
if (tableViewerCreator != null) {
tableViewerCreator.applyActivatedCellEditor();
}
}
};
for (ExtendedPushButton extendedPushButton : outputToolBarButtons) {
extendedPushButton.addListener(beforeCommandListenerForOutputButtons, true);
if (extendedPushButton instanceof RemovePushButton && !mapperManager.componentIsReadOnly()) {
removeButton = (RemovePushButtonForExtendedTable) extendedPushButton;
}
}
if (removeButton != null) {
final TableViewerCreator tableViewerCreator = removeButton.getExtendedTableViewer().getTableViewerCreator();
tableViewerCreator.getSelectionHelper().addAfterSelectionListener(new ILineSelectionListener() {
public void handle(LineSelectionEvent e) {
for (TableItem item : tableViewerCreator.getTable().getSelection()) {
if (item.getData() instanceof MetadataColumn) {
MetadataColumn column = (MetadataColumn) item.getData();
removeButton.getButton().setEnabled(!column.isCustom());
break;
}
}
}
});
}
this.addDisposeListener(new DisposeListener() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
*/
public void widgetDisposed(DisposeEvent e) {
for (ExtendedPushButton extendedPushButton : outputToolBarButtons) {
extendedPushButton.removeListener(beforeCommandListenerForOutputButtons, true);
}
}
});
}
use of org.eclipse.swt.widgets.TableItem in project tdi-studio-se by Talend.
the class DragSourceListenerForWebService method dragSetData.
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.dnd.DragSourceListener#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)
*/
public void dragSetData(DragSourceEvent event) {
if (TableEntriesTransfer.getInstance().isSupportedType(event.dataType)) {
if (draggableControl instanceof Table) {
Table draggableTable = (Table) draggableControl;
TableItem selection = draggableTable.getSelection()[0];
event.data = selection.getData();
}
}
}
use of org.eclipse.swt.widgets.TableItem in project tdi-studio-se by Talend.
the class DropTargetListenerForWebService method drop.
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.dnd.DropTargetListener#drop(org.eclipse.swt.dnd.DropTargetEvent)
*/
public void drop(DropTargetEvent event) {
if (getTransfer().isSupportedType(event.currentDataType)) {
// boolean canRemove = true;
// Parameter pa = TableEntriesTransfer.getInstance().getParameter();
Table draggableTable = (Table) draggableControl;
Point point = new Point(event.x, event.y);
int selevIndex = TableUtils.getItemIndexWhereInsertFromPosition(draggableTable, point);
if (selevIndex < 0) {
return;
}
TableItem tabitem = TableEntriesTransfer.getInstance().getTableItem();
if (tabitem == null) {
return;
}
ExtendedTableModel tabelModel = draggableControlView.getExtendedTableModel();
if (tabelModel.getBeansList().size() == 0 || tabelModel.getBeansList().size() == selevIndex) {
// }
return;
} else if (tabelModel.getBeansList().size() > 0) {
if (tabelModel.getBeansList().size() < selevIndex) {
return;
}
Object objData = tabelModel.getBeansList().get(selevIndex);
if (objData instanceof InputMappingData) {
InputMappingData inData = (InputMappingData) objData;
IMetadataColumn inputColumn = null;
if (tabitem.getData() instanceof IMetadataColumn) {
inputColumn = (IMetadataColumn) tabitem.getData();
List<IMetadataColumn> columnList = inData.getMetadataColumnList();
if (inData.getInputColumnValue() == null || "".equals(inData.getInputColumnValue())) {
inData.setInputColumnValue(connector.initInRoWName() + "." + inputColumn.getLabel());
columnList.add(inputColumn);
} else {
inData.setInputColumnValue(inData.getInputColumnValue() + " " + connector.initInRoWName() + "." + inputColumn.getLabel());
columnList.add(inputColumn);
}
}
tabelModel.remove(selevIndex);
tabelModel.add(inData, selevIndex);
} else if (objData instanceof OutPutMappingData) {
OutPutMappingData outData = (OutPutMappingData) objData;
if (tabitem.getData() instanceof ParameterInfo) {
ParameterInfo para = (ParameterInfo) tabitem.getData();
if (outData.getParameterName() == null || "".equals(outData.getParameterName())) {
if (para.getParent() != null) {
String name = new ParameterInfoUtil().getParentName(para);
outData.setParameterName(name);
} else {
outData.setParameterName(para.getName());
}
} else {
outData.setParameterName(outData.getParameterName() + " " + para.getName());
}
outData.getParameterList().add(para);
// outData.setParameter(para);
} else if (tabitem.getData() instanceof OutPutMappingData) {
if (((OutPutMappingData) tabitem.getData()).getParameter() instanceof ParameterInfo) {
ParameterInfo para = ((OutPutMappingData) tabitem.getData()).getParameter();
if (outData.getParameterName() == null || "".equals(outData.getParameterName())) {
if (para.getParent() != null) {
String name = "";
if (((OutPutMappingData) tabitem.getData()).getParameterName() != null) {
name = ((OutPutMappingData) tabitem.getData()).getParameterName();
} else {
name = new ParameterInfoUtil().getParentName(para);
}
outData.setParameterName(name);
} else {
outData.setParameterName(para.getName());
}
} else {
outData.setParameterName(outData.getParameterName() + " " + para.getName());
}
outData.getParameterList().add(para);
// outData.setParameter(para);
}
}
tabelModel.remove(selevIndex);
tabelModel.add(outData, selevIndex);
}
}
TableItem[] items = draggableTable.getSelection();
if (items.length <= 0) {
return;
}
TableItem itemTarget = items[0];
itemTarget.setChecked(true);
createLinks(itemTarget, tabitem, tabelModel.getName());
}
}
Aggregations