aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/demo/util/SampleDirectory.java
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2007-11-19 14:03:05 +0000
committerMarc Englund <marc.englund@itmill.com>2007-11-19 14:03:05 +0000
commitf2e3722df9676436680afc0f1991e91e1696fb99 (patch)
tree6f255ff78abaf96f1e71a1f2c9ecd3b66647f4a2 /src/com/itmill/toolkit/demo/util/SampleDirectory.java
parent93291f532db9d545cf2a8dd98e2671f27cd197b0 (diff)
downloadvaadin-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/demo/util/SampleDirectory.java')
-rw-r--r--src/com/itmill/toolkit/demo/util/SampleDirectory.java98
1 files changed, 49 insertions, 49 deletions
diff --git a/src/com/itmill/toolkit/demo/util/SampleDirectory.java b/src/com/itmill/toolkit/demo/util/SampleDirectory.java
index 95faf970c8..15cdf87dad 100644
--- a/src/com/itmill/toolkit/demo/util/SampleDirectory.java
+++ b/src/com/itmill/toolkit/demo/util/SampleDirectory.java
@@ -17,53 +17,53 @@ import com.itmill.toolkit.ui.Panel;
*/
public class SampleDirectory {
- /**
- * Get sample directory.
- *
- * @param application
- * @return file pointing to sample directory
- */
- public static File getDirectory(Application application) {
- String errorMessage = "Access to application "
- + "context base directory failed, "
- + "possible security constraint with Application "
- + "Server or Servlet Container.<br />";
- File file = application.getContext().getBaseDirectory();
- if ((file == null) || (!file.canRead())
- || (file.getAbsolutePath() == null)) {
- // cannot access example directory, possible security issue with
- // Application Server or Servlet Container
- // Try to read sample directory from web.xml parameter
- if (application.getProperty("sampleDirectory") != null) {
- file = new File(application.getProperty("sampleDirectory"));
- if ((file != null) && (file.canRead())
- && (file.getAbsolutePath() != null)) {
- // Success using property
- return file;
- }
- // Failure using property
- errorMessage += "Failed also to access sample directory <b>["
- + application.getProperty("sampleDirectory")
- + "]</b> defined in <b>sampleDirectory property</b>.";
- } else {
- // Failure using application context base dir, no property set
- errorMessage += "<b>Note: </b>You can set this manually in "
- + "web.xml by defining " + "sampleDirectory property.";
- }
- } else {
- // Success using application context base dir
- return file;
- }
- // Add failure notification as an Panel to main window
- Panel errorPanel = new Panel("Demo application error");
- errorPanel.setStyle("strong");
- errorPanel.setComponentError(new SystemError(
- "Cannot provide sample directory"));
- errorPanel.addComponent(new Label(errorMessage, Label.CONTENT_XHTML));
- // Remove all components from applications main window
- application.getMainWindow().getLayout().removeAllComponents();
- // Add error panel
- application.getMainWindow().getLayout().addComponent(errorPanel);
- return null;
- }
+ /**
+ * Get sample directory.
+ *
+ * @param application
+ * @return file pointing to sample directory
+ */
+ public static File getDirectory(Application application) {
+ String errorMessage = "Access to application "
+ + "context base directory failed, "
+ + "possible security constraint with Application "
+ + "Server or Servlet Container.<br />";
+ File file = application.getContext().getBaseDirectory();
+ if ((file == null) || (!file.canRead())
+ || (file.getAbsolutePath() == null)) {
+ // cannot access example directory, possible security issue with
+ // Application Server or Servlet Container
+ // Try to read sample directory from web.xml parameter
+ if (application.getProperty("sampleDirectory") != null) {
+ file = new File(application.getProperty("sampleDirectory"));
+ if ((file != null) && (file.canRead())
+ && (file.getAbsolutePath() != null)) {
+ // Success using property
+ return file;
+ }
+ // Failure using property
+ errorMessage += "Failed also to access sample directory <b>["
+ + application.getProperty("sampleDirectory")
+ + "]</b> defined in <b>sampleDirectory property</b>.";
+ } else {
+ // Failure using application context base dir, no property set
+ errorMessage += "<b>Note: </b>You can set this manually in "
+ + "web.xml by defining " + "sampleDirectory property.";
+ }
+ } else {
+ // Success using application context base dir
+ return file;
+ }
+ // Add failure notification as an Panel to main window
+ Panel errorPanel = new Panel("Demo application error");
+ errorPanel.setStyle("strong");
+ errorPanel.setComponentError(new SystemError(
+ "Cannot provide sample directory"));
+ errorPanel.addComponent(new Label(errorMessage, Label.CONTENT_XHTML));
+ // Remove all components from applications main window
+ application.getMainWindow().getLayout().removeAllComponents();
+ // Add error panel
+ application.getMainWindow().getLayout().addComponent(errorPanel);
+ return null;
+ }
}