Exemplo n.º 1
0
  /**
   * 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;
  }
Exemplo n.º 2
0
  @Override
  protected void setup(VaadinRequest request) {
    final VerticalLayout uiLayout = new VerticalLayout();
    uiLayout.setMargin(true);
    setContent(uiLayout);

    final VerticalLayout windowLayout = new VerticalLayout();

    final Window testWindow = new Window("WebKitFail", windowLayout);
    testWindow.setWidth(300, Unit.PIXELS);

    GridLayout gl = new GridLayout();
    gl.setHeight(null);
    gl.setWidth(100, Unit.PERCENTAGE);
    windowLayout.addComponent(gl);

    ListSelect listSelect = new ListSelect();
    listSelect.setWidth(100, Unit.PERCENTAGE);
    gl.addComponent(listSelect);
    gl.setMargin(true);

    final Button testButton =
        new Button(
            "Open Window",
            new Button.ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                UI.getCurrent().addWindow(testWindow);
              }
            });
    uiLayout.addComponent(testButton);
  }
Exemplo n.º 3
0
  /**
   * 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;
  }
Exemplo n.º 4
0
  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();
            }
          }
        });
  }
  @Override
  protected void setup(VaadinRequest request) {
    listSelect = new ListSelect<>("ListSelect", dataProvider);
    listSelect.setWidth("100px");
    listSelect.setRows(10);

    resetContainer();
    logContainer();

    addComponent(listSelect);
    addComponent(
        new Button(
            "Reset",
            event -> {
              resetContainer();
              log.clear();
              logContainer();
            }));

    addComponent(
        new Button(
            "Add first",
            event -> {
              List<String> list = dataProvider.fetch(new Query<>()).collect(Collectors.toList());
              list.add(0, "first");
              dataProvider = new ListDataProvider<>(list);
              listSelect.setDataProvider(dataProvider);
              logContainer();
            }));

    addComponent(
        new Button(
            "Add middle",
            event -> {
              List<String> list = dataProvider.fetch(new Query<>()).collect(Collectors.toList());
              list.add(list.size() / 2, "middle");
              dataProvider = new ListDataProvider<>(list);
              listSelect.setDataProvider(dataProvider);
              logContainer();
            }));

    addComponent(
        new Button(
            "Add last",
            event -> {
              List<String> list = dataProvider.fetch(new Query<>()).collect(Collectors.toList());
              list.add("last");
              dataProvider = new ListDataProvider<>(list);
              listSelect.setDataProvider(dataProvider);
              logContainer();
            }));

    addComponent(
        new Button(
            "Swap",
            event -> {
              List<String> list = dataProvider.fetch(new Query<>()).collect(Collectors.toList());
              Collections.swap(list, 0, list.size() - 1);
              dataProvider = new ListDataProvider<>(list);
              listSelect.setDataProvider(dataProvider);

              logContainer();
            }));

    addComponent(
        new Button(
            "Remove first",
            event -> {
              List<String> list = dataProvider.fetch(new Query<>()).collect(Collectors.toList());
              list.remove(0);

              dataProvider = new ListDataProvider<>(list);
              listSelect.setDataProvider(dataProvider);

              logContainer();
            }));

    addComponent(
        new Button(
            "Remove middle",
            event -> {
              List<String> list = dataProvider.fetch(new Query<>()).collect(Collectors.toList());
              list.remove(list.size() / 2);
              dataProvider = new ListDataProvider<>(list);
              listSelect.setDataProvider(dataProvider);
              logContainer();
            }));

    addComponent(
        new Button(
            "Remove last",
            event -> {
              List<String> list = dataProvider.fetch(new Query<>()).collect(Collectors.toList());
              list.remove(list.size() - 1);

              dataProvider = new ListDataProvider<>(list);
              listSelect.setDataProvider(dataProvider);

              logContainer();
            }));
  }