コード例 #1
0
  /**
   * The constructor should first build the main layout, set the composition root and then do any
   * custom initialization.
   *
   * <p>The constructor will not be automatically regenerated by the visual editor.
   *
   * @throws Exception
   * @throws IllegalArgumentException
   */
  public ClientViewForm(IWorkbenchContext context) throws IllegalArgumentException, Exception {
    this.context = context;

    buildMainLayout();
    setCompositionRoot(mainLayout);

    // TODO add user code here
    initComponents();

    // configure Organization Type data
    this.userField.setTabSheet(tabSheetClient);
    this.userRoleCollectionField.setContext(context);

    clientTypeField.setNullSelectionAllowed(false);
    clientTypeField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    clientTypeField.setItemCaptionPropertyId("description");

    clientGroupField.setNullSelectionAllowed(false);
    clientGroupField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    clientGroupField.setItemCaptionPropertyId("description");

    addressField.addListenerAddressChange(
        new AddressChangeListener() {
          @Override
          public void addressChange(AddressChangeEvent event) {
            if (client != null) client.setAddress(event.getAddress());
          }
        });

    // get form services from OSGi Service Registry
    getServices();

    // load data sources
    loadData();
  }
コード例 #2
0
ファイル: TireViewForm.java プロジェクト: wr4eng/bustrack
  /**
   * The constructor should first build the main layout, set the composition root and then do any
   * custom initialization.
   *
   * <p>The constructor will not be automatically regenerated by the visual editor.
   *
   * @throws Exception
   * @throws IllegalArgumentException
   */
  public TireViewForm() throws IllegalArgumentException, Exception {
    buildMainLayout();
    setCompositionRoot(mainLayout);

    // TODO add user code here
    initComponents();

    // configure Organization Type data
    vehicleField.setNullSelectionAllowed(false);
    vehicleField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    vehicleField.setItemCaptionPropertyId("vehicleNumber");

    supplierField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    supplierField.setItemCaptionPropertyId("name");

    supplierField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    supplierField.setItemCaptionPropertyId("name");

    tireTypeField.setNullSelectionAllowed(false);
    tireTypeField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    tireTypeField.setItemCaptionPropertyId("description");

    tireStatusField.setNullSelectionAllowed(false);
    tireStatusField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    tireStatusField.setItemCaptionPropertyId("description");

    // get form services from OSGi Service Registry
    getServices();

    // load data sources
    loadData();
  }
コード例 #3
0
  public DepartmentSelector() {
    setImmediate(false);
    // conu = SpringApplicationContext.getContainerUtils();
    container = conu.createJPABatchableContainer(Department.class);
    geoContainer = conu.createJPABatchableContainer(Department.class);
    geoContainer.setAutoCommit(false);
    container.setAutoCommit(false);
    setCaption("Department");
    // Only list "roots" which are in our example geographical super
    // departments
    geoContainer.addContainerFilter(new IsNull("parent"));
    geographicalDepartment.setContainerDataSource(geoContainer);
    geographicalDepartment.setItemCaptionPropertyId("name");
    geographicalDepartment.setImmediate(true);

    container.setApplyFiltersImmediately(false);
    filterDepartments(null);
    department.setContainerDataSource(container);
    department.setItemCaptionPropertyId("name");

    geographicalDepartment.addListener(
        new Property.ValueChangeListener() {
          @Override
          public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
            /*
             * Modify filtering of the department combobox
             */
            EntityItem<Department> item = geoContainer.getItem(geographicalDepartment.getValue());
            Department entity = item.getEntity();
            filterDepartments(entity);
          }
        });
    department.addListener(
        new Property.ValueChangeListener() {
          @Override
          public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
            /*
             * Modify the actual value of the custom field.
             */
            if (department.getValue() == null) {
              setValue(null, false);
            } else {
              Department entity = container.getItem(department.getValue()).getEntity();
              setValue(entity, false);
            }
          }
        });
  }
コード例 #4
0
  ComboBox userList() {
    users.setCaption("Users: ");
    users.setWidth("200px");
    users.setNullSelectionAllowed(false);
    users.addContainerProperty("y", String.class, "");
    users.setItemCaptionPropertyId("y");

    Item i;
    for (User u : service.getUserList()) {
      i = users.addItem(u.getId());
      i.getItemProperty("y").setValue(u.getUsername());
    }

    users.addListener(
        new ValueChangeListener() {

          @Override
          public void valueChange(Property.ValueChangeEvent event) {
            allowedBackwardInputAttendance.setValue(
                service.isUserAllowedToEnterPreviousAttendance(
                    util.convertStringToInteger(event.getProperty().getValue().toString())));
          }
        });

    users.setImmediate(true);

    return users;
  }
