*/
private LinkedList<ValueChangeListener> valueChangeListeners = null;
+ /**
+ * Is the Property read-only?
+ */
+ private boolean readOnly;
+
+ /**
+ * {@inheritDoc}
+ *
+ * Override for additional restrictions on what is considered a read-only
+ * property.
+ */
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ public void setReadOnly(boolean newStatus) {
+ boolean oldStatus = isReadOnly();
+ readOnly = newStatus;
+ if (oldStatus != isReadOnly()) {
+ fireReadOnlyStatusChange();
+ }
+ }
+
/**
* Returns the value of the <code>Property</code> in human readable textual
* format. The return value should be assignable to the
@SuppressWarnings("serial")
public class ObjectProperty<T> extends AbstractProperty {
- /**
- * A boolean value storing the Property's read-only status information.
- */
- private boolean readOnly = false;
-
/**
* The value contained by the Property.
*/
return value;
}
- /**
- * Tests if the Property is in read-only mode. In read-only mode calls to
- * the method <code>setValue</code> will throw
- * <code>ReadOnlyException</code>s and will not modify the value of the
- * Property.
- *
- * @return <code>true</code> if the Property is in read-only mode,
- * <code>false</code> if it's not
- */
- public boolean isReadOnly() {
- return readOnly;
- }
-
- /**
- * Sets the Property's read-only mode to the specified status.
- *
- * @param newStatus
- * the new read-only status of the Property.
- */
- public void setReadOnly(boolean newStatus) {
- if (newStatus != readOnly) {
- readOnly = newStatus;
- fireReadOnlyStatusChange();
- }
- }
-
/**
* Sets the value of the property. This method supports setting from
* <code>String</code> if either <code>String</code> is directly assignable
public class TextFileProperty extends AbstractProperty {\r
\r
private File file;\r
- private boolean readonly;\r
private Charset charset = null;\r
\r
/**\r
* \r
* @see com.vaadin.data.Property#isReadOnly()\r
*/\r
+ @Override\r
public boolean isReadOnly() {\r
- return file == null || readonly || !file.canWrite();\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see com.vaadin.data.Property#setReadOnly(boolean)\r
- */\r
- public void setReadOnly(boolean newStatus) {\r
- boolean oldStatus = isReadOnly();\r
- readonly = newStatus;\r
- if (isReadOnly() != oldStatus) {\r
- fireReadOnlyStatusChange();\r
- }\r
+ return file == null || super.isReadOnly() || !file.canWrite();\r
}\r
\r
/*\r