Exemple #1
0
  @Override
  public void search() {
    final Obu obu = new Obu();
    final Eia eia = new Eia();
    eia.setState(null);

    if (serialNumber.getValue() != null) eia.setSerialNumber(serialNumber.getValueAsString());
    if (fixedAssetIdentifier != null)
      eia.setFixedAssetIdentifier(fixedAssetIdentifier.getValueAsString());
    if (obuSelectItem.getValue() != null) {
      obu.setId(Long.valueOf(obuSelectItem.getValueAsString()));
      eia.setObu(obu);
    }
    if (bpiObuSelectItem.getValue() != null) {
      final Bpi bpi = new Bpi(Long.valueOf(bpiObuSelectItem.getValueAsString()));
      obu.setBpi(bpi);
      eia.setObu(obu);
    }
    if (baseRoleSelectItem.getValue() != null) {
      final Role baseRole = new Role();
      baseRole.setId(Integer.valueOf(baseRoleSelectItem.getValueAsString()));
      eia.setResponsibleRole(baseRole);
    }
    if (stateSelectItem.getValue() != null) {
      eia.setState(EiaStateEnum.valueOf(stateSelectItem.getValueAsString()));
    }
    if (facilityLocationSelectItem.getValue() != null) {
      eia.setWorkingArea(null);
      eia.setFacility(new Facility(Integer.valueOf(facilityLocationSelectItem.getValueAsString())));
    }
    if (workingAreaLocationSelectItem.getValue() != null) {
      eia.setFacility(null);
      eia.setWorkingArea(
          new WorkingArea(Integer.valueOf(workingAreaLocationSelectItem.getValueAsString())));
    }
    search(eia);
  }
Exemple #2
0
  public EIASearchForm(String title) {
    super(title);

    form.setItems(
        serialNumber,
        fixedAssetIdentifier,
        stateSelectItem,
        bpiObuSelectItem,
        workingAreaLocationSelectItem,
        facilityLocationSelectItem,
        obuSelectItem,
        baseRoleSelectItem);
    form.setAutoFocus(true);
    serialNumber.setSelectOnFocus(true);

    final KeyUpHandler searchKeyUpHandler =
        new KeyUpHandler() {

          @Override
          public void onKeyUp(KeyUpEvent event) {
            if (event.getKeyName().equals("Enter")) {
              search();
            }
          }
        };
    // actualCostItem.addKeyUpHandler(searchKeyUpHandler);
    serialNumber.addKeyUpHandler(searchKeyUpHandler);
    fixedAssetIdentifier.addKeyUpHandler(searchKeyUpHandler);
    stateSelectItem.addKeyUpHandler(searchKeyUpHandler);
    bpiObuSelectItem.addKeyUpHandler(searchKeyUpHandler);
    workingAreaLocationSelectItem.addKeyUpHandler(searchKeyUpHandler);
    facilityLocationSelectItem.addKeyUpHandler(searchKeyUpHandler);
    obuSelectItem.addKeyUpHandler(searchKeyUpHandler);
    baseRoleSelectItem.addKeyUpHandler(searchKeyUpHandler);

    final VLayout sideButtons =
        GHAUiHelper.createBar(
            new GHASearchButton(searchClickHandler),
            new GHACleanButton(
                new ClickHandler() {

                  @Override
                  public void onClick(ClickEvent event) {
                    clean();
                  }
                }),
            new GHACancelButton(
                new ClickHandler() {

                  @Override
                  public void onClick(ClickEvent event) {
                    hide();
                    clean();
                  }
                }));

    final HLayout formLayout = new HLayout();
    formLayout.setPadding(10);
    formLayout.setHeight(GHAUiHelper.DEFAULT_INNER_TOP_SECTION_HEIGHT + "px");
    formLayout.setDefaultLayoutAlign(VerticalAlignment.CENTER);
    formLayout.addMembers(form, new LayoutSpacer(), sideButtons);

    addMembers(
        formLayout,
        GHAUiHelper.verticalGraySeparator(GHAUiHelper.V_SEPARATOR_HEIGHT + "px"),
        resultSet);
    fill();
  }