Search in sources :

Example 1 with MetadataEmfTableEditor

use of org.talend.core.ui.metadata.editor.MetadataEmfTableEditor in project tdi-studio-se by Talend.

the class JSONFileOutputStep3Form method addFields.

@Override
protected void addFields() {
    Composite mainComposite = Form.startNewDimensionnedGridLayout(this, 2, WIDTH_GRIDDATA_PIXEL, 60);
    metadataNameText = new LabelledText(mainComposite, "Name");
    metadataCommentText = new LabelledText(mainComposite, "Comment");
    Group groupMetaData = Form.createGroup(this, 1, "Schema", 280);
    Composite compositeMetaData = Form.startNewGridLayout(groupMetaData, 1);
    Composite compositeTable = Form.startNewDimensionnedGridLayout(compositeMetaData, 1, WIDTH_GRIDDATA_PIXEL, 200);
    compositeTable.setLayout(new FillLayout());
    metadataEditor = new MetadataEmfTableEditor("Description of the Schema");
    tableEditorView = new MetadataEmfTableEditorView(compositeTable, SWT.NONE);
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) MetadataEmfTableEditorView(org.talend.core.ui.metadata.editor.MetadataEmfTableEditorView) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) MetadataEmfTableEditor(org.talend.core.ui.metadata.editor.MetadataEmfTableEditor) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 2 with MetadataEmfTableEditor

use of org.talend.core.ui.metadata.editor.MetadataEmfTableEditor in project tdi-studio-se by Talend.

the class BRMSSchemaOutputDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);
    // Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayout(new FillLayout());
    tableEditor = new MetadataEmfTableEditor("");
    MetadataTable metadataTable = form.getMetadataOutputTable();
    tableEditor.setMetadataTable(metadataTable);
    tableEditor.removeAll();
    // List<MetadataColumn> list = (List<MetadataColumn>) metadataTable.getColumns();
    // tableEditor.addAll(list);
    // if (list.size() > 0) {
    // for (MetadataColumn column : list) {
    // boolean toAdd = true;
    // for (int i = 0; i < list.size(); i++) {
    // String label = column.getLabel();
    // String curLabel = list.get(i).getLabel();
    // if (label.equals(curLabel)) {
    // toAdd = false;
    // break;
    // }
    // }
    // if (toAdd) {
    // tableEditor.add(column);
    // }
    // }
    // }
    tableEditorView = new MetadataEmfTableEditorView(composite, SWT.NONE);
    tableEditorView.setMetadataEditor(tableEditor);
    addListeners();
    return composite;
}
Also used : MetadataEmfTableEditorView(org.talend.core.ui.metadata.editor.MetadataEmfTableEditorView) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) MetadataEmfTableEditor(org.talend.core.ui.metadata.editor.MetadataEmfTableEditor) GridData(org.eclipse.swt.layout.GridData) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 3 with MetadataEmfTableEditor

use of org.talend.core.ui.metadata.editor.MetadataEmfTableEditor in project tdi-studio-se by Talend.

the class JSONFileMetadataEmfToolbarEditor method createAddPushButton.

@Override
protected AddPushButton createAddPushButton() {
    return new AddPushButtonForExtendedTable(this.toolbar, getExtendedTableViewer()) {

        @Override
        protected Object getObjectToAdd() {
            MetadataEmfTableEditor tableEditorModel = (MetadataEmfTableEditor) getExtendedTableViewer().getExtendedControlModel();
            if (tableEditorModel.getMetadataTable() == null) {
                tableEditorModel.setMetadataTable(ConnectionFactory.eINSTANCE.createMetadataTable());
            }
            MetadataColumn metadatacolumn = tableEditorModel.createNewMetadataColumn(dbmsId);
            return metadatacolumn;
        }
    };
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) AddPushButtonForExtendedTable(org.talend.commons.ui.swt.advanced.dataeditor.button.AddPushButtonForExtendedTable) MetadataEmfTableEditor(org.talend.core.ui.metadata.editor.MetadataEmfTableEditor)

Example 4 with MetadataEmfTableEditor

use of org.talend.core.ui.metadata.editor.MetadataEmfTableEditor in project tdi-studio-se by Talend.

the class JSONTree2SchemaDragAndDropHandler method addColumn.

private void addColumn(String label, FOXTreeNode node, EList columnList) {
    if (StringUtils.isEmpty(label)) {
        return;
    }
    MetadataEmfTableEditor editor = new MetadataEmfTableEditor();
    String columnName = label;
    if (columnName.contains(":")) {
        //$NON-NLS-1$
        //$NON-NLS-1$
        columnName = columnName.split(":")[1];
    }
    //$NON-NLS-1$
    columnName = columnName.replaceAll("[^a-zA-Z0-9]", "_");
    String dataType = node.getDataType();
    MetadataColumn metadataColumn = ConnectionFactory.eINSTANCE.createMetadataColumn();
    metadataColumn.setLabel(editor.getNextGeneratedColumnName(columnName, columnList));
    metadataColumn.setOriginalField(label);
    metadataColumn.setTalendType(dataType);
    columnList.add(metadataColumn);
    node.setColumn(ConvertionHelper.convertToIMetaDataColumn(metadataColumn));
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) MetadataEmfTableEditor(org.talend.core.ui.metadata.editor.MetadataEmfTableEditor)

