Search in sources :

Example 1 with ChainPage

use of eu.esdihumboldt.hale.io.appschema.ui.FeatureChainingConfigurationPage.ChainPage in project hale by halestudio.

the class WorkspaceConfigurationPage method createContent.

/**
 * @see eu.esdihumboldt.hale.ui.HaleWizardPage#createContent(org.eclipse.swt.widgets.Composite)
 */
@Override
protected void createContent(Composite page) {
    Composite main = new Composite(page, SWT.NONE);
    main.setLayout(new GridLayout(3, false));
    Composite tableParent = new Composite(main, SWT.NONE);
    TableColumnLayout layout = new TableColumnLayout();
    tableParent.setLayout(layout);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 2);
    gridData.minimumHeight = 150;
    tableParent.setLayoutData(gridData);
    workspaceTableViewer = new TableViewer(tableParent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    workspaceTableViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 2));
    workspaceTableViewer.setContentProvider(ArrayContentProvider.getInstance());
    workspaceTableViewer.getTable().setHeaderVisible(true);
    workspaceTableViewer.getTable().setLinesVisible(true);
    // disable selection on table viewer
    workspaceTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            // prevent selection
            if (!event.getSelection().isEmpty()) {
                workspaceTableViewer.setSelection(StructuredSelection.EMPTY);
            }
        }
    });
    TableViewerColumn nameColumn = new TableViewerColumn(workspaceTableViewer, SWT.NONE);
    layout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(2, true));
    nameColumn.setLabelProvider(new WorkspaceNameLabelProvider());
    nameColumn.getColumn().setText("Name");
    nameColumn.setEditingSupport(new WorkspaceNameEditingSupport(workspaceTableViewer));
    TableViewerColumn isolatedColumn = new TableViewerColumn(workspaceTableViewer, SWT.NONE);
    layout.setColumnData(isolatedColumn.getColumn(), new ColumnWeightData(1, true));
    isolatedColumn.setLabelProvider(new WorkspaceIsolatedLabelProvider());
    isolatedColumn.getColumn().setText("Isolated");
    isolatedColumn.setEditingSupport(new WorkspaceIsolatedEditingSupport(workspaceTableViewer));
    TableViewerColumn namespaceColumn = new TableViewerColumn(workspaceTableViewer, SWT.NONE);
    layout.setColumnData(namespaceColumn.getColumn(), new ColumnWeightData(3, true));
    namespaceColumn.setLabelProvider(new WorkspaceNamespaceLabelProvider());
    namespaceColumn.getColumn().setText("Namespace");
    TableViewerColumn featuresColumn = new TableViewerColumn(workspaceTableViewer, SWT.NONE);
    layout.setColumnData(featuresColumn.getColumn(), new ColumnWeightData(3, true));
    featuresColumn.setLabelProvider(new WorkspaceFeaturesLabelProvider());
    featuresColumn.getColumn().setText("Features");
    IWizardContainer container = getContainer();
    if (container instanceof WizardDialog) {
        changeListener = new IPageChangingListener() {

            @Override
            public void handlePageChanging(PageChangingEvent event) {
                Object currentPage = event.getCurrentPage();
                Object targetPage = event.getTargetPage();
                if ((currentPage instanceof FeatureChainingConfigurationPage || currentPage instanceof ChainPage) && targetPage instanceof WorkspaceConfigurationPage) {
                    goingBack = false;
                } else if (currentPage instanceof AppSchemaDataStoreConfigurationPage && targetPage instanceof WorkspaceConfigurationPage) {
                    goingBack = true;
                }
            }
        };
        WizardDialog dialog = (WizardDialog) container;
        dialog.addPageChangingListener(changeListener);
    } else {
        changeListener = null;
    }
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IPageChangingListener(org.eclipse.jface.dialogs.IPageChangingListener) IWizardContainer(org.eclipse.jface.wizard.IWizardContainer) ChainPage(eu.esdihumboldt.hale.io.appschema.ui.FeatureChainingConfigurationPage.ChainPage) GridLayout(org.eclipse.swt.layout.GridLayout) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) PageChangingEvent(org.eclipse.jface.dialogs.PageChangingEvent) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

ChainPage (eu.esdihumboldt.hale.io.appschema.ui.FeatureChainingConfigurationPage.ChainPage)1 IPageChangingListener (org.eclipse.jface.dialogs.IPageChangingListener)1 PageChangingEvent (org.eclipse.jface.dialogs.PageChangingEvent)1 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)1 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)1 IWizardContainer (org.eclipse.jface.wizard.IWizardContainer)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1