コード例 #1
0
 /**
  * Removes a specific component from the register; effectively turning it off.
  *
  * <p>It's quite tricky to go through a cleanly rebind events and remove events, worry about
  * components that depend on this one, etc., so none of that happens here; handle it manually in
  * the component's shutdown() call.
  */
 public void removeComponent(Component c) throws Exception {
   c.shutdown();
   try {
     elementCache.remove(c.getContainer().getRootElement());
     idCache.remove(c.getContainer().getRootElement().getId());
   } catch (Exception e) {
   }
 }
コード例 #2
0
 /** Invoked async when a componet has been created. */
 public void componentCreated(Component c, String requestId) {
   Element root = c.getContainer().getRootElement();
   elementCache.put(root, c);
   if ((root.getId() != null) && (!root.getId().equals(""))) idCache.put(root.getId(), c);
   if (componentRequests.contains(requestId)) componentRequests.remove(requestId);
   if (componentRequests.size() == 0) componentCreationComplete();
 }
コード例 #3
0
 /** Returns a the first component of the given type. */
 public Component getComponentByType(String type) {
   Component rtn = null;
   for (Element root : elementCache.keySet()) {
     Component c = getComponent(root);
     if (c.getContainer().getType().equals(type)) {
       rtn = c;
       break;
     }
   }
   return (rtn);
 }