Revision: e6fe5cfc24fc Branch: default Author: Brandon Roller <brandon.r.roller@xxxxxxxxx> Date: Mon Feb 25 11:14:21 2013 Log: revised setText method in braille view http://code.google.com/p/brailleblaster/source/detail?r=e6fe5cfc24fc&repo=newdesign Modified: /src/main/org/brailleblaster/abstractClasses/AbstractView.java /src/main/org/brailleblaster/views/BrailleView.java /src/main/org/brailleblaster/views/TextView.java /src/main/org/brailleblaster/views/TreeView.java /src/main/org/brailleblaster/wordprocessor/DocumentManager.java =======================================--- /src/main/org/brailleblaster/abstractClasses/AbstractView.java Wed Jan 23 08:02:41 2013 +++ /src/main/org/brailleblaster/abstractClasses/AbstractView.java Mon Feb 25 11:14:21 2013
@@ -31,18 +31,15 @@ import org.eclipse.swt.*; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.custom.VerifyKeyListener; -import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.events.*; public abstract class AbstractView { public StyledText view; public boolean hasFocus = false; public boolean hasChanged = false; - + public AbstractView() { } @@ -71,7 +68,7 @@ hasChanged = true; } }; - + void handleKeystrokes(VerifyEvent event) { hasChanged = true; event.doit = true; =======================================--- /src/main/org/brailleblaster/views/BrailleView.java Fri Feb 22 08:42:53 2013 +++ /src/main/org/brailleblaster/views/BrailleView.java Mon Feb 25 11:14:21 2013
@@ -68,28 +68,17 @@ setTextHelper(e.getChild(i)); } - if(!(e instanceof Text) && !(e instanceof Comment)){ - Element local = (Element)e; - - if(local.getLocalName().equals("brl") && local.getChildCount() > 1){ - for(int i = 0; i < local.getChildCount(); i++){ - if(e.getChild(i) instanceof Text){ - view.append(e.getChild(i).getValue()); - } - else { - Element temp = (Element)e.getChild(i); - if(temp.getLocalName().equals("span")){ - view.append("\nPage " + temp.getChild(0).getValue().trim()); - } - else if(temp.getLocalName().equals("newline")){ - view.append("\n"); - } - } - } - } + if(e instanceof Text){ + Element parent = (Element)e.getParent(); + if(parent.getLocalName().equals("brl")){ + view.append(e.getValue() + "\n"); + } + }+ else if(!(e instanceof Comment) && ((Element)e).getLocalName().equals("newpage")){
+ view.append("\n"); } } - + class BrailleContent extends AbstractContent { } } =======================================--- /src/main/org/brailleblaster/views/TextView.java Fri Feb 22 08:42:53 2013 +++ /src/main/org/brailleblaster/views/TextView.java Mon Feb 25 11:14:21 2013
@@ -31,9 +31,7 @@ import nu.xom.Comment; import nu.xom.Document; import nu.xom.Element; -import nu.xom.Elements; import nu.xom.Node; -import nu.xom.Nodes; import nu.xom.Text; import org.brailleblaster.abstractClasses.AbstractContent; @@ -70,8 +68,9 @@ private void setTextHelper(Node e){ for(int i = 0; i < e.getChildCount(); i++){if(!(e.getChild(i) instanceof Text) && !(e.getChild(i) instanceof Comment)){
- if(!((Element)e.getChild(i)).getLocalName().equals("brl")) + if(!((Element)e.getChild(i)).getLocalName().equals("brl")){ setTextHelper(e.getChild(i)); + } } else if(e.getChild(i) instanceof Text){ view.append(e.getChild(i).getValue() + "\n"); =======================================--- /src/main/org/brailleblaster/views/TreeView.java Fri Feb 22 08:42:53 2013 +++ /src/main/org/brailleblaster/views/TreeView.java Mon Feb 25 11:14:21 2013
@@ -31,16 +31,10 @@ package org.brailleblaster.views; -import java.io.IOException; -import nu.xom.Builder; import nu.xom.Document; import nu.xom.Element; import nu.xom.Elements; -import nu.xom.Node; -import nu.xom.Nodes; -import nu.xom.ParsingException; -import nu.xom.ValidityException; import org.brailleblaster.abstractClasses.AbstractView; import org.eclipse.swt.SWT; @@ -49,7 +43,6 @@ import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; =======================================--- /src/main/org/brailleblaster/wordprocessor/DocumentManager.java Fri Feb 22 08:42:53 2013 +++ /src/main/org/brailleblaster/wordprocessor/DocumentManager.java Mon Feb 25 11:14:21 2013
@@ -35,7 +35,6 @@ import java.io.File; import java.util.logging.Level; import java.util.logging.Logger; -import nu.xom.Document; import org.brailleblaster.BBIni; import org.brailleblaster.document.DocumentBase;