celeboss.ui
Class UIHelper

java.lang.Object
  extended byceleboss.ui.UIHelper

public final class UIHelper
extends java.lang.Object

Static utility class for Celebos windows.

Version:
1.0
Author:
bevans

Field Summary
static java.text.NumberFormat CURRENCY
          Default format for Currency.
static java.text.DateFormat DATETIME
          Default format for date time
static javax.swing.Icon DOWN_ICON
          Icon for decreasing values
static javax.swing.Icon HIGHEST_ICON
          Icon for highest value
static javax.swing.Icon HIGHEST_UP_ICON
          Icon for highest value
static javax.swing.Icon LOWEST_DOWN_ICON
          Icon for lowest values
static javax.swing.Icon LOWEST_ICON
          Icon for lowest values
static java.text.NumberFormat NUMBER
          Default format for all Number values
static java.text.NumberFormat PERCENTAGE
          Default format for all percetnage values
static javax.swing.Icon UP_ICON
          Icon for increasing values
 
Method Summary
static javax.swing.JLabel addGridLabel(javax.swing.JPanel panel, int column, java.lang.String label)
          Adds a label and a vlaue label to a panel using Gridbag at a specific column.
static javax.swing.JLabel addGridLabel(javax.swing.JPanel panel, java.lang.String label)
          Adds a label and a vlaue label to a panel using Gridbag
static javax.swing.Icon getChangableValueIcon(ChangableValue change)
          Generate an icon that best represents the status of a ChangeableValue.
static javax.swing.Icon getIcon(java.lang.String name)
          Find an icon by name from the class loader.
static void setChangeLabel(javax.swing.JLabel label, ChangableValue value)
          This is a helper method that updates a JLabel with a changable value according to the common formatting.
static void setChangeLabel(javax.swing.JLabel label, java.text.NumberFormat format, ChangableValue value)
          This is a helper method that updates a JLabel with a changable value according to the common formatting.
static void setDateLabel(javax.swing.JLabel label, java.util.Date time)
          This is a helper method that updates a JLabel with a Date value according to the common formatting.
static void setMoneyLabel(javax.swing.JLabel label, float cashValue)
          This is a helper method that updates a JLabel with a Money value according to the common formatting.
static void setMoneyLabel(javax.swing.JLabel label, java.lang.Float cashValue)
          This is a helper method that updates a JLabel with a Money value according to the common formatting.
static void setPercentageLabel(javax.swing.JLabel label, java.lang.Float perc)
          This is a helper method that updates a JLabel with a percentage value according to the common formatting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENCY

public static final java.text.NumberFormat CURRENCY
Default format for Currency. Fix this as UK for pounds


DATETIME

public static final java.text.DateFormat DATETIME
Default format for date time


DOWN_ICON

public static final javax.swing.Icon DOWN_ICON
Icon for decreasing values


HIGHEST_ICON

public static final javax.swing.Icon HIGHEST_ICON
Icon for highest value


HIGHEST_UP_ICON

public static final javax.swing.Icon HIGHEST_UP_ICON
Icon for highest value


LOWEST_DOWN_ICON

public static final javax.swing.Icon LOWEST_DOWN_ICON
Icon for lowest values


LOWEST_ICON

public static final javax.swing.Icon LOWEST_ICON
Icon for lowest values


NUMBER

public static final java.text.NumberFormat NUMBER
Default format for all Number values


PERCENTAGE

public static final java.text.NumberFormat PERCENTAGE
Default format for all percetnage values


UP_ICON

public static final javax.swing.Icon UP_ICON
Icon for increasing values

Method Detail

addGridLabel

public static javax.swing.JLabel addGridLabel(javax.swing.JPanel panel,
                                              int column,
                                              java.lang.String label)
Adds a label and a vlaue label to a panel using Gridbag at a specific column.

Parameters:
panel - Target panel
column - The column index
label - Text of label
Returns:
Return the JLabel for the value.

addGridLabel

public static javax.swing.JLabel addGridLabel(javax.swing.JPanel panel,
                                              java.lang.String label)
Adds a label and a vlaue label to a panel using Gridbag

Parameters:
panel - Target panel
label - Text of label
Returns:
Return the JLabel for the value.

getChangableValueIcon

public static javax.swing.Icon getChangableValueIcon(ChangableValue change)
Generate an icon that best represents the status of a ChangeableValue. The icon will show if the vlaue is increasing or descreasing.

Parameters:
change - Value to represent
Returns:
Icon

getIcon

public static javax.swing.Icon getIcon(java.lang.String name)
Find an icon by name from the class loader.

Parameters:
name - Name of icon.
Returns:
Icon instance or null.

setChangeLabel

public static void setChangeLabel(javax.swing.JLabel label,
                                  ChangableValue value)
This is a helper method that updates a JLabel with a changable value according to the common formatting. An ico will be added to reflect direction of the changing value. The tooltip will display how the value has changed.

Parameters:
label - JLabel to update.
value - Value.

setChangeLabel

public static void setChangeLabel(javax.swing.JLabel label,
                                  java.text.NumberFormat format,
                                  ChangableValue value)
This is a helper method that updates a JLabel with a changable value according to the common formatting. An ico will be added to reflect direction of the changing value. The tooltip will display how the value has changed.

Parameters:
label - JLabel to update.
format - Format to use.
value - Value.

setDateLabel

public static void setDateLabel(javax.swing.JLabel label,
                                java.util.Date time)
This is a helper method that updates a JLabel with a Date value according to the common formatting.

Parameters:
label - JLable to update.
time - Value.

setMoneyLabel

public static void setMoneyLabel(javax.swing.JLabel label,
                                 float cashValue)
This is a helper method that updates a JLabel with a Money value according to the common formatting.

Parameters:
label - JLable to update.
cashValue - Value.

setMoneyLabel

public static void setMoneyLabel(javax.swing.JLabel label,
                                 java.lang.Float cashValue)
This is a helper method that updates a JLabel with a Money value according to the common formatting.

Parameters:
label - JLable to update.
cashValue - Value.

setPercentageLabel

public static void setPercentageLabel(javax.swing.JLabel label,
                                      java.lang.Float perc)
This is a helper method that updates a JLabel with a percentage value according to the common formatting.

Parameters:
label - JLable to update.
perc - Value.