private Section createIdentitySection()

in uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/details/AEMetaDataDetailsPage.java [330:555]


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

    sectionAEMetaDataDetails = FormSection.createTableWrapDataSection(toolkit, parent, 
            Section.TWISTIE,
            Messages.DDE_AEConfigPage_AEConfig_Section_Title, 
            "Set the properties of ...", 10, 5,
            TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB, 1, 1);
    final SectionPart spart = new SectionPart(sectionAEMetaDataDetails);
    mform.addPart(spart);
    spart.initialize(mform); // Need this code. Otherwise, exception in SectionPart !!!
    sectionAEMetaDataDetails.setExpanded(true);

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

    Composite sectionClient = toolkit.createComposite(sectionAEMetaDataDetails);
    TableWrapLayout tl = new TableWrapLayout();
    tl.numColumns = 2;
    tl.leftMargin = 0;
    tl.rightMargin = 0;
    tl.topMargin = 10;
    tl.bottomMargin = 0;
    sectionClient.setLayout(tl);
    sectionAEMetaDataDetails.setClient(sectionClient);

    // Co-located or Remote
    // toolkit.createLabel(sectionClient, "", SWT.NONE);
    Composite colocatedOrRemote = toolkit.createComposite(sectionClient, SWT.NONE);
    GridLayout gl = new GridLayout(3, true);
    gl.marginWidth = 0;
    colocatedOrRemote.setLayout(gl);
    td = new TableWrapData(TableWrapData.FILL);
    td.colspan = 2;
    td.grabHorizontal = true;
    td.indent = 0;
    colocatedOrRemote.setLayoutData(td);
    Label label = toolkit.createLabel(colocatedOrRemote, "Deployment:", SWT.NONE);
    label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
    deploymentCoLocated = toolkit.createButton(colocatedOrRemote, "Co-located", SWT.RADIO);
    deploymentRemote = toolkit.createButton(colocatedOrRemote, "Remote", SWT.RADIO);
    deploymentCoLocated.setSelection(true);
    deploymentCoLocated.addSelectionListener(deploymentListener);
    deploymentRemote.addSelectionListener(deploymentListener);

    stackLayoutComposite = new Composite(sectionClient, SWT.NONE);
    stackLayout = new StackLayout();
    stackLayoutComposite.setLayout(stackLayout);
    td = new TableWrapData(TableWrapData.FILL);
    td.colspan = 2;
    td.grabHorizontal = true;
    td.indent = 0;
    stackLayoutComposite.setLayoutData(td);

    compositeCoLocatedSetting = toolkit.createComposite(stackLayoutComposite, SWT.NONE);
    gl = new GridLayout(2, false);
    gl.marginWidth = 0;
    compositeCoLocatedSetting.setLayout(gl);
    GridData gd = new GridData(GridData.FILL_BOTH);
    compositeCoLocatedSetting.setLayoutData(gd);

    compositeRemoteSetting = toolkit.createComposite(stackLayoutComposite, SWT.NONE);
    gl = new GridLayout(2, false);
    gl.marginWidth = 2;
    gl.marginHeight = 2;
    compositeRemoteSetting.setLayout(gl);
    gd = new GridData(GridData.FILL_BOTH);
    compositeRemoteSetting.setLayoutData(gd);

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

    // Run in AS mode
    asMode = toolkit.createButton(compositeCoLocatedSetting, Messages.DDE_AEMetaDataDetails_RunAsASAggregate, SWT.CHECK);
    gd = new GridData();
    gd.horizontalSpan = 2;
    asMode.setLayoutData(gd);
    asMode.addSelectionListener(asynAggregateListener);

    // <scaleout numberOfInstances="1"/> <!-- optional -->
    Label labelScaleout = toolkit.createLabel(compositeCoLocatedSetting, Messages.DDE_AEMetaDataDetails_NumberOfReplicatedInstances);
    scaleout = FormSection2.createLabelAndSpinner(toolkit, compositeCoLocatedSetting,
            labelScaleout, SWT.BORDER, 1, Integer.MAX_VALUE, false);
    scaleout.setSelection(1);
    scaleout.addSelectionListener(asynAggregateListener);
    GenericHoverManager hover = new GenericHoverManager(new IGenericHoverOwner() {
      public void computeInformation(GenericHoverManager hoverManager, Point ptHoverEventLocation) {
        if (!scaleout.isEnabled()) {
          hoverManager.setDisplayedInformation(Messages.Hover_Disable_NumberOfReplicatedInstances, 
                new Rectangle(1, ptHoverEventLocation.y, 1, 1));  
        } else {
          hoverManager.setDisplayedInformation(null, null);
        }
      }     
    }, getPresenterControlCreator("commandId"));
    hover.install(labelScaleout);

    labelInputQueueScaleout = toolkit.createLabel(compositeCoLocatedSetting, Messages.DDE_InputQueueScaleout);
    inputQueueScaleout = FormSection2.createLabelAndSpinner(toolkit, compositeCoLocatedSetting,
            labelInputQueueScaleout, SWT.BORDER, 1, 
            Integer.MAX_VALUE, false);
    inputQueueScaleout.setSelection(1);
    inputQueueScaleout.addSelectionListener(asynAggregateListener);
    hover = new GenericHoverManager(new IGenericHoverOwner() {
      public void computeInformation(GenericHoverManager hoverManager, Point ptHoverEventLocation) {
        hoverManager.setDisplayedInformation(Messages.Hover_InputQueueScaleout, 
                new Rectangle(1, ptHoverEventLocation.y, 1, 1));        
      }      
    }, getPresenterControlCreator("commandId"));
    hover.install(labelInputQueueScaleout);
    
    labelReplyQueueForCoLocated = toolkit.createLabel(compositeCoLocatedSetting, Messages.DDE_ReplyQueueListenersForCoLocated);
    replyQueueListenersForCoLocated = FormSection2.createLabelAndSpinner(toolkit, compositeCoLocatedSetting,
            labelReplyQueueForCoLocated, SWT.BORDER, 1, 
            Integer.MAX_VALUE, false);
    replyQueueListenersForCoLocated.setSelection(1);
    replyQueueListenersForCoLocated.addSelectionListener(asynAggregateListener);
    hover = new GenericHoverManager(new IGenericHoverOwner() {
      public void computeInformation(GenericHoverManager hoverManager, Point ptHoverEventLocation) {
        hoverManager.setDisplayedInformation(Messages.Hover_ReplyQueueListenersForCoLocated, 
                new Rectangle(1, ptHoverEventLocation.y, 1, 1));        
      }     
    }, getPresenterControlCreator("commandId"));
    hover.install(labelReplyQueueForCoLocated);

    // <casMultiplier poolSize="5"/> <!-- optional -->
    // Only for AS primitive CAS Multiplier
    casMultiplierLabel = toolkit.createLabel(compositeCoLocatedSetting,
            Messages.DDE_AEMetaDataDetails_PoolSizeOfCM);
    casMultiplier = FormSection2.createLabelAndSpinner(toolkit, compositeCoLocatedSetting,
            casMultiplierLabel, SWT.BORDER, 0, Integer.MAX_VALUE, false);
    casMultiplier.setSelection(0);
    casMultiplier.addSelectionListener(asynAggregateListener);
    
    // initialFsHeapSize (default size is 2M)
    initialFsHeapSizeLabel = toolkit.createLabel(compositeCoLocatedSetting,
            Messages.DDE_AEMetaDataDetails_InitalSizeOfCASHeap);
    initialFsHeapSize = FormSection2.createLabelAndSpinner(toolkit, compositeCoLocatedSetting,
            initialFsHeapSizeLabel, SWT.BORDER, 1, 
            Integer.MAX_VALUE, false, FormSection2.MAX_DECORATION_WIDTH);
    gd = (GridData) initialFsHeapSize.getLayoutData();
    gd.minimumWidth = 80;
    gd.widthHint = 80;
    initialFsHeapSize.setLayoutData(gd);
    initialFsHeapSize.setSelection(0);
    initialFsHeapSize.addSelectionListener(asynAggregateListener);

    // ProcessParentCASLast (default false)
    processParentCASLast = toolkit.createButton(compositeCoLocatedSetting, Messages.DDE_AEMetaDataDetails_ProcessParentCASLast, SWT.CHECK);
    gd = new GridData();
    gd.horizontalSpan = 2;
    processParentCASLast.setLayoutData(gd);
    processParentCASLast.addSelectionListener(asynAggregateListener);

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

    // Note: Need to add SWT.BORDER style to make the border VISIBLE in Linux
    brokerUrlDecoField = FormSection2.createLabelAndDecoratedText(toolkit, 
            compositeRemoteSetting, Messages.DDE_AEMetaDataDetails_BrokerURLForRemote, 
            currentMetaDataObject == null ?
                    "":((RemoteAEDeploymentMetaData) currentMetaDataObject).getInputQueue().getBrokerURL(), 
                    SWT.WRAP | SWT.BORDER, 100, 0, true, 0);
    
    // Create an error decoration
    decorationBrokerUrl = FormSection2.registerFieldDecoration("brokerUrl2",
                  "The broker URL cannot be empty");
    brokerUrlDecoField.addFieldDecoration(decorationBrokerUrl, SWT.LEFT | SWT.TOP, false);    
    brokerUrl = (Text) brokerUrlDecoField.getControl();
    FormData fd = (FormData) brokerUrl.getLayoutData();
    fd.top.offset += 2; // make border visible in Linux
    fd.left.offset += 2;   // make border visible in Linux
    brokerUrl.addModifyListener(fModifyListener);  

    // Note: Need to add SWT.BORDER style to make the border VISIBLE in Linux
    endPointDecoField = FormSection2.createLabelAndDecoratedText(toolkit, 
            compositeRemoteSetting, Messages.DDE_AEMetaDataDetails_QueueNameForRemote, 
            currentMetaDataObject == null ?
                    "":((RemoteAEDeploymentMetaData) currentMetaDataObject).getInputQueue().getEndPoint(), 
                    SWT.WRAP | SWT.BORDER, 100, 0, true, 0);
    endPoint = (Text) endPointDecoField.getControl();
    endPoint.addModifyListener(fModifyListener);
    decorationEndPoint =
      FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
    decorationEndPoint.setDescription("The name of the queue cannot be empty");
    endPointDecoField.addFieldDecoration(decorationEndPoint, SWT.LEFT | SWT.TOP, false);    
   
    labelRemoteReplyQueueScaleout = toolkit.createLabel(compositeRemoteSetting, Messages.DDE_RemoteReplyQueueScaleout);
    remoteReplyQueueScaleout = FormSection2.createLabelAndSpinner(toolkit, compositeRemoteSetting,
            labelRemoteReplyQueueScaleout, SWT.BORDER, 1, 
            Integer.MAX_VALUE, false);
    remoteReplyQueueScaleout.setSelection(1);
    remoteReplyQueueScaleout.addSelectionListener(asynAggregateListener);
    hover = new GenericHoverManager(new IGenericHoverOwner() {

      public void computeInformation(GenericHoverManager hoverManager, Point ptHoverEventLocation) {
        hoverManager.setDisplayedInformation(Messages.Hover_RemoteReplyQueueScaleout, 
                new Rectangle(1, ptHoverEventLocation.y, 1, 1));        
      }
      
    }, getPresenterControlCreator("commandId"));
    hover.install(labelRemoteReplyQueueScaleout);

    // <casMultiplier poolSize="5"/> <!-- optional -->
    casMultiplierLabelRemote = toolkit.createLabel(compositeRemoteSetting,
            Messages.DDE_AEMetaDataDetails_PoolSizeOfCM);
    casMultiplierRemote = FormSection2.createLabelAndSpinner(toolkit, compositeRemoteSetting,
            casMultiplierLabelRemote, SWT.BORDER, 0, Integer.MAX_VALUE, false);
    casMultiplierRemote.setSelection(0);
    casMultiplierRemote.addSelectionListener(asynAggregateListener);

    // initialFsHeapSize (default size is 2M)
    initialFsHeapSizeLabelRemote = toolkit.createLabel(compositeRemoteSetting,
            Messages.DDE_AEMetaDataDetails_InitalSizeOfCASHeap);
    initialFsHeapSizeRemote = FormSection2.createLabelAndSpinner(toolkit, compositeRemoteSetting,
            initialFsHeapSizeLabelRemote, SWT.BORDER, 1, 
            Integer.MAX_VALUE, false, FormSection2.MAX_DECORATION_WIDTH);
    gd = (GridData) initialFsHeapSizeRemote.getLayoutData();
    gd.minimumWidth = 80;
    gd.widthHint = 80;
    initialFsHeapSizeRemote.setLayoutData(gd);
    initialFsHeapSizeRemote.setSelection(0);
    initialFsHeapSizeRemote.addSelectionListener(asynAggregateListener);
    
    stackLayout.topControl = compositeCoLocatedSetting;

    return sectionAEMetaDataDetails;
  }