Пример #1
0
  protected List<ModelWrapper<?>> search() throws Exception {
    List<ModelWrapper<?>> wrappers = new ArrayList<ModelWrapper<?>>();
    if (radioWaybill.getSelection()) {
      wrappers.addAll(
          OriginInfoWrapper.getShipmentsByWaybill(
              SessionManager.getAppService(), treeText.getText().trim()));
      wrappers.addAll(
          DispatchWrapper.getDispatchesByWaybill(
              SessionManager.getAppService(), treeText.getText().trim()));
      return wrappers;

    } else if (radioDateReceived.getSelection()) {
      Date date = dateWidget.getDate();
      if (date != null) {
        wrappers.addAll(
            OriginInfoWrapper.getShipmentsByDateReceived(
                SessionManager.getAppService(),
                date,
                SessionManager.getUser().getCurrentWorkingCenter()));
        wrappers.addAll(
            DispatchWrapper.getDispatchesByDateReceived(
                SessionManager.getAppService(),
                date,
                SessionManager.getUser().getCurrentWorkingCenter()));
        return wrappers;
      }
    } else {
      Date date = dateWidget.getDate();
      if (date != null) {
        wrappers.addAll(
            OriginInfoWrapper.getShipmentsByDateSent(
                SessionManager.getAppService(),
                date,
                SessionManager.getUser().getCurrentWorkingCenter()));
        wrappers.addAll(
            DispatchWrapper.getDispatchesByDateSent(
                SessionManager.getAppService(),
                date,
                SessionManager.getUser().getCurrentWorkingCenter()));
        return wrappers;
      }
    }
    return null;
  }
Пример #2
0
 @Override
 protected void internalSearch() {
   try {
     List<? extends ModelWrapper<?>> searchedObject = search();
     if (searchedObject == null || searchedObject.size() == 0) {
       String msg;
       if (radioWaybill.getSelection()) {
         msg =
             NLS.bind(Messages.SpecimenTransitView_notfound_waybill_error_msg, treeText.getText());
       } else {
         msg =
             NLS.bind(
                 Messages.SpecimenTransitView_notfound_date_error_msg,
                 DateFormatter.formatAsDate(dateWidget.getDate()));
       }
       BgcPlugin.openMessage(Messages.SpecimenTransitView_notfound_error_title, msg);
     } else {
       showSearchedObjectsInTree(searchedObject, true);
       getTreeViewer().expandToLevel(searchedNode, 2);
     }
   } catch (Exception e) {
     BgcPlugin.openError(Messages.SpecimenTransitView_search_error_msg, e);
   }
 }
Пример #3
0
  @Override
  protected void createTreeTextOptions(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(3, false);
    layout.horizontalSpacing = 0;
    layout.marginHeight = 0;
    layout.verticalSpacing = 0;
    composite.setLayout(layout);

    radioWaybill = new Button(composite, SWT.RADIO);
    radioWaybill.setText(Messages.SpecimenTransitView_waybill_label);
    radioWaybill.setSelection(true);
    radioWaybill.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (radioWaybill.getSelection()) {
              showTextOnly(true);
            }
          }
        });

    radioDateReceived = new Button(composite, SWT.RADIO);
    radioDateReceived.setText(Messages.SpecimenTransitView_received_label);
    radioDateReceived.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (radioDateReceived.getSelection()) {
              showTextOnly(false);
            }
          }
        });

    radioDateSent = new Button(composite, SWT.RADIO);
    radioDateSent.setText(Messages.SpecimenTransitView_packed_label);
    radioDateSent.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (radioDateSent.getSelection()) {
              showTextOnly(false);
            }
          }
        });

    dateComposite = new Composite(parent, SWT.NONE);
    layout = new GridLayout(2, false);
    layout.horizontalSpacing = 0;
    layout.marginHeight = 0;
    layout.verticalSpacing = 0;
    dateComposite.setLayout(layout);
    GridData gd = new GridData();
    gd.exclude = true;
    dateComposite.setLayoutData(gd);

    dateWidget = new DateTimeWidget(dateComposite, SWT.DATE, new Date());
    dateWidget.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetDefaultSelected(SelectionEvent e) {
            internalSearch();
          }
        });
    Button searchButton = new Button(dateComposite, SWT.PUSH);
    searchButton.setText(Messages.SpecimenTransitView_go_label);
    searchButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            internalSearch();
          }
        });
  }