Class Utils

java.lang.Object
org.zkoss.zk.ui.impl.Utils

public class Utils extends Object
Utilities to implement ZK.
Since:
5.0.7
Author:
tomyeh
  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • markClientInfoPerDesktop

      public static boolean markClientInfoPerDesktop(Desktop desktop, String key)
      Marks the per-desktop information of the given key will be generated, and returns true if the information is not generated yet (i.e., this method is NOT called with the given key). You could use this method to minimize the bytes to be sent to the client if the information is required only once per desktop.
    • getXMLResourcesLocator

      public static org.zkoss.util.resource.XMLResourcesLocator getXMLResourcesLocator()
      Returns the XML resources locator to locate metainfo/zk/config.xml, metainfo/zk/lang.xml, and metainfo/zk/lang-addon.xml
    • newComposer

      public static Composer newComposer(Page page, Object o) throws Exception
      Instantiates a composer of the given object. This method will invoke UiFactory.newComposer(org.zkoss.zk.ui.Page, java.lang.Class) to instantiate the composer if page is not null.
      Parameters:
      page - the page that the composer will be created for. Ignored if null.
      o - the composer instance, the class of the composer to instantiate, or the name of the class of the composer. If o is an instance of Composer, it is returned directly.
      Throws:
      Exception
    • getComponentInfo

      public static ComponentInfo getComponentInfo(Component comp)
      Returns the component info associated with the given component, or null if not available.

      It is used only internally.

    • setComponentInfo

      public static void setComponentInfo(Component comp, ComponentInfo info)
      Sets the component info for the given component.

      It is used only internally.

    • testAttribute

      public static final boolean testAttribute(Component comp, String name, boolean defValue, boolean recurse)
      Tests if the given attribute is defined in a component or in library property.
      Parameters:
      name - the name of the attribute
      defValue - the default value if neither component's attribute or library property is defined for the given name
      recurse - whether to look up the ancestor's attribute
      Since:
      5.0.7
    • setShadowInfo

      public static void setShadowInfo(Component comp, ShadowInfo info)
      Sets the component info for the given component.

      It is used only internally.

      Since:
      8.0.0