Hi Hanxiao, Thanks for the patch. I am working on a description of semantic-action files. That will help in further progress. John On Sun, Oct 07, 2012 at 12:33:59PM +0800, Hanxiao Fu wrote: > Hello, > > I made some progresses on displaying and editing. The patch is attached. To > see clearly what changes are made, use diff tools like KDiff, which can > ignore indentation and white-spaces. > > I didn't check the email John sent several days ago about revised framework > while I was working on this patch, but our aims are basically the same. I > will modify the patch to adjust to John's new framework, but meanwhile, I'd > like to share my current progress with you. Here are some important details > about this update: > 1. Now when BB opens an XML (through File-> open or File-> Recent > Document), it tries to add styling in the daisy view. Opening file is still > handled in a different thread to maintain the best user experience, though > a short period of sluggishness, around 5 second to 15 seconds, is observed > when opening a file. Most parts of this delay are caused by XOM builder > parsing the document, which was already there before this patch and I > couldn't find a way to improve its performance yet. The styling part's > performance should be good enough, though I haven't test it with really > large documents. > *To-do: According to John, BB should translate the document right after (or > even simultaneously) the document is opened. > 2. The initial styling is done in the following steps: > i. According to the name of the root element of an XML file, the semantic > file with the name [root element]_sem.properties in > dist/programData/semantics/ will be used. Semantic files decides what style > should be added to an element. Inside each file, it contains key-value pair > as the key is the element name and the value is the style should be added > to this element. > *To-do : > -configuration file was not implemented in this patch yet. > -Xpath expressions were not supported yet. > -I saw the discussion in the list about what kind of files should be used > to carry this information. In my opinion, properties files are simpler to > be handled in Java and easier to be viewed and modified than other formats, > whereas XMLs could potentially be more powerful and hence complicated. I > think XMLs can be used when BB gets more developed. For > now properties files are good enough for containing information, and we can > focus on more important tasks at hand. > ii. The information of a style is stored in > dist/prgramData/styles/[stylename]. properties or in user's local BB folder. > iii. The document is partitioned during opening. Each partition represents > a element in XML. It also contains information about its styling. Each > partition is an object of class MyStyleRange. I think this is what > was referred to as "block" by John. No change that takes place in more than > one block can be done. > iv. Now only three of the style properties are supported, they are lines > after, lines before and first line indentation. Lines after defines how > many new line characters should be inserted after an element. One cannot > navigate through or edit these new line characters, but only though Edit-> > Style Panel and then apply a style with different number of lines after. > Lines before is basically the same, except that they are inserted before an > element. First line indentation is self-evident. > *To-do : Support other styling properties > 3. As caret moves, the status bar shows some basic information about the > block where the caret is at. Also if the style panel is opened when caret > moves, its combo value automatically changes to what It also updates when a > style is applied, an element is inserted or an element is deleted. > 4. I didn't come up with a more convenient way to insert or delete a > block, now a block can be deleted if its lines before and after are both 0, > and all of its content is removed. An element can be inserted only between > two elements by entering "Enter"/ "Carriage Return". When an element is > inserted, the Enter itself won't insert a newline character like it used to > do. The new inserted element is named "newElement" for now, and is not > associated with any styles. > *To-do: > -Support changing element names > -Better mechanism to delete elements and to insert elements precisely > > *Some known issues: > -If there are elements with more than one Text child, it may mistakenly > save the content to different element when inserting new nodes to such > element. > -After inserting a new element after a element whose line after range has a > length of 0, the following input are considered new content for the > previous element instead of the new one. > I'm also attaching an XML that Vic used to send to the list. It could help > testing the new features. Hi Vic, I hope it is okay that I am sending this > to the list again. > > Best Regards, > Hanxiao -- John J. Boyer, Executive Director GodTouches Digital Ministry, Inc. http://www.godtouches.org Madison, Wisconsin, USA Peace, Love, Service