net.ponec.jworksheet.core
Class ApplContext

Package class diagram package ApplContext
java.lang.Object
  extended by net.ponec.jworksheet.core.ApplContext
All Implemented Interfaces:
java.lang.Runnable, java.util.EventListener, javax.swing.event.TableModelListener, JwsContext

public class ApplContext
extends java.lang.Object
implements javax.swing.event.TableModelListener, java.lang.Runnable, JwsContext

A Main Application Context


Field Summary
protected  WorkDay currentDay
           
static java.lang.String EXTENSION_TMP
          A temporarry extension
static java.lang.String FILE_DATA
          Data XML File
static java.lang.String FILE_LOCK
          Lock File
static java.lang.String FILE_MODULES
          Subdirectory of modules
static java.lang.String FILE_STYLES
          Style subdirectory
static boolean LANGUAGE_MANAGER_ENABLED
          Is the language manager enabled?
protected  LanguageManager languageManager
          LanguageMananer
static java.lang.String MODULE_ENTRY
           
protected  Parameters parameters
          Parameters of the application.
protected  int timeInterval
           
protected  long timeSaveExpected
          Last Saved Time
protected  JWorkSheet topFrame
          Basic window
protected  WorkSpace workSpace
           
 
Constructor Summary
ApplContext()
          Creates a new instance of ApplContext
 
Method Summary
 void closeAppl(boolean closeWindow)
          Close The Application (no exit)
 void createExitEvent()
          Create an Exit row, if it is enabled.
 boolean createLock(boolean force)
          Create new lock.
 void deleteTempFiles()
          Delete all temporarry files from a Config Directory.
 Event findLastEventToday()
          Returns the Last Event Today, or null.
 void fireModuleEvent()
          File an module event.
 java.io.File getConfigDir()
          Configuration Directory
 java.io.File getConfigFile()
          Configuration Directory
 java.io.File getDataFile()
          Data File
 java.io.File getDataFileBackup()
          Data File Backup
 java.io.File getDataFileTemp()
          Data File for a temporarry usage.
 float getDataVersion()
          Returns an old version.
 java.util.Locale getLanguage()
          Current Language
 LanguageManager getLanguageManager()
          Returns manager
 java.util.List<MetaReport> getMetaReports()
          Get Sorted Reports.
 java.io.File getModulesDir()
          Get Modules directory and create one if the directory is missing.
 Parameters getParameters()
          Parameters of the application.
 YearMonthDay getSelectedDay()
          Get "Selected Day" - don't modify it!
 java.lang.String getSelectedDayStr()
          GetCurrentDay
 java.io.File getStyleDir()
          Style Directory
 java.io.File getStyleFile(java.lang.String fileName)
          Get a style file
 javax.swing.JTabbedPane getTabbedPane()
          Get a main Tabbed pane of the application
 java.lang.String getTagContent(java.io.File file, java.lang.String tagName)
          Returns a tag content.
 JWorkSheet getTopFrame()
          Get JWorkSheet
 WorkDay getWorkDay()
          Get Work Day
 WorkSpace getWorkSpace()
          Returns WorkSpace
 void initModules()
           
 boolean isDataRestored()
          Warning: data is restored from a backup!
 boolean isStarting()
          Does application starting
 boolean isSystrayEnabled()
          Systray is enabled in case a parameter is supported AND system is supported too
 boolean isToday()
          Is selected time Today?
 void loadData()
          Load Parameters & Data.
protected  void loadParameters()
          Load parameters from file.
 void run()
          Save data (file: data.xml)
 void saveData(boolean includeParams)
          Save data into file(s)
 void saveParameters()
          Save parameters into file.
 void saveStyleFiles()
          Save styles into config directory.
 void selectWorkDay(YearMonthDay workDay)
          Select a WorkDay by parameter
 void setInitialized()
          Initializaton flag
 void setSystrayTooltip()
          Display a Tooltip into a Systray
 void setTopFrame(JWorkSheet topFrame, boolean showDebugWindow)
          Set JWorkSheet
 void setUserConfigDir(java.lang.String userConfigDir)
          Set a user configuration directory
 void showReport(java.lang.String report)
          Show report in a browser.
 void showReport(java.lang.String aData, java.io.File aXsl, java.util.ArrayList<java.lang.String[]> params)
          Show a report in HTML viewer:
 void tableChanged(javax.swing.event.TableModelEvent e)
          Save a data in a special thread, if data is changed (TableModelListener).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LANGUAGE_MANAGER_ENABLED

public static final boolean LANGUAGE_MANAGER_ENABLED
Is the language manager enabled?

See Also:
Constant Field Values

FILE_LOCK

public static final java.lang.String FILE_LOCK
Lock File

See Also:
Constant Field Values

FILE_DATA

public static final java.lang.String FILE_DATA
Data XML File

See Also:
Constant Field Values

FILE_STYLES

public static final java.lang.String FILE_STYLES
Style subdirectory

See Also:
Constant Field Values

FILE_MODULES

public static final java.lang.String FILE_MODULES
Subdirectory of modules

See Also:
Constant Field Values

EXTENSION_TMP

public static final java.lang.String EXTENSION_TMP
A temporarry extension

See Also:
Constant Field Values

MODULE_ENTRY

public static final java.lang.String MODULE_ENTRY
See Also:
Constant Field Values

topFrame

protected JWorkSheet topFrame
Basic window


languageManager

protected LanguageManager languageManager
LanguageMananer


parameters

protected Parameters parameters
Parameters of the application.


workSpace

protected WorkSpace workSpace

currentDay

