private Section createAEConfigSection()

in uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/MasterDetails.java [184:281]


  private Section createAEConfigSection(Composite parent, FormToolkit toolkit) {
    TableWrapData td;

    Section section = FormSection.createGridDataSection(toolkit, parent, SWT.NONE,
            Messages.DDE_AEConfigPage_AEConfigTree_Section_Title,
            Messages.DDE_AEConfigPage_AEConfigTree_Section_Description, 10, 10, GridData.FILL_BOTH
                    | GridData.VERTICAL_ALIGN_BEGINNING, 1, 1);
    section.clientVerticalSpacing = 10;
    section.setExpanded(true);
    section.addExpansionListener(new ExpansionAdapter() {
      public void expansionStateChanged(ExpansionEvent e) {
        form.reflow(true);
      }
    });
    spart = new SectionPart(section);
    managedForm.addPart(spart);

    // Create ToolBar
    Composite sectionToolbarComposite = FormSection.createGridLayoutContainer(toolkit, section, 4,
            0, 0);
    section.setTextClient(sectionToolbarComposite);
    toolkit.createCompositeSeparator(section);

    // //////////////////

    Composite sectionClient = toolkit.createComposite(section);
    section.setClient(sectionClient);
    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = 2;
    layout.marginWidth = 2;
    sectionClient.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    sectionClient.setLayoutData(gd);
    toolkit.paintBordersFor(sectionClient);

    // /////////////////////////////////////////////////////////////////////

    final Tree tree = toolkit.createTree(sectionClient, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    gd = new GridData(GridData.FILL_BOTH);
    gd.grabExcessVerticalSpace = true;
    tree.setLayoutData(gd);
    tree.setLinesVisible(true);
    tree.setHeaderVisible(true);
    String headers[] = { "Element", "Remote", "Instances" };
    final TreeColumn columns[] = new TreeColumn[headers.length];
    for (int i = 0; i < headers.length; i++) {
      int style;
      if (i==0) {
        style = SWT.NONE;
      } else {
        style = SWT.CENTER;
      }
      TreeColumn tc = new TreeColumn(tree, style, i);
      tc.setResizable(true);
      tc.setText(headers[i]);
      if (i == 0) {
        tc.setWidth(200);
      }
      columns[i] = tc;
      if (i == 1 || i == 2) {
        tc.pack();
      }
    }

    aeConfigViewer = new TreeViewer(tree);
    DDTreeContentProvider contentProvider = new DDTreeContentProvider();
    DDTreeLabelProvider labelProvider = new DDTreeLabelProvider();
    aeConfigViewer.setContentProvider(contentProvider);
    aeConfigViewer.setLabelProvider(labelProvider);
    aeConfigViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        ISelection selection = event.getSelection();
        if (selection != null && selection instanceof IStructuredSelection) {
          IStructuredSelection ssel = (IStructuredSelection) selection;
          if (ssel.size() > 0) {
            // Trace.err(ssel.getFirstElement().getClass().getName());
          }
        }
        managedForm.fireSelectionChanged(spart, event.getSelection());
      }
    });

    AbstractHeaderPage.createExpandOrCollapseAllMenu(toolkit, section, sectionToolbarComposite,
            aeConfigViewer, true);
    AbstractHeaderPage.createExpandOrCollapseAllMenu(toolkit, section, sectionToolbarComposite,
            aeConfigViewer, false);

    ///////////////////////////////////////////////////////////////////////////

    HoverManager hover = new HoverManager(aeConfigViewer, getPresenterControlCreator("commandId"));
    hover.install(aeConfigViewer.getTree());

    if (aeDD != null) {
      aeConfigViewer.setInput(aeDD);
    }

    return section;
  } // createAEConfigSection