Class FlkDemo

java.lang.Object
  extended by FlkDemo

public class FlkDemo
extends java.lang.Object

FlkDemo contains methods to maintain the DB/FlkDemoDB.txt database used by Flicker. The file is a tab-delimited file with the following 7 fields: SubMenuName, SubMenuEntry, ClickableURL1, ImageURL1, ClickableURL2,ImageURL2,StartupData

 The map is used to build menus of images to load
 a map entry contains the following fields:
 1. SubMenuName: is the menu image name: e.g.,
   "Human Plasma"
 2. SubMenuEntry: is the menu image name: e.g.,
   "(Swiss2DPAGE vs Merril) gels - clickable"
 3. ClickableURL1: is the clickable map URL for image 1: e.g.,
   "http://www.expasy.org/cgi-bin/map3/big/PLASMA_HUMAN?"
 4. ImageURL1: is the Image URL for image 1: e.g.
   "http://www.expasy.org/ch2dgifs/PLASMA_HUMAN/PLASMA_HUMAN_id.gif"
 5. ClickableURL2: is the clickable map URL for image 2: e.g.,
   ""
 6. ImageURL2: is the Image URL for image 2: e.g.
   "plasmaL.gif"
 7. StartupData: is TRUE if should be the default startup for Flicker.
   "TRUE"

 The database file DB/FlkDemoDB.txt contains data Fields:
        SubMenuName, SubMenuEntry, ClickableURL1, ImageURL1, 
        ClickableURL2,ImageURL2,StartupData

 E.g. of a data entry:
        Human Plasma
        (Swiss2DPAGE vs Merril) gels - clickable
        http://www.expasy.org/cgi-bin/map3/PLASMA_HUMAN?
        PLASMA_HUMAN_id.gif     
        
        plasmaL.gif
        FALSE

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The Flicker Mozilla and Legal files are available on http://open2dprot.sourceforge.net/Flicker

Version:
$Date$ $Revision$
Author:
P. Lemkin (LECB/NCI), G. Thornwall (SAIC), Frederick, MD
See Also:
Flicker Home

Field Summary
(package private)  java.lang.String clickableURL1
          ClickableURL1: is the clickable map URL for image 1: e.g., "http://www.expasy.org/cgi-bin/map3/big/PLASMA_HUMAN?"
(package private)  java.lang.String clickableURL2
          ClickableURL2: is the clickable map URL for image 2: e.g., ""
private static Flicker flk
          Instance of Flicker
static java.lang.String FlkDemoDBfile
          name of the database file
static FlkDemo[] flkDemos
          FlkDemo database [0:nMaps]
(package private)  java.lang.String imageURL1
          ImageURL1: is the Image URL for image 1: e.g.
(package private)  java.lang.String imageURL2
          imageURL2: is the Image URL for image 2: e.g.
static int MAX_DATABASES
          MAX # of demo databases
static int MAX_DEMOS
          Max # of demo images
static int nMaps
          # of FlkDemos[] map entries
(package private)  boolean startupDataFlag
          is TRUE if should be the default startup for Flicker.
(package private)  java.lang.String subMenuEntry
          is the menu image name: e.g., "(Swiss2DPAGE vs Merril) gels - clickable"
(package private)  java.lang.String subMenuName
          is the menu image name: e.g., "Human Plasma"
private static Util util
          Instance of Util
 
Constructor Summary
FlkDemo(Flicker flkS)
          FlkDemo() - constructor for Class FlkDemo
FlkDemo(java.lang.String subMenuName, java.lang.String subMenuEntry, java.lang.String clickableURL1, java.lang.String imageURL1, java.lang.String clickableURL2, java.lang.String imageURL2, java.lang.String startupData)
          FlkDemo() - constructor to add a new FlkDemo entry NOTE: to do add of an entry, use 'new FlkDemo()' method
 
Method Summary
static void clear()
          clear() - clear database flkDemos[0:nMaps-1].
 boolean delete()
          delete() - rmv entry from database flkDemos[0:nMaps-1].
static int lookup(FlkDemo fm)
          lookup() - lookup entry to database flkDemos[0:nMaps-1].
static int lookupByFileName(java.lang.String fileName1, java.lang.String fileName2)
          lookupByFileName() - lookup entry by file name to flkDemos[0:nMaps-1].
(package private) static int lookupBySubmenu(java.lang.String subMenuEntry)
          lookupBySubmenu() - lookup entry by submenu name to flkDemos[0:nMaps-1].
(package private) static int lookupBySubMenuNameAndEntry(java.lang.String subMenuName, java.lang.String subMenuEntry)
          lookupBySubMenuNameAndEntry() - lookup entry by matching BOTH the SubMenuName and SubMenuEntry in the flkDemos[0:nMaps-1].
static boolean parseAndAddEntry(java.lang.String flkDemoDBdata)
          parseAndAddEntry() - parse and add entry to global to flkDemos[0:nMaps-1] if the data is well formed.
private static boolean read()
          read() - read database from FlkDemoDB.txt file to flkDemos[0:nMaps-1].
 boolean set(java.lang.String subMenuName, java.lang.String subMenuEntry, java.lang.String clickableURL1, java.lang.String imageURL1, java.lang.String clickableURL2, java.lang.String imageURL2, boolean startupDataFlag)
          set() - set entry to database flkDemos[0:nMaps-1].
static boolean write()
          write() - write database in memory to DB/FlkDemoDB.txt database file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flk

private static Flicker flk
Instance of Flicker


util

private static Util util
Instance of Util


MAX_DEMOS

public static final int MAX_DEMOS
Max # of demo images

See Also:
Constant Field Values

MAX_DATABASES

public static final int MAX_DATABASES
MAX # of demo databases

See Also:
Constant Field Values

flkDemos

public static FlkDemo[] flkDemos
FlkDemo database [0:nMaps]


nMaps

public static int nMaps
# of FlkDemos[] map entries


FlkDemoDBfile

public static java.lang.String FlkDemoDBfile
name of the database file


subMenuName

java.lang.String subMenuName
is the menu image name: e.g., "Human Plasma"


subMenuEntry

java.lang.String subMenuEntry
is the menu image name: e.g., "(Swiss2DPAGE vs Merril) gels - clickable"


clickableURL1

java.lang.String clickableURL1
ClickableURL1: is the clickable map URL for image 1: e.g., "http://www.expasy.org/cgi-bin/map3/big/PLASMA_HUMAN?"


imageURL1

java.lang.String imageURL1
ImageURL1: is the Image URL for image 1: e.g. "http://www.expasy.org/ch2dgifs/PLASMA_HUMAN/PLASMA_HUMAN_id.gif"


clickableURL2

java.lang.String clickableURL2
ClickableURL2: is the clickable map URL for image 2: e.g., ""


imageURL2

java.lang.String imageURL2
imageURL2: is the Image URL for image 2: e.g. "plasmaL.gif"


startupDataFlag

boolean startupDataFlag
is TRUE if should be the default startup for Flicker. "TRUE"

Constructor Detail

FlkDemo

public FlkDemo(Flicker flkS)
FlkDemo() - constructor for Class FlkDemo

Parameters:
flk - instance of Flicker

FlkDemo

public FlkDemo(java.lang.String subMenuName,
               java.lang.String subMenuEntry,
               java.lang.String clickableURL1,
               java.lang.String imageURL1,
               java.lang.String clickableURL2,
               java.lang.String imageURL2,
               java.lang.String startupData)
FlkDemo() - constructor to add a new FlkDemo entry NOTE: to do add of an entry, use 'new FlkDemo()' method

Parameters:
subMenuName -
subMenuEntry -
clickableURL1 -
imageURL1 -
clickableURL2 -
imageURL2 -
startupData -
Method Detail

read

private static boolean read()
read() - read database from FlkDemoDB.txt file to flkDemos[0:nMaps-1]. Append the data to the FlkDemos list.

Returns:
true if succeed

parseAndAddEntry

public static boolean parseAndAddEntry(java.lang.String flkDemoDBdata)
parseAndAddEntry() - parse and add entry to global to flkDemos[0:nMaps-1] if the data is well formed. Also check to see if the entry already exists (SubMenuName and SubMenuEntry), in which case overide it.

Parameters:
flkDemoDBdata - is a text file tab-delimited \n row terminated set of data for parsing into the FlkDemo[] database table.
Returns:
true if succeed

write

public static boolean write()
write() - write database in memory to DB/FlkDemoDB.txt database file.

Returns:
true if succeed

lookup

public static int lookup(FlkDemo fm)
lookup() - lookup entry to database flkDemos[0:nMaps-1].

Parameters:
fm - is the instance to lookup
Returns:
index of flkDemos[] if succeed, else -1

lookupBySubmenu

static int lookupBySubmenu(java.lang.String subMenuEntry)
lookupBySubmenu() - lookup entry by submenu name to flkDemos[0:nMaps-1].

Parameters:
subMenuEntry - is the menu name of the instance to lookup
Returns:
index of flkDemos[] if succeed, else -1

lookupBySubMenuNameAndEntry

static int lookupBySubMenuNameAndEntry(java.lang.String subMenuName,
                                       java.lang.String subMenuEntry)
lookupBySubMenuNameAndEntry() - lookup entry by matching BOTH the SubMenuName and SubMenuEntry in the flkDemos[0:nMaps-1]. database

Parameters:
subMenuName - is the menu name of the instance to lookup
subMenuEntry - is the menu name of the instance to lookup
Returns:
index of flkDemos[] if succeed, else -1

lookupByFileName

public static int lookupByFileName(java.lang.String fileName1,
                                   java.lang.String fileName2)
lookupByFileName() - lookup entry by file name to flkDemos[0:nMaps-1].

Parameters:
fileName1 - is the fileName name of the instance to lookup for imageURL1 (if not null)
fileName2 - is the fileName name of the instance to lookup for imageURL2 (if not null)
Returns:
index of flkDemos[] if succeed, else -1

set

public boolean set(java.lang.String subMenuName,
                   java.lang.String subMenuEntry,
                   java.lang.String clickableURL1,
                   java.lang.String imageURL1,
                   java.lang.String clickableURL2,
                   java.lang.String imageURL2,
                   boolean startupDataFlag)
set() - set entry to database flkDemos[0:nMaps-1]. NOTE: to do add of an entry, use 'new FlkDemo()' method

Parameters:
subMenuName -
subMenuEntry -
clickableURL1 -
imageURL1 -
clickableURL2 -
imageURL2 -
startupData -
Returns:
true if succeed

delete

public boolean delete()
delete() - rmv entry from database flkDemos[0:nMaps-1].

Returns:
true if succeed

clear

public static void clear()
clear() - clear database flkDemos[0:nMaps-1].