protected WorkDay currentDay

timeSaveExpected

protected long timeSaveExpected
Last Saved Time


timeInterval

protected final int timeInterval
See Also:
Constant Field Values
Constructor Detail

ApplContext

public ApplContext()
Creates a new instance of ApplContext

Method Detail

getWorkSpace

public WorkSpace getWorkSpace()
Returns WorkSpace

Specified by:
getWorkSpace in interface JwsContext

loadData

public void loadData()
Load Parameters & Data. Set the current day.


initModules

public void initModules()

saveData

public void saveData(boolean includeParams)
Save data into file(s)


closeAppl

public void closeAppl(boolean closeWindow)
Close The Application (no exit)


createExitEvent

public void createExitEvent()
Create an Exit row, if it is enabled.


getConfigDir

public java.io.File getConfigDir()
Configuration Directory

Specified by:
getConfigDir in interface JwsContext

getStyleDir

public java.io.File getStyleDir()
Style Directory

Specified by:
getStyleDir in interface JwsContext

getModulesDir

public java.io.File getModulesDir()
Get Modules directory and create one if the directory is missing.


getConfigFile

public java.io.File getConfigFile()
Configuration Directory

Specified by:
getConfigFile in interface JwsContext

getDataFile

public java.io.File getDataFile()
Data File

Specified by:
getDataFile in interface JwsContext

getDataFileTemp

public java.io.File getDataFileTemp()
                             throws java.io.IOException
Data File for a temporarry usage.

Specified by:
getDataFileTemp in interface JwsContext
Throws:
java.io.IOException

deleteTempFiles

public void deleteTempFiles()
Delete all temporarry files from a Config Directory.


getDataFileBackup

public java.io.File getDataFileBackup()
Data File Backup

Specified by:
getDataFileBackup in interface JwsContext

getStyleFile

public java.io.File getStyleFile(java.lang.String fileName)
Get a style file

Specified by:
getStyleFile in interface JwsContext

getSelectedDay

public YearMonthDay getSelectedDay()
Get "Selected Day" - don't modify it!

Specified by:
getSelectedDay in interface JwsContext

getSelectedDayStr

public java.lang.String getSelectedDayStr()
GetCurrentDay


isToday

public boolean isToday()
Is selected time Today?

Specified by:
isToday in interface JwsContext

getLanguage

public java.util.Locale getLanguage()
Current Language

Specified by:
getLanguage in interface JwsContext

selectWorkDay

public void selectWorkDay(YearMonthDay workDay)
Select a WorkDay by parameter

See Also:
getWorkDay()

getWorkDay

public WorkDay getWorkDay()
Get Work Day

Specified by:
getWorkDay in interface JwsContext

tableChanged

public void tableChanged(javax.swing.event.TableModelEvent e)
Save a data in a special thread, if data is changed (TableModelListener).

Specified by:
tableChanged in interface javax.swing.event.TableModelListener

run

public void run()
Save data (file: data.xml)

Specified by:
run in interface java.lang.Runnable

createLock

public boolean createLock(boolean force)
Create new lock.


getParameters

public Parameters getParameters()
Parameters of the application.

Specified by:
getParameters in interface JwsContext

loadParameters

protected void loadParameters()
Load parameters from file.


saveStyleFiles

public void saveStyleFiles()
Save styles into config directory.


saveParameters

public void saveParameters()
Save parameters into file.


setInitialized

public void setInitialized()
Initializaton flag


isStarting

public boolean isStarting()
Description copied from interface: JwsContext
Does application starting

Specified by:
isStarting in interface JwsContext

fireModuleEvent

public void fireModuleEvent()
File an module event.


getDataVersion

public float getDataVersion()
Returns an old version.


getTagContent

public java.lang.String getTagContent(java.io.File file,
                                      java.lang.String tagName)
                               throws java.io.IOException
Returns a tag content.

Throws:
java.io.IOException

getTopFrame

public JWorkSheet getTopFrame()
Get JWorkSheet

Specified by:
getTopFrame in interface JwsContext

setTopFrame

public void setTopFrame(JWorkSheet topFrame,
                        boolean showDebugWindow)
Set JWorkSheet


setUserConfigDir

public void setUserConfigDir(java.lang.String userConfigDir)
Set a user configuration directory


showReport

public void showReport(java.lang.String aData,
                       java.io.File aXsl,
                       java.util.ArrayList<java.lang.String[]> params)
                throws javax.xml.transform.TransformerConfigurationException,
                       javax.xml.transform.TransformerException,
                       java.io.IOException
Show a report in HTML viewer:

Parameters:
aData - Null value means a BasicDataFile
aXsl -
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

getMetaReports

public java.util.List<MetaReport> getMetaReports()
Get Sorted Reports.


isSystrayEnabled

public boolean isSystrayEnabled()
Systray is enabled in case a parameter is supported AND system is supported too

Specified by:
isSystrayEnabled in interface JwsContext

findLastEventToday

public Event findLastEventToday()
Returns the Last Event Today, or null.


setSystrayTooltip

public void setSystrayTooltip()
Display a Tooltip into a Systray


showReport

public void showReport(java.lang.String report)
                throws java.io.IOException
Show report in a browser.

Throws:
java.io.IOException

isDataRestored

public boolean isDataRestored()
Warning: data is restored from a backup!


getLanguageManager

public LanguageManager getLanguageManager()
Returns manager


getTabbedPane

public javax.swing.JTabbedPane getTabbedPane()
Get a main Tabbed pane of the application

Specified by:
getTabbedPane in interface JwsContext


Copyright © 2007-2009 PPonec