@AutoGenerated
  private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("400px");
    mainLayout.setHeight("300px");

    // top-level component properties
    setWidth("400px");
    setHeight("300px");

    // btn_editar
    btn_editar = new Button();
    btn_editar.setCaption("Editar");
    btn_editar.setImmediate(true);
    btn_editar.setWidth("280px");
    btn_editar.setHeight("-1px");
    mainLayout.addComponent(btn_editar, "top:234.0px;left:60.0px;");

    // tableMaterias
    tableMaterias = new Table();
    tableMaterias.setImmediate(false);
    tableMaterias.setWidth("100.0%");
    tableMaterias.setHeight("200px");
    mainLayout.addComponent(tableMaterias, "top:20.0px;right:60.0px;left:60.0px;");

    return mainLayout;
  }
Example #2
0
  public void refreshTable() {
    try {
      table.removeAllItems();
      Collection<LightProcessDefinition> processes =
          ProcessbaseApplication.getCurrent()
              .getBpmModule()
              .getLightProcessDefinitions(ProcessState.ENABLED);

      for (LightProcessDefinition pd : processes) {
        if (pd.getCategoryNames().contains(category.getName())) {
          addTableRow(pd);
        } else {
          Item woItem = processesComboBox.addItem(pd);
          String caption = pd.getLabel() != null ? pd.getLabel() : pd.getName();
          processesComboBox.setItemCaption(pd, caption + " (version " + pd.getVersion() + ")");
        }
      }
      table.setSortContainerPropertyId("name");
      table.setSortAscending(true);
      table.sort();
    } catch (Exception ex) {
      ex.printStackTrace();
      showError(ex.getMessage());
    }
  }
  public GridLayout getGridView(String[] headerTable) {

    List reportData = report.dataReport();
    if (reportData.isEmpty()) {
      return new GridLayout();
    }

    GridLayout grid = new GridLayout(1, 2 * reportData.size());

    Iterator iterator = reportData.iterator();
    while (iterator.hasNext()) {
      Object[] row = (Object[]) iterator.next();

      for (int i = 0; i < row.length - 1; i++) {
        grid.addComponent(new Label(row[i].toString()));
      }

      Table table = fillTable(headerTable, (List) row[row.length - 1]);
      table.setWidth("100%");
      grid.addComponent(table);
      grid.setComponentAlignment(
          table, new Alignment(Bits.ALIGNMENT_VERTICAL_CENTER | Bits.ALIGNMENT_HORIZONTAL_CENTER));
    }

    return grid;
  }
