org.hardtokenmgmt.admin.ui
Class AdminUIUtils

java.lang.Object
  extended by org.hardtokenmgmt.admin.ui.AdminUIUtils

public class AdminUIUtils
extends java.lang.Object

GUI related utility methods.

Version:
$Id$
Author:
Philip Vendil 23 feb 2009

Field Summary
static byte[] PEM_BEGIN_CERTIFICATE_TAG
           
static byte[] PEM_END_CERTIFICATE_TAG
           
 
Constructor Summary
AdminUIUtils()
           
 
Method Summary
static void displayCertificateUsingDesktop(java.security.cert.X509Certificate certificate)
          Displays the certificate using the OS desktop, it's up to the operating system if this is supported.
static void displayCRLUsingDesktop(java.security.cert.X509CRL cRL)
          Displays the CRL using the OS desktop, it's up to the operating system if this is supported.
static java.awt.Image getAdminWindowIcon()
          returns the icon of the image used in the top left corner of a window
static java.lang.String getCAStatusTranslated(java.lang.String caStatus)
          Returns a localized version of a CA status.
static java.lang.String[] getDepartments()
           
static java.lang.String getReadableDataSizes(long dataSize)
          Takes a dataSize in bytes and converts it into a more readable format
static java.lang.String getStatusMessageTranslated(java.lang.String statusMessage)
          Method that translates a status message if it is possible othervise is the original string returned
static java.lang.String getStatusTranslated(java.lang.String status)
          Returns a localized version of a status.
static boolean isDesktopSupported()
           
static java.lang.String isFileReadable(java.lang.String filename)
          Method checking that a given file path exists, is a file and is readable, otherwise is an error message returned.
static void showErrorMsg(java.lang.String text, java.awt.Component owner)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PEM_BEGIN_CERTIFICATE_TAG

public static final byte[] PEM_BEGIN_CERTIFICATE_TAG

PEM_END_CERTIFICATE_TAG

public static final byte[] PEM_END_CERTIFICATE_TAG
Constructor Detail

AdminUIUtils

public AdminUIUtils()
Method Detail

getStatusTranslated

public static java.lang.String getStatusTranslated(java.lang.String status)
Returns a localized version of a status.

Parameters:
status - one of Constants.STATUS_ constants
Returns:
localized string representation of the status.

getCAStatusTranslated

public static java.lang.String getCAStatusTranslated(java.lang.String caStatus)
Returns a localized version of a CA status.

Parameters:
caStatus - one of Constants.CASTATUS_ constants
Returns:
localized string representation of the status.

getReadableDataSizes

public static java.lang.String getReadableDataSizes(long dataSize)
Takes a dataSize in bytes and converts it into a more readable format

Parameters:
dataSize - in bytes
Returns:
a readable represtation in GB, MB, KB or B

getStatusMessageTranslated

public static java.lang.String getStatusMessageTranslated(java.lang.String statusMessage)
Method that translates a status message if it is possible othervise is the original string returned

Parameters:
statusMessage - message that should be translated
Returns:
translated or original message

isDesktopSupported

public static boolean isDesktopSupported()
Returns:
true if the current OS supports desktop access.

displayCertificateUsingDesktop

public static void displayCertificateUsingDesktop(java.security.cert.X509Certificate certificate)
Displays the certificate using the OS desktop, it's up to the operating system if this is supported. In Windows is the CAPI called for displaying the certificate info.

Parameters:
certificate - the certificate to display.

displayCRLUsingDesktop

public static void displayCRLUsingDesktop(java.security.cert.X509CRL cRL)
Displays the CRL using the OS desktop, it's up to the operating system if this is supported. In Windows is the CAPI called for displaying the CRL info.

Parameters:
cRL - the CRL to display.

getAdminWindowIcon

public static java.awt.Image getAdminWindowIcon()
returns the icon of the image used in the top left corner of a window


getDepartments

public static java.lang.String[] getDepartments()
Returns:
available departments or null of no departments is configured.

isFileReadable

public static java.lang.String isFileReadable(java.lang.String filename)
Method checking that a given file path exists, is a file and is readable, otherwise is an error message returned.

Returns:
a translated error message or null if the file was OK.

showErrorMsg

public static void showErrorMsg(java.lang.String text,
                                java.awt.Component owner)