diff options
author | Marc Englund <marc.englund@itmill.com> | 2007-11-19 14:03:05 +0000 |
---|---|---|
committer | Marc Englund <marc.englund@itmill.com> | 2007-11-19 14:03:05 +0000 |
commit | f2e3722df9676436680afc0f1991e91e1696fb99 (patch) | |
tree | 6f255ff78abaf96f1e71a1f2c9ecd3b66647f4a2 /src/com/itmill/toolkit/ui/ProgressIndicator.java | |
parent | 93291f532db9d545cf2a8dd98e2671f27cd197b0 (diff) | |
download | vaadin-framework-f2e3722df9676436680afc0f1991e91e1696fb99.tar.gz vaadin-framework-f2e3722df9676436680afc0f1991e91e1696fb99.zip |
MASS REFORMAT.
According to http://toolkit.intra.itmill.com/trac/itmilltoolkit/wiki/CodingConventions
svn changeset:2864/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/ui/ProgressIndicator.java')
-rw-r--r-- | src/com/itmill/toolkit/ui/ProgressIndicator.java | 426 |
1 files changed, 217 insertions, 209 deletions
diff --git a/src/com/itmill/toolkit/ui/ProgressIndicator.java b/src/com/itmill/toolkit/ui/ProgressIndicator.java index 5a82fe441c..2314e833e1 100644 --- a/src/com/itmill/toolkit/ui/ProgressIndicator.java +++ b/src/com/itmill/toolkit/ui/ProgressIndicator.java @@ -48,214 +48,222 @@ import com.itmill.toolkit.terminal.PaintTarget; * @since 4 */ public class ProgressIndicator extends AbstractField implements Property, - Property.Viewer, Property.ValueChangeListener { - - /** - * Content mode, where the label contains only plain text. The getValue() - * result is coded to XML when painting. - */ - public static final int CONTENT_TEXT = 0; - - /** - * Content mode, where the label contains preformatted text. - */ - public static final int CONTENT_PREFORMATTED = 1; - - private boolean indeterminate = false; - - private Property dataSource; - - private int pollingInterval = 1000; - - /** - * Creates an a new ProgressIndicator. - */ - public ProgressIndicator() { - setPropertyDataSource(new ObjectProperty(new Float(0), Float.class)); - } - - /** - * Creates a new instance of ProgressIndicator with given state. - * - * @param value - */ - public ProgressIndicator(Float value) { - setPropertyDataSource(new ObjectProperty(value, Float.class)); - } - - /** - * Creates a new instance of ProgressIndicator with stae read from given - * datasource. - * - * @param contentSource - */ - public ProgressIndicator(Property contentSource) { - setPropertyDataSource(contentSource); - } - - /** - * Gets the component UIDL tag. - * - * @return the Component UIDL tag as string. - */ - public String getTag() { - return "progressindicator"; - } - - /** - * Sets the component to read-only. Readonly is not used in - * ProgressIndicator. - * - * @param readOnly - * True to enable read-only mode, False to disable it. - */ - public void setReadOnly(boolean readOnly) { - if (dataSource == null) - throw new IllegalStateException("Datasource must be se"); - dataSource.setReadOnly(readOnly); - } - - /** - * Is the component read-only ? Readonly is not used in ProgressIndicator - - * this returns allways false. - * - * @return True if the component is in read only mode. - */ - public boolean isReadOnly() { - if (dataSource == null) - throw new IllegalStateException("Datasource must be se"); - return dataSource.isReadOnly(); - } - - /** - * Paints the content of this component. - * - * @param target - * the Paint Event. - * @throws PaintException - * if the Paint Operation fails. - */ - public void paintContent(PaintTarget target) throws PaintException { - target.addAttribute("indeterminate", indeterminate); - target.addAttribute("pollinginterval", pollingInterval); - target.addAttribute("state", this.getValue().toString()); - } - - /** - * Gets the value of the ProgressIndicator. Value of the ProgressIndicator - * is Float between 0 and 1. - * - * @return the Value of the ProgressIndicator. - * @see com.itmill.toolkit.ui.AbstractField#getValue() - */ - public Object getValue() { - if (dataSource == null) - throw new IllegalStateException("Datasource must be se"); - return dataSource.getValue(); - } - - /** - * Sets the value of the ProgressIndicator. Value of the ProgressIndicator - * is the Float between 0 and 1. - * - * @param newValue - * the New value of the ProgressIndicator. - * @see com.itmill.toolkit.ui.AbstractField#setValue(java.lang.Object) - */ - public void setValue(Object newValue) { - if (dataSource == null) - throw new IllegalStateException("Datasource must be se"); - this.dataSource.setValue(newValue); - } - - /** - * @see com.itmill.toolkit.ui.AbstractField#toString() - */ - public String toString() { - if (dataSource == null) - throw new IllegalStateException("Datasource must be se"); - return dataSource.toString(); - } - - /** - * @see com.itmill.toolkit.ui.AbstractField#getType() - */ - public Class getType() { - if (dataSource == null) - throw new IllegalStateException("Datasource must be se"); - return dataSource.getType(); - } - - /** - * Gets the viewing data-source property. - * - * @return the datasource. - * @see com.itmill.toolkit.ui.AbstractField#getPropertyDataSource() - */ - public Property getPropertyDataSource() { - return dataSource; - } - - /** - * Sets the property as data-source for viewing. - * - * @param newDataSource - * the new data source. - * @see com.itmill.toolkit.ui.AbstractField#setPropertyDataSource(com.itmill.toolkit.data.Property) - */ - public void setPropertyDataSource(Property newDataSource) { - // Stops listening the old data source changes - if (dataSource != null - && Property.ValueChangeNotifier.class - .isAssignableFrom(dataSource.getClass())) - ((Property.ValueChangeNotifier) dataSource).removeListener(this); - - // Sets the new data source - dataSource = newDataSource; - - // Listens the new data source if possible - if (dataSource != null - && Property.ValueChangeNotifier.class - .isAssignableFrom(dataSource.getClass())) - ((Property.ValueChangeNotifier) dataSource).addListener(this); - } - - /** - * Gets the mode of ProgressIndicator. - * - * @return true if in indeterminate mode. - */ - public boolean getContentMode() { - return indeterminate; - } - - /** - * Sets the ProgressIndicator to indeterminate mode. - * - * @param newValue - * true to set to indeterminate mode. - */ - public void setIndeterminate(boolean newValue) { - indeterminate = newValue; - } - - /** - * Sets the interval that component checks for progress. - * - * @param newValue - * the interval in milliseconds. - */ - public void setPollingInterval(int newValue) { - pollingInterval = newValue; - } - - /** - * Gets the interval that component checks for progress. - * - * @return the interval in milliseconds. - */ - public int getPollingInterval() { - return pollingInterval; - } + Property.Viewer, Property.ValueChangeListener { + + /** + * Content mode, where the label contains only plain text. The getValue() + * result is coded to XML when painting. + */ + public static final int CONTENT_TEXT = 0; + + /** + * Content mode, where the label contains preformatted text. + */ + public static final int CONTENT_PREFORMATTED = 1; + + private boolean indeterminate = false; + + private Property dataSource; + + private int pollingInterval = 1000; + + /** + * Creates an a new ProgressIndicator. + */ + public ProgressIndicator() { + setPropertyDataSource(new ObjectProperty(new Float(0), Float.class)); + } + + /** + * Creates a new instance of ProgressIndicator with given state. + * + * @param value + */ + public ProgressIndicator(Float value) { + setPropertyDataSource(new ObjectProperty(value, Float.class)); + } + + /** + * Creates a new instance of ProgressIndicator with stae read from given + * datasource. + * + * @param contentSource + */ + public ProgressIndicator(Property contentSource) { + setPropertyDataSource(contentSource); + } + + /** + * Gets the component UIDL tag. + * + * @return the Component UIDL tag as string. + */ + public String getTag() { + return "progressindicator"; + } + + /** + * Sets the component to read-only. Readonly is not used in + * ProgressIndicator. + * + * @param readOnly + * True to enable read-only mode, False to disable it. + */ + public void setReadOnly(boolean readOnly) { + if (dataSource == null) { + throw new IllegalStateException("Datasource must be se"); + } + dataSource.setReadOnly(readOnly); + } + + /** + * Is the component read-only ? Readonly is not used in ProgressIndicator - + * this returns allways false. + * + * @return True if the component is in read only mode. + */ + public boolean isReadOnly() { + if (dataSource == null) { + throw new IllegalStateException("Datasource must be se"); + } + return dataSource.isReadOnly(); + } + + /** + * Paints the content of this component. + * + * @param target + * the Paint Event. + * @throws PaintException + * if the Paint Operation fails. + */ + public void paintContent(PaintTarget target) throws PaintException { + target.addAttribute("indeterminate", indeterminate); + target.addAttribute("pollinginterval", pollingInterval); + target.addAttribute("state", getValue().toString()); + } + + /** + * Gets the value of the ProgressIndicator. Value of the ProgressIndicator + * is Float between 0 and 1. + * + * @return the Value of the ProgressIndicator. + * @see com.itmill.toolkit.ui.AbstractField#getValue() + */ + public Object getValue() { + if (dataSource == null) { + throw new IllegalStateException("Datasource must be se"); + } + return dataSource.getValue(); + } + + /** + * Sets the value of the ProgressIndicator. Value of the ProgressIndicator + * is the Float between 0 and 1. + * + * @param newValue + * the New value of the ProgressIndicator. + * @see com.itmill.toolkit.ui.AbstractField#setValue(java.lang.Object) + */ + public void setValue(Object newValue) { + if (dataSource == null) { + throw new IllegalStateException("Datasource must be se"); + } + dataSource.setValue(newValue); + } + + /** + * @see com.itmill.toolkit.ui.AbstractField#toString() + */ + public String toString() { + if (dataSource == null) { + throw new IllegalStateException("Datasource must be se"); + } + return dataSource.toString(); + } + + /** + * @see com.itmill.toolkit.ui.AbstractField#getType() + */ + public Class getType() { + if (dataSource == null) { + throw new IllegalStateException("Datasource must be se"); + } + return dataSource.getType(); + } + + /** + * Gets the viewing data-source property. + * + * @return the datasource. + * @see com.itmill.toolkit.ui.AbstractField#getPropertyDataSource() + */ + public Property getPropertyDataSource() { + return dataSource; + } + + /** + * Sets the property as data-source for viewing. + * + * @param newDataSource + * the new data source. + * @see com.itmill.toolkit.ui.AbstractField#setPropertyDataSource(com.itmill.toolkit.data.Property) + */ + public void setPropertyDataSource(Property newDataSource) { + // Stops listening the old data source changes + if (dataSource != null + && Property.ValueChangeNotifier.class + .isAssignableFrom(dataSource.getClass())) { + ((Property.ValueChangeNotifier) dataSource).removeListener(this); + } + + // Sets the new data source + dataSource = newDataSource; + + // Listens the new data source if possible + if (dataSource != null + && Property.ValueChangeNotifier.class + .isAssignableFrom(dataSource.getClass())) { + ((Property.ValueChangeNotifier) dataSource).addListener(this); + } + } + + /** + * Gets the mode of ProgressIndicator. + * + * @return true if in indeterminate mode. + */ + public boolean getContentMode() { + return indeterminate; + } + + /** + * Sets the ProgressIndicator to indeterminate mode. + * + * @param newValue + * true to set to indeterminate mode. + */ + public void setIndeterminate(boolean newValue) { + indeterminate = newValue; + } + + /** + * Sets the interval that component checks for progress. + * + * @param newValue + * the interval in milliseconds. + */ + public void setPollingInterval(int newValue) { + pollingInterval = newValue; + } + + /** + * Gets the interval that component checks for progress. + * + * @return the interval in milliseconds. + */ + public int getPollingInterval() { + return pollingInterval; + } } |