@Override
  protected void setup() {
    (getLayout()).setSpacing(true);

    ComboBox cb = getComboBox("A combobox", false);
    addComponent(cb);

    cb = getComboBox("A combobox with input prompt", false);
    cb.setInputPrompt("Please select");
    addComponent(cb);

    cb = getComboBox("A combobox with null item", true);
    addComponent(cb);

    cb = getComboBox("A combobox with null item and input prompt", true);
    cb.setInputPrompt("Please select");
    addComponent(cb);

    cb = getComboBox("A disabled combobox", true);
    cb.setEnabled(false);
    addComponent(cb);

    cb = getComboBox("A read-only combobox", true);
    cb.setReadOnly(true);
    addComponent(cb);

    cb = getComboBox("A combobox with filteringMode off", false);
    cb.setFilteringMode(FilteringMode.OFF);
  }
Exemplo n.º 2
0
 /** Llenado del Combo Box */
 private void fillcbGrupo() {
   cb_Grupo.setNullSelectionAllowed(false);
   cb_Grupo.setInputPrompt("Seleccione un Grupo Contable");
   for (GruposContablesModel grupo : grupo_impl.getalls()) {
     cb_Grupo.addItem(grupo.getGRC_Grupo_Contable());
     cb_Grupo.setItemCaption(grupo.getGRC_Grupo_Contable(), grupo.getGRC_Nombre_Grupo_Contable());
   }
 }
Exemplo n.º 3
0
 private void fillcbAuxiliar(String id_grupo) {
   cb_Auxiliar.removeAllItems();
   cb_Auxiliar.setNullSelectionAllowed(false);
   cb_Auxiliar.setInputPrompt("Seleccione el Auxiliar Contable");
   for (AuxiliaresContablesModel auxiliar : auxiliar_impl.getreporte(id_grupo)) {
     cb_Auxiliar.addItem(auxiliar.getAUC_Auxiliar_Contable());
     cb_Auxiliar.setItemCaption(
         auxiliar.getAUC_Auxiliar_Contable(), auxiliar.getAUC_Nombre_Auxiliar_Contable());
   }
 }
Exemplo n.º 4
0
 private void fillcbAcivo(String id_auxiliar, String grupoContable) {
   cb_Activos.removeAllItems();
   cb_Activos.setNullSelectionAllowed(false);
   cb_Activos.setInputPrompt("Seleccione el Activo");
   for (ActivosModel activo : activo_impl.activos_by_auxiliar(id_auxiliar, grupoContable)) {
     cb_Activos.addItem(activo.getACT_Codigo_Activo());
     cb_Activos.setItemCaption(activo.getACT_Codigo_Activo(), activo.getACT_Nombre_Activo());
   }
   String a = "ALL";
   cb_Activos.addItem(a);
   cb_Activos.setItemCaption(a, "Todos los Activos");
 }
