Class ImmoToolUtils


  • public class ImmoToolUtils
    extends Object
    Hilfsfunktionen.
    Author:
    Andreas Rudolph
    • Field Detail

      • BG_COLOR_1

        public static final Color BG_COLOR_1
      • BG_COLOR_2

        public static final Color BG_COLOR_2
      • TABLE_HIGHLIGHT_COLOR

        public static final Color TABLE_HIGHLIGHT_COLOR
      • UNKNOWN_MIME_TYPE

        public static final eu.medsea.mimeutil.MimeType UNKNOWN_MIME_TYPE
    • Method Detail

      • buildButtonBar

        public static JPanel buildButtonBar​(Action... actions)
      • buildButtonBar

        public static JPanel buildButtonBar​(JComponent... components)
      • buildButtonBarFixed

        public static JPanel buildButtonBarFixed​(Action... actions)
      • buildButtonBarFixed

        public static JPanel buildButtonBarFixed​(JButton... buttons)
      • buildTitleBar

        public static JPanel buildTitleBar​(org.jdesktop.swingx.JXTitledSeparator title,
                                           Action... actions)
      • buildTitleBar

        public static JPanel buildTitleBar​(org.jdesktop.swingx.JXTitledSeparator title,
                                           JComponent... buttons)
      • canRead

        public static boolean canRead​(File file)
      • canWrite

        public static boolean canWrite​(File file)
      • configureDialog

        public static void configureDialog​(JDialog dlg)
      • configureDialog

        public static void configureDialog​(JDialog dlg,
                                           org.jdesktop.swingx.JXPanel bgPanel)
      • configureFrame

        public static void configureFrame​(JFrame frame,
                                          String title,
                                          org.jdesktop.swingx.JXPanel bgPanel)
      • configureTable

        public static void configureTable​(org.jdesktop.swingx.JXTable table)
      • configureWarningComponent

        public static void configureWarningComponent​(JComponent component)
      • createBalloonTipStyle

        public static net.java.balloontip.styles.BalloonTipStyle createBalloonTipStyle()
      • createHead1Separator

        public static org.jdesktop.swingx.JXTitledSeparator createHead1Separator​(String title)
      • createHead2Separator

        public static org.jdesktop.swingx.JXTitledSeparator createHead2Separator​(String title)
      • createMenuSeparator

        public static org.jdesktop.swingx.JXTitledSeparator createMenuSeparator​(String title)
      • createMenuSeparator

        public static org.jdesktop.swingx.JXTitledSeparator createMenuSeparator​(String title,
                                                                                int marginTop)
      • createValidationHandler

        public static ValidationHandler createValidationHandler()
      • executeTask

        public static void executeTask​(ImmoToolTask task)
      • getActiveWindow

        public static Window getActiveWindow()
      • getBackgroundStripesPainter

        public static org.jdesktop.swingx.painter.Painter getBackgroundStripesPainter()
      • getBackgroundGradientLeftPainter

        public static org.jdesktop.swingx.painter.Painter getBackgroundGradientLeftPainter​(Color bg)
      • getBackgroundGradientTopPainter

        public static org.jdesktop.swingx.painter.Painter getBackgroundGradientTopPainter()
      • getCountryCodes

        public static List<String> getCountryCodes()
        Liefert die ID's der verfügbaren Länder
        Returns:
        ISO-Codes
      • getCountryCodeForLanguage

        public static String getCountryCodeForLanguage​(String languageCode)
      • getCountryCodeFromText

        public static String getCountryCodeFromText​(String country)
      • getCountryFlagIcon

        public static ImageIcon getCountryFlagIcon​(Locale locale)
      • getCountryFlagIcon

        public static ImageIcon getCountryFlagIcon​(String countryCode)
      • getCountryFlagImage

        public static BufferedImage getCountryFlagImage​(String countryCode)
      • getCountryCoordinates

        public static double[] getCountryCoordinates​(String countryCode)
      • getCountryName

        public static String getCountryName​(String countryCode)
      • getCurrencyCodes

        public static List<String> getCurrencyCodes()
      • getCurrencySymbol

        public static String getCurrencySymbol​(String code)
      • getDialogBackgroundPainter

        public static org.jdesktop.swingx.painter.AbstractPainter getDialogBackgroundPainter()
      • getDefaultCsvFormat

        public static org.apache.commons.csv.CSVFormat getDefaultCsvFormat()
      • getDefaultCsvFormat

        public static org.apache.commons.csv.CSVFormat getDefaultCsvFormat​(String[] headline)
      • getDefaultCurrency

        public static Currency getDefaultCurrency()
      • getFileIcon

        public static ImageIcon getFileIcon​(String fileName,
                                            int size)
      • getFileIcon

        public static ImageIcon getFileIcon​(javax.mail.internet.ContentType contentType,
                                            int size)
      • getFileIcon

        public static ImageIcon getFileIcon​(javax.mail.internet.ContentType contentType,
                                            String fileName,
                                            int size)
      • getFirstLine

        public static String getFirstLine​(String value)
      • getHexColor

        public static Color getHexColor​(String s)
        Erzeugt ein Color-Objekt aus einem RGB-Hex-String.
        Parameters:
        s - RGB-Hex-String
        Returns:
        Color-Objekt
      • getHtmlBody

        public static String getHtmlBody​(String html)
      • getHumanReadableByteCount

        public static String getHumanReadableByteCount​(long size)
      • getHumanReadableByteCount

        public static String getHumanReadableByteCount​(long size,
                                                       NumberFormat numberFormat)
      • getI18n

        public static org.xnap.commons.i18n.I18n getI18n​(Class clazz)
      • getI18n

        public static org.xnap.commons.i18n.I18n getI18n​(Class clazz,
                                                         Locale locale)
      • getI18nString

        public static String getI18nString​(org.xnap.commons.i18n.I18n i18n,
                                           String key)
      • getMimeType

        public static eu.medsea.mimeutil.MimeType getMimeType​(File file)
      • getMimeType

        public static eu.medsea.mimeutil.MimeType getMimeType​(InputStream in)
      • getPreferredSize

        public static Dimension getPreferredSize​(String html,
                                                 boolean width,
                                                 int prefSize)
      • getRandomAlphaString

        public static String getRandomAlphaString​(int length)
      • getRandomAlphaNumericString

        public static String getRandomAlphaNumericString​(int length)
      • getRandomNumericString

        public static String getRandomNumericString​(int length)
      • getResourceIcon

        public static ImageIcon getResourceIcon​(String resourcePath,
                                                int size,
                                                String name)
      • getResourceImageURL

        public static URL getResourceImageURL​(String resourcePath,
                                              int size,
                                              String name)
      • getResourceImageURL

        public static URL getResourceImageURL​(String resourcePath,
                                              int size,
                                              String name,
                                              ClassLoader loader)
      • getResourcePath

        public static String getResourcePath​(Class containerClass)
      • getResourcePath

        public static String getResourcePath​(Class containerClass,
                                             Locale locale)
      • getUrlDecodedPath

        public static String getUrlDecodedPath​(String path)
      • getUrlDecodedPath

        public static String getUrlDecodedPath​(String path,
                                               String separator)
      • getUrlEncodedPath

        public static String getUrlEncodedPath​(String path)
      • getUrlEncodedPath

        public static String getUrlEncodedPath​(String path,
                                               String separator)
      • hashCode

        public static int hashCode​(Object obj)
      • isValidHostname

        public static boolean isValidHostname​(String hostname)
        Check, if a hostname is valid.
        Parameters:
        hostname - The hostname to check.
        Returns:
        Returns true, if the hostname is valid.
      • isValidMailAddress

        public static boolean isValidMailAddress​(String mail)
        Parameters:
        mail - The mail address to check.
        Returns:
        Returns true, if the mail address is valid.
      • openPDF

        public static void openPDF​(String pdfPath)
        PDF-Datei in externer Anwendung öffnen.
        Parameters:
        pdfPath - zu öffnende PDF
      • openPDF

        public static void openPDF​(File pdf)
        PDF-Datei in externer Anwendung öffnen.
        Parameters:
        pdf - zu öffnende PDF
      • openURL

        public static void openURL​(String url)
        URL im Web-Browser öffnen.
        Parameters:
        url - zu öffnende URL
      • openURL

        public static void openURL​(URL url)
        URL im Web-Browser öffnen.
        Parameters:
        url - zu öffnende URL
      • openURL

        public static void openURL​(URI url)
        URL im Web-Browser öffnen.
        Parameters:
        url - zu öffnende URL
      • showInputDialog

        public static String showInputDialog​(String msg)
        Darstellung eines Dialog-Fensters mit einem Eingabefeld.
        Parameters:
        msg - dargestellter Text
        Returns:
        eingegebener Text, oder null bei einem Abbruch
      • showInputDialog

        public static String showInputDialog​(String msg,
                                             Component c)
        Darstellung eines Dialog-Fensters mit einem Eingabefeld.
        Parameters:
        msg - dargestellter Text
        c - Komponente
        Returns:
        eingegebener Text, oder null bei einem Abbruch
      • showInputDialog

        public static String showInputDialog​(String msg,
                                             String defaultValue)
        Darstellung eines Dialog-Fensters mit einem Eingabefeld.
        Parameters:
        msg - dargestellter Text
        defaultValue - Standard-Wert im Eingabefeld
        Returns:
        eingegebener Text, oder null bei einem Abbruch
      • showMessageDialog

        public static void showMessageDialog​(String msg,
                                             String title,
                                             int type)
        Meldungsdialog anzeigen.
        Parameters:
        title - Mitteilungstitel
        msg - Mitteilungstext
        type - Mitteilungsart
      • showMessageDialog

        public static void showMessageDialog​(String msg,
                                             String title,
                                             int type,
                                             Component parent)
        Meldungsdialog anzeigen.
        Parameters:
        title - Mitteilungstitel
        msg - Mitteilungstext
        type - Mitteilungsart
        parent - Parent-Komponente
      • showMessageErrorDialog

        public static void showMessageErrorDialog​(String msg)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        msg - Mitteilungstext
      • showMessageErrorDialog

        public static void showMessageErrorDialog​(String msg,
                                                  Component parent)
      • showMessageErrorDialog

        public static void showMessageErrorDialog​(String msg,
                                                  Throwable t)
      • showMessageErrorDialog

        public static void showMessageErrorDialog​(String msg,
                                                  Throwable t,
                                                  Window w)
      • showMessageErrorDialog

        public static void showMessageErrorDialog​(String msg,
                                                  Collection<String> errors)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        msg - Mitteilungstext
        errors - Fehler-Liste
      • showMessageErrorDialog

        public static void showMessageErrorDialog​(String msg,
                                                  Collection<String> errors,
                                                  Component c)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        msg - Mitteilungstext
        errors - Fehler-Liste
        c - Komponente
      • showMessageErrorDialog

        public static void showMessageErrorDialog​(String msg,
                                                  Map<String,​Collection<String>> errors)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        msg - Mitteilungstext
        errors - Fehler-Liste
      • showMessageErrorDialog

        public static void showMessageErrorDialog​(String msg,
                                                  Map<String,​Collection<String>> errors,
                                                  Component c)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        msg - Mitteilungstext
        errors - Fehler-Liste
        c - Komponente
      • showMessageErrorDialog

        public static void showMessageErrorDialog​(String msg,
                                                  String title)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        title - Mitteilungstitel
        msg - Mitteilungstext
      • showMessageErrorDialog

        public static void showMessageErrorDialog​(String msg,
                                                  String title,
                                                  Component c)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        title - Mitteilungstitel
        msg - Mitteilungstext
        c - Komponente
      • showMessageInfoDialog

        public static void showMessageInfoDialog​(String msg)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        msg - Mitteilungstext
      • showMessageInfoDialog

        public static void showMessageInfoDialog​(String msg,
                                                 Component c)
      • showMessageInfoDialog

        public static void showMessageInfoDialog​(String msg,
                                                 String title)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        title - Mitteilungstitel
        msg - Mitteilungstext
      • showMessageInfoDialog

        public static void showMessageInfoDialog​(String msg,
                                                 String title,
                                                 Component c)
      • showMessageWarningDialog

        public static void showMessageWarningDialog​(String msg)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        msg - Mitteilungstext
      • showMessageWarningDialog

        public static void showMessageWarningDialog​(String msg,
                                                    Component c)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        msg - Mitteilungstext
        c - Komponente
      • showMessageWarningDialog

        public static void showMessageWarningDialog​(String msg,
                                                    String title)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        title - Mitteilungstitel
        msg - Mitteilungstext
      • showMessageWarningDialog

        public static void showMessageWarningDialog​(String msg,
                                                    String title,
                                                    Component c)
        Dialog mit Fehlermeldung anzeigen.
        Parameters:
        title - Mitteilungstitel
        msg - Mitteilungstext
        c - Komponente
      • showQuestionDialog

        public static boolean showQuestionDialog​(String msg)
        Darstellung eines Dialog-Fensters mit einer Frage.
        Parameters:
        msg - Text der Frage
        Returns:
        true, wenn die Frage mit ja beantwortet wurde
      • showQuestionDialog

        public static boolean showQuestionDialog​(String msg,
                                                 Component c)
      • showQuestionDialog

        public static boolean showQuestionDialog​(String msg,
                                                 String title,
                                                 Component c)
      • showQuestionWithCancelDialog

        public static Boolean showQuestionWithCancelDialog​(String msg)
        Darstellung eines Dialog-Fensters mit einer Frage.
        Parameters:
        msg - Text der Frage
        Returns:
        true, wenn die Frage mit ja beantwortet wurde
      • showQuestionWithCancelDialog

        public static Boolean showQuestionWithCancelDialog​(String msg,
                                                           Component c)
        Darstellung eines Dialog-Fensters mit einer Frage.
        Parameters:
        msg - Text der Frage
        c - aufrufende Komponente
        Returns:
        true, wenn die Frage mit ja beantwortet wurde
      • splitLines

        public static String[] splitLines​(String txt)
      • stripTags

        public static String stripTags​(String txt)
      • tidy

        public static org.w3c.tidy.Tidy tidy()
      • tidy

        public static String tidy​(org.w3c.tidy.Tidy tidy,
                                  String input)
      • toGray

        public static Image toGray​(Image image)
      • toIdnInternetAddress

        public static javax.mail.internet.InternetAddress toIdnInternetAddress​(javax.mail.internet.InternetAddress address)
      • toIdnMailAddress

        public static String toIdnMailAddress​(String address)
      • toIdnUrl

        public static URI toIdnUrl​(String url)
      • toIdnUrl

        public static URI toIdnUrl​(URI url)
      • toPattern

        public static String toPattern​(String value)
        Regulären Ausdruch aus einem String erzeugen. Jedes enthaltene * wird dabei durch ein .* im regulären Ausdruck ersetzt. Jedes enthaltene ? wird dabei durch ein . im regulären Ausdruck ersetzt. Alle anderen Zeichen werden escapet.
        Parameters:
        value - Der umzuwandelnde Text
        Returns:
        Text zur Verwendung als regulärer Ausdruck
      • trimLeft

        public static String trimLeft​(String value)
      • trimRight

        public static String trimRight​(String value)
      • wrapAndIndentString

        public static String wrapAndIndentString​(String original,
                                                 String indent,
                                                 int width)
        Indent and wrap multi-line strings.
        Parameters:
        original - the original string to wrap
        indent - indentation
        width - the maximum width of lines
        Returns:
        the whole string with embedded newlines
      • wrapStringToArray

        public static List<String> wrapStringToArray​(String original,
                                                     int width,
                                                     BreakIterator breakIterator,
                                                     boolean removeNewLines)
        Wrap multi-line strings (and get the individual lines).
        Parameters:
        original - the original string to wrap
        width - the maximum width of lines
        breakIterator - breaks original to chars, words, sentences, depending on what instance you provide.
        removeNewLines - if true, any newlines in the original string are ignored
        Returns:
        the lines after wrapping
      • writeHexColor

        public static String writeHexColor​(Color color)