Search in sources :

Example 1 with SelectionHelper

use of org.talend.commons.ui.runtime.swt.tableviewer.selection.SelectionHelper in project tdi-studio-se by Talend.

the class JSONToXPathLinker method removeFieldsListeners.

private void removeFieldsListeners() {
    JSONExtractorFieldModel schemaModel = this.fieldsTableEditorView.getModel();
    schemaModel.removeModifiedBeanListener(schemaModelModifiedBeanListener);
    schemaModel.removeModifiedListListener(schemaModelBeforeListenableListListener);
    schemaModel.removeModifiedListListener(schemaModelAfterListenableListListener);
    SelectionHelper selectionHelper = this.fieldsTableEditorView.getTableViewerCreator().getSelectionHelper();
    selectionHelper.removeAfterSelectionListener(fieldsTableLineSelectionListener);
}
Also used : SelectionHelper(org.talend.commons.ui.runtime.swt.tableviewer.selection.SelectionHelper)

Example 2 with SelectionHelper

use of org.talend.commons.ui.runtime.swt.tableviewer.selection.SelectionHelper in project tdi-studio-se by Talend.

the class JSONToXPathLinker method initFieldsListeners.

/**
     * DOC amaumont Comment method "initListeners".
     */
private void initFieldsListeners() {
    JSONExtractorFieldModel schemaModel = this.fieldsTableEditorView.getModel();
    final Table fieldsTable = this.fieldsTableEditorView.getTable();
    schemaModelModifiedBeanListener = new IModifiedBeanListener<SchemaTarget>() {

        @Override
        public void handleEvent(ModifiedBeanEvent<SchemaTarget> event) {
            handleModifiedBeanEvent(event);
        }

        private void handleModifiedBeanEvent(ModifiedBeanEvent<SchemaTarget> event) {
            if (event.column == fieldsTableEditorView.getXPathColumn()) {
                onXPathValueChanged(fieldsTable, (String) event.newValue, event.index);
            }
        }
    };
    schemaModel.addModifiedBeanListener(schemaModelModifiedBeanListener);
    schemaModelBeforeListenableListListener = new IListenableListListener<SchemaTarget>() {

        @Override
        public void handleEvent(ListenableListEvent<SchemaTarget> event) {
            handleListenableListBeforeTableViewerRefreshedEvent(event);
        }
    };
    schemaModel.addBeforeOperationListListener(-50, schemaModelBeforeListenableListListener);
    schemaModelAfterListenableListListener = new IListenableListListener<SchemaTarget>() {

        @Override
        public void handleEvent(ListenableListEvent<SchemaTarget> event) {
            handleListenableListAfterTableViewerRefreshedEvent(event);
        }
    };
    schemaModel.addAfterOperationListListener(schemaModelAfterListenableListListener);
    SelectionHelper selectionHelper = this.fieldsTableEditorView.getTableViewerCreator().getSelectionHelper();
    fieldsTableLineSelectionListener = new ILineSelectionListener() {

        @Override
        public void handle(LineSelectionEvent e) {
            updateLinksStyleAndControlsSelection(e.source.getTable(), true);
        }
    };
    selectionHelper.addAfterSelectionListener(fieldsTableLineSelectionListener);
}
Also used : LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) Table(org.eclipse.swt.widgets.Table) SelectionHelper(org.talend.commons.ui.runtime.swt.tableviewer.selection.SelectionHelper) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) SchemaTarget(org.talend.repository.model.json.SchemaTarget)

Example 3 with SelectionHelper

use of org.talend.commons.ui.runtime.swt.tableviewer.selection.SelectionHelper in project tdi-studio-se by Talend.

the class JSONToXPathLinker method initLoopListeners.

/**
     * DOC amaumont Comment method "initListeners".
     */
private void initLoopListeners() {
    JSONExtractorLoopModel loopModel = this.loopTableEditorView.getModel();
    final Table loopTable = this.loopTableEditorView.getTableViewerCreator().getTable();
    loopModelModifiedBeanListener = new IModifiedBeanListener<JSONXPathLoopDescriptor>() {

        @Override
        public void handleEvent(ModifiedBeanEvent<JSONXPathLoopDescriptor> event) {
            handleModifiedBeanEvent(event);
        }

        private void handleModifiedBeanEvent(ModifiedBeanEvent<JSONXPathLoopDescriptor> event) {
            if (event.column == loopTableEditorView.getXPathColumn()) {
                onXPathValueChanged(loopTable, (String) event.newValue, event.index);
            }
        }
    };
    loopModel.addModifiedBeanListener(loopModelModifiedBeanListener);
    loopTableExtendedControlListener = new IExtendedControlListener() {

        @Override
        public void handleEvent(ExtendedControlEvent event) {
            if (event.getType() == EVENT_TYPE.MODEL_CHANGED) {
                nodeRetriever.setCurrentLoopXPath(getCurrentLoopXPath());
            }
        }
    };
    this.loopTableEditorView.getExtendedTableViewer().addListener(loopTableExtendedControlListener);
    SelectionHelper selectionHelper = this.loopTableEditorView.getTableViewerCreator().getSelectionHelper();
    afterLineSelectionListener = new ILineSelectionListener() {

        @Override
        public void handle(LineSelectionEvent e) {
            updateLinksStyleAndControlsSelection(e.source.getTable(), true);
        }
    };
    selectionHelper.addAfterSelectionListener(afterLineSelectionListener);
}
Also used : JSONXPathLoopDescriptor(org.talend.repository.model.json.JSONXPathLoopDescriptor) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) Table(org.eclipse.swt.widgets.Table) SelectionHelper(org.talend.commons.ui.runtime.swt.tableviewer.selection.SelectionHelper) ExtendedControlEvent(org.talend.commons.ui.swt.extended.table.ExtendedControlEvent) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) IExtendedControlListener(org.talend.commons.ui.swt.extended.table.IExtendedControlListener)

Example 4 with SelectionHelper

use of org.talend.commons.ui.runtime.swt.tableviewer.selection.SelectionHelper in project tdi-studio-se by Talend.

the class JSONToXPathLinker method removeLoopListeners.

private void removeLoopListeners() {
    JSONExtractorLoopModel loopModel = this.loopTableEditorView.getModel();
    loopModel.removeModifiedBeanListener(loopModelModifiedBeanListener);
    this.loopTableEditorView.getExtendedTableViewer().removeListener(loopTableExtendedControlListener);
    SelectionHelper selectionHelper = this.loopTableEditorView.getTableViewerCreator().getSelectionHelper();
    selectionHelper.removeAfterSelectionListener(afterLineSelectionListener);
}
Also used : SelectionHelper(org.talend.commons.ui.runtime.swt.tableviewer.selection.SelectionHelper)

Aggregations

SelectionHelper (org.talend.commons.ui.runtime.swt.tableviewer.selection.SelectionHelper)4 Table (org.eclipse.swt.widgets.Table)2 ILineSelectionListener (org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener)2 LineSelectionEvent (org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent)2 ExtendedControlEvent (org.talend.commons.ui.swt.extended.table.ExtendedControlEvent)1 IExtendedControlListener (org.talend.commons.ui.swt.extended.table.IExtendedControlListener)1 JSONXPathLoopDescriptor (org.talend.repository.model.json.JSONXPathLoopDescriptor)1 SchemaTarget (org.talend.repository.model.json.SchemaTarget)1