de.jdemo.framework
Class DemoCase

java.lang.Object
  extended by de.jdemo.framework.AbstractDemoCase
      extended by de.jdemo.framework.DemoCase
All Implemented Interfaces:
IDemo, IDemoCase, java.lang.Cloneable
Direct Known Subclasses:
ErrorDemoCase

public abstract class DemoCase
extends AbstractDemoCase

Abstract superclass for all text/file based demos or extensions.

See Also:
DemoSuite

Constructor Summary
DemoCase()
          No-arg constructor to enable serialization.
DemoCase(java.lang.String name)
          Constructs a demo case with the given name.
 
Method Summary
 IDemoCaseRunnable createRunnable(boolean allowExternalLaunches)
          Creates a runnable for running this demo case.
protected  java.io.File createTempFile(java.lang.String suffix)
          Creates a temporary file using the specified suffig (e.g.
 void setFileLauncher(IFileLauncher fileLauncher)
          Sets the launcher to show files with.
 void setTextLauncher(ITextLauncher textLauncher)
          Sets the launcher to show texts with.
protected  void show(java.lang.CharSequence text)
          Shows the given text by using the demos text launcher.
protected  void show(java.io.File file)
          Tries to open the given file by passing it to the operating system.
 
Methods inherited from class de.jdemo.framework.AbstractDemoCase
accept, after, assertNotNull, assertNull, assertTrue, before, cancel, clone, createThreadGroup, executeSetUp, executeTearDown, exit, fail, getClone, getIdentifier, getName, getRunnable, runDemo, setName, setRunnable, setUp, tearDown, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DemoCase

public DemoCase()
No-arg constructor to enable serialization. This method is not intended to be used by mere mortals without calling setName().


DemoCase

public DemoCase(java.lang.String name)
Constructs a demo case with the given name.

Method Detail

createRunnable

public IDemoCaseRunnable createRunnable(boolean allowExternalLaunches)
Description copied from interface: IDemoCase
Creates a runnable for running this demo case.

Parameters:
allowExternalLaunches - indicates whether this demo is allowed e.g. to launch a file in an external software. This flag will be false if this demo is executed as test for example.

createTempFile

protected final java.io.File createTempFile(java.lang.String suffix)
                                     throws java.io.IOException
Creates a temporary file using the specified suffig (e.g. ".txt") that will be deleted when the virtual machine terminates.

Parameters:
suffix - the filename suffix for the temporary file to be created.
Returns:
an empty temporary file having the specified suffix.
Throws:
java.io.IOException
See Also:
show(File)

show

protected final void show(java.io.File file)
Tries to open the given file by passing it to the operating system. Note that this might not work properly on all systems.

See Also:
createTempFile(String)

show

protected final void show(java.lang.CharSequence text)
Shows the given text by using the demos text launcher. The default launcher prints out the text to System.out, but each DemoRunner application is free to set its own text launcher.

See Also:
setTextLauncher(ITextLauncher)

setFileLauncher

public void setFileLauncher(IFileLauncher fileLauncher)
Sets the launcher to show files with. This method is intended to be only called by the demorunner, never by the demo itself.


setTextLauncher

public void setTextLauncher(ITextLauncher textLauncher)
Sets the launcher to show texts with. This method is intended to be only called by the demorunner, never by the demo itself.



JDemo homepage: http://www.jdemo.de
Copyright © 2003-2008 Markus Gebhard. All Rights Reserved.