|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectGlobals
HTMLtools
public class HTMLtools
Program HTMLtools main class.
This application converts a set of tab-delimited data files to various HTML < TABLE > formats with many mapping options available. We use the term Table with an upper case 'T' to indicate the FileTable data structure used throughout the program. The command line arguments are parsed by the Switches class. It may be used iteratively if the argument is the '-batchProcess:{some batch file}' switch.
The program is documented in the MANUAL.html file that includes an introduction, list of switch commands, a number of examples, instructions, and additional documentation. See TODO.java class for [TODO] List for software Development.
Note that the application could be tightened up and optimized more. However, since most of the files it processes are relatively small, it may not be worth the effort.
List of Class modules
List of Methods HTMLtools() - Constructor for converter main class createGUI() - create GUI instance. Do this only one time. createSearchGUI() - create Search GUI instance. Do this only one time. isAbortProcessingFlag() - check abort processing flag abortProcessingFlag. setAbortProcessingFlag() - set abort processing flag abortProcessingFlag. main() - program main when used as stand-alone application. cmdLineProcess() - main processing to parse command lines, process all files. initCvt() - get OS variables, set up class instances & some data structures. processTableFile() - process an input file into an output HTML file. setupPrologEpilogue() - get the prolog and epilogue if they exist. mapFileSpecificPrologKeywords() - map file specific keywords in prolog. mapFileSpecificEpilogueKeywords() - map file specific keywords in epilogue. preprocessTable() - pre-process the Table prior to conversion to HTML. makeConcatTable() - create a new concatenated tab-delimited .txt makePrefaceHTML() - if -makePrefaceHTML, then setup preface file doEpilogueExtract() - if row extraction from resource file, mod. epilogue saveIndexMapFile() - save the index map table for the edited Table closeProgram() - close out the log file if logging messages and exit. fastEditFile() - fast process an input file into a tab-delimited file. buildColumnEditMap() - build column editing map for fast table editing. postCopyFilesAndDirectories() - copy files post-conversion joinTableToCurrentTable() - join another table to ft before preprocessing createFlipTable() - generate transposed flipped Table files: .txt, .html makeIndexMapFile() - read file header, make Index-Map in Table structure addNameOfHTMLfile() - append name of HTML file path last generated clearGenHTMLpathList() - clear Generated HTML path List getGenHTMLpathList() - get Generated HTML path List incrUpdateStatusLine() - if GUI, then do incremental statusLine update.
This code is available at the HTMLtools project on SourceForge at http://htmltools.sourceforge.org/ under the "Common Public License Version 1.0" http://www.opensource.org/licenses/cpl1.0.php.
It was derived and refactored from the open source MAExplorer (http://maexplorer.sourceforge.org/), and Open2Dprot (http://Open2Dprot.sourceforge.net/) Table modules.
$Date: 2009/12/12 11:45:56 $ $Revision: 1.41 $
Copyright 2008, 2009 by Peter Lemkin
E-Mail: lemkin@users.sourceforge.net
http://lemkingroup.com/
Field Summary | |
---|---|
static boolean |
abortProcessingFlag
Abort processing at major points: at the end of each file being converted. |
static CvtGUI |
gui
CvtGui instance if it exists |
java.lang.String |
initialReport
Initial report to user on startup |
static SearchGUI |
sGui
SearchGui instance if it exists |
static boolean |
usingGUIflag
Set if started up as a GUI of any type |
static boolean |
verboseLoggingFlag
|
static java.lang.String |
VERSION
Title line version numbers |
Constructor Summary | |
---|---|
HTMLtools()
HTMLtools() - Constructor for converter main class |
Method Summary | |
---|---|
void |
addNameOfHTMLfile(java.lang.String nameOfHTMLpath)
addNameOfHTMLfile() - append name of HTML file path last generated to the this.genHTMLpathList[] list. |
private int[] |
buildColumnEditMap(FileTable ft,
boolean reorderRemainingColsFlag)
buildColumnEditMap() - build column editing map for fast table editing. |
void |
clearGenHTMLpathList(boolean forceFlag)
clearGenHTMLpathList() - clear Generated HTML path List if not using the GUI and not doing batch processing. |
void |
closeProgram(int exitNbr)
closeProgram() - close out the log file if logging messages and exit with the exit number. |
boolean |
cmdLineProcess(java.lang.String[] args)
cmdLineProcess() - main processing for CvtTabDelim2HTML. |
private boolean |
convertTableFiles()
convertTableFiles() - process list of Table files into HTML files. |
boolean |
createCvtGUI()
createCvtGUI() - create GUI instance. |
private boolean |
createFlipTable()
createFlipTable() - generate transposed flipped Table files (.txt and .html). |
boolean |
createSearchGUI(java.lang.String searchParamMapDefault)
createSearchGUI() - create Search GUI instance. |
private boolean |
createTestsIntersectionTable()
createTestsIntersectionTable() - create Tests Intersection Table and do related processing and .txt and .html file generation. |
private java.lang.String |
doEpilogueExtract(FileTable ft,
java.lang.String sEpilogue)
doEpilogueExtract() - test if doing row extraction from a resource table to modify the epilogue. |
private boolean |
doGenBatchScripts()
doGenBatchScripts() - do GenBatchScripts processing to create batchScripts/ directory. |
private boolean |
fastEditFile(int fileNbr,
int maxFiles,
java.lang.String iDir,
java.lang.String oDir,
java.lang.String iFile,
java.lang.String oFile,
java.lang.String sName)
fastEditFile() - fast process an input file into a tab-delimited file. |
java.lang.String[] |
getGenHTMLpathList()
getGenHTMLpathList() - get Generated HTML path List cvt.genHTMLpathList[]. |
void |
incrUpdateStatusLine(java.lang.String incrStr)
incrUpdateStatusLine() - if GUI, then do incremental statusLine update. |
void |
initBase()
initBase() - initialize basic data structures |
boolean |
initCvt(java.lang.String[] args)
initCvt() - initialize data structures |
static boolean |
isAbortProcessingFlag()
isAbortProcessingFlag() - check abort processing flag abortProcessingFlag. |
boolean |
joinTableToCurrentTable(FileTable ft,
java.lang.String joinTableFile)
joinTableToCurrentTable() - join another table to ft before preprocessing. |
static void |
main(java.lang.String[] args)
main() - run CvtTabDelim2HTML as a stand-alone application. |
private boolean |
makeConcatTable(FileTable ft,
int fileNbr,
int maxFiles)
makeConcatTable() - create a new concatenated tab-delimited .txt output file from the set of input text files IFF they have exactly the same column header names. |
private FileTable |
makeIndexMapFile(java.lang.String iFileNamePath,
java.lang.String oDir,
java.lang.String oIdxFileName)
makeIndexMapFile() - read file header and make Index-Map in Table structure. |
private java.lang.String |
makePrefaceHTML(FileTable ft,
java.lang.String oFile,
java.lang.String sName,
java.lang.String sProlog,
java.lang.String sEpilogue)
makePrefaceHTML() - if -makePrefaceHTML, then setup preface file name to link to in the 2nd file HTML we generate |
java.lang.String |
mapFileSpecificEpilogueKeywords(java.lang.String subTitle,
java.lang.String epilogue)
mapFileSpecificEpilogueKeywords() - map file specific keywords in the epilogue. |
java.lang.String |
mapFileSpecificPrologKeywords(java.lang.String subTitle,
java.lang.String prolog)
mapFileSpecificPrologKeywords() - map file specific keywords in prolog. |
boolean |
postCopyFilesAndDirectories()
postCopyFilesAndDirectories() - copy files post-conversion using the set of -copyFile:{srcFile,destFile} and -copyTree:{srcTreeFiles,destPath} switches specified. |
private boolean |
preprocessTable(FileTable ft)
preprocessTable() - pre-process the Table prior to conversion to HTML. |
private boolean |
processTableFile(int fileNbr,
int maxFiles,
java.lang.String iDir,
java.lang.String oDir,
java.lang.String iFile,
java.lang.String oFile,
java.lang.String sName,
java.lang.String sProlog,
java.lang.String sEpilogue,
boolean use_ftConcatFlag)
processTableFile() - Process an input file into an output HTML file. |
private boolean |
saveIndexMapFile(java.lang.String inputFilePath,
java.lang.String oDir,
java.lang.String oFile,
FileTable ft)
saveIndexMapFile() - save the index map table for the edited Table If doing '-makeIndexMapFile:{colName1,colName2,...,colNameN}' first generate the Index-Map Table using the makeIdxMapTable(). |
static void |
setAbortProcessingFlag(boolean flag)
setAbortProcessingFlag() - set abort processing flag abortProcessingFlag. |
boolean |
setupPrologEpilogue()
setupPrologEpilogue() - setup the prolog and epilogue strings if the files exist. |
Methods inherited from class Globals |
---|
reinitGBSglobalSwitches, reinitGlobalSwitches, reinitJTVglobalSwitches, reinitTIglobalSwitches |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION
public static CvtGUI gui
public static SearchGUI sGui
public static boolean usingGUIflag
public static boolean abortProcessingFlag
public static boolean verboseLoggingFlag
public java.lang.String initialReport
Constructor Detail |
---|
public HTMLtools()
Method Detail |
---|
public boolean createCvtGUI()
CvtGUI
public boolean createSearchGUI(java.lang.String searchParamMapDefault)
searchParamMapDefault
- is default param .map file if not null.
SearchGUI
public static boolean isAbortProcessingFlag()
public static void setAbortProcessingFlag(boolean flag)
public static void main(java.lang.String[] args)
public boolean cmdLineProcess(java.lang.String[] args)
Globals.reinitGlobalSwitches()
,
#parseSwitches
,
convertTableFiles()
,
doGenBatchScripts()
,
createTestsIntersectionTable()
,
postCopyFilesAndDirectories()
,
createFlipTable()
,
closeProgram(int)
,
Convert.checkAndMakeIndexHtmlDirList(int, java.lang.String, java.lang.String[], boolean[])
,
FileIO.getDirOfFile(java.lang.String)
,
FileIO.getFilesInDir(java.lang.String, java.lang.String)
,
FileIO.readFileAsString(java.lang.String)
,
JTVconvert
,
JTVconvert.convertAllJTVfiles()
,
Switches.parseSwitches(java.lang.String[])
,
UtilCM.logMsg(java.lang.String)
,
UtilCM.mapCRLF2space(java.lang.String)
,
UtilCM.dateStr()
,
UtilCM.changeWorkingDirectory(java.lang.String)
,
UtilCM.cvs2Array(java.lang.String, java.lang.String)
public boolean initCvt(java.lang.String[] args)
args
- is the command line arg list
UtilCM
,
UtilCM.dateStr()
,
UtilCM.logMsg(java.lang.String)
,
Convert
,
FileTable
,
Switches
public void initBase()
private boolean convertTableFiles()
processTableFile(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)
,
setupPrologEpilogue()
,
UtilCM.logMsg(java.lang.String)
,
UtilCM.replaceSubstrInString(java.lang.String, java.lang.String, java.lang.String)
private boolean processTableFile(int fileNbr, int maxFiles, java.lang.String iDir, java.lang.String oDir, java.lang.String iFile, java.lang.String oFile, java.lang.String sName, java.lang.String sProlog, java.lang.String sEpilogue, boolean use_ftConcatFlag)
[1] Create a current FileTable instance. [2] Read and parse the tab-delimited input file to current FileTable. [3] Optional (switch dependent) Table pre-processing including: -dropColumn list of columns -keepColumn list of columns -reorderColumn list of columns -mapLongToShortHdrNames -sortRowsByColumn data. [3.1] optional -concatTables data from all input files with the the same ft.tFields. [3.2] optional creation of preface HTML string (from 1st part of current file before Table) for use later when convert and post process the current Table. [3.3] if -extractRow, then get the data from the resource Table file and insert it into the epilogue string for $$EXTRACT_ROW$$. [4] Conversion of current File Table to HTML by the following: Then it creates a Column-to-URL mapping lists. a) Add Web page header via the prolog and the TABLE title. b) Add TABLE header row c) Add all of the TABLE data rows, mapping some column data to the URL HREFs if match. d) Add epilogue HTML if it exists (before doing extractRow if required). [4.1] Write the HTML file from the current File Table. If doing -makeIndexMapFile, then no HTML file is generated. If doing '-saveEditedTable2File:{outTblFile,opt. "HTML"}', then the HTML is conditionally written. If the outTblFile is null then use the input file name with the output file postfix string added to the input file. [5] optional post-conversion preface processing to create HTML file linked from the current Table HTML file. [6] If doing '-concatTables:{outputConcatenateFile.txt}', or '-makeIndexMapFile:{colName1,colName2,...,colNameN}' or '-saveEditedTable2File:{outTblFile,opt. "HTML"}', then it will write an output file. In the case of -makeIndexMapFile, it has the same name as the input file, but with an .idx file extensions.Finally it writes the
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |