public class InternalUtilities extends Object
Constructor and Description |
---|
InternalUtilities() |
Modifier and Type | Method and Description |
---|---|
static boolean |
areObjectsEqual(Object a,
Object b)
areObjectsEqual, This function exists as a workaround for the fact that Objects.equals() did
not exist in Java 1.6.
|
static boolean |
doesParsedDateMatchText(LocalDate parsedDate,
String text,
Locale formatLocale)
doesParsedDateMatchText, This compares the numbers in a parsed date, to the original text
from which the date was parsed.
|
static DateTimeFormatter |
generateDefaultFormatterBCE(Locale pickerLocale)
generateDefaultFormatterBCE, This returns a default formatter for the specified locale, that
can be used for displaying or parsing BC dates.
|
static DateTimeFormatter |
generateDefaultFormatterCE(Locale pickerLocale)
generateDefaultFormatterCE, This returns a default formatter for the specified locale, that
can be used for displaying or parsing AD dates.
|
static String |
getCompiledJavaMajorVersionFromJavaClassFileAsString(InputStream classByteStream)
getCompiledJavaMajorVersionFromJavaClassFileAsString, Given an input stream to a Java class
file, this will return the major version of Java that was used to compile the file (as a
string).
|
static int |
getCompiledJavaVersionFromJavaClassFile(InputStream classByteStream,
boolean majorVersionRequested)
getCompiledJavaVersionFromJavaClassFile, Given an input stream to a Java class file, this
will return the major or minor version of Java that was used to compile the file.
|
static GridBagConstraints |
getConstraints(int gridx,
int gridy)
getConstraints, This returns a grid bag constraints object that can be used for placing a
component appropriately into a grid bag layout.
|
static double |
getJavaRunningVersionAsDouble()
getJavaRunningVersionAsDouble, Returns a double with the currently running java version.
|
static String |
getJavaRunningVersionAsString()
getJavaRunningVersionAsString, Returns a string with the currently running java version.
|
static String |
getJavaTargetVersionFromPom()
getJavaTargetVersionFromPom, Returns a string with the java "target" version, as it was
specified in the pom file at compile time.
|
static <T> T |
getMostCommonElementInList(List<T> sourceList)
getMostCommonElementInList, This returns the most common element in the supplied list.
|
static LocalDate |
getParsedDateOrNull(String text,
DateTimeFormatter displayFormatterAD,
DateTimeFormatter displayFormatterBC,
ArrayList<DateTimeFormatter> parsingFormatters,
Locale formatLocale)
getParsedDateOrNull, This takes text from the date picker text field, and tries to parse it
into a java.time.LocalDate instance.
|
static LocalTime |
getParsedTimeOrNull(String timeText,
DateTimeFormatter formatForDisplayTime,
DateTimeFormatter formatForMenuTimes,
ArrayList<DateTimeFormatter> formatsForParsing,
Locale timePickerLocale) |
static String |
getProjectVersionString()
getProjectVersionString, Returns a string with the project version number.
|
static Insets |
getScreenInsets(Window windowOrNull)
getScreenInsets, This returns the insets of the screen, which are defined by any task bars
that have been set up by the user.
|
static Rectangle |
getScreenTotalArea(Window windowOrNull)
getScreenTotalArea, This returns the total area of the screen.
|
static Rectangle |
getScreenWorkingArea(Window windowOrNull)
getScreenWorkingArea, This returns the working area of the screen.
|
static boolean |
isDateVetoed(DateVetoPolicy policy,
LocalDate date)
isDateVetoed, This is a convenience function for checking whether or not a particular date is
vetoed.
|
static boolean |
isMouseWithinComponent(Component component)
isMouseWithinComponent, This returns true if the mouse is inside of the specified component,
otherwise returns false.
|
static boolean |
isTimeVetoed(TimeVetoPolicy policy,
LocalTime time) |
static String |
safeSubstring(String text,
int beginIndex,
int endIndexExclusive)
safeSubstring, This is a version of the substring function which is guaranteed to never throw
an exception.
|
static void |
setDefaultTableEditorsClicks(JTable table,
int clickCountToStart)
setDefaultTableEditorsClicks, This sets the number of clicks required to start the default
table editors in the supplied table.
|
public static boolean areObjectsEqual(Object a, Object b)
true
if the arguments are equal to each other and false
otherwise.
Consequently, if both arguments are null
, true
is returned and if exactly one
argument is null
, false
is returned. Otherwise, equality is determined by using the
equals
method of the first argument.a
- an objectb
- an object to be compared with a
for equalitytrue
if the arguments are equal to each other and false
otherwiseObject.equals(Object)
public static boolean doesParsedDateMatchText(LocalDate parsedDate, String text, Locale formatLocale)
public static double getJavaRunningVersionAsDouble()
public static String getJavaRunningVersionAsString()
public static String getJavaTargetVersionFromPom()
public static <T> T getMostCommonElementInList(List<T> sourceList)
public static String getProjectVersionString()
public static Insets getScreenInsets(Window windowOrNull)
public static Rectangle getScreenTotalArea(Window windowOrNull)
public static Rectangle getScreenWorkingArea(Window windowOrNull)
public static DateTimeFormatter generateDefaultFormatterCE(Locale pickerLocale)
public static DateTimeFormatter generateDefaultFormatterBCE(Locale pickerLocale)
public static LocalDate getParsedDateOrNull(String text, DateTimeFormatter displayFormatterAD, DateTimeFormatter displayFormatterBC, ArrayList<DateTimeFormatter> parsingFormatters, Locale formatLocale)
public static LocalTime getParsedTimeOrNull(String timeText, DateTimeFormatter formatForDisplayTime, DateTimeFormatter formatForMenuTimes, ArrayList<DateTimeFormatter> formatsForParsing, Locale timePickerLocale)
public static GridBagConstraints getConstraints(int gridx, int gridy)
public static boolean isDateVetoed(DateVetoPolicy policy, LocalDate date)
public static boolean isMouseWithinComponent(Component component)
public static boolean isTimeVetoed(TimeVetoPolicy policy, LocalTime time)
public static String safeSubstring(String text, int beginIndex, int endIndexExclusive)
public static int getCompiledJavaVersionFromJavaClassFile(InputStream classByteStream, boolean majorVersionRequested) throws Exception
Exception
public static String getCompiledJavaMajorVersionFromJavaClassFileAsString(InputStream classByteStream) throws Exception
Exception
public static void setDefaultTableEditorsClicks(JTable table, int clickCountToStart)
Copyright © 2018. All rights reserved.