Package tools.dynamia.zk.util
Class ZKUtil
- java.lang.Object
-
- tools.dynamia.zk.util.ZKUtil
-
public abstract class ZKUtil extends Object
Utility class for common ZK process- Author:
- Mario A. Serrano Leones
-
-
Field Summary
Fields Modifier and Type Field Description static StringNAVIGATION_PAGEstatic intNOThe Constant NO.static intYESThe Constant YES.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidchangeReadOnly(org.zkoss.zk.ui.Component comp, boolean readOnly)Automatic change component to read only or disabled.static voidclearComponent(org.zkoss.zk.ui.Component comp)clear the component value.static voidclearPage(org.zkoss.zk.ui.Page page)clean all input components in the page.static voidconfigureComponentIcon(String image, org.zkoss.zk.ui.Component component, IconSize size)Configure the component icon for the Action, its takes care of IMAGE and FONT type icons.static voidconfigureComponentIcon(Icon icon, org.zkoss.zk.ui.Component component, IconSize size)Configure the component icon, its takes care of IMAGE and FONT type icons.static org.zkoss.zk.ui.ComponentcreateAjaxLoader()Creates the ajax loader.static org.zkoss.zk.ui.ComponentcreateAjaxLoader(String message)Creates the ajax loader.static org.zkoss.zk.ui.ComponentcreateAjaxLoader(String message, String imagePath)Creates the ajax loader.static org.zkoss.zk.ui.ComponentcreateComponent(String uri, org.zkoss.zk.ui.Component parent, Map<?,?> args)Creates the component.static org.zkoss.zul.PopupcreateTooltip(String text)Create a tootip popup.static org.zkoss.zul.PopupcreateTooltip(String title, String description)Create a tooltip popup with title and description.static org.zkoss.zul.WindowcreateWindow(String title)Creates the window.static org.zkoss.zul.WindowcreateWindow(String uri, String title, Object data)Creates the window.static voideventQueuePublish(String name, String scope, boolean autocreate, org.zkoss.zk.ui.event.Event evt)static voideventQueuePublish(String name, org.zkoss.zk.ui.event.Event evt)static voidfillCombobox(org.zkoss.zul.Combobox combo, Object[] data, boolean live)Fill combobox.static voidfillCombobox(org.zkoss.zul.Combobox combo, Collection data, boolean live)Fill combobox.static voidfillCombobox(org.zkoss.zul.Combobox combo, Collection data, Object selected, boolean live)Fill combobox.static voidfillCombobox(org.zkoss.zul.Combobox combo, List data)Fill combobox.static voidfillCombobox(org.zkoss.zul.Combobox combo, List data, boolean live)Fill combobox.static voidfillListbox(org.zkoss.zul.Listbox listbox, Object[] data, boolean live)Fill listbox.static voidfillListbox(org.zkoss.zul.Listbox listbox, Collection data, boolean live)Fill listbox.static voidfillListbox(org.zkoss.zul.Listbox listbox, List data, boolean live)Fill listbox.static ObjectgetExecutionArg(String name)Return and argument from current executionstatic ObjectgetExecutionEntity()Return entity binding to current zk execution (or event)static PagegetExecutionNavigationPage()Return current navigationPagebinded to current execution or currentPage fromNavigationManagerstatic org.zkoss.zul.WindowgetExecutionParentWindow()Return parentWindowbinding to current zk execution (or event)static org.zkoss.zk.ui.PagegetFirstPage()Gets the first page.static StringgetSessionID()Gets the session id.static voidinitEventQueueSubscribers(Object target)static booleanisEmpty(org.zkoss.zul.impl.InputElement input)Checks if is empty.static booleanisInEventListener()static voidsetSelected(org.zkoss.zul.Combobox combobox, Object value)Make easy select a combobox itemstatic voidsetSelected(org.zkoss.zul.Listbox listbox, Object value)Make easy selecte a listbox itemstatic org.zkoss.zul.WindowshowDialog(String uri, String title)Show dialog.static org.zkoss.zul.WindowshowDialog(String uri, String title, Object data)Show dialog.static org.zkoss.zul.WindowshowDialog(String uri, String title, Object data, String width, String height)Show dialog.static org.zkoss.zul.WindowshowDialog(String uri, String title, Object data, String width, String height, org.zkoss.zk.ui.event.EventListener onCloseListener)Show dialog.static org.zkoss.zul.WindowshowDialog(String uri, String title, String icon, Object data, String width, String height, org.zkoss.zk.ui.event.EventListener onCloseListener)Show Dialog with custom propertiesstatic org.zkoss.zul.WindowshowDialog(String uri, String title, String width, String height)Show dialog.static org.zkoss.zul.WindowshowDialog(String title, org.zkoss.zk.ui.Component component)Show dialog.static org.zkoss.zul.WindowshowDialog(String title, org.zkoss.zk.ui.Component component, String width, String height)Show dialog.static org.zkoss.zul.WindowshowDialog(String title, org.zkoss.zk.ui.Component component, String width, String height, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> onCloseListener)static <T> InputPanelshowInputDialog(String label, Class<T> inputClass, Object value, org.zkoss.zk.ui.event.EventListener eventListener)Show a simple InputPanelstatic <T> InputPanelshowInputDialog(String label, Class<T> inputClass, org.zkoss.zk.ui.event.EventListener eventListener)Show a simple InputPanel.static org.zkoss.zul.WindowshowListboxMultiSelector(String title, String label, List model, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> onSelect)static org.zkoss.zul.WindowshowListboxSelector(String title, List model, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.SelectEvent> onSelect)static voidshowMessage(String message)show a message.static voidshowMessage(String message, String title, MessageType type)Show message.static voidshowMessage(String message, MessageType type)show a message by type.static org.zkoss.zul.PopupshowPopup(org.zkoss.zk.ui.Component refComponent, org.zkoss.zk.ui.Component contentComponent)Show popup.static org.zkoss.zul.PopupshowPopup(org.zkoss.zk.ui.Component refComponent, org.zkoss.zk.ui.Component contentComponent, String width, String height)Show popup.static voidshowQuestion(String question, String title, org.zkoss.zk.ui.event.EventListener<org.zkoss.zul.Messagebox.ClickEvent> listener)Show question.static voidshowTextInputDialog(String title, String buttonLabel, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> evt)static voidsynchronizePaginator(DataPaginator dataPaginator, org.zkoss.zul.ext.Paginal paginal)Synchronize paginator.static voidupdateClientURI(String pagetitle, String uri)Invoke a Javascript util method to update browser uri and page title
-
-
-
Field Detail
-
NAVIGATION_PAGE
public static final String NAVIGATION_PAGE
- See Also:
- Constant Field Values
-
YES
public static final int YES
The Constant YES.- See Also:
- Constant Field Values
-
NO
public static final int NO
The Constant NO.- See Also:
- Constant Field Values
-
-
Method Detail
-
showMessage
public static void showMessage(String message)
show a message.- Parameters:
message- the message
-
showMessage
public static void showMessage(String message, MessageType type)
show a message by type.- Parameters:
message- the messagetype- the type
-
showMessage
public static void showMessage(String message, String title, MessageType type)
Show message.- Parameters:
message- the messagetitle- the titletype- the type
-
showQuestion
public static void showQuestion(String question, String title, org.zkoss.zk.ui.event.EventListener<org.zkoss.zul.Messagebox.ClickEvent> listener)
Show question.- Parameters:
question- the questiontitle- the titlelistener- the listener
-
fillCombobox
public static void fillCombobox(org.zkoss.zul.Combobox combo, Collection data, boolean live)Fill combobox.- Parameters:
combo- the combodata- the datalive- the live
-
fillCombobox
public static void fillCombobox(org.zkoss.zul.Combobox combo, Collection data, Object selected, boolean live)Fill combobox.- Parameters:
combo- the combodata- the dataselected- the selectedlive- the live
-
fillCombobox
public static void fillCombobox(org.zkoss.zul.Combobox combo, List data)Fill combobox.- Parameters:
combo- the combodata- the data
-
fillCombobox
public static void fillCombobox(org.zkoss.zul.Combobox combo, List data, boolean live)Fill combobox.- Parameters:
combo- the combodata- the datalive- the live
-
fillCombobox
public static void fillCombobox(org.zkoss.zul.Combobox combo, Object[] data, boolean live)Fill combobox.- Parameters:
combo- the combodata- the datalive- the live
-
fillListbox
public static void fillListbox(org.zkoss.zul.Listbox listbox, Collection data, boolean live)Fill listbox.- Parameters:
listbox- the listboxdata- the datalive- the live
-
fillListbox
public static void fillListbox(org.zkoss.zul.Listbox listbox, List data, boolean live)Fill listbox.- Parameters:
listbox- the listboxdata- the datalive- the live
-
fillListbox
public static void fillListbox(org.zkoss.zul.Listbox listbox, Object[] data, boolean live)Fill listbox.- Parameters:
listbox- the listboxdata- the datalive- the live
-
clearPage
public static void clearPage(org.zkoss.zk.ui.Page page)
clean all input components in the page.- Parameters:
page- the page
-
clearComponent
public static void clearComponent(org.zkoss.zk.ui.Component comp)
clear the component value.- Parameters:
comp- the comp
-
showDialog
public static org.zkoss.zul.Window showDialog(String uri, String title, Object data, String width, String height)
Show dialog.- Parameters:
uri- the urititle- the titledata- the dataheight- the heightwidth- the width
-
showDialog
public static org.zkoss.zul.Window showDialog(String uri, String title, String width, String height)
Show dialog.- Parameters:
uri- the urititle- the titlewidth- the widthheight- the height- Returns:
- the window
-
showDialog
public static org.zkoss.zul.Window showDialog(String uri, String title, Object data, String width, String height, org.zkoss.zk.ui.event.EventListener onCloseListener)
Show dialog.- Parameters:
uri- the urititle- the titledata- the dataheight- the heightwidth- the widthonCloseListener- the on close listener- Returns:
- the window
-
createWindow
public static org.zkoss.zul.Window createWindow(String uri, String title, Object data)
Creates the window.- Parameters:
uri- the urititle- the titledata- the data- Returns:
- the window
-
createWindow
public static org.zkoss.zul.Window createWindow(String title)
Creates the window.- Parameters:
title- the title- Returns:
- the window
-
showDialog
public static org.zkoss.zul.Window showDialog(String uri, String title, Object data)
Show dialog.- Parameters:
uri- the urititle- the titledata- the data
-
showDialog
public static org.zkoss.zul.Window showDialog(String uri, String title)
Show dialog.- Parameters:
uri- the urititle- the title
-
showDialog
public static org.zkoss.zul.Window showDialog(String title, org.zkoss.zk.ui.Component component)
Show dialog.- Parameters:
title- the titlecomponent- the component
-
showDialog
public static org.zkoss.zul.Window showDialog(String title, org.zkoss.zk.ui.Component component, String width, String height)
Show dialog.- Parameters:
title- the titlecomponent- the componentwidth- the widthheight- the height
-
showDialog
public static org.zkoss.zul.Window showDialog(String title, org.zkoss.zk.ui.Component component, String width, String height, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> onCloseListener)
-
showInputDialog
public static <T> InputPanel showInputDialog(String label, Class<T> inputClass, Object value, org.zkoss.zk.ui.event.EventListener eventListener)
Show a simple InputPanel- Parameters:
label-inputClass-value-eventListener-
-
showInputDialog
public static <T> InputPanel showInputDialog(String label, Class<T> inputClass, org.zkoss.zk.ui.event.EventListener eventListener)
Show a simple InputPanel.- Type Parameters:
T- the generic type- Parameters:
label- the labelinputClass- the input classeventListener- the event listener
-
isEmpty
public static boolean isEmpty(org.zkoss.zul.impl.InputElement input)
Checks if is empty.- Parameters:
input- the input- Returns:
- true, if is empty
-
synchronizePaginator
public static void synchronizePaginator(DataPaginator dataPaginator, org.zkoss.zul.ext.Paginal paginal)
Synchronize paginator.- Parameters:
dataPaginator- the data paginatorpaginal- the paginal
-
getFirstPage
public static org.zkoss.zk.ui.Page getFirstPage()
Gets the first page.- Returns:
- the first page
-
showPopup
public static org.zkoss.zul.Popup showPopup(org.zkoss.zk.ui.Component refComponent, org.zkoss.zk.ui.Component contentComponent, String width, String height)Show popup.- Parameters:
refComponent- the ref componentcontentComponent- the content componentwidth- the widthheight- the height- Returns:
- the popup
-
showPopup
public static org.zkoss.zul.Popup showPopup(org.zkoss.zk.ui.Component refComponent, org.zkoss.zk.ui.Component contentComponent)Show popup.- Parameters:
refComponent- the ref componentcontentComponent- the content component- Returns:
- the popup
-
getSessionID
public static String getSessionID()
Gets the session id.- Returns:
- the session id
-
createAjaxLoader
public static org.zkoss.zk.ui.Component createAjaxLoader(String message, String imagePath)
Creates the ajax loader.- Parameters:
message- the messageimagePath- the image path- Returns:
- the component
-
createAjaxLoader
public static org.zkoss.zk.ui.Component createAjaxLoader()
Creates the ajax loader.- Returns:
- the component
-
createAjaxLoader
public static org.zkoss.zk.ui.Component createAjaxLoader(String message)
Creates the ajax loader.- Parameters:
message- the message- Returns:
- the component
-
createTooltip
public static org.zkoss.zul.Popup createTooltip(String title, String description)
Create a tooltip popup with title and description.- Parameters:
title- the titledescription- the description- Returns:
- the popup
-
createTooltip
public static org.zkoss.zul.Popup createTooltip(String text)
Create a tootip popup.- Parameters:
text- the text- Returns:
- the popup
-
configureComponentIcon
public static void configureComponentIcon(Icon icon, org.zkoss.zk.ui.Component component, IconSize size)
Configure the component icon, its takes care of IMAGE and FONT type icons.- Parameters:
icon- the iconcomponent- the componentsize- the size
-
configureComponentIcon
public static void configureComponentIcon(String image, org.zkoss.zk.ui.Component component, IconSize size)
Configure the component icon for the Action, its takes care of IMAGE and FONT type icons.- Parameters:
image- the actioncomponent- the componentsize- the size
-
createComponent
public static org.zkoss.zk.ui.Component createComponent(String uri, org.zkoss.zk.ui.Component parent, Map<?,?> args)
Creates the component.- Parameters:
uri- the uriparent- the parentargs- the args
-
initEventQueueSubscribers
public static void initEventQueueSubscribers(Object target)
-
eventQueuePublish
public static void eventQueuePublish(String name, String scope, boolean autocreate, org.zkoss.zk.ui.event.Event evt)
-
eventQueuePublish
public static void eventQueuePublish(String name, org.zkoss.zk.ui.event.Event evt)
-
isInEventListener
public static boolean isInEventListener()
-
showListboxSelector
public static org.zkoss.zul.Window showListboxSelector(String title, List model, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.SelectEvent> onSelect)
-
showListboxMultiSelector
public static org.zkoss.zul.Window showListboxMultiSelector(String title, String label, List model, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> onSelect)
-
showTextInputDialog
public static void showTextInputDialog(String title, String buttonLabel, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> evt)
-
setSelected
public static void setSelected(org.zkoss.zul.Combobox combobox, Object value)Make easy select a combobox item- Parameters:
combobox-value-
-
setSelected
public static void setSelected(org.zkoss.zul.Listbox listbox, Object value)Make easy selecte a listbox item- Parameters:
listbox-value-
-
getExecutionArg
public static Object getExecutionArg(String name)
Return and argument from current execution- Parameters:
name-- Returns:
-
getExecutionEntity
public static Object getExecutionEntity()
Return entity binding to current zk execution (or event)- Returns:
-
getExecutionParentWindow
public static org.zkoss.zul.Window getExecutionParentWindow()
Return parentWindowbinding to current zk execution (or event)- Returns:
-
getExecutionNavigationPage
public static Page getExecutionNavigationPage()
Return current navigationPagebinded to current execution or currentPage fromNavigationManager- Returns:
-
changeReadOnly
public static void changeReadOnly(org.zkoss.zk.ui.Component comp, boolean readOnly)Automatic change component to read only or disabled. Include children component- Parameters:
comp-readOnly-
-
showDialog
public static org.zkoss.zul.Window showDialog(String uri, String title, String icon, Object data, String width, String height, org.zkoss.zk.ui.event.EventListener onCloseListener)
Show Dialog with custom properties- Parameters:
uri-title-icon-data-width-height-onCloseListener-- Returns:
-
-