List of usage examples for org.springframework.beans.propertyeditors StringArrayPropertyEditor StringArrayPropertyEditor
public StringArrayPropertyEditor()
From source file:org.jdal.model.TableState.java
/** * Set visible columns as CSV String // ww w .java2 s . co m * @param value the CSV String */ public void setVisibleColumns(String value) { StringArrayPropertyEditor pe = new StringArrayPropertyEditor(); pe.setAsText(value); visibleColumns = Arrays.asList((String[]) pe.getValue()); }
From source file:org.springmodules.cache.provider.ehcache.EhCacheFacade.java
/** * @see org.springmodules.cache.provider.CacheProviderFacade#getFlushingModelEditor() *//* w w w .j av a2 s . com*/ public PropertyEditor getFlushingModelEditor() { Map propertyEditors = new HashMap(); propertyEditors.put("cacheNames", new StringArrayPropertyEditor()); ReflectionCacheModelEditor editor = new ReflectionCacheModelEditor(); editor.setCacheModelClass(EhCacheFlushingModel.class); editor.setCacheModelPropertyEditors(propertyEditors); return editor; }
From source file:org.stockwatcher.web.StockController.java
private StockCriteria getCriteria(HttpServletRequest request) { StockCriteria criteria = new StockCriteria(); ServletRequestDataBinder binder = new ServletRequestDataBinder(criteria); binder.registerCustomEditor(Integer[].class, "industryIds", new StringArrayPropertyEditor()); binder.bind(request);/*from ww w . jav a 2 s .c o m*/ return criteria; }
From source file:org.hdiv.web.servlet.tags.form.OptionTagTests.java
public void testWithPropertyEditor() throws Exception { BindStatus bindStatus = new BindStatus(getRequestContext(), "testBean.stringArray", false) { public PropertyEditor getEditor() { return new StringArrayPropertyEditor(); }//from www. ja v a2 s . c om }; getPageContext().setAttribute(SelectTagHDIV.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus); this.tag.setValue(ARRAY_SOURCE); this.tag.setLabel("someArray"); int result = this.tag.doStartTag(); assertEquals(BodyTag.EVAL_BODY_BUFFERED, result); result = this.tag.doEndTag(); assertEquals(Tag.EVAL_PAGE, result); String output = getOutput(); assertOptionTagOpened(output); assertOptionTagClosed(output); String hdivValue = this.confidentiality ? "0" : ARRAY_SOURCE; assertContainsAttribute(output, "value", hdivValue); assertContainsAttribute(output, "selected", "selected"); assertBlockTagContains(output, "someArray"); }
From source file:org.nextframework.controller.ExtendedBeanWrapper.java
/** * Register default editors in this class, for restricted environments. * We're not using the JRE's PropertyEditorManager to avoid potential * SecurityExceptions when running in a SecurityManager. * <p>Registers a <code>CustomNumberEditor</code> for all primitive number types, * their corresponding wrapper types, <code>BigInteger</code> and <code>BigDecimal</code>. *///www . ja va2s .c om protected void registerDefaultEditors() { // Simple editors, without parameterization capabilities. // The JDK does not contain a default editor for any of these target types. this.defaultEditors.put(byte[].class, new ByteArrayPropertyEditor()); this.defaultEditors.put(Class.class, new ClassEditor()); this.defaultEditors.put(File.class, new FileEditor()); this.defaultEditors.put(InputStream.class, new InputStreamEditor()); this.defaultEditors.put(Locale.class, new LocaleEditor()); this.defaultEditors.put(Properties.class, new PropertiesEditor()); this.defaultEditors.put(Resource[].class, new ResourceArrayPropertyEditor()); this.defaultEditors.put(String[].class, new StringArrayPropertyEditor()); this.defaultEditors.put(URL.class, new URLEditor()); // Default instances of collection editors. // Can be overridden by registering custom instances of those as custom editors. this.defaultEditors.put(Collection.class, new CustomCollectionEditor(Collection.class)); this.defaultEditors.put(Set.class, new CustomCollectionEditor(Set.class)); this.defaultEditors.put(SortedSet.class, new CustomCollectionEditor(SortedSet.class)); this.defaultEditors.put(List.class, new CustomCollectionEditor(List.class)); // Default instances of character and boolean editors. // Can be overridden by registering custom instances of those as custom editors. PropertyEditor characterEditor = new CharacterEditor(true); PropertyEditor booleanEditor = new CustomBooleanEditor(true); // The JDK does not contain a default editor for char! this.defaultEditors.put(char.class, characterEditor); this.defaultEditors.put(Character.class, characterEditor); // Spring's CustomBooleanEditor accepts more flag values than the JDK's default editor. this.defaultEditors.put(boolean.class, booleanEditor); this.defaultEditors.put(Boolean.class, booleanEditor); // The JDK does not contain default editors for number wrapper types! // Override JDK primitive number editors with our own CustomNumberEditor. PropertyEditor byteEditor = new CustomNumberEditor(Byte.class, true); PropertyEditor shortEditor = new CustomNumberEditor(Short.class, true); PropertyEditor integerEditor = new CustomNumberEditor(Integer.class, true); PropertyEditor longEditor = new CustomNumberEditor(Long.class, true); PropertyEditor floatEditor = new CustomNumberEditor(Float.class, true); PropertyEditor doubleEditor = new CustomNumberEditor(Double.class, true); this.defaultEditors.put(byte.class, byteEditor); this.defaultEditors.put(Byte.class, byteEditor); this.defaultEditors.put(short.class, shortEditor); this.defaultEditors.put(Short.class, shortEditor); this.defaultEditors.put(int.class, integerEditor); this.defaultEditors.put(Integer.class, integerEditor); this.defaultEditors.put(long.class, longEditor); this.defaultEditors.put(Long.class, longEditor); this.defaultEditors.put(float.class, floatEditor); this.defaultEditors.put(Float.class, floatEditor); this.defaultEditors.put(double.class, doubleEditor); this.defaultEditors.put(Double.class, doubleEditor); this.defaultEditors.put(BigDecimal.class, new CustomNumberEditor(BigDecimal.class, false)); this.defaultEditors.put(BigInteger.class, new CustomNumberEditor(BigInteger.class, false)); //============================================================================================ // Date, Time, Hora e Timestamp. boolean allowEmpty = true; registerCustomEditor(Calendar.class, new CalendarEditor(simpleDateFormat, allowEmpty)); registerCustomEditor(Date.class, new CustomDateEditor(simpleDateFormat, allowEmpty)); registerCustomEditor(java.sql.Date.class, new CustomSqlDateEditor(simpleDateFormat, allowEmpty)); registerCustomEditor(Time.class, new TimePropertyEditor()); registerCustomEditor(SimpleTime.class, new SimpleTimePropertyEditor()); registerCustomEditor(Timestamp.class, new TimestampPropertyEditor()); // Tipos personalizados. registerCustomEditor(Cpf.class, new CpfPropertyEditor()); registerCustomEditor(Cnpj.class, new CnpjPropertyEditor()); registerCustomEditor(InscricaoEstadual.class, new InscricaoEstadualPropertyEditor()); registerCustomEditor(Money.class, new MoneyPropertyEditor()); registerCustomEditor(Cep.class, new CepPropertyEditor()); registerCustomEditor(PhoneBrazil.class, new PhoneBrazilPropertyEditor()); registerCustomEditor(Phone.class, new PhonePropertyEditor()); }