コード例 #5
0
 @Override
 public Field createField(Item item, Object propertyId, Component uiContext) {
   BeanItemContainer<Localidad> container =
       new BeanItemContainer<Localidad>(Localidad.class, service.findAll());
   ComboBox box = new ComboBox();
   box.setItemCaptionPropertyId(Localidad.Atributos.NOMBRE);
   box.setContainerDataSource(container);
   return box;
 }
コード例 #6
0
  public VentanaAltaConsultaSesion(
      final IPacientes iPacientes, Observer observer, Evaluacion evaluacion) {
    this.iPacientes = iPacientes;
    this.observer = observer;
    this.evaluacion = evaluacion;
    setModal(true);
    setCaption("Ingeso de consulta/sesión");
    layout.setMargin(true);

    fecha = new PopupDateField();
    fecha.setValue(Calendar.getInstance().getTime());
    layout.addComponent(fecha);

    textArea.setInputPrompt("observaciones");
    layout.addComponent(textArea);

    //		containerTipoConsulta = new BeanItemContainer<TipoConsulta>(TipoConsulta.class,
    //				TipoConsulta.getAll());
    containerTipoConsulta =
        new BeanItemContainer<TipoConsulta>(
            TipoConsulta.class, Arrays.asList(TipoConsulta.values()));

    comboBoxTipoConsulta = new ComboBox();
    comboBoxTipoConsulta.setContainerDataSource(containerTipoConsulta);
    comboBoxTipoConsulta.setItemCaptionPropertyId("descripcion");
    comboBoxTipoConsulta.setItemCaptionMode(ItemCaptionMode.PROPERTY);
    comboBoxTipoConsulta.setImmediate(true);
    comboBoxTipoConsulta.addValueChangeListener(
        new ValueChangeListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void valueChange(ValueChangeEvent event) {
            if (event.getProperty() != null) {
              TipoConsulta tipoConsulta = (TipoConsulta) event.getProperty().getValue();
              layoutAdicional.removeAllComponents();
              if (tipoConsulta != null) {
                if (tipoConsulta.equals(TipoConsulta.TERAPIA_FISICA)) {
                  layoutAdicional.addComponent(opcionesTerapiaFisica);
                } else if (tipoConsulta.equals(TipoConsulta.GIMNASIO)) {
                  layoutAdicional.addComponent(opcionesGimnasio);
                }
              }
            }
          }
        });

    layout.addComponent(comboBoxTipoConsulta);
    cargarTipoTerapiaFisica();
    cargarTipoGimnasio();
    layout.addComponent(layoutAdicional);
    layout.addComponent(this.obtenerBotonGuardar());
    this.setContent(layout);
  }
コード例 #7
0
  private ComboBox createSelect(String caption) {
    final ComboBox cb = new ComboBox();
    cb.setImmediate(true);
    cb.addContainerProperty(CAPTION, String.class, "");
    cb.setItemCaptionPropertyId(CAPTION);
    cb.setCaption(caption);
    cb.addValueChangeListener(
        new ValueChangeListener() {

          @Override
          public void valueChange(ValueChangeEvent event) {
            Notification.show(
                "Value now:" + cb.getValue() + " " + cb.getItemCaption(cb.getValue()));
          }
        });
    return cb;
  }
コード例 #8
0
  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();
  }
コード例 #9
0
ファイル: RelatedTableStep.java プロジェクト: vancezhao/mocha
    public void attach() {
      this.addStyleName("custom-report-step-caption");
      Label caption = new Label("Select Reference Table");
      caption.setStyleName("caption");
      this.addComponent(caption);
      box.setWidth(fieldWidth);
      box.setImmediate(true);
      box.addStyleName("custom-report-step-box");
      BeanItemContainer<ReportModel> container =
          new BeanItemContainer<ReportModel>(ReportModel.class);
      container.addAll(getReportModels());
      box.setContainerDataSource(container);
      box.setItemCaptionPropertyId("tableLabel");
      box.addListener(this);
      this.addComponent(box);
      columnLayout.setSpacing(true);
      columnLayout.setVisible(false);

      //			List<ReportTable> relateReportTables=null;
      //			if(getEditableReportTable()!=null){
      //				for(Iterator<ReportModel> it=container.getItemIds().iterator();it.hasNext();){
      //					rm=(ReportModel) it.next();
      //					if(rm.getTableName().equals(getEditableReportTable().getTableName())){
      //						box.setValue(rm);
      //						mainReportTable=rm.getReportTables().iterator().next();
      //						relateReportTables=buildEditableRelatedTableInfo();
      //						break;
      //					}
      //				}
      //				box.setValue(getEditableReportTable().getTableName());
      //				rm.getReportTables().addAll(relateReportTables);
      //			}

      if (relateReportTables != null && isEditableFlg) {
        columnLayout.setVisible(true);
        columnLayout.setImmediate(true);
        //				columnLayout.addComponent(gridLayout);

        //				box.setValue(getEditableReportTable().getTableName());
        //				rm.getReportTables().addAll(relateReportTables);

        for (ReportTable relateRT : relateReportTables) {
          for (Iterator<ReportModel> it = container.getItemIds().iterator(); it.hasNext(); ) {
            ReportModel tempRm = it.next();
            if (tempRm.getTableName().equals(relateRT.getTableName())) {
              box.setValue(tempRm);
              break;
            }
          }
          List<ReportColumn> columnFields = relateRT.getReportColumns();

          for (final ReportColumn columnField : columnFields) {
            if (columnField.getColumnLabel() != null) {
              ReportColumnCard reportColumnCard =
                  new ReportColumnCard(columnField) {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void layoutClick(LayoutClickEvent event) {
                      ReportColumn reportColumn = columnField;
                      reportColumn.setColumnUseMode(
                          ReportConfiguration.ReportColumnType.OutputColumn.toString());
                      rm.getSubTableSelectedColumns().add(reportColumn);
                    }
                  };

              for (ReportColumn rc : relateRT.getReportColumns()) {
                if (rc.getColumnUseMode() != null
                    && rc.getColumnUseMode()
                        .equals(ReportConfiguration.ReportColumnType.OutputColumn.toString())) {
                  if (rc.getColumnName().equals(columnField.getColumnName())) {
                    reportColumnCard.getCheckBox().setValue(true);
                  }
                }
              }

              gridLayout.addComponent(reportColumnCard);
            }
          }
        }
      }

      this.addComponent(columnLayout);
      reportColumnLabel.setStyleName("custom-report-step-column-caption");
      reportColumnLabel.setVisible(false);
      reportColumnStepDesc.setStyleName("custom-report-step-column-desc");
      reportColumnStepDesc.setVisible(false);
      this.addComponent(reportColumnLabel);
      this.addComponent(reportColumnStepDesc);
      gridLayout.setSizeFull();
      gridLayout.setImmediate(true);
      gridLayout.addStyleName("custom-report-step-column-gridlayout");
      this.addComponent(gridLayout);
    }
コード例 #10
0
  private void buildView() {
    logger.info(
        "Company ID : "
            + companyId
            + " | User Name : "
            + userName
            + " > "
            + "Painting Attendance Process UI");
    // Material Components Definition
    btnsaveAttenProc.setVisible(false);
    cbPayPeried = new GERPComboBox("Pay Period");
    cbPayPeried.setImmediate(true);
    cbPayPeried.setNullSelectionAllowed(false);
    cbPayPeried.setWidth("130");
    cbPayPeried.setItemCaptionPropertyId("periodName");
    cbPayPeried.addValueChangeListener(
        new Property.ValueChangeListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void valueChange(ValueChangeEvent event) {
            Object itemId = event.getProperty().getValue();
            if (itemId != null) {
              BeanItem<?> item = (BeanItem<?>) cbPayPeried.getItem(itemId);
              payPeriodList = (PayPeriodDM) item.getBean();
              payPeriodId = payPeriodList.getPayPeriodId();
              loadStartandEndDates();
            }
          }
        });
    btnsaveAttenProc.setCaption("Save");
    tblMstScrSrchRslt.addItemClickListener(
        new ItemClickListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void itemClick(ItemClickEvent event) {
            if (tblMstScrSrchRslt.isSelected(event.getItemId())) {
              tblMstScrSrchRslt.setImmediate(true);
              btnsaveAttenProc.setStyleName("savebt");
              resetFields();
            } else {
              ((AbstractSelect) event.getSource()).select(event.getItemId());
              btnsaveAttenProc.setStyleName("savebt");
              readonlyfalse();
              editAttenProc();
              readonlytrue();
            }
          }
        });
    hlPageHdrContainter.addComponent(btnsaveAttenProc);
    hlPageHdrContainter.setComponentAlignment(btnsaveAttenProc, Alignment.MIDDLE_RIGHT);
    tfProcessPeriod = new GERPTextField("Process Period");
    tfProcessPeriod.setWidth("170");
    tfProcessPeriod.setReadOnly(true);
    cbBranch = new GERPComboBox("Branch");
    cbBranch.setWidth("170");
    cbBranch.setNullSelectionAllowed(false);
    cbBranch.setItemCaptionPropertyId("branchName");
    cbBranch.setImmediate(true);
    cbBranch.setValue(0L);
    cbBranch.addValueChangeListener(
        new Property.ValueChangeListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void valueChange(ValueChangeEvent event) {
            Object itemId = event.getProperty().getValue();
            if (itemId != null) {
              loadEmployeeList();
            }
          }
        });
    btnsaveAttenProc.addClickListener(
        new ClickListener() {
          // Click Listener for Add and Update
          private static final long serialVersionUID = 6551953728534136363L;

          @Override
          public void buttonClick(ClickEvent event) {
            saveattapprove();
          }
        });
    cbEmployeeName = new GERPComboBox("Employee Name");
    cbEmployeeName.setItemCaptionPropertyId("firstname");
    cbEmployeeName.setWidth("200");
    cbEmployeeName.setImmediate(true);
    cbEmployeeName.setNullSelectionAllowed(false);
    btnSearchStaff = new GERPButton("Search Employee", "searchbt", this);
    btnAttendanceProc = new GERPButton("Run Attendance Process", "savebt", this);
    btnAttendanceProc.addClickListener(
        new ClickListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void buttonClick(ClickEvent event) {
            // TODO Auto-generated method stub
            loadAttendenceProcess();
            // new AttendenceApprove();
          }
        });
    btnSearch.setVisible(false);
    hlSearchLayout = new GERPAddEditHLayout();
    assembleSearchLayout();
    hlSrchContainer.addComponent(GERPPanelGenerator.createPanel(hlSearchLayout));
    resetFields();
    loadAttendanceProcessBranchList();
    loadPayPeriod();
    loadSrchRslt();
  }
