Java Code Examples for com.vaadin.data.Property#getValue()

The following examples show how to use com.vaadin.data.Property#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JobLogTable.java    From chipster with MIT License 6 votes vote down vote up
public Component generateCell(Table source, final Object itemId,
		Object columnId) {
	
	Property<?> prop = source.getItem(itemId).getItemProperty(columnId);
	if (prop != null && prop.getType() != null && prop.getType().equals(Integer.class)) {

		Integer wallClockTime = (Integer) prop.getValue();

		if (wallClockTime != null) {
			return new Label(StringUtils.formatMinutes(wallClockTime));
		} else {
			return new Label();
		}
	}
	return null;
}
 
Example 2
Source File: JobLogTable.java    From chipster with MIT License 5 votes vote down vote up
public Component generateCell(Table source, final Object itemId,
		Object columnId) {

	Property<?> prop = source.getItem(itemId).getItemProperty(JobLogContainer.ERROR_MESSAGE);
	if (prop != null && prop.getType() != null && prop.getType().equals(String.class)) {

		String errorMessage = (String) prop.getValue();

		if (errorMessage != null) {

			Button link = new Button();
			link.setIcon(new ThemeResource("../admin/crystal/agt_update_critical.png"));
			link.setStyleName(BaseTheme.BUTTON_LINK);
			link.setDescription("Show job error message");

			link.addClickListener(new Button.ClickListener() {

				public void buttonClick(ClickEvent event) {

					select(itemId);
					view.showErrorOutput(itemId);
				}
			});

			return link;
		}
	}

	return null;
}
 
Example 3
Source File: DateColumnGenerator.java    From chipster with MIT License 5 votes vote down vote up
public Component generateCell(Table source, final Object itemId,
		Object columnId) {

	Property<?> prop = source.getItem(itemId).getItemProperty(columnId);
	if (prop != null && prop.getType() != null && prop.getType().equals(Date.class)) {
		
		Date date = (Date) prop.getValue();

		SimpleDateFormat dateFormat = new SimpleDateFormat("yyy-MM-dd HH:mm");
		
		Label label = new Label(dateFormat.format(date));
		return label;
	}
	return null;
}
 
Example 4
Source File: JobLogView.java    From chipster with MIT License 5 votes vote down vote up
public void showOutput(Object itemId) {
	
	String output = "";
	Property<?> outputProperty = dataSource.getContainerProperty(itemId, JobLogContainer.OUTPUT_TEXT);
	
	if (outputProperty != null) {
		output = (String) outputProperty.getValue();
	}
	
	showTextWindow("Job output", output);
}
 
Example 5
Source File: JobLogView.java    From chipster with MIT License 5 votes vote down vote up
public void showErrorOutput(Object itemId) {
	String error = "";
	Property<?> errorProperty = dataSource.getContainerProperty(itemId, JobLogContainer.ERROR_MESSAGE);
	
	if (errorProperty != null) {
		error = (String) errorProperty.getValue();
	}

	showTextWindow("Error message", error);
}
 
Example 6
Source File: HumanReadableLongColumnGenerator.java    From chipster with MIT License 5 votes vote down vote up
public Component generateCell(Table source, Object itemId,
        Object columnId) {
	
    Property<?> prop = source.getItem(itemId).getItemProperty(columnId);
    if (prop != null && prop.getType() != null && prop.getType().equals(Long.class)) {
    	
    	Long longSize = (Long)prop.getValue();
    	String stringSize = StringUtils.getHumanReadable(longSize);
    	
        Label label = new Label(stringSize);

        return label;
    }
    return null;
}