[brailleblaster] Re: push by RandomCh...@xxxxxxxxx - Apply Button removed. Image Describer updates document as you type. Hi... on 2014-01-09 16:23 GMT

  • From: Keith Creasy <kcreasy@xxxxxxx>
  • To: "brailleblaster@xxxxxxxxxxxxx" <brailleblaster@xxxxxxxxxxxxx>
  • Date: Thu, 9 Jan 2014 16:54:50 +0000

I'll defer to your judgement. If you are convinced that it won't cause issues 
then let's leave it as it is. What kind of machine are you running it on? Were 
you running a screen reader? I'll test it too just to be sure.


-----Original Message-----
From: brailleblaster-bounce@xxxxxxxxxxxxx 
[mailto:brailleblaster-bounce@xxxxxxxxxxxxx] On Behalf Of Chuck Myers
Sent: Thursday, January 09, 2014 11:48 AM
To: brailleblaster@xxxxxxxxxxxxx
Subject: [brailleblaster] Re: push by RandomCh...@xxxxxxxxx - Apply Button 
removed. Image Describer updates document as you type. Hi... on 2014-01-09 
16:23 GMT

I didn't notice any performance issues, and I was using a fairly large 
document. I can revisit it if you think it's too simple a solution. :) 
________________________________________
From: brailleblaster-bounce@xxxxxxxxxxxxx [brailleblaster-bounce@xxxxxxxxxxxxx] 
on behalf of Keith Creasy
Sent: Thursday, January 09, 2014 11:26 AM
To: brailleblaster@xxxxxxxxxxxxx
Subject: [brailleblaster] Re: push by RandomCh...@xxxxxxxxx - Apply Button 
removed. Image Describer updates document as you type. Hi... on 2014-01-09 
16:23 GMT

Chuck.

Do you really mean "updates document as you type"? Wouldn't it be best to store 
the text in the edit control when either you move away from the currently 
focused image or exit the perspective/application? I don't think you want to 
update the XML DOM on every keystroke.


-----Original Message-----
From: brailleblaster-bounce@xxxxxxxxxxxxx 
[mailto:brailleblaster-bounce@xxxxxxxxxxxxx] On Behalf Of 
brailleblaster@xxxxxxxxxxxxxx
Sent: Thursday, January 09, 2014 11:23 AM
To: brailleblaster@xxxxxxxxxxxxx
Subject: [brailleblaster] push by RandomCh...@xxxxxxxxx - Apply Button removed. 
Image Describer updates document as you type. Hi... on 2014-01-09 16:23 GMT

Revision: 0fcba21f846c
Branch:   default
Author:   cmyers@xxxxxxxxxxxxxxxxx
Date:     Thu Jan  9 16:22:23 2014 UTC
Log:      Apply Button removed. Image Describer updates document as you
type. Hit save/save as to save changes to file as usual. Undo All changed to 
Undo, and just undoes changes to current image.
http://code.google.com/p/brailleblaster/source/detail?r=0fcba21f846c

Modified:

/src/main/org/brailleblaster/perspectives/imageDescriber/ImageDescriberController.java

/src/main/org/brailleblaster/perspectives/imageDescriber/document/ImageDescriber.java

/src/main/org/brailleblaster/perspectives/imageDescriber/document/ImageDescriberContext.java

/src/main/org/brailleblaster/perspectives/imageDescriber/views/ImageDescriberView.java

