@Override
  protected void setup(VaadinRequest request) {
    ComboBox cb = new ComboBox("Page length 0", items);
    cb.setPageLength(0);
    cb.setFilteringMode(FilteringMode.CONTAINS);
    addComponent(cb);

    cb = new ComboBox("Page length 2", items);
    cb.setPageLength(2);
    cb.setFilteringMode(FilteringMode.CONTAINS);
    addComponent(cb);
  }
  @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);
  }
예제 #3
0
  protected final void setupRowPerPageCombo(
      final PMContext ctx, final PaginatedList list, HorizontalLayout l, final PMMainWindow window)
      throws UnsupportedOperationException {
    rowPerPage = new ComboBox();
    rowPerPage.addItem("5");
    rowPerPage.addItem("10");
    rowPerPage.addItem("20");
    rowPerPage.addItem("50");
    if (list.getRowsPerPage() == null) {
      rowPerPage.select("10");
    } else {
      rowPerPage.select(list.getRowsPerPage().toString());
    }
    rowPerPage.setNullSelectionAllowed(false);
    rowPerPage.setNewItemsAllowed(false);
    rowPerPage.setWidth("50px");
    rowPerPage.setFilteringMode(Filtering.FILTERINGMODE_OFF);
    rowPerPage.setImmediate(true);
    rowPerPage.addListener(
        new ValueChangeListener() {

          public void valueChange(Property.ValueChangeEvent event) {
            list.setRowsPerPage(Integer.parseInt((String) event.getProperty().getValue()));
            PMContext c = cloneContext(ctx);
            c.put("rows_per_page", list.getRowsPerPage());
            final ListCommand cmd = new ListCommand(c);
            window.setMainScreen(cmd.execute());
          }
        });
    l.addComponent(rowPerPage);
  }
  public void setDisplay() {
    comboGroup0.setContainerDataSource(model.getBeanItemContainerFSalesman());
    comboGroup0.setNewItemsAllowed(false);
    comboGroup0.setFilteringMode(FilteringMode.CONTAINS);
    comboGroup0.setNullSelectionAllowed(true);

    comboGroup1.setContainerDataSource(model.getBeanItemContainerFVendor());
    comboGroup1.setNewItemsAllowed(false);
    comboGroup1.setFilteringMode(FilteringMode.CONTAINS);
    comboGroup1.setNullSelectionAllowed(true);

    comboGroup2.setContainerDataSource(model.getBeanItemContainerFCustomer());
    comboGroup2.setNewItemsAllowed(false);
    comboGroup2.setFilteringMode(FilteringMode.CONTAINS);
    comboGroup2.setNullSelectionAllowed(true);

    comboGroup3.setContainerDataSource(model.getBeanItemContainerFArea());
    comboGroup3.setNewItemsAllowed(false);
    comboGroup3.setFilteringMode(FilteringMode.CONTAINS);
    comboGroup3.setNullSelectionAllowed(true);

    comboGroup4.setContainerDataSource(model.getBeanItemContainerFSubArea());
    comboGroup4.setNewItemsAllowed(false);
    comboGroup4.setFilteringMode(FilteringMode.CONTAINS);
    comboGroup4.setNullSelectionAllowed(true);

    comboGroup5.setContainerDataSource(model.getBeanItemContainerFProductGroup());
    comboGroup5.setNewItemsAllowed(false);
    comboGroup5.setFilteringMode(FilteringMode.CONTAINS);
    comboGroup5.setNullSelectionAllowed(true);

    dateField1From.setValue(model.getTransaksiHelper().getCurrentTransDate());
    dateField1To.setValue(model.getTransaksiHelper().getCurrentTransDate());

    checkBoxFaktur.setEnabled(false);
  }
예제 #5
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());
    }
  }
