jwo.landserf.process
Class OpenThread

java.lang.Object
  extended by java.lang.Thread
      extended by jwo.landserf.process.LSThread
          extended by jwo.landserf.process.OpenThread
All Implemented Interfaces:
Runnable, Scriptable, JWInterruptionListener

public class OpenThread
extends LSThread
implements Scriptable

Opens a spatial file and places contents into a spatial object.

Version:
2.3, 5th January, 2008.
Author:
Jo Wood

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
OpenThread(GISFrame gisFrame)
          Creates an object ready for opening but does not open any files.
OpenThread(GISFrame gisFrame, File[] inFiles)
          Attempts to open the relevant spatial object file(s).
OpenThread(GISFrame gisFrame, File[] inFiles, int fileType, int position)
          Opens the relevant spatial object file(s).
 
Method Summary
 boolean doCommand(LSCommand command)
          Opens the file specified in the given scripting parameters.
 void doProcessing()
          Opens the spatial object file(s) requested.
 LSCommand getCommand()
          Reports the syntax required to allow files to be opened via a scripting command.
 GISFrame getGISFrame()
          Retrieves the GISFrame that can be used for storing multiple spatial objects.
 Object getReturnedObject()
          Returns a spatial object that has been opened via scripting command.
 
Methods inherited from class jwo.landserf.process.LSThread
checkStoppedThread, interruptionRequested, resetTimer, run, setErrorMessage, setFinalMessage, setMessage
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OpenThread

public OpenThread(GISFrame gisFrame)
Creates an object ready for opening but does not open any files. This is primarily used for opening files via the scripting interface.

Parameters:
gisFrame - Frame holding spatial objects and in which to report results.

OpenThread

public OpenThread(GISFrame gisFrame,
                  File[] inFiles)
Attempts to open the relevant spatial object file(s). Guesses the file type by the extension of the file name. Note that this is not reliable for several of the file types that share the same extension (e.g. .txt).

Parameters:
gisFrame - Frame holding spatial objects and in which to report results.
inFiles - File(s) to open.

OpenThread

public OpenThread(GISFrame gisFrame,
                  File[] inFiles,
                  int fileType,
                  int position)
Opens the relevant spatial object file(s).

Parameters:
gisFrame - Frame holding spatial objects and in which to report results.
inFiles - File(s) to open.
fileType - Type of file to open.
position - Object selection type. Either GISFrame.PRIMARY, GISFrame.SECONDARY, GISFrame.NOT_SELECTED.
Method Detail

doProcessing

public void doProcessing()
Opens the spatial object file(s) requested. The newly opened spatial object(s) is/are stored in the GISFrame supplied to the constructor.

Note that this method will be called automatically if this is run as a threaded process (e.g. myOpenThread.start()). Alternatively it can be called directly as a non-threaded process.

Specified by:
doProcessing in class LSThread
See Also:
GISFrame

getCommand

public LSCommand getCommand()
Reports the syntax required to allow files to be opened via a scripting command.

Specified by:
getCommand in interface Scriptable
Returns:
Command syntax.

doCommand

public boolean doCommand(LSCommand command)
Opens the file specified in the given scripting parameters.

Specified by:
doCommand in interface Scriptable
Parameters:
command - Command containing parameter values.
Returns:
True if file opened successfully. If false, the details of the problem are reported to the gisFrame.

getReturnedObject

public Object getReturnedObject()
Returns a spatial object that has been opened via scripting command. If command has yet to be issued this will return null.

Specified by:
getReturnedObject in interface Scriptable
Returns:
New spatial object or null if problems opening file or command has not yet been issued.

getGISFrame

public GISFrame getGISFrame()
Retrieves the GISFrame that can be used for storing multiple spatial objects.

Specified by:
getGISFrame in interface Scriptable
Returns:
GISFrame storing spatial objects.


Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009