net.ponec.jworksheet.core
Class ApplTools

Package class diagram package ApplTools
java.lang.Object
  extended by net.ponec.jworksheet.core.ApplTools

public final class ApplTools
extends java.lang.Object

Static methods.


Constructor Summary
ApplTools()
           
 
Method Summary
static void aboutApplication(java.lang.Object frame, java.lang.String title, java.lang.String version, java.lang.String licence, java.lang.String homePage, java.lang.String date, java.lang.String ide, java.lang.String iconLicence, java.lang.String libraryLicence, javax.swing.Icon logo, javax.swing.JButton okButton, LanguageManager lm)
          Display an About program message.
static void browse(java.net.URI uri, java.lang.String sysBrowser)
          Open uri by system browser
static void copy(java.io.File source, java.io.File target)
          Copy a file to a target file.
static void copy(java.io.InputStream is, java.io.File target)
          Copy a file to a target file.
static javax.swing.JButton createCloseButton(java.lang.String text)
          Create a close button for a JOptionPane.
static java.text.DecimalFormat createDecimalFormat(java.lang.String format)
           
static java.text.DecimalFormat createDecimalFormat(java.lang.String format, java.util.Locale locale)
           
static javax.swing.JSpinner createSpinnerDate(java.lang.String dateFormat, java.util.Locale language)
          Factory for creating Date Spinner (unlimited).
static byte[] getBytes(java.lang.String text, java.nio.charset.Charset charset)
          Converts String to bytes on Java 5.0.
static
<T> java.lang.Class<T>
getClass(java.lang.String className, java.io.File jar)
          Call the class from another JAR
static int getCurrentYear()
          Returns a current year
static java.lang.String getFileContent(java.io.File file, java.nio.charset.Charset enc, int maxLength)
          Creates a new instance of Str
static java.lang.StringBuffer getStackTraceBuf(java.lang.Throwable anException)
          Get StackTrace from an Exception.
static void initLookAndFeel(boolean nimbus)
          Set a default look and feel
static boolean isLinuxOS()
          Returns true, if environment is a Linux OS.
static boolean isNimbusLAF()
          Is was set a Nimbus L&F ?
static boolean isValid(java.lang.CharSequence text)
          Returns true, if text is not null and not empty.
static boolean isWindowsOS()
          Returns true, if environment is a Windows OS.
static java.io.File makeXslTransformation(javax.xml.transform.stream.StreamSource source, javax.xml.transform.stream.StreamSource xsl, java.util.ArrayList<java.lang.String[]> params)
          Make a XSL transformation.
static java.awt.Color modify(java.awt.Color color, int light)
          Modify a color
static java.lang.String newString(byte[] bytes, java.nio.charset.Charset charset)
          Converts bytes to String on Java 5.0.
static void registerAction(javax.swing.KeyStroke key, java.lang.String action, javax.swing.JComponent component, javax.swing.Action listener)
          Register Escape Action.
static void registerEscapeAction(javax.swing.JComponent component, javax.swing.Action listener)
          Register Escape Action.
static void rename(java.io.File source, java.io.File target)
          Rename a source to target.
static void resetTime(java.util.Calendar calednar)
          Reset Time to 12:00:00.000 .
static void setAlign(javax.swing.JSpinner spinner, int aligment)
          Align a JSpinner.
static void setClipboard(java.lang.String str)
          This method writes a string to the system clipboard, otherwise it returns null.
static void setCursorWait(boolean aWait, ApplContext context)
          Change cursor.
static void sleep(int milis)
          Sleep
static java.lang.String stringCat(java.lang.String separator, java.lang.String... lines)
          StringConcatenation
static void valueMouseWheelMoved(java.awt.event.MouseWheelEvent evt)
          Value Weel Moved for JSpinner.
static void windowsSizing(java.awt.Window window, java.awt.Rectangle rect)
          Window Sizing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplTools

public ApplTools()
Method Detail

getStackTraceBuf

public static java.lang.StringBuffer getStackTraceBuf(java.lang.Throwable anException)
Get StackTrace from an Exception.


createDecimalFormat

public static java.text.DecimalFormat createDecimalFormat(java.lang.String format)

createDecimalFormat

public static java.text.DecimalFormat createDecimalFormat(java.lang.String format,
                                                          java.util.Locale locale)

copy

public static void copy(java.io.File source,
                        java.io.File target)
                 throws java.io.IOException
Copy a file to a target file.

Throws:
java.io.IOException

copy

public static void copy(java.io.InputStream is,
                        java.io.File target)
                 throws java.io.IOException
Copy a file to a target file.

Throws:
java.io.IOException

resetTime

public static void resetTime(java.util.Calendar calednar)
Reset Time to 12:00:00.000 .


setClipboard

public static void setClipboard(java.lang.String str)
This method writes a string to the system clipboard, otherwise it returns null.


getCurrentYear

