it.eng.spagobi.plugins.ireport
Class PluginResourcesManager

java.lang.Object
  extended byit.eng.spagobi.plugins.ireport.PluginResourcesManager
All Implemented Interfaces:
it.businesslogic.ireport.util.LanguageChangedListener

public class PluginResourcesManager
extends java.lang.Object
implements it.businesslogic.ireport.util.LanguageChangedListener

This class manages the interface with iReport (load or save file), the boundleResources for language and the main data for the plugin configuration, like config folder, temp folder, and server location

Author:
scarel

Method Summary
 void closeIReportFile()
           
 java.lang.String getConfigFile()
           
 java.lang.String getConfigFolder()
           
 java.util.Locale getCurrentLocale()
           
 java.io.File getIReportFile()
          If the operation mode is set on "run", this method checks if there is an open JReportFrame.
 java.lang.String getIReportHomeDirectory()
           
 java.lang.String getLanguageResource(java.lang.String key)
           
 java.lang.String getLog()
           
 javax.swing.JFrame getMainFrame()
          This methods returns the main instance of the iReport MainFrame class if the operation mode is set on "run" or an empty JFrame otherwise
static PluginResourcesManager getMainInstance()
          This method returns the unique instance of this class
 java.lang.String getServerLocation()
           
 java.lang.String getTempFolder()
           
 void languageChanged(it.businesslogic.ireport.util.LanguageChangedEvent arg0)
           
 void logOnConsole(java.lang.String msg)
          This methods shows a message on the main console of iReport if the operation mode is set on "run" or on the System.out otherwise
 void openIReportFile(java.lang.String fileName)
          If the operation mode is set on "run", this method calls iReport method to open a JReportFile.
 java.io.File saveAndGetIReportFile()
          If the operation mode is set on "run", this method checks if there is an open JReportFrame and then shows a JDialog to ask to the user if he wants to save it.
 void setConfigFolder(java.lang.String configFolder)
           
 void setOperationMode(java.lang.String operationMode)
           
 void setResourceBounle()
          This method reads the .properties files containing language informations, complaint to the ResourceBoundle class If the operation mode is set on "run", the Locale information are taken from the iReport I18n class.
 void setServerLocation(java.lang.String serverLocation)
           
 void setTempFolder(java.lang.String tempFolder)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMainInstance

public static PluginResourcesManager getMainInstance()
This method returns the unique instance of this class


setOperationMode

public void setOperationMode(java.lang.String operationMode)

getMainFrame

public javax.swing.JFrame getMainFrame()
This methods returns the main instance of the iReport MainFrame class if the operation mode is set on "run" or an empty JFrame otherwise


getIReportHomeDirectory

public java.lang.String getIReportHomeDirectory()
Returns:
the iReport Home Directory

logOnConsole

public void logOnConsole(java.lang.String msg)
This methods shows a message on the main console of iReport if the operation mode is set on "run" or on the System.out otherwise


saveAndGetIReportFile

public java.io.File saveAndGetIReportFile()
If the operation mode is set on "run", this method checks if there is an open JReportFrame and then shows a JDialog to ask to the user if he wants to save it.

Returns:
the file if the user chooses the "OK" button or null otherwise or if no file are opened on iReport, if the operation mode is set on "run". If the operation mode is differnt from "run", a default file;

closeIReportFile

public void closeIReportFile()

getIReportFile

public java.io.File getIReportFile()
If the operation mode is set on "run", this method checks if there is an open JReportFrame.

Returns:
the file open on iReport or null otherwise, if the operation mode is set on "run". If the operation mode is differnt from "run", a default file;

openIReportFile

public void openIReportFile(java.lang.String fileName)
If the operation mode is set on "run", this method calls iReport method to open a JReportFile. Otherwise it shows a default message on the default console

Parameters:
fileName - Name of the file to be opened

setResourceBounle

public void setResourceBounle()
This method reads the .properties files containing language informations, complaint to the ResourceBoundle class If the operation mode is set on "run", the Locale information are taken from the iReport I18n class. Otherwise the dafult Locale is set on ITALIAN


languageChanged

public void languageChanged(it.businesslogic.ireport.util.LanguageChangedEvent arg0)
Specified by:
languageChanged in interface it.businesslogic.ireport.util.LanguageChangedListener

getCurrentLocale

public java.util.Locale getCurrentLocale()

getLanguageResource

public java.lang.String getLanguageResource(java.lang.String key)

getConfigFolder

public java.lang.String getConfigFolder()

setConfigFolder

public void setConfigFolder(java.lang.String configFolder)

getServerLocation

public java.lang.String getServerLocation()

setServerLocation

public void setServerLocation(java.lang.String serverLocation)

getTempFolder

public java.lang.String getTempFolder()

setTempFolder

public void setTempFolder(java.lang.String tempFolder)

getConfigFile

public java.lang.String getConfigFile()

getLog

public java.lang.String getLog()