Search in sources :

Example 1 with ArrayIndexList

use of org.talend.designer.webservice.data.ArrayIndexList in project tdi-studio-se by Talend.

the class AddArrayIndexForParentsDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    Composite createDialogArea = (Composite) super.createDialogArea(parent);
    FillLayout layout = new FillLayout();
    // layout.horizontalSpacing = 1;
    // layout.numColumns = 1;
    GridData data = new GridData(GridData.FILL_BOTH);
    createDialogArea.setLayout(layout);
    createDialogArea.setLayoutData(data);
    table = new TableViewer(createDialogArea, SWT.FULL_SELECTION | SWT.BORDER);
    new TableColumn(table.getTable(), SWT.LEFT).setText(COLUMN_NAME[0]);
    table.getTable().getColumn(0).pack();
    new TableColumn(table.getTable(), SWT.LEFT).setText(COLUMN_NAME[1]);
    table.getTable().getColumn(1).pack();
    table.getTable().setHeaderVisible(true);
    table.getTable().setLinesVisible(true);
    table.setContentProvider(new IndexContentProvider());
    table.setLabelProvider(new IndexLabelProvider());
    table.setInput(arrayIndexList);
    table.setColumnProperties(COLUMN_NAME);
    CellEditor[] editors = new CellEditor[2];
    editors[0] = null;
    editors[1] = new TextCellEditor(table.getTable());
    table.setCellEditors(editors);
    table.setCellModifier(new ICellModifier() {

        public boolean canModify(Object element, String property) {
            if (property.equals(COLUMN_NAME[0]))
                return false;
            return true;
        }

        public Object getValue(Object element, String property) {
            ArrayIndexList index = (ArrayIndexList) element;
            if (property.equals(COLUMN_NAME[1])) {
                if (index.getIndexNum() != null) {
                    return index.getIndexNum();
                } else {
                    return "";
                }
            }
            return null;
        }

        public void modify(Object element, String property, Object value) {
            if (element instanceof Item)
                element = ((Item) element).getData();
            ArrayIndexList index = (ArrayIndexList) element;
            if (property.equals(COLUMN_NAME[1]))
                index.setIndexNum((String) value);
            table.refresh();
        }
    });
    return createDialogArea;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) CellEditor(org.eclipse.jface.viewers.CellEditor) FillLayout(org.eclipse.swt.layout.FillLayout) TableColumn(org.eclipse.swt.widgets.TableColumn) Item(org.eclipse.swt.widgets.Item) GridData(org.eclipse.swt.layout.GridData) ICellModifier(org.eclipse.jface.viewers.ICellModifier) ArrayIndexList(org.talend.designer.webservice.data.ArrayIndexList) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 2 with ArrayIndexList

use of org.talend.designer.webservice.data.ArrayIndexList in project tdi-studio-se by Talend.

the class AddArrayIndexForParentsDialog method createParentsArrayIndexItem.

/**
     * DOC gcui Comment method "createParentsArrayIndexItem".
     */
private List<ArrayIndexList> createParentsArrayIndexItem(ParameterInfo itemPara) {
    List<ParameterInfo> allArray = getAllArrayFromParents(itemPara, null);
    for (int i = 0; i < allArray.size(); i++) {
        String name = allArray.get(i).getName();
        ArrayIndexList indexItem = new ArrayIndexList(name);
        arrayIndexList.add(indexItem);
    }
    return arrayIndexList;
}
Also used : ArrayIndexList(org.talend.designer.webservice.data.ArrayIndexList) ParameterInfo(org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)

Aggregations

ArrayIndexList (org.talend.designer.webservice.data.ArrayIndexList)2 CellEditor (org.eclipse.jface.viewers.CellEditor)1 ICellModifier (org.eclipse.jface.viewers.ICellModifier)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 GridData (org.eclipse.swt.layout.GridData)1 Composite (org.eclipse.swt.widgets.Composite)1 Item (org.eclipse.swt.widgets.Item)1 TableColumn (org.eclipse.swt.widgets.TableColumn)1 ParameterInfo (org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)1