|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gswing.components.common.Misc
public class Misc
Purpose: Miscellaneous utility class for the common package.
Field Summary | |
---|---|
static Color |
APPLET_BACKGROUND
The applet background colour. |
static JLabel |
CONST_LABEL
constituency label |
static String |
CONSTITUENCY
Constituency election string. |
static String |
COUNCIL
Council election string. |
static JLabel |
COUNCIL_LABEL
council label |
static String |
DEV_BY_ELEC
Devolved by-election string. |
static String |
DEVOLVED
Devolved election string. |
static int |
ERROR
Message severity Error. |
static int |
FPTP
First past the post electoral system string. |
static String |
FPTP_STR
First past the post electoral system string. |
static String |
GEN_BY_ELEC
General by-election string. |
static String |
GENERAL
General election string. |
static String |
GSWING_VERSION
Current gswing version. |
static int |
INFO
Message severity Information |
static int |
INVALID
Invalid const. |
static int |
LIST
List electoral system string. |
static String |
LIST_STR
List electoral system string. |
static String |
LOCAL
Local election string. |
static String |
LOCAL_FILE_NAME_ENDING
Local results file name ending. |
static JLabel |
LOCAL_LABEL
local label |
static String |
NATIONAL
National election string. |
static String |
NEW_LINE
platform independant new line string. |
static int |
NEXT
Next const. |
static String |
NONE_DEFINED
none defined const. |
static Font |
NORMAL_FONT
Normal canvas font. |
static int |
PREVIOUS
Previous const. |
static JLabel |
REGION_LABEL
region label |
static String |
REGIONAL
Regional election string. |
static String |
REGIONAL_FILE_NAME
Regional results file name. |
static String |
SERIALISED_FILE_EXT
Serialised files file extension |
static Font |
SMALL_FONT
Small canvas font. |
static Color |
TABLE_ROW_SELECT
The colour of a selected table row. |
static Font |
TITLE_FONT
The canvas title font. |
static int |
UNCONTESTED
The number of votes assigned to an uncontested seat. |
static int |
WARN
Message severity Warning. |
Constructor Summary | |
---|---|
Misc()
|
Method Summary | |
---|---|
static Date |
getDateFromDbString(String text)
Convert database date string to a Java Date. |
static Date |
getDateFromString(String text)
Convert simple date string to a Java Date. |
static String |
getDbProtocol()
Convert system properties into the JDBC protocol. |
static Color |
getElectionColour(String election)
Get the colour of a for an election type. |
static String |
getFormattedDate(Date date)
Convert a Java Date into a simple string. |
static String |
getFormattedDate(Date date,
String pattern)
Convert a Java Date into a simple string with the given pattern. |
static int |
getIntFromStdInput()
Get an integer from standard input. |
static String |
getShortYear(Date date)
Remove the first two character of the year. |
static String |
getStringFromStdInput()
Get a String from standard input. |
static String |
getWholeYear(Date date)
Get the four digits year from a Date object. |
static void |
initialise(IMessageHandling logger)
Set up message logging capability. |
static void |
logError(String message)
Log error message. |
static void |
logMessage(int level,
String message)
Log a messge with severity. |
static void |
logMessage(String message)
Log information message. |
void |
logToFile(String message)
Log a message to file. |
static void |
logWarning(String message)
Log warning message. |
static void |
printTitle()
Print the title message to standard output. |
static void |
showError(Component comp,
String message)
Popup an error dialog box. |
static void |
showError(String message)
Popup an error dialog box. |
static void |
showMessage(Component comp,
String message)
Popup a message dialog box. |
static void |
showMessage(String message)
Popup a message dialog box. |
static void |
toStdErr(String message)
Print message to standard error stream. |
static void |
toStdOut(String message)
Print a message to the standard output. |
static void |
toStdOut(String message,
boolean printLine)
Print a message to the standard output. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String GSWING_VERSION
public static final Font TITLE_FONT
public static final Font NORMAL_FONT
public static final Font SMALL_FONT
public static final Color TABLE_ROW_SELECT
public static final Color APPLET_BACKGROUND
public static final String NATIONAL
public static final String REGIONAL
public static final String GENERAL
public static final String DEVOLVED
public static final String CONSTITUENCY
public static final String DEV_BY_ELEC
public static final String GEN_BY_ELEC
public static final String COUNCIL
public static final String LOCAL
public static final String NONE_DEFINED
public static final String FPTP_STR
public static final String LIST_STR
public static final int FPTP
public static final int LIST
public static final int UNCONTESTED
public static final int PREVIOUS
public static final int NEXT
public static final int INVALID
public static final int INFO
public static final int WARN
public static final int ERROR
public static final String REGIONAL_FILE_NAME
public static final String LOCAL_FILE_NAME_ENDING
public static final String NEW_LINE
public static final JLabel CONST_LABEL
public static final JLabel REGION_LABEL
public static final JLabel COUNCIL_LABEL
public static final JLabel LOCAL_LABEL
public static final String SERIALISED_FILE_EXT
Constructor Detail |
---|
public Misc()
Method Detail |
---|
public static void initialise(IMessageHandling logger)
logger
- Framework message handler.public static Date getDateFromDbString(String text)
text
- A date string.
public static Date getDateFromString(String text)
text
- A date string.
public static String getFormattedDate(Date date)
date
- The Java Date object.
public static String getFormattedDate(Date date, String pattern)
date
- The Java Date object.pattern
- The date pattern.
public static void showError(String message)
message
- The message to display.public static void showError(Component comp, String message)
comp
- The parent conmponent.message
- The message to display.public static void showMessage(String message)
message
- The message to display.public static void showMessage(Component comp, String message)
comp
- The parent conmponent.message
- The message to display.public void logToFile(String message)
message
- The message to log.public static String getDbProtocol()
public static String getShortYear(Date date)
date
- The date to perform on.
public static String getWholeYear(Date date)
date
- The date to perform on.
public static Color getElectionColour(String election)
election
- The election data.
public static void toStdOut(String message)
message
- The message to print.public static void toStdErr(String message)
message
- The message to print.public static void toStdOut(String message, boolean printLine)
message
- The message to print.printLine
- Should the message be printed as a line?public static void logMessage(int level, String message)
level
- The serverity level - INFO, WARN or ERROR.message
- The message to log.public static void logMessage(String message)
message
- The message to log.public static void logWarning(String message)
message
- The warning to log.public static void logError(String message)
message
- The error to log.public static void printTitle()
public static int getIntFromStdInput()
public static String getStringFromStdInput()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |