Revision: 0fcba21f846c Branch: default Author: cmyers@xxxxxxxxxxxxxxxxx Date: Thu Jan 9 16:22:23 2014 UTCLog: 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() {