private void cargarUsuarios(List<Usuario> lstUsuarios, boolean flagLimpiar) {

    IndexedContainer container = new IndexedContainer();
    container.addContainerProperty("id", Long.class, null);
    container.addContainerProperty("usuario", String.class, null);
    container.addContainerProperty("clave", String.class, null);
    container.addContainerProperty("nombres", String.class, null);
    container.addContainerProperty("apePat", String.class, null);
    container.addContainerProperty("apeMat", String.class, null);
    container.addContainerProperty("cargo", String.class, null);
    container.addContainerProperty("descCargo", String.class, null);
    container.addContainerProperty("rol", Rol.class, null);
    container.addContainerProperty("policia", Policia.class, null);
    container.addContainerProperty("dependencia", Dependencia.class, null);
    container.addContainerProperty("oficina.id", Long.class, null);
    container.addContainerProperty("oficina.nombre", String.class, null);
    container.addContainerProperty("rol.id", Long.class, null);

    tblUsuarios.setContainerDataSource(container);
    tblUsuarios.setVisibleColumns(
        new Object[] {"usuario", "nombres", "apePat", "apeMat", "cargo", "oficina.nombre"});

    tblUsuarios.setColumnWidth("usuario", 50);
    tblUsuarios.setColumnWidth("nombres", 75);
    tblUsuarios.setColumnWidth("apePat", 75);
    tblUsuarios.setColumnWidth("apeMat", 75);
    tblUsuarios.setColumnWidth("cargo", 130);
    tblUsuarios.setColumnWidth("oficina.nombre", 160);

    tblUsuarios.setColumnHeader("usuario", "Usuario");
    tblUsuarios.setColumnHeader("nombres", "Nombres");
    tblUsuarios.setColumnHeader("apePat", "Ape. Paterno");
    tblUsuarios.setColumnHeader("apeMat", "Ape. Materno");
    tblUsuarios.setColumnHeader("cargo", "Cargo");
    tblUsuarios.setColumnHeader("oficina.nombre", "Oficina");

    int con = 1;
    for (Usuario usuario : lstUsuarios) {
      Item item = container.addItem(con++);
      item.getItemProperty("id").setValue(usuario.getId());
      item.getItemProperty("usuario").setValue(usuario.getUsuario());
      item.getItemProperty("clave").setValue(usuario.getClave());
      item.getItemProperty("nombres").setValue(usuario.getNombres());
      item.getItemProperty("apePat").setValue(usuario.getApePat());
      item.getItemProperty("apeMat").setValue(usuario.getApeMat());
      item.getItemProperty("rol").setValue(usuario.getRol());
      item.getItemProperty("cargo").setValue(usuario.getCargo());
      item.getItemProperty("dependencia").setValue(usuario.getOficina());
      item.getItemProperty("policia").setValue(usuario.getPolicia());
      item.getItemProperty("descCargo").setValue(usuario.getDescCargo());
      item.getItemProperty("rol.id")
          .setValue(usuario.getRol() != null ? usuario.getRol().getId() : null);
      item.getItemProperty("oficina.id")
          .setValue(usuario.getOficina() != null ? usuario.getOficina().getId() : null);
      item.getItemProperty("oficina.nombre")
          .setValue(usuario.getOficina() != null ? usuario.getOficina().getNombre() : null);
    }
    limpiar();
  }
