use of org.eclipse.swt.widgets.Table in project tdi-studio-se by Talend.
the class FieldSection method getDragItemsAsText.
/*
* (non-Javadoc)
*
* @see org.talend.designer.scd.ui.IDragDrop#getDragItemsAsText()
*/
public String getDragItemsAsText() {
tableViewer.cancelEditing();
Table table = tableViewer.getTable();
TableItem[] selection = table.getSelection();
StringBuffer buf = new StringBuffer();
// number of selected elements
buf.append(selection.length);
for (TableItem element : selection) {
buf.append('|');
buf.append(element.getText());
}
return buf.toString();
}
use of org.eclipse.swt.widgets.Table in project tdi-studio-se by Talend.
the class StatusEditor method createTable.
@Override
protected Table createTable(Composite parent) {
Table contextTable = new Table(parent, SWT.BORDER | SWT.SINGLE);
contextTable.setLinesVisible(true);
contextTable.setHeaderVisible(true);
TableColumn colName = new TableColumn(contextTable, SWT.NONE);
//$NON-NLS-1$
colName.setText(Messages.getString("StatusEditor.codeColumnTitle"));
colName.setWidth(60);
TableColumn colValue = new TableColumn(contextTable, SWT.NONE);
//$NON-NLS-1$
colValue.setText(Messages.getString("StatusEditor.labelColumnTitle"));
colValue.setWidth(150);
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
parent.setEnabled(false);
}
return contextTable;
}
use of org.eclipse.swt.widgets.Table in project tdi-studio-se by Talend.
the class StatusManagerSettingPage method addItemTableViewer.
private void addItemTableViewer(Composite rightComposite) {
Composite composite = new Composite(rightComposite, SWT.NONE);
composite.setLayout(new GridLayout());
GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
addItemsOption(composite);
itemTable = new Table(composite, SWT.MULTI | SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, true).applyTo(itemTable);
itemTable.setHeaderVisible(true);
itemTable.setLinesVisible(true);
//
TableColumn itemColumn = new TableColumn(itemTable, SWT.CENTER);
//$NON-NLS-1$
itemColumn.setText(Messages.getString("VersionManagementDialog.Items"));
itemColumn.setWidth(110);
TableColumn oldVersionColumn = new TableColumn(itemTable, SWT.CENTER);
//$NON-NLS-1$
oldVersionColumn.setText(Messages.getString("StatusManagementDialog.Status"));
oldVersionColumn.setWidth(90);
TableColumn versionColumn = new TableColumn(itemTable, SWT.CENTER);
//$NON-NLS-1$
versionColumn.setText(Messages.getString("StatusManagementDialog.NewStatus"));
versionColumn.setWidth(92);
final TableColumn delColumn = new TableColumn(itemTable, SWT.CENTER);
//$NON-NLS-1$
delColumn.setText("");
delColumn.setWidth(26);
delColumn.setResizable(false);
versionColumn.addControlListener(new ControlListener() {
@Override
public void controlMoved(ControlEvent e) {
//
}
@Override
public void controlResized(ControlEvent e) {
if (!isFixedstatus()) {
refreshTableItems();
}
}
});
itemTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
checkButtonsState();
}
});
}
use of org.eclipse.swt.widgets.Table in project tdi-studio-se by Talend.
the class JsonFieldModel method addAll.
@Override
public void addAll(final Integer index, List<Map<String, Object>> beans, boolean fireBefore, boolean fireAfter) {
super.addAll(index, beans, fireBefore, fireAfter);
TableViewer tableViewer = getTableViewer();
if (tableViewer != null) {
Table table = tableViewer.getTable();
table.pack();
table.layout();
}
}
use of org.eclipse.swt.widgets.Table in project tdi-studio-se by Talend.
the class TableController method estimateRowSize.
/*
* (non-Javadoc)
*
* @see
* org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController#estimateRowSize
* (org.eclipse.swt.widgets.Composite, org.talend.core.model.process.IElementParameter)
*/
@Override
public int estimateRowSize(Composite subComposite, IElementParameter param) {
PropertiesTableEditorModel<Map<String, Object>> tableEditorModel = new PropertiesTableEditorModel<Map<String, Object>>();
updateTableValues(param);
tableEditorModel.setData(elem, param, part.getProcess());
PropertiesTableEditorView<Map<String, Object>> tableEditorView = new PropertiesTableEditorView<Map<String, Object>>(subComposite, SWT.NONE, tableEditorModel, !param.isBasedOnSchema(), false);
tableEditorView.getExtendedTableViewer().setCommandStack(getCommandStack());
tableEditorView.setReadOnly(param.isReadOnly());
final Table table = tableEditorView.getTable();
int toolbarSize = 0;
if (!param.isBasedOnSchema()) {
Point size = tableEditorView.getExtendedToolbar().getToolbar().computeSize(SWT.DEFAULT, SWT.DEFAULT);
toolbarSize = size.y + 5;
}
int currentHeightEditor = table.getHeaderHeight() + ((List) param.getValue()).size() * table.getItemHeight() + table.getItemHeight() + toolbarSize;
int minHeightEditor = table.getHeaderHeight() + getNumberLines(param) * table.getItemHeight() + table.getItemHeight() + toolbarSize;
tableEditorView.getMainComposite().dispose();
int ySize2 = Math.max(currentHeightEditor, minHeightEditor);
return ySize2 + ITabbedPropertyConstants.VSPACE;
}
Aggregations