Пример #1
0
 @Override
 public void setSnapshot(SnapshotInstance snapshot) {
   super.setSnapshot(snapshot);
   loadSnapshotParameters();
   if (snapshot != null) {
     if (snapshot.getSnapshotTaken() == null) {
       takeSnapshot();
     } else {
       if (store != null && localStore) store.getLoader().load();
     }
   }
 }
Пример #2
0
  @Override
  public void addPanelContent() {
    //		contentPanel = new ContentPanel();
    contentPanel.setLayout(new FitLayout());
    //		contentPanel.setHeading("Snapshot Terms Chart View");
    IconSupplier.setIcon(contentPanel, IconSupplier.getPieChartIconName());

    if (store == null) store = getNewStore();

    if (chart == null) createChart();

    addHelpTool(contentPanel);
    contentPanel.getHeader().addTool(getParametersTool());

    contentPanel.setTopComponent(getButtonsBar());

    contentPanel.add(chart, new MarginData(20));

    add(contentPanel);

    if (snapshot != null && localStore) store.getLoader().load();
  }
Пример #3
0
  @SuppressWarnings({"unchecked", "rawtypes"})
  protected void initData(ListStore ds, ColumnModel cm) {
    if (liveStoreListener == null) {
      liveStoreListener =
          new StoreListener<ModelData>() {

            public void storeDataChanged(StoreEvent<ModelData> se) {
              liveStoreOffset = loader.getOffset();

              if (totalCount != loader.getTotalCount()) {
                totalCount = loader.getTotalCount();
                int height = totalCount * getCalculatedRowHeight();
                // 1000000 as browser maxheight hack
                int count = height / 1000000;
                int h = 0;

                StringBuilder sb = new StringBuilder();

                if (count > 0) {
                  h = height / count;

                  for (int i = 0; i < count; i++) {
                    sb.append("<div style=\"width: ");
                    sb.append(XDOM.getScrollBarWidth());
                    sb.append("px; height:");
                    sb.append(h);
                    sb.append("px;\">&nbsp;</div>");
                  }
                }
                int diff = height - count * h;
                if (diff != 0) {
                  sb.append("<div style=\"width: ");
                  sb.append(XDOM.getScrollBarWidth());
                  sb.append("px; height:");
                  sb.append(diff);
                  sb.append("px;\"></div>");
                }
                liveScroller.setInnerHtml(sb.toString());
              }
              if (totalCount > 0 && viewIndexReload != -1 && !isCached(viewIndexReload)) {
                loadLiveStore(getLiveStoreCalculatedIndex(viewIndexReload));
              } else {
                viewIndexReload = -1;
                ignoreScroll = true;
                int scrollTop = liveScroller.getScrollTop();
                liveScroller.setScrollTop(scrollTop - 1);
                liveScroller.setScrollTop(scrollTop);
                ignoreScroll = false;
                updateRows(viewIndex, true);
                isLoading = false;
                if (isMasked) {
                  isMasked = false;
                  scroller.unmask();
                }
              }
            }

            public void storeUpdate(StoreEvent<ModelData> se) {
              LiveGridView.this.ds.update(se.getModel());
            }
          };
    }
    if (liveStore != null) {
      liveStore.removeStoreListener(liveStoreListener);
    }
    liveStore = ds;
    super.initData(
        new ListStore() {
          @Override
          public boolean equals(ModelData model1, ModelData model2) {
            return LiveGridView.this.liveStore.equals(model1, model2);
          }

          @Override
          public ModelKeyProvider getKeyProvider() {
            return LiveGridView.this.liveStore.getKeyProvider();
          }

          @Override
          public Record getRecord(ModelData model) {
            return LiveGridView.this.liveStore.getRecord(model);
          }

          @Override
          public boolean hasRecord(ModelData model) {
            return LiveGridView.this.liveStore.hasRecord(model);
          }

          @Override
          public void sort(String field, SortDir sortDir) {
            LiveGridView.this.liveStore.sort(field, sortDir);
            sortInfo = liveStore.getSortState();
          }
        },
        cm);

    loader = (PagingLoader) liveStore.getLoader();
    liveStore.addStoreListener(liveStoreListener);
    grid.getSelectionModel().bind(this.ds);
  }