yu.ac.bg.etf.javaqx.qswing
Class QSwing

java.lang.Object
  extended byyu.ac.bg.etf.javaqx.qswing.QSwing
All Implemented Interfaces:
QSwingProperties

public final class QSwing
extends java.lang.Object
implements QSwingProperties

QSwing.

Version:
0.2.0
Author:
Slobodan Vrkacevic (slobodan.vrkacevic@gmail.com)

Field Summary
 
Fields inherited from interface yu.ac.bg.etf.javaqx.qswing.properties.QSwingProperties
PROPERTY_CUSTOM, PROPERTY_LOCALE, PROPERTY_STYLE, PROPERTY_STYLE_SHEET, PROPERTY_THEME, PROPERTY_TRANSLATION
 
Method Summary
static void about()
          Shows information about QSwing.
static void aboutQt()
          Shows information about Qt.
static void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Adds property chage listener for all properties.
static void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener pcl)
          Adds property chage listener for specified property.
static void changeOverrideCursor(Cursor cursor)
          Changes the application override cursor (cursor that indicates special state of the application).
static Image crateImage(byte[] imageData)
          Creates and returns image.
static Image crateImage(byte[] imageData, int length)
          Creates and returns image.
static Image crateImage(java.io.File file)
          Creates and returns image.
static Image crateImage(java.lang.String fileName)
          Creates and returns image.
static Image crateImage(java.net.URL location)
          Creates and returns image.
static void dispose()
          Disposes the QSwing.
static void disposedCheck()
          Throws DisposedError exception if QSwing is disposed.
static void flushEvents()
          Flushes the event queue.
static java.lang.String getCustomProperty(java.lang.String name)
          Returns custom property.
static int getEventLoopExitCode()
          Returns event loop exit code.
static java.lang.String[] getInstalledStyleNames()
          Returns the names of the installed styles.
static Style[] getInstalledStyles()
          Returns installed styles.
static java.lang.String[] getInstalledThemeNames()
          Returns the names of the installed theme.
static Theme[] getInstalledThemes()
          Returns installed themes.
static java.util.Locale getLocale()
          Returns locale.
static java.beans.PropertyChangeListener[] getPropertyChangeListeners()
          Returns property change listeners for all properties.
static java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
          Returns property chage listeners for specified property.
static Style getStyle()
          Returns current style.
static java.lang.String getStyleName()
          Returns the name of the current style.
static StyleSheet getStyleSheet()
          Returns style sheet.
static Theme getTheme()
          Returns current style.
static java.lang.String getThemeName()
          Returns the name of the current theme.
static java.lang.String getTranslation()
          Returns translation file name.
static void initialize()
          Initializes the library.
static void initialize(boolean useEventThread)
          Initializes the library.
static void initialize(java.lang.String[] args)
          Initializes the library.
static void initialize(java.lang.String[] args, boolean useEventThread)
          Initializes the library.
static void installStyle(java.lang.String styleClassName)
          Installs the specified style.
static void installStyle(Style style)
          Installs the specified style.
static void installTheme(java.lang.String themeClassName)
          Installs the specified theme.
static void installTheme(Theme theme)
          Installs the specified theme.
static boolean isDisposed()
          Returns true if QSwing is disposed.
static boolean isEventLoopRunning()
          Returns true if event loop is running.
static boolean isInitialized()
          Returns true if QSwing is initialized.
static boolean isQSwingThread()
          Returns true if the current thread is gui thread.
static boolean isQSwingThread(java.lang.Thread t)
          Returns true if the specified thread is gui thread.
static boolean isUsingSystemTheme()
          Returns true if QSwing is using the system style theme.
static void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Removes property chage listener for all properties.
static void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener pcl)
          Removes property chage listener for specified property.
static void removeStyleSheet()
          Removes the current style sheet.
static void removeTranslation()
          Removes current translation.
static void restoreOverrideCursor()
          Undoes the last setOverrideCursor() call.
static void setCustomProperty(java.lang.String name, java.lang.String value)
          Sets custom property.
static void setLocale(java.util.Locale locale)
          Sets locale.
static void setOverrideCursor(Cursor cursor)
          Sets the application override cursor (cursor that indicates special state of the application).
static void setStyle(java.lang.String styleName)
          Sets current style.
static void setStyle(Style style)
          Sets current style.
static boolean setStyleSafely(java.lang.String styleName)
          Helper method.
