[brailleblaster] [brailleblaster.newdesign] push by brandon....@xxxxxxxxx - Moved view to view package, abstract classes to abstractClasses packag... on 2013-01-15 15:31 GMT

  • From: brailleblaster@xxxxxxxxxxxxxx
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Tue, 15 Jan 2013 15:32:04 +0000

Revision: a3be027b07d7
Branch:   default
Author:   Brandon Roller <brandon.r.roller@xxxxxxxxx>
Date:     Tue Jan 15 07:30:48 2013
Log: Moved view to view package, abstract classes to abstractClasses package
http://code.google.com/p/brailleblaster/source/detail?r=a3be027b07d7&repo=newdesign

Added:
 /src/main/org/brailleblaster/abstractClasses/AbstractContent.java
 /src/main/org/brailleblaster/abstractClasses/AbstractPreview.java
 /src/main/org/brailleblaster/abstractClasses/AbstractPrinting.java
 /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
Deleted:
 /src/main/org/brailleblaster/wordprocessor/AbstractContent.java
 /src/main/org/brailleblaster/wordprocessor/AbstractPreview.java
 /src/main/org/brailleblaster/wordprocessor/AbstractPrinting.java
 /src/main/org/brailleblaster/wordprocessor/AbstractView.java
 /src/main/org/brailleblaster/wordprocessor/BrailleView.java
 /src/main/org/brailleblaster/wordprocessor/TextView.java
 /src/main/org/brailleblaster/wordprocessor/TreeView.java
Modified:
 /src/main/org/brailleblaster/wordprocessor/SaveOptionsDialog.java.orig

