Single Page


Miscellaneous Features

Drag-and-Drop, Tooltip and Context Menu

They are supported automatically with custom JavaScript codes as long as you extends your component handle from org.zkoss.zul.impl.XulElement.

Click, Right Click and Double Click

The onClick, onRightClick and onDoubleClick events are handled automatically by ZK Client Engine. All you need to do is to generate the correct attributes by use of the appendAsapAttr method.

public String getOuterAttrs() {
    final StringBuffer sb = new StringBuffer(super.getOuterAttrs());    
    appendAsapAttr(sb, Events.ON_CLICK);    
    appendAsapAttr(sb, Events.ON_DOUBLE_CLICK);    
    appendAsapAttr(sb, Events.ON_RIGHT_CLICK);    
    return sb.otString();    
}

HtmlBasedCcomponent provides an utility called getAllOnClickAttrs to simplify the job.

public String getOuterAttrs() {
    String attrs = super.getOuterAttrs();    
    String clkattrs = getAllOnClickAttrs();    
    rerturn clkattrs != null ? attrs + clkattrs: attrs;    
}