static boolean setStyleSafely(Style style)
          Helper method.
static void setStyleSheet(java.io.File styleSheetFile)
          Sets style sheet.
static void setStyleSheet(java.io.InputStream styleSheetStream)
          Sets style sheet.
static void setStyleSheet(java.lang.String styleSheetText)
          Sets style sheet.
static void setStyleSheet(StyleSheet styleSheet)
          Sets style sheet.
static boolean setStyleSheetSafely(java.io.InputStream styleSheetStream)
          Sets style sheet.
static boolean setStyleSheetSafely(java.lang.String styleSheetFile)
          Sets style sheet.
static void setTheme(java.lang.String themeName)
          Sets the theme of the current style.
static void setTheme(Theme theme)
          Sets the theme of the current style.
static boolean setThemeSafely(java.lang.String themeName)
          Helper method.
static boolean setThemeSafely(Theme theme)
          Helper method.
static boolean setTranslation(java.lang.String fileName)
          Sets library translation.
static void setUseSystemTheme(boolean useSystemTheme)
          Sets whether or not QSwing should use system style theme.
static void startEventLoop()
          Starts event loop.
static void startEventLoop(boolean quitOnLastWindowClosed)
          Starts event loop.
static void stopEventLoop()
          Stops event loop.
static void stopEventLoop(int returnCode)
          Stops event loop.
static java.lang.String translate(java.lang.String sourceText)
          Translates the specified text using translation file.
static java.lang.String translate(java.lang.String context, java.lang.String sourceText)
          Translates the specified text using translation file.
static void uninstallStyle(java.lang.String styleName)
          Uninstalls the specified style.
static void uninstallTheme(java.lang.String themeName)
          Uninstalls the specified theme.
static void waitForEventLoopExit()
          Waits for event loop exit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isInitialized

public static boolean isInitialized()
Returns true if QSwing is initialized.

Returns:
true if QSwing is initialized

initialize

public static void initialize(java.lang.String[] args,
                              boolean useEventThread)
Initializes the library. This method should be called first.

Parameters:
args - the application arguments
useEventThread - if true QSwing will use separate GUI thread

initialize

public static void initialize(java.lang.String[] args)
Initializes the library.

Parameters:
args - the application arguments

initialize

public static void initialize(boolean useEventThread)
Initializes the library.

Parameters:
useEventThread - if true QSwing will use separate GUI thread

initialize

public static void initialize()
Initializes the library.


isDisposed

public static boolean isDisposed()
Returns true if QSwing is disposed.

Returns:
true if QSwing is disposed

dispose

public static void dispose()
Disposes the QSwing.


disposedCheck

public static void disposedCheck()
Throws DisposedError exception if QSwing is disposed.


isEventLoopRunning

public static boolean isEventLoopRunning()
Returns true if event loop is running.

Returns:
true if event loop is running

waitForEventLoopExit

public static void waitForEventLoopExit()
                                 throws java.lang.InterruptedException
Waits for event loop exit.

Throws:
java.lang.InterruptedException - if interrupted

startEventLoop

public static void startEventLoop(boolean quitOnLastWindowClosed)
Starts event loop.

NOTE: This method must be called from initialization thread!

Parameters:
quitOnLastWindowClosed - if true exits loop when the last window is closed
Throws:
java.lang.IllegalThreadStateException - if the method is called outside initialization thread

startEventLoop

public static void startEventLoop()
Starts event loop.


getEventLoopExitCode

public static int getEventLoopExitCode()
Returns event loop exit code.

Returns:
event loop exit code

stopEventLoop

public static void stopEventLoop(int returnCode)
Stops event loop.

Parameters:
returnCode - the event loop return code

stopEventLoop

public static void stopEventLoop()
Stops event loop.


flushEvents

public static void flushEvents()
Flushes the event queue.


isQSwingThread

public static boolean isQSwingThread(java.lang.Thread t)
Returns true if the specified thread is gui thread.

Parameters:
t - the thread to be checked
Returns:
true if the specified thread is gui thread

isQSwingThread

public static boolean isQSwingThread()
Returns true if the current thread is gui thread.

Returns:
true if the current thread is gui thread

getLocale

public static java.util.Locale getLocale()
Returns locale.

Returns:
locale

setLocale

public static void setLocale(java.util.Locale locale)
Sets locale.

Parameters:
locale - the locale

getTranslation

public static java.lang.String getTranslation()
Returns translation file name.

