Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Util
Class GEVAHelper

    java.lang.Object
      Util.GEVAHelper

    public class GEVAHelper

extends java.lang.Object

Some helpful methods for repeated tasks across several classes

Author:
  eliottbartley

Field Summary
`static java.awt.Component` | `mainWindow` When showing error messages in classes that don't have direct access to a parent window, this allows them to set the parent to be the application window.

Method Summary
`static void` | `gridAdd(java.awt.Container container, java.awt.Container control, int gridX, int gridY, double weightX)` gridAdd(Container, Container, int, int, int, int, double, double) overload.
`static void` | `gridAdd(java.awt.Container container, java.awt.Container control, int gridX, int gridY, int gridW, int gridH, double weightX, double weightY)` Helper for adding a control to a GridBagLayout control
`static double` | `parseDouble(java.lang.String value)` Parse a string containing a double with locale specific formatting e.g. 1.000,00 is formatted to 1000.00 and then parsed to double
`static float` | `parseFloat(java.lang.String value)` Parse a string containing a float with locale specific formatting e.g. 1.000,00 is formatted to 1000.00 and then parsed to float
`static int` | `parseInt(java.lang.String value)` Parse a string containing an integer with locale specific formatting.
`static java.lang.String[]` | `prune(java.lang.String[] a)` Trim an array of strings so that all white-space padding is removed and any strings that contained just white-space and removed completely from the array. e.g. {" a ", " ", "b"} -> {"a", "b"}
`static java.lang.String` | `quote(java.lang.String string)` Given a string, wrap it in quotes (") if that string contains spaces
`static java.lang.String[]` | `trim(java.lang.String[] a)` Trim an array of strings so that all padding white-space is removed, e.g. {" a ", " ", "b"} -> {"a", "", "b"}

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### mainWindow

    public static java.awt.Component mainWindow

  When showing error messages in classes that don't have direct access to a parent window, this allows them to set the parent to be the application window. A bit of a hack, I know, but I'm a bit of a hacker!

Method Detail

### quote

    public static java.lang.String quote(java.lang.String string)

  Given a string, wrap it in quotes (") if that string contains spaces

  Parameters:
    `string` - The string to wrap
  Returns:
    The string wrapped in quotes if there are spaces in the string, else the string is returned unchanged

### parseInt

    public static int parseInt(java.lang.String value)

  Parse a string containing an integer with locale specific formatting. e.g. 1.000,00 is formatted to 1000.00 and then parsed to int

### parseFloat

    public static float parseFloat(java.lang.String value)

  Parse a string containing a float with locale specific formatting e.g. 1.000,00 is formatted to 1000.00 and then parsed to float

### parseDouble

    public static double parseDouble(java.lang.String value)

  Parse a string containing a double with locale specific formatting e.g. 1.000,00 is formatted to 1000.00 and then parsed to double

### prune

    public static java.lang.String[] prune(java.lang.String[] a)

  Trim an array of strings so that all white-space padding is removed and any strings that contained just white-space and removed completely from the array. e.g. {" a ", " ", "b"} -> {"a", "b"}

  Parameters:
    `a` - An array of strings to prune
  Returns:
    The array of strings with no white-space padding and no elements empty containing empty strings

### trim

    public static java.lang.String[] trim(java.lang.String[] a)

  Trim an array of strings so that all padding white-space is removed, e.g. {" a ", " ", "b"} -> {"a", "", "b"}

  Parameters:
    `a` - An array of strings to trim
  Returns:
    The array of strings with no white-space padding

### gridAdd

    public static void gridAdd(java.awt.Container container,
                               java.awt.Container control,
                               int gridX,
                               int gridY,
                               double weightX)

  gridAdd(Container, Container, int, int, int, int, double, double) overload. When calling on gridAdd(..), gridW and gridH are set to 1, and weightY is set to 0

  Parameters:
    `container` - The control to add control to
    `control` - The control being added to container
    `gridX` - The grid column to add the control
    `gridY` - The grid row to add the control
    `weightX` - The amount of horizontal space this column should take relative to other columns

### gridAdd

    public static void gridAdd(java.awt.Container container,
                               java.awt.Container control,
                               int gridX,
                               int gridY,
                               int gridW,
                               int gridH,
                               double weightX,
                               double weightY)

  Helper for adding a control to a GridBagLayout control

  Parameters:
    `container` - The control to add control to
    `control` - The control being added to container
    `gridX` - The grid column to add the control
    `gridY` - The grid row to add the control
    `gridW` - The number of columns to span
    `gridH` - The number of rows to span
    `weightX` - The amount of horizontal space this column should take relative to other columns
    `weightY` - The amount of vertical space this column should take relative to other rows

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD