Search in sources :

Example 1 with ExtractionLoopWithJSONXPathEditorView

use of org.talend.repository.json.ui.wizards.extraction.ExtractionLoopWithJSONXPathEditorView in project tdi-studio-se by Talend.

the class JSONFileStep2Form method addGroupSchemaTarget.

private void addGroupSchemaTarget(final Composite mainComposite, final int width, final int height) {
    // Group Schema Viewer
    schemaTargetGroup = Form.createGroup(mainComposite, 1, "Target Schema", height);
    // to correct graphic bug under Linux-GTK when the wizard is opened the first time
    if (WindowSystem.isGTK() && firstTimeWizardOpened.equals(Boolean.TRUE)) {
        schemaTargetGroup.addListener(SWT.Paint, new Listener() {

            @Override
            public void handleEvent(Event event) {
                Point offsetPoint = event.display.map(linker.getBgDrawableComposite(), schemaTargetGroup, new Point(0, 0));
                linker.setOffset(offsetPoint);
                linker.drawBackground(event.gc);
            }
        });
    }
    // ///////////////////////////////////////////
    schemaTargetGroup.setBackgroundMode(SWT.INHERIT_FORCE);
    CommandStackForComposite commandStack = new CommandStackForComposite(schemaTargetGroup);
    loopModel = new JSONExtractorLoopModel("Path loop expression");
    loopTableEditorView = new ExtractionLoopWithJSONXPathEditorView(loopModel, schemaTargetGroup);
    loopTableEditorView.getExtendedTableViewer().setCommandStack(commandStack);
    GridData data2 = new GridData(GridData.FILL_HORIZONTAL);
    data2.heightHint = 90;
    final Composite loopTableEditorComposite = loopTableEditorView.getMainComposite();
    loopTableEditorComposite.setLayoutData(data2);
    loopTableEditorComposite.setBackground(null);
    // to correct graphic bug under Linux-GTK when the wizard is opened the first time
    if (WindowSystem.isGTK() && firstTimeWizardOpened.equals(Boolean.TRUE)) {
        loopTableEditorComposite.addListener(SWT.Paint, new Listener() {

            @Override
            public void handleEvent(Event event) {
                Point offsetPoint = event.display.map(linker.getBgDrawableComposite(), loopTableEditorComposite, new Point(0, 0));
                linker.setOffset(offsetPoint);
                linker.drawBackground(event.gc);
            }
        });
    }
    // ///////////////////////////////////////////
    // Messages.getString("FileStep3.metadataDescription")
    fieldsModel = new JSONExtractorFieldModel("Fields to extract");
    fieldsTableEditorView = new ExtractionFieldsWithJSONXPathEditorView(fieldsModel, schemaTargetGroup);
    fieldsTableEditorView.getExtendedTableViewer().setCommandStack(commandStack);
    final Composite fieldTableEditorComposite = fieldsTableEditorView.getMainComposite();
    data2 = new GridData(GridData.FILL_BOTH);
    data2.heightHint = 180;
    fieldTableEditorComposite.setLayoutData(data2);
    fieldTableEditorComposite.setBackground(null);
    // to correct graphic bug under Linux-GTK when the wizard is opened the first time
    if (WindowSystem.isGTK() && firstTimeWizardOpened.equals(Boolean.TRUE)) {
        fieldTableEditorComposite.addListener(SWT.Paint, new Listener() {

            @Override
            public void handleEvent(Event event) {
                Point offsetPoint = event.display.map(linker.getBgDrawableComposite(), fieldTableEditorComposite, new Point(0, 0));
                linker.setOffset(offsetPoint);
                linker.drawBackground(event.gc);
            }
        });
    }
// ///////////////////////////////////////////
}
Also used : CommandStackForComposite(org.talend.commons.ui.command.CommandStackForComposite) JSONExtractorFieldModel(org.talend.repository.json.ui.wizards.extraction.JSONExtractorFieldModel) IModifiedBeanListener(org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener) IPreviewHandlerListener(org.talend.metadata.managment.ui.preview.IPreviewHandlerListener) IListenableListListener(org.talend.commons.utils.data.list.IListenableListListener) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) CommandStackForComposite(org.talend.commons.ui.command.CommandStackForComposite) ExtractionLoopWithJSONXPathEditorView(org.talend.repository.json.ui.wizards.extraction.ExtractionLoopWithJSONXPathEditorView) GridData(org.eclipse.swt.layout.GridData) ListenableListEvent(org.talend.commons.utils.data.list.ListenableListEvent) Event(org.eclipse.swt.widgets.Event) ModifiedBeanEvent(org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ExtractionFieldsWithJSONXPathEditorView(org.talend.repository.json.ui.wizards.extraction.ExtractionFieldsWithJSONXPathEditorView) Point(org.eclipse.swt.graphics.Point) JSONExtractorLoopModel(org.talend.repository.json.ui.wizards.extraction.JSONExtractorLoopModel)

Aggregations

SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Point (org.eclipse.swt.graphics.Point)1 GridData (org.eclipse.swt.layout.GridData)1 Composite (org.eclipse.swt.widgets.Composite)1 Event (org.eclipse.swt.widgets.Event)1 Listener (org.eclipse.swt.widgets.Listener)1 CommandStackForComposite (org.talend.commons.ui.command.CommandStackForComposite)1 IModifiedBeanListener (org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener)1 ModifiedBeanEvent (org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent)1 IListenableListListener (org.talend.commons.utils.data.list.IListenableListListener)1 ListenableListEvent (org.talend.commons.utils.data.list.ListenableListEvent)1 IPreviewHandlerListener (org.talend.metadata.managment.ui.preview.IPreviewHandlerListener)1 ExtractionFieldsWithJSONXPathEditorView (org.talend.repository.json.ui.wizards.extraction.ExtractionFieldsWithJSONXPathEditorView)1 ExtractionLoopWithJSONXPathEditorView (org.talend.repository.json.ui.wizards.extraction.ExtractionLoopWithJSONXPathEditorView)1 JSONExtractorFieldModel (org.talend.repository.json.ui.wizards.extraction.JSONExtractorFieldModel)1 JSONExtractorLoopModel (org.talend.repository.json.ui.wizards.extraction.JSONExtractorLoopModel)1