Returns:
translation file name

setTranslation

public static boolean setTranslation(java.lang.String fileName)
Sets library translation.

Parameters:
fileName - translation file name
Returns:
true if succeed

removeTranslation

public static void removeTranslation()
Removes current translation.


translate

public static java.lang.String translate(java.lang.String context,
                                         java.lang.String sourceText)
Translates the specified text using translation file.

Parameters:
context - the translation context
sourceText - the text to be translated
Returns:
translated text

translate

public static java.lang.String translate(java.lang.String sourceText)
Translates the specified text using translation file.

Parameters:
sourceText - the text to be translated
Returns:
translated text

getInstalledStyles

public static Style[] getInstalledStyles()
Returns installed styles.

Returns:
installed styles

getInstalledStyleNames

public static java.lang.String[] getInstalledStyleNames()
Returns the names of the installed styles.

Returns:
the names of the installed styles

installStyle

public static void installStyle(Style style)
                         throws UnsupportedStyleException
Installs the specified style.

Parameters:
style - the style
Throws:
UnsupportedStyleException - if the style is not supported

installStyle

public static void installStyle(java.lang.String styleClassName)
                         throws UnsupportedStyleException
Installs the specified style.

Parameters:
styleClassName - the style class name
Throws:
UnsupportedStyleException - if the style class name is invalid

uninstallStyle

public static void uninstallStyle(java.lang.String styleName)
Uninstalls the specified style.

Parameters:
styleName - the theme style

getStyle

public static Style getStyle()
Returns current style.

Returns:
current style

getStyleName

public static java.lang.String getStyleName()
Returns the name of the current style.

Returns:
the name of the current style

setStyle

public static void setStyle(Style style)
                     throws UnsupportedStyleException
Sets current style.

Parameters:
style - the style
Throws:
UnsupportedStyleException - if the style is not supported

setStyle

public static void setStyle(java.lang.String styleName)
                     throws UnsupportedStyleException
Sets current style.

Parameters:
styleName - the style name
Throws:
UnsupportedStyleException - if the style name is invalid

setStyleSafely

public static boolean setStyleSafely(Style style)
Helper method. Sets style without throwing an exception if failed.

Parameters:
style - the style
Returns:
true if succeed

setStyleSafely

public static boolean setStyleSafely(java.lang.String styleName)
Helper method. Sets style without throwing an exception if failed.

Parameters:
styleName - the style name
Returns:
true if succeed

getInstalledThemes

public static Theme[] getInstalledThemes()
Returns installed themes.

Returns:
installed themes

getInstalledThemeNames

public static java.lang.String[] getInstalledThemeNames()
Returns the names of the installed theme.

Returns:
the names of the installed theme

installTheme

public static void installTheme(Theme theme)
                         throws UnsupportedThemeException
Installs the specified theme.

Parameters:
theme - the theme
Throws:
UnsupportedThemeException - if the theme is not supported

installTheme

public static void installTheme(java.lang.String themeClassName)
                         throws UnsupportedThemeException
Installs the specified theme.

Parameters:
themeClassName - the theme class name
Throws:
UnsupportedThemeException - if the theme is not supported

uninstallTheme

public static void uninstallTheme(java.lang.String themeName)
Uninstalls the specified theme.

Parameters:
themeName - the theme name

getTheme

public static Theme getTheme()
Returns current style.

Returns:
current style

getThemeName

public static java.lang.String getThemeName()
Returns the name of the current theme.

Returns:
the name of the current theme

setTheme

public static void setTheme(Theme theme)
                     throws UnsupportedThemeException
Sets the theme of the current style.

Parameters:
theme - the theme
Throws:
UnsupportedThemeException - if the theme is not supported

setTheme

public static void setTheme(java.lang.String themeName)
                     throws UnsupportedThemeException
Sets the theme of the current style.

Parameters:
themeName - the theme name
Throws:
UnsupportedThemeException - if the theme class name is invalid

setThemeSafely

public static boolean setThemeSafely(Theme theme)
Helper method. Sets theme without throwing an exception if failed.

Parameters:
theme - the theme
Returns:
true if succeed

setThemeSafely

public static boolean setThemeSafely(java.lang.String themeName)
Helper method. Sets theme without throwing an exception if failed.

Parameters:
themeName - the theme name
Returns:
true if succeed

isUsingSystemTheme

public static boolean isUsingSystemTheme()
Returns true if QSwing is using the system style theme.

