예제 #1
0
 private void reload() {
   div2.getChildren().clear();
   if (session.getAttribute("user") != null) {
     Executions.createComponents("leftpanel.zul", div2, null);
     System.out.println("create leftpanel.zul");
   } else {
     div2.getChildren().clear();
     // div2.appendChild(new Label("Please login"));
   }
 }
  private void buildDivFieldsFromEntity(ComposerController<?> composer) {
    //		AnnotateDataBinder binder = new AnnotateDataBinder(crudFormWindow);
    //		binder.bindBean("controller2", composer);

    if (divFields.getChildren().size() == 0) {
      List<Component> list = new ArrayList<Component>(divFields.getChildren());
      for (Component c : list) {
        c.detach();
      }
      d = new Div();
      g = new Grid();
      d.appendChild(g);

      binder = new AnnotateDataBinder(g);
      binder.bindBean("controller2", composer);
      Columns c = new Columns();
      Column col1 = new Column();
      col1.setWidth("120px");
      Column col2 = new Column();
      col2.setAlign("left");
      c.appendChild(col1);
      c.appendChild(col2);
      Rows r = new Rows();
      Textbox t;
      Checkbox checkbox;
      for (ManagedBeanField field : composer.getListColumns()) {
        if (field.isVisible()) {
          Row row = new Row();
          row.appendChild(new Label(Labels.getLabel(field.getFieldCaption())));
          String fieldName = "controller2." + field.getFieldName() + "";

          if (field.getFieldType().equalsIgnoreCase("boolean")) {
            checkbox = new Checkbox();
            binder.addBinding(checkbox, "checked", fieldName);
            row.appendChild(checkbox);

          } else {
            t = new Textbox();

            t.setWidth("98%");

            binder.addBinding(t, "value", fieldName);
            row.appendChild(t);
          }
          r.appendChild(row);
        }
      }
      g.appendChild(r);

      d.setParent(this.divFields);
      // binder.loadAll();
    }
    binder.loadComponent(g);
    // binder.saveAll();
  }
  // Metodo para buscar //
  public void buscarDatos() throws Exception {
    try {
      Map<String, Object> parameters = new HashMap<String, Object>();
      String value = tbxValue.getValue().trim().toUpperCase();
      parameters.put("codigo_empresa", codigo_empresa);
      parameters.put("codigo_sucursal", codigo_sucursal);
      String parameter = lbxParameter.getSelectedItem().getValue().toString();

      parameters.put("parameter", parameter);
      parameters.put("value", "%" + value + "%");

      parameters.put("limite_paginado", "limit 25 offset 0");

      List<Maestro_manual> lista_datos = maestro_manualService.listar(parameters);
      listboxResultado.getItems().clear();
      divPopups.getChildren().clear();

      for (Maestro_manual maestro_manual : lista_datos) {
        listboxResultado.appendChild(crearFilas(maestro_manual, this));
      }

      listboxResultado.applyProperties();
      listboxResultado.invalidate();

    } catch (Exception e) {
      MensajesUtil.mensajeError(e, "", this);
    }
  }
예제 #4
0
  /** Load Format */
  private void cmd_loadFormat() {
    //	clear panel
    previewPanel.getChildren().clear();

    ListItem listitem = pickFormat.getSelectedItem();

    String formatName = (String) listitem.getValue();

    if (formatName.equals(s_none)) return;

    m_format = ImpFormat.load(formatName);

    if (m_format == null) {
      FDialog.error(m_WindowNo, this, formatName);
      return;
    }

    //	pointers

    int size = m_format.getRowCount();
    m_labels = new Label[size];
    m_fields = new Textbox[size];

    for (int i = 0; i < size; i++) {
      ImpFormatRow row = m_format.getRow(i);

      m_labels[i] = new Label(row.getColumnName());

      Hbox hbox = new Hbox();
      hbox.setWidth("100%");
      hbox.setWidths("30%, 70%");
      hbox.setStyle("padding-bottom: 3px");

      hbox.appendChild(m_labels[i].rightAlign());

      int length = row.getEndNo() - row.getStartNo();

      if (length <= 5) length = 5;
      else if (length > 20) length = 20;

      m_fields[i] = new Textbox();
      m_fields[i].setStyle("margin-left: 2px");

      hbox.appendChild(m_fields[i]);

      previewPanel.appendChild(hbox);
    }
    m_record = -1;
    record.setValue("------");
    previewPanel.invalidate();
  } //	cmd_format