=======================================
--- /dev/null
+++ /src/main/org/brailleblaster/abstractClasses/AbstractContent.java Tue Jan 15 07:30:48 2013
@@ -0,0 +1,246 @@
+/* BrailleBlaster Braille Transcription Application
+  *
+  * Copyright (C) 2010, 2012
+  * ViewPlus Technologies, Inc. www.viewplus.com
+  * and
+  * Abilitiessoft, Inc. www.abilitiessoft.com
+  * All rights reserved
+  *
+  * This file may contain code borrowed from files produced by various
+  * Java development teams. These are gratefully acknoledged.
+  *
+  * This file is free software; you can redistribute it and/or modify it
+  * under the terms of the Apache 2.0 License, as given at
+  * http://www.apache.org/licenses/
+  *
+  * This file is distributed in the hope that it will be useful, but
+  * WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
+  * See the Apache 2.0 License for more details.
+  *
+  * You should have received a copy of the Apache 2.0 License along with
+  * this program; see the file LICENSE.txt
+  * If not, see
+  * http://www.apache.org/licenses/
+  *
+  * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
+*/
+
+package org.brailleblaster.abstractClasses;
+
+import org.eclipse.swt.custom.StyledTextContent;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.TextChangeListener;
+import nu.xom.*;
+
+public abstract class AbstractContent implements StyledTextContent {
+
+private StyledTextContent baseContent;
+
+public AbstractContent() {
+}
+
+public AbstractContent (final StyledText styledText) {
+baseContent = styledText.getContent();
+styledText.setContent(this);
+}
+
+/**
+ * Called by StyledText to add itself as an Observer to content changes.
+ * See TextChangeListener for a description of the listener methods that
+ * are called when text changes occur.
+ * <p>
+ *
+ * @param listener the listener
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT when listener is null</li>
+ * </ul>
+ */
+public void addTextChangeListener(TextChangeListener listener){}
+
+/**
+ * Return the number of characters in the content.
+ * <p>
+ *
+ * @return the number of characters in the content.
+ */
+public int getCharCount() {
+return 0;
+}
+
+/**
+ * Return the line at the given line index without delimiters.
+ * <p>
+ *
+ * @param lineIndex index of the line to return. Does not include
+ *     delimiters of preceding lines. Index 0 is the first line of the
+ *     content.
+ * @return the line text without delimiters
+ */
+public String getLine(int lineIndex) {
+return null;
+}
+
+/**
+ * Return the line index at the given character offset.
+ * <p>
+ *
+ * @param offset offset of the line to return. The first character of the
+ *     document is at offset 0.  An offset of getLength() is valid and should
+ *     answer the number of lines.
+ * @return the line index. The first line is at index 0.  If the character
+ *     at offset is a delimiter character, answer the line index of the line
+ *     that is delimited.
+ *     For example, if text = "\r\n\r\n", and delimiter = "\r\n", then:
+ * <ul>
+ * <li>getLineAtOffset(0) == 0
+ * <li>getLineAtOffset(1) == 0
+ * <li>getLineAtOffset(2) == 1
+ * <li>getLineAtOffset(3) == 1
+ * <li>getLineAtOffset(4) == 2
+ * </ul>
+ */
+public int getLineAtOffset(int offset) {
+return 0;
+}
+
+/**
+ * Return the number of lines.  Should answer 1 when no text is specified.
+ * The  StyledText widget relies on this behavior for drawing the cursor.
+ * <p>
+ *
+ * @return the number of lines.  For example:
+ * <ul>
+ * <li>  text value ==> getLineCount
+ * <li>  null ==> 1
+ * <li>  "" ==> 1
+ * <li>  "a\n" ==> 2
+ * <li>  "\n\n" ==> 3
+ * </ul>
+ */
+public int getLineCount() {
+return 0;
+}
+
+/**
+ * Return the line delimiter that should be used by the StyledText
+ * widget when inserting new lines. New lines entered using key strokes
+ * and paste operations use this line delimiter.
+ * Implementors may use System.getProperty("line.separator") to return
+ * the platform line delimiter.
+ * <p>
+ *
+ * @return the line delimiter that should be used by the StyledText widget
+ *     when inserting new lines.
+ */
+public String getLineDelimiter() {
+return null;
+}
+
+/**
+ * Return the character offset of the first character of the given line.
+ * <p>
+ * <b>NOTE:</b> When there is no text (i.e., no lines), getOffsetAtLine(0)
+ * is a valid call that should return 0.
+ * </p>
+ *
+ * @param lineIndex index of the line. The first line is at index 0.
+ * @return offset offset of the first character of the line. The first
+ *     character of the document is at offset 0.  The return value should
+ *     include line delimiters.
+ *     For example, if text = "\r\ntest\r\n" and delimiter = "\r\n", then:
+ * <ul>
+ * <li>getOffsetAtLine(0) == 0
+ * <li>getOffsetAtLine(1) == 2
+ * <li>getOffsetAtLine(2) == 8
+ * </ul>
+ */
+public int getOffsetAtLine(int lineIndex) {
+return 0;
+}
+
+/**
+ * Returns a string representing the content at the given range.
+ * <p>
+ *
+ * @param start the start offset of the text to return. Offset 0 is the
+ *     first character of the document.
+ * @param length the length of the text to return
+ * @return the text at the given range
+ */
+public String getTextRange(int start, int length) {
+return null;
+}
+
+/**
+ * Remove the specified text changed listener.
+ * <p>
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT when listener is null</li>
+ * </ul>
+ */
+public void removeTextChangeListener(TextChangeListener listener){}
+
+/**
+ * Replace the text with "newText" starting at position "start"
+ * for a length of "replaceLength".
+ * <p>
+ * Implementors have to notify the TextChangeListeners that were added
+ * using <code>addTextChangeListener</code> before and after the content
+ * is changed. A <code>TextChangingEvent</code> has to be sent to the
+ * textChanging method before the content is changed and a
+ * <code>TextChangedEvent</code> has to be sent to the textChanged method
+ * after the content has changed.
+ * The text change that occurs after the <code>TextChangingEvent</code>
+ * has been sent has to be consistent with the data provided in the
+ * <code>TextChangingEvent</code>.
+ * This data will be cached by the widget and will be used when the
+ * <code>TextChangedEvent</code> is received.
+ * <p>
+ * The <code>TextChangingEvent</code> should be set as follows:
+ * <ul>
+ * <li>event.start = start of the replaced text
+ * <li>event.newText = text that is going to be inserted or empty String
+ *     if no text will be inserted
+ * <li>event.replaceCharCount = length of text that is going to be replaced
+ * <li>event.newCharCount = length of text that is going to be inserted
+ * <li>event.replaceLineCount = number of lines that are going to be replaced + * <li>event.newLineCount = number of new lines that are going to be inserted
+ * </ul>
+ * <b>NOTE:</b> newLineCount is the number of inserted lines and replaceLineCount
+ * is the number of deleted lines based on the change that occurs visually.
+ * For example:
+ * <ul>
+ * <li>(replaceText, newText) ==> (replaceLineCount, newLineCount)
+ * <li>("", "\n") ==> (0, 1)
+ * <li>("\n\n", "a") ==> (2, 0)
+ * <li>("a", "\n\n") ==> (0, 2)
+ * <li>("\n", "") ==> (1, 0)
+ * </ul>
+ * </p>
+ *
+ * @param start start offset of text to replace, none of the offsets include
+ *     delimiters of preceding lines, offset 0 is the first character of the
+ *     document
+ * @param replaceLength length of text to replace
+ * @param text text to replace
+ * @see TextChangeListener
+ */
+public void replaceTextRange(int start, int replaceLength, String text){}
+
+/**
+ * Set text to "text".
+ * Implementors have to send a <code>TextChangedEvent</code> to the
+ * textSet method of the TextChangeListeners that were added using
+ * <code>addTextChangeListener</code>.
+ * <p>
+ *
+ * @param text the new text
+ * @see TextChangeListener
+ */
+public void setText(String text){}
+
+}
=======================================
--- /dev/null
+++ /src/main/org/brailleblaster/abstractClasses/AbstractPreview.java Tue Jan 15 07:30:48 2013
@@ -0,0 +1,32 @@
+/* BrailleBlaster Braille Transcription Application
+  *
+  * Copyright (C) 2010, 2012
+  * ViewPlus Technologies, Inc. www.viewplus.com
+  * and
+  * Abilitiessoft, Inc. www.abilitiessoft.com
+  * All rights reserved
+  *
+  * This file may contain code borrowed from files produced by various
+  * Java development teams. These are gratefully acknoledged.
+  *
+  * This file is free software; you can redistribute it and/or modify it
+  * under the terms of the Apache 2.0 License, as given at
+  * http://www.apache.org/licenses/
+  *
+  * This file is distributed in the hope that it will be useful, but
+  * WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
+  * See the Apache 2.0 License for more details.
+  *
+  * You should have received a copy of the Apache 2.0 License along with
+  * this program; see the file LICENSE.
+  * If not, see
+  * http://www.apache.org/licenses/
+  *
+  * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
+*/
+
+package org.brailleblaster.abstractClasses;
+
+abstract class AbstractPreview {
+}
=======================================
--- /dev/null
+++ /src/main/org/brailleblaster/abstractClasses/AbstractPrinting.java Tue Jan 15 07:30:48 2013
@@ -0,0 +1,78 @@
+/* BrailleBlaster Braille Transcription Application
+  *
+  * Copyright (C) 2010, 2012
+  * ViewPlus Technologies, Inc. www.viewplus.com
+  * and
+  * Abilitiessoft, Inc. www.abilitiessoft.com
+  * All rights reserved
+  *
+  * This file may contain code borrowed from files produced by various
+  * Java development teams. These are gratefully acknoledged.
+  *
+  * This file is free software; you can redistribute it and/or modify it
+  * under the terms of the Apache 2.0 License, as given at
+  * http://www.apache.org/licenses/
+  *
+  * This file is distributed in the hope that it will be useful, but
+  * WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
+  * See the Apache 2.0 License for more details.
+  *
+  * You should have received a copy of the Apache 2.0 License along with
+  * this program; see the file LICENSE.
+  * If not, see
+  * http://www.apache.org/licenses/
+  *
+  * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
+*/
+
+package org.brailleblaster.abstractClasses;
+
+import org.eclipse.swt.printing.*;
+import org.brailleblaster.BBIni;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.FontDialog;
+import org.eclipse.swt.widgets.ColorDialog;
+
+/**
+ * This class handles printing, printer setup and print preview. Since
+ * the Tiger printer uses a standard printer driver, it is also covered
+ * here.
+*/
+
+abstract class AbstractPrinting {
+PrinterData data = null;
+Printer printer = null;
+
+/**
+ * This constructor takes care of printer setup.
+*/
+AbstractPrinting() {
+Shell shell = new Shell (BBIni.getDisplay(), SWT.DIALOG_TRIM);
+PrintDialog printer = new PrintDialog (shell);
+data = printer.open();
+shell.dispose();
+}
+
+Thread printingThread = new Thread("Printing") {
+public void run() {
+//print(printer);
+//printer.dispose();
+}
+};
+
+abstract int fillPage ();
+
+}
+
=======================================
--- /dev/null
+++ /src/main/org/brailleblaster/abstractClasses/AbstractView.java Tue Jan 15 07:30:48 2013
@@ -0,0 +1,79 @@
+/* BrailleBlaster Braille Transcription Application
+ *
+ * Copyright (C) 2010, 2012
+ * ViewPlus Technologies, Inc. www.viewplus.com
+ * and
+ * Abilitiessoft, Inc. www.abilitiessoft.com
+ * All rights reserved
+ *
+ * This file may contain code borrowed from files produced by various
+ * Java development teams. These are gratefully acknoledged.
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the Apache 2.0 License, as given at
+ * http://www.apache.org/licenses/
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
+ * See the Apache 2.0 License for more details.
+ *
+ * You should have received a copy of the Apache 2.0 License along with
+ * this program; see the file LICENSE.
+ * If not, see
+ * http://www.apache.org/licenses/
+ *
+ * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
+ */
+
+package org.brailleblaster.abstractClasses;
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.custom.StyledText;
+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() {
+       }
+
+ public AbstractView(Shell documentWindow, int left, int right, int top, int bottom) {
+               view = new StyledText(documentWindow, SWT.BORDER | SWT.H_SCROLL
+                               | SWT.V_SCROLL | SWT.WRAP);
+
+               FormData location = new FormData();
+               location.left = new FormAttachment(left);
+               location.right = new FormAttachment(right);
+               location.top = new FormAttachment(top);
+               location.bottom = new FormAttachment(bottom);
+               view.setLayoutData(location);
+
+               // view.addVerifyKeyListener (new VerifyKeyListener() {
+               // public void verifyKey (VerifyEvent event) {
+               // handleKeystrokes (event);
+               // }
+               // });
+
+               view.addModifyListener(viewMod);
+       }
+
+       // Better use a ModifyListener to set the change flag.
+       ModifyListener viewMod = new ModifyListener() {
+               public void modifyText(ModifyEvent e) {
+                       hasChanged = true;
+               }
+       };
+
+       void handleKeystrokes(VerifyEvent event) {
+               hasChanged = true;
+               event.doit = true;
+       }
+}
=======================================
--- /dev/null
+++ /src/main/org/brailleblaster/views/BrailleView.java Tue Jan 15 07:30:48 2013
@@ -0,0 +1,58 @@
+/* BrailleBlaster Braille Transcription Application
+  *
+  * Copyright (C) 2010, 2012
+  * ViewPlus Technologies, Inc. www.viewplus.com
+  * and
+  * Abilitiessoft, Inc. www.abilitiessoft.com
+  * All rights reserved
+  *
+  * This file may contain code borrowed from files produced by various
+  * Java development teams. These are gratefully acknoledged.
+  *
+  * This file is free software; you can redistribute it and/or modify it
+  * under the terms of the Apache 2.0 License, as given at
+  * http://www.apache.org/licenses/
+  *
+  * This file is distributed in the hope that it will be useful, but
+  * WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
+  * See the Apache 2.0 License for more details.
+  *
+  * You should have received a copy of the Apache 2.0 License along with
+  * this program; see the file LICENSE.
+  * If not, see
+  * http://www.apache.org/licenses/
+  *
+  * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
+*/
+
+package org.brailleblaster.views;
+
+import org.brailleblaster.abstractClasses.AbstractContent;
+import org.brailleblaster.abstractClasses.AbstractView;
+import org.eclipse.swt.*;
+import org.eclipse.swt.custom.StyledText;
+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.events.VerifyEvent;
+
+
+public class BrailleView extends AbstractView {
+
+public BrailleView (Shell documentWindow) {
+//     super (documentWindow, 56, 100, 12, 92);
+       super (documentWindow, 58, 100, 12, 92);
+
+}
+
+
+/* This is a derivative work from
+ * org.eclipse.swt.custom.DefaultContent.java
+*/
+
+class BrailleContent extends AbstractContent {
+}
+}
+
=======================================
--- /dev/null
+++ /src/main/org/brailleblaster/views/TextView.java Tue Jan 15 07:30:48 2013
@@ -0,0 +1,57 @@
+/* BrailleBlaster Braille Transcription Application
+  *
+  * Copyright (C) 2010, 2012
+  * ViewPlus Technologies, Inc. www.viewplus.com
+  * and
+  * Abilitiessoft, Inc. www.abilitiessoft.com
+  * All rights reserved
+  *
+  * This file may contain code borrowed from files produced by various
+  * Java development teams. These are gratefully acknoledged.
+  *
+  * This file is free software; you can redistribute it and/or modify it
+  * under the terms of the Apache 2.0 License, as given at
+  * http://www.apache.org/licenses/
+  *
+  * This file is distributed in the hope that it will be useful, but
+  * WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
+  * See the Apache 2.0 License for more details.
+  *
+  * You should have received a copy of the Apache 2.0 License along with
+  * this program; see the file LICENSE.txt
+  * If not, see
+  * http://www.apache.org/licenses/
+  *
+  * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
+*/
+
+package org.brailleblaster.views;
+
+import org.brailleblaster.abstractClasses.AbstractContent;
+import org.brailleblaster.abstractClasses.AbstractView;
+import org.eclipse.swt.*;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.custom.VerifyKeyListener;
+
+
+public class TextView extends AbstractView {
+
+public TextView (Shell documentWindow) {
+// super (documentWindow, 0, 55, 12, 92);
+super (documentWindow, 16, 57, 12, 92);
+
+}
+
+/* This is a derivative work from
+ * org.eclipse.swt.custom.DefaultContent.java
+*/
+
+private class TextContent extends AbstractContent {
+}
+
+}
=======================================
--- /dev/null
+++ /src/main/org/brailleblaster/views/TreeView.java Tue Jan 15 07:30:48 2013
@@ -0,0 +1,110 @@
+/* BrailleBlaster Braille Transcription Application
+  *
+  * Copyright (C) 2010, 2012
+  * ViewPlus Technologies, Inc. www.viewplus.com
+  * and
+  * Abilitiessoft, Inc. www.abilitiessoft.com
+  * and
+  * American Printing House for the Blind, Inc. www.aph.org
+  *
+  * All rights reserved
+  *
+  * This file may contain code borrowed from files produced by various
+  * Java development teams. These are gratefully acknoledged.
+  *
+  * This file is free software; you can redistribute it and/or modify it
+  * under the terms of the Apache 2.0 License, as given at
+  * http://www.apache.org/licenses/
+  *
+  * This file is distributed in the hope that it will be useful, but
+  * WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
+  * See the Apache 2.0 License for more details.
+  *
+  * You should have received a copy of the Apache 2.0 License along with
+  * this program; see the file LICENSE.
+  * If not, see
+  * http://www.apache.org/licenses/
+  *
+  * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
+*/
+
+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;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+
+public class TreeView extends AbstractView {
+
+       Tree tree;
+
+       public TreeView(Shell documentWindow){
+               super(documentWindow, 0, 15, 12, 92);
+               this.tree = new Tree(view, SWT.NONE);
+               /*
+                * Code below was used for testing purposes only.
+                * It should be deleted once Document class is properly 
implemented
+               try {
+                       Builder builder = new Builder();
+ Document doc = builder.build("File:/Users/broller/Documents/TestProject/build.xml");
+                       populateTree(doc);
+               }
+               catch(IOException e){
+                       System.out.println("IO Error ");
+                       e.printStackTrace();
+               }
+               catch (ParsingException e){
+                       System.out.println("Parse Error");
+                       e.printStackTrace();
+               }
+               */
+
+               view.setLayout(new FillLayout());
+               tree.pack();
+       }
+
+       public void populateTree(Document doc){
+               TreeItem root = new TreeItem(this.tree, 0);
+               root.setText(doc.getRootElement().getLocalName());
+
+               Elements rootNode = doc.getRootElement().getChildElements();
+
+        for(int i = 0; i < rootNode.size(); i++){
+               Element e = rootNode.get(i);
+               TreeItem temp = new TreeItem(root, 0);
+               temp.setText(e.getLocalName());
+               populateHelper(e, temp);
+        }
+       }
+
+       private void populateHelper(Element e, TreeItem item){
+               Elements n = e.getChildElements();
+
+               for(int i = 0; i < n.size(); i++){
+                       Element e2 = n.get(i);
+               TreeItem temp = new TreeItem(item, 0);
+               temp.setText(e2.getLocalName());
+               populateHelper(e2, temp);
+               }
+       }
+
+       public void clearTree(){
+               tree.removeAll();
+       }
+}
=======================================
--- /src/main/org/brailleblaster/wordprocessor/AbstractContent.java Mon Oct 24 13:17:30 2011
+++ /dev/null
@@ -1,246 +0,0 @@
-/* BrailleBlaster Braille Transcription Application
-  *
-  * Copyright (C) 2010, 2012
-  * ViewPlus Technologies, Inc. www.viewplus.com
-  * and
-  * Abilitiessoft, Inc. www.abilitiessoft.com
-  * All rights reserved
-  *
-  * This file may contain code borrowed from files produced by various
-  * Java development teams. These are gratefully acknoledged.
-  *
-  * This file is free software; you can redistribute it and/or modify it
-  * under the terms of the Apache 2.0 License, as given at
-  * http://www.apache.org/licenses/
-  *
-  * This file is distributed in the hope that it will be useful, but
-  * WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
-  * See the Apache 2.0 License for more details.
-  *
-  * You should have received a copy of the Apache 2.0 License along with
-  * this program; see the file LICENSE.txt
-  * If not, see
-  * http://www.apache.org/licenses/
-  *
-  * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
-*/
-
-package org.brailleblaster.wordprocessor;
-
-import org.eclipse.swt.custom.StyledTextContent;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.custom.TextChangeListener;
-import nu.xom.*;
-
-public abstract class AbstractContent implements StyledTextContent {
-
-private StyledTextContent baseContent;
-
-public AbstractContent() {
-}
-
-public AbstractContent (final StyledText styledText) {
-baseContent = styledText.getContent();
-styledText.setContent(this);
-}
-
-/**
- * Called by StyledText to add itself as an Observer to content changes.
- * See TextChangeListener for a description of the listener methods that
- * are called when text changes occur.
- * <p>
- *
- * @param listener the listener
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT when listener is null</li>
- * </ul>
- */
-public void addTextChangeListener(TextChangeListener listener){}
-
-/**
- * Return the number of characters in the content.
- * <p>
- *
- * @return the number of characters in the content.
- */
-public int getCharCount() {
-return 0;
-}
-
-/**
- * Return the line at the given line index without delimiters.
- * <p>
- *
- * @param lineIndex index of the line to return. Does not include
- *     delimiters of preceding lines. Index 0 is the first line of the
- *     content.
- * @return the line text without delimiters
- */
-public String getLine(int lineIndex) {
-return null;
-}
-
-/**
- * Return the line index at the given character offset.
- * <p>
- *
- * @param offset offset of the line to return. The first character of the
- *     document is at offset 0.  An offset of getLength() is valid and should
- *     answer the number of lines.
- * @return the line index. The first line is at index 0.  If the character
- *     at offset is a delimiter character, answer the line index of the line
- *     that is delimited.
- *     For example, if text = "\r\n\r\n", and delimiter = "\r\n", then:
- * <ul>
- * <li>getLineAtOffset(0) == 0
- * <li>getLineAtOffset(1) == 0
- * <li>getLineAtOffset(2) == 1
- * <li>getLineAtOffset(3) == 1
- * <li>getLineAtOffset(4) == 2
- * </ul>
- */
-public int getLineAtOffset(int offset) {
-return 0;
-}
-
-/**
- * Return the number of lines.  Should answer 1 when no text is specified.
- * The  StyledText widget relies on this behavior for drawing the cursor.
- * <p>
- *
- * @return the number of lines.  For example:
- * <ul>
- * <li>  text value ==> getLineCount
- * <li>  null ==> 1
- * <li>  "" ==> 1
- * <li>  "a\n" ==> 2
- * <li>  "\n\n" ==> 3
- * </ul>
- */
-public int getLineCount() {
-return 0;
-}
-
-/**
- * Return the line delimiter that should be used by the StyledText
- * widget when inserting new lines. New lines entered using key strokes
- * and paste operations use this line delimiter.
- * Implementors may use System.getProperty("line.separator") to return
- * the platform line delimiter.
- * <p>
- *
- * @return the line delimiter that should be used by the StyledText widget
- *     when inserting new lines.
- */
-public String getLineDelimiter() {
-return null;
-}
-
-/**
- * Return the character offset of the first character of the given line.
- * <p>
- * <b>NOTE:</b> When there is no text (i.e., no lines), getOffsetAtLine(0)
- * is a valid call that should return 0.
- * </p>
- *
- * @param lineIndex index of the line. The first line is at index 0.
- * @return offset offset of the first character of the line. The first
- *     character of the document is at offset 0.  The return value should
- *     include line delimiters.
- *     For example, if text = "\r\ntest\r\n" and delimiter = "\r\n", then:
- * <ul>
- * <li>getOffsetAtLine(0) == 0
- * <li>getOffsetAtLine(1) == 2
- * <li>getOffsetAtLine(2) == 8
- * </ul>
- */
-public int getOffsetAtLine(int lineIndex) {
-return 0;
-}
-
-/**
- * Returns a string representing the content at the given range.
- * <p>
- *
- * @param start the start offset of the text to return. Offset 0 is the
- *     first character of the document.
- * @param length the length of the text to return
- * @return the text at the given range
- */
-public String getTextRange(int start, int length) {
-return null;
-}
-
-/**
- * Remove the specified text changed listener.
- * <p>
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT when listener is null</li>
- * </ul>
- */
-public void removeTextChangeListener(TextChangeListener listener){}
-
-/**
- * Replace the text with "newText" starting at position "start"
- * for a length of "replaceLength".
- * <p>
- * Implementors have to notify the TextChangeListeners that were added
- * using <code>addTextChangeListener</code> before and after the content
- * is changed. A <code>TextChangingEvent</code> has to be sent to the
- * textChanging method before the content is changed and a
- * <code>TextChangedEvent</code> has to be sent to the textChanged method
- * after the content has changed.
- * The text change that occurs after the <code>TextChangingEvent</code>
- * has been sent has to be consistent with the data provided in the
- * <code>TextChangingEvent</code>.
- * This data will be cached by the widget and will be used when the
- * <code>TextChangedEvent</code> is received.
- * <p>
- * The <code>TextChangingEvent</code> should be set as follows:
- * <ul>
- * <li>event.start = start of the replaced text
- * <li>event.newText = text that is going to be inserted or empty String
- *     if no text will be inserted
- * <li>event.replaceCharCount = length of text that is going to be replaced
- * <li>event.newCharCount = length of text that is going to be inserted
- * <li>event.replaceLineCount = number of lines that are going to be replaced - * <li>event.newLineCount = number of new lines that are going to be inserted
- * </ul>
- * <b>NOTE:</b> newLineCount is the number of inserted lines and replaceLineCount
- * is the number of deleted lines based on the change that occurs visually.
- * For example:
- * <ul>
- * <li>(replaceText, newText) ==> (replaceLineCount, newLineCount)
- * <li>("", "\n") ==> (0, 1)
- * <li>("\n\n", "a") ==> (2, 0)
- * <li>("a", "\n\n") ==> (0, 2)
- * <li>("\n", "") ==> (1, 0)
- * </ul>
- * </p>
- *
- * @param start start offset of text to replace, none of the offsets include
- *     delimiters of preceding lines, offset 0 is the first character of the
- *     document
- * @param replaceLength length of text to replace
- * @param text text to replace
- * @see TextChangeListener
- */
-public void replaceTextRange(int start, int replaceLength, String text){}
-
-/**
- * Set text to "text".
- * Implementors have to send a <code>TextChangedEvent</code> to the
- * textSet method of the TextChangeListeners that were added using
- * <code>addTextChangeListener</code>.
- * <p>
- *
- * @param text the new text
- * @see TextChangeListener
- */
-public void setText(String text){}
-
-}
=======================================
--- /src/main/org/brailleblaster/wordprocessor/AbstractPreview.java Mon Oct 24 07:48:38 2011
+++ /dev/null
@@ -1,32 +0,0 @@
-/* BrailleBlaster Braille Transcription Application
-  *
-  * Copyright (C) 2010, 2012
-  * ViewPlus Technologies, Inc. www.viewplus.com
-  * and
-  * Abilitiessoft, Inc. www.abilitiessoft.com
-  * All rights reserved
-  *
-  * This file may contain code borrowed from files produced by various
-  * Java development teams. These are gratefully acknoledged.
-  *
-  * This file is free software; you can redistribute it and/or modify it
-  * under the terms of the Apache 2.0 License, as given at
-  * http://www.apache.org/licenses/
-  *
-  * This file is distributed in the hope that it will be useful, but
-  * WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
-  * See the Apache 2.0 License for more details.
-  *
-  * You should have received a copy of the Apache 2.0 License along with
-  * this program; see the file LICENSE.
-  * If not, see
-  * http://www.apache.org/licenses/
-  *
-  * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
-*/
-
-package org.brailleblaster.wordprocessor;
-
-abstract class AbstractPreview {
-}
=======================================
--- /src/main/org/brailleblaster/wordprocessor/AbstractPrinting.java Fri Nov 18 11:53:17 2011
+++ /dev/null
@@ -1,78 +0,0 @@
-/* BrailleBlaster Braille Transcription Application
-  *
-  * Copyright (C) 2010, 2012
-  * ViewPlus Technologies, Inc. www.viewplus.com
-  * and
-  * Abilitiessoft, Inc. www.abilitiessoft.com
-  * All rights reserved
-  *
-  * This file may contain code borrowed from files produced by various
-  * Java development teams. These are gratefully acknoledged.
-  *
-  * This file is free software; you can redistribute it and/or modify it
-  * under the terms of the Apache 2.0 License, as given at
-  * http://www.apache.org/licenses/
-  *
-  * This file is distributed in the hope that it will be useful, but
-  * WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
-  * See the Apache 2.0 License for more details.
-  *
-  * You should have received a copy of the Apache 2.0 License along with
-  * this program; see the file LICENSE.
-  * If not, see
-  * http://www.apache.org/licenses/
-  *
-  * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
-*/
-
-package org.brailleblaster.wordprocessor;
-
-import org.eclipse.swt.printing.*;
-import org.brailleblaster.BBIni;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.FontDialog;
-import org.eclipse.swt.widgets.ColorDialog;
-
-/**
- * This class handles printing, printer setup and print preview. Since
- * the Tiger printer uses a standard printer driver, it is also covered
- * here.
-*/
-
-abstract class AbstractPrinting {
-PrinterData data = null;
-Printer printer = null;
-
-/**
- * This constructor takes care of printer setup.
-*/
-AbstractPrinting() {
-Shell shell = new Shell (BBIni.getDisplay(), SWT.DIALOG_TRIM);
-PrintDialog printer = new PrintDialog (shell);
-data = printer.open();
-shell.dispose();
-}
-
-Thread printingThread = new Thread("Printing") {
-public void run() {
-//print(printer);
-//printer.dispose();
-}
-};
-
-abstract int fillPage ();
-
-}
-
=======================================
--- /src/main/org/brailleblaster/wordprocessor/AbstractView.java Tue Jan 15 05:17:47 2013
+++ /dev/null
@@ -1,79 +0,0 @@
-/* BrailleBlaster Braille Transcription Application
- *
- * Copyright (C) 2010, 2012
- * ViewPlus Technologies, Inc. www.viewplus.com
- * and
- * Abilitiessoft, Inc. www.abilitiessoft.com
- * All rights reserved
- *
- * This file may contain code borrowed from files produced by various
- * Java development teams. These are gratefully acknoledged.
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the Apache 2.0 License, as given at
- * http://www.apache.org/licenses/
- *
- * This file is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
- * See the Apache 2.0 License for more details.
- *
- * You should have received a copy of the Apache 2.0 License along with
- * this program; see the file LICENSE.
- * If not, see
- * http://www.apache.org/licenses/
- *
- * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
- */
-
-package org.brailleblaster.wordprocessor;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.StyledText;
-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.*;
-
-abstract class AbstractView {
-       StyledText view;
-       boolean hasFocus = false;
-       boolean hasChanged = false;
-
-       AbstractView() {
-       }
-
- AbstractView(Shell documentWindow, int left, int right, int top, int bottom) {
-               view = new StyledText(documentWindow, SWT.BORDER | SWT.H_SCROLL
-                               | SWT.V_SCROLL | SWT.WRAP);
-
-               FormData location = new FormData();
-               location.left = new FormAttachment(left);
-               location.right = new FormAttachment(right);
-               location.top = new FormAttachment(top);
-               location.bottom = new FormAttachment(bottom);
-               view.setLayoutData(location);
-
-               // view.addVerifyKeyListener (new VerifyKeyListener() {
-               // public void verifyKey (VerifyEvent event) {
-               // handleKeystrokes (event);
-               // }
-               // });
-
-               view.addModifyListener(viewMod);
-       }
-
-       // Better use a ModifyListener to set the change flag.
-       ModifyListener viewMod = new ModifyListener() {
-               public void modifyText(ModifyEvent e) {
-                       hasChanged = true;
-               }
-       };
-
-       void handleKeystrokes(VerifyEvent event) {
-               hasChanged = true;
-               event.doit = true;
-       }
-}
=======================================
--- /src/main/org/brailleblaster/wordprocessor/BrailleView.java Tue Jan 15 05:17:47 2013
+++ /dev/null
@@ -1,55 +0,0 @@
-/* BrailleBlaster Braille Transcription Application
-  *
-  * Copyright (C) 2010, 2012
-  * ViewPlus Technologies, Inc. www.viewplus.com
-  * and
-  * Abilitiessoft, Inc. www.abilitiessoft.com
-  * All rights reserved
-  *
-  * This file may contain code borrowed from files produced by various
-  * Java development teams. These are gratefully acknoledged.
-  *
-  * This file is free software; you can redistribute it and/or modify it
-  * under the terms of the Apache 2.0 License, as given at
-  * http://www.apache.org/licenses/
-  *
-  * This file is distributed in the hope that it will be useful, but
-  * WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
-  * See the Apache 2.0 License for more details.
-  *
-  * You should have received a copy of the Apache 2.0 License along with
-  * this program; see the file LICENSE.
-  * If not, see
-  * http://www.apache.org/licenses/
-  *
-  * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
-*/
-
-package org.brailleblaster.wordprocessor;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.StyledText;
-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.events.VerifyEvent;
-
-class BrailleView extends AbstractView {
-
-BrailleView (Shell documentWindow) {
-//     super (documentWindow, 56, 100, 12, 92);
-       super (documentWindow, 58, 100, 12, 92);
-
-}
-
-
-/* This is a derivative work from
- * org.eclipse.swt.custom.DefaultContent.java
-*/
-
-class BrailleContent extends AbstractContent {
-}
-}
-
=======================================
--- /src/main/org/brailleblaster/wordprocessor/TextView.java Tue Jan 15 05:17:47 2013
+++ /dev/null
@@ -1,54 +0,0 @@
-/* BrailleBlaster Braille Transcription Application
-  *
-  * Copyright (C) 2010, 2012
-  * ViewPlus Technologies, Inc. www.viewplus.com
-  * and
-  * Abilitiessoft, Inc. www.abilitiessoft.com
-  * All rights reserved
-  *
-  * This file may contain code borrowed from files produced by various
-  * Java development teams. These are gratefully acknoledged.
-  *
-  * This file is free software; you can redistribute it and/or modify it
-  * under the terms of the Apache 2.0 License, as given at
-  * http://www.apache.org/licenses/
-  *
-  * This file is distributed in the hope that it will be useful, but
-  * WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
-  * See the Apache 2.0 License for more details.
-  *
-  * You should have received a copy of the Apache 2.0 License along with
-  * this program; see the file LICENSE.txt
-  * If not, see
-  * http://www.apache.org/licenses/
-  *
-  * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx
-*/
-
-package org.brailleblaster.wordprocessor;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.custom.VerifyKeyListener;
-
-class TextView extends AbstractView {
-
-TextView (Shell documentWindow) {
-// super (documentWindow, 0, 55, 12, 92);
-super (documentWindow, 16, 57, 12, 92);
-
-}
-
-/* This is a derivative work from
- * org.eclipse.swt.custom.DefaultContent.java
-*/
-
-private class TextContent extends AbstractContent {
-}
-
-}
=======================================
--- /src/main/org/brailleblaster/wordprocessor/TreeView.java Tue Jan 15 05:17:47 2013
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.brailleblaster.wordprocessor;
-
-import java.io.IOException;
-
-import javax.swing.text.View;
-
-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.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.GlyphMetrics;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-public class TreeView extends AbstractView {
-
-       static Tree tree;
-
-       public TreeView(Shell documentWindow){
-               super(documentWindow, 0, 15, 12, 92);
-               tree = new Tree(view, SWT.NONE);
-               /*
-                * Code below was used for testing purposes only.
-                * It should be deleted once Document class is properly 
implemented
-               try {
-                       Builder builder = new Builder();
- Document doc = builder.build("File:/Users/broller/Documents/TestProject/build.xml");
-                       populateTree(doc);
-               }
-               catch(IOException e){
-                       System.out.println("IO Error ");
-                       e.printStackTrace();
-               }
-               catch (ParsingException e){
-                       System.out.println("Parse Error");
-                       e.printStackTrace();
-               }
-               */
-
-               view.setLayout(new FillLayout());
-               tree.pack();
-       }
-
-       public static  void populateTree(Document doc){
-               TreeItem root = new TreeItem(tree, 0);
-               root.setText(doc.getRootElement().getLocalName());
-
-               Elements rootNode = doc.getRootElement().getChildElements();
-
-        for(int i = 0; i < rootNode.size(); i++){
-               Element e = rootNode.get(i);
-               TreeItem temp = new TreeItem(root, 0);
-               temp.setText(e.getLocalName());
-               populateHelper(e, temp);
-        }
-       }
-
-       private static void populateHelper(Element e, TreeItem item){
-               Elements n = e.getChildElements();
-
-               for(int i = 0; i < n.size(); i++){
-                       Element e2 = n.get(i);
-               TreeItem temp = new TreeItem(item, 0);
-               temp.setText(e2.getLocalName());
-               populateHelper(e2, temp);
-               }
-       }
-
-       public void clearTree(){
-               tree.removeAll();
-       }
-}
=======================================
--- /src/main/org/brailleblaster/wordprocessor/SaveOptionsDialog.java.orig Thu Jan 10 11:53:41 2013 +++ /src/main/org/brailleblaster/wordprocessor/SaveOptionsDialog.java.orig Tue Jan 15 07:30:48 2013
@@ -21,6 +21,8 @@
 import org.brailleblaster.BBIni;
 import org.brailleblaster.localization.LocaleHandler;
 import org.brailleblaster.util.Notify;
+import org.brailleblaster.views.BrailleView;
+

 enum SaveSelection {
     TEXT_AND_BRAILLE, TEXT_ONLY, CANCELLED
@@ -52,12 +54,7 @@
         radioGroup.setLayout(new RowLayout(SWT.VERTICAL));
         final Button b1 = new Button (radioGroup, SWT.RADIO);
                b1.setText(lh.localValue("saveTextBraille"));
-/*             if (BBIni.useUtd()) {
-                       b1.setSelection(true);
-               } else {
-*/
-                   b1.setEnabled(false);
-//             }
+       b1.setSelection(true);
                b1.pack();

                final Button b2 = new Button (radioGroup, SWT.RADIO);

Other related posts:

  • » [brailleblaster] [brailleblaster.newdesign] push by brandon....@xxxxxxxxx - Moved view to view package, abstract classes to abstractClasses packag... on 2013-01-15 15:31 GMT - brailleblaster