Пример #1
0
  private void setDateRange(DateField date) {
    date.setRangeStart(getDefaultDate());

    Date endDate = getDefaultDate();
    endDate.setMonth(endDate.getMonth() + 1);
    date.setRangeEnd(endDate);
  }
 private DateField getDateField(TimeZone timezone, SimpleDateFormat dateformat) {
   final DateField dateField = new DateField();
   try {
     Date initialDate = dateformat.parse(initialDateString);
     dateField.setResolution(Resolution.DAY);
     dateField.setTimeZone(timezone);
     dateField.setValue(initialDate);
   } catch (ParseException e) {
     e.printStackTrace();
   }
   return dateField;
 }
  @Override
  public ReportData getReportData() {
    ReportData data = new ReportData(function);

    data.setAccepted((String) selectAcceptance.getValue());
    System.out.println(selectEndDate.getValidators().toString());
    data.setReportContent((ReportContent) selectContent.getValue());
    data.setDateEnd(selectEndDate.getValue());
    data.setDateStart(selectStartDate.getValue());
    data.setType(ReportType.EXPIRED_GOODS);

    return data;
  }
  @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())));
  }
Пример #5
0
  protected void initForm() {
    form = new Form();
    form.setValidationVisibleOnCommit(true);
    form.setImmediate(true);
    addComponent(form);

    // name
    nameField = new TextField(i18nManager.getMessage(Messages.TASK_NAME));
    nameField.focus();
    nameField.setRequired(true);
    nameField.setRequiredError(i18nManager.getMessage(Messages.TASK_NAME_REQUIRED));
    form.addField("name", nameField);

    // description
    descriptionArea = new TextArea(i18nManager.getMessage(Messages.TASK_DESCRIPTION));
    descriptionArea.setColumns(25);
    form.addField("description", descriptionArea);

    // duedate
    dueDateField = new DateField(i18nManager.getMessage(Messages.TASK_DUEDATE));
    dueDateField.setResolution(DateField.RESOLUTION_DAY);
    form.addField("duedate", dueDateField);

    // priority
    priorityComboBox = new PriorityComboBox(i18nManager);
    form.addField("priority", priorityComboBox);
  }
Пример #6
0
 void newDinner(Dinner dinner) {
   this.dinner = dinner;
   if (dinner != null) {
     formFieldBindings = BeanFieldGroup.bindFieldsBuffered(dinner, this);
     dinnerDate.focus();
   }
   setVisible(dinner != null);
 }
Пример #7
0
  @Override
  protected void updateLabels() {
    jobNameField.setCaption(
        getI18N()
            .getMessage("com.thingtrack.konekti.view.web.form.JobViewForm.jobNameField.caption"));
    jobGroupField.setCaption(
        getI18N()
            .getMessage("com.thingtrack.konekti.view.web.form.JobViewForm.jobGroupField.caption"));
    startTimeField.setCaption(
        getI18N()
            .getMessage("com.thingtrack.konekti.view.web.form.JobViewForm.startTimeField.caption"));
    endTimeField.setCaption(
        getI18N()
            .getMessage("com.thingtrack.konekti.view.web.form.JobViewForm.endTimeField.caption"));
    areaField.setCaption(
        getI18N().getMessage("com.thingtrack.konekti.view.web.form.JobViewForm.areaField.caption"));
    descriptionField.setCaption(
        getI18N()
            .getMessage(
                "com.thingtrack.konekti.view.web.form.JobViewForm.descriptionField.caption"));
    jobTriggerTypeField.setCaption(
        getI18N()
            .getMessage(
                "com.thingtrack.konekti.view.web.form.JobViewForm.jobTriggerTypeField.caption"));
    jobTriggerPriorityField.setCaption(
        getI18N()
            .getMessage(
                "com.thingtrack.konekti.view.web.form.JobViewForm.jobTriggerPriorityField.caption"));
    future_timeField.setCaption(
        getI18N()
            .getMessage(
                "com.thingtrack.konekti.view.web.form.JobViewForm.future_timeField.caption"));
    futureField.setCaption(
        getI18N()
            .getMessage("com.thingtrack.konekti.view.web.form.JobViewForm.futureField.caption"));
    jobIntervalField.setCaption(
        getI18N()
            .getMessage(
                "com.thingtrack.konekti.view.web.form.JobViewForm.jobIntervalField.caption"));
    repeatCountField.setCaption(
        getI18N()
            .getMessage(
                "com.thingtrack.konekti.view.web.form.JobViewForm.repeatCountField.caption"));
    // jobCalendarField.setCaption(getI18N().getMessage("com.thingtrack.konekti.view.web.form.JobViewForm.jobCalendarField.caption"));

  }
  public void initComponent() {
    comboGroup0.setWidth("300px");
    comboGroup1.setWidth("300px");
    comboGroup2.setWidth("300px");
    comboGroup3.setWidth("300px");
    comboGroup4.setWidth("300px");
    comboGroup5.setWidth("300px");

    textField1.setWidth("200px");
    textField2.setWidth("300px");

    dateField1From.setDateFormat("dd/MM/yyyy");
    dateField1To.setDateFormat("dd/MM/yyyy");

    panelFilter.setCaption("Filter Criteria");
    panelOutput.setCaption("Jenis Laporan");
  }
Пример #9
0
 void modify(Dinner dinner) {
   this.dinner = dinner;
   if (dinner != null) {
     formFieldBindings = BeanFieldGroup.bindFieldsBuffered(dinner, this);
     dinnerDate.setEnabled(false);
     soup.focus();
   }
   setVisible(dinner != null);
 }
  // MEngeset data dari FormData ke form
  private void setData(FormDeletion data) {
    // untuk kebutuhan edit

    inputDeletionDate.setValue(data.getDeletionDate());
    information.setValue(data.getInformation());
    inputGoodsQuantity.setValue(data.getQuantity());
    inputGoodsSelect.setValue(data.getIdGoods());
    this.deletionId = data.getDeletionId();
    inputGoodsPrice.setValue(data.getPrice());
  }
  private FormDeletion getFormData(FormDeletion form) {
    form.setDeletionDate(inputDeletionDate.getValue());
    form.setInformation(information.getValue());
    form.setQuantity(inputGoodsQuantity.getValue());
    form.setIdGoods((String) inputGoodsSelect.getValue());
    form.setDeletionId(this.deletionId);
    form.setPrice(inputGoodsPrice.getValue());

    return form;
  }
 @Override
 public FormDeletion getFormData() {
   FormDeletion form = new FormDeletion(function);
   form.setDeletionDate(inputDeletionDate.getValue());
   form.setInformation(information.getValue());
   form.setQuantity(inputGoodsQuantity.getValue());
   form.setIdGoods((String) inputGoodsSelect.getValue());
   form.setDeletionId(this.deletionId);
   form.setPrice(inputGoodsPrice.getValue());
   return form;
 }
Пример #13
0
  void configureComponents() {
    saveButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    saveButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
    cloneDinnerButton.setStyleName(ValoTheme.BUTTON_FRIENDLY);
    removeButton.setStyleName(ValoTheme.BUTTON_DANGER);

    dinnerDate.setResolution(Resolution.DAY);
    soup.setContainerDataSource(new BeanItemContainer<>(DinnerComponent.class));
    meat.setContainerDataSource(new BeanItemContainer<>(DinnerComponent.class));
    starch.setContainerDataSource(new BeanItemContainer<>(DinnerComponent.class));
    vegetables.setContainerDataSource(new BeanItemContainer<>(DinnerComponent.class));
  }
  @Override
  public void setFormData(DeletedGoods deletion) {
    this.deletionId = deletion.getIdDeletedGoods();
    buttonSubmit.setCaption("Simpan Perubahan");

    inputDeletionDate.setValue(deletion.getDeletionDate());
    information.setValue(deletion.getInformation());
    inputGoodsQuantity.setValue(deletion.getQuantity() + "");
    inputGoodsSelect.setValue(deletion.getGoods().getIdGoods());
    inputGoodsPrice.setValue(deletion.getPrice() + "");
    System.out.println("deletionDate " + deletion.getDeletionDate());
    System.out.println("inputGoodsQuantity " + deletion.getQuantity());
    System.out.println("deletionDate " + deletion.getPrice());
  }
  public void setDisplay() {
    comboGroup0.setContainerDataSource(model.getBeanItemContainerFSalesman());
    comboGroup0.setNewItemsAllowed(false);
    comboGroup0.setFilteringMode(FilteringMode.CONTAINS);
    comboGroup0.setNullSelectionAllowed(true);

    comboGroup1.setContainerDataSource(model.getBeanItemContainerFVendor());
    comboGroup1.setNewItemsAllowed(false);
    comboGroup1.setFilteringMode(FilteringMode.CONTAINS);
    comboGroup1.setNullSelectionAllowed(true);

    comboGroup2.setContainerDataSource(model.getBeanItemContainerFCustomer());
    comboGroup2.setNewItemsAllowed(false);
    comboGroup2.setFilteringMode(FilteringMode.CONTAINS);
    comboGroup2.setNullSelectionAllowed(true);

    comboGroup3.setContainerDataSource(model.getBeanItemContainerFArea());
    comboGroup3.setNewItemsAllowed(false);
    comboGroup3.setFilteringMode(FilteringMode.CONTAINS);
    comboGroup3.setNullSelectionAllowed(true);

    comboGroup4.setContainerDataSource(model.getBeanItemContainerFSubArea());
    comboGroup4.setNewItemsAllowed(false);
    comboGroup4.setFilteringMode(FilteringMode.CONTAINS);
    comboGroup4.setNullSelectionAllowed(true);

    comboGroup5.setContainerDataSource(model.getBeanItemContainerFProductGroup());
    comboGroup5.setNewItemsAllowed(false);
    comboGroup5.setFilteringMode(FilteringMode.CONTAINS);
    comboGroup5.setNullSelectionAllowed(true);

    dateField1From.setValue(model.getTransaksiHelper().getCurrentTransDate());
    dateField1To.setValue(model.getTransaksiHelper().getCurrentTransDate());

    checkBoxFaktur.setEnabled(false);
  }
Пример #16
0
  public void save(Button.ClickEvent event) {
    if (dinnerDate.isEmpty()) {
      Notification.show("Dinner Date is missing", Notification.Type.TRAY_NOTIFICATION);
      return;
    }

    try {
      formFieldBindings.commit();
      getUI().getService().save(dinner);

      Notification.show("Dinner saved", Notification.Type.TRAY_NOTIFICATION);
      getUI().refreshDinnersData();
    } catch (FieldGroup.CommitException e) {
      Notification.show("Dinner not valid", Notification.Type.TRAY_NOTIFICATION);
    }
  }
Пример #17
0
  protected void handleFormSubmit() {
    try {
      // Check for errors
      form.commit(); // will throw exception in case validation is false

      // Create task
      Task task = taskService.newTask();
      task.setName(nameField.getValue().toString());
      task.setDescription(descriptionArea.getValue().toString());
      task.setDueDate((Date) dueDateField.getValue());
      task.setPriority(priorityComboBox.getPriority());
      task.setOwner(ExplorerApp.get().getLoggedInUser().getId());
      taskService.saveTask(task);

      // close popup and navigate to new group
      close();
      ExplorerApp.get().getViewManager().showTasksPage(task.getId());

    } catch (InvalidValueException e) {
      // Do nothing: the Form component will render the errormsgs automatically
      setHeight(350, UNITS_PIXELS);
    }
  }
Пример #18
0
  @Override
  protected void setup() {

    Locale locale = new Locale("fi", "FI");
    Calendar cal = Calendar.getInstance();
    cal.set(2010, 0, 1);

    DateField df = new DateField();
    df.setResolution(Resolution.DAY);
    df.setLocale(locale);
    df.setWidth("300px");

    String pattern = "d. MMMM'ta 'yyyy 'klo 'H.mm.ss";
    df.setDateFormat(pattern);

    df.setValue(cal.getTime());

    addComponent(df);
  }
