Yes indeed. Although I would not attempt to make the div look exactly like a text area, that would be a very painful exercise. My thoughts were along the lines of: .readonlytextearea { width: 500px; height: 150px; overflow: auto; border: thin solid #000; }
Erik. ChuckDeal schreef: > To be clear, you are proposing that I create a new component that generates a > div with css that makes it appear to be a TextArea, then when I determine > (determination based upon the user/data) that I want a readonly TextArea, I > replace the real TextArea with a FakeTextArea prior to rendering? > > Before I attempt this myself, has anyone created a div based TextArea > component, that can be made available to me? > > > Erik van Oosten wrote: > >> Hi, >> >> It is up to the component on how to interpreted the disabled property. >> In your case you could make a new form component (use TextArea as >> template) that shows a div with scroll bars instead of an input element. >> If you still need the input element, simply add it, but make it hidden. >> >> Regards, >> Erik. >> >> >> ChuckDeal schreef: >> >>> I'm not sure about other browsers, but IE6 doesn't allow scrolling of a >>> disabled TextArea. TextArea extends FormComponent and form component has >>> an >>> internal Behavior that adds the disabled attribute when the field is set >>> to >>> disabled (setEnabled(false)). This causes my project grief because we >>> need >>> to add the READONLY attribute instead. But, as far as I can see there is >>> no >>> way to remove a Behavior because they are not "named (ala a Map) and the >>> getBehaviors returns an unmodifiable List. I see that the >>> DisabledAttributeModifier extends AttributeModifer that supports an >>> enabled >>> flag, but this internal class is private and it makes working with it >>> difficult. >>> >>> Does this non-scrolling behavior happen with other browsers or just IE? >>> If >>> it happens elsewhere, might I suggest that Wicket change it's default >>> behavior to put a readonly attribute instead of disabled? >>> >>> What is the recommended way of working with behaviors that are already >>> added >>> to a Component? >>> >>> Here is what I came up with for disabling the behavior for a TextArea. >>> Notice that I had to use the FQN instead of the Class object because the >>> behavior is private to FormComponent. >>> >>> public class TextAreaFixer { >>> /** >>> * Constructor for TextAreaFixer >>> */ >>> private TextAreaFixer() { >>> super(); >>> } >>> >>> /** >>> * Find the FormComponent$DisabledAttributeModifier and disable it! >>> * >>> * @param textArea >>> */ >>> public static void updateTextArea(TextArea textArea) { >>> for (IBehavior behavior : >>> (List<IBehavior>)textArea.getBehaviors()) { >>> if >>> (behavior.getClass().getName().equals("wicket.markup.html.form.FormComponent$DisabledAttributeModifier")) >>> { >>> ((AttributeModifier)behavior).setEnabled(false); >>> break; >>> } >>> } >>> } >>> } >>> >>> Then to use it, in my code: >>> >>> TextArea description = new TextArea("description"); >>> add(description); >>> TextAreaFixer.updateTextArea(description); >>> >>> Is ther a better way to do what I am trying to accomplish? >>> >>> Thanks! >>> >>> >> -- >> Erik van Oosten >> http://www.day-to-day-stuff.blogspot.com/ >> >> >> ------------------------------------------------------------------------- >> Using Tomcat but need to do more? Need to support web services, security? >> Get stuff done quickly with pre-integrated technology to make your job >> easier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> Wicket-user mailing list >> Wicket-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> >> >> > > -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user