コード例 #11
0
  private void buildView() {
    logger.info(
        "Company ID : "
            + companyid
            + " | User Name : "
            + username
            + " > "
            + "Painting PurchaseEnquiry UI");
    // Initialization for Purchase Enquire Details user input components
    tfEnqNo = new TextField("Enquiry No");
    tfEnqNo.setMaxLength(40);
    tfEnqQty = new TextField();
    tfEnqQty.setValue("0");
    tfEnqQty.setWidth("90");
    dfDueDate = new GERPPopupDateField("Due Date");
    dfDueDate.setInputPrompt("Select Date");
    dfEnqDate = new GERPPopupDateField("Enquiry Date");
    dfEnqDate.setInputPrompt("Select Date");
    taEnqDtlRem = new TextArea("Remarks");
    taEnqDtlRem.setMaxLength(40);
    taEnqDtlRem.setWidth("150");
    taEnqDtlRem.setHeight("50");
    taEnqRem = new TextArea("Remarks");
    taEnqRem.setHeight("50");
    taEnqDtlRem.setMaxLength(100);
    cbBranch = new GERPComboBox("Branch Name");
    cbBranch.setItemCaptionPropertyId("branchName");
    loadBranchList();
    try {
      ApprovalSchemaDM obj =
          serviceSmsPurEnqHdr.getReviewerId(companyid, appScreenId, branchId, roleId).get(0);
      if (obj.getApprLevel().equals("Approver")) {
        cbEnqStatus =
            new GERPComboBox("Status", BASEConstants.T_SMS_P_ENQUIRY_HDR, BASEConstants.RP_STATUS);
      } else {
        cbEnqStatus =
            new GERPComboBox(
                "Status", BASEConstants.T_SMS_P_ENQUIRY_HDR, BASEConstants.PE_STATUS_RV);
      }
    } catch (Exception e) {
      logger.info(e.getMessage());
    }
    cbEnqStatus.setWidth("120");
    cbEnqDtlStatus =
        new GERPComboBox("Status", BASEConstants.M_GENERIC_TABLE, BASEConstants.M_GENERIC_COLUMN);
    lsProduct = new ListSelect("Product Name");
    lsProduct.setItemCaptionPropertyId("prodname");
    lsProduct.setMultiSelect(true);
    loadProduct();
    lsProduct.setImmediate(true);
    lsProduct.addValueChangeListener(
        new ValueChangeListener() {
          /** */
          private static final long serialVersionUID = 1L;

          @Override
          public void valueChange(ValueChangeEvent event) {
            String[] split =
                lsProduct
                    .getValue()
                    .toString()
                    .replaceAll("\\[", "")
                    .replaceAll("\\]", "")
                    .split(",");
            for (String obj : split) {
              if (obj.trim().length() > 0) {
                cbUom.setReadOnly(false);
                cbUom.setValue(
                    serviceProduct
                        .getProductList(
                            companyid, Long.valueOf(obj.trim()), null, null, null, null, null, "F")
                        .get(0)
                        .getUom());
                cbUom.setReadOnly(true);
              }
            }
          }
        });
    cbUom = new TextField();
    cbUom.setWidth("77");
    cbUom.setHeight("23");
    lsVendorName = new ListSelect("Vendor Name ");
    lsVendorName.setMultiSelect(true);
    lsVendorName.setItemCaptionPropertyId("vendorName");
    loadVendorList();
    lsVendorName.setWidth("150");
    lsVendorName.setHeight("75");
    hlSearchLayout = new GERPAddEditHLayout();
    assembleSearchLayout();
    hlSrchContainer.addComponent(GERPPanelGenerator.createPanel(hlSearchLayout));
    resetFields();
    loadSrchRslt();
    loadPurDtl();
    btnaddSpec.setStyleName("add");
    btnaddSpec.addClickListener(
        new ClickListener() {
          // Click Listener for Add and Update
          private static final long serialVersionUID = 6551953728534136363L;

          @Override
          public void buttonClick(ClickEvent event) {
            if (dtlValidation()) {
              saveEnqDtl();
            }
          }
        });
    btndelete.setEnabled(false);
    // ClickListener for Enquire Detail Tale
    tblSmsEnqDtl.addItemClickListener(
        new ItemClickListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void itemClick(ItemClickEvent event) {
            if (tblSmsEnqDtl.isSelected(event.getItemId())) {
              tblSmsEnqDtl.setImmediate(true);
              btnaddSpec.setCaption("Add");
              btnaddSpec.setStyleName("savebt");
              btndelete.setEnabled(false);
              enqDtlresetFields();
            } else {
              ((AbstractSelect) event.getSource()).select(event.getItemId());
              btnaddSpec.setCaption("Update");
              btnaddSpec.setStyleName("savebt");
              btndelete.setEnabled(true);
              editSmsPurDetail();
            }
          }
        });
    btndelete.addClickListener(
        new ClickListener() {
          // Click Listener for Add and Update
          private static final long serialVersionUID = 6551953728534136363L;

          @Override
          public void buttonClick(ClickEvent event) {
            if (btndelete == event.getButton()) {
              deleteDetails();
            }
          }
        });
  }