Пример #19
0
 private void setDate(DateField date) {
   date.setValue(getDefaultDate());
 }
Пример #20
0
 public void cloneDinner(Button.ClickEvent event) {
   dinnerDate.setEnabled(true);
   dinnerDate.focus();
 }
Пример #21
0
  public DateFields() {
    setMargin(true);

    Label h1 = new Label("Date Fields");
    h1.addStyleName(ValoTheme.LABEL_H1);
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
    row.setSpacing(true);
    addComponent(row);

    DateField date = new DateField("Default resolution");
    setDate(date);
    row.addComponent(date);

    date = new DateField("Error");
    setDate(date);
    date.setComponentError(new UserError("Fix it, now!"));
    row.addComponent(date);

    date = new DateField("Error, borderless");
    setDate(date);
    date.setComponentError(new UserError("Fix it, now!"));
    date.addStyleName(ValoTheme.DATEFIELD_BORDERLESS);
    row.addComponent(date);

    CssLayout group = new CssLayout();
    group.setCaption("Grouped with a Button");
    group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    row.addComponent(group);

    final DateField date2 = new DateField();
    group.addComponent(date2);

    Button today =
        new Button(
            "Today",
            new ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                date2.setValue(new Date());
              }
            });
    group.addComponent(today);

    date = new DateField("Default resolution, explicit size");
    setDate(date);
    row.addComponent(date);
    date.setWidth("260px");
    date.setHeight("60px");

    date = new DateField("Second resolution");
    setDate(date);
    date.setResolution(Resolution.SECOND);
    row.addComponent(date);

    date = new DateField("Minute resolution");
    setDate(date);
    date.setResolution(Resolution.MINUTE);
    row.addComponent(date);

    date = new DateField("Hour resolution");
    setDate(date);
    date.setResolution(Resolution.HOUR);
    row.addComponent(date);

    date = new DateField("Disabled");
    setDate(date);
    date.setResolution(Resolution.HOUR);
    date.setEnabled(false);
    row.addComponent(date);

    date = new DateField("Day resolution");
    setDate(date);
    date.setResolution(Resolution.DAY);
    row.addComponent(date);

    date = new DateField("Month resolution");
    setDate(date);
    date.setResolution(Resolution.MONTH);
    row.addComponent(date);

    date = new DateField("Year resolution");
    setDate(date);
    date.setResolution(Resolution.YEAR);
    row.addComponent(date);

    date = new DateField("Custom color");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName("color1");
    row.addComponent(date);

    date = new DateField("Custom color");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName("color2");
    row.addComponent(date);

    date = new DateField("Custom color");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName("color3");
    row.addComponent(date);

    date = new DateField("Small");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName(ValoTheme.DATEFIELD_SMALL);
    row.addComponent(date);

    date = new DateField("Large");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName(ValoTheme.DATEFIELD_LARGE);
    row.addComponent(date);

    date = new DateField("Borderless");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName(ValoTheme.DATEFIELD_BORDERLESS);
    row.addComponent(date);

    date = new DateField("Week numbers");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.setLocale(new Locale("fi", "fi"));
    date.setShowISOWeekNumbers(true);
    row.addComponent(date);

    date = new DateField("US locale");
    setDate(date);
    date.setResolution(Resolution.SECOND);
    date.setLocale(new Locale("en", "US"));
    row.addComponent(date);

    date = new DateField("Custom format");
    setDate(date);
    date.setDateFormat("E dd/MM/yyyy");
    row.addComponent(date);

    date = new DateField("Tiny");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName(ValoTheme.DATEFIELD_TINY);
    row.addComponent(date);

    date = new DateField("Huge");
    setDate(date);
    date.setResolution(Resolution.DAY);
    date.addStyleName(ValoTheme.DATEFIELD_HUGE);
    row.addComponent(date);

    date = new InlineDateField("Date picker");
    setDate(date);
    setDateRange(date);
    row.addComponent(date);

    date = new InlineDateField("Date picker with week numbers");
    setDate(date);
    date.setLocale(new Locale("fi", "fi"));
    date.setShowISOWeekNumbers(true);
    row.addComponent(date);

    PropertysetItem item = new PropertysetItem();
    item.addItemProperty("date", new ObjectProperty<Date>(getDefaultDate()));

    FormLayout form = new FormLayout();
    form.setMargin(false);

    FieldGroup binder = new FieldGroup(item);
    form.addComponent(binder.buildAndBind("Picker in read-only field group", "date"));
    binder.setReadOnly(true);

    row.addComponent(form);
  }
