Class ZKUtil


  • public abstract class ZKUtil
    extends Object
    Utility class for common ZK process
    Author:
    Mario A. Serrano Leones
    • 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 message
        type - the type
      • showMessage

        public static void showMessage​(String message,
                                       String title,
                                       MessageType type)
        Show message.
        Parameters:
        message - the message
        title - the title
        type - 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 question
        title - the title
        listener - the listener
      • fillCombobox

        public static void fillCombobox​(org.zkoss.zul.Combobox combo,
                                        Collection data,
                                        boolean live)
        Fill combobox.
        Parameters:
        combo - the combo
        data - the data
        live - the live
      • fillCombobox

        public static void fillCombobox​(org.zkoss.zul.Combobox combo,
                                        Collection data,
                                        Object selected,
                                        boolean live)
        Fill combobox.
        Parameters:
        combo - the combo
        data - the data
        selected - the selected
        live - the live
      • fillCombobox

        public static void fillCombobox​(org.zkoss.zul.Combobox combo,
                                        List data)
        Fill combobox.
        Parameters:
        combo - the combo
        data - the data
      • fillCombobox

        public static void fillCombobox​(org.zkoss.zul.Combobox combo,
                                        List data,
                                        boolean live)
        Fill combobox.
        Parameters:
        combo - the combo
        data - the data
        live - the live
      • fillCombobox

        public static void fillCombobox​(org.zkoss.zul.Combobox combo,
                                        Object[] data,
                                        boolean live)
        Fill combobox.
        Parameters:
        combo - the combo
        data - the data
        live - the live
      • fillListbox

        public static void fillListbox​(org.zkoss.zul.Listbox listbox,
                                       Collection data,
                                       boolean live)
        Fill listbox.
        Parameters:
        listbox - the listbox
        data - the data
        live - the live
      • fillListbox

        public static void fillListbox​(org.zkoss.zul.Listbox listbox,
                                       List data,
                                       boolean live)
        Fill listbox.
        Parameters:
        listbox - the listbox
        data - the data
        live - the live
      • fillListbox

        public static void fillListbox​(org.zkoss.zul.Listbox listbox,
                                       Object[] data,
                                       boolean live)
        Fill listbox.
        Parameters:
        listbox - the listbox
        data - the data
        live - 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 uri
        title - the title
        data - the data
        height - the height
        width - the width
      • showDialog

        public static org.zkoss.zul.Window showDialog​(String uri,
                                                      String title,
                                                      String width,
                                                      String height)
        Show dialog.
        Parameters:
        uri - the uri
        title - the title
        width - the width
        height - 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 uri
        title - the title
        data - the data
        height - the height
        width - the width
        onCloseListener - 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 uri
        title - the title
        data - 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 uri
        title - the title
        data - the data
      • showDialog

        public static org.zkoss.zul.Window showDialog​(String uri,
                                                      String title)
        Show dialog.
        Parameters:
        uri - the uri
        title - the title
      • showDialog

        public static org.zkoss.zul.Window showDialog​(String title,
                                                      org.zkoss.zk.ui.Component component)
        Show dialog.
        Parameters:
        title - the title
        component - 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 title
        component - the component
        width - the width
        height - 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 label
        inputClass - the input class
        eventListener - 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 paginator
        paginal - 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 component
        contentComponent - the content component
        width - the width
        height - 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 component
        contentComponent - 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 message
        imagePath - 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 title
        description - 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 icon
        component - the component
        size - 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 action
        component - the component
        size - 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 uri
        parent - the parent
        args - 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 parent Window binding to current zk execution (or event)
        Returns:
      • getExecutionNavigationPage

        public static Page getExecutionNavigationPage()
        Return current navigation Page binded to current execution or currentPage from NavigationManager
        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:
      • updateClientURI

        public static void updateClientURI​(String pagetitle,
                                           String uri)
        Invoke a Javascript util method to update browser uri and page title
        Parameters:
        pagetitle -
        uri -