예제 #6
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() {

    tableList =
        new Table() {
          @Override
          protected String formatPropertyValue(Object rowId, Object colId, Property property) {
            // Format by property type
            if (property.getType() == Date.class && property.getValue() != null) {
              SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
              return df.format((Date) property.getValue());
            }

            //		        if (property.getType()==Boolean.class){
            //		        	if ((Boolean) property.getValue()==true) {
            //		        		return "Active";
            //		        	} else {
            //		        		return "-";
            //		        	}
            //		        }

            return super.formatPropertyValue(rowId, colId, property);
          }
        };
    tableDetil =
        new Table() {
          @Override
          protected String formatPropertyValue(Object rowId, Object colId, Property property) {
            // Format by property type
            if (property.getType() == Date.class && property.getValue() != null) {
              SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
              return df.format((Date) property.getValue());
            }

            //		        if (property.getType()==Boolean.class){
            //		        	if ((Boolean) property.getValue()==true) {
            //		        		return "Active";
            //		        	} else {
            //		        		return "-";
            //		        	}
            //		        }

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

    // ::LIST
    fieldSearch1.setWidth("100px");
    fieldSearch2.setWidth("100px");
    fieldSearch2.setWidth("100px");
    comboSearch1.setWidth("200px");
    comboSearch2.setWidth("200px");

    // ::DETIL
    fieldNomor.setNullRepresentation("");
    fieldInvoiceno.setNullRepresentation("");

    fieldNomor.setWidth("100px");
    fieldInvoiceno.setWidth("100px");
    comboTipeopname.setWidth("200px");
    comboTipeopname.setFilteringMode(FilteringMode.CONTAINS);
    comboWarehouse.setWidth("200px");
    comboWarehouse.setFilteringMode(FilteringMode.CONTAINS);

    dateFieldTrdate.setDateFormat("dd/MM/yyyy");
    dateFieldEntrydate.setDateFormat("dd/MM/yyyy");
    dateFieldTrdate.setWidth("100px");
    dateFieldEntrydate.setWidth("100px");

    btnSearch.setIcon(new ThemeResource("../images/navigation/12x12/Find.png"));
    btnNewForm.setIcon(new ThemeResource("../images/navigation/12x12/Create.png"));
    btnEditForm.setIcon(new ThemeResource("../images/navigation/12x12/Pencil.png"));
    btnDeleteForm.setIcon(new ThemeResource("../images/navigation/12x12/Erase.png"));
    //		btnPrint.setIcon(new ThemeResource("../images/navigation/12x12/Print.png"));

    btnSaveForm.setIcon(new ThemeResource("../images/navigation/12x12/Save.png"));
    btnCancelForm.setIcon(new ThemeResource("../images/navigation/12x12/Undo.png"));

    btnAddItem.setIcon(new ThemeResource("../images/navigation/12x12/Create.png"));
    btnEditForm.setIcon(new ThemeResource("../images/navigation/12x12/Pencil.png"));
    btnRemoveItem.setIcon(new ThemeResource("../images/navigation/12x12/Erase.png"));

    btnPosting.setIcon(new ThemeResource("../images/navigation/12x12/OK.png"));
    //		btnPostingBatal.setIcon(new ThemeResource("../images/navigation/12x12/OK.png"));
    btnLapselisih.setIcon(new ThemeResource("../images/navigation/12x12/Print.png"));

    tableList.setSelectable(true);
    tableList.setImmediate(true);
    tableList.setBuffered(false);
    tableList.setFooterVisible(true);

    tableDetil.setSelectable(true);
    tableDetil.setImmediate(true);
    tableDetil.setBuffered(false);
    tableDetil.setFooterVisible(true);

    // VALIDATOR
    fieldNomor.setRequired(true);
    comboTipeopname.setRequired(true);
    comboWarehouse.setRequired(true);
    dateFieldTrdate.setRequired(true);
    //		fieldDescription.setRequired(true);

    btnSeparator1.setEnabled(false);
    btnSeparator2.setEnabled(false);

    // FIELD FOOTER
    fieldDisc1 = new TextField();
    fieldDisc1rp = new TextField();
    fieldDisc1rpafterppn = new TextField();
    fieldDisc1.setWidth("50px");
    fieldDisc1rp.setWidth("50px");
    fieldDisc1rpafterppn.setWidth("150px");
    fieldDisc1rpafterppn.addStyleName("numerical");

    fieldDisc2 = new TextField();
    fieldDisc2rp = new TextField();
    fieldDisc2rpafterppn = new TextField();
    fieldDisc2.setWidth("50px");
    fieldDisc2rp.setWidth("50px");
    fieldDisc2rpafterppn.setWidth("150px");
    fieldDisc2rpafterppn.addStyleName("numerical");

    fieldDisc = new TextField();
    fieldDiscrp = new TextField();
    fieldDiscrpafterppn = new TextField();
    fieldDisc.setWidth("50px");
    fieldDiscrp.setWidth("50px");
    fieldDiscrpafterppn.setWidth("150px");
    fieldDiscrpafterppn.addStyleName("numerical");

    fieldAmount.setWidth("200px");
    fieldAmount.addStyleName("numerical");
    fieldAmountafterdisc.setWidth("200px");
    fieldAmountafterdisc.addStyleName("numerical");
    fieldAmountafterdiscafterppn.setWidth("200px");
    fieldAmountafterdiscafterppn.addStyleName("numerical");
    fieldAmountafterppn.setWidth("200px");
    fieldAmountafterppn.addStyleName("numerical");
    fieldAmountpay.setWidth("200px");
    fieldAmountpay.addStyleName("numerical");
    fieldAmountpayfaterppn.setWidth("200px");
    fieldAmountpayfaterppn.addStyleName("numerical");
    fieldPpnrp.setWidth("200px");
    fieldPpnrp.addStyleName("numerical");

    fieldPpnpercent.setWidth("50px");
  }