Submit | Open tickets | Closed tickets

[ Ticket #1218 ] overwrite doesn't work
Date:
06/08/18 08:56
Submitted by:
B_Fristensky
Assigned to:
B_Fristensky
Category:
bioLegato
Priority:
5
Ticket group:
Bug
Resolution:
Resolved
Summary:
overwrite doesn't work
Original submission:
It looks like the overwrite function attribute doesn't work, at least in the table canvas. Given the following code from dat/blreads/PCD/File/ShortNames.blmenu is an example:

var "out1"
type tempfile
direction out
format tsv
overwrite true

data written to out1 does get read into the table canvas, but the original data is not overwritten. Even if a block of rows is selected, the original content is not deleted.

The correct behavior should be to replace the content with the output from the file. Even better would be
Please log in to add comments and receive followups via email.
Followups
Comment Date By
overwrite and content=canvas now work when direction=out.
However, there is a difficult to track down error generated when replacing an entire canvas with new content.

The problem is illustrated in blreads/File/Refresh, whose purpose is to act like the refresh button on a file manager. given

var "out1"
type tempfile
direction out
format tsv
save false
overwrite true
content canvas

BioLegato successfully runs bldirtab.py with output going to %out1%, as shown below:

{mars:/home/psgendb/temp/blreads/maize/transcriptome/reads.raw}blreads
BioPCD: executing - bldirtab.py bio3895482915133062369.tmp
BioPCD: Command executed successfully, return status: 0
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 2 >= 0
at java.util.Vector.elementAt(Vector.java:477)
at javax.swing.table.DefaultTableModel.getValueAt(DefaultTableModel.java:648)
at javax.swing.JTable.getValueAt(JTable.java:2717)
at javax.swing.JTable.prepareRenderer(JTable.java:5706)
at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2114)
at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:2016)
at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1812)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
at javax.swing.JComponent.paintComponent(JComponent.java:780)
at javax.swing.JComponent.paint(JComponent.java:1056)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5210)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:290)
at javax.swing.RepaintManager.paint(RepaintManager.java:1272)
at javax.swing.JComponent._paintImmediately(JComponent.java:5158)
at javax.swing.JComponent.paintImmediately(JComponent.java:4969)
at javax.swing.RepaintManager$4.run(RepaintManager.java:831)
at javax.swing.RepaintManager$4.run(RepaintManager.java:814)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:814)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:789)
at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:738)
at javax.swing.RepaintManager.access$1200(RepaintManager.java:64)
at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1732)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

I did a lot of detective work trying to debug what was causing the error, and was not able to track it down. There are a lot of debugging statements commented out in TSVFile.jj and in TableCanvas.java, particularly with respect to the addRows method. I initially thought that the error was in TableCanvas/addRows, but can't seem to find anything that looks wrong.

Testing so far shows that BioLegato still correctly reads in the %out1% file when replacing the contents of the canvas. The error seems to be inconsequential. Still, I hate to have an error message. For now, we'll consider the overwrite/content feature to be implemented, but this should be fixed.
07/12/18 17:41 B_Fristensky
In order to make overwrite and canvas=true work, it was necessary to modify TSVFile.jj/readFile to add the forceall parameter to the parameter list. The new declaration looks like this:

public static void readFile(TableCanvas table, Reader currentFile, boolean overwrite, boolean forceall) throws IOException

Consequently, all calls to readFile had to be modified to include this parameter:
CSVFile.jj
TableCanvas.java
PCDIO.java
SequenceCanvas.java
PCDEditor.java
ImageCanvas.java


07/12/18 17:30 B_Fristensky
To facilitate creation of a Refresh function (File --> Refresh), added the following code to TSVFile.jj and CSVFile.jj:

if (overwrite) {
// If no data are selected, delete all data in the canvas
boolean forceall = (table.tablePane.getSelectedColumnCount() == 0
&& table.tablePane.getSelectedRowCount() == 0);
if (forceall) {
table.tablePane.selectAll();
}
table.deleteSelectedRows();
// An error would be generated if we had an empty canvas, so add a dummy
// first row and clear the selection.
if (forceall) {
String[] dummy = new String[1];
dummy[0]="";
table.addRow(dummy);
table.tablePane.clearSelection();
}
}
07/09/18 18:09 B_Fristensky
Two steps were required to get this to work:

1) Add a method to TableCanvas.java called deleteSelectedRows(). This contains code that was moved from the actionPerformed for the Delete Row(s) button, that already deleted selected rows. The Delete Row(s) button now calls deleteSelectedRows().
2) In TSVfile.jj and CSVfile.jj, the TODO comment saying that overwrite needed to be implemented was replaced with:
<pre>
if (overwrite) {
table.deleteSelectedRows();
}
</pre>
06/26/18 19:13 B_Fristensky
Confirmed: In both CSVFile.java and TSVFile.java there are TODO comments saying that overwrite needs to be implemented. 06/25/18 17:46 B_Fristensky
Overwrite has been tested for the Sequence canvas, and does work. It replaces the SELECTION, not the entire contents of the window, as advertised.

It seems likely that it just wasn't implemented for the table canvas.
06/25/18 15:19 B_Fristensky
No results for "Dependent on ticket"
No results for "Dependent on Task"
No other tickets are dependent on this ticket
Ticket change history
Field Old value Date By
close_date 07/12/18 17:30 07/12/18 17:41 B_Fristensky
close_date 07/09/18 18:09 07/12/18 17:30 B_Fristensky
close_date 06/26/18 19:14 07/09/18 18:09 B_Fristensky
status_id Open 06/26/18 19:14 B_Fristensky
assigned_to unset 06/26/18 19:14 B_Fristensky
resolution_id Not Resolved 06/26/18 19:14 B_Fristensky
close_date 12/31/69 19:00 06/26/18 19:14 B_Fristensky
status_id Pending 06/25/18 15:19 B_Fristensky
resolution_id Unset 06/25/18 15:19 B_Fristensky

© 1998-2025 Scilico, LLC. All rights reserved.