Search in sources :

Example 1 with MetadataTableEditorViewExt

use of org.talend.designer.rowgenerator.ui.editor.MetadataTableEditorViewExt 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)

Example 2 with MetadataTableEditorViewExt

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

the class RowGenMain method addAllControlForKeyListener.

/**
     * qzhang Comment method "addAllControlForKeyListener".
     * 
     * @param parent
     * @param keyAdapter
     * @return
     */
private void addAllControlForKeyListener(Control parent) {
    KeyAdapter keyAdapter = new KeyAdapter() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.KeyAdapter#keyReleased(org.eclipse.swt.events.KeyEvent)
             */
        @Override
        public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.F5) {
                MetadataTableEditorViewExt viewExt = generatorUI.getDataTableView();
                viewExt.refreshPreviewColumn();
            }
        }
    };
    parent.addKeyListener(keyAdapter);
    if (parent instanceof Composite) {
        Control[] children = ((Composite) parent).getChildren();
        for (Control control : children) {
            if (control != null && !control.isDisposed()) {
                addAllControlForKeyListener(control);
            }
        }
    }
}
Also used : KeyEvent(org.eclipse.swt.events.KeyEvent) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) KeyAdapter(org.eclipse.swt.events.KeyAdapter) MetadataTableEditorViewExt(org.talend.designer.rowgenerator.ui.editor.MetadataTableEditorViewExt)

Example 3 with MetadataTableEditorViewExt

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

the class TabFolderEditors method refreshPreview.

/**
     * qzhang Comment method "refreshPreview".
     */
public void refreshPreview(String number) {
    MetadataTableEditorViewExt editor2 = (MetadataTableEditorViewExt) generatorUI.getDataTableView();
    processPreview.refreshTablePreview(editor2.getMetadataTableEditor().getMetadataColumnList(), getItemsByRunJob(number), true);
}
Also used : MetadataTableEditorViewExt(org.talend.designer.rowgenerator.ui.editor.MetadataTableEditorViewExt)

Aggregations

MetadataTableEditorViewExt (org.talend.designer.rowgenerator.ui.editor.MetadataTableEditorViewExt)3 KeyAdapter (org.eclipse.swt.events.KeyAdapter)1 KeyEvent (org.eclipse.swt.events.KeyEvent)1 Composite (org.eclipse.swt.widgets.Composite)1 Control (org.eclipse.swt.widgets.Control)1 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)1 MetadataTableEditorExt (org.talend.designer.rowgenerator.ui.editor.MetadataTableEditorExt)1