Returns:
true if QSwing is using the system style theme

setUseSystemTheme

public static void setUseSystemTheme(boolean useSystemTheme)
Sets whether or not QSwing should use system style theme.

Parameters:
useSystemTheme - if true QSwing will use system style theme

getStyleSheet

public static StyleSheet getStyleSheet()
Returns style sheet.

Returns:
style sheet

setStyleSheet

public static void setStyleSheet(StyleSheet styleSheet)
Sets style sheet.

Parameters:
styleSheet - the style sheet

setStyleSheet

public static void setStyleSheet(java.lang.String styleSheetText)
Sets style sheet.

Parameters:
styleSheetText - the style sheet text

setStyleSheet

public static void setStyleSheet(java.io.File styleSheetFile)
                          throws java.io.IOException
Sets style sheet.

Parameters:
styleSheetFile - the style sheet file
Throws:
java.io.IOException - on an I/O error

setStyleSheet

public static void setStyleSheet(java.io.InputStream styleSheetStream)
                          throws java.io.IOException
Sets style sheet.

Parameters:
styleSheetStream - the style sheet input stream
Throws:
java.io.IOException - on an I/O error

setStyleSheetSafely

public static boolean setStyleSheetSafely(java.lang.String styleSheetFile)
Sets style sheet.

Parameters:
styleSheetFile - the style sheet file
Returns:
true if succeed

setStyleSheetSafely

public static boolean setStyleSheetSafely(java.io.InputStream styleSheetStream)
Sets style sheet.

Parameters:
styleSheetStream - the style sheet input stream
Returns:
true if succeed

removeStyleSheet

public static void removeStyleSheet()
Removes the current style sheet.


setOverrideCursor

public static void setOverrideCursor(Cursor cursor)
Sets the application override cursor (cursor that indicates special state of the application).

Parameters:
cursor - the cursor

changeOverrideCursor

public static void changeOverrideCursor(Cursor cursor)
Changes the application override cursor (cursor that indicates special state of the application).

Parameters:
cursor - the cursor

restoreOverrideCursor

public static void restoreOverrideCursor()
Undoes the last setOverrideCursor() call.


crateImage

public static Image crateImage(byte[] imageData,
                               int length)
Creates and returns image.

Parameters:
imageData - the image data
length - the image data length
Returns:
image

crateImage

public static Image crateImage(byte[] imageData)
Creates and returns image.

Parameters:
imageData - the image data
Returns:
image

crateImage

public static Image crateImage(java.net.URL location)
Creates and returns image.

Parameters:
location - the image location
Returns:
image

crateImage

public static Image crateImage(java.lang.String fileName)
Creates and returns image.

Parameters:
fileName - the image file name
Returns:
image

crateImage

public static Image crateImage(java.io.File file)
Creates and returns image.

Parameters:
file - the image file
Returns:
image

about

public static void about()
Shows information about QSwing.


aboutQt

public static void aboutQt()
Shows information about Qt.


getCustomProperty

public static java.lang.String getCustomProperty(java.lang.String name)
Returns custom property.

Parameters:
name - the property name
Returns:
custom property

setCustomProperty

public static void setCustomProperty(java.lang.String name,
                                     java.lang.String value)
Sets custom property.

Parameters:
name - the property name
value - the property value

addPropertyChangeListener

public static void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Adds property chage listener for all properties.

Parameters:
pcl - the property chage listener

addPropertyChangeListener

public static void addPropertyChangeListener(java.lang.String propertyName,
                                             java.beans.PropertyChangeListener pcl)
Adds property chage listener for specified property.

Parameters:
propertyName - the property name
pcl - the property chage listener

removePropertyChangeListener

public static void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Removes property chage listener for all properties.

Parameters:
pcl - the property chage listener

removePropertyChangeListener

public static void removePropertyChangeListener(java.lang.String propertyName,
                                                java.beans.PropertyChangeListener pcl)
Removes property chage listener for specified property.

Parameters:
propertyName - the property name
pcl - the property chage listener

getPropertyChangeListeners

public static java.beans.PropertyChangeListener[] getPropertyChangeListeners()
Returns property change listeners for all properties.

Returns:
property change listeners for all properties

getPropertyChangeListeners

public static java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
Returns property chage listeners for specified property.

Parameters:
propertyName - the property name
Returns:
property chage listeners for specified property


Copyright © 2007 ETF and contributors. All Rights Reserved.