You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2008/10/17 15:14:58 UTC
svn commit: r705604 -
/incubator/empire-db/trunk/core/Empire-db/src/org/apache/empire/data/bean/BeanProperty.java
Author: doebele
Date: Fri Oct 17 06:14:57 2008
New Revision: 705604
URL: http://svn.apache.org/viewvc?rev=705604&view=rev
Log:
EMPIREDB-25
Modified:
incubator/empire-db/trunk/core/Empire-db/src/org/apache/empire/data/bean/BeanProperty.java
Modified: incubator/empire-db/trunk/core/Empire-db/src/org/apache/empire/data/bean/BeanProperty.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/core/Empire-db/src/org/apache/empire/data/bean/BeanProperty.java?rev=705604&r1=705603&r2=705604&view=diff
==============================================================================
--- incubator/empire-db/trunk/core/Empire-db/src/org/apache/empire/data/bean/BeanProperty.java (original)
+++ incubator/empire-db/trunk/core/Empire-db/src/org/apache/empire/data/bean/BeanProperty.java Fri Oct 17 06:14:57 2008
@@ -18,6 +18,7 @@
*/
package org.apache.empire.data.bean;
+import org.apache.empire.commons.Attributes;
import org.apache.empire.commons.Options;
import org.apache.empire.data.Column;
import org.apache.empire.data.DataType;
@@ -37,6 +38,7 @@
private boolean readOnly; // optional
private String title; // optional
private Options options; // optional
+ private Attributes attributes;// optional
protected BeanClass beanClass; // internal;
@@ -51,22 +53,48 @@
this.controlType = controlType;
this.readOnly = readOnly;
}
+
+ public BeanProperty(String name, DataType dataType, double size, boolean required)
+ {
+ this(name, dataType, size, required, "text", false);
+ }
+ /**
+ * Returns the name of the property.
+ * @return the property name
+ */
public String getName()
{
return name;
}
+ /**
+ * Returns the data type of the bean property.
+ * @see org.apache.empire.data.DataType
+ *
+ * @return the property data type
+ */
public DataType getDataType()
{
return dataType;
}
-
+
+ /**
+ * Returns the value of a column attribute.
+ * Column attributes are used to provide metadata for a property.
+ *
+ * @param name the attribute name
+ * @return value of the attribute if it exists or null otherwise
+ */
public Object getAttribute(String name)
{
- return null;
+ return (attributes!=null) ? attributes.get(name) : null;
}
+ /**
+ * Returns the title attribute.
+ * @return the column title
+ */
public String getTitle()
{
if (title==null)
@@ -74,21 +102,44 @@
return title;
}
+ /**
+ * Returns the list of options for this column
+ * containing all allowed field values.
+ *
+ * @return the list of options
+ */
public Options getOptions()
{
return options;
}
+ /**
+ * Returns the columns control type.
+ * The control type is a client specific name for the type of input control
+ * that should be used to display and edit values for this column.
+ *
+ * @return the columns control type
+ */
public String getControlType()
{
return controlType;
}
+ /**
+ * Gets the Java bean property name.
+ * This function should return the same string as getName()
+ * @return the name of the bean property
+ */
public String getBeanPropertyName()
{
return name;
}
+ /**
+ * Returns the column
+ * This function should return the same string as getName()
+ * @return the name of the bean property
+ */
public Column getSourceColumn()
{
return this;
@@ -139,4 +190,11 @@
this.title = title;
}
+ public void setAttribute(String name, Object value)
+ {
+ if (attributes== null)
+ attributes = new Attributes();
+ attributes.set(name, value);
+ }
+
}