=======================================
---
/src/main/org/brailleblaster/perspectives/imageDescriber/ImageDescriberController.java
Tue Jan  7 20:55:45 2014 UTC
+++
/src/main/org/brailleblaster/perspectives/imageDescriber/ImageDescriberController.java
Thu Jan  9 16:22:23 2014 UTC
@@ -217,7 +217,7 @@
                                else if(arch.getOrigDocPath().endsWith("xml"))
                                {
                                        
if(fu.createXMLFile(imgDesc.getNewXML(), workingFilePath)){
-                                               String tempSemFile = 
BBIni.getTempFilesPath() + BBIni.getFileSep() +
fu.getFileName(workingFilePath) + ".sem";
+                                               String tempSemFile = 
+BBIni.getTempFilesPath() +
+BBIni.getFileSep() +
fu.getFileName(workingFilePath) + ".sem";
                                                copySemanticsFile(tempSemFile, 
fu.getPath(workingFilePath) +
BBIni.getFileSep() + fu.getFileName(workingFilePath) + ".sem");
                                        }
                                        else { @@ -227,7 +227,7 @@
                        }
                        else if(workingFilePath.endsWith("xml")){
                                if(fu.createXMLFile(imgDesc.getNewXML(), 
workingFilePath)){
-                                       String tempSemFile = 
BBIni.getTempFilesPath() + BBIni.getFileSep() +
fu.getFileName(workingFilePath) + ".sem";
+                                       String tempSemFile = 
+ BBIni.getTempFilesPath() + BBIni.getFileSep()
++
fu.getFileName(workingFilePath) + ".sem";
                                        copySemanticsFile(tempSemFile, 
fu.getPath(workingFilePath) +
BBIni.getFileSep() + fu.getFileName(workingFilePath) + ".sem");
                                }
                                else {
=======================================
---
/src/main/org/brailleblaster/perspectives/imageDescriber/document/ImageDescriber.java
Tue Jan  7 20:55:45 2014 UTC
+++
/src/main/org/brailleblaster/perspectives/imageDescriber/document/ImageDescriber.java
Thu Jan  9 16:22:23 2014 UTC
@@ -206,7 +206,7 @@
                        if(getDescAtIndex(curItem) != null)
                                sb = new StringBuilder( getDescAtIndex(curItem) 
);
                        else
-                               sb = new StringBuilder( "Error" );
+                               sb = new StringBuilder( "" );

                        // Add this to string.
                        prodCopyList.add( sb.toString() ); 
=======================================
---
/src/main/org/brailleblaster/perspectives/imageDescriber/document/ImageDescriberContext.java
Tue Jan  7 20:55:45 2014 UTC
+++
/src/main/org/brailleblaster/perspectives/imageDescriber/document/ImageDescriberContext.java
Thu Jan  9 16:22:23 2014 UTC
@@ -244,7 +244,7 @@
        public String getDescription(Element e)
        {
                // String for description text.
-               String descText = "NO DESCRIPTION.";
+               String descText = null;
                // Description element found.
                Element descElm = null;

@@ -262,7 +262,7 @@
                {
                        // If there are no children, then there's no text node. 
Create it.
                        if(descElm.getChildCount() == 0)
-                               descElm.appendChild( new nu.xom.Text("ADD 
DESCRIPTION!") );
+                               descElm.appendChild( new nu.xom.Text("") 
+ );

                        // Store text and get ready to return it.
                        descText = descElm.getChild(0).getValue(); 
=======================================
---
/src/main/org/brailleblaster/perspectives/imageDescriber/views/ImageDescriberView.java
Tue Jan  7 20:55:45 2014 UTC
+++
/src/main/org/brailleblaster/perspectives/imageDescriber/views/ImageDescriberView.java
Thu Jan  9 16:22:23 2014 UTC
@@ -99,13 +99,15 @@
        ImageDescriber imgDesc;
        ImageDescriberController idd;
        Group group;
-       Button prevBtn, nextBtn, applyBtn, undoAllBtn, applyToAllBtn, 
clearAllBtn;
+       Button prevBtn, nextBtn, applyBtn, undoBtn, applyToAllBtn, 
+clearAllBtn;
        Text imgDescTextBox;
        Label altLabel;
        Text altBox;
        Browser browser;
        ImageHelper imgHelper;
        Label mainImage;
+       String oldDescText = "";
+       String oldAltText = "";

        public ImageDescriberView(Group group, ImageDescriber imgDesc, 
ImageDescriberController idd){
                this.group = group;
@@ -137,12 +139,16 @@
                        //Change current image in dialog.
                        setMainImage();

+                       // Get description and alt text.
+                       oldDescText = imgDesc.getCurDescription();
+                       oldAltText = imgDesc.getCurElmAttribute("alt");
+
                        // Get prodnote text/image description.
-                       imgDescTextBox.setText( imgDesc.getCurDescription() );
+                       setTextBox( oldDescText );

                        // Get alt attribute.
-                       if(imgDesc.getCurElmAttribute("alt") != null)
-                               
altBox.setText(imgDesc.getCurElmAttribute("alt"));
+                       if(oldAltText != null)
+                               altBox.setText(oldAltText);

                        idd.setImageInfo();
                        // Show current image index and name.
@@ -170,12 +176,16 @@
                                // Change current image in dialog.
                                setMainImage();

+                               // Get description and alt text.
+                               oldDescText = imgDesc.getCurDescription();
+                               oldAltText = 
+ imgDesc.getCurElmAttribute("alt");
+
                                // Get prodnote text/image description.
-                               imgDescTextBox.setText( 
imgDesc.getCurDescription() );
+                               setTextBox( oldDescText );

                                // Get alt attribute.
-                               if(imgDesc.getCurElmAttribute("alt") != null)
-                                       
altBox.setText(imgDesc.getCurElmAttribute("alt"));
+                               if(oldAltText != null)
+                                       altBox.setText(oldAltText);

                                idd.setImageInfo();
                                //Show current image index and name.
@@ -188,43 +198,25 @@

                }); // nextBtn.addSelectionListener...

-               // Create apply button.
-               applyBtn = new Button(group, SWT.PUSH);
-               applyBtn.setText("Apply");
-               //applyBtn.setBounds(applyBtnX,  applyBtnY, applyBtnW, 
applyBtnH);
-//             setFormData(applyBtn, 14, 21, 0, 5);
-               setFormData(applyBtn, 21, 28, 0, 5);
-               applyBtn.addSelectionListener(new SelectionAdapter() {
-                       @Override
-                       public void widgetSelected(SelectionEvent e) {
-
-                               // Set image's description.
-                               
imgDesc.setDescription(imgDescTextBox.getText(), null, null,
altBox.getText());
-                               idd.setDocumentEdited(true);
-                       } // widgetSelected()
-
-               }); // applyBtn.addSelectionListener...
-
-               // Create undo all button.
-               undoAllBtn = new Button(group, SWT.PUSH);
-               undoAllBtn.setText("Undo All");
-               //undoAllBtn.setBounds(undoBtnX,  undoBtnY, undoBtnW, undoBtnH);
-               setFormData(undoAllBtn, 28, 35, 0, 5);
-               undoAllBtn.addSelectionListener(new SelectionAdapter() {
+               // Create undo button.
+               undoBtn = new Button(group, SWT.PUSH);
+               undoBtn.setText("Undo");
+               //undoBtn.setBounds(undoBtnX,  undoBtnY, undoBtnW, undoBtnH);
+               setFormData(undoBtn, 28, 35, 0, 5);
+               undoBtn.addSelectionListener(new SelectionAdapter() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
-
-                               // Warn user that all changes will be discarded.
-                               if( msgBx("Warning", "This will discard all 
changes, even the ones you
Apply'd. Continue?") == true)
-                               {
-                                       // Copy original elements back into 
main list. "Undo!"
-                                       imgDesc.copyUndo2MainList();
-
-                               } // msgBx()
+
+                               // Get prodnote text/image description.
+                               setTextBox( oldDescText );
+
+                               // Get alt attribute.
+                               if(oldAltText != null)
+                                       altBox.setText(oldAltText);

                        } // widgetSelected()

-               }); // undoAllBtn.addSelectionListener...
+               }); // undoBtn.addSelectionListener...

                // Apply to all button. Finds every image with this name and 
changes description
                // to what was in the notes.
@@ -329,7 +321,8 @@
                altBox.addModifyListener(new ModifyListener() {
                        @Override
                        public void modifyText(ModifyEvent arg0) {
-
+                                       imgDesc.setCurElmImgAttributes( null, 
null, altBox.getText() );
+                                       idd.setDocumentEdited(true);
                        } // modifyText()

                }); // addModifyListener(new ModiftyListener() { @@ -341,7 
+334,8 @@
                imgDescTextBox.addModifyListener(new ModifyListener() {
                        @Override
                        public void modifyText(ModifyEvent arg0) {
-
+                                       
imgDesc.setDescription(imgDescTextBox.getText(), null, null, null);
+                                       idd.setDocumentEdited(true);
                        } // modifyText()

                }); // addModifyListener(new ModiftyListener() {




Other related posts: