2 new revisions: Revision: 5ea2230a2ef3 Branch: default Author: Sahel "sahel.mastoureshgh@xxxxxxxxx" Date: Tue Jul 1 19:25:42 2014 UTC Log: Adding Boxline to brailleview http://code.google.com/p/brailleblaster/source/detail?r=5ea2230a2ef3 Revision: 5b7595ffbd6d Branch: default Author: Sahel "sahel.mastoureshgh@xxxxxxxxx" Date: Tue Jul 1 19:33:11 2014 UTC Log: merged with head http://code.google.com/p/brailleblaster/source/detail?r=5b7595ffbd6d ============================================================================== Revision: 5ea2230a2ef3 Branch: default Author: Sahel "sahel.mastoureshgh@xxxxxxxxx" Date: Tue Jul 1 19:25:42 2014 UTC Log: Adding Boxline to brailleview http://code.google.com/p/brailleblaster/source/detail?r=5ea2230a2ef3 Added:/src/main/org/brailleblaster/perspectives/braille/mapping/BrlOnlyMapElement.java
Modified: /src/main/org/brailleblaster/converter/Converter.java /src/main/org/brailleblaster/perspectives/braille/Manager.java /src/main/org/brailleblaster/perspectives/braille/views/wp/BrailleView.java /src/main/org/brailleblaster/perspectives/braille/views/wp/TextView.java ======================================= --- /dev/null+++ /src/main/org/brailleblaster/perspectives/braille/mapping/BrlOnlyMapElement.java Tue Jul 1 19:25:42 2014 UTC
@@ -0,0 +1,27 @@ +package org.brailleblaster.perspectives.braille.mapping; + +import nu.xom.Element; +import nu.xom.Node; + +public class BrlOnlyMapElement extends TextMapElement { + Element parent=null; + + public BrlOnlyMapElement(int start, int end, Node n,Element parent) { + super(start, end, n); + this.parent=parent; + // TODO Auto-generated constructor stub + } + public String getText(){ + return ""; + } + + public int textLength(){ + return 0; + } + + @Override + public Element parentElement(){ + return this.parent; + } + +} =======================================--- /src/main/org/brailleblaster/converter/Converter.java Wed Jun 25 17:39:54 2014 UTC +++ /src/main/org/brailleblaster/converter/Converter.java Tue Jul 1 19:25:42 2014 UTC
@@ -42,7 +42,7 @@ void tansformer(Document doc){String xslPath=BBIni.getProgramDataPath() + BBIni.getFileSep()+"xsl"+BBIni.getFileSep() +"NimasToEpub.xsl";
- + //need to change for something to outputString outputpath=BBIni.getProgramDataPath() + BBIni.getFileSep()+"xsl"+BBIni.getFileSep() +"NimasTemp.xml";
String docStr=doc.toXML(); InputStream in=null; @@ -52,26 +52,7 @@ // TODO Auto-generated catch block e1.printStackTrace(); } - /**Builder builder = new Builder(); - Document xslDoc; - try { - xslDoc = builder.build(xslPath); - Source xsl = new StreamSource(new File(xslPath)); - String test=xsl.toString(); - //XSLTransform xslt = new XSLTransform(xslDoc); - //Nodes newDocNodes = xslt.transform(doc); - //Document transformedDoc = xslt.toDocument(newDocNodes); - - } catch (ValidityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (ParsingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - }**/ + StreamSource domSource = new StreamSource( in); Source xsl = new StreamSource(new File(xslPath)); =======================================--- /src/main/org/brailleblaster/perspectives/braille/Manager.java Wed Jun 25 13:24:35 2014 UTC +++ /src/main/org/brailleblaster/perspectives/braille/Manager.java Tue Jul 1 19:25:42 2014 UTC
@@ -330,8 +330,20 @@ for(int i = 0; i < current.getChildCount(); i++){if(current.getChild(i) instanceof Element && ((Element)current.getChild(i)).getLocalName().equals("brl")){
- initializeBraille(current.getChild(i), list.getLast()); + //Added to handle brl for side bar+ if (((Element)current.getChild(i).getParent()).getLocalName().equals("sidebar"))
+ {+ text.setBRLOnlyText(list, "\n",((Element)current.getChild(i).getParent()));
+ braille.setBRLOnlyBraille(list,current.getChild(i)); + + + } + else + { + initializeBraille(current.getChild(i), list.getLast()); + } } +else if(current.getChild(i) instanceof Element && ((Element)current.getChild(i)).getLocalName().equals("math")){
//if math is empty skip next brl element if(validateMath((Element)current.getChild(i))) @@ -339,6 +351,12 @@ else i++; } + //Added this part for side bar+ else if(current.getChild(i) instanceof Element && ((Element)current.getChild(i)).getLocalName().equals("sidebar")){
+ initializeViews(current.getChild(i)); + + + } else { if(current.getChild(i) instanceof Element){ if(((Element)current.getChild(i)).getLocalName().equals("pagenum")){ =======================================--- /src/main/org/brailleblaster/perspectives/braille/views/wp/BrailleView.java Wed Apr 16 22:06:34 2014 UTC +++ /src/main/org/brailleblaster/perspectives/braille/views/wp/BrailleView.java Tue Jul 1 19:25:42 2014 UTC
@@ -42,11 +42,11 @@import org.brailleblaster.perspectives.braille.document.BBSemanticsTable.Styles; import org.brailleblaster.perspectives.braille.document.BBSemanticsTable.StylesType;
import org.brailleblaster.perspectives.braille.mapping.BrailleMapElement; +import org.brailleblaster.perspectives.braille.mapping.BrlOnlyMapElement; import org.brailleblaster.perspectives.braille.mapping.MapList; import org.brailleblaster.perspectives.braille.mapping.TextMapElement; import org.brailleblaster.perspectives.braille.messages.Message; import org.brailleblaster.perspectives.braille.messages.Sender; - import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CaretEvent; import org.eclipse.swt.custom.CaretListener; @@ -280,7 +280,7 @@ setListenerLock(true); Styles style = stylesTable.makeStylesElement(t.parentElement(), n); Styles prevStyle; - if(list.size() > 1) + if(list.size() > 1 && list.get(list.size() - 2).n!=null)prevStyle = stylesTable.makeStylesElement(list.get(list.size() - 2).parentElement(),list.get(list.size() - 2).n);
else prevStyle = null; @@ -876,4 +876,13 @@ total += spaceBeforeText + text.length(); spaceBeforeText = 0; } + + public void setBRLOnlyBraille(MapList list, Node child) { + String brailleSidebar="\n"+child.getValue(); + view.append(brailleSidebar);+ list.getLast().brailleList.add(new BrailleMapElement(total, total + brailleSidebar.length(), child));
+ total += brailleSidebar.length(); + + + } } =======================================--- /src/main/org/brailleblaster/perspectives/braille/views/wp/TextView.java Tue Jun 10 14:54:43 2014 UTC +++ /src/main/org/brailleblaster/perspectives/braille/views/wp/TextView.java Tue Jul 1 19:25:42 2014 UTC
@@ -42,6 +42,7 @@ import org.brailleblaster.perspectives.braille.document.BBSemanticsTable;import org.brailleblaster.perspectives.braille.document.BBSemanticsTable.Styles; import org.brailleblaster.perspectives.braille.document.BBSemanticsTable.StylesType;
+import org.brailleblaster.perspectives.braille.mapping.BrlOnlyMapElement; import org.brailleblaster.perspectives.braille.mapping.MapList; import org.brailleblaster.perspectives.braille.mapping.PageMapElement; import org.brailleblaster.perspectives.braille.mapping.TextMapElement; @@ -574,7 +575,7 @@ public void setText(Node n, MapList list){ Styles style = stylesTable.makeStylesElement((Element)n.getParent(), n); Styles prevStyle; - if(list.size() > 0) + if(list.size() > 0 && list.getLast().n!=null )prevStyle = stylesTable.makeStylesElement(list.getLast().parentElement(),list.getLast().n);
else prevStyle = null; @@ -1564,4 +1565,12 @@ textChanged = false; setListenerLock(false); } + + public void setBRLOnlyText(MapList list, String text, Element element) { + view.append(text);+ list.add(new BrlOnlyMapElement(total, total + text.length(), null,element));
+ total += text.length(); + + } + } ============================================================================== Revision: 5b7595ffbd6d Branch: default Author: Sahel "sahel.mastoureshgh@xxxxxxxxx" Date: Tue Jul 1 19:33:11 2014 UTC Log: merged with head http://code.google.com/p/brailleblaster/source/detail?r=5b7595ffbd6d