Search in sources :

Example 31 with TableItem

use of org.eclipse.swt.widgets.TableItem in project tdi-studio-se by Talend.

the class MultiSchemasShadowProcessPreview method refreshPreviewItem.

@Override
protected void refreshPreviewItem(List<String[]> csvRows, boolean firstRowIsLabel, int... selectedColumnIndex) {
    setSelectColumnIndex(selectedColumnIndex[0]);
    int existingItemCount = table.getItemCount();
    int end = csvRows.size();
    if (firstRowIsLabel) {
        end--;
    }
    showCheckImageOnColumn(selectedColumnIndex);
    for (int f = 0; f < end; f++) {
        String[] csvFields;
        if (firstRowIsLabel) {
            csvFields = csvRows.get(f + 1);
        } else {
            csvFields = csvRows.get(f);
        }
        String[] values = csvFields;
        if (f >= existingItemCount) {
            // create a new Item
            TableItem row = new TableItem(table, SWT.NONE);
            row.setText(values);
        } else {
            // update an existing Item
            table.getItem(f).setText(values);
        }
    }
    table.setRedraw(true);
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem)

Example 32 with TableItem

use of org.eclipse.swt.widgets.TableItem in project tdi-studio-se by Talend.

the class SchemaXMLLinker method addLink.

/**
     * amaumont Comment method "addLink".
     * 
     * @param tableItem
     * @param dataItem1
     * @param tree
     * @param dataItem2
     */
private LinkDescriptor<Item, Object, Tree, Object> addLink(Item tableItem, Object dataItem1, Tree tree, Object dataItem2, boolean lastOne) {
    LinkDescriptor<Item, Object, Tree, Object> link = new LinkDescriptor<Item, Object, Tree, Object>(new ItemExtremityDescriptor(tableItem, dataItem1), new ExtremityLink<Tree, Object>(tree, dataItem2));
    link.setStyleLink(getUnselectedStyleLink());
    getLinksManager().addLink(link);
    updateLinksStyleAndControlsSelection(tree, lastOne);
    return link;
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) TreeItem(org.eclipse.swt.widgets.TreeItem) Item(org.eclipse.swt.widgets.Item) ItemExtremityDescriptor(org.talend.commons.ui.swt.drawing.link.ItemExtremityDescriptor) Tree(org.eclipse.swt.widgets.Tree) LinkDescriptor(org.talend.commons.ui.swt.drawing.link.LinkDescriptor)

Example 33 with TableItem

use of org.eclipse.swt.widgets.TableItem in project tdi-studio-se by Talend.

the class SchemaXMLLinker method createLoopLinks.

private void createLoopLinks(List<HL7TreeNode> treeData) {
    for (HL7TreeNode treeNode : treeData) {
        if (treeNode.getColumn() != null) {
            TableItem tableItem = null;
            for (TableItem curTableItem : getSource().getItems()) {
                if (curTableItem.getText().equals(treeNode.getColumn().getLabel())) {
                    tableItem = curTableItem;
                    break;
                }
            }
            if (tableItem == null) {
                continue;
            }
            String path = tableItem.getText();
            if (path != null) {
                TreeItem treeItem = getTreeItem(treeNode);
                if (treeItem != null) {
                    addLoopLink(tableItem, tableItem.getData(), xmlViewer.getTree(), (HL7TreeNode) treeItem.getData(), false);
                }
            }
        }
        createLoopLinks(treeNode.getChildren());
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) TableItem(org.eclipse.swt.widgets.TableItem) HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode)

Example 34 with TableItem

use of org.eclipse.swt.widgets.TableItem 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();
}
Also used : Table(org.eclipse.swt.widgets.Table) TableItem(org.eclipse.swt.widgets.TableItem)

Example 35 with TableItem

use of org.eclipse.swt.widgets.TableItem in project tdi-studio-se by Talend.

the class MultipleSurrogateSection method createNewItem.

public void createNewItem(final SurrogateKey key) {
    tableModel.add(key);
    table.setRedraw(false);
    final TableItem item = new TableItem(table, SWT.NONE);
    initTableItem(key, item);
    table.setRedraw(true);
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem)

Aggregations

TableItem (org.eclipse.swt.widgets.TableItem)475 Point (org.eclipse.swt.graphics.Point)136 Table (org.eclipse.swt.widgets.Table)125 TableColumn (org.eclipse.swt.widgets.TableColumn)79 SelectionEvent (org.eclipse.swt.events.SelectionEvent)73 GridData (org.eclipse.swt.layout.GridData)70 GridLayout (org.eclipse.swt.layout.GridLayout)61 Composite (org.eclipse.swt.widgets.Composite)56 ArrayList (java.util.ArrayList)55 Image (org.eclipse.swt.graphics.Image)55 Button (org.eclipse.swt.widgets.Button)53 Rectangle (org.eclipse.swt.graphics.Rectangle)52 Label (org.eclipse.swt.widgets.Label)51 Shell (org.eclipse.swt.widgets.Shell)49 Color (org.eclipse.swt.graphics.Color)48 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)43 Text (org.eclipse.swt.widgets.Text)42 FillLayout (org.eclipse.swt.layout.FillLayout)40 Test (org.junit.Test)39 SelectionListener (org.eclipse.swt.events.SelectionListener)36