me.escapeNT.pail.Util
Class Util

java.lang.Object
  extended by me.escapeNT.pail.Util.Util

public class Util
extends Object

Various static utility methods.

Author:
escapeNT

Constructor Summary
Util()
           
 
Method Summary
static FileMenu getFileMenu()
           
static HashMap<String,JPanel> getInterfaceComponents()
           
static Pail getPlugin()
           
static ServerControlPanel getServerControls()
           
static void log(Level level, Object message)
          Logs a message from the plugin to the console with the specified level..
static void log(Object message)
          Logs an info message from the plugin to the console.
static String[] readLastLines(File file, int numLines)
          Reads the last number of specified lines in a file.
static void saveTextFile(String text, File saveTo)
          Saves the specified text to a file.
static void setFileMenu(FileMenu aFileMenu)
           
static void setPlugin(Pail aPlugin)
           
static void setServerControls(ServerControlPanel aServerControls)
           
static String translate(String text)
          Translates the text to the configured language.
static void translateTextComponent(JButton c)
           
static void translateTextComponent(JCheckBox c)
           
static void translateTextComponent(JLabel c)
           
static void translateTextComponent(JRadioButton c)
           
static void zipDir(File dir, File zipFile)
          Compresses a directory to a zip file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

readLastLines

public static String[] readLastLines(File file,
                                     int numLines)
Reads the last number of specified lines in a file.

Parameters:
file - The file to read from.
numLines - The number of lines to read from the end.
Returns:
The last n lines from the file.

log

public static void log(Object message)
Logs an info message from the plugin to the console.

Parameters:
message - The message to send.

log

public static void log(Level level,
                       Object message)
Logs a message from the plugin to the console with the specified level..

Parameters:
level - The log level.
message - The message to send.

saveTextFile

public static void saveTextFile(String text,
                                File saveTo)
                         throws IOException
Saves the specified text to a file.

Parameters:
text - The text to save.
saveTo - The file to write the text to.
Throws:
IOException

translate

public static String translate(String text)
Translates the text to the configured language.

Parameters:
text - The text to translate.
Returns:
The translated text.

zipDir

public static void zipDir(File dir,
                          File zipFile)
Compresses a directory to a zip file.

Parameters:
dir - The path to directory to compress.
zipFile - The path to the resulting zip file.

getPlugin

public static Pail getPlugin()
Returns:
the plugin

setPlugin

public static void setPlugin(Pail aPlugin)
Parameters:
aPlugin - the plugin to set

getInterfaceComponents

public static HashMap<String,JPanel> getInterfaceComponents()
Returns:
the interfaceComponents

getServerControls

public static ServerControlPanel getServerControls()
Returns:
the serverControls

setServerControls

public static void setServerControls(ServerControlPanel aServerControls)
Parameters:
aServerControls - the serverControls to set

getFileMenu

public static FileMenu getFileMenu()
Returns:
the fileMenu

setFileMenu

public static void setFileMenu(FileMenu aFileMenu)
Parameters:
aFileMenu - the fileMenu to set

translateTextComponent

public static void translateTextComponent(JCheckBox c)

translateTextComponent

public static void translateTextComponent(JLabel c)

translateTextComponent

public static void translateTextComponent(JButton c)

translateTextComponent

public static void translateTextComponent(JRadioButton c)


Copyright © 2011. All Rights Reserved.