/** Returns the desktop-level event queue with the specified name in the current * desktop. * It is a shortcut of <code>lookup(name, DESKTOP, autoCreate)</code>. */ public static <T extends Event> EventQueue<T> lookup(String name, boolean autoCreate) { return lookup(name, DESKTOP, autoCreate); }
/** Removes the event queue. * It is the same as <code>remove(name, DESKTOP)</code>. * @param name the queue name. * @return true if it is removed successfully */ public static boolean remove(String name) { return remove(name, DESKTOP); }
/** Removes the event queue of the specified scope. * @param name the queue name. * @param scope the scope of the event queue. Currently, * it supports {@link #DESKTOP}, {@link #GROUP}, * {@link #SESSION}, and {@link #APPLICATION}. * Note: {@link #GROUP} requires ZK EE. * @return true if it is removed successfully */ public static boolean remove(String name, String scope) { return getProvider().remove(name, scope); }
/** Removes the event queue of the specified session. * <p>Unlike {@link #remove(String, String)}, this method * can be called without an activated execution. * @param name the queue name. * @param sess the session that the event queue is located (i.e., * the session scope) * @return true if it is removed successfully * @since 5.0.4 */ public static boolean remove(String name, Session sess) { return getProvider().remove(name, sess); }
/** Returns the desktop-level event queue with the specified name in the current * desktop, or if no such event queue, create one. * It is a shortcut of <code>lookup(name, DESKTOP, true)</code>. */ public static <T extends Event> EventQueue<T> lookup(String name) { return lookup(name, DESKTOP, true); }
/** Removes the event queue of the specified application. * <p>Unlike {@link #remove(String, String)}, this method * can be called without an activated execution. * @param name the queue name. * @param wapp the Web application that the event queue is located (i.e., * the application scope) * @return true if it is removed successfully * @since 5.0.4 */ public static boolean remove(String name, WebApp wapp) { return getProvider().remove(name, wapp); }
/** Tests if the specified event queue has been created. */ public static boolean exists(String name, String scope) { return lookup(name, scope, false) != null; }
/** Returns the event queue with the specified name in the * give session (i.e., the session scope). * <p>Unlike {@link #lookup(String, String, boolean)}, this method * can be called without an activated execution. * @param sess the session that the event queue is located (i.e., * the session scope) * @see #lookup(String, String, boolean) * @see #lookup(String, WebApp, boolean) * @since 5.0.2 */ public static <T extends Event> EventQueue<T> lookup(String name, Session sess, boolean autoCreate) { return getProvider().lookup(name, sess, autoCreate); }
/** Tests if the specified event queue has been created * in the current desktop. * It is a shortcut of <code>exists(name, DESKTOP)</code> */ public static boolean exists(String name) { return lookup(name, false) != null; }
/** Returns the event queue with the specified name in the * give application (i.e., the application scope). * <p>Unlike {@link #lookup(String, String, boolean)}, this method * can be called without an activated execution. * @param wapp the Web application that the event queue is located (i.e., * the application scope) * @see #lookup(String, String, boolean) * @see #lookup(String, Session, boolean) * @since 5.0.2 */ public static <T extends Event> EventQueue<T> lookup(String name, WebApp wapp, boolean autoCreate) { return getProvider().lookup(name, wapp, autoCreate); }
protected EventQueue<Event> getEventQueue() { return EventQueues.lookup(_quename, _quescope, true); }
return getProvider().lookup(name, scope, autoCreate);
private void unsubscribeQueue(String quename, String quescope, EventListener<Event> listener) { EventQueue<Event> que = EventQueues.lookup(quename, quescope, false); if (que != null) { que.unsubscribe(listener); } }
private void subscribeQueue(String quename, String quescope, EventListener<Event> listener) { EventQueue<Event> que = EventQueues.lookup(quename, quescope, true); que.subscribe(listener); }
private boolean isSubscribed(String quename, String quescope, EventListener<Event> listener) { EventQueue<Event> que = EventQueues.lookup(quename, quescope, false); return que == null ? false : que.isSubscribed(listener); }
/** * Post a notify change to corresponding event queue to notify a bean's property changing * @param queueName the queue name, null for default queue name * @param queueScope the queue scope, null for default queue scope (i.e. {@link EventQueues#DESKTOP}) * @param bean the bean instance * @param property the property name of bean */ public static void postNotifyChange(String queueName, String queueScope, Object bean, String property) { final EventQueue<Event> que = EventQueues.lookup(queueName == null ? BinderCtrl.DEFAULT_QUEUE_NAME : queueName, queueScope == null ? BinderCtrl.DEFAULT_QUEUE_SCOPE : queueScope, false); if (Strings.isEmpty(property)) throw new IllegalArgumentException("property is empty"); if (que != null) { que.publish(new PropertyChangeEvent(null, bean, property)); } }
/** * Post a global command to corresponding event queue * @param queueName the queue name, null for default queue name * @param queueScope the queue scope, null for default queue scope (i.e. {@link EventQueues#DESKTOP}) * @param cmdName the global command name * @param args arguments, could get the data in command method by {@link BindingParam} */ public static void postGlobalCommand(String queueName, String queueScope, String cmdName, Map<String, Object> args) { final EventQueue<Event> que = EventQueues.lookup(queueName == null ? BinderCtrl.DEFAULT_QUEUE_NAME : queueName, queueScope == null ? BinderCtrl.DEFAULT_QUEUE_SCOPE : queueScope, false); if (Strings.isEmpty(cmdName)) throw new IllegalArgumentException("cmdName is empty"); if (que != null) { que.publish(new GlobalCommandEvent(null, cmdName, args)); } }