/**
   * Build content 'evaluation process' of tab 3.
   *
   * @return content of third tab
   */
  private Layout buildTab3Content() {
    VerticalLayout tab3Content = new VerticalLayout();
    tab3Content.setSpacing(true);
    tab3Content.setMargin(true);
    tab3Content.setSizeFull();

    Label instructions =
        new Label(
            "<b>Instructions:</b> <i>Please select and click a sentence below in order to process the evaluation.</i>",
            Label.CONTENT_XHTML);
    tab3Content.addComponent(instructions);

    this.tableEvaluation = new Table("Evaluation process:");
    tableEvaluation.setHeight("150px");
    tableEvaluation.setWidth("100%");
    tableEvaluation.setImmediate(true);
    tableEvaluation.setSelectable(true);
    tableEvaluation.setMultiSelect(false);
    tableEvaluation.setSortDisabled(false);
    tableEvaluation.addContainerProperty("ID", Integer.class, null);
    tableEvaluation.addContainerProperty("Sentence", String.class, null);
    tableEvaluation.addContainerProperty("Precision", Double.class, null);
    tableEvaluation.addContainerProperty("Recall", Double.class, null);
    tableEvaluation.addContainerProperty("F-Score", Double.class, null);
    tab3Content.addComponent(tableEvaluation);

    this.buttonNext2 = new Button("Next");
    buttonNext2.setImmediate(true);
    buttonNext2.setDescription("Get the next sentence in table");
    tab3Content.addComponent(buttonNext2);

    this.textAreaEvalSentence = new TextArea("Sentence:");
    textAreaEvalSentence.setImmediate(false);
    textAreaEvalSentence.setReadOnly(true);
    textAreaEvalSentence.setRows(3);
    textAreaEvalSentence.setWidth("100%");
    tab3Content.addComponent(textAreaEvalSentence);

    HorizontalLayout hlay1 = new HorizontalLayout();
    this.listSelectGoldstandard = new ListSelect("Goldstandard:");
    listSelectGoldstandard.setImmediate(true);
    listSelectGoldstandard.setHeight("120px");
    listSelectGoldstandard.setWidth("100%");
    listSelectGoldstandard.setNullSelectionAllowed(false);
    this.listSelectFramework = new ListSelect("Framework:");
    listSelectFramework.setImmediate(true);
    listSelectFramework.setHeight("120px");
    listSelectFramework.setWidth("100%");
    listSelectFramework.setNullSelectionAllowed(false);
    hlay1.setSpacing(true);
    hlay1.setMargin(false);
    hlay1.setWidth("100%");
    hlay1.addComponent(listSelectGoldstandard);
    hlay1.addComponent(listSelectFramework);
    tab3Content.addComponent(hlay1);

    return tab3Content;
  }
  /**
   * Build content 'annotation process' of tab 2.
   *
   * @return content of second tab
   */
  private Layout buildTab2Content() {
    VerticalLayout tab2Content = new VerticalLayout();
    tab2Content.setSpacing(true);
    tab2Content.setMargin(true);
    tab2Content.setSizeFull();

    this.textAreaSentence = new TextArea("Sentence:");
    textAreaSentence.setImmediate(true);
    textAreaSentence.setRows(7);
    textAreaSentence.setWidth("100%");
    tab2Content.addComponent(textAreaSentence);

    HorizontalLayout hlay1 = new HorizontalLayout();
    this.buttonNew = new Button("New");
    buttonNew.setImmediate(true);
    buttonNew.setDescription("Type in new sentences");
    this.buttonAnnotate = new Button("Annotate");
    buttonAnnotate.setImmediate(true);
    buttonAnnotate.setDescription("Annotate the sentences above");
    hlay1.setSpacing(true);
    hlay1.setMargin(false);
    hlay1.addComponent(buttonNew);
    hlay1.addComponent(buttonAnnotate);
    tab2Content.addComponent(hlay1);

    this.listSelectAnnotation = new ListSelect("Annotations:");
    listSelectAnnotation.setImmediate(true);
    listSelectAnnotation.setHeight("150px");
    listSelectAnnotation.setWidth("100%");
    listSelectAnnotation.setNullSelectionAllowed(false);
    tab2Content.addComponent(listSelectAnnotation);

    this.textAreaAnnotation = new TextArea("Further annotations with other surface forms:");
    textAreaAnnotation.setImmediate(false);
    textAreaAnnotation.setRows(4);
    textAreaAnnotation.setReadOnly(true);
    textAreaAnnotation.setWidth("100%");
    tab2Content.addComponent(textAreaAnnotation);

    // this.buttonNext = new Button("Next");
    // buttonNext.setImmediate(true);
    // buttonNext.setDescription("Get next annotation");
    // tab2Content.addComponent(buttonNext);

    return tab2Content;
  }
  public PaymentTypeMgmt(BalanceSheet sheet) {
    super(AccountsMessages.BAL_SHEET_NEW_PAY_TYPE);

    this.balSheet = sheet;

    setWidth("320px");
    setIcon(IconManager.getIcon(IconManager.CATG_MGMT_SM));

    accordion = new Accordion();
    accordion.setSizeFull();

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);

    VerticalLayout vl1 = new VerticalLayout();
    vl1.setSpacing(true);

    paymentCategories =
        new ListSelect(STRINGS.getString(AccountsMessages.BAL_SHEET_PAYMENT_CATEGORY));
    populatePaymentCategories();
    paymentCategories.setNullSelectionAllowed(false);
    paymentCategories.setImmediate(true);
    paymentCategories.setRows(NUM_ROWS);
    paymentCategories.addListener(this);

    Set<String> keys = categories.keySet();
    if (keys.size() > 0) paymentCategories.select(keys.iterator().next());

    vl1.addComponent(paymentCategories);

    hl.addComponent(vl1);

    VerticalLayout vl2 = new VerticalLayout();
    vl2.setSpacing(true);

    paymentTypes = new ListSelect(STRINGS.getString(AccountsMessages.BAL_SHEET_PAYMENT_TYPE));
    populatePaymentTypes(categories.get(paymentCategories.getValue()));
    paymentTypes.setNullSelectionAllowed(false);
    paymentTypes.setImmediate(true);
    paymentTypes.setRows(NUM_ROWS);

    vl2.addComponent(paymentTypes);

    hl.addComponent(vl2);

    current = accordion.addTab(hl);
    current.setCaption(STRINGS.getString(AccountsMessages.CURRENT));

    addNewCategory = accordion.addTab(generateCreateNewCategoryForm());
    addNewCategory.setCaption(
        STRINGS.getString(AccountsMessages.ADD_NEW)
            + " "
            + STRINGS.getString(AccountsMessages.BAL_SHEET_PAYMENT_CATEGORY));

    addNewType = accordion.addTab(generateCreateNewTypeForm());
    addNewType.setCaption(
        STRINGS.getString(AccountsMessages.ADD_NEW)
            + " "
            + STRINGS.getString(AccountsMessages.BAL_SHEET_PAYMENT_TYPE));

    addComponent(accordion);
  }
  private void buildView() {
    logger.info(
        "Company ID : "
            + companyid
            + " | User Name : "
            + username
            + " > "
            + "Painting PurchaseEnquiry UI");
    // Initialization for Purchase Enquire Details user input components
    tfEnqNo = new TextField("Enquiry No");
    tfEnqNo.setMaxLength(40);
    tfEnqQty = new TextField();
    tfEnqQty.setValue("0");
    tfEnqQty.setWidth("90");
    dfDueDate = new GERPPopupDateField("Due Date");
    dfDueDate.setInputPrompt("Select Date");
    dfEnqDate = new GERPPopupDateField("Enquiry Date");
    dfEnqDate.setInputPrompt("Select Date");
    taEnqDtlRem = new TextArea("Remarks");
    taEnqDtlRem.setMaxLength(40);
    taEnqDtlRem.setWidth("150");
    taEnqDtlRem.setHeight("50");
    taEnqRem = new TextArea("Remarks");
    taEnqRem.setHeight("50");
    taEnqDtlRem.setMaxLength(100);
    cbBranch = new GERPComboBox("Branch Name");
    cbBranch.setItemCaptionPropertyId("branchName");
    loadBranchList();
    try {
      ApprovalSchemaDM obj =
          serviceSmsPurEnqHdr.getReviewerId(companyid, appScreenId, branchId, roleId).get(0);
      if (obj.getApprLevel().equals("Approver")) {
        cbEnqStatus =
            new GERPComboBox("Status", BASEConstants.T_SMS_P_ENQUIRY_HDR, BASEConstants.RP_STATUS);
      } else {
        cbEnqStatus =
            new GERPComboBox(
                "Status", BASEConstants.T_SMS_P_ENQUIRY_HDR, BASEConstants.PE_STATUS_RV);
      }
    } catch (Exception e) {
      logger.info(e.getMessage());
    }
    cbEnqStatus.setWidth("120");
    cbEnqDtlStatus =
        new GERPComboBox("Status", BASEConstants.M_GENERIC_TABLE, BASEConstants.M_GENERIC_COLUMN);
    lsProduct = new ListSelect("Product Name");
    lsProduct.setItemCaptionPropertyId("prodname");
    lsProduct.setMultiSelect(true);
    loadProduct();
    lsProduct.setImmediate(true);
    lsProduct.addValueChangeListener(
        new ValueChangeListener() {
          /** */
          private static final long serialVersionUID = 1L;

          @Override
          public void valueChange(ValueChangeEvent event) {
            String[] split =
                lsProduct
                    .getValue()
                    .toString()
                    .replaceAll("\\[", "")
                    .replaceAll("\\]", "")
                    .split(",");
            for (String obj : split) {
              if (obj.trim().length() > 0) {
                cbUom.setReadOnly(false);
                cbUom.setValue(
                    serviceProduct
                        .getProductList(
                            companyid, Long.valueOf(obj.trim()), null, null, null, null, null, "F")
                        .get(0)
                        .getUom());
                cbUom.setReadOnly(true);
              }
            }
          }
        });
    cbUom = new TextField();
    cbUom.setWidth("77");
    cbUom.setHeight("23");
    lsVendorName = new ListSelect("Vendor Name ");
    lsVendorName.setMultiSelect(true);
    lsVendorName.setItemCaptionPropertyId("vendorName");
    loadVendorList();
    lsVendorName.setWidth("150");
    lsVendorName.setHeight("75");
    hlSearchLayout = new GERPAddEditHLayout();
    assembleSearchLayout();
    hlSrchContainer.addComponent(GERPPanelGenerator.createPanel(hlSearchLayout));
    resetFields();
    loadSrchRslt();
    loadPurDtl();
    btnaddSpec.setStyleName("add");
    btnaddSpec.addClickListener(
        new ClickListener() {
          // Click Listener for Add and Update
          private static final long serialVersionUID = 6551953728534136363L;

          @Override
          public void buttonClick(ClickEvent event) {
            if (dtlValidation()) {
              saveEnqDtl();
            }
          }
        });
    btndelete.setEnabled(false);
    // ClickListener for Enquire Detail Tale
    tblSmsEnqDtl.addItemClickListener(
        new ItemClickListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void itemClick(ItemClickEvent event) {
            if (tblSmsEnqDtl.isSelected(event.getItemId())) {
              tblSmsEnqDtl.setImmediate(true);
              btnaddSpec.setCaption("Add");
              btnaddSpec.setStyleName("savebt");
              btndelete.setEnabled(false);
              enqDtlresetFields();
            } else {
              ((AbstractSelect) event.getSource()).select(event.getItemId());
              btnaddSpec.setCaption("Update");
              btnaddSpec.setStyleName("savebt");
              btndelete.setEnabled(true);
              editSmsPurDetail();
            }
          }
        });
    btndelete.addClickListener(
        new ClickListener() {
          // Click Listener for Add and Update
          private static final long serialVersionUID = 6551953728534136363L;

          @Override
          public void buttonClick(ClickEvent event) {
            if (btndelete == event.getButton()) {
              deleteDetails();
            }
          }
        });
  }