当前位置: 首页>>代码示例>>Java>>正文


Java InvalidValueException类代码示例

本文整理汇总了Java中com.vaadin.data.Validator.InvalidValueException的典型用法代码示例。如果您正苦于以下问题:Java InvalidValueException类的具体用法?Java InvalidValueException怎么用?Java InvalidValueException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InvalidValueException类属于com.vaadin.data.Validator包,在下文中一共展示了InvalidValueException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: commit

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
@Override
public void commit() throws SourceException, InvalidValueException {
	final CommitHandler<ITEM> handler = getCommitHandler()
			.orElseThrow(() -> new IllegalStateException("Missing CommitHandler"));
	List<ITEM> added = requireItemStore().getAddedItems().stream().map(i -> requireItemAdapter().restore(this, i))
			.collect(Collectors.toList());
	List<ITEM> modified = requireItemStore().getModifiedItems().stream()
			.map(i -> requireItemAdapter().restore(this, i)).collect(Collectors.toList());
	List<ITEM> removed = requireItemStore().getRemovedItems().stream()
			.map(i -> requireItemAdapter().restore(this, i)).collect(Collectors.toList());
	if (!added.isEmpty() || !modified.isEmpty() || !removed.isEmpty()) {
		final List<ITEM> addedItemReversed = new ArrayList<>(added);
		Collections.reverse(addedItemReversed);
		handler.commit(addedItemReversed, modified, removed);
		// reset items store
		requireItemStore().reset(false, false);
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:19,代码来源:DefaultItemDataSourceContainer.java

示例2: RequiredIntegerField

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
/**
 * Constructeur
 */
public RequiredIntegerField() {
	super();		
	setConverter(new StringToIntegerConverter() {
           private static final long serialVersionUID = -1725520453911073564L;

           @Override
           protected NumberFormat getFormat(Locale locale) {
               return new DecimalFormat("#");
           }
       });
	addValidator(value->{
		if (value==null){
			return;
		}
		Integer integerValue = null;
		try{
			integerValue = Integer.valueOf(value.toString());				
		}catch (Exception e){
			throw new InvalidValueException(getConversionError());
		}
		if (value!=null && integerValue<0){
			throw new InvalidValueException(getConversionError());
		}
	});
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:29,代码来源:RequiredIntegerField.java

示例3: doSave

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
protected void doSave() {
	try {
		//
		// Commit changes
		//
		self.tableFunctions.commit();
		//
		// We are saved
		//
		self.isSaved = true;
		//
		// Close the window
		//
		self.close();
	} catch (SourceException | InvalidValueException e) {
		return;
	}
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:19,代码来源:MatchEditorWindow.java

示例4: doSave

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
protected void doSave() {
	try {
		//
		// Commit changes
		//
		self.tableFunctions.commit();
		//
		// We are saved
		//
		self.isSaved = true;
		//
		// Close the window
		//
		self.close();
	} catch (SourceException | InvalidValueException e) { //NOPMD
		//
		// Nothing to do, Vaadin highlights
		//
	}
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:21,代码来源:FunctionSelectionWindow.java

示例5: initializeButton

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
protected void initializeButton() {
	self.buttonSave.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			try {
				//
				// Commit
				//
				self.textFieldColumn.commit();
				//
				// If we get here, the value is valid.
				// Mark ourselves as saved and close the window
				//
				self.isSaved = true;
				self.close();
			} catch (SourceException | InvalidValueException e) { //NOPMD
				//
				// Vaadin will display error
				//
			}
		}
	});
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:26,代码来源:ColumnSelectionWindow.java

示例6: validate

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
@Override
public void validate() throws InvalidValueException {
	if (this.mainLayout.getComponentCount() == 0) {
		return;
	}
	Component c = this.mainLayout.getComponent(0);
	if (c instanceof SQLPIPConfigurationComponent) {
		((SQLPIPConfigurationComponent)c).validate();
	} else if (c instanceof LDAPPIPConfigurationComponent) {
		((LDAPPIPConfigurationComponent)c).validate();
	} else if (c instanceof CSVPIPConfigurationComponent) {
		((CSVPIPConfigurationComponent)c).validate();
	} else if (c instanceof HyperCSVPIPConfigurationComponent) {
		((HyperCSVPIPConfigurationComponent)c).validate();
	} else if (c instanceof CustomPIPConfigurationComponent) {
		((CustomPIPConfigurationComponent)c).validate();
	}
	super.validate();
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:20,代码来源:ConfigParamField.java

示例7: commit

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
@Override
public void commit() throws SourceException, InvalidValueException {
	if (this.mainLayout.getComponentCount() == 0) {
		return;
	}
	Component c = this.mainLayout.getComponent(0);
	if (c instanceof SQLPIPConfigurationComponent) {
		((SQLPIPConfigurationComponent)c).commit();
	} else if (c instanceof LDAPPIPConfigurationComponent) {
		((LDAPPIPConfigurationComponent)c).commit();
	} else if (c instanceof CSVPIPConfigurationComponent) {
		((CSVPIPConfigurationComponent)c).commit();
	} else if (c instanceof HyperCSVPIPConfigurationComponent) {
		((HyperCSVPIPConfigurationComponent)c).commit();
	} else if (c instanceof CustomPIPConfigurationComponent) {
		((CustomPIPConfigurationComponent)c).commit();
	}
	super.commit();
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:20,代码来源:ConfigParamField.java

示例8: getFormPropertyValues

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
/**
 * Returns all values filled in in the writable fields on the form.
 * 
 * @throws InvalidValueException when a validation error occurs.
 */
public Map<String, String> getFormPropertyValues() throws InvalidValueException {
  // Commit the form to ensure validation is executed
  form.commit();
  
  Map<String, String> formPropertyValues = new HashMap<String, String>();
  
  // Get values from fields defined for each form property
  for(FormProperty formProperty : formProperties) {
    if(formProperty.isWritable()) {
      Field field = form.getField(formProperty.getId());
      FormPropertyRenderer renderer = getRenderer(formProperty);
      String fieldValue = renderer.getFieldValue(formProperty, field);
      
      formPropertyValues.put(formProperty.getId(), fieldValue);
    }
  }
  return formPropertyValues;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:24,代码来源:FormPropertiesComponent.java

示例9: getAttachment

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
public Attachment getAttachment() throws InvalidValueException {
  // Force validation of the fields
  form.commit();
  
  // Check if file is uploaded
  if(!fileUploaded) {
    InvalidValueException ive = new InvalidValueException(i18nManager.getMessage(Messages.RELATED_CONTENT_TYPE_FILE_REQUIRED));
    form.setComponentError(ive);
    throw ive;
  }
  
  if(attachment != null) {
    applyValuesToAttachment();
  } else {
    // Create new attachment based on values
    // TODO: use explorerApp to get services
    attachment = taskService.createAttachment(mimeType, taskId, processInstanceId, 
        getAttachmentName(), getAttachmentDescription(), new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
  }
  return attachment;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:FileAttachmentEditorComponent.java

示例10: handleFormSubmit

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
protected void handleFormSubmit() {
  try {
    // create user
    form.commit(); // will throw exception in case validation is false
    User user = createUser();
    
    // close popup and navigate to fresh user
    close();
    ExplorerApp.get().getViewManager().showUserPage(user.getId());
    
    // Update user cache
    ExplorerApp.get().getUserCache().notifyUserDataChanged(user.getId());
    
  } catch (InvalidValueException e) {
    // Do nothing: the Form component will render the errormsgs automatically
    setHeight(340, UNITS_PIXELS);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:NewUserPopupWindow.java

示例11: handleFormSubmit

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
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);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:24,代码来源:NewCasePopupWindow.java

示例12: createQueryValidator

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
private Validator createQueryValidator() {
    Validator validator = new Validator() {

        private static final long serialVersionUID = -186376062628005948L;

        @Override
        public void validate(Object value) throws InvalidValueException {
            String query = ((String) value).trim();
            if (!query.toLowerCase().startsWith("select")) {
                throw new InvalidValueException(ctx.tr("dialog.errors.validation.select"));
            }
        }
    };

    return validator;
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:17,代码来源:RelationalVaadinDialog.java

示例13: commit

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
@Override
public void commit() throws SourceException, InvalidValueException {
    Integer roleId = (Integer) roleComboBox.getValue();
    if (roleId == -1) {
        if (CurrentProjectVariables.isAdmin()) {
            beanItem.setIsadmin(Boolean.TRUE);
            this.setInternalValue(null);
        } else {
            throw new UserInvalidInputException(UserUIContext.getMessage(ProjectRoleI18nEnum.ERROR_ONLY_OWNER_ASSIGN_ROLE_OWNER));
        }
    } else {
        beanItem.setIsadmin(Boolean.FALSE);
        this.setInternalValue((Integer) this.roleComboBox.getValue());
    }

    super.commit();
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:18,代码来源:ProjectMemberEditViewImpl.java

示例14: commit

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
@Override
public void commit() throws SourceException, InvalidValueException {
    Integer roleId = (Integer) roleBox.getValue();
    if (roleId == -1) {
        if (!UserUIContext.isAdmin()) {
            throw new UserInvalidInputException(UserUIContext.getMessage(RoleI18nEnum.ERROR_ONLY_OWNER_CAN_ASSIGN_OWNER_ROLE));
        } else {
            user.setAccountOwner(Boolean.TRUE);
            user.setRoleName(UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER));
        }
    } else {
        user.setAccountOwner(Boolean.FALSE);
        BeanItem<SimpleRole> role = (BeanItem<SimpleRole>) roleBox.getItem(roleId);
        if (role != null) {
            user.setRoleName(role.getBean().getRolename());
        }
    }
    setInternalValue(roleId);
    super.commit();
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:21,代码来源:UserAddViewImpl.java

示例15: initializeButton

import com.vaadin.data.Validator.InvalidValueException; //导入依赖的package包/类
protected void initializeButton() {
	this.buttonSave.setClickShortcut(KeyCode.ENTER);
	this.buttonSave.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			try {
				//
				// Commit it
				//
				self.textFieldID.commit();
				//
				// Save it
				//
				self.variable.setVariableId(self.textFieldID.getValue());
				self.isSaved = true;
				//
				// Close window
				//
				self.close();
			} catch (SourceException | InvalidValueException e) {
			}
		}			
	});
}
 
开发者ID:att,项目名称:XACML,代码行数:27,代码来源:VariableDefinitionEditorWindow.java


注:本文中的com.vaadin.data.Validator.InvalidValueException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。