Esempio n. 2
0
  protected Table createList() {
    groupTable = new Table();

    groupTable.setEditable(false);
    groupTable.setImmediate(true);
    groupTable.setSelectable(true);
    groupTable.setNullSelectionAllowed(false);
    groupTable.setSortDisabled(true);
    groupTable.setSizeFull();

    groupListQuery = new GroupListQuery();
    groupListContainer = new LazyLoadingContainer(groupListQuery, 20);
    groupTable.setContainerDataSource(groupListContainer);

    // Column headers
    groupTable.addGeneratedColumn("icon", new ThemeImageColumnGenerator(Images.GROUP_22));
    groupTable.setColumnWidth("icon", 22);
    groupTable.addContainerProperty("name", String.class, null);
    groupTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);

    // Listener to change right panel when clicked on a user
    groupTable.addListener(
        new Property.ValueChangeListener() {
          private static final long serialVersionUID = 1L;

          public void valueChange(ValueChangeEvent event) {
            Item item =
                groupTable.getItem(
                    event
                        .getProperty()
                        .getValue()); // the value of the property is the itemId of the table entry
            if (item != null) {
              String groupId = (String) item.getItemProperty("id").getValue();
              setDetailComponent(new GroupDetailPanel(GroupPage.this, groupId));

              // Update URL
              ExplorerApp.get()
                  .setCurrentUriFragment(new UriFragment(GroupNavigator.GROUP_URI_PART, groupId));
            } else {
              // Nothing is selected
              setDetailComponent(null);
              ExplorerApp.get()
                  .setCurrentUriFragment(new UriFragment(GroupNavigator.GROUP_URI_PART, groupId));
            }
          }
        });

    return groupTable;
  }
  protected Table createList() {
    // customerService =  ProcessEngines.getDefaultProcessEngine().getCustomerService();
    // customerService.newUser("hebele");
    Table table = new Table();

    table.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_LIST);
    // table.addGeneratedColumn("icon", new ThemeImageColumnGenerator(Images.REPORT_22));
    table.setColumnWidth("icon", 18);

    // table.addContainerProperty("name", String.class, null);
    table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);

    // Set non-editable, selectable and full-size
    table.setEditable(false);
    table.setImmediate(true);
    table.setSelectable(true);
    table.setNullSelectionAllowed(false);
    table.setSortDisabled(true);
    table.setSizeFull();

    return table;
  }
  protected void addTasks() {
    Label header = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_HEADER_TASKS));
    header.addStyleName(ExplorerLayout.STYLE_H3);
    header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    header.addStyleName(ExplorerLayout.STYLE_NO_LINE);
    panelLayout.addComponent(header);

    panelLayout.addComponent(new Label("&nbsp;", Label.CONTENT_XHTML));

    Table taskTable = new Table();
    taskTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST);
    taskTable.setWidth(100, UNITS_PERCENTAGE);

    // Fetch all tasks
    List<HistoricTaskInstance> tasks =
        historyService
            .createHistoricTaskInstanceQuery()
            .processInstanceId(processInstance.getId())
            .orderByHistoricTaskInstanceEndTime()
            .desc()
            .orderByHistoricTaskInstanceStartTime()
            .desc()
            .list();

    if (tasks.size() > 0) {

      // Finished icon
      taskTable.addContainerProperty(
          "finished", Component.class, null, "", null, Table.ALIGN_CENTER);
      taskTable.setColumnWidth("finished", 22);

      taskTable.addContainerProperty(
          "name",
          String.class,
          null,
          i18nManager.getMessage(Messages.TASK_NAME),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "priority",
          Integer.class,
          null,
          i18nManager.getMessage(Messages.TASK_PRIORITY),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "assignee",
          Component.class,
          null,
          i18nManager.getMessage(Messages.TASK_ASSIGNEE),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "dueDate",
          Component.class,
          null,
          i18nManager.getMessage(Messages.TASK_DUEDATE),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "startDate",
          Component.class,
          null,
          i18nManager.getMessage(Messages.TASK_CREATE_TIME),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "endDate",
          Component.class,
          null,
          i18nManager.getMessage(Messages.TASK_COMPLETE_TIME),
          null,
          Table.ALIGN_LEFT);

      panelLayout.addComponent(taskTable);
      panelLayout.setExpandRatio(taskTable, 1.0f);

      for (HistoricTaskInstance task : tasks) {
        addTaskItem(task, taskTable);
      }

      taskTable.setPageLength(taskTable.size());
    } else {
      // No tasks
      Label noTaskLabel = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_NO_TASKS));
      panelLayout.addComponent(noTaskLabel);
    }
  }
  private void cargarDatos() {
    Notificacion notificacionBuscar = new Notificacion();
    notificacionBuscar.setInforme(informe);
    List<Notificacion> notificaciones = notificacionService.buscar(notificacionBuscar);

    IndexedContainer container = new IndexedContainer();
    container.addContainerProperty(COLUMNA_UNIDAD_PROCURADURIA, String.class, null);
    container.addContainerProperty(COLUMNA_TIPO_NOTIFICACION, String.class, null);
    container.addContainerProperty(COLUMNA_FECHA_RECEPCION, String.class, null);
    container.addContainerProperty(COLUMNA_FECHA_VENCIMIENTO, String.class, null);
    container.addContainerProperty(COLUMNA_FECHA_PLAZO, String.class, null);
    container.addContainerProperty(COLUMNA_ESTADO_NOTIFICACION, String.class, null);
    container.addContainerProperty(COLUMNA_OPCION_ELIMINAR, Button.class, null);
    container.addContainerProperty(COLUMNA_OPCION_SEGUIMIENTO, Button.class, null);

    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");

    int con = 1;
    for (final Notificacion notificacion : notificaciones) {
      Item item = container.addItem(con++);
      item.getItemProperty(COLUMNA_UNIDAD_PROCURADURIA)
          .setValue(notificacion.getUnidad() == null ? null : notificacion.getUnidad().getNombre());
      item.getItemProperty(COLUMNA_TIPO_NOTIFICACION)
          .setValue(
              notificacion.getTipoNotificacion() == null
                  ? null
                  : notificacion.getTipoNotificacion().getNombre());
      item.getItemProperty(COLUMNA_FECHA_RECEPCION)
          .setValue(
              notificacion.getFechaRecepcion() == null
                  ? null
                  : df.format(notificacion.getFechaRecepcion()));
      item.getItemProperty(COLUMNA_FECHA_VENCIMIENTO)
          .setValue(
              notificacion.getFechaVencimiento() == null
                  ? null
                  : df.format(notificacion.getFechaVencimiento()));
      item.getItemProperty(COLUMNA_FECHA_PLAZO)
          .setValue(
              notificacion.getFechaPlazo() == null
                  ? null
                  : df.format(notificacion.getFechaPlazo()));
      item.getItemProperty(COLUMNA_ESTADO_NOTIFICACION)
          .setValue(notificacion.getEstado() == null ? null : notificacion.getEstado().getNombre());
      Button eliminar = new Button();
      eliminar.setCaption("Eliminar");
      eliminar.addListener(
          new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
              notificacionService.eliminar(notificacion);
              cargarDatos();
            }
          });
      item.getItemProperty(COLUMNA_OPCION_ELIMINAR).setValue(eliminar);
      Button seguimiento = new Button();
      seguimiento.setCaption("Seguimiento");
      seguimiento.addListener(
          new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {

              PanelRegistroInformeSeguimientoNotificacion
                  panelRegistroInformeSeguimientoNotificacion =
                      new PanelRegistroInformeSeguimientoNotificacion(notificacion);

              Window wdSeguimiento = new Window();

              wdSeguimiento.setModal(true);
              wdSeguimiento.setResizable(false);
              wdSeguimiento.addComponent(panelRegistroInformeSeguimientoNotificacion);

              wdSeguimiento.setCaption("Seguimiento");
              wdSeguimiento.setWidth("1050px");
              getApplication().getMainWindow().getWindow().addWindow(wdSeguimiento);
            }
          });
      item.getItemProperty(COLUMNA_OPCION_SEGUIMIENTO).setValue(seguimiento);
    }

    tblNotificacion.setContainerDataSource(container);
    tblNotificacion.setVisibleColumns(
        new Object[] {
          COLUMNA_UNIDAD_PROCURADURIA,
          COLUMNA_TIPO_NOTIFICACION,
          COLUMNA_FECHA_RECEPCION,
          COLUMNA_FECHA_VENCIMIENTO,
          COLUMNA_FECHA_PLAZO,
          COLUMNA_ESTADO_NOTIFICACION,
          COLUMNA_OPCION_ELIMINAR,
          COLUMNA_OPCION_SEGUIMIENTO
        });
    tblNotificacion.setColumnWidth(COLUMNA_UNIDAD_PROCURADURIA, 100);
    tblNotificacion.setColumnWidth(COLUMNA_TIPO_NOTIFICACION, 100);
    tblNotificacion.setColumnWidth(COLUMNA_FECHA_RECEPCION, 100);
    tblNotificacion.setColumnWidth(COLUMNA_FECHA_VENCIMIENTO, 100);
    tblNotificacion.setColumnWidth(COLUMNA_FECHA_PLAZO, 100);
    tblNotificacion.setColumnWidth(COLUMNA_ESTADO_NOTIFICACION, 100);
    tblNotificacion.setColumnWidth(COLUMNA_OPCION_ELIMINAR, 100);
    tblNotificacion.setColumnWidth(COLUMNA_OPCION_SEGUIMIENTO, 100);
    tblNotificacion.setColumnHeader(COLUMNA_UNIDAD_PROCURADURIA, "Unidad");
    tblNotificacion.setColumnHeader(COLUMNA_TIPO_NOTIFICACION, "Tipo");
    tblNotificacion.setColumnHeader(COLUMNA_FECHA_RECEPCION, "F. Recepcion");
    tblNotificacion.setColumnHeader(COLUMNA_FECHA_VENCIMIENTO, "F. Vencimiento");
    tblNotificacion.setColumnHeader(COLUMNA_FECHA_PLAZO, "F. Plazo");
    tblNotificacion.setColumnHeader(COLUMNA_ESTADO_NOTIFICACION, "Estado");
    tblNotificacion.setColumnHeader(COLUMNA_OPCION_ELIMINAR, "");
    tblNotificacion.setColumnHeader(COLUMNA_OPCION_SEGUIMIENTO, "");
  }
