Changeset 29298 in osm for applications/editors
- Timestamp:
- 2013-03-02T00:32:50+01:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/opendata
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/includes/org/jopendocument/io/SaxContentUnmarshaller.java
r28000 r29298 285 285 final TableTableCell cell = new TableTableCell(); 286 286 cell.setTableStyleName(attribs.getValue("table:style-name")); 287 //cell.setTableNumberColumnsRepeated(attribs.getValue("table:number-columns-repeated"));287 cell.setTableNumberColumnsRepeated(attribs.getValue("table:number-columns-repeated")); 288 288 //cell.setTableNumberColumnsSpanned(attribs.getValue("table:number-columns-spanned")); 289 289 //cell.setTableNumberRowsSpanned(attribs.getValue("table:number-rows-spanned")); -
applications/editors/josm/plugins/opendata/includes/org/jopendocument/model/table/TableTableCell.java
r28000 r29298 22 22 private TableTableColumn column; 23 23 24 protected int tableNumberColumnsRepeated = 1; 25 24 26 protected String tableStyleName; 25 27 26 28 private TextP textP; 29 30 protected TableTableCell cloneCell() { 31 final TableTableCell c = new TableTableCell(); 32 33 c.tableNumberColumnsRepeated = this.tableNumberColumnsRepeated; 34 c.tableStyleName = this.tableStyleName; 35 c.textP = this.textP; 36 return c; 37 } 27 38 28 39 private void computeStyle() { … … 48 59 } 49 60 61 /** 62 * Gets the value of the tableNumberColumnsRepeated property. 63 * 64 */ 65 public int getTableNumberColumnsRepeated() { 66 return this.tableNumberColumnsRepeated; 67 } 68 50 69 public TextP getTextP() { 51 70 return this.textP; 71 } 72 73 /** 74 * Sets the value of the tableNumberColumnsRepeated property. 75 * 76 * @param value allowed object is {@link String } 77 * 78 */ 79 public void setTableNumberColumnsRepeated(final String value) { 80 if (value != null) { 81 this.tableNumberColumnsRepeated = Integer.valueOf(value); 82 } 52 83 } 53 84 … … 64 95 65 96 } 66 67 97 68 98 public void setTextP(final TextP p) { -
applications/editors/josm/plugins/opendata/includes/org/jopendocument/model/table/TableTableRow.java
r28000 r29298 16 16 package org.jopendocument.model.table; 17 17 18 import java.util.ArrayList; 19 import java.util.Collection; 18 20 import java.util.Vector; 19 21 … … 23 25 public class TableTableRow { 24 26 static int count = 0; 25 27 ArrayList<TableTableCell> allCells; 26 28 27 29 Vector<TableTableCell> cells = new Vector<TableTableCell>(); 28 30 29 31 int id = 0; 30 32 31 33 protected int tableNumberRowsRepeated = 1; 32 34 … … 39 41 this.cells.add(c); 40 42 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; 41 81 } 42 82 … … 56 96 // return cells; 57 97 // } 58 59 98 60 99 public String getText() { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/OdsReader.java
r28113 r29298 24 24 import org.jopendocument.model.office.OfficeSpreadsheet; 25 25 import org.jopendocument.model.table.TableTable; 26 import org.jopendocument.model.table.TableTableCell; 26 27 import org.jopendocument.model.table.TableTableRow; 28 import org.jopendocument.model.text.TextP; 27 29 import org.openstreetmap.josm.data.osm.DataSet; 28 30 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 36 38 private int rowIndex; 37 39 38 private static final String SEP = "TextP: \\[";40 private static final String SEP = "TextP:["; 39 41 40 42 public OdsReader(SpreadSheetHandler handler) { … … 79 81 List<String> result = new ArrayList<String>(); 80 82 boolean allFieldsBlank = true; 81 for (String text : row.getText().replaceFirst(SEP, "").replaceAll("\\]", "").replaceAll("null", SEP).split(SEP)) { 82 result.add(text); 83 if (allFieldsBlank && !text.isEmpty()) { 84 allFieldsBlank = false; 85 } 83 for (TableTableCell cell : row.getAllCells()) { 84 TextP textP = cell.getTextP(); 85 String text = textP == null ? "" : textP.toString().replace(SEP, "").replace("]", "").replace("null", "").trim(); 86 result.add(text); 87 if (allFieldsBlank && !text.isEmpty()) { 88 allFieldsBlank = false; 89 } 86 90 } 87 91
Note:
See TracChangeset
for help on using the changeset viewer.