Example #4
0
 // Load Purchase Detail
 private void loadPurDtl() {
   try {
     logger.info(
         "Company ID : " + companyid + " | User Name : " + username + " > " + "Loading Search...");
     recordCnt = listEnqDtls.size();
     beanPurEnqDtlDM = new BeanItemContainer<SmsPurEnqDtlDM>(SmsPurEnqDtlDM.class);
     beanPurEnqDtlDM.addAll(listEnqDtls);
     logger.info(
         "Company ID : "
             + companyid
             + " | User Name : "
             + username
             + " > "
             + "Got the dPurDt. result set");
     tblSmsEnqDtl.setContainerDataSource(beanPurEnqDtlDM);
     tblSmsEnqDtl.setVisibleColumns(
         new Object[] {
           "pordName", "productUom", "enquiryQty", "enqDtlStaus", "lastUpdateddt", "lastUpdatedby"
         });
     tblSmsEnqDtl.setColumnHeaders(
         new String[] {
           "Product Name", "UOM", "Enquiry Qty", "Status", "Last Updated Date", "Last Updated By"
         });
     tblSmsEnqDtl.setColumnFooter("lastUpdatedby", "No.of Records : " + recordCnt);
     tblSmsEnqDtl.setPageLength(7);
   } catch (Exception e) {
     logger.info(e.getMessage());
   }
 }
  @AutoGenerated
  private VerticalLayout buildVerticalLayout_2() {
    // common part: create layout
    verticalLayout_2 = new VerticalLayout();
    verticalLayout_2.setImmediate(false);
    verticalLayout_2.setWidth("-1px");
    verticalLayout_2.setHeight("-1px");
    verticalLayout_2.setMargin(false);

    // label_1
    label_1 = new Label();
    label_1.setStyleName("h1");
    label_1.setImmediate(false);
    label_1.setWidth("-1px");
    label_1.setHeight("-1px");
    label_1.setValue("Filtro de Busqueda de Usuarios");
    verticalLayout_2.addComponent(label_1);

    // horizontalLayout_3
    horizontalLayout_3 = buildHorizontalLayout_3();
    verticalLayout_2.addComponent(horizontalLayout_3);

    // tblUsuarios
    tblUsuarios = new Table();
    tblUsuarios.setImmediate(false);
    tblUsuarios.setWidth("650px");
    tblUsuarios.setHeight("430px");
    verticalLayout_2.addComponent(tblUsuarios);

    return verticalLayout_2;
  }
  /**
   * Assigns this as the context menu of given table. Allows context menu to appear only on certain
   * parts of the table.
   *
   * @param table
   * @param onRow show context menu when row is clicked
   * @param onHeader show context menu when header is clicked
   * @param onFooter show context menu when footer is clicked
   */
  public void setAsTableContextMenu(
      final Table table, final boolean onRow, final boolean onHeader, final boolean onFooter) {
    extend(table);

    setOpenAutomatically(false);

    if (onRow) {
      table.addItemClickListener(
          new ItemClickEvent.ItemClickListener() {
            private static final long serialVersionUID = -348059189217149508L;

            @Override
            public void itemClick(ItemClickEvent event) {
              if (event.getButton() == MouseButton.RIGHT) {
                events.preContextMenuOpen();
                fireEvent(
                    new ContextMenuOpenedOnTableRowEvent(
                        TableContextMenu.this, table, event.getItemId(), event.getPropertyId()));
                open(event.getClientX(), event.getClientY());
              }
            }
          });
    }

    if (onHeader) {
      table.addHeaderClickListener(
          new HeaderClickListener() {
            private static final long serialVersionUID = -5880755689414670581L;

            @Override
            public void headerClick(HeaderClickEvent event) {
              if (event.getButton() == MouseButton.RIGHT) {
                events.preContextMenuOpen();
                fireEvent(
                    new ContextMenuOpenedOnTableHeaderEvent(
                        TableContextMenu.this, table, event.getPropertyId()));
                open(event.getClientX(), event.getClientY());
              }
            }
          });
    }

    if (onFooter) {
      table.addFooterClickListener(
          new FooterClickListener() {
            private static final long serialVersionUID = 2884227013964132482L;

            @Override
            public void footerClick(FooterClickEvent event) {
              if (event.getButton() == MouseButton.RIGHT) {
                events.preContextMenuOpen();
                fireEvent(
                    new ContextMenuOpenedOnTableHeaderEvent(
                        TableContextMenu.this, table, event.getPropertyId()));
                open(event.getClientX(), event.getClientY());
              }
            }
          });
    }
  }
 private void buildColumns() {
   gameResultTable.addGeneratedColumn("Round", GameCoulmnHelper.getRoundColmun());
   gameResultTable.addGeneratedColumn(
       PlayerType.FACTORY.toString() + " order",
       GameCoulmnHelper.getPlayerOrderColumn(PlayerType.FACTORY));
   gameResultTable.addGeneratedColumn(
       PlayerType.FACTORY.toString() + " score",
       GameCoulmnHelper.getPlayerScoreColumn(PlayerType.FACTORY));
   gameResultTable.addGeneratedColumn(
       PlayerType.DISTRIBUTOR.toString() + " order",
       GameCoulmnHelper.getPlayerOrderColumn(PlayerType.DISTRIBUTOR));
   gameResultTable.addGeneratedColumn(
       PlayerType.DISTRIBUTOR.toString() + " score",
       GameCoulmnHelper.getPlayerScoreColumn(PlayerType.DISTRIBUTOR));
   gameResultTable.addGeneratedColumn(
       PlayerType.WHOLESALER.toString() + " order",
       GameCoulmnHelper.getPlayerOrderColumn(PlayerType.WHOLESALER));
   gameResultTable.addGeneratedColumn(
       PlayerType.WHOLESALER.toString() + " score",
       GameCoulmnHelper.getPlayerOrderColumn(PlayerType.WHOLESALER));
   gameResultTable.addGeneratedColumn(
       PlayerType.RETAILER.toString() + " order",
       GameCoulmnHelper.getPlayerOrderColumn(PlayerType.RETAILER));
   gameResultTable.addGeneratedColumn(
       PlayerType.RETAILER.toString() + " score",
       GameCoulmnHelper.getPlayerOrderColumn(PlayerType.RETAILER));
   gameResultTable.addGeneratedColumn("Total score", GameCoulmnHelper.getScoreColumn());
 }
  @Override
  protected Component getChart() {
    List<StockData> data = new LinkedList<StockData>();
    for (int i = 0; i < 200; i++) {
      data.addAll(getStockData());
    }

    Container container = new BeanItemContainer<StockData>(StockData.class, data);

    Table table = new Table();
    table.setContainerDataSource(container);
    table.addGeneratedColumn(
        "values",
        new Table.ColumnGenerator() {
          @Override
          public Object generateCell(Table source, Object itemId, Object columnId) {
            return new Sparkline(
                100, 20, (Number[]) source.getItem(itemId).getItemProperty(columnId).getValue());
          }
        });

    table.setVisibleColumns("month", "values", "latest");
    table.setHeightUndefined();

    return table;
  }
  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();
  }
