aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/terminal/ClassResource.java
diff options
context:
space:
mode:
authorJani Laakso <jani.laakso@itmill.com>2007-04-18 05:32:44 +0000
committerJani Laakso <jani.laakso@itmill.com>2007-04-18 05:32:44 +0000
commit121ae54f709f887c95592b95bdc09977642b8c3b (patch)
tree389925b20e51a24428ae8bb625c651c3d9de6ca8 /src/com/itmill/toolkit/terminal/ClassResource.java
parent76d0a503c56656bafc68d732d245dd2dafe1b55d (diff)
downloadvaadin-framework-121ae54f709f887c95592b95bdc09977642b8c3b.tar.gz
vaadin-framework-121ae54f709f887c95592b95bdc09977642b8c3b.zip
Unified code style (indentation) based on default settings using Eclipse 3.2.
svn changeset:1256/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/terminal/ClassResource.java')
-rw-r--r--src/com/itmill/toolkit/terminal/ClassResource.java148
1 files changed, 82 insertions, 66 deletions
diff --git a/src/com/itmill/toolkit/terminal/ClassResource.java b/src/com/itmill/toolkit/terminal/ClassResource.java
index efdfee4ad3..c53375350e 100644
--- a/src/com/itmill/toolkit/terminal/ClassResource.java
+++ b/src/com/itmill/toolkit/terminal/ClassResource.java
@@ -1,80 +1,85 @@
/* *************************************************************************
- IT Mill Toolkit
+ IT Mill Toolkit
- Development of Browser User Interfaces Made Easy
+ Development of Browser User Interfaces Made Easy
- Copyright (C) 2000-2006 IT Mill Ltd
-
- *************************************************************************
+ Copyright (C) 2000-2006 IT Mill Ltd
+
+ *************************************************************************
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might
- require purchasing a commercial license from IT Mill Ltd. For guidelines
- on usage, see licensing-guidelines.html
+ This product is distributed under commercial license that can be found
+ from the product package on license.pdf. Use of this product might
+ require purchasing a commercial license from IT Mill Ltd. For guidelines
+ on usage, see licensing-guidelines.html
- *************************************************************************
-
- For more information, contact:
-
- IT Mill Ltd phone: +358 2 4802 7180
- Ruukinkatu 2-4 fax: +358 2 4802 7181
- 20540, Turku email: info@itmill.com
- Finland company www: www.itmill.com
-
- Primary source for information and releases: www.itmill.com
+ *************************************************************************
+
+ For more information, contact:
+
+ IT Mill Ltd phone: +358 2 4802 7180
+ Ruukinkatu 2-4 fax: +358 2 4802 7181
+ 20540, Turku email: info@itmill.com
+ Finland company www: www.itmill.com
+
+ Primary source for information and releases: www.itmill.com
- ********************************************************************** */
+ ********************************************************************** */
package com.itmill.toolkit.terminal;
import com.itmill.toolkit.Application;
import com.itmill.toolkit.service.FileTypeResolver;
-/**
- * <code>ClassResource</code> is a named resource accessed with the class loader.
- *
+/**
+ * <code>ClassResource</code> is a named resource accessed with the class
+ * loader.
+ *
* This can be used to access resources such as icons, files, etc.
+ *
* @see java.lang.Class#getResource(java.lang.String)
- *
+ *
* @author IT Mill Ltd.
- * @version @VERSION@
+ * @version
+ * @VERSION@
* @since 3.0
*/
public class ClassResource implements ApplicationResource {
- /**
- * Default buffer size for this stream resource.
+ /**
+ * Default buffer size for this stream resource.
*/
private int bufferSize = 0;
- /**
- * Default cache time for this stream resource.
+ /**
+ * Default cache time for this stream resource.
*/
- private long cacheTime = DEFAULT_CACHETIME;
+ private long cacheTime = DEFAULT_CACHETIME;
- /**
- * Associated class used for indetifying the source of the resource.
+ /**
+ * Associated class used for indetifying the source of the resource.
*/
private Class associatedClass;
-
- /**
- * Name of the resource is relative to the associated class.
+
+ /**
+ * Name of the resource is relative to the associated class.
*/
private String resourceName;
-
- /**
- * Application used for serving the class.
+
+ /**
+ * Application used for serving the class.
*/
private Application application;
- /**
- * Creates a new application resource instance.
- * The resource id is relative to the location of the application class.
+ /**
+ * Creates a new application resource instance. The resource id is relative
+ * to the location of the application class.
*
- * @param resourceName the Unique identifier of the resource within the application.
- * @param application the application this resource will be added to.
- * */
+ * @param resourceName
+ * the Unique identifier of the resource within the application.
+ * @param application
+ * the application this resource will be added to.
+ */
public ClassResource(String resourceName, Application application) {
this.associatedClass = application.getClass();
this.resourceName = resourceName;
@@ -84,17 +89,18 @@ public class ClassResource implements ApplicationResource {
application.addResource(this);
}
- /**
- * Creates a new application resource instance.
+ /**
+ * Creates a new application resource instance.
*
- * @param associatedClass the class of the which the resource is associated.
- * @param resourceName the Unique identifier of the resource within the application.
- * @param application the application this resource will be added to.
+ * @param associatedClass
+ * the class of the which the resource is associated.
+ * @param resourceName
+ * the Unique identifier of the resource within the application.
+ * @param application
+ * the application this resource will be added to.
*/
- public ClassResource(
- Class associatedClass,
- String resourceName,
- Application application) {
+ public ClassResource(Class associatedClass, String resourceName,
+ Application application) {
this.associatedClass = associatedClass;
this.resourceName = resourceName;
this.application = application;
@@ -102,22 +108,28 @@ public class ClassResource implements ApplicationResource {
throw new NullPointerException();
application.addResource(this);
}
+
/**
* Gets the MIME type of this resource.
+ *
* @see com.itmill.toolkit.terminal.Resource#getMIMEType()
*/
public String getMIMEType() {
return FileTypeResolver.getMIMEType(this.resourceName);
}
+
/**
* Gets the application of this resource.
+ *
* @see com.itmill.toolkit.terminal.ApplicationResource#getApplication()
*/
public Application getApplication() {
return application;
}
+
/**
* Gets the virtual filename for this resource.
+ *
* @return the file name associated to this resource.
* @see com.itmill.toolkit.terminal.ApplicationResource#getFilename()
*/
@@ -125,19 +137,20 @@ public class ClassResource implements ApplicationResource {
int index = 0;
int next = 0;
while ((next = resourceName.indexOf('/', index)) > 0
- && next + 1 < resourceName.length())
+ && next + 1 < resourceName.length())
index = next + 1;
return resourceName.substring(index);
}
+
/**
* Gets resource as stream.
+ *
* @see com.itmill.toolkit.terminal.ApplicationResource#getStream()
*/
public DownloadStream getStream() {
- DownloadStream ds = new DownloadStream(
- associatedClass.getResourceAsStream(resourceName),
- getMIMEType(),
- getFilename());
+ DownloadStream ds = new DownloadStream(associatedClass
+ .getResourceAsStream(resourceName), getMIMEType(),
+ getFilename());
ds.setBufferSize(getBufferSize());
ds.setCacheTime(cacheTime);
return ds;
@@ -148,9 +161,11 @@ public class ClassResource implements ApplicationResource {
return bufferSize;
}
- /**
+ /**
* Sets the size of the download buffer used for this resource.
- * @param bufferSize the size of the buffer in bytes.
+ *
+ * @param bufferSize
+ * the size of the buffer in bytes.
*/
public void setBufferSize(int bufferSize) {
this.bufferSize = bufferSize;
@@ -161,17 +176,18 @@ public class ClassResource implements ApplicationResource {
return cacheTime;
}
- /**
+ /**
* Sets the length of cache expiration time.
*
* <p>
- * This gives the adapter the possibility cache streams sent to the
- * client. The caching may be made in adapter or at the client if the
- * client supports caching. Zero or negavive value disbales the
- * caching of this stream.
+ * This gives the adapter the possibility cache streams sent to the client.
+ * The caching may be made in adapter or at the client if the client
+ * supports caching. Zero or negavive value disbales the caching of this
+ * stream.
* </p>
*
- * @param cacheTime the cache time in milliseconds.
+ * @param cacheTime
+ * the cache time in milliseconds.
*
*/
public void setCacheTime(long cacheTime) {