/** 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); }
/** 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); }
/** Tests if the specified event queue has been created. */ public static boolean exists(String name, String scope) { return lookup(name, scope, false) != null; }
/** 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; }
protected EventQueue<Event> getEventQueue() { return EventQueues.lookup(_quename, _quescope, true); }
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)); } }