Revision: 2a0cefbfe2f2 Branch: default Author: Brandon Roller <brandon.r.roller@xxxxxxxxx> Date: Wed Sep 18 13:39:31 2013 UTC Log: Cleaned up wordprocessor package http://code.google.com/p/brailleblaster/source/detail?r=2a0cefbfe2f2&repo=newdesign Added: /src/main/org/brailleblaster/encoder/Encoder.java /src/main/org/brailleblaster/encoder/Encodings.java Deleted: /src/main/org/brailleblaster/wordprocessor/Encoder.java /src/main/org/brailleblaster/wordprocessor/Encodings.java /src/main/org/brailleblaster/wordprocessor/SaveOptionsDialog.java.orig /src/main/org/brailleblaster/wordprocessor/TextView.java.orig Modified: /src/main/org/brailleblaster/document/MyReader.java ======================================= --- /dev/null+++ /src/main/org/brailleblaster/encoder/Encoder.java Wed Sep 18 13:39:31 2013 UTC
@@ -0,0 +1,158 @@ +package org.brailleblaster.encoder; + +import org.brailleblaster.localization.LocaleHandler; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Monitor; +import org.eclipse.swt.widgets.Shell; + +public class Encoder { + static LocaleHandler lh = new LocaleHandler(); + static String encoding = null; + // encoding for Import + public static String getEncodingString(Display display) { + //String encoding = null; ++ // final Shell selShell = new Shell(display, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.CENTER);
+ final Shell selShell = new Shell(display, SWT.DIALOG_TRIM | SWT.CENTER); + selShell.setText(lh.localValue("specifyEncoding")); + selShell.setMinimumSize(250, 100); + + FillLayout layout = new FillLayout(SWT.VERTICAL); + layout.marginWidth = 8; + selShell.setLayout(layout); + Composite radioGroup = new Composite(selShell, SWT.NONE); + radioGroup.setLayout(new RowLayout(SWT.VERTICAL)); + + Button b1 = new Button(radioGroup, SWT.RADIO); + b1.setText(lh.localValue("encodeUTF8")); + b1.setSelection(true); // default + b1.pack(); + + Button b2 = new Button(radioGroup, SWT.RADIO); + b2.setText(lh.localValue("encodeISO88591")); + b2.pack(); + + Button b3 = new Button(radioGroup, SWT.RADIO); + b3.setText(lh.localValue("encodeWINDOWS1252")); + b3.pack(); + + Button b4 = new Button(radioGroup, SWT.RADIO); + b4.setText(lh.localValue("encodeUSASCII")); + b4.pack(); + + // if (SWT.getPlatform().equals("win32") || + // SWT.getPlatform().equals("wpf")) { + // b1.setSelection(false); + // b3.setSelection(true); + // } + + radioGroup.pack(); + + Composite c = new Composite(selShell, SWT.NONE); + RowLayout clayout = new RowLayout(); + clayout.type = SWT.HORIZONTAL; + // clayout.spacing = 30; + // clayout.marginWidth = 8; + clayout.marginTop = 20; + clayout.center = true; + clayout.pack = true; + clayout.justify = true; + c.setLayout(clayout); + + Button bsel = new Button(c, SWT.PUSH); + bsel.setText(lh.localValue("encodeSelect")); + bsel.pack(); + + c.pack(); + + Control tabList[] = new Control[] { radioGroup, c, radioGroup }; + try { + selShell.setTabList(tabList); + } + catch (IllegalArgumentException e) { + System.err.println("setTabList exception " + e.getMessage()); + } + + selShell.setDefaultButton(bsel); + selShell.pack(); + + Monitor primary = display.getPrimaryMonitor(); + Rectangle bounds = primary.getBounds(); + Rectangle rect = selShell.getBounds(); + int x = bounds.x + (bounds.width - rect.width) / 2; + int y = bounds.y + (bounds.height - rect.height) / 2; + selShell.setLocation(x, y); + + b1.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + encoding = Encodings.UTF_8.encoding(); + } + }); + + b2.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + encoding = Encodings.ISO_8859_1.encoding(); + } + }); + + b3.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + encoding = Encodings.WINDOWS_1252.encoding(); + } + }); + + b4.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + encoding = Encodings.US_ASCII.encoding(); + } + }); + + /* Select */ + bsel.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + selShell.dispose(); + } + }); + + selShell.addListener(SWT.Close, new Listener() { + public void handleEvent(Event event) { + event.doit = false; // must pick a value + } + }); + + selShell.open(); + + while (!selShell.isDisposed()) { + if (!display.readAndDispatch()){ + display.sleep(); + } + // nothing clicked + if (encoding == null) { + if (b1.getSelection()) { + encoding = Encodings.UTF_8.encoding(); + } + else if (b2.getSelection()) { + encoding = Encodings.ISO_8859_1.encoding(); + } + else if (b3.getSelection()) { + encoding = Encodings.WINDOWS_1252.encoding(); + } + else if (b4.getSelection()) { + encoding = Encodings.US_ASCII.encoding(); + } + } + } + return encoding; + } +} ======================================= --- /dev/null+++ /src/main/org/brailleblaster/encoder/Encodings.java Wed Sep 18 13:39:31 2013 UTC
@@ -0,0 +1,16 @@ +package org.brailleblaster.encoder; + +public enum Encodings {+ ISO_8859_1("ISO-8859-1"), UTF_8("UTF-8"), WINDOWS_1252("WINDOWS-1252"), US_ASCII(
+ "US-ASCII"); + + private final String encoding; + + Encodings(String encoding) { + this.encoding = encoding; + } + + public String encoding() { + return encoding; + } +} =======================================--- /src/main/org/brailleblaster/wordprocessor/Encoder.java Wed Jan 23 16:02:41 2013 UTC
+++ /dev/null @@ -1,158 +0,0 @@ -package org.brailleblaster.wordprocessor; - -import org.brailleblaster.localization.LocaleHandler; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.RowLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Monitor; -import org.eclipse.swt.widgets.Shell; - -public class Encoder { - static LocaleHandler lh = new LocaleHandler(); - static String encoding = null; - // encoding for Import - public static String getEncodingString(Display display) { - //String encoding = null; -- // final Shell selShell = new Shell(display, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.CENTER);
- final Shell selShell = new Shell(display, SWT.DIALOG_TRIM | SWT.CENTER); - selShell.setText(lh.localValue("specifyEncoding")); - selShell.setMinimumSize(250, 100); - - FillLayout layout = new FillLayout(SWT.VERTICAL); - layout.marginWidth = 8; - selShell.setLayout(layout); - Composite radioGroup = new Composite(selShell, SWT.NONE); - radioGroup.setLayout(new RowLayout(SWT.VERTICAL)); - - Button b1 = new Button(radioGroup, SWT.RADIO); - b1.setText(lh.localValue("encodeUTF8")); - b1.setSelection(true); // default - b1.pack(); - - Button b2 = new Button(radioGroup, SWT.RADIO); - b2.setText(lh.localValue("encodeISO88591")); - b2.pack(); - - Button b3 = new Button(radioGroup, SWT.RADIO); - b3.setText(lh.localValue("encodeWINDOWS1252")); - b3.pack(); - - Button b4 = new Button(radioGroup, SWT.RADIO); - b4.setText(lh.localValue("encodeUSASCII")); - b4.pack(); - - // if (SWT.getPlatform().equals("win32") || - // SWT.getPlatform().equals("wpf")) { - // b1.setSelection(false); - // b3.setSelection(true); - // } - - radioGroup.pack(); - - Composite c = new Composite(selShell, SWT.NONE); - RowLayout clayout = new RowLayout(); - clayout.type = SWT.HORIZONTAL; - // clayout.spacing = 30; - // clayout.marginWidth = 8; - clayout.marginTop = 20; - clayout.center = true; - clayout.pack = true; - clayout.justify = true; - c.setLayout(clayout); - - Button bsel = new Button(c, SWT.PUSH); - bsel.setText(lh.localValue("encodeSelect")); - bsel.pack(); - - c.pack(); - - Control tabList[] = new Control[] { radioGroup, c, radioGroup }; - try { - selShell.setTabList(tabList); - } - catch (IllegalArgumentException e) { - System.err.println("setTabList exception " + e.getMessage()); - } - - selShell.setDefaultButton(bsel); - selShell.pack(); - - Monitor primary = display.getPrimaryMonitor(); - Rectangle bounds = primary.getBounds(); - Rectangle rect = selShell.getBounds(); - int x = bounds.x + (bounds.width - rect.width) / 2; - int y = bounds.y + (bounds.height - rect.height) / 2; - selShell.setLocation(x, y); - - b1.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - encoding = Encodings.UTF_8.encoding(); - } - }); - - b2.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - encoding = Encodings.ISO_8859_1.encoding(); - } - }); - - b3.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - encoding = Encodings.WINDOWS_1252.encoding(); - } - }); - - b4.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - encoding = Encodings.US_ASCII.encoding(); - } - }); - - /* Select */ - bsel.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - selShell.dispose(); - } - }); - - selShell.addListener(SWT.Close, new Listener() { - public void handleEvent(Event event) { - event.doit = false; // must pick a value - } - }); - - selShell.open(); - - while (!selShell.isDisposed()) { - if (!display.readAndDispatch()){ - display.sleep(); - } - // nothing clicked - if (encoding == null) { - if (b1.getSelection()) { - encoding = Encodings.UTF_8.encoding(); - } - else if (b2.getSelection()) { - encoding = Encodings.ISO_8859_1.encoding(); - } - else if (b3.getSelection()) { - encoding = Encodings.WINDOWS_1252.encoding(); - } - else if (b4.getSelection()) { - encoding = Encodings.US_ASCII.encoding(); - } - } - } - return encoding; - } -} =======================================--- /src/main/org/brailleblaster/wordprocessor/Encodings.java Wed Jan 23 16:02:41 2013 UTC
+++ /dev/null @@ -1,16 +0,0 @@ -package org.brailleblaster.wordprocessor; - -public enum Encodings {- ISO_8859_1("ISO-8859-1"), UTF_8("UTF-8"), WINDOWS_1252("WINDOWS-1252"), US_ASCII(
- "US-ASCII"); - - private final String encoding; - - Encodings(String encoding) { - this.encoding = encoding; - } - - public String encoding() { - return encoding; - } -} =======================================--- /src/main/org/brailleblaster/wordprocessor/SaveOptionsDialog.java.orig Tue Jan 15 15:30:48 2013 UTC
+++ /dev/null @@ -1,149 +0,0 @@ -package org.brailleblaster.wordprocessor; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.TraverseEvent; -import org.eclipse.swt.events.TraverseListener; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.layout.RowLayout; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Dialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Monitor; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Control; - - -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 -} -public class SaveOptionsDialog extends Dialog { - SaveSelection result = SaveSelection.CANCELLED; - private LocaleHandler lh = new LocaleHandler(); - private boolean textAndBraille; - private BrailleView braille; - - - public SaveOptionsDialog (Shell parent, int style) { - super (parent, style); - } - public SaveOptionsDialog (Shell parent) { - this (parent, SWT.NONE); - } - public SaveSelection open () { - Shell parent = getParent(); - Display display = parent.getDisplay();- final Shell selShell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.CENTER);
- selShell.setText(getText()); - selShell.setMinimumSize (300, 150); - - FillLayout layout = new FillLayout(SWT.VERTICAL); - layout.marginWidth = 8; - selShell.setLayout(layout); - final Composite radioGroup = new Composite(selShell, SWT.NONE); - radioGroup.setLayout(new RowLayout(SWT.VERTICAL)); - final Button b1 = new Button (radioGroup, SWT.RADIO); - b1.setText(lh.localValue("saveTextBraille")); - b1.setSelection(true); - b1.pack(); - - final Button b2 = new Button (radioGroup, SWT.RADIO); - b2.setText(lh.localValue("saveTextOnly")); - b2.pack(); - radioGroup.pack(); - Composite c = new Composite(selShell, SWT.NONE); - RowLayout clayout = new RowLayout(); - clayout.type = SWT.HORIZONTAL; - clayout.spacing = 30; - clayout.marginWidth = 8; - clayout.center = true; - clayout.pack = true; - clayout.justify = true; - c.setLayout(clayout); - - Button b3 = new Button (c, SWT.PUSH); - b3.setText(lh.localValue("buttonSave")); - b3.pack(); - - Button b4 = new Button (c, SWT.PUSH); - b4.setText(lh.localValue("buttonCancel")); - b4.pack(); - - c.pack(); - - Control tabList[] = new Control[] { radioGroup, c, radioGroup}; - try { - selShell.setTabList(tabList); - } catch (IllegalArgumentException e) { - System.err.println ("setTabList exception " + e.getMessage()); - } - - selShell.setDefaultButton(b3); - - selShell.pack(); - - Monitor primary = display.getPrimaryMonitor (); - Rectangle bounds = primary.getBounds (); - Rectangle rect = selShell.getBounds (); - int x = bounds.x + (bounds.width - rect.width) / 2; - int y = bounds.y + (bounds.height - rect.height) / 2; - selShell.setLocation (x, y); - - /* text and Braille */ - b1.addSelectionListener (new SelectionAdapter() { - public void widgetSelected (SelectionEvent e) { - textAndBraille = true; - } - }); - - /* Text only */ - b2.addSelectionListener (new SelectionAdapter() { - public void widgetSelected (SelectionEvent e) { - textAndBraille = false; - } - }); - - /* Save */ - b3.addSelectionListener (new SelectionAdapter() { - public void widgetSelected (SelectionEvent e) { - - if ((b1.getSelection()) || (b2.getSelection()) ) { - //FO make sure we get the default selection - if (textAndBraille || b1.getSelection()) { - result = SaveSelection.TEXT_AND_BRAILLE; - } else { - result = SaveSelection.TEXT_ONLY; - } - selShell.dispose(); - } else { - new Notify (lh.localValue("mustSelect")); - } - } - }); - - /* Cancel */ - b4.addSelectionListener (new SelectionAdapter() { - public void widgetSelected (SelectionEvent e) { - selShell.dispose(); - } - }); - - - selShell.open(); - while (!selShell.isDisposed()) { - if (!display.readAndDispatch()) display.sleep(); - } - - return result; - } -} =======================================--- /src/main/org/brailleblaster/wordprocessor/TextView.java.orig Fri Jan 11 13:59:27 2013 UTC
+++ /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, 0, 49, 12, 92); - -} - -/* This is a derivative work from - * org.eclipse.swt.custom.DefaultContent.java -*/ - - -private class TextContent extends AbstractContent { -} -} =======================================--- /src/main/org/brailleblaster/document/MyReader.java Mon Aug 5 13:07:24 2013 UTC +++ /src/main/org/brailleblaster/document/MyReader.java Wed Sep 18 13:39:31 2013 UTC
@@ -1,6 +1,6 @@ package org.brailleblaster.document; -import org.brailleblaster.wordprocessor.Encodings; +import org.brailleblaster.encoder.Encodings; import org.xml.sax.InputSource; public class MyReader extends InputSource{