Example #10
0
  public void notifyGroupChanged(String groupId) {
    // Clear cache
    groupTable.removeAllItems();
    groupListContainer.removeAllItems();

    // select changed group
    groupTable.select(groupListContainer.getIndexForObjectId(groupId));
  }
Example #11
0
  @Override
  protected void configureTable(Table table) {
    table.setContainerDataSource(getTableContainer());

    setupGeneratedColumns(table);
    table.setVisibleColumns(new Object[] {"name", "playerCount", "roundCount", "gameCount"});
    table.setColumnHeaders(new String[] {"Name", "Players", "Rounds", "Games"});
  }
Example #12
0
 private void recargarListaAvance() {
   tblAvance.removeAllItems();
   for (int i = 0; i < listaAvance.size(); i++) {
     LinkedList<Object> avance = listaAvance.get(i);
     avance.set(0, i + 1);
     tblAvance.addItem(avance.toArray(), null);
   }
 }
 public void onRemoveUser() {
   // check if a user is selected in the table
   Table userList = this.view.getUserList();
   Object selected = userList.getValue();
   if (selected != null) {
     this.container.removeItem(selected);
   }
 }
 public void cargarMaterias(List<MateriaBO> listMaterias) {
   this.listMaterias = new ArrayList<>();
   tableMaterias.removeAllItems();
   this.listMaterias = listMaterias;
   for (int i = 0; i < this.listMaterias.size(); i++) {
     MateriaBO bloqueBO = listMaterias.get(i);
     tableMaterias.addItem(new Object[] {bloqueBO}, new Integer(i));
   }
 }
Example #15
0
 @Override
 public void containerItemSetChange(final ItemSetChangeEvent event) {
   if (!(field instanceof Table)) {
     return;
   }
   final Table table = (Table) field;
   saveButton.setEnabled(
       isSaveButtonEnabledAfterValueChange(table, table.getContainerDataSource().getItemIds()));
 }
Example #16
0
 private void deleteDetails() {
   SmsPurEnqDtlDM save = new SmsPurEnqDtlDM();
   if (tblSmsEnqDtl.getValue() != null) {
     save = beanPurEnqDtlDM.getItem(tblSmsEnqDtl.getValue()).getBean();
     listEnqDtls.remove(save);
     enqDtlresetFields();
     loadPurDtl();
     btndelete.setEnabled(false);
   }
 }
  public void setTableProperties() {

    setVisibleTableProperties("selected", "recapno", "divisionBean", "invoicedate");

    //		table.setColumnCollapsingAllowed(true);
    //		try{
    //			table.setColumnCollapsed("state", true);
    //			table.setColumnCollapsed("birthDate", true);
    //			table.setColumnCollapsed("joinDate", true);
    //
    //		} catch(Exception ex){}

    // ALIGNMENT
    table.setColumnAlignment("id", Align.CENTER);
    table.setColumnAlignment("invoicedate", Align.CENTER);
    table.setColumnAlignment("closing", Align.CENTER);
    table.setColumnAlignment("entrydate", Align.CENTER);

    // SET HEADER
    table.setColumnHeader("selected", "<input type='checkbox'/>");
    table.setColumnHeader("id", "DIV-REFNO");
    table.setColumnHeader("divisionBean", "DIVISI");
    table.setColumnHeader("invoicedate", "RECAP/INV. DATE");
    table.setColumnHeader("recapno", "NO. REKAP");

    //		table.setColumnExpandRatio("selected", 2);
    //		table.setColumnExpandRatio("recapno", 3);

  }
  public void initializeTable() {
    Set<DocumentObject> documentSet = this.beanItem.getBean().getDocumentObjectList();

    fileTable.removeAllItems();
    for (DocumentObject document : documentSet) {
      if (document.getStateEnable())
        fileTable.addItem(
            new Object[] {document.getName() + '.' + document.getExtension(), document.getSize()},
            document);
    }
  }
