|
VLab Common 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.psnc.vlab.util.gui.helper.FormHelper
public abstract class FormHelper
FormHelper - abstract class defines a set of utility helper methods when dealing with gui.
Constructor Summary | |
---|---|
FormHelper()
|
Method Summary | |
---|---|
static java.lang.String |
format(java.lang.Number value)
Parse the given value using default number formatter |
static java.lang.Boolean |
getBoolean(java.lang.Object value)
Return Boolean representation from the given object |
static java.lang.Double |
getDoubleValue(java.lang.Object value)
Return Double representation from the given object |
static javax.swing.text.MaskFormatter |
getMaskFormatter(java.lang.String mask,
java.lang.Character placeHolder)
Create a MaskFormatter for the given mask and place holder |
static javax.swing.event.TableModelEvent |
getModelEvent(java.lang.Object modelEvent)
Get TableModelEvent from the given argument |
static java.lang.String |
getValue(javax.swing.text.JTextComponent component)
Get value of the formatted text field. |
static boolean |
isNull(java.lang.Object value)
Checks whether the given value is null or empty string |
static void |
removeMaskFormatter(javax.swing.JFormattedTextField fTextField)
Removes mask formatter from the given formatted text field |
static void |
removeMaskFormatter(javax.swing.JSpinner spinner)
Removes mask formatter from the given spinner |
static void |
removeSelection(javax.swing.JTable table)
Removes rows and columns selection from the given table. |
static void |
setEnabled(javax.swing.JComponent component,
boolean enabled)
Enables/disables all child components of the given component |
static void |
setImage(javax.swing.JLabel component,
java.lang.String image,
java.lang.String tooltip)
Sets icon and tooltip for the give JLabel component. |
static void |
setMax(double max,
javax.swing.JSpinner... spinners)
Set max value for the given spinners |
static void |
setNormalizedDocument(javax.swing.text.JTextComponent component,
int maxLenght)
Set NormalizedDocument on the given text component |
static void |
setSelectedRow(java.lang.Integer row,
javax.swing.JTable table)
Selects the given row index at the given table. |
static void |
setText(javax.swing.JComponent component,
java.lang.String text,
java.lang.String tooltip)
Set the given text on each container components. |
static void |
setValue(double value,
javax.swing.JSpinner... spinners)
Set current value for the given spinners |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FormHelper()
Method Detail |
---|
public static javax.swing.event.TableModelEvent getModelEvent(java.lang.Object modelEvent)
TableModelEvent
from the given argument
modelEvent
- instance of table model event
TableModelEvent
or NULL
if given
value is not instance of TableModelEvent
public static boolean isNull(java.lang.Object value)
value
- object value
true
if value is null or empty, false
otherwisepublic static java.lang.Boolean getBoolean(java.lang.Object value)
Boolean
representation from the given object
value
- object value
Boolean.TRUE
if string value is not null and equals
to true, Boolean.FALSE
otherwisepublic static java.lang.Double getDoubleValue(java.lang.Object value)
Double
representation from the given object
value
- object value
Double
if string value is not null and can be parsed
as double, NULL
otherwisepublic static java.lang.String format(java.lang.Number value)
value
- number value to be parsed
public static void setEnabled(javax.swing.JComponent component, boolean enabled)
component
- parent componentpublic static void setText(javax.swing.JComponent component, java.lang.String text, java.lang.String tooltip)
component
- parent componenttext
- text to be settooltip
- tooltip to setpublic static void setImage(javax.swing.JLabel component, java.lang.String image, java.lang.String tooltip)
component
- parent componenttext
- text to be settooltip
- tooltip to setpublic static java.lang.String getValue(javax.swing.text.JTextComponent component)
component
- formatted text componentpublic static javax.swing.text.MaskFormatter getMaskFormatter(java.lang.String mask, java.lang.Character placeHolder)
MaskFormatter
for the given mask and place holder
mask
- mask. Please refer to MaskFormatter
for the available
choicesplaceHolder
- place holder character
MaskFormatter
or null if Mask Formatter
creation failedpublic static void removeMaskFormatter(javax.swing.JFormattedTextField fTextField)
fTextField
- instance of JFormattedTextField
public static void removeMaskFormatter(javax.swing.JSpinner spinner)
spinner
- instance of JSpinner
public static void setNormalizedDocument(javax.swing.text.JTextComponent component, int maxLenght)
NormalizedDocument
on the given text component
component
- text componentpublic static void setSelectedRow(java.lang.Integer row, javax.swing.JTable table)
row
- row indextable
- instance of JTable
public static void removeSelection(javax.swing.JTable table)
table
- instance of JTable
public static void setMax(double max, javax.swing.JSpinner... spinners)
max
- max valuespinners
- spinner listpublic static void setValue(double value, javax.swing.JSpinner... spinners)
value
- max valuespinners
- spinner list
|
VLab Common 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |