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
  // public Listitem agregarDetail(IBeanAbstracto dto, Listbox lista, int
  // span,
  // String widthEstado, boolean aplicaEstado, boolean aplicaDetail,
  // String lblcaption, String... nobreColumnas) {
  //
  // Listitem detail = new Listitem();
  // Listhead columnas = new Listhead();
  // Groupbox gbox = new Groupbox();
  // Caption caption = new Caption(lblcaption);
  // gbox.appendChild(caption);
  //
  // Listcell cell1 = new Listcell();
  // Listcell cell2 = new Listcell();
  // cell2.setSpan(span);
  // if (aplicaDetail) {
  // Listheader deta = new Listheader();
  // deta.setWidth("20px");
  // deta.setAlign("center");
  // columnas.appendChild(deta);
  // }
  //
  // for (String nombreColumna : nobreColumnas) {
  // columnas.appendChild(new Listheader(nombreColumna));
  // }
  // if (aplicaEstado) {
  // if (widthEstado != "" && widthEstado != null) {
  // Listheader estado = new Listheader("Estado");
  // estado.setAlign(CENTER);
  // estado.setWidth(widthEstado);
  // columnas.appendChild(estado);
  // } else {
  // Listheader estado = new Listheader("Estado");
  // estado.setAlign(CENTER);
  // estado.setWidth("70px");
  // columnas.appendChild(estado);
  // }
  //
  // }
  // lista.appendChild(columnas);
  // gbox.appendChild(lista);
  // gbox.setStyle("overflow:auto");
  // cell2.appendChild(gbox);
  // detail.appendChild(cell1);
  // detail.appendChild(cell2);
  // detail.setVisible(false);
  //
  // return detail;
  // }
  //
  @SuppressWarnings("deprecation")
  public Listitem agregarDetail(
      IBeanAbstracto dto,
      Listbox lista,
      int span,
      String widthEstado,
      String lblCaption,
      boolean aplicaEstado,
      boolean aplicaDetail,
      String... nobreColumnas) {

    Listitem detail = new Listitem();
    Listhead columnas = new Listhead();
    Groupbox gbox = new Groupbox();
    Caption caption = new Caption();
    if (lblCaption != null) caption.setLabel(lblCaption);

    Listcell cell1 = new Listcell();
    Listcell cell2 = new Listcell();
    cell2.setSpan(span);
    if (aplicaDetail) {
      Listheader deta = new Listheader();
      deta.setWidth("30px");
      deta.setAlign("center");
      columnas.appendChild(deta);
    }

    for (String nombreColumna : nobreColumnas) {
      columnas.appendChild(new Listheader(nombreColumna));
    }
    if (aplicaEstado) {
      if (widthEstado != "" && widthEstado != null) {
        Listheader estado = new Listheader("Estado");
        estado.setAlign(CENTER);
        estado.setWidth(widthEstado);
        columnas.appendChild(estado);
      } else {
        Listheader estado = new Listheader("Estado");
        estado.setAlign(CENTER);
        estado.setWidth("70px");
        columnas.appendChild(estado);
      }
    }
    lista.setFixedLayout(true);
    lista.appendChild(columnas);
    gbox.appendChild(caption);
    gbox.appendChild(lista);
    gbox.setHflex("true");
    gbox.setContentStyle("overflow-x:auto");
    cell2.appendChild(gbox);
    detail.appendChild(cell1);
    detail.appendChild(cell2);
    detail.setVisible(false);

    return detail;
  }
예제 #3
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);
  }