Example #19
0
  /** Tests if setting the footer visibility works properly */
  public void testFooterVisibility() {
    Table table = new Table("Test table", createContainer());

    // The footer should by default be hidden
    assertFalse(table.isFooterVisible());

    // Set footer visibility to tru should be reflected in the
    // isFooterVisible() method
    table.setFooterVisible(true);
    assertTrue(table.isFooterVisible());
  }
 @Override
 protected void initView() {
   super.initView();
   processTable = new Table();
   dataSource = new BeanItemContainer<ProcessDefinition>(ProcessDefinition.class);
   processTable.setContainerDataSource(dataSource);
   processTable.setVisibleColumns(
       new String[] {"name", "key", "version", "resourceName", "category"});
   processTable.setSizeFull();
   processTable.addGeneratedColumn("name", createNameColumnGenerator());
   getViewLayout().addComponent(processTable);
   getViewLayout().setExpandRatio(processTable, 1.0F);
 }
    @Override
    public List<List<String>> getSummary(String page, Object object) {
      List<List<String>> list = null;
      if (page.equals("viewOrganization.jsp")) {
        if (!(object instanceof Unit)) {
          return null;
        }

        Unit unit = (Unit) object;
        Person currentUser = UserView.getCurrentUser().getExpenditurePerson();
        if (!(unit.isResponsible(currentUser)
            || unit.getObserversSet().contains(currentUser)
            || UserView.getCurrentUser().hasRoleType(RoleType.MANAGER))) {
          return null;
        }

        list = new ArrayList<List<String>>();
        list.add(new ArrayList<String>());
        list.add(new ArrayList<String>());

        ReportViewerComponent projectSummary;
        Project project = getProjectFromID(unit.getExternalId());
        if (project != null) {
          String projectCode = project.getProjectCode();
          System.out.println(projectCode);

          projectSummary =
              new ReportViewerComponent(
                  "SELECT V.\"Orçamento\", V.\"Máximo Financiável\" AS \"Máx. Financiável\", V.\"Receita\", V.\"Transf. Parceiros\", V.\"Despesa\", V.\"Adiantamentos por Justificar\", V.\"Cabimentos por Executar\", V.\"Saldo Tesouraria\", V.\"Saldo Orçamental\" FROM V_RESPROJPROF V WHERE V.\"NºProj\"='"
                      + projectCode
                      + "'",
                  new NoBehaviourCustomTableFormatter());

          Table t = projectSummary.getTable();

          if (t.getItemIds().size() > 0) {
            for (Object a : t.getItemIds()) {
              Item item = t.getItem(a);

              for (Object column : item.getItemPropertyIds()) {
                String itemString =
                    ReportType.formatCurrency(item.getItemProperty(column).toString());
                list.get(0).add(t.getColumnHeader(column));
                list.get(1).add(itemString);
              }
            }
          }
        }
      }
      return list;
    }
