On Thu, 26 Jun 2008, Graeme Geldenhuys wrote:
> 2008/6/26 Kostas Michalopoulos <[EMAIL PROTECTED]>: > > I have the feeling that Swing uses this wherever text is used. This is why > > you can set a JLabel's caption to "<html>This is <b>some bold test</b> near > > an image <img src='foo.png'>" and having it working. This provides a lot of > > flexibility. And this is one of the reasons why Swing is *so* slow :-). In a > > program of medium size i did in Java which was in Swing, i used this feature > > only once. Yet i could do without it if the toolkit was a little more > > faster. > > > > Please don't bring stuff like this to LCL. Or at least make them so optional > > one can throw them out completelly if not needed. Anything more elaborate > > than: > > OK, you are understanding the Document Interface incorrectly. But I > think you are correct about any Swing component that stores text, > using the Document Interface. The Document Interface is where the > content (text) is stored, it's nothing visual. Think of the Document > as a String/TStringList replacement. It's up the the individual > component to decide how to paint the content. > > The Document Interface has some nice advantages. Because the data/text > (content) is abstracted, it's easier to implement things like > Model-View-Controller. Different behavior is very easily added to the > Document via filters (eg: auto spell check, uppercase all text, filter > out tab characters or other not printable characters etc..). And these > filter can be reused with other components supporting the Document > Interface. The other really nice benefit is that different components > can share the same Document. Hence they will always be in sync and > only have a single instance in memory. This could be very handy for > SynEdit if it supports multiple views into the same document (eg: > Editor window is split in two and each part is viewing different > sections of the same text document. Edit one and the other is > automatically in sync.). While this is all certainly true, it's simply overkill for 99% of the cases, and adds a lot of memory and parsing overhead. Simplicity is a virtue in design. Michael. _______________________________________________ Lazarus mailing list [email protected] http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