Esempio n. 6
0
  public void initUI() {
    try {
      setModal(true);
      VerticalLayout layout = (VerticalLayout) this.getContent();
      layout.setMargin(true);
      layout.setSpacing(true);
      layout.setStyleName(Reindeer.LAYOUT_WHITE);

      processesComboBox =
          new ComboBox(
              ProcessbaseApplication.getCurrent().getPbMessages().getString("processToCategory"));
      processesComboBox.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS);
      //            processesComboBox.setItemCaptionPropertyId("name");
      processesComboBox.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_EXPLICIT);
      processesComboBox.setWidth("100%");

      bar.setWidth("100%");
      bar.addComponent(processesComboBox);
      bar.setExpandRatio(processesComboBox, 1);

      addBtn =
          new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnAdd"), this);
      bar.addComponent(addBtn);
      bar.setComponentAlignment(addBtn, Alignment.BOTTOM_RIGHT);

      layout.addComponent(bar);
      layout.addComponent(table);

      deleteBtn =
          new Button(
              ProcessbaseApplication.getCurrent().getPbMessages().getString("btnDelete"), this);
      deleteBtn.setDescription(
          ProcessbaseApplication.getCurrent().getPbMessages().getString("deleteCategory"));
      cancelBtn =
          new Button(
              ProcessbaseApplication.getCurrent().getPbMessages().getString("btnCancel"), this);
      saveBtn =
          new Button(
              ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSave"), this);
      buttons.addButton(deleteBtn);
      buttons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_RIGHT);
      buttons.addButton(saveBtn);
      buttons.setComponentAlignment(saveBtn, Alignment.MIDDLE_RIGHT);
      buttons.setExpandRatio(saveBtn, 1);
      buttons.addButton(cancelBtn);
      buttons.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);
      buttons.setMargin(false);
      buttons.setHeight("30px");
      buttons.setWidth("100%");
      addComponent(buttons);
      setWidth("70%");
      //            setHeight("70%");
      setResizable(false);

      table.addContainerProperty(
          "name",
          String.class,
          null,
          ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionProcessName"),
          null,
          null);
      table.setColumnExpandRatio("name", 1);
      table.addContainerProperty(
          "version",
          String.class,
          null,
          ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionVersion"),
          null,
          null);
      table.setColumnWidth("version", 50);
      table.addContainerProperty(
          "deployedBy",
          String.class,
          null,
          ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionDeployedBy"),
          null,
          null);
      table.addContainerProperty(
          "actions",
          TableLinkButton.class,
          null,
          ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionActions"),
          null,
          null);
      table.setColumnWidth("actions", 50);
      table.setSelectable(false);
      table.setImmediate(true);
      table.setWidth("100%");
      table.setPageLength(10);
      refreshTable();
    } catch (Exception ex) {
      ex.printStackTrace();
      showError(ex.getMessage());
    }
  }