Ignore:
Timestamp:
2013-03-02T00:32:50+01:00 (11 years ago)
Author:
donvip
Message:

[josm_opendata] better handling of .ods files (management of repeated cells)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/includes/org/jopendocument/model/table/TableTableRow.java

    r28000 r29298  
    1616package org.jopendocument.model.table;
    1717
     18import java.util.ArrayList;
     19import java.util.Collection;
    1820import java.util.Vector;
    1921
     
    2325public class TableTableRow {
    2426    static int count = 0;
    25 
     27    ArrayList<TableTableCell> allCells;
    2628
    2729    Vector<TableTableCell> cells = new Vector<TableTableCell>();
    2830
    2931    int id = 0;
    30 
     32   
    3133    protected int tableNumberRowsRepeated = 1;
    3234
     
    3941        this.cells.add(c);
    4042
     43    }
     44   
     45    /**
     46     * Compute AllCell except the last one
     47     */
     48    void computeAllCells() {
     49        this.allCells = new ArrayList<TableTableCell>();
     50        for (int index = 0; index < this.cells.size(); index++) {
     51            final TableTableCell c = this.cells.get(index);
     52            // for (TableTableCell c : cells) {
     53            //final int colPosition = this.allCells.size();
     54            int repeated = c.getTableNumberColumnsRepeated();
     55            // la derniere colonne n'est repétée que dans la limite de la zone d'impression
     56            // sinon, on s'en coltine des milliers
     57            if (index == this.cells.size() - 1) {
     58                //repeated = this.getTable().getPrintStopCol() - this.allCells.size() + 1;
     59                // Patch JOSM open data : do not care about last cell
     60                repeated = 0;
     61            }
     62            for (int i = 0; i < repeated; i++) {
     63             // Patch JOSM open data : do not care about column
     64                //final TableTableColumn col = this.table.getColumnAtPosition(colPosition + i);
     65                final TableTableCell cc = c.cloneCell();
     66                //cc.setRowAndColumn(this, col);
     67                this.allCells.add(cc);
     68            }
     69        }
     70        // }}
     71        // System.err.println("Computed:" + allCells.size() + " :" + allCells);
     72    }
     73   
     74    public Collection<TableTableCell> getAllCells() {
     75
     76        if (this.allCells == null) {
     77            this.computeAllCells();
     78        }
     79       
     80        return this.allCells;
    4181    }
    4282
     
    5696    // return cells;
    5797    // }
    58 
    5998
    6099    public String getText() {
Note: See TracChangeset for help on using the changeset viewer.