Thursday 5 February 2009

half arsed and happy

I have recently decided to have a crack at making some sort of editor, there are several formats of documents that I would like represented in a specific way and have been as yet unable to find any editors that meet my needs. Plus it would be a great opportunity to learn some of the finer points of Swing or whatever I eventually decide to use. As a side note: it may suit my purposes to make the editor using GTK since it is looking more and more like this is the best solution to the interface for my media centre. For the Swing MVC ( well in the style of mvc but more like message-delegate, I think ) you get a series of interfaces I'll add to this blog as time goes on but for now it looks like this A JEditorPane is an uneditable representation of some styled document, it editable subclass is the JTextPane - to be honest I would have named these the other way round to avoid confusion but thats me. a JEditorPane displays a StyledDocument, this is an extended version of the Document class which consists of lots of Elements that are held in a tree like structure, all of which makes sense. Each Element can have Attributes ( for example bold, italic, size... ), these attributes are what are translated to the visible difference in text and other objects. The Document itself does not carry state, so we don't know where any caret may be or anything that is selected, it is just the data that forms the Document. In order to have state and hence to be able to 'View' the data the Document is added to the JEditorPane inside an EditorKit, this kit is then responsible for displaying the styling defined in the Document as represented by the Style interface. After looking at all this it does kinda make your head ache but it does make sense after a while...as you may have noticed I haven't looked into the Styleing of the Document much yet I have only got as far as the Pane and Document stuff. Therefore I shall add to this blog as the murky waters begin to clear

1 comment:

  1. I am bored of this editor already so I have put it on the back burner for now.

    And I have decided to make the GUI for the media-centre using GTK+ as it should solve most issues for me. A shame to not be platform independant but at the end of the day I only have one media-centre so will only every use the one operating system :)

    ReplyDelete

 
Stack Overflow profile for Richard Johnson at Stack Overflow, Q&A for professional and enthusiast programmers