private void onNameChanged(InputEvent e) { String value = e.getValue(); Textbox box = (Textbox) e.getTarget(); String lastName, firstName; if (box == lastNameBox) { lastName = value; firstName = firstNameBox.getValue(); } else { lastName = lastNameBox.getValue(); firstName = value; } labelBox.setValue(lastName + ", " + firstName); }
public void onChanging$cmbEmpleadosPreparaciones(ForwardEvent event) { logger.log(Level.INFO, "[GestionIngresosDescuentosCtrl][onChanging$cmbEmpleadosPreparaciones]"); try { listaPlanillaDetalles = null; InputEvent input = (InputEvent) event.getOrigin(); if (planillaSelected != null && StringUtils.isNotBlank(input.getValue())) { listaPlanillaDetalles = personalBean.obtenerPlanillasDetallesPorCriterio( planillaSelected.getCodigoPlanilla(), input.getValue(), Boolean.TRUE); } renderizarDatosPlanillaDetalle(); } catch (Exception e) { e.printStackTrace(); } }
/* * http://forum.zkoss.org/question/12670/get-onchanging-value-in-java/ * Should use InputEvent instead of Event * * Same effect as: searchBar.addEventListener(Events.ON_CHANGING, new EventListener<Event>() { ... */ @SuppressWarnings({"rawtypes", "unchecked"}) @Listen("onChanging=#searchBar") public void changeSelected(InputEvent fe) { String keyword = fe.getValue(); log.debug( "onChanging=#searchBar: oldVal->" + ((Bandbox) fe.getTarget()).getValue() + " newVal->" + keyword); // refresh list List<NoteNode> list = noteService.findMatchedTopicsByUser( UserCredentialManager.getIntance().getUser().getId(), keyword); filterbox.setModel(new SimpleListModel(list.toArray())); }