# Synthax to add "dataset" prop in a VisionComponent

**URL:** <https://forum.inductiveautomation.com/t/synthax-to-add-dataset-prop-in-a-visioncomponent/5780>\
**Category:** Module Development\
**Created:** [January 31, 2013, 11:01pm UTC](https://forum.inductiveautomation.com/t/synthax-to-add-dataset-prop-in-a-visioncomponent/5780 "2013-01-31T23:01:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [January 31, 2013, 11:01pm UTC](https://forum.inductiveautomation.com/t/synthax-to-add-dataset-prop-in-a-visioncomponent/5780/1 "2013-01-31T23:01:26Z")

</div>

I use the AbstractVisionComponent  
I’m looking for the synthax to add “dataset” prop in the CommonBeanInfo ?  
and the java type for the associed getter and setter for the dataset ?  
 ![:scratch:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:")

You’re example is fine for a text prop :

addProp(“text”, “Text”, “The text to display in the component”, CAT\_DATA, PREFFERED\_MASK | BOUND\_MASK);

public String getText() {  
return text;  
}

public void setText(String text) {  
// Firing property changes like this is required for any property that has the BOUND\_MASK set on it.  
// (See this component’s BeanInfo class)  
String old = this.text;  
this.text = text;  
firePropertyChange(“text”, old, text);

repaint();  
}

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [January 31, 2013, 11:08pm UTC](https://forum.inductiveautomation.com/t/synthax-to-add-dataset-prop-in-a-visioncomponent/5780/2 "2013-01-31T23:08:38Z")

</div>

In the bean info class you do the following:`addBoundProp("data", "Data", "The data for this component", CAT_DATA, PREFERRED_MASK);`In your Java class you do the following:[code]public Dataset getData() {  
return data;  
}

public void setData(Dataset newDataset) {  
if (newDataset == null) {  
newDataset = new BasicDataset(new ArrayList(0), new ArrayList\<Class\<?\>\>(0), new Object[][] {});  
}

```
Dataset oldDataset = this.data;
this.data = newDataset;

// Do something with the data like update component

firePropertyChange("data", oldDataset == newDataset ? null : oldDataset, newDataset);

```

}[/code]

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [February 1, 2013, 10:56am UTC](https://forum.inductiveautomation.com/t/synthax-to-add-dataset-prop-in-a-visioncomponent/5780/3 "2013-02-01T10:56:18Z")

</div>

Perfect ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")
