[brailleblaster] push by john.bo...@xxxxxxxxxxxxxxxxx - Adding more code and documentation to newcode directory. on 2012-10-27 20:59 GMT

  • From: brailleblaster@xxxxxxxxxxxxxx
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Sat, 27 Oct 2012 20:59:43 +0000

Revision: 13699e6cb837
Branch:   default
Author:   John Boyer <john.boyer@xxxxxxxxxxxxxxxxx>
Date:     Sat Oct 27 13:57:41 2012
Log:      Adding more code and documentation to newcode directory.
http://code.google.com/p/brailleblaster/source/detail?r=13699e6cb837

Added:
 /src/main/org/brailleblaster/newcode/wordprocessorrequiremennts.txt
Modified:
 /src/main/org/brailleblaster/newcode/Semantics.java

=======================================
--- /dev/null
+++ /src/main/org/brailleblaster/newcode/wordprocessorrequiremennts.txt Sat Oct 27 13:57:41 2012
@@ -0,0 +1,14 @@
+Here are the requirements for the BrailleBlaster wordprocessor/editor.
+
+Typewriter-like font with italic, bold and underline variants.
+
+A Unicode Braille font that shows dot patterns.
+
+Ability to show emphasis and highlighting of single letters and words.
+
+Closely tied to position in xml parse tree.
+
+Ability to change contrast.
+
+
+
=======================================
--- /src/main/org/brailleblaster/newcode/Semantics.java Fri Oct 26 13:23:12 2012 +++ /src/main/org/brailleblaster/newcode/Semantics.java Sat Oct 27 13:57:41 2012
@@ -32,6 +32,8 @@
 package newcode;

 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import nu.xom.Builder;
@@ -46,6 +48,7 @@
 import org.brailleblaster.localization.LocaleHandler;
 import org.brailleblaster.util.Notify;
 import org.brailleblaster.util.YesNoChoice;
+import java.util.Hashtable;

 /**
  * This class provides the means of displaying and editing any
@@ -108,22 +111,92 @@
  * being processed is read and each line is used to create an entry in
  * this table.
  */
-SemanticEntry[] semanticTable = new SemanticEntry[100];
+private SemanticEntry[] semanticTable = new SemanticEntry[100];

-public boolean makeSemanticsTable (Document doc) {
-return true;
+/**
+ * This is the parsed xml document (Containing UTDML).
+ */
+private Document parsedDocument;
+
+/**
+ * The semanticLookup hash table has literal markup  in the
+ semanticTable as keys and the index of entries in the samanticTable as
+ values.
+ */
+Hashtable<String, Integer> semanticLookup = new Hashtable<String,
+   Integer>();
+private LocaleHandler lh = new LocaleHandler();
+private boolean internetAccessRequired;
+private boolean newEntries;
+
+/**
+ * Handle the namespaces entries in a semantic-action file.
+ */
+private void handleNamespaces (String nm) {
+}
+
+/**
+ * Find the root element of parsedDocument and look for a file with the
+ * root name concatenated with .sem in the semantics directory. Read
+ * this file into semanticTable, separating the various strings and putting
+ * them into their proper fields. Then construct the semanticLookup
+ * Hashtable. If no semantic-action file is found construct a bare-bones
+ * semanticTable, and output a prototype semantic-action file in the
+ * user's semantics directory. Show a dialog box informing the user of
+ * the situation.
+ */
+private void makeSemanticsTable() {
+  internetAccessRequired = false;
+  newEntries = false;
 }

+/**
+ * Evaluate any Xpath expressions that the semanticTable may contain and
+ add the bbsem attribute to the nodes in the nodeset. The bbsem attribut
+ has the index of the entry in the semanticTable as its valuel
+ */
+private void doXPathExpressions() {
+}
+
+/**
+ * Add the bbsem attribute to nodes in the parse tree.  Any XPath
+ * expressions in the semanticTable have already been aplied. The
+ * parse tree is traversed, and the semanticTable is checked for matching
+ * markup. If found, a bbsem attribute with a value of the index in the
+ * semanticTable is added to the element node.
+ */
 private void addBBSemAttr (Element element) {
 }

-public void makeDocumentModel (Document doc) {
+/**
+ * Make the BrailleBlaster document model, calling addBBSemAttr
+ * recursively. fileName is the complete path of an xml file containing
+ * UTDML.
+ */
+public void makeDocumentModel (String fileName) {
+  File file = new File (fileName);
+Builder parser = new Builder();
+try {
+parsedDocument = parser.build (file);
+} catch (ParsingException e) {
+new Notify(lh.localValue("malformedDocument"));
+return;
+} catch (IOException e) {
+new Notify(lh.localValue("couldNotOpen") + " " + fileName);
+return;
+}
+  file = null;
+  makeSemanticsTable();
+  doXPathExpressions();
+  Element rootElement = parsedDocument.getRootElement();
+  addBBSemAttr (rootElement);
+  semanticLookup = null;
 }

 private void doActionOrStyle (Element element) {
 }

-public void readAndEdit (Document doc) {
+public void readAndEdit() {
 }

 }

Other related posts:

  • » [brailleblaster] push by john.bo...@xxxxxxxxxxxxxxxxx - Adding more code and documentation to newcode directory. on 2012-10-27 20:59 GMT - brailleblaster