Пример #22
0
  @AutoGenerated
  private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("650px");
    mainLayout.setHeight("220px");
    mainLayout.setMargin(true);

    // top-level component properties
    setWidth("650px");
    setHeight("220px");

    // jobGroupField
    jobGroupField = new TextField();
    jobGroupField.setCaption("Grupo");
    jobGroupField.setImmediate(false);
    jobGroupField.setWidth("140px");
    jobGroupField.setHeight("-1px");
    jobGroupField.setRequired(true);
    mainLayout.addComponent(jobGroupField, "top:20.0px;left:180.0px;");

    // jobIntervalField
    jobIntervalField = new TextField();
    jobIntervalField.setCaption("Intervalo");
    jobIntervalField.setImmediate(false);
    jobIntervalField.setWidth("60px");
    jobIntervalField.setHeight("-1px");
    mainLayout.addComponent(jobIntervalField, "top:180.0px;left:20.0px;");

    // jobNameField
    jobNameField = new TextField();
    jobNameField.setCaption("Nombre");
    jobNameField.setImmediate(false);
    jobNameField.setWidth("140px");
    jobNameField.setHeight("-1px");
    jobNameField.setRequired(true);
    mainLayout.addComponent(jobNameField, "top:20.0px;left:20.0px;");

    // jobTriggerPriorityField
    jobTriggerPriorityField = new TextField();
    jobTriggerPriorityField.setCaption("Job Trigger Priority");
    jobTriggerPriorityField.setImmediate(false);
    jobTriggerPriorityField.setWidth("160px");
    jobTriggerPriorityField.setHeight("-1px");
    mainLayout.addComponent(jobTriggerPriorityField, "top:140.0px;left:200.0px;");

    // jobTriggerTypeField
    jobTriggerTypeField = new ComboBox();
    jobTriggerTypeField.setCaption("Tipo Disparador");
    jobTriggerTypeField.setImmediate(true);
    jobTriggerTypeField.setWidth("160px");
    jobTriggerTypeField.setHeight("-1px");
    jobTriggerTypeField.setRequired(true);
    mainLayout.addComponent(jobTriggerTypeField, "top:140.0px;left:20.0px;");

    // cronExpressionField
    cronExpressionField = new TextField();
    cronExpressionField.setCaption("Expresión Cron ");
    cronExpressionField.setImmediate(false);
    cronExpressionField.setWidth("340px");
    cronExpressionField.setHeight("-1px");
    mainLayout.addComponent(cronExpressionField, "top:180.0px;left:20.0px;");

    // descriptionField
    descriptionField = new TextField();
    descriptionField.setCaption("Descripción");
    descriptionField.setImmediate(false);
    descriptionField.setWidth("620px");
    descriptionField.setHeight("-1px");
    mainLayout.addComponent(descriptionField, "top:100.0px;left:20.0px;");

    // endTimeField
    endTimeField = new DateField();
    endTimeField.setCaption("Fecha Finalización");
    endTimeField.setImmediate(false);
    endTimeField.setWidth("-1px");
    endTimeField.setHeight("-1px");
    endTimeField.setInvalidAllowed(false);
    mainLayout.addComponent(endTimeField, "top:60.0px;left:225.0px;");

    // futureField
    futureField = new CheckBox();
    futureField.setCaption("Futuro");
    futureField.setImmediate(false);
    futureField.setWidth("-1px");
    futureField.setHeight("-1px");
    mainLayout.addComponent(futureField, "top:140.0px;left:585.0px;");

    // future_timeField
    future_timeField = new TextField();
    future_timeField.setCaption("Future_time");
    future_timeField.setImmediate(false);
    future_timeField.setWidth("160px");
    future_timeField.setHeight("-1px");
    mainLayout.addComponent(future_timeField, "top:140.0px;left:400.0px;");

    // repeatCountField
    repeatCountField = new TextField();
    repeatCountField.setCaption("Repeticiones");
    repeatCountField.setImmediate(false);
    repeatCountField.setWidth("60px");
    repeatCountField.setHeight("24px");
    mainLayout.addComponent(repeatCountField, "top:180.0px;right:290.0px;");

    // startTimeField
    startTimeField = new DateField();
    startTimeField.setCaption("Fecha Comienzo");
    startTimeField.setImmediate(false);
    startTimeField.setWidth("-1px");
    startTimeField.setHeight("-1px");
    startTimeField.setInvalidAllowed(false);
    mainLayout.addComponent(startTimeField, "top:60.0px;left:20.0px;");

    // areaField
    areaField = new ComboBox();
    areaField.setCaption("Area Trabajo");
    areaField.setImmediate(false);
    areaField.setWidth("-1px");
    areaField.setHeight("-1px");
    areaField.setRequired(true);
    mainLayout.addComponent(areaField, "top:60.0px;left:420.0px;");

    // jobCalendarField
    jobCalendarField = new JobTriggerCalendarField();
    jobCalendarField.setImmediate(false);
    jobCalendarField.setWidth("-1px");
    jobCalendarField.setHeight("-1px");
    mainLayout.addComponent(jobCalendarField, "top:167.0px;left:397.0px;");

    // jobIntervalTypeField
    jobIntervalTypeField = new ComboBox();
    jobIntervalTypeField.setCaption("Tipo Intervalo");
    jobIntervalTypeField.setImmediate(false);
    jobIntervalTypeField.setWidth("175px");
    jobIntervalTypeField.setHeight("-1px");
    mainLayout.addComponent(jobIntervalTypeField, "top:180.0px;left:100.0px;");

    return mainLayout;
  }
Пример #23
0
  private void initUI() {
    addStyleName(Reindeer.WINDOW_LIGHT);
    setModal(true);
    setHeight("90%");
    setWidth("60%");
    center();

    HorizontalLayout bottom = new HorizontalLayout();
    bottom.setStyleName(ExplorerLayout.THEME);
    bottom.setSizeFull();
    // bottom.setMargin(true);
    bottom.setSpacing(true);
    bottom.addStyleName(Runo.LAYOUT_DARKER);
    this.setContent(bottom);

    scheduleEventFieldGroup = new FieldGroup();
    scheduleEventFieldGroup.setBuffered(true);
    if (currentBeanItem != null) {
      scheduleEventFieldGroup.setItemDataSource(currentBeanItem);
    }

    line = new GridLayout(4, 20);
    line.addStyleName("v-gridlayout");
    line.setWidth("100%");
    line.setSpacing(true);
    line.setMargin(true);

    final Label lbTitle = CommonFieldHandler.createLable("计划名称:");
    line.addComponent(lbTitle);
    line.setComponentAlignment(lbTitle, Alignment.MIDDLE_RIGHT);
    final TextField txtTitle = new TextField();
    txtTitle.setWidth("80%");
    scheduleEventFieldGroup.bind(txtTitle, "name");
    line.addComponent(txtTitle, 1, 0, 3, 0);
    line.setComponentAlignment(txtTitle, Alignment.MIDDLE_LEFT);

    Label label2 = CommonFieldHandler.createLable("开始时间:");
    line.addComponent(label2, 0, 1, 0, 1);
    line.setComponentAlignment(label2, Alignment.MIDDLE_RIGHT);
    // 创建一个时间后台变化的listener
    BlurListener startTimeListener = createTimeReCountListener();
    DateField startDateField = CommonFieldHandler.createDateField("", false);
    scheduleEventFieldGroup.bind(startDateField, "startDate");
    startDateField.addBlurListener(startTimeListener);
    line.addComponent(startDateField, 1, 1, 1, 1);
    line.setComponentAlignment(startDateField, Alignment.MIDDLE_LEFT);

    Label label3 = CommonFieldHandler.createLable("估算时间:");
    line.addComponent(label3, 2, 1, 2, 1);
    line.setComponentAlignment(label3, Alignment.MIDDLE_RIGHT);
    HorizontalLayout hlay = new HorizontalLayout();
    final TextField estimateField = new TextField();
    estimateField.setValue("1");
    estimateField.setWidth("60px");
    estimateField.setNullSettingAllowed(false);
    BlurListener timeReCountListener = createTimeReCountListener();
    estimateField.addBlurListener(timeReCountListener);
    scheduleEventFieldGroup.bind(estimateField, "estimate");
    hlay.addComponent(estimateField);
    Map<Object, String> data = new HashMap();
    data.put(0, "天");
    data.put(1, "时");
    data.put(2, "分");
    // WW_TODO 估算时间单位
    ComboBox unit_cb = createComboBox(data, "55px");
    scheduleEventFieldGroup.bind(unit_cb, "estimateUnit");
    hlay.addComponent(unit_cb);
    line.addComponent(hlay, 3, 1, 3, 1);
    line.setComponentAlignment(hlay, Alignment.MIDDLE_LEFT);

    Label label4 = CommonFieldHandler.createLable("到期时间:");
    line.addComponent(label4, 0, 2, 0, 2);
    line.setComponentAlignment(label4, Alignment.MIDDLE_RIGHT);
    completionDateField = CommonFieldHandler.createDateField("", false);
    line.addComponent(completionDateField, 1, 2, 1, 2);
    line.setComponentAlignment(completionDateField, Alignment.MIDDLE_LEFT);
    scheduleEventFieldGroup.bind(completionDateField, "completionDate");
    //		line.setExpandRatio(completionDateField, 1.0f);

    Label label6 = CommonFieldHandler.createLable("消耗时间:");
    line.addComponent(label6, 2, 2, 2, 2);
    line.setComponentAlignment(label6, Alignment.MIDDLE_RIGHT);
    TextField gs1 = new TextField();
    gs1.setValue("20%");
    gs1.setInputPrompt("50%");
    scheduleEventFieldGroup.bind(gs1, "useup");
    line.addComponent(gs1, 3, 2, 3, 2);
    line.setComponentAlignment(gs1, Alignment.MIDDLE_LEFT);

    Label label5 = CommonFieldHandler.createLable("优先级:");
    //		label.setWidth("80px");
    line.addComponent(label5, 0, 3, 0, 3);
    line.setComponentAlignment(label5, Alignment.MIDDLE_RIGHT);
    Map<Object, String> dtp = new HashMap();
    dtp.put(0, "底");
    dtp.put(1, "中");
    dtp.put(2, "高");
    ComboBox selectPriority = createComboBox(dtp, "100px");
    //		NativeSelect select = new NativeSelect();
    //		select.addItem("无");
    //		select.addItem("0(最低)");
    //		String itemId = "1(中)";
    //		select.addItem(itemId);
    //		select.addItem("2(高)");
    selectPriority.setNullSelectionAllowed(false);
    selectPriority.select(2);
    scheduleEventFieldGroup.bind(selectPriority, "priority");
    line.addComponent(selectPriority, 1, 3, 1, 3);
    line.setComponentAlignment(selectPriority, Alignment.MIDDLE_LEFT);

    Label label1 = CommonFieldHandler.createLable("完成百分比:");
    line.addComponent(label1, 2, 3, 2, 3);
    line.setComponentAlignment(label1, Alignment.MIDDLE_RIGHT);
    TextField tf = new TextField();
    tf.setInputPrompt("50%");
    line.addComponent(tf, 3, 3, 3, 3);
    line.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);

    Label label7 = CommonFieldHandler.createLable("关联日程:");
    line.addComponent(label7, 0, 4, 0, 4);
    line.setComponentAlignment(label7, Alignment.MIDDLE_RIGHT);
    CheckBox relatedCalendar_cb = new CheckBox();
    relatedCalendar_cb.setValue(false);
    line.addComponent(relatedCalendar_cb, 1, 4, 1, 4);
    line.setComponentAlignment(relatedCalendar_cb, Alignment.MIDDLE_LEFT);
    scheduleEventFieldGroup.bind(relatedCalendar_cb, "relatedCalendar");

    Label lbStatus = CommonFieldHandler.createLable("计划状态:");
    lbStatus.setWidth("20px");
    line.addComponent(lbStatus, 2, 4, 2, 4);
    line.setComponentAlignment(lbStatus, Alignment.MIDDLE_RIGHT);
    Map<Object, String> sta = new HashMap();
    sta.put(0, "新建");
    sta.put(1, "完成");
    sta.put(2, "关闭");
    sta.put(3, "取消");
    ComboBox sectStatus = createComboBox(sta, "100px");
    sectStatus.setNullSelectionAllowed(false);
    scheduleEventFieldGroup.bind(sectStatus, "status");
    line.addComponent(sectStatus, 3, 4, 3, 4);
    line.setComponentAlignment(sectStatus, Alignment.MIDDLE_LEFT);

    Label label8 = CommonFieldHandler.createLable("关联外部任务:");
    label8.setWidth("20px");
    line.addComponent(label8, 0, 5, 0, 5);
    line.setComponentAlignment(label8, Alignment.MIDDLE_RIGHT);
    CheckBox cb = new CheckBox();
    cb.setValue(true);
    line.addComponent(cb, 1, 5, 1, 5);
    line.setComponentAlignment(cb, Alignment.MIDDLE_LEFT);
    scheduleEventFieldGroup.bind(cb, "relatedTask");

    Label label9 = CommonFieldHandler.createLable("外部任务类型:");
    label9.setWidth("20px");
    line.addComponent(label9, 2, 5, 2, 5);
    line.setComponentAlignment(label9, Alignment.MIDDLE_RIGHT);
    Map<Object, String> oat = new HashMap();
    oat.put(0, "外包任务");
    oat.put(1, "外包任务-类型2");
    ComboBox select2 = createComboBox(oat, "150px");
    //		NativeSelect select2 = new NativeSelect();
    //		select2.addItem("外包任务");
    //		select2.addItem("外包任务-类型2");
    select2.setNullSelectionAllowed(false);
    scheduleEventFieldGroup.bind(select2, "type");
    line.addComponent(select2, 3, 5, 3, 5);
    line.setComponentAlignment(select2, Alignment.MIDDLE_LEFT);
    // select2.select("Timed");

    Label lbOwnGrp = CommonFieldHandler.createLable("计划分配团队:");
    lbOwnGrp.setWidth("20px");
    line.addComponent(lbOwnGrp, 0, 6, 0, 6);
    line.setComponentAlignment(lbOwnGrp, Alignment.MIDDLE_RIGHT);

    //		NativeSelect sectOwnGrp = new NativeSelect();
    Map<Object, String> groupsMap =
        teamService.queryTeamOfUser(LoginHandler.getLoggedInUser().getId());
    groupsMap.put("", "请选择");
    ComboBox sectOwnGrp = createComboBox(groupsMap, "150px");
    //		for (String p : groupsMap.keySet()) {
    //			String title = groupsMap.get(p);
    //			sectOwnGrp.addItem(p);
    //			sectOwnGrp.setItemCaption(p, title);
    //		}
    sectOwnGrp.setNullSelectionAllowed(false);
    ValueChangeListener valueChangeListener = createValueChangeListener();
    sectOwnGrp.addValueChangeListener(valueChangeListener);
    sectOwnGrp.setImmediate(true);
    scheduleEventFieldGroup.bind(sectOwnGrp, "assignedTeam");
    line.addComponent(sectOwnGrp, 1, 6, 1, 6);
    line.setComponentAlignment(sectOwnGrp, Alignment.MIDDLE_LEFT);

    final Label lbOwner = CommonFieldHandler.createLable("计划分配用户:");
    lbOwner.setWidth("20px");
    line.addComponent(lbOwner, 2, 6, 2, 6);
    line.setComponentAlignment(lbOwner, Alignment.MIDDLE_RIGHT);
    //		sectOwner = new NativeSelect();
    //		sectOwner.addItem("请选择");
    sectOwner.setNullSelectionAllowed(false);
    scheduleEventFieldGroup.bind(sectOwner, "assignedUser");
    line.addComponent(sectOwner, 3, 6, 3, 6);
    line.setComponentAlignment(sectOwner, Alignment.MIDDLE_LEFT);

    final Label lbDesc = CommonFieldHandler.createLable("计划描述:");
    lbDesc.setWidth("15px");
    line.addComponent(lbDesc, 0, 7, 0, 7);
    line.setComponentAlignment(lbDesc, Alignment.MIDDLE_RIGHT);
    final TextArea taDesc = CommonFieldHandler.createTextArea("");
    taDesc.setWidth("85%");
    taDesc.setHeight("290px");
    scheduleEventFieldGroup.bind(taDesc, "description");
    line.addComponent(taDesc, 1, 7, 3, 13);
    line.setComponentAlignment(taDesc, Alignment.MIDDLE_LEFT);

    //		CKEditorConfig config = new CKEditorConfig();

    final Button updateSave = new Button("保存");
    updateSave.addClickListener(
        new ClickListener() {
          @SuppressWarnings("unchecked")
          public void buttonClick(ClickEvent event) {
            // WW_TODO 修改保存到数据库
            Todo fieldGroupTodo = saveFieldGroupToDB();
            fireEvent(
                new SubmitEvent(
                    updateSave,
                    SubmitEvent.SUBMITTED,
                    scheduleEventFieldGroup.getItemDataSource()));

            // close popup window
            close();
            /*
             * Todo fieldGroupTodo = saveFieldGroupToDB(); //reflash current
             * Item copyBeanValueToContainer(hContainer,(BeanItem<Todo>)(
             * scheduleEventFieldGroup.getItemDataSource())); //刷新日历
             * main.refreshCalendarView(); Notification.show("保存成功",
             * Notification.Type.HUMANIZED_MESSAGE); //如果有外部流程,启动外部流程 if
             * (fieldGroupTodo.getRelatedTask()) { ViewToolManager
             * .showPopupWindow(new ActivityStartPopupWindow( "1111")); }
             */
            if (fieldGroupTodo.getRelatedTask()) {
              ViewToolManager.showPopupWindow(new ActivityStartPopupWindow("1111"));
            }
          }
        });
    line.addComponent(updateSave, 3, 14, 3, 14);
    line.setComponentAlignment(updateSave, Alignment.MIDDLE_RIGHT);
    //		line.setExpandRatio(updateSave, 1.0f);

    bottom.addComponent(line);
  }
  public void init(String title, Class<T> typeOfRows, String objectCode) {
    setModal(true);
    setClosable(true);
    setResizable(false);
    setDraggable(false);
    setHeight("90%");
    setWidth("100%");
    setCaption("<b>" + title + "</b>");
    setCaptionAsHtml(true);

    this.objectCode = objectCode;

    dfFrom = new DateField();
    dfFrom.setCaption("Từ Ngày");
    dfFrom.addStyleName("date-field-caption");
    dfTo = new DateField();
    dfTo.setCaption("Đến Ngày");
    dfTo.addStyleName("date-field-caption");
    btnOk = new Button("Xem Báo Cáo");
    btnOk.addStyleName(ValoTheme.BUTTON_SMALL);
    btnOk.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    btnOk.addStyleName("margin-top-2px");

    gridSummaryReportDetail = new MGrid<ReportDetailSummary>(ReportDetailSummary.class);
    gridSummaryReportDetail.setWidth("50%");
    gridSummaryReportDetail.setHeight("77px");
    gridSummaryReportDetail.setEditorEnabled(false);
    gridSummaryReportDetail.setSelectionMode(SelectionMode.NONE);
    gridSummaryReportDetail.withProperties(
        "openingStock", "issueInPeriod", "receiptInPeriod", "closingStock");

    gridContent = new MGrid<>(typeOfRows);

    VerticalLayout wrapper = new VerticalLayout();
    wrapper.setSpacing(true);

    // Add first line
    HorizontalLayout hrzDateFields = new HorizontalLayout();
    wrapper.addComponent(hrzDateFields);
    wrapper.setComponentAlignment(hrzDateFields, Alignment.TOP_CENTER);
    hrzDateFields.addComponent(dfFrom);
    hrzDateFields.addComponent(dfTo);
    hrzDateFields.addComponent(btnOk);
    hrzDateFields.addStyleName("margin-left-right-20px df-report-detail-style");

    // Add second line
    wrapper.addComponent(gridSummaryReportDetail);
    wrapper.setComponentAlignment(gridSummaryReportDetail, Alignment.TOP_CENTER);

    wrapper.addComponent(gridContent);
    gridContent.setWidth("100%");
    gridContent.setHeight("10%");
    gridContent.setEditorEnabled(false);
    gridContent.setSelectionMode(SelectionMode.NONE);

    gridContentProperties = new ArrayList<String>();

    withTableProperties(getProperties());
    withHeaderNames(getHeaderNames());
    setContent(wrapper);

    btnOk.addClickListener(
        new ClickListener() {
          private static final long serialVersionUID = -2918006939436642296L;

          @Override
          public void buttonClick(ClickEvent event) {
            if (!objectCode.isEmpty()) {
              generateSummaryReportDetails(dfFrom.getValue(), dfTo.getValue());
              generateReportDetails(dfFrom.getValue(), dfTo.getValue());
            }
          }
        });
  }
  public void initComponent() {
    table =
        new Table() {
          @Override
          protected String formatPropertyValue(Object rowId, Object colId, Property property) {
            // Format by property type
            try {
              if (property.getType() == Date.class && property.getValue() != null) {
                SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
                return df.format((Date) property.getValue());
              }
            } catch (Exception ex) {
            }

            try {
              if (property.getType() == Boolean.class) {
                if ((Boolean) property.getValue() == true) {
                  return "CLOSE";
                } else {
                  return "-";
                }
              }
            } catch (Exception ex) {
            }

            return super.formatPropertyValue(rowId, colId, property);
          }
        };

    // Inisialisasi Panel
    setSizeFull();
    content.setSizeFull();
    content.setMargin(true);

    // INIT COMPONENT TENGAH
    table.setSizeFull();
    table.setSelectable(true);
    table.setImmediate(true);
    table.setBuffered(false);
    table.setFooterVisible(true);

    // INIT COMPONENT ATAS
    btnSeparator1.setEnabled(false);
    btnSeparator2.setEnabled(false);

    //		fieldSearchByRekap = new TextField("NO. REKAP");
    fieldSearchById = new TextField("NO. REKAP");
    fieldSearchById.setInputPrompt("NO. REKAP");
    fieldSearchById.setStyleName(Reindeer.TEXTFIELD_SMALL);
    fieldSearchById.setWidth("120px");

    //		fieldSearchByInvoice = new TextField("INVOICE");
    comboSearchByDivision = new ComboBox("DIVISION");
    comboSearchByDivision.setInputPrompt("DIVISION");
    comboSearchByDivision.setStyleName(Reindeer.TEXTFIELD_SMALL);
    comboSearchByDivision.setWidth("120px");

    dateFieldSearchByTransdateFrom = new DateField("INV FROM");
    dateFieldSearchByTransdateFrom.setStyleName(Reindeer.TEXTFIELD_SMALL);
    dateFieldSearchByTransdateFrom.setWidth("120px");

    dateFieldSearchByTransdateTo = new DateField("INV TO");
    dateFieldSearchByTransdateTo.setStyleName(Reindeer.TEXTFIELD_SMALL);
    dateFieldSearchByTransdateTo.setWidth("120px");

    btnSearch.setStyleName(Reindeer.BUTTON_SMALL);

    btnSearch.setIcon(new ThemeResource("images/navigation/12x12/Find.png"));
    btnSelect.setIcon(new ThemeResource("images/navigation/16x16/OK.png"));
  }
Пример #26
0
  /**
   * The constructor should first build the main layout, set the composition root and then do any
   * custom initialization.
   *
   * <p>The constructor will not be automatically regenerated by the visual editor.
   *
   * @throws Exception
   * @throws IllegalArgumentException
   */
  public JobViewForm() throws IllegalArgumentException, Exception {
    buildMainLayout();
    setCompositionRoot(mainLayout);

    // TODO add user code here
    initComponents();

    cronExpressionField.setVisible(false);
    future_timeField.setEnabled(false);
    startTimeField.setResolution(DateField.RESOLUTION_SEC);
    endTimeField.setResolution(DateField.RESOLUTION_SEC);

    // configure Type data
    areaField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    areaField.setItemCaptionPropertyId("name");

    jobTriggerTypeField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    jobTriggerTypeField.setItemCaptionPropertyId("description");

    jobIntervalTypeField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    jobIntervalTypeField.setItemCaptionPropertyId("description");

    // get form services from OSGi Service Registry
    getServices();

    // load data sources
    loadData();

    futureField.setImmediate(true);
    futureField.addListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() == null) return;

            if ((Boolean) event.getProperty().getValue()) future_timeField.setEnabled(true);
            else {
              future_timeField.setValue(null);
              future_timeField.setEnabled(false);
            }
          }
        });

    jobTriggerTypeField.setImmediate(true);
    jobTriggerTypeField.setNullSelectionAllowed(false);
    jobTriggerTypeField.addListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() == null) return;

            if (((JobTriggerType) event.getProperty().getValue())
                .getCode()
                .equals(Job.JOB_TRIGGER_TYPE.SIMPLE.name())) {
              jobIntervalField.setVisible(true);
              jobIntervalTypeField.setVisible(true);
              repeatCountField.setVisible(true);
              cronExpressionField.setVisible(false);
            } else {
              jobIntervalField.setVisible(false);
              jobIntervalTypeField.setVisible(false);
              repeatCountField.setVisible(false);
              cronExpressionField.setVisible(true);
            }
          }
        });
  }
  @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();
  }
  public void initComponent() {

    tableList =
        new Table() {
          @Override
          protected String formatPropertyValue(Object rowId, Object colId, Property property) {
            // Format by property type
            if (property.getType() == Date.class && property.getValue() != null) {
              SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
              return df.format((Date) property.getValue());
            }

            //		        if (property.getType()==Boolean.class){
            //		        	if ((Boolean) property.getValue()==true) {
            //		        		return "Active";
            //		        	} else {
            //		        		return "-";
            //		        	}
            //		        }

            return super.formatPropertyValue(rowId, colId, property);
          }
        };
    tableDetil =
        new Table() {
          @Override
          protected String formatPropertyValue(Object rowId, Object colId, Property property) {
            // Format by property type
            if (property.getType() == Date.class && property.getValue() != null) {
              SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
              return df.format((Date) property.getValue());
            }

            //		        if (property.getType()==Boolean.class){
            //		        	if ((Boolean) property.getValue()==true) {
            //		        		return "Active";
            //		        	} else {
            //		        		return "-";
            //		        	}
            //		        }

            return super.formatPropertyValue(rowId, colId, property);
          }
        };

    // ::LIST
    fieldSearch1.setWidth("100px");
    fieldSearch2.setWidth("100px");
    fieldSearch2.setWidth("100px");
    comboSearch1.setWidth("200px");
    comboSearch2.setWidth("200px");

    // ::DETIL
    fieldNomor.setNullRepresentation("");
    fieldInvoiceno.setNullRepresentation("");

    fieldNomor.setWidth("100px");
    fieldInvoiceno.setWidth("100px");
    comboTipeopname.setWidth("200px");
    comboTipeopname.setFilteringMode(FilteringMode.CONTAINS);
    comboWarehouse.setWidth("200px");
    comboWarehouse.setFilteringMode(FilteringMode.CONTAINS);

    dateFieldTrdate.setDateFormat("dd/MM/yyyy");
    dateFieldEntrydate.setDateFormat("dd/MM/yyyy");
    dateFieldTrdate.setWidth("100px");
    dateFieldEntrydate.setWidth("100px");

    btnSearch.setIcon(new ThemeResource("../images/navigation/12x12/Find.png"));
    btnNewForm.setIcon(new ThemeResource("../images/navigation/12x12/Create.png"));
    btnEditForm.setIcon(new ThemeResource("../images/navigation/12x12/Pencil.png"));
    btnDeleteForm.setIcon(new ThemeResource("../images/navigation/12x12/Erase.png"));
    //		btnPrint.setIcon(new ThemeResource("../images/navigation/12x12/Print.png"));

    btnSaveForm.setIcon(new ThemeResource("../images/navigation/12x12/Save.png"));
    btnCancelForm.setIcon(new ThemeResource("../images/navigation/12x12/Undo.png"));

    btnAddItem.setIcon(new ThemeResource("../images/navigation/12x12/Create.png"));
    btnEditForm.setIcon(new ThemeResource("../images/navigation/12x12/Pencil.png"));
    btnRemoveItem.setIcon(new ThemeResource("../images/navigation/12x12/Erase.png"));

    btnPosting.setIcon(new ThemeResource("../images/navigation/12x12/OK.png"));
    //		btnPostingBatal.setIcon(new ThemeResource("../images/navigation/12x12/OK.png"));
    btnLapselisih.setIcon(new ThemeResource("../images/navigation/12x12/Print.png"));

    tableList.setSelectable(true);
    tableList.setImmediate(true);
    tableList.setBuffered(false);
    tableList.setFooterVisible(true);

    tableDetil.setSelectable(true);
    tableDetil.setImmediate(true);
    tableDetil.setBuffered(false);
    tableDetil.setFooterVisible(true);

    // VALIDATOR
    fieldNomor.setRequired(true);
    comboTipeopname.setRequired(true);
    comboWarehouse.setRequired(true);
    dateFieldTrdate.setRequired(true);
    //		fieldDescription.setRequired(true);

    btnSeparator1.setEnabled(false);
    btnSeparator2.setEnabled(false);

    // FIELD FOOTER
    fieldDisc1 = new TextField();
    fieldDisc1rp = new TextField();
    fieldDisc1rpafterppn = new TextField();
    fieldDisc1.setWidth("50px");
    fieldDisc1rp.setWidth("50px");
    fieldDisc1rpafterppn.setWidth("150px");
    fieldDisc1rpafterppn.addStyleName("numerical");

    fieldDisc2 = new TextField();
    fieldDisc2rp = new TextField();
    fieldDisc2rpafterppn = new TextField();
    fieldDisc2.setWidth("50px");
    fieldDisc2rp.setWidth("50px");
    fieldDisc2rpafterppn.setWidth("150px");
    fieldDisc2rpafterppn.addStyleName("numerical");

    fieldDisc = new TextField();
    fieldDiscrp = new TextField();
    fieldDiscrpafterppn = new TextField();
    fieldDisc.setWidth("50px");
    fieldDiscrp.setWidth("50px");
    fieldDiscrpafterppn.setWidth("150px");
    fieldDiscrpafterppn.addStyleName("numerical");

    fieldAmount.setWidth("200px");
    fieldAmount.addStyleName("numerical");
    fieldAmountafterdisc.setWidth("200px");
    fieldAmountafterdisc.addStyleName("numerical");
    fieldAmountafterdiscafterppn.setWidth("200px");
    fieldAmountafterdiscafterppn.addStyleName("numerical");
    fieldAmountafterppn.setWidth("200px");
    fieldAmountafterppn.addStyleName("numerical");
    fieldAmountpay.setWidth("200px");
    fieldAmountpay.addStyleName("numerical");
    fieldAmountpayfaterppn.setWidth("200px");
    fieldAmountpayfaterppn.addStyleName("numerical");
    fieldPpnrp.setWidth("200px");
    fieldPpnrp.addStyleName("numerical");

    fieldPpnpercent.setWidth("50px");
  }
  @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();
  }
 public void setDateValue(Date fromDate, Date toDate) {
   dfFrom.setValue(fromDate);
   dfTo.setValue(toDate);
 }