@Override
  protected void setup(VaadinRequest request) {
    final Label dateValue = new Label(initialDateString);
    dateValue.setId("dateValue");

    final TimeZone timezone = TimeZone.getTimeZone("GMT");
    final SimpleDateFormat dateformat = getDateFormat(timezone);
    final DateField dateField = getDateField(timezone, dateformat);

    addComponent(dateValue);
    addComponent(dateField);

    dateField.addValueChangeListener(
        event -> dateValue.setValue(dateformat.format(dateField.getValue())));
  }
  @Override
  public void init() {
    final String WIDTH = "350px";
    labelErrorQuantity =
        new Label() {
          {
            setVisible(false);
            addStyleName("form-error");
            setContentMode(ContentMode.HTML);
          }
        };
    labelErrorPrice =
        new Label() {
          {
            setVisible(false);
            addStyleName("form-error");
            setContentMode(ContentMode.HTML);
          }
        };
    labelGeneralError =
        new Label() {
          {
            setVisible(false);
            addStyleName("form-error");
            setContentMode(ContentMode.HTML);
          }
        };
    inputGoodsQuantity =
        new TextField("Jumlah") {
          {
            setWidth(function.FORM_WIDTH);
            setImmediate(true);
          }
        };
    inputGoodsQuantity.addValueChangeListener(this);

    inputGoodsSelect =
        new ComboBox("Nama Barang") {
          {
            setImmediate(true);
            setWidth(function.FORM_WIDTH);
          }
        };
    inputGoodsSelect.addValueChangeListener(this);

    inputGoodsPrice = new TextField("Harga Barang");
    inputGoodsPrice.setImmediate(true);
    inputGoodsPrice.setWidth(function.FORM_WIDTH);

    inputDeletionDate =
        new DateField("Tanggal") {
          {
            setWidth(function.FORM_WIDTH);
            setImmediate(true);
          }
        };
    inputDeletionDate.addValueChangeListener(this);

    information = new TextArea("Informasi");
    information.setMaxLength(function.MAX_TEXTAREA_LENGTH);
    information.setWidth(function.FORM_WIDTH);
    labelPriceGuide = new Label("");
    labelPriceGuide.setContentMode(ContentMode.HTML);

    labelSatuan = new Label("Satuan");

    buttonReset = new Button("Reset");
    buttonReset.addClickListener(this);

    buttonSubmit = new Button("Simpan");
    buttonSubmit.addClickListener(this);
    buttonSubmit.addStyleName("primary");
    buttonCancel = new Button("Batal");
    buttonCancel.addClickListener(this);
    buttonUpdate = new Button("Simpan Perubahan");
    buttonUpdate.addClickListener(this);

    buttonNext = new Button(">>");
    buttonNext.addClickListener(this);
    buttonNext.setWidth("50px");
    buttonNext.setEnabled(false);
    buttonPrev = new Button("<<");
    buttonPrev.addClickListener(this);
    buttonPrev.setWidth("50px");
    buttonPrev.setEnabled(false);
    buttonPrev.setDescription("Sebelumnya");

    buttonAdd = new Button("Tambah");
    buttonAdd.addClickListener(this);
    buttonAdd.setWidth("130px");
    buttonAdd.setDescription("Tambah Input Baru");

    buttonRemove = new Button("");
    buttonRemove.setIcon(new ThemeResource("icons/image/icon-delete.png"));
    buttonRemove.addClickListener(this);
    buttonRemove.setDescription("Hapus Data");

    construct();
  }
  @Override
  public void init() {
    buttonCancel = new Button("Batalkan");
    buttonCancel.addClickListener(this);

    buttonShow = new Button("Tampilkan Laporan");
    buttonShow.addClickListener(this);

    buttonPrint = new Button("Cetak");
    buttonPrint.addClickListener(this);
    buttonPrint.setIcon(new ThemeResource("icons/image/icon-print.png"));

    opener = new BrowserWindowOpener(ReportPrint.class);
    opener.setFeatures("height=200,width=400,resizable");
    // A button to open the printer-friendly page.
    opener.extend(buttonPrint);

    DateTime now = DateTime.now();
    Date beginYear =
        now.withDayOfYear(now.dayOfYear().getMinimumValue())
            .withHourOfDay(now.hourOfDay().getMinimumValue())
            .toDate();
    Date endYear =
        now.withDayOfYear(now.dayOfYear().getMaximumValue())
            .withHourOfDay(now.hourOfDay().getMaximumValue())
            .toDate();

    selectStartDate = new DateField("Dari Tanggal");
    selectStartDate.setImmediate(true);
    selectStartDate.setWidth(function.FORM_WIDTH);
    selectStartDate.setValue(beginYear);

    selectEndDate = new DateField("Hingga Tanggal");
    selectEndDate.setImmediate(true);
    selectEndDate.setWidth(function.FORM_WIDTH);
    selectEndDate.setValue(endYear);
    selectAcceptance = new OptionGroup("Persetujuan");
    Item itemType1 = selectAcceptance.addItem("diterima");
    Item itemType2 = selectAcceptance.addItem("belumditerima");
    selectAcceptance.setImmediate(true);
    selectAcceptance.setValue("diterima");

    selectAcceptance.setItemCaption("diterima", "Barang Kadaluarsa Disetujui");

    selectAcceptance.setItemCaption("belumditerima", "Barang Kadaluarsa Belum Disetujui");
    selectContent = new ComboBox("Pilih Tampilan");
    selectContent.setImmediate(true);
    selectContent.addItem(ReportContent.CHART);
    selectContent.addItem(ReportContent.TABLE);
    selectContent.addItem(ReportContent.TABLE_CHART);
    selectContent.setItemCaption(ReportContent.CHART, "Tampilkan Chart");
    selectContent.setItemCaption(ReportContent.TABLE, "Tampilkan Tabel");
    selectContent.setItemCaption(ReportContent.TABLE_CHART, "Tampilkan Tabel dan Chart");
    selectContent.setItemCaption(4, "Minggu Ke-4");
    selectContent.setValue(ReportContent.TABLE);

    selectAcceptance.addValueChangeListener(this);
    selectStartDate.addValueChangeListener(this);
    selectEndDate.addValueChangeListener(this);
    selectContent.addValueChangeListener(this);
    updateWindowOpener();

    construct();
  }