UIInput dropdown = (UIInput) facesContext.getViewRoot().findComponent("formid:dropdownid"); dropdown.setValue(null);
[...] UIInput input = (UIInput) FacesContext.getCurrentInstance().getViewRoot().findComponent("editform:textBoxParent"); input.setValue(selectedFase.getTitel()); input.setSubmittedValue(null); [...]
@Override public void setValue(Object value) { getWrapped().setValue(value); }
@Override public void setValue(Object value) { getWrapped().setValue(value); }
/** * Set the selected and available values of the day, month and year fields based on the model. */ @Override public void encodeBegin(FacesContext context) throws IOException { String value = getAttributeValue("value", ""); String dddValue = ""; String prefixoValue = ""; String sufixoValue = ""; if (value.length() > EIGHT) { dddValue = value.substring(0, 2); int quantidadePrefixo = value.length() == TEN ? 6 : 7; prefixoValue = value.substring(2, quantidadePrefixo); sufixoValue = value.substring(quantidadePrefixo); } ddd.setValue(dddValue); prefixo.setValue(prefixoValue); sufixo.setValue(sufixoValue); super.encodeBegin(context); }
public void searchCep() { if (zipCode.getSubmittedValue() == null) { return; } CepBean cepBean = CDI.current().select(CepService.class).get().buscaCep(zipCode.getSubmittedValue().toString()); publicPlace.setValue(cepBean.getLogradouro()); complement.setValue(""); district.setValue(cepBean.getBairro()); county.setValue(cepBean.getMunicipio()); state.setValue(cepBean.getEstado()); } }
/** * Set the selected and available values of the day, month and year fields based on the model. */ @Override public void encodeBegin(FacesContext context) throws IOException { Calendar calendar = Calendar.getInstance(); int maxYear = getAttributeValue("yearMax", calendar.get(Calendar.YEAR)); int minYear = getAttributeValue("yearMin", maxYear - ONE_HUNDRED); Date date = (Date) getValue(); if (date != null) { calendar.setTime(date); int yearLocal = calendar.get(Calendar.YEAR); if (yearLocal > maxYear || minYear > yearLocal) { throw new IllegalArgumentException(String.format("Year %d out of min/max range %d/%d.", yearLocal, minYear, maxYear)); } } day.setValue(calendar.get(Calendar.DATE)); month.setValue(calendar.get(Calendar.MONTH) + 1); year.setValue(calendar.get(Calendar.YEAR)); setDays(createIntegerArray(1, calendar.getActualMaximum(Calendar.DATE))); setMonths(createIntegerArray(1, calendar.getActualMaximum(Calendar.MONTH) + 1)); setYears(createIntegerArray(maxYear, minYear)); super.encodeBegin(context); }
public void setValue(Object value) { setupPerspective(); innerGetDelegateInput().setValue(value); teardownPerspective(); }
/** * @since 1.2 */ public void resetValue() { setSubmittedValue(null); setValue(null); setLocalValueSet(false); setValid(true); }
/** * Update the available days based on the selected month and year, if necessary. */ public void updateDaysIfNecessary(AjaxBehaviorEvent event) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DATE, 1); calendar.set(Calendar.MONTH, (Integer) month.getValue() - 1); calendar.set(Calendar.YEAR, (Integer) year.getValue()); int maxDay = calendar.getActualMaximum(Calendar.DATE); if (getDays().length != maxDay) { setDays(createIntegerArray(1, maxDay)); if ((Integer) day.getValue() > maxDay) { day.setValue(maxDay); // Fix the selected value if it exceeds new max value. } FacesContext context = FacesContext.getCurrentInstance(); // Update day field. context.getPartialViewContext().getRenderIds().add(day.getClientId(context)); } }
/** * <p>Convenience method to reset this component's value to the * un-initialized state. This method does the following:</p> * <p/> * <p>Call {@link #setValue} passing <code>null</code>.</p> * <p/> * <p>Call {@link #setSubmittedValue} passing <code>null</code>.</p> * <p/> * <p>Call {@link #setLocalValueSet} passing <code>false</code>.</p> * <p/> * <p>Call {@link #setValid} passing <code>true</code>.</p> * <p/> * <p>Upon return from this call if the instance had a * <code>ValueBinding</code> associated with it for the "value" * property, this binding is evaluated when {@link * UIOutput#getValue} is called. Otherwise, <code>null</code> is * returned from <code>getValue()</code>.</p> */ public void resetValue() { this.setValue(null); this.setSubmittedValue(null); this.setLocalValueSet(false); this.setValid(true); }
/** * <p>Convenience method to reset this component's value to the * un-initialized state. This method does the following:</p> * <p/> * <p>Call {@link #setValue} passing <code>null</code>.</p> * <p/> * <p>Call {@link #setSubmittedValue} passing <code>null</code>.</p> * <p/> * <p>Call {@link #setLocalValueSet} passing <code>false</code>.</p> * <p/> * <p>Call {@link #setValid} passing <code>true</code>.</p> * <p/> * <p>Upon return from this call if the instance had a * <code>ValueBinding</code> associated with it for the "value" * property, this binding is evaluated when {@link * UIOutput#getValue} is called. Otherwise, <code>null</code> is * returned from <code>getValue()</code>.</p> */ public void resetValue() { this.setValue(null); this.setSubmittedValue(null); this.setLocalValueSet(false); this.setValid(true); }
/** * {@inheritDoc} * * @see javax.faces.component.UIInput#setValue(java.lang.Object) */ @Override public void setValue(Object value) { // Check if the local values get restored if (value != null && value instanceof LocalUploadValue) { LocalUploadValue localValue = (LocalUploadValue) value; localFileName = localValue.getFileName(); localFileSize = localValue.getFileSize(); localContentType = localValue.getContentType(); localInputStream = localValue.getInputStream(); } else { super.setValue(value); } }
@Override public void encodeBegin(FacesContext context) throws IOException { if (!isRendered()) { return; } ResponseWriter responseWriter = context.getResponseWriter(); responseWriter.startElement(Constante.HTML_ELEMENT_DIV, null); responseWriter.writeAttribute(Constante.HTML_ATTREBUT_CLASS, "ui-form-item ui-widget ui-helper-reset", null); // Champ nom d'utilisateur StringBuilder idGenerate = new StringBuilder(); idGenerate.append(getId()).append('-').append("input"); createLabel(); inputUser = createInput(); inputUser.setId(idGenerate.toString()); inputUser.setRequired(isRequired()); inputUser.setValue(getValue()); this.getChildren().add(inputUser); createMessage(); }
public void updateModel(FacesContext context) { AssertionUtil.assertNotNull("context", context); if (!isValid() || !isLocalValueSet()) { return; } final ValueBinding valueBinding = getValueBinding("value"); if (valueBinding == null) { return; } try { final Object localValue = getLocalValue(); valueBinding.setValue(context, localValue); setValue(null); setLocalValueSet(false); } catch (RuntimeException e) { Object[] args = { UIComponentUtil.getLabel(this) }; context.getExternalContext().log(e.getMessage(), e); FacesMessageUtil.addErrorComponentMessage(context, this, CONVERSION_MESSAGE_ID, args); setValid(false); } }
public void updateModel(FacesContext context) { if (!isValid()) return; if (!isLocalValueSet()) return; ValueExpression expression = getValueExpression("value"); if (expression == null) return; try { expression.setValue(context.getELContext(), getLocalValue()); setValue(null); setLocalValueSet(false); } catch (Exception e) { context.getExternalContext().log(e.getMessage(), e); _MessageUtils.addErrorMessage(context, this, UPDATE_MESSAGE_ID, new Object[]{_MessageUtils.getLabel(context,this)}); setValid(false); /* we are not allowed to throw exceptions here - we still need the full stack-trace later on * to process it later in our error-handler */ queueExceptionInRequest(context, expression, e); } }
setValue(null); setLocalValueSet(false);
public void validate(FacesContext context) { AssertionUtil.assertNotNull("context", context); Object submittedValue = getSubmittedValue(); if (submittedValue == null) { return; } Object convertedValue = getConvertedValue(context, submittedValue); if (!isValid()) { return; } validateValue(context, convertedValue); if (!isValid()) { return; } Object previous = getValue(); setValue(convertedValue); setSubmittedValue(null); if (compareValues(previous, convertedValue)) { queueEvent(new ValueChangeEvent(this, previous, convertedValue)); } }
setValue(convertedValue); setSubmittedValue(null); if (compareValues(previousValue, convertedValue))
UIInput input = multiple.getInputInstance(); input.setId( createChildId( multiple.getId(), index ) ); input.setValue( v ); input.encodeAll( context ); writer.endElement( "div" );