Search in sources :

Example 1 with MetadataTableEditorExt

use of org.talend.designer.rowgenerator.ui.editor.MetadataTableEditorExt in project tdi-studio-se by Talend.

the class RowGeneratorUI method createSchemaComposite.

/**
     * qzhang Comment method "createSchemaComposite".
     */
private void createSchemaComposite() {
    outputMetaTable = externalNode.getMetadataList().get(0);
    uiManager.convert(externalNode, outputMetaTable, functionManager);
    //$NON-NLS-1$
    metadataTableEditor = new MetadataTableEditorExt(outputMetaTable, "", this.functionManager);
    metadataTableEditor.setRowGenUI(this);
    inputReadOnly = this.externalNode.getProcess().isReadOnly();
    if (this.externalNode.getOriginalNode().getJobletNode() != null) {
        inputReadOnly = this.externalNode.getOriginalNode().isReadOnly();
    } else if (this.externalNode.getOriginalNode().getJunitNode() != null) {
        inputReadOnly = true;
    }
    dataTableView = new MetadataTableEditorViewExt(datasFlowViewSashForm, SWT.BORDER, metadataTableEditor, inputReadOnly, !inputReadOnly, externalNode, functionManager);
    dataTableView.getExtendedTableViewer().setCommandStack(generatorManager.getCommandStack());
    dataTableView.setGeneratorUI(this);
    dataTableView.setShowDbTypeColumn(true, true, false);
    dataTableView.setShowDbColumnName(false, false);
    metadataTableEditor.setModifiedBeanListenable(dataTableView.getTableViewerCreator());
    // see bug 7471,record the modification of the column value.
    metadataTableEditor.addModifiedBeanListener(new IModifiedBeanListener<IMetadataColumn>() {

        @Override
        public void handleEvent(ModifiedBeanEvent<IMetadataColumn> event) {
            if (AbstractMetadataTableEditorView.ID_COLUMN_NAME.equals(event.column.getId())) {
                IMetadataColumn modifiedObject = event.bean;
                if (modifiedObject != null) {
                    String originalLabel = changedNameColumns.get(modifiedObject);
                    if (originalLabel == null) {
                        changedNameColumns.put(modifiedObject.getLabel(), (String) event.previousValue);
                    }
                }
            }
        }
    });
    // resize all the columns but not the table
    for (int i = 0; i < dataTableView.getTable().getColumnCount(); i++) {
        dataTableView.getTable().getColumn(i).pack();
    }
    dataTableView.getTable().getColumn(0).setWidth(0);
}
Also used : MetadataTableEditorExt(org.talend.designer.rowgenerator.ui.editor.MetadataTableEditorExt) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataTableEditorViewExt(org.talend.designer.rowgenerator.ui.editor.MetadataTableEditorViewExt)

Aggregations

IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)1 MetadataTableEditorExt (org.talend.designer.rowgenerator.ui.editor.MetadataTableEditorExt)1 MetadataTableEditorViewExt (org.talend.designer.rowgenerator.ui.editor.MetadataTableEditorViewExt)1