Example 5 with MetadataEmfTableEditor

use of org.talend.core.ui.metadata.editor.MetadataEmfTableEditor in project tdi-studio-se by Talend.

the class HL7UI method createContent.

/**
     * Comment method "createContent".
     * 
     * @param child
     */
private void createContent(Composite mainComposite) {
    judgeRepository();
    header = new HeaderComposite(mainComposite, SWT.NONE, this.filePath, startChar, endChar, hl7Manager, this.isRepository);
    MsgToSchemaSash = new SashForm(mainComposite, SWT.HORIZONTAL | SWT.SMOOTH);
    MsgToSchemaSash.setLayoutData(new GridData(GridData.FILL_BOTH));
    MsgToSchemaSash.setBackgroundMode(SWT.INHERIT_FORCE);
    addMessageViewer(MsgToSchemaSash, 300, 110);
    addSchemaViewer(MsgToSchemaSash, 400, 110);
    MsgToSchemaSash.setWeights(new int[] { 40, 60 });
    linker = new HL7Tree2SchemaLinker(this.MsgToSchemaSash, this.isRepository);
    linker.setMainui(this);
    hl7SchemaEditorView.setLinker(linker);
    GridData data2 = new GridData(GridData.FILL_HORIZONTAL);
    data2.heightHint = 300;
    hl7SchemaEditorView.initGraphicComponents();
    final Composite tableEditorComposite = hl7SchemaEditorView.getMainComposite();
    tableEditorComposite.setLayoutData(data2);
    tableEditorComposite.setBackground(null);
    //$NON-NLS-1$
    metadataEditor = new MetadataEmfTableEditor("");
    //$NON-NLS-1$
    metadataEditor.setDefaultLabel("newColumn");
    metadataEditor.registerDataList(new ArrayList());
    hl7SchemaEditorView.setMetadataEditor(metadataEditor);
    linker.init(messageViewer, hl7SchemaEditorView);
    linker.setManager(hl7Manager);
    initMessageTree();
    new FooterComposite(mainComposite, SWT.NONE, hl7Manager);
    initSchemaCombo(externalNode.getMetadataList());
    initTableViewer();
    initlinkers();
    boolean jobReadOnly = externalNode.getProcess().isReadOnly();
    if (externalNode.getOriginalNode().getJobletNode() != null) {
        jobReadOnly = externalNode.getOriginalNode().isReadOnly();
    }
    if (jobReadOnly || isRepository) {
        hl7SchemaEditorView.setReadOnly(true);
    }
    addModifylistener();
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) HeaderComposite(org.talend.designer.hl7.ui.header.HeaderComposite) Composite(org.eclipse.swt.widgets.Composite) FooterComposite(org.talend.designer.hl7.ui.footer.FooterComposite) MetadataEmfTableEditor(org.talend.core.ui.metadata.editor.MetadataEmfTableEditor) FooterComposite(org.talend.designer.hl7.ui.footer.FooterComposite) HeaderComposite(org.talend.designer.hl7.ui.header.HeaderComposite) GridData(org.eclipse.swt.layout.GridData) ArrayList(java.util.ArrayList) HL7Tree2SchemaLinker(org.talend.designer.hl7.edit.HL7Tree2SchemaLinker)

Aggregations

MetadataEmfTableEditor (org.talend.core.ui.metadata.editor.MetadataEmfTableEditor)15 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)10 Composite (org.eclipse.swt.widgets.Composite)7 FillLayout (org.eclipse.swt.layout.FillLayout)6 MetadataEmfTableEditorView (org.talend.core.ui.metadata.editor.MetadataEmfTableEditorView)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 IModel (org.talend.designer.hl7.model.IModel)5 HL7MultiSchemaUI (org.talend.designer.hl7.ui.HL7MultiSchemaUI)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Command (org.eclipse.gef.commands.Command)4 ExtendedTableResetDBTypesCommand (org.talend.core.ui.metadata.extended.command.ExtendedTableResetDBTypesCommand)4 MetadataEmfExportXmlCommand (org.talend.core.ui.metadata.extended.command.MetadataEmfExportXmlCommand)4 MetadataEmfImportXmlCommand (org.talend.core.ui.metadata.extended.command.MetadataEmfImportXmlCommand)4 MetadataEmfPasteCommand (org.talend.core.ui.metadata.extended.command.MetadataEmfPasteCommand)4 Group (org.eclipse.swt.widgets.Group)3 LabelledText (org.talend.commons.ui.swt.formtools.LabelledText)3 GridData (org.eclipse.swt.layout.GridData)2 AddPushButtonForExtendedTable (org.talend.commons.ui.swt.advanced.dataeditor.button.AddPushButtonForExtendedTable)2 ExtendedTableModel (org.talend.commons.ui.swt.extended.table.ExtendedTableModel)2