Directory

← Back

PropertiesItem

Bind java.util.Properties easily to Vaadin Form.

Author

Rating

Popularity

<100

The standard java.util.Properties class represents a persistent set of properties. The Properties can be saved to a stream or loaded from a stream. Each key and its corresponding value in the property list is a string.A property list can contain another property list as its "defaults"; this second property list is searched if the property key is not found in the original property list. Load and store properties in a simple line-oriented (human readable) format.

org.vaadin.data.PropertiesItem utility class makes it very easy to bind java.util.Properties objects directly into a Vaadin Form, like: form.setItemDataSource(new PropertiesItem(myProps)).

There is built-in typing for the properties using the type suffix in parentheses. Supports string, int, boolean, date types. This feature is optional and the default type is String as normally. Also for convenience there is setFile() and save() functions to persist the data easily.

Sample code

Properties props = new Properties();
props.setProperty("Name", "John Doe");
props.setProperty("Age(int)", "39");
props.setProperty("DOA(boolean)", "false");
props.setProperty("Arrived(date)", "");
props.setProperty("Notes", "");
org.vaadin.data.PropertiesItem item = new PropertiesItem(props);

Form f = new Form();
f.setItemDataSource(item);
mainWindow.addComponent(f);
package org.vaadin.data;

import java.util.Properties;

import com.vaadin.Application;
import com.vaadin.ui.Form;
import com.vaadin.ui.Window;

public class PropertiesItemApplication extends Application {
	private static final long serialVersionUID = 1L;

	@Override
	public void init() {
		Window mainWindow = new Window("PropertiesItem Sample Application");

		Properties props = new Properties();
		props.setProperty("Name", "John Doe");
		props.setProperty("Age(int)", "39");
		props.setProperty("DOA(boolean)", "false");
		props.setProperty("Arrived(date)", "");
		props.setProperty("Notes", "");
		org.vaadin.data.PropertiesItem item = new PropertiesItem(props);

		Form f = new Form();
		f.setItemDataSource(item);
		mainWindow.addComponent(f);

		setMainWindow(mainWindow);
	}

}

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Released
2010-01-22
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 6.0+
Vaadin 7.0+
Browser
Browser Independent

PropertiesItem - Vaadin Add-on Directory

Bind java.util.Properties easily to Vaadin Form. PropertiesItem - Vaadin Add-on Directory
The standard java.util.Properties class represents a persistent set of properties. The Properties can be saved to a stream or loaded from a stream. Each key and its corresponding value in the property list is a string.A property list can contain another property list as its "defaults"; this second property list is searched if the property key is not found in the original property list. Load and store properties in a simple line-oriented (human readable) format. org.vaadin.data.PropertiesItem utility class makes it very easy to bind java.util.Properties objects directly into a Vaadin Form, like: form.setItemDataSource(new PropertiesItem(myProps)). There is built-in typing for the properties using the type suffix in parentheses. Supports string, int, boolean, date types. This feature is optional and the default type is String as normally. Also for convenience there is setFile() and save() functions to persist the data easily.
Java 1.5 API: java.util.Properties
Discussion Forum
Source Code

PropertiesItem version 0.9.1
null

Online