@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    Bundle extras = CommonActivity.getIntentExtras(data);
    if (extras != null) {

      // check for repeat update
      if (ActivityAppointmentRepeat.GetActivityResult(requestCode, resultCode, extras)) {
        iRepeatType = ActivityAppointmentRepeat.getExtraRepeatType(extras);
        iRepeatEvery = ActivityAppointmentRepeat.getExtraRepeatEvery(extras);
        dateEndOn.setTimeInMillis(ActivityAppointmentRepeat.getExtraRepeatEndOnDate(extras));
        UpdateRepeatInfo();
        return;
      }

      // check for date widget edit request code
      if (requestCode == DateWidget.SELECT_DATE_REQUEST) {
        final long lDate =
            DateWidget.GetSelectedDateOnActivityResult(requestCode, resultCode, extras, dateStart);
        if (lDate != -1) {
          UpdateStartDateTimeView();
          return;
        }
      }

      // check for time widget edit request code
      if ((requestCode == TimeWidget.SELECT_TIME_REQUEST) && (resultCode == RESULT_OK)) {
        final int iHour =
            TimeWidget.GetSelectedTimeHourOnActivityResult(requestCode, resultCode, extras);
        final int iMinute =
            TimeWidget.GetSelectedTimeMinuteOnActivityResult(requestCode, resultCode, extras);
        dateStart.set(Calendar.HOUR_OF_DAY, iHour);
        dateStart.set(Calendar.MINUTE, iMinute);
        chkAllDay.setChecked(false);
        UpdateStartDateTimeView();
        return;
      }

      // get KeyboardWidget result
      if ((requestCode == KeyboardWidget.EDIT_TEXT_REQUEST) && (resultCode == RESULT_OK)) {
        String sText = KeyboardWidget.GetTextOnActivityResult(requestCode, resultCode, extras);
        edSubject.setText(sText);
        return;
      }
    }
  }
Esempio n. 2
0
  /** **************************************************************** ObjectWidget */
  public void setValue(FromServer element) {
    boolean edit;
    Supplier supp;
    CustomCaptionPanel frame;

    super.setValue(element);
    main.clear();

    if (element != null) {
      supp = (Supplier) element.getObject("supplier");
      edit = (supp.iAmReference() && element.sharingStatus() <= ACL.ACL_READWRITE);
    } else {
      edit = false;
    }

    frame = new CustomCaptionPanel("Attributi");
    main.add(frame);
    main.setCellWidth(frame, "50%");

    supplier = new NameLabelWidget();
    frame.addPair("Fornitore", widgetWarp("supplier", supplier));

    status = Order.doOrderStatusSelector(edit);
    frame.addPair("Stato", widgetWarp("status", status));

    if (edit == true) anticipated = new PercentageBox();
    else anticipated = new PercentageViewer();

    frame.addPair("Anticipo", widgetWarp("anticipated", (Widget) anticipated));

    frame = new CustomCaptionPanel("Date");
    main.add(frame);
    main.setCellWidth(frame, "50%");

    if (edit == true) {
      BankMovementSelector bms;

      startdate = new DateSelector();
      enddate = new DateSelector();
      shippingdate = new DateSelector();

      bms = new BankMovementSelector();
      bms.setDefaultType(BankMovement.ORDER_PAYMENT);
      bms.setDefaultTargetSupplier(element.getObject("supplier"));
      bms.setDefaultNote("Pagamento ordine a " + element.getObject("supplier").getString("name"));
      payment = bms;
    } else {
      startdate = new DateViewer();
      enddate = new DateViewer();
      shippingdate = new DateViewer();
      payment = new BankMovementCellViewer();
    }

    frame.addPair("Data apertura", widgetWarp("startdate", (Widget) startdate));
    frame.addPair("Data chiusura", widgetWarp("enddate", (Widget) enddate));
    frame.addPair("Data consegna", widgetWarp("shippingdate", (Widget) shippingdate));

    if (Session.getGAS().getBool("use_bank") == true)
      frame.addPair("Pagamento", widgetWarp("payment_event", (Widget) payment));

    if (element != null) {
      supplier.setValue(element.getObject("supplier"));
      status.setVal(element.getInt("status"));
      anticipated.setValue(element.getString("anticipated"));
      startdate.setValue(element.getDate("startdate"));
      enddate.setValue(element.getDate("enddate"));
      shippingdate.setValue(element.getDate("shippingdate"));
      payment.setValue(element.getObject("payment_event"));
    }
  }