propertyeditor

Spring MVC abstract class binding

那年仲夏 提交于 2019-12-24 16:58:43
问题 Assume I have classes: abstract class Animal {} class Elephant extends Animal { Trunk trunk; RightEar rightEar; } class Peacock extends Animal { Tail tail; Beak beak; } And I want to write single controller method, which will have parameter of type Animal : @RequestMapping("/animal") public ModelAndView animalsHandler(@ModelAttribute("animal") Animal animal) {...} I found that for non-complex parameter it could be done by choosing appropriate propertyEditor in @InitBinder method, i.e. it will

How to modify TComponentProperty to show only particular items on drop down list?

不问归期 提交于 2019-12-12 12:25:32
问题 Please consider such scenerio: I have component called TMenuItemSelector which has two published properties: PopupMenu - allows to pick an instance of TPopupMenu from the form and MenuItem which allows to pick any instance of TMenuItem from the form. I would like to modify property editor for MenuItem property in a way that when PopupMenu is assigned then only menu items from this PopupMenu are visible in a drop down list. I know that I need to write my own descendant of TComponentProperty

Spring @InitBinder not invoked when showing form => CustomEditors not defined

橙三吉。 提交于 2019-12-08 13:21:59
问题 I have following (simplified to the bone) Controller: @Controller public class TestController { @RequestMapping(value = "/test.htm", method = RequestMethod.GET) public String showForm(final ModelMap map) { final TestFilter filter = new TestFilter(); filter.setStartDate(new Date(System.currentTimeMillis())); map.addAttribute("reportPerResourceForm", filter); return "test"; } @InitBinder public void initBinder(final WebDataBinder binder) { binder.registerCustomEditor(Date.class, null, new

Converting Delphi 7 property editor to Delphi XE2

拥有回忆 提交于 2019-12-07 19:10:27
问题 First of all, I have never written a property editor from scratch, but had some help with one in another question. Refer to the accepted answer there. This was in Delphi 7, and now I have started using XE2 and I have to make sure my property editor is compatible with both 7 and XE2. It's essentially a collection editor, with the difference that each collection item has its own named component in the parent form. Is there anything new about the property editors in XE2 since 7, since it is a

Spring CustomNumberEditor parses numbers that are not numbers

狂风中的少年 提交于 2019-12-07 06:45:06
问题 I'm using Spring CustomNumberEditor editor to bind my float values and I've experimented that if in the value is not a number sometimes it can parse the value and no error is returned. number=10 ...... then the number is 10 and there's no errors number=10a ...... then the number is 10 and there's no errors number=10a25 ...... then the number is 10 and there's no errors number=a ...... error because the number is not valid So it seems that the editor parses the value until it can and omit the

Converting Delphi 7 property editor to Delphi XE2

别等时光非礼了梦想. 提交于 2019-12-05 19:55:17
First of all, I have never written a property editor from scratch, but had some help with one in another question . Refer to the accepted answer there. This was in Delphi 7, and now I have started using XE2 and I have to make sure my property editor is compatible with both 7 and XE2. It's essentially a collection editor, with the difference that each collection item has its own named component in the parent form. Is there anything new about the property editors in XE2 since 7, since it is a huge version jump? I do NOT want to make a complete copy of my unit for different versions. I want to

Using the setAllowedFields() method in Spring

被刻印的时光 ゝ 提交于 2019-12-01 10:54:01
I'm using Spring 3.2.0. I have registered a few custom property editors for some basic needs as follows. import editors.DateTimeEditor; import editors.StrictNumberFormatEditor; import java.math.RoundingMode; import java.net.URL; import java.text.DecimalFormat; import java.text.NumberFormat; import org.joda.time.DateTime; import org.springframework.beans.propertyeditors.StringTrimmerEditor; import org.springframework.beans.propertyeditors.URLEditor; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web

How can I implement my own custom property editor for all instances of a certain type?

烂漫一生 提交于 2019-11-30 12:57:08
问题 I have followed a few tutorials on creating a custom property editor dialog, but there are so many things involved that I could not get it to work right. What I am trying to accomplish is a custom form with a date picker (calendar), a time picker, and OK and Cancel buttons. The form is no problem at all, but how would I go about implementing this so that I can publish a property in any component of a certain type with a button to launch the property editor? I would like to completely override