From 78039ce424d4c4b5b9011b99e993ac7bd80a3a9c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Sep 2010 17:29:42 +0100 Subject: [PATCH] check the user has not reorganised the table --- .../tedpearson/ypp/market/MarketUploader.java | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/com/tedpearson/ypp/market/MarketUploader.java b/src/com/tedpearson/ypp/market/MarketUploader.java index 7632c01..729c686 100644 --- a/src/com/tedpearson/ypp/market/MarketUploader.java +++ b/src/com/tedpearson/ypp/market/MarketUploader.java @@ -378,12 +378,12 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis yarrgts = getYarrgTimestamp(); } - AccessibleTable t = findMarketTable(); - if(t == null) { + AccessibleTable accesstable = findMarketTable(); + if(accesstable == null) { error("Market table not found! Please open the Buy/Sell Commodities interface."); return; } - if(t.getAccessibleRowCount() == 0) { + if(accesstable.getAccessibleRowCount() == 0) { error("No data found, please wait for the table to have data first!"); return; } @@ -399,7 +399,29 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis latch.await(2, java.util.concurrent.TimeUnit.SECONDS); } - ArrayList> data = getData(t); + String headings_expected[] = new String[] + { "Commodity", "Trading outlet", "Buy price", "Will buy", "Sell price", "Will sell" }; + ArrayList> headers = getData(accesstable.getAccessibleColumnHeader()); + if (headers.size() != 1) { + error("Table headings not one row! " + headers.toString()); + return; + } + if (headers.get(0).size() != 6) { + error("Table headings not six columns! " + headers.toString()); + return; + } + for (int col=0; col> data = getData(accesstable); if (uploadToYarrg && yarrgts != null) { pm.setNote("Yarrg: Preparing data"); -- 2.30.2