Example #22
0
  /*
   * (non-Javadoc)
   *
   * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
   * VaadinRequest)
   */
  @Override
  protected void setup(VaadinRequest request) {
    setSizeFull();

    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();
    layout.setSpacing(true);
    addComponent(layout);

    Table table1 = createTable("no scrolling, has context menu");
    addActionHandler(table1);
    table1.addItem();
    layout.addComponent(table1);

    Table table2 = createTable("should scroll, has context menu");
    for (int i = 0; i < 100; ++i) {
      table2.addItem();
    }
    addActionHandler(table2);
    layout.addComponent(table2);

    Table table3 = createTable("no scrolling, no context menu");
    table3.addItem();
    layout.addComponent(table3);

    Table table4 = createTable("should scroll, no context menu");
    for (int i = 0; i < 100; ++i) {
      table4.addItem();
    }
    layout.addComponent(table4);
  }
  @Override
  public void buttonClick(ClickEvent event) {
    if (event.getButton().equals(btnCrearUsuario)) {
      Usuario object = new Usuario();
      object.setUsuario(txtUsuario.getValue().toString());
      object.setNombres(txtNombres.getValue().toString());
      object.setApePat(txtApellidoPaterno.getValue().toString());
      object.setApeMat(txtApellidoMaterno.getValue().toString());

      object.setRol((Rol) cmbRol.getValue());
      object.setCargo(
          txtCargo.getValue() != null ? txtCargo.getValue().toString() : StringUtils.EMPTY);
      object.setDescCargo(
          txtCargoDescripcion.getValue() != null
              ? txtCargoDescripcion.getValue().toString()
              : StringUtils.EMPTY);
      object.setOficina((Dependencia) cmbOficina.getValue());
      object.setPolicia((Policia) cmbPolicia.getValue());

      if (flagNuevoUsuario) {
        String randomPassword = RandomUtil.createWord(8);
        object.setClave(randomPassword);
        usuarioService.crear(object);
      } else {
        object.setClave(clave);
        Item item = tblUsuarios.getItem(tblUsuarios.getValue());
        object.setId((Long) item.getItemProperty("id").getValue());
        usuarioService.actualizar(object);
      }
      refrescar();
    } else if (event.getButton().equals(btnEliminarUsuario)) {
      ConfirmDialog.show(
          getApplication().getMainWindow(),
          "¿Seguro de Eliminar el Registro?",
          new ConfirmDialog.Listener() {
            private static final long serialVersionUID = 1L;

            public void onClose(ConfirmDialog dialog) {
              if (dialog.isConfirmed()) {
                Item item = tblUsuarios.getItem(tblUsuarios.getValue());
                usuarioService.eliminarXId((Long) item.getItemProperty("id").getValue());
                refrescar();
              }
            }
          });
    } else if (event.getButton().equals(btnAgregarPolicia)) {
      cargarWindowRegistroPolicia();
    }
  }
Example #24
0
 private void cachingForTriples(Table table, String endpoint) {
   Model model = ModelFactory.createDefaultModel();
   List<String> resources = null;
   FileWriter fstream = null;
   try {
     fstream = new FileWriter("/home/mofeed/TrialStart/zicozico.nt");
   } catch (IOException e1) {
     // TODO Auto-generated catch block
     e1.printStackTrace();
   }
   BufferedWriter out = new BufferedWriter(fstream);
   try {
     for (Object id : table.getItemIds()) {
       Item item = table.getItem(id);
       Property sourceURI = item.getItemProperty("sourceURI"); // vaadin property not jena
       Resource resource = model.createResource();
       try {
         String sparqlQuery = "select distinct * where { <" + sourceURI.getValue() + "> ?p  ?o .}";
         Query query = QueryFactory.create(sparqlQuery);
         QueryExecution qexec = QueryExecutionFactory.sparqlService(endpoint, query);
         com.hp.hpl.jena.query.ResultSet results = qexec.execSelect();
         com.hp.hpl.jena.query.QuerySolution binding = null;
         while (results.hasNext()) {
           binding = results.next();
           String property = binding.getResource("?p").toString();
           String value;
           if (binding.get("?o").isResource()) value = binding.getResource("?o").toString();
           else value = binding.getLiteral("?o").toString();
           com.hp.hpl.jena.rdf.model.Property pt = ResourceFactory.createProperty(property);
           // resource.addProperty(pt, value);
           model.add(resource, pt, value);
         }
         qexec.close();
         model.write(out, null, "TURTLE");
       } catch (Exception e) {
         Notification.show(e.toString());
       }
       // model.add(s, p, o);
       // Property destinationURI = item.getItemProperty("destinationURI");
       // out.write(sourceURI.getValue()+"\n");
     }
     /*out.flush();
     fstream.flush();*/
     out.close();
   } catch (Exception e) { // Catch exception if any
     System.err.println("Error: " + e.getMessage());
   }
 }
 public Component generateCell(Table source, Object itemId, Object columnId) {
   Property property = source.getContainerProperty(itemId, columnId);
   if (property == null) {
     return null;
   }
   Object cellContent = property.getValue();
   if (cellContent instanceof Collection) {
     StringBuilder sb = new StringBuilder();
     Iterator<?> it = ((Collection<?>) cellContent).iterator();
     while (it.hasNext()) {
       if (displayProperty != null) {
         Object value = new MethodProperty(it.next(), displayProperty).getValue();
         sb.append(value);
       } else {
         sb.append(it.next());
       }
       if (it.hasNext()) {
         sb.append(", ");
       }
     }
     return new Label(sb.toString());
   } else if (cellContent != null) {
     Object value = cellContent;
     if (displayProperty != null) {
       value = new MethodProperty(cellContent, displayProperty).getValue();
     }
     return new Label(value != null ? value.toString() : "");
   } else {
     return null;
   }
 }
