本文整理了Java中org.zkoss.zk.ui.event.Events
类的一些代码示例,展示了Events
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Events
类的具体详情如下:
包路径:org.zkoss.zk.ui.event.Events
类名称:Events
[英]Utilities to handle events.
[中]处理事件的实用程序。
代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.documents
/**
* Triggers document view mode.
*/
public void onClick$btnView() {
Events.postEvent("onViewOpen", root, true);
}
代码示例来源:origin: org.zkoss.zk/zk
/** Echos an event.
* By echo we mean the event is fired after the client receives the AU
* responses and then echoes back.
* In other words, the event won't be processed in the current execution.
* Rather, it executes after the client receives the AU responses
* and then echoes back the event back.
*
* <p>It is usually if you want to prompt the user before doing a long
* operation. A typical case is to open a highlighted window to
* prevent the user from clicking any button before the operation gets done.
*
* <p>It is the same as <code>echoEvent(name, target, (Object)data)</code>.
*
* @since 3.0.2
* @see #sendEvent
* @see #echoEvent(String, Component, Object)
* @param name the event name, such as onSomething
* @param target the component to receive the event (never null).
* @param data the extra information, or null if not available.
* It will become {@link Event#getData}.
*/
public static final void echoEvent(String name, Component target, String data) {
echoEvent(name, target, (Object) data);
}
代码示例来源:origin: org.zkoss.zk/zul
public void onEvent(Event event) {
Events.sendEvent(Tabbox.this, event);
}
代码示例来源:origin: org.zkoss.zk/zkplus
/*package*/ static void postOnCreateEvents(Component item) {
for (final Iterator it = item.getChildren().iterator(); it.hasNext();) {
final Component child = (Component) it.next();
postOnCreateEvents(child); //recursive
}
if (Events.isListened(item, Events.ON_CREATE, false)) {
Events.postEvent(new CreateEvent(Events.ON_CREATE, item, null));
}
}
}
代码示例来源:origin: org.zkoss.zk/zkplus
refs.add(dataTarget);
bindings.add(binding);
Events.sendEvent(new BindingSaveEvent("onBindingSave", dataTarget, target, binding, vals[0]));
refs.add(dataTarget1);
bindings.add(binding);
Events.sendEvent(
new BindingSaveEvent("onBindingSave", dataTarget1, target, binding, vals[0]));
Events.sendEvent(new BindingValidateEvent("onBindingValidate", target, refs, bindings, values));
Events.postEvent(new Event("onLoadOnSave", loadOnSaveProxy, loadOnSaveInfos));
代码示例来源:origin: org.zkoss.zk/zul
public boolean isDeferrable() {
return !Events.isListened(Tabbox.this, Events.ON_SELECT, true);
}
}
代码示例来源:origin: org.zkoss.zk/zk
public boolean addEventListener(int priority, String evtnm, EventListener<? extends Event> listener) {
if (evtnm == null || listener == null)
throw new IllegalArgumentException("null");
if (!Events.isValid(evtnm))
throw new IllegalArgumentException("Invalid event name: " + evtnm);
final boolean oldasap = Events.isListened(this, evtnm, true);
desktop.setAttribute("org.zkoss.desktop.visibilitychange.enabled", true);
} else if (getClientEvents().containsKey(evtnm)) {
final boolean asap = Events.isListened(this, evtnm, true);
if (lis.size() == 1 || oldasap != asap)
smartUpdate("$" + evtnm, asap);
代码示例来源:origin: org.zkoss.zk/zk
public boolean activateServerPush(long timeout) throws InterruptedException {
checkSeverPush("activate");
if (Events.inEventListener() && Executions.getCurrent().getDesktop() == this)
throw new IllegalStateException("No need to invoke Executions.activate() in an event listener");
if (log.isDebugEnabled()) {
log.debug("activateServerPush, timeout is [{}]", timeout);
}
return _spush.activate(timeout);
}
代码示例来源:origin: org.zkoss.zk/zuljsp
if (Events.isListened(_comp, Events.ON_CREATE, false))//send onCreate event...
Events.postEvent(
new CreateEvent(Events.ON_CREATE, _comp, Executions.getCurrent().getArg()));
代码示例来源:origin: org.carewebframework/org.carewebframework.ui
/**
* First, posts any pending echo requests to the event queue. Then empties the event queue,
* sending each queued event to its target. Finally, processes any events on the server push
* event queue.
*
* @return True if events were flushed.
*/
public boolean flushEvents() {
Event event;
boolean result = false;
for (AuEcho echo : execution.getEchoedEvents()) {
Events.postEvent(toEvent(echo));
}
execution.getEchoedEvents().clear();
while ((event = execution.getNextEvent()) != null) {
Events.sendEvent(event);
result = true;
}
result |= serverPush.flush();
return result;
}
代码示例来源:origin: org.zkoss.zk/zk
public boolean removeEventListener(String evtnm, EventListener<? extends Event> listener) {
if (evtnm == null || listener == null)
throw new IllegalArgumentException("null");
if (_auxinf != null && _auxinf.listeners != null) {
final boolean oldasap = Events.isListened(this, evtnm, true);
final List<EventListenerInfo> lis = _auxinf.listeners.get(evtnm);
if (lis != null) {
for (Iterator<EventListenerInfo> it = lis.iterator(); it.hasNext();) {
final EventListenerInfo li = it.next();
if (li.listener.equals(listener)) {
it.remove();
if (lis.isEmpty())
_auxinf.listeners.remove(evtnm);
final Desktop desktop = getDesktop();
if (desktop != null) {
onListenerChange(desktop, false);
if (getClientEvents().containsKey(evtnm)) {
if (lis.isEmpty() && !Events.isListened(this, evtnm, false))
smartUpdate("$" + evtnm, (Object) null); //no listener at all
else if (oldasap != Events.isListened(this, evtnm, true))
smartUpdate("$" + evtnm, !oldasap);
}
}
return true;
}
}
}
}
return false;
}
代码示例来源:origin: org.zkoss.zk/zul
if (!Events.inEventListener())
throw new SuspendNotAllowedException("doModal must be called in an event listener");
代码示例来源:origin: org.zkoss.zk/zul
/**
* mark a draw flag to inform that this Chart needs update.
*/
protected void smartDrawChart() {
if (_smartDrawChart) { //already mark smart draw
return;
}
_smartDrawChart = true;
Events.postEvent("onSmartDrawChart", this, null);
}
代码示例来源:origin: org.zkoss.zk/zk
public void onPiggyback() {
//Note: we don't post ON_PIGGYBACK twice in an execution
//(performance concern and back-compatibility).
if (_piggybackListened && Executions.getCurrent().getAttribute(ATTR_PIGGYBACK_POSTED) == null) {
for (Page page : _pages) {
if (Executions.getCurrent().isAsyncUpdate(page)) { //ignore new created pages
for (Component root = page.getFirstRoot(); root != null; root = root.getNextSibling()) {
if (Events.isListened(root, Events.ON_PIGGYBACK, false)) { //asap+deferrable
Events.postEvent(new Event(Events.ON_PIGGYBACK, root));
Executions.getCurrent().setAttribute(ATTR_PIGGYBACK_POSTED, Boolean.TRUE);
}
}
}
}
}
if (!_schedInfos.isEmpty())
Events.postEvent(ON_SCHEDULE, _dummyTarget, null);
//we could not process them here (otherwise, event handling, thread
//might not work)
//Thus, we post an event and handle it in _dummyTarget
if (_spush != null)
_spush.onPiggyback();
}
代码示例来源:origin: org.zkoss.zk/zk
/** Sends the event to the target specified in the event, and processes it immediately.
*
* <p>Note: {@link Event#getTarget} cannot be null.
*/
public static void sendEvent(Event event) {
sendEvent(event.getTarget(), event);
}
代码示例来源:origin: org.carewebframework/org.carewebframework.vista.security.impl
/**
* Restarts the timer.
*/
private void resetTimer() {
if (timer != null) {
timer.stop();
Events.echoEvent("onResetTimer", timer, null);
}
}
代码示例来源:origin: org.zkoss.zk/zk
private void onListenerChange(Desktop desktop, boolean listen) {
if (listen) {
if (Events.isListened(this, Events.ON_CLIENT_INFO, false)) { //asap+deferrable
response(new AuClientInfo(desktop));
getDesktop().setAttribute("org.zkoss.desktop.clientinfo.enabled", true);
//We always fire event not a root, since we don't like to
//check when setParent or setPage is called
}
if (Events.isListened(this, Events.ON_PIGGYBACK, false))
((DesktopCtrl) desktop).onPiggybackListened(this, true);
if (Events.isListened(this, Events.ON_VISIBILITY_CHANGE, false))
getDesktop().setAttribute("org.zkoss.desktop.visibilitychange.enabled", true);
} else {
if (!Events.isListened(this, Events.ON_PIGGYBACK, false))
((DesktopCtrl) desktop).onPiggybackListened(this, false);
}
}
代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.esig
/**
* Force focus to the password text box.
*/
public void onBlur$txtPassword() {
Events.postEvent(Events.ON_FOCUS, this, null);
}
代码示例来源:origin: org.zkoss.zk/zk
/** Sends the event to the target, and processes it immediately.
* @param target the target of the event (never null)
* @since 5.0.4
*/
public static void sendEvent(String name, Component target, Object data) {
sendEvent(new Event(name, target, data));
}
代码示例来源:origin: org.carewebframework/org.carewebframework.security.spring.core
/**
* Restarts the timer.
*/
private void resetTimer() {
if (timer != null) {
timer.stop();
Events.echoEvent("onResetTimer", timer, null);
}
}
内容来源于网络,如有侵权,请联系作者删除!