コード例 #1
0
  @Override
  public Object enter() {
    navigator = ((AppEntry) UI.getCurrent()).getNavigation();
    // prepare data object
    cachedSource =
        new DbCachedSource<>(dbExecution, new ExecutionAccessor(), utils.getPageLength());
    ReadOnlyContainer c = new ReadOnlyContainer<>(cachedSource);
    c.sort(new Object[] {"id"}, new boolean[] {false});
    dataObject = new ExecutionListData(c);
    // prepare view
    Object viewObject = view.enter(this);
    refreshManager = ((AppEntry) UI.getCurrent()).getRefreshManager();
    refreshManager.addListener(
        RefreshManager.EXECUTION_MONITOR,
        new Refresher.RefreshListener() {
          private long lastRefreshFinished = 0;

          @Override
          public void refresh(Refresher source) {
            if (new Date().getTime() - lastRefreshFinished > RefreshManager.MIN_REFRESH_INTERVAL) {
              refreshEventHandler();
              LOG.debug("ExecutionMonitor refreshed.");
              lastRefreshFinished = new Date().getTime();
            }
          }
        });

    // set data object
    view.setDisplay(dataObject);

    // add initial name filter
    view.setFilter("owner.username", utils.getUserName());

    // return main component
    return viewObject;
  }
コード例 #2
0
 private ReadOnlyContainer<MessageRecord> getMessageDataSource() {
   return new ReadOnlyContainer<>(
       new DbCachedSource<>(dbMessageRecord, new MessageRecordAccessor(), utils.getPageLength()));
 }