Example #26
0
    public Component generateCell(Table source, final Object itemId, Object columnId) {

      Property<?> prop = source.getItem(itemId).getItemProperty(JobLogContainer.ERROR_MESSAGE);
      if (prop != null && prop.getType() != null && prop.getType().equals(String.class)) {

        String errorMessage = (String) prop.getValue();

        if (errorMessage != null) {

          Button link = new Button();
          link.setIcon(new ThemeResource("../admin/crystal/agt_update_critical.png"));
          link.setStyleName(BaseTheme.BUTTON_LINK);
          link.setDescription("Show job error message");

          link.addClickListener(
              new Button.ClickListener() {

                public void buttonClick(ClickEvent event) {

                  select(itemId);
                  view.showErrorOutput(itemId);
                }
              });

          return link;
        }
      }

      return null;
    }
  protected void addTaskItem(HistoricTaskInstance task, Table taskTable) {
    Item item = taskTable.addItem(task.getId());

    if (task.getEndTime() != null) {
      item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_FINISHED_22));
    } else {
      item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_22));
    }

    item.getItemProperty("name").setValue(task.getName());
    item.getItemProperty("priority").setValue(task.getPriority());

    item.getItemProperty("startDate").setValue(new PrettyTimeLabel(task.getStartTime(), true));
    item.getItemProperty("endDate").setValue(new PrettyTimeLabel(task.getEndTime(), true));

    if (task.getDueDate() != null) {
      Label dueDateLabel =
          new PrettyTimeLabel(
              task.getEndTime(), i18nManager.getMessage(Messages.TASK_NOT_FINISHED_YET), true);
      item.getItemProperty("dueDate").setValue(dueDateLabel);
    }

    if (task.getAssignee() != null) {
      Component taskAssigneeComponent = getTaskAssigneeComponent(task.getAssignee());
      if (taskAssigneeComponent != null) {
        item.getItemProperty("assignee").setValue(taskAssigneeComponent);
      }
    }
  }
Example #28
0
 @Override
 protected void resetFields() {
   logger.info(
       "Company ID : "
           + companyid
           + " | User Name : "
           + username
           + " > "
           + "Resetting the UI controls");
   tfEnqNo.setReadOnly(false);
   tfEnqNo.setValue("");
   cbEnqStatus.setValue(null);
   listEnqDtls = new ArrayList<SmsPurEnqDtlDM>();
   tblSmsEnqDtl.removeAllItems();
   cbBranch.setValue(branchId);
   cbBranch.setComponentError(null);
   lsVendorName.setValue(null);
   lsVendorName.setComponentError(null);
   dfDueDate.setValue(null);
   dfEnqDate.setValue(null);
   taEnqRem.setValue("");
   taEnqDtlRem.setValue("");
   dfEnqDate.setValue(new Date());
   cbEnqStatus.setValue(cbEnqStatus.getItemIds().iterator().next());
   cbUom.setReadOnly(true);
   dfDueDate.setValue(addDays(new Date(), 7));
 }
Example #29
0
  public void buttonClick(ClickEvent event) {
    try {
      if (event.getButton().equals(saveBtn)) {
        save();
        close();
      } else if (event.getButton().equals(addBtn)) {
        LightProcessDefinition lpd = (LightProcessDefinition) processesComboBox.getValue();
        addTableRow(lpd);
        processesComboBox.removeItem(lpd);
      } else if (event.getButton().equals(deleteBtn)) {
        delete();
        close();
      } else if (event.getButton() instanceof TableLinkButton) {
        LightProcessDefinition lpd =
            (LightProcessDefinition) ((TableLinkButton) event.getButton()).getTableValue();
        table.removeItem(lpd);
        processesComboBox.addItem(lpd);
        processesComboBox.setItemCaption(
            lpd, lpd.getLabel() + " (version " + lpd.getVersion() + ")");
      } else {
        close();
      }

    } catch (Exception ex) {
      ex.printStackTrace();
      showError(ex.getMessage());
    }
  }
Example #30
0
 @Override
 public void discard() throws SourceException {
   super.discard();
   for (Field<?> eachField : fields.values()) {
     eachField.discard();
   }
 }