예제 #4
0
  @Listen("onClick=#btn_atualiza, #btn_aberto, #btn_fechado")
  public void criaLista(Event event) {

    String itemId = event.getTarget().getId();
    ArrayList<Edital> editais = new ArrayList<>();

    if (itemId.equals("btn_atualiza")) {

      editais.addAll(new EditalDAO().getAll());

    } else if (itemId.equals("btn_aberto")) {

      editais.addAll(new EditalDAO().getOpened());

    } else {

      editais.addAll(new EditalDAO().getClosed());
    }

    // remove filhos da listbox
    listar_edital.getItems().clear();

    ListModelList<Edital> editalModel = new ListModelList<Edital>(editais);
    // cria model
    listar_edital.setModel(editalModel);

    // recria listbox
    try {

      Listhead lh = new Listhead();
      lh.appendChild(new Listheader("código edital"));
      lh.appendChild(new Listheader("projeto"));
      lh.appendChild(new Listheader("número de vagas"));
      lh.appendChild(new Listheader("data inicio"));
      lh.appendChild(new Listheader("data final"));

      listar_edital.appendChild(lh);

    } catch (Exception e) {
      // TODO: handle exception
    }

    listar_edital.setItemRenderer(
        new ListitemRenderer() {

          @Override
          public void render(Listitem listitem, Object data, int arg2) throws Exception {

            final Edital edital = (Edital) data;
            final Projeto projeto = new ProjetoDAO().getOneByCod(edital.getProjeto_cod());

            new Listcell(String.valueOf(edital.getCod())).setParent(listitem);
            new Listcell(projeto.getCod() + "-" + projeto.getDescricao()).setParent(listitem);
            new Listcell(String.valueOf(edital.getN_vagas())).setParent(listitem);
            new Listcell(edital.getData_inicio().toString()).setParent(listitem);
            new Listcell(edital.getData_fim().toString()).setParent(listitem);
          }
        });
  }
  /** Creates the components..<br> */
  private void createComponents() {

    /**
     * !! Windows as NameSpaceContainer to prevent not unique id's error from other dashboard module
     * buttons or other used components.
     */
    Window win = new Window();
    win.setBorder("none");
    win.setParent(this);

    Groupbox gb = new Groupbox();
    gb.setMold("3d");
    gb.setClosable(false);
    gb.setParent(win);
    Caption cap = new Caption();
    cap.setImage("/images/icons/new_icons_10.gif");
    cap.setLabel(Labels.getLabel("common.Application.History"));
    cap.setStyle("padding: 0px;");
    cap.setParent(gb);

    // Buttons Toolbar/Timer
    Div div = new Div();
    div.setSclass("z-toolbar");
    div.setStyle("padding: 0px");
    div.setParent(cap);
    Hbox hbox = new Hbox();
    hbox.setPack("stretch");
    hbox.setSclass("hboxRemoveWhiteStrips");
    hbox.setWidth("100%");
    hbox.setParent(div);
    Toolbar toolbarRight = new Toolbar();
    toolbarRight.setAlign("end");
    toolbarRight.setStyle("float:right; border-style: none;");
    toolbarRight.setParent(hbox);

    Hbox hboxBtn = new Hbox();
    hboxBtn.setSclass("hboxRemoveWhiteStrips");
    hboxBtn.setWidth("100%");
    hboxBtn.setParent(toolbarRight);

    //		Paging paging = new Paging();
    //		paging.setParent(hboxBtn);
    //		paging.setDetailed(true);

    if (isTimerControl()) {
      Button btnTimer = new Button();
      btnTimer.setId("btnTimer");
      btnTimer.setHeight("22px");
      btnTimer.setImage("/images/icons/clock1_16x16.gif");

      // convert to seconds
      int seconds = (int) Math.round(getDelay() / 1000);

      if (seconds > 60) {
        // convert to minutes and set localization to minutes
        int minutes = (int) Math.round((getDelay() / 1000) / 60);
        btnTimer.setTooltiptext(
            Labels.getLabel("btnTimer.tooltiptext")
                + " "
                + minutes
                + " "
                + Labels.getLabel("common.Minutes"));
      } else
        // set localization to seconds
        btnTimer.setTooltiptext(
            Labels.getLabel("btnTimer.tooltiptext")
                + " "
                + seconds
                + " "
                + Labels.getLabel("common.Seconds"));

      btnTimer.addEventListener("onClick", new BtnClickListener());
      btnTimer.setParent(hboxBtn);
    }

    Button btnRefresh = new Button();
    btnRefresh.setId("btnRefresh");
    btnRefresh.setHeight("22px");
    btnRefresh.setLabel("!");
    btnRefresh.setTooltiptext(Labels.getLabel("btnRefresh.tooltiptext"));
    btnRefresh.addEventListener("onClick", new BtnClickListener());
    btnRefresh.setParent(hboxBtn);
    // END Buttons Toolbar/Timer

    // body
    Borderlayout bl = new Borderlayout();
    bl.setHeight(getModulHeight() + "px");
    bl.setParent(gb);
    Center ct = new Center();
    ct.setSclass("FDCenterNoBorder");
    ct.setStyle("background-color: white");
    ct.setFlex(true);
    ct.setParent(bl);

    // Listbox
    listbox = new Listbox();
    listbox.setStyle("border: none;");
    listbox.setHeight("100%");
    listbox.setVisible(true);
    listbox.setParent(ct);
    listbox.setItemRenderer(new ItemRenderer());

    Listhead listhead = new Listhead();
    listhead.setParent(listbox);

    Listheader listheader1 = new Listheader();
    listheader1.setWidth("100px");
    listheader1.setHeight("0px");
    listheader1.setParent(listhead);

    Listheader listheader2 = new Listheader();
    listheader2.setWidth("100%");
    listheader1.setHeight("0px");
    listheader2.setParent(listhead);

    doReadData();
  }