Exemplo n.º 5
0
  @Override
  protected void setup() {

    List<String> list = new ArrayList<String>();
    for (int i = 0; i < 100; i++) {
      list.add("Item " + i);
    }

    ComboBox cb = new ComboBox("Combobox", list);
    cb.setImmediate(true);
    cb.setInputPrompt("Enter text");
    cb.setDescription("Some Combobox");
    addComponent(cb);

    final ObjectProperty<String> log = new ObjectProperty<String>("");

    cb.addListener(
        new FieldEvents.FocusListener() {
          public void focus(FocusEvent event) {
            log.setValue(log.getValue().toString() + "<br>" + counter + ": Focus event!");
            counter++;
          }
        });

    cb.addListener(
        new FieldEvents.BlurListener() {
          public void blur(BlurEvent event) {
            log.setValue(log.getValue().toString() + "<br>" + counter + ": Blur event!");
            counter++;
          }
        });

    TextField field = new TextField("Some textfield");
    field.setImmediate(true);
    addComponent(field);

    Label output = new Label(log);
    output.setCaption("Events:");

    output.setContentMode(Label.CONTENT_XHTML);
    addComponent(output);
  }
  public void postConstruct() {

    cmbTipoNotificacion.setCodigoLista(Constante.LISTA.CODIGO.TIPO_NOTI);
    cmbTipoNotificacion.setInputPrompt("Tipo Notificacion");

    cmbEstadoNotificacion.setCodigoLista(Constante.LISTA.CODIGO.ESTADO_NOTI);
    cmbEstadoNotificacion.setInputPrompt("Estado Notificacion");

    List<Dependencia> dependencias = dependenciaService.buscar(null);

    BeanItemContainer<Dependencia> containerDependencia =
        new BeanItemContainer<Dependencia>(Dependencia.class, dependencias);
    cmbUnidadProcuraduria.setContainerDataSource(containerDependencia);
    cmbUnidadProcuraduria.setItemCaptionPropertyId("nombre");
    cmbUnidadProcuraduria.setInputPrompt("Unidad Procuraduria");

    dtFechaRecepcion.setInputPrompt("Fecha Recepcion Notificacion");
    dtFechaVencimiento.setInputPrompt("Fecha Vencimiento PRI");
    dtFechaPlazo.setInputPrompt("Fecha Plazo Fundamentar");

    btnGuardar.addListener(this);

    cargarDatos();
  }
  private Component buildProfileTab() {
    HorizontalLayout root = new HorizontalLayout();
    root.setCaption("Profile");
    root.setIcon(FontAwesome.USER);
    root.setWidth(100.0f, Unit.PERCENTAGE);
    root.setSpacing(true);
    root.setMargin(true);
    root.addStyleName("profile-form");

    VerticalLayout pic = new VerticalLayout();
    pic.setSizeUndefined();
    pic.setSpacing(true);
    Image profilePic = new Image(null, new ThemeResource("img/profile-pic-300px.jpg"));
    profilePic.setWidth(100.0f, Unit.PIXELS);
    pic.addComponent(profilePic);

    Button upload =
        new Button(
            "Change…",
            event -> {
              Notification.show("Not implemented in this demo");
            });
    upload.addStyleName(ValoTheme.BUTTON_TINY);
    pic.addComponent(upload);

    root.addComponent(pic);

    FormLayout details = new FormLayout();
    details.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    root.addComponent(details);
    root.setExpandRatio(details, 1);

    firstNameField = new TextField("First Name");
    details.addComponent(firstNameField);
    lastNameField = new TextField("Last Name");
    details.addComponent(lastNameField);

    titleField = new ComboBox("Title");
    titleField.setInputPrompt("Please specify");
    titleField.addItem("Mr.");
    titleField.addItem("Mrs.");
    titleField.addItem("Ms.");
    titleField.setNewItemsAllowed(true);
    details.addComponent(titleField);

    sexField = new OptionGroup("Sex");
    sexField.addItem(Boolean.FALSE);
    sexField.setItemCaption(Boolean.FALSE, "Female");
    sexField.addItem(Boolean.TRUE);
    sexField.setItemCaption(Boolean.TRUE, "Male");
    sexField.addStyleName("horizontal");
    details.addComponent(sexField);

    Label section = new Label("Contact Info");
    section.addStyleName(ValoTheme.LABEL_H4);
    section.addStyleName(ValoTheme.LABEL_COLORED);
    details.addComponent(section);

    emailField = new TextField("Email");
    emailField.setWidth("100%");
    emailField.setRequired(true);
    emailField.setNullRepresentation("");
    details.addComponent(emailField);

    locationField = new TextField("Location");
    locationField.setWidth("100%");
    locationField.setNullRepresentation("");
    locationField.setComponentError(new UserError("This address doesn't exist"));
    details.addComponent(locationField);

    phoneField = new TextField("Phone");
    phoneField.setWidth("100%");
    phoneField.setNullRepresentation("");
    details.addComponent(phoneField);

    newsletterField = new OptionalSelect<>();
    newsletterField.addOption(0, "Daily");
    newsletterField.addOption(1, "Weekly");
    newsletterField.addOption(2, "Monthly");
    details.addComponent(newsletterField);

    section = new Label("Additional Info");
    section.addStyleName(ValoTheme.LABEL_H4);
    section.addStyleName(ValoTheme.LABEL_COLORED);
    details.addComponent(section);

    websiteField = new TextField("Website");
    websiteField.setInputPrompt("http://");
    websiteField.setWidth("100%");
    websiteField.setNullRepresentation("");
    details.addComponent(websiteField);

    bioField = new TextArea("Bio");
    bioField.setWidth("100%");
    bioField.setRows(4);
    bioField.setNullRepresentation("");
    details.addComponent(bioField);

    return root;
  }
