From: Ian Jackson Date: Sat, 4 Sep 2010 16:29:42 +0000 (+0100) Subject: check the user has not reorganised the table X-Git-Tag: 0.9.9~29 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=jarrg-ian.git;a=commitdiff_plain;h=78039ce424d4c4b5b9011b99e993ac7bd80a3a9c;ds=sidebyside check the user has not reorganised the table --- 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");