Ejemplo n.º 1
0
  /*
   * 刷新topNList
   */
  private void refreshiControl() {
    ChartUtil.clearListbox(topNList);
    TopNListitemModel model = new TopNListitemModel(topNReport);
    //		ChartUtil.makelistData(topNList, model, model);

    try {
      for (TopNBean m : model.getTopNData()) {
        Image image = null;
        if (m.getDeny().equals("允许")) {
          image = new Image("/main/images/button/ico/enable_bt.gif");
        } else {
          image = new Image("/main/images/button/ico/disable_bt.gif");
        }
        Listitem item =
            ChartUtil.addRow(
                topNList,
                m,
                m.getTitle(),
                m.getDescript(),
                m.getPeriod(),
                new Image("/main/images/filetype/" + m.getFiletype() + ".gif"),
                image,
                m.getEditImage());
        item.setId(m.getSection());
        item.addForward("onClick", topNReport, "onSelecttopNList");
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    String section =
        (String) Executions.getCurrent().getDesktop().getSession().getAttribute("topNReportlit_id");

    if (null == section) return;

    Listitem selectedItem = null;
    for (Object obj : topNList.getItems()) {
      if (obj instanceof Listitem) {
        Listitem tmpItem = (Listitem) obj;
        if (tmpItem.getId().equals(section)) {
          selectedItem = tmpItem;
        }
      }
    }

    if (null != selectedItem) {
      selectedItem.setSelected(true);
      Events.sendEvent(new Event(Events.ON_SELECT, topNList));
      topNList.setActivePage(selectedItem);
    }
  }