Exemplo n.º 8
0
  @Override
  public void postConstruct() {

    flagNuevoUsuario = true;
    btnCrearUsuario.setIcon(Constante.ICONOS.SAVE);
    btnEliminarUsuario.setIcon(Constante.ICONOS.DELETE);
    btnAgregarPolicia.setIcon(Constante.ICONOS.CREATE);

    lstRoles = rolService.buscar(null);
    BeanItemContainer<Rol> bicRoles = new BeanItemContainer<Rol>(Rol.class, lstRoles);
    cmbRol.setInputPrompt("Rol");
    cmbRol.setContainerDataSource(bicRoles);
    cmbRol.setItemCaptionPropertyId("nombre");
    cmbRol.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS);
    cmbRol.setImmediate(true);
    cmbRol.addListener((ValueChangeListener) this);

    lstPolicias = policiaService.buscar(null);
    BeanItemContainer<Policia> bicPolicias =
        new BeanItemContainer<Policia>(Policia.class, lstPolicias);
    cmbPolicia.setInputPrompt("Policia");
    cmbPolicia.setContainerDataSource(bicPolicias);
    cmbPolicia.setItemCaptionPropertyId("nombreCompleto");
    cmbPolicia.setImmediate(true);
    cmbPolicia.addListener(
        new ValueChangeListener() {

          private static final long serialVersionUID = 4418094011985520491L;

          @Override
          public void valueChange(ValueChangeEvent event) {
            pintarPersona(event);
          }

          private void pintarPersona(ValueChangeEvent event) {

            if (cmbPolicia.getValue() != null) {
              Policia policia = (Policia) cmbPolicia.getValue();
              txtApellidoPaterno.setValue(policia.getPersona().getApePaterno());
              txtApellidoMaterno.setValue(policia.getPersona().getApeMaterno());
              txtNombres.setValue(policia.getPersona().getNombres());
              txtCargo.setValue(
                  policia.getCargo() != null ? policia.getCargo().getNombre() : StringUtils.EMPTY);
            }
          }
        });

    cmbPolicia.addListener((ValueChangeListener) this);

    cmbOficina.setItemCaptionPropertyId("nombre");
    cmbOficina.setInputPrompt("Oficina");

    lstDependencias = dependenciasService.buscar(null);
    BeanItemContainer<Dependencia> bicDependencias =
        new BeanItemContainer<Dependencia>(Dependencia.class, lstDependencias);
    cmbOficina.setContainerDataSource(bicDependencias);
    cmbOficina.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS);
    cmbOficina.setImmediate(true);
    cmbOficina.addListener((ValueChangeListener) this);

    tblUsuarios.setSelectable(true);
    tblUsuarios.setImmediate(true);
    tblUsuarios.setNullSelectionAllowed(true);
    tblUsuarios.setNullSelectionItemId(null);

    habilitarBoton(false);
    btnCrearUsuario.addListener((ClickListener) this);
    btnEliminarUsuario.addListener((ClickListener) this);
    btnAgregarPolicia.addListener((ClickListener) this);

    tblUsuarios.addListener(
        new ValueChangeListener() {
          private static final long serialVersionUID = -6124596484581515359L;

          @Override
          public void valueChange(ValueChangeEvent event) {
            boolean esModoNuevo = tblUsuarios.getValue() == null;
            habilitarBoton(!esModoNuevo);
            limpiar();
            if (esModoNuevo) {
              tblUsuarios.setValue(null);
              habilitarEdicion(esModoNuevo);
            } else {
              Item item = tblUsuarios.getItem(tblUsuarios.getValue());
              clave = item.getItemProperty("clave").getValue().toString();
              txtUsuario.setValue(item.getItemProperty("usuario").getValue());
              txtNombres.setValue(item.getItemProperty("nombres").getValue());
              txtApellidoPaterno.setValue(item.getItemProperty("apePat").getValue());
              txtApellidoMaterno.setValue(item.getItemProperty("apeMat").getValue());
              cmbPolicia.select(item.getItemProperty("policia").getValue());
              cmbOficina.select(item.getItemProperty("dependencia").getValue());
              cmbRol.select(item.getItemProperty("rol").getValue());
              txtCargo.setValue(
                  item.getItemProperty("cargo").getValue() != null
                      ? item.getItemProperty("cargo").getValue()
                      : StringUtils.EMPTY);
              txtCargoDescripcion.setValue(
                  item.getItemProperty("descCargo").getValue() != null
                      ? item.getItemProperty("descCargo").getValue()
                      : StringUtils.EMPTY);
              habilitarEdicion(esModoNuevo);
            }
          }
        });

    txtFiltroUsuario.addShortcutListener(
        new ShortcutListener("", KeyCode.ENTER, null) {
          private static final long serialVersionUID = 4068232062569621771L;

          @Override
          public void handleAction(Object sender, Object target) {
            shortCutEnter(sender, target);
          }
        });
    txtFiltroNombres.addShortcutListener(
        new ShortcutListener("", KeyCode.ENTER, null) {
          private static final long serialVersionUID = 4068232062569621771L;

          @Override
          public void handleAction(Object sender, Object target) {
            shortCutEnter(sender, target);
          }
        });
    txtFiltroApePaterno.addShortcutListener(
        new ShortcutListener("", KeyCode.ENTER, null) {
          private static final long serialVersionUID = 4068232062569621771L;

          @Override
          public void handleAction(Object sender, Object target) {
            shortCutEnter(sender, target);
          }
        });
    txtFiltroApeMaterno.addShortcutListener(
        new ShortcutListener("", KeyCode.ENTER, null) {
          private static final long serialVersionUID = 4068232062569621771L;

          @Override
          public void handleAction(Object sender, Object target) {
            shortCutEnter(sender, target);
          }
        });
    txtFiltroCargo.addShortcutListener(
        new ShortcutListener("", KeyCode.ENTER, null) {
          private static final long serialVersionUID = 4068232062569621771L;

          @Override
          public void handleAction(Object sender, Object target) {
            shortCutEnter(sender, target);
          }
        });
    txtFiltroOficina.addShortcutListener(
        new ShortcutListener("", KeyCode.ENTER, null) {
          private static final long serialVersionUID = 4068232062569621771L;

          @Override
          public void handleAction(Object sender, Object target) {
            shortCutEnter(sender, target);
          }
        });

    txtUsuario.setImmediate(true);
    txtNombres.setImmediate(true);
    txtApellidoPaterno.setImmediate(true);
    txtApellidoMaterno.setImmediate(true);
    txtCargo.setImmediate(true);
    txtFiltroOficina.setImmediate(true);

    txtUsuario.addListener((TextChangeListener) this);
    txtNombres.addListener((TextChangeListener) this);
    txtApellidoPaterno.addListener((TextChangeListener) this);
    txtApellidoMaterno.addListener((TextChangeListener) this);
    txtCargo.addListener((TextChangeListener) this);
    txtFiltroOficina.addListener((TextChangeListener) this);

    lstUsuarios = usuarioService.buscar(null);
    cargarUsuarios(lstUsuarios, true);
  }
  public void initComponent() {
    table =
        new Table() {
          @Override
          protected String formatPropertyValue(Object rowId, Object colId, Property property) {
            // Format by property type
            try {
              if (property.getType() == Date.class && property.getValue() != null) {
                SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
                return df.format((Date) property.getValue());
              }
            } catch (Exception ex) {
            }

            try {
              if (property.getType() == Boolean.class) {
                if ((Boolean) property.getValue() == true) {
                  return "CLOSE";
                } else {
                  return "-";
                }
              }
            } catch (Exception ex) {
            }

            return super.formatPropertyValue(rowId, colId, property);
          }
        };

    // Inisialisasi Panel
    setSizeFull();
    content.setSizeFull();
    content.setMargin(true);

    // INIT COMPONENT TENGAH
    table.setSizeFull();
    table.setSelectable(true);
    table.setImmediate(true);
    table.setBuffered(false);
    table.setFooterVisible(true);

    // INIT COMPONENT ATAS
    btnSeparator1.setEnabled(false);
    btnSeparator2.setEnabled(false);

    //		fieldSearchByRekap = new TextField("NO. REKAP");
    fieldSearchById = new TextField("NO. REKAP");
    fieldSearchById.setInputPrompt("NO. REKAP");
    fieldSearchById.setStyleName(Reindeer.TEXTFIELD_SMALL);
    fieldSearchById.setWidth("120px");

    //		fieldSearchByInvoice = new TextField("INVOICE");
    comboSearchByDivision = new ComboBox("DIVISION");
    comboSearchByDivision.setInputPrompt("DIVISION");
    comboSearchByDivision.setStyleName(Reindeer.TEXTFIELD_SMALL);
    comboSearchByDivision.setWidth("120px");

    dateFieldSearchByTransdateFrom = new DateField("INV FROM");
    dateFieldSearchByTransdateFrom.setStyleName(Reindeer.TEXTFIELD_SMALL);
    dateFieldSearchByTransdateFrom.setWidth("120px");

    dateFieldSearchByTransdateTo = new DateField("INV TO");
    dateFieldSearchByTransdateTo.setStyleName(Reindeer.TEXTFIELD_SMALL);
    dateFieldSearchByTransdateTo.setWidth("120px");

    btnSearch.setStyleName(Reindeer.BUTTON_SMALL);

    btnSearch.setIcon(new ThemeResource("images/navigation/12x12/Find.png"));
    btnSelect.setIcon(new ThemeResource("images/navigation/16x16/OK.png"));
  }