public static int getCurrentYear()
Returns a current year


aboutApplication

public static void aboutApplication(java.lang.Object frame,
                                    java.lang.String title,
                                    java.lang.String version,
                                    java.lang.String licence,
                                    java.lang.String homePage,
                                    java.lang.String date,
                                    java.lang.String ide,
                                    java.lang.String iconLicence,
                                    java.lang.String libraryLicence,
                                    javax.swing.Icon logo,
                                    javax.swing.JButton okButton,
                                    LanguageManager lm)
Display an About program message.

Parameters:
frame - The one of types: JFrame, JDialog, Component, String, Object (ClassName)
version -
licence -
homePage -
date -
ide -
iconLicence -
logo - Logo of the program. Parameter is NOT mandatory.

stringCat

public static java.lang.String stringCat(java.lang.String separator,
                                         java.lang.String... lines)
StringConcatenation

Parameters:
lines - The Array of Strings for concatenation. Any items can be null.
separator - String for separating Fields of the Array. Separator can be null.

isValid

public static final boolean isValid(java.lang.CharSequence text)
Returns true, if text is not null and not empty.


isWindowsOS

public static boolean isWindowsOS()
Returns true, if environment is a Windows OS.


isLinuxOS

public static boolean isLinuxOS()
Returns true, if environment is a Linux OS.


createSpinnerDate

public static javax.swing.JSpinner createSpinnerDate(java.lang.String dateFormat,
                                                     java.util.Locale language)
Factory for creating Date Spinner (unlimited).

Parameters:
dateFormat -
language -

valueMouseWheelMoved

public static void valueMouseWheelMoved(java.awt.event.MouseWheelEvent evt)
Value Weel Moved for JSpinner.

Parameters:
evt -

setAlign

public static void setAlign(javax.swing.JSpinner spinner,
                            int aligment)
Align a JSpinner.

See Also:
SwingConstants.LEFT

rename

public static void rename(java.io.File source,
                          java.io.File target)
                   throws java.io.IOException
Rename a source to target.

Throws:
java.io.IOException

makeXslTransformation

public static java.io.File makeXslTransformation(javax.xml.transform.stream.StreamSource source,
                                                 javax.xml.transform.stream.StreamSource xsl,
                                                 java.util.ArrayList<java.lang.String[]> params)
                                          throws javax.xml.transform.TransformerConfigurationException,
                                                 javax.xml.transform.TransformerException,
                                                 java.io.IOException
Make a XSL transformation.

Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

getFileContent

public static java.lang.String getFileContent(java.io.File file,
                                              java.nio.charset.Charset enc,
                                              int maxLength)
                                       throws java.io.IOException
Creates a new instance of Str

Throws:
java.io.IOException

registerEscapeAction

public static void registerEscapeAction(javax.swing.JComponent component,
                                        javax.swing.Action listener)
Register Escape Action.


registerAction

public static void registerAction(javax.swing.KeyStroke key,
                                  java.lang.String action,
                                  javax.swing.JComponent component,
                                  javax.swing.Action listener)
Register Escape Action.


windowsSizing

public static void windowsSizing(java.awt.Window window,
                                 java.awt.Rectangle rect)
Window Sizing


browse

public static void browse(java.net.URI uri,
                          java.lang.String sysBrowser)
                   throws java.io.IOException,
                          java.lang.UnsupportedOperationException
Open uri by system browser

Parameters:
uri -
sysBrowser - sysBrowser is mandatory for Java 1.5 only.
Throws:
java.io.IOException
java.lang.UnsupportedOperationException

setCursorWait

public static void setCursorWait(boolean aWait,
                                 ApplContext context)
Change cursor.


sleep

public static void sleep(int milis)
Sleep


createCloseButton

public static javax.swing.JButton createCloseButton(java.lang.String text)
Create a close button for a JOptionPane.


newString

public static java.lang.String newString(byte[] bytes,
                                         java.nio.charset.Charset charset)
Converts bytes to String on Java 5.0.


getBytes

public static byte[] getBytes(java.lang.String text,
                              java.nio.charset.Charset charset)
Converts String to bytes on Java 5.0.


initLookAndFeel

public static void initLookAndFeel(boolean nimbus)
                            throws javax.swing.UnsupportedLookAndFeelException
Set a default look and feel

Throws:
javax.swing.UnsupportedLookAndFeelException

isNimbusLAF

public static boolean isNimbusLAF()
Is was set a Nimbus L&F ?


modify

public static java.awt.Color modify(java.awt.Color color,
                                    int light)
Modify a color


getClass

public static final <T> java.lang.Class<T> getClass(java.lang.String className,
                                                    java.io.File jar)
                                         throws java.net.MalformedURLException,
                                                java.lang.ClassNotFoundException
Call the class from another JAR

Throws:
java.net.MalformedURLException
java.lang.ClassNotFoundException


Copyright © 2007-2009 PPonec