Class ScriptHandler

java.lang.Object
fr.ifremer.isisfish.ui.script.ScriptHandler
All Implemented Interfaces:
EventListener, TreeSelectionListener

public class ScriptHandler extends Object implements TreeSelectionListener
ScriptAction. Template are now loaded with freemarker.
Version:
$Revision$ Last update: $Date$ by : $Author$
Author:
letellier
  • Field Details

    • COLOR_SUCCESS

      public static final Color COLOR_SUCCESS
      Couleur de succes (vert leger).
    • COLOR_FAILURE

      public static final Color COLOR_FAILURE
      Couleur d'echec (rouge leger).
    • codeStorage

      protected CodeSourceStorage codeStorage
      Storage for currently edited file.
    • freemarkerConfiguration

      protected freemarker.template.Configuration freemarkerConfiguration
      Freemarke configuration used to create new script (based on templates).
    • scriptUI

      protected ScriptUI scriptUI
      UI managed by this action class.
    • scriptFileFilter

      protected static FileFilter scriptFileFilter
  • Constructor Details

    • ScriptHandler

      public ScriptHandler(ScriptUI scriptUI)
      Constructeur. Init freemarker.
      Parameters:
      scriptUI - managed script UI
  • Method Details

    • afterInit

      public void afterInit()
      Post init, must be called after ui building.
    • setButton

      protected void setButton()
      Update script UI component actions buttons.
    • setStatusMessage

      protected void setStatusMessage(String msg)
    • setStatusMessage

      protected void setStatusMessage(String msg, boolean running)
    • newScript

      public void newScript(MouseEvent event)
      Make new script, and select it on tree.
    • newScript

      public void newScript(ScriptHandler.ScriptMapping scriptType)
      Make new script, and select it on tree.
      Parameters:
      scriptType - script to make
    • newScript

      protected File newScript(String fileName, ScriptHandler.ScriptMapping scriptType)
      Creer un nouveau script, ici un script peut-etre un Script, un Simulator, un Export.
      Parameters:
      fileName - full filename
      scriptType - le type que l'on souhaite Script, Simulator, ou Export.
      Returns:
      created file or null if any error happen
    • returnError

      protected void returnError(String s, Exception eee)
      Write error in log and display exception to user.
      Parameters:
      s - message
      eee - cause
    • valueChanged

      public void valueChanged(TreeSelectionEvent e)
      Specified by:
      valueChanged in interface TreeSelectionListener
    • loadScript

      public void loadScript(File file)
      Load specified script in current action. TODO can we change this ?
      Parameters:
      file - file to load
    • fileLoaded

      public boolean fileLoaded()
    • isJavaScript

      public boolean isJavaScript()
    • saveScript

      public void saveScript()
      Save current editor test in current loaded codeStorage.
    • commitScript

      public void commitScript()
      Save script, and display commit UI.
    • exportScript

      public void exportScript()
      Exporte le(s) script(s) sélectionnés dans l'arbre.
      L'arbre doit avoir au moins un script de selectionnés
    • extractFiles

      protected static List<String> extractFiles(int prefixLength, TreePath[] selectedPaths)
    • getScriptFileFilter

      public static FileFilter getScriptFileFilter()
    • checkScript

      public boolean checkScript()
      Check script content.
      Returns:
      compilation success flag
    • checkAllScripts

      public void checkAllScripts()
      Check all scripts.
    • resetCheckLogArea

      protected void resetCheckLogArea()
    • checkAllScriptsAsync

      protected void checkAllScriptsAsync()
    • evaluateScript

      public void evaluateScript()
      Call main method in current cod storage code. Check script before call.
    • backup

      protected void backup(File src, String path, String suffix) throws IOException
      Copy a single file to destination directory.
      Parameters:
      src - file to copy
      path - path of file to copy
      suffix - file suffix
      Throws:
      IOException - if copy fail
    • scanZip

      protected static List<String>[] scanZip(File source, File root)
      Scan archive for script, and return an array of new files and conflict files.
      Parameters:
      source - archive file
      root - database directory
      Returns:
      an array [newFiles, conflictFiles]
    • deleteScript

      public void deleteScript(boolean deleteRemote)
      Delete a script
      Parameters:
      deleteRemote - true to remove in vcs too
    • diffScript

      public void diffScript()
      Show diff between selected files and files server version.
    • generateScriptJavadoc

      public void generateScriptJavadoc()
      Generate javadoc and display output in UI.
    • showScriptJavadoc

      public void showScriptJavadoc()
      Open a browser displaying javadoc.
    • moveFiles

      public void moveFiles(File directory, Collection<File> filesToMove)
      Move files. (called by drag and drop handler).
      Parameters:
      directory - directory to moves files to
      filesToMove - files to move to directory