示例#1
0
    public void select() {
      ComponentAgent parent = AuUtility.lookupEventTarget(target, Events.ON_SELECT);
      Set<String> items = new HashSet<String>();
      items.add(target.getUuid());

      String desktopId = target.getDesktop().getId();
      Event event =
          new SelectEvent(
              Events.ON_SELECT,
              (Component) parent.getDelegatee(),
              items,
              (Component) target.getDelegatee());
      Map<String, Object> data = EventDataManager.getInstance().build(event);
      ((ClientCtrl) target.getClient())
          .postUpdate(desktopId, event.getName(), parent.getUuid(), data, null);
    }
    public void render(int x, int y) {
      Listbox listbox = target.as(Listbox.class);
      if (x == -1) x = 0;
      if (y == -1) y = listbox.getItemCount() - 1;
      ArrayList<String> ids = new ArrayList<String>();
      while (true) {
        if (x > y) break;
        Listitem item = listbox.getItemAtIndex(x++);
        if (item != null && !item.isLoaded()) {
          ids.add(item.getUuid());
        }
      }
      if (ids.size() == 0) return;

      String desktopId = target.getDesktop().getId();
      String cmd = Events.ON_RENDER;
      Map<String, Object> data =
          EventDataManager.getInstance().build(new RenderEvent(cmd, new HashSet<String>(ids)));
      ((ClientCtrl) target.getClient()).postUpdate(desktopId, target.getUuid(), cmd, data, false);
      ((ClientCtrl) getClient()).flush(desktopId);
    };