コード例 #12
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);
  }
コード例 #13
0
ファイル: JobViewForm.java プロジェクト: coderhelps/konekti
  /**
   * The constructor should first build the main layout, set the composition root and then do any
   * custom initialization.
   *
   * <p>The constructor will not be automatically regenerated by the visual editor.
   *
   * @throws Exception
   * @throws IllegalArgumentException
   */
  public JobViewForm() throws IllegalArgumentException, Exception {
    buildMainLayout();
    setCompositionRoot(mainLayout);

    // TODO add user code here
    initComponents();

    cronExpressionField.setVisible(false);
    future_timeField.setEnabled(false);
    startTimeField.setResolution(DateField.RESOLUTION_SEC);
    endTimeField.setResolution(DateField.RESOLUTION_SEC);

    // configure Type data
    areaField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    areaField.setItemCaptionPropertyId("name");

    jobTriggerTypeField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    jobTriggerTypeField.setItemCaptionPropertyId("description");

    jobIntervalTypeField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    jobIntervalTypeField.setItemCaptionPropertyId("description");

    // get form services from OSGi Service Registry
    getServices();

    // load data sources
    loadData();

    futureField.setImmediate(true);
    futureField.addListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() == null) return;

            if ((Boolean) event.getProperty().getValue()) future_timeField.setEnabled(true);
            else {
              future_timeField.setValue(null);
              future_timeField.setEnabled(false);
            }
          }
        });

    jobTriggerTypeField.setImmediate(true);
    jobTriggerTypeField.setNullSelectionAllowed(false);
    jobTriggerTypeField.addListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() == null) return;

            if (((JobTriggerType) event.getProperty().getValue())
                .getCode()
                .equals(Job.JOB_TRIGGER_TYPE.SIMPLE.name())) {
              jobIntervalField.setVisible(true);
              jobIntervalTypeField.setVisible(true);
              repeatCountField.setVisible(true);
              cronExpressionField.setVisible(false);
            } else {
              jobIntervalField.setVisible(false);
              jobIntervalTypeField.setVisible(false);
              repeatCountField.setVisible(false);
              cronExpressionField.setVisible(true);
            }
          }
        });
  }