|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface UI
Main UI singleton.
Access this to create new UI objects or control global UI features.
The leafChat UI is, in general, thread-safe.
Field Summary | |
---|---|
static int |
BUTTON_CANCEL
'Cancel' button bitfield constant for showQuestion |
static int |
BUTTON_NO
'No' button bitfield constant for showQuestion |
static int |
BUTTON_YES
'Yes' button bitfield constant for showQuestion |
static int |
UISTYLE_MULTIWINDOW
UI style: multi-window style |
static int |
UISTYLE_SINGLEWINDOW
UI style: single window 'classic' style |
static int |
UISTYLE_TABBED
UI style: tabbed |
Method Summary | |
---|---|
void |
activate()
Activates the app. |
Dialog |
createDialog(org.w3c.dom.Document d,
java.lang.Object callbacks)
Deprecated. Use createDialog(String, Object) instead |
Dialog |
createDialog(java.lang.String xml,
java.lang.Object callbacks)
Creates a Dialog from an XML document. |
Page |
createPage(org.w3c.dom.Document d,
java.lang.Object callbacks)
Deprecated. Use createPage(String, Object) instead |
Page |
createPage(java.lang.String xml,
java.lang.Object callbacks)
Creates a Page from an XML document. |
Widget |
createWidget(org.w3c.dom.Document d,
WidgetOwner owner)
Creates a Widget from an XML document. |
Window |
createWindow(org.w3c.dom.Document d,
java.lang.Object callbacks)
Deprecated. Use createWindow(String, Object) instead |
Window |
createWindow(java.lang.String xml,
java.lang.Object callbacks)
Creates a Window from an XML document. |
Theme[] |
getAvailableThemes()
Obtains the list of available themes. |
Theme |
getTheme()
Obtains the user's selected theme. |
java.io.File |
getThemeFolder(boolean system)
Obtains the folder used for themes. |
int |
getUIStyle()
|
void |
installUserTheme(java.io.File newTheme)
Installs a new theme file into the user's theme folder, checking it for errors. |
boolean |
isAppActive()
|
BorderPanel |
newBorderPanel()
|
Button |
newButton()
|
ButtonPanel |
newButtonPanel()
|
CheckBox |
newCheckBox()
|
ChoicePanel |
newChoicePanel()
|
DecoratedPanel |
newDecoratedPanel()
|
Dialog |
newDialog(java.lang.Object callbacks)
Creates a new Dialog. |
Dropdown |
newDropdown()
|
EditArea |
newEditArea()
|
EditBox |
newEditBox()
|
GroupPanel |
newGroupPanel()
|
HorizontalPanel |
newHorizontalPanel()
|
Widget |
newJComponentWrapper(javax.swing.JComponent c)
Creates a widget wrapper for a JComponent. |
Label |
newLabel()
|
ListBox |
newListBox()
|
Page |
newPage()
|
Page |
newPage(java.lang.Object callbacks)
Creates a new Page. |
Pic |
newPic()
|
PopupMenu |
newPopupMenu()
|
Progress |
newProgress()
|
RadioButton |
newRadioButton()
|
ScrollPanel |
newScrollPanel()
|
Spacer |
newSpacer()
|
SplitPanel |
newSplitPanel()
|
Table |
newTable()
|
TabPanel |
newTabPanel()
|
TextView |
newTextView()
|
TreeBox |
newTreeBox()
|
VerticalPanel |
newVerticalPanel()
|
Window |
newWindow(java.lang.Object callbacks)
|
void |
refreshTheme()
Refreshes the current theme to take account of user style changes (userstyle.css). |
void |
registerTool(Tool t)
Registers a new Tool that will be placed on the toolbar. |
void |
resizeToolbar()
Tools can call this command to make the system resize the toolbar as appropriate given changed content. |
void |
runInThread(java.lang.Runnable r)
Runs a task in the user-interface/event thread. |
void |
setTheme(Theme t)
Sets the selected theme (should be called by preferences, which for technical reasons has to be in a different plugin). |
void |
setUIStyle(int uiStyle)
Changes the current UI style and remembers it in preferences. |
java.awt.Color |
showColourSelect(WidgetOwner parent,
java.lang.String title,
java.awt.Color original)
Shows a colour-select dialog. |
java.io.File |
showFileSelect(WidgetOwner parent,
java.lang.String title,
boolean saveMode,
java.io.File folder,
java.io.File file,
java.lang.String[] extensions,
java.lang.String filterName)
Shows a file-select dialog as appropriate for the platform. |
java.io.File |
showFolderSelect(WidgetOwner parent,
java.lang.String title,
java.io.File folder)
Shows a folder-select dialog as appropriate for the platform. |
void |
showLatest()
Switches to the window with most recent changes (if any window has changes). |
int |
showOptionalQuestion(java.lang.String prefID,
WidgetOwner parent,
java.lang.String title,
java.lang.String message,
int buttons,
java.lang.String yesLabel,
java.lang.String noLabel,
java.lang.String cancelLabel,
int defaultButton)
Shows a dialog with don't-show-this-again feature. |
int |
showQuestion(WidgetOwner parent,
java.lang.String title,
java.lang.String message,
int buttons,
java.lang.String yesLabel,
java.lang.String noLabel,
java.lang.String cancelLabel,
int defaultButton)
Show a yes/no/cancel confirm dialog. |
void |
showUserError(WidgetOwner parent,
java.lang.String title,
java.lang.String message)
Displays an alert dialog indicating some kind of error, with an OK button |
void |
unregisterTool(Tool t)
Unregisters an existing Tool and removes it from the toolbar. |
Field Detail |
---|
static final int BUTTON_YES
static final int BUTTON_NO
static final int BUTTON_CANCEL
static final int UISTYLE_SINGLEWINDOW
static final int UISTYLE_MULTIWINDOW
static final int UISTYLE_TABBED
Method Detail |
---|
Window newWindow(java.lang.Object callbacks)
callbacks
- Object used for callback methods
Dialog newDialog(java.lang.Object callbacks)
The use of dialogs should be avoided as they are modal; while a dialog is shown, users cannot access other windows.
callbacks
- Object used for callback methods
Page newPage(java.lang.Object callbacks)
callbacks
- Object used for callback methods
Page newPage()
BorderPanel newBorderPanel()
SplitPanel newSplitPanel()
VerticalPanel newVerticalPanel()
HorizontalPanel newHorizontalPanel()
GroupPanel newGroupPanel()
TabPanel newTabPanel()
ChoicePanel newChoicePanel()
ScrollPanel newScrollPanel()
DecoratedPanel newDecoratedPanel()
ButtonPanel newButtonPanel()
Label newLabel()
Pic newPic()
TextView newTextView()
Button newButton()
RadioButton newRadioButton()
CheckBox newCheckBox()
Dropdown newDropdown()
EditBox newEditBox()
EditArea newEditArea()
ListBox newListBox()
TreeBox newTreeBox()
Table newTable()
Progress newProgress()
Spacer newSpacer()
PopupMenu newPopupMenu()
Widget newJComponentWrapper(javax.swing.JComponent c)
Though leafChat UI is thread-safe, this of course does not apply to the Swing component. Be careful when calling methods on the Swing component.
c
- Swing component
Widget createWidget(org.w3c.dom.Document d, WidgetOwner owner)
d
- XML widget documentowner
- Window that maintains a list of IDs for the created widgets
BugException
- If the XML document is invalidWindow createWindow(org.w3c.dom.Document d, java.lang.Object callbacks)
createWindow(String, Object)
instead
d
- XML document describing the windowcallbacks
- Object used for callback methods
BugException
- If the XML document is invalidWindow createWindow(java.lang.String xml, java.lang.Object callbacks)
xml
- Name of XML file without the '.xml' at the endcallbacks
- Callback object, which must have UIHandler
annotation including this xml file
BugException
- If the XML document is invalid or can't be loadedPage createPage(org.w3c.dom.Document d, java.lang.Object callbacks)
createPage(String, Object)
instead
d
- XML document describing the pagecallbacks
- Object used for callback methods
BugException
- If the XML document is invalidPage createPage(java.lang.String xml, java.lang.Object callbacks)
xml
- Name of XML file without the '.xml' at the endcallbacks
- Callback object, which must have UIHandler
annotation including this xml file
BugException
- If the XML document is invalidDialog createDialog(org.w3c.dom.Document d, java.lang.Object callbacks)
createDialog(String, Object)
instead
The use of dialogs should be avoided as they are modal; while a dialog is shown, users cannot access other windows.
d
- XML document describing the dialogcallbacks
- Object used for callback methods
BugException
- If the XML document is invalidDialog createDialog(java.lang.String xml, java.lang.Object callbacks)
The use of dialogs should be avoided as they are modal; while a dialog is shown, users cannot access other windows.
xml
- Name of XML file without the '.xml' at the endcallbacks
- Callback object, which must have UIHandler
annotation including this xml file
BugException
- If the XML document is invalidint showQuestion(WidgetOwner parent, java.lang.String title, java.lang.String message, int buttons, java.lang.String yesLabel, java.lang.String noLabel, java.lang.String cancelLabel, int defaultButton)
parent
- Parent that dialog will be aligned withtitle
- Dialog titlemessage
- Message in XMLbuttons
- Bitfield e.g. BUTTON_YES|BUTTON_CANCELyesLabel
- Label for Yes button (null = Yes)noLabel
- Label for No button (null = No)cancelLabel
- Label for Cancel button (null = Cancel)defaultButton
- Default button BUTTON_xx constant
int showOptionalQuestion(java.lang.String prefID, WidgetOwner parent, java.lang.String title, java.lang.String message, int buttons, java.lang.String yesLabel, java.lang.String noLabel, java.lang.String cancelLabel, int defaultButton)
prefID
- ID used to disable appearanceparent
- Parent that dialog will be aligned withtitle
- Dialog titlemessage
- Message in XMLbuttons
- Bitfield e.g. BUTTON_YES|BUTTON_CANCELyesLabel
- Label for Yes button (null = Yes)noLabel
- Label for No button (null = No)cancelLabel
- Label for Cancel button (null = Cancel)defaultButton
- Default button BUTTON_xx constant
void showUserError(WidgetOwner parent, java.lang.String title, java.lang.String message)
parent
- Parent that dialog will be aligned withtitle
- Dialog titlemessage
- Message in XMLjava.io.File showFileSelect(WidgetOwner parent, java.lang.String title, boolean saveMode, java.io.File folder, java.io.File file, java.lang.String[] extensions, java.lang.String filterName)
parent
- Parent that dialog will be aligned with, or null for defaulttitle
- Title of dialogsaveMode
- True for save, false for load (in save mode, the
user will be asked to confirm overwrite if they select a file that
exists, and the confirm prompt will change to 'Save' instead of 'Open')folder
- Initial folder or null for nonefile
- Initial file or null for none (overrides folder)extensions
- Array of supported extensions in the form ".jpg" (not
case-sensitive) or null to show all filesfilterName
- Name describing supported extensions e.g. 'Image files' or null for default
java.io.File showFolderSelect(WidgetOwner parent, java.lang.String title, java.io.File folder)
parent
- Parent that dialog will be aligned with, or null for defaulttitle
- Title of dialogfolder
- Initial folder or null for none
java.awt.Color showColourSelect(WidgetOwner parent, java.lang.String title, java.awt.Color original)
parent
- Parent that dialog will be aligned with, or null for defaulttitle
- Title of dialogoriginal
- Initial colour
void registerTool(Tool t)
t
- SimpleTool or ComplexTool implementor
BugException
- If there is any problem registering the toolvoid unregisterTool(Tool t)
t
- Tool to removevoid resizeToolbar()
Theme getTheme()
Theme[] getAvailableThemes()
void setTheme(Theme t)
t
- New themevoid refreshTheme()
java.io.File getThemeFolder(boolean system)
system
- If true, returns the system theme folder, otherwise
returns the per-user theme folder
void installUserTheme(java.io.File newTheme) throws GeneralException
newTheme
- New theme file
GeneralException
- If there is an error with the theme or with
copyingvoid setUIStyle(int uiStyle)
uiStyle
- One of the UISTYLE_xx constantsint getUIStyle()
void runInThread(java.lang.Runnable r)
r
- Task to runboolean isAppActive()
void activate()
void showLatest()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |