[ 
https://issues.apache.org/jira/browse/ODFTOOLKIT-356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15005865#comment-15005865
 ] 

Svante Schubert commented on ODFTOOLKIT-356:
--------------------------------------------

Hello Raimund,

Thank you for the update, you have been busy! :)
Here comes the a patch, where I need further discussion.

After the patch the test "testDeleteColumnsOnEmptyTable()" will create a 5 
column table and delete 5 columns.

If you save the document, e.g. via 
document.save(ResourceUtilities.newTestOutputFile("EmptyTableTest.ods"));
and validate it on http://odf-validator.rhcloud.com/ there is a problem due to 
the empty table element.
<table:table table:name="Table2" table:style-name="a388ddf"/>
As every ODF table requires at least one cell with one column/row.

In the office application the user deletes the table when deleting the last 
column/row, but not here.
We might want to make the behavior a little more fool proof for the user, like 
either ignoring the last deletion of row/column (even throwing a run-time 
exception) or deleting as well the complete table element, when deleting the 
last row/column. The latter is a little difficult, as we are deleting the 
column/rows with the table and are still holding the handle.

If you believe the user has to know what to do, I can agree on that as long it 
is being explicitly mentioned in the JavaDoc of the methods and behaves 
consistently when deleting rows/columns.

What do you think, Raimund?

Two general comments: 
1) How about marking old patches as deprecated or deleting them within JIRA to 
avoid confusion. I do like very much your effort in separating the test and the 
solution, so I am able to review first the failing tests.
2) Can you double check your line indent? You seem to indent with two spaces, 
while I indent with a TAB 
-               if (nStart + nCount >= clmnum) {
+    if (nStart > 1 && nStart + nCount >= clmnum) {
TAB as first indent allows more flexibility for different indent taste of users 
and less characters to parse, but this is kind of religion and I have not find 
quickly any coding style guide.. ;)


> IllegalArgumentException when removing all columns from a fresh Table
> ---------------------------------------------------------------------
>
>                 Key: ODFTOOLKIT-356
>                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-356
>             Project: ODF Toolkit
>          Issue Type: Bug
>    Affects Versions: 0.6-incubating
>            Reporter: Florian Hopf
>            Assignee: Florian Hopf
>         Attachments: HandlingEmptyTables-Test.patch, 
> HandlingEmptyTables.patch, ODFTOOLKIT-356-Test.patch, 
> ODFTOOLKIT-356-contribution.patch
>
>
> When trying to remove all columns from the Table of a newly created 
> SpreadsheetDocument an illegal index is passed in to Row#getCellByIndex()



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to