コード例 #1
0
 public void onClick$btn_export() throws InterruptedException {
   try {
     Listbox listBox = new Listbox();
     Listhead listHeader = new Listhead();
     for (Object o : lb_user_org_list.getChildren()) {
       if (o instanceof Listhead) {
         Listhead head = (Listhead) o;
         for (Object o1 : head.getChildren()) {
           if (o1 instanceof Listheader) {
             Listheader header = (Listheader) o1;
             Listheader newHeader = new Listheader(header.getLabel());
             newHeader.setParent(listHeader);
           }
         }
         listHeader.setParent(listBox);
       }
     }
     listBox.setModel(
         new ListModelList(userOrgManager.getUserOrgListByID(bb_user_org.getValue())));
     ExportUtil.exportToExcel(
         globalUtils.getGlobalPropValue(Commons.SCREEN_USER_ORG_SEARCH), listBox);
   } catch (Exception e) {
     e.printStackTrace();
     GlobalUtils.showMessage(
         globalUtils.getMessagePropValue(Commons.ERR_MSG_EXPORT),
         globalUtils.getGlobalPropValue(Commons.MSG_HEADER_ERROR),
         Messagebox.OK,
         Messagebox.ERROR);
   }
 }
コード例 #2
0
  /**
   * Sets the listeners. <br>
   * <br>
   * 1. "onPaging" for the paging component. <br>
   * 2. "onSort" for all listheaders that have a sortDirection declared. <br>
   * All not used Listheaders must me declared as: listheader.setSortAscending("");
   * listheader.setSortDescending(""); <br>
   */
  private void setListeners(Listbox listBox) {

    // Add 'onPaging' listener to the paging component
    getPaging().addEventListener("onPaging", new OnPagingEventListener());

    final Listhead listhead = listBox.getListhead();
    final List<?> list = listhead.getChildren();

    final OnSortEventListener onSortEventListener = new OnSortEventListener();
    for (final Object object : list) {
      if (object instanceof Listheader) {
        final Listheader lheader = (Listheader) object;

        if (lheader.getSortAscending() != null || lheader.getSortDescending() != null) {
          lheader.addEventListener("onSort", onSortEventListener);
        }
      }
    }
    listBox.setModel(this);
  }