ccs.cpc
Class Viewer

java.lang.Object
  extended by ccs.cpc.Viewer
All Implemented Interfaces:
java.lang.Comparable<Viewer>
Direct Known Subclasses:
HelperApp, Plugin

public abstract class Viewer
extends java.lang.Object
implements java.lang.Comparable<Viewer>

A "viewer" is the commonality of a plug-in and an external helper application. (NOTE: the above nomenclature is rather new. Until recently these two were called internal and external viewers respectively.) Note that a "viewer" is not necessarily passive - it may change its data - and isn't necessarily even a viewer! (Now you can see why we changed the notation.) This class represents static information about the "viewer". Runtime / lifecycle is handled by ViewerRuntime and its subclasses.


Nested Class Summary
static class Viewer.FileCap
          File handling capability.
 
Field Summary
protected  boolean editness
           
protected  Viewer.FileCap fileness
           
 
Constructor Summary
protected Viewer(java.lang.String name, boolean editness, Viewer.FileCap fileness)
           
 
Method Summary
 int compareTo(Viewer v)
           
static Viewer createFrom(java.io.DataInputStream dis, int marshalver)
          Create a viewer from stored data
 boolean getEditness()
          Whether the viewer edits files.
 Viewer.FileCap getFileness()
          The viewer's capacity to be launched with or without a file (or either).
abstract  java.lang.String getID()
          Return a unique ID for this viewer, unique at least within the current profile.
 java.lang.String getName()
          Return the viewer's name.
abstract  ViewerRuntime getRuntime(PluginCallback callback, VFile target)
          create a suitable runtime instance of this viewer, viewing a given target.
 void marshalTo(java.io.DataOutputStream dos)
           
protected abstract  void submarshal(java.io.DataOutputStream dos)
           
 void validate(java.awt.Frame parent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

editness

protected boolean editness

fileness

protected Viewer.FileCap fileness
Constructor Detail

Viewer

protected Viewer(java.lang.String name,
                 boolean editness,
                 Viewer.FileCap fileness)
Method Detail

marshalTo

public final void marshalTo(java.io.DataOutputStream dos)
                     throws java.io.IOException
Throws:
java.io.IOException

getID

public abstract java.lang.String getID()
Return a unique ID for this viewer, unique at least within the current profile.


submarshal

protected abstract void submarshal(java.io.DataOutputStream dos)
                            throws java.io.IOException
Throws:
java.io.IOException

createFrom

public static final Viewer createFrom(java.io.DataInputStream dis,
                                      int marshalver)
                               throws java.io.IOException
Create a viewer from stored data

Parameters:
dis - The stream of previously stored data.
marshalver - the marshal version of the ProfileModel object this is stored in.
Throws:
java.io.IOException

getName

public java.lang.String getName()
Return the viewer's name.


getEditness

public boolean getEditness()
Whether the viewer edits files. NB. no setter - in the case of plugins, the plugin dictates this.


getFileness

public Viewer.FileCap getFileness()
The viewer's capacity to be launched with or without a file (or either). NB. no setter - in the case of plugins, the plugin dictates this.


getRuntime

public abstract ViewerRuntime getRuntime(PluginCallback callback,
                                         VFile target)
                                  throws java.io.IOException
create a suitable runtime instance of this viewer, viewing a given target.

Throws:
java.io.IOException

validate

public void validate(java.awt.Frame parent)
              throws ccs.LoseException
Throws:
ccs.LoseException

compareTo

public int compareTo(Viewer v)
Specified by:
compareTo in interface java.lang.Comparable<Viewer>