Ejemplo n.º 1
0
 private ContentType getNewEntity(FieldGroup binder) {
   final ContentTypeModel bean =
       ((BeanItem<ContentTypeModel>) binder.getItemDataSource()).getBean();
   Map<String, String> contentTypeVals = new HashMap<>();
   contentTypeVals.put("name", bean.getName());
   contentTypeVals.put("description", bean.getDescription());
   final ContentType contentType = ContentTypeFactory.getContentType(contentTypeVals);
   return contentType;
 }
Ejemplo n.º 2
0
 private ContentType getUpdateEntity(FieldGroup binder) {
   final ContentTypeModel bean =
       ((BeanItem<ContentTypeModel>) binder.getItemDataSource()).getBean();
   final ContentType contentType =
       new ContentType.Builder()
           .name(bean.getName())
           .description(bean.getDescription())
           .id(table.getValue().toString())
           .build();
   return contentType;
 }
Ejemplo n.º 3
0
 @SuppressWarnings("unchecked")
 private Todo getFieldGroupTodo() {
   BeanItem<Todo> item = (BeanItem<Todo>) scheduleEventFieldGroup.getItemDataSource();
   Todo todo = item.getBean();
   // WW_TODO 保存是设置项目id和用户
   if (!StringTool.judgeBlank(todo.getProId())) {
     todo.setProId(projectId);
   }
   if (todo.getAssignedUser() == null) {
     todo.setAssignedUser(LoginHandler.getLoggedInUser().getId());
   }
   return todo;
 }
Ejemplo n.º 4
0
 @Override
 protected Layout addFields(FieldGroup fieldGroup) {
   Layout l = super.addFields(fieldGroup);
   Field id = (Field) fieldGroup.getField("id");
   id.setRequired(true);
   id.setRequiredError(getApp().getMessage("errorMessage.req", id.getCaption()));
   String idValue = (String) fieldGroup.getItemDataSource().getItemProperty("id").getValue();
   // Hide prefix
   if (idValue != null) { // Means it is not a new sysconfig entry
     id.setReadOnly(false);
     idValue = prefix != null ? idValue.substring(prefix.length()) : idValue;
     id.setValue(idValue);
     id.setReadOnly(true);
   }
   return l;
 }
Ejemplo n.º 5
0
  private OperatingCost getEntity(FieldGroup binder) {
    final OperatingCostBean operatingCostsBean =
        ((BeanItem<OperatingCostBean>) binder.getItemDataSource()).getBean();
    final Person driver =
        PersonFacade.getPersonService().findById(operatingCostsBean.getDriverId());

    final OperatingCost operatingCosts =
        new OperatingCost.Builder(new Date())
            .fuelCost(operatingCostsBean.getFuelCost())
            .fuelLitres(operatingCostsBean.getFuelLitres())
            .oilCost(operatingCostsBean.getOilCost())
            .oilLitres(operatingCostsBean.getOilLitres())
            .speedometer(operatingCostsBean.getSpeedometer())
            .slipNo(operatingCostsBean.getSlipNo())
            .driver(driver)
            .id(operatingCostsBean.getId())
            .build();

    return operatingCosts;
  }