Skip to content
This repository
Browse code

start of test app gchart

git-svn-id: https://pyjamas.svn.sourceforge.net/svnroot/pyjamas/trunk@1325 7a2bd370-bda8-463c-979e-2900ccfb811e
  • Loading branch information...
commit 0e8e6dae0d4aaeb0bd709567cfc5ce170252c7c8 1 parent a66830a
authored

Showing 28 changed files with 982 additions and 59 deletions. Show diff stats Hide diff stats

  1. 19  examples/gcharttestapp/GChartExample00.py
  2. 381  examples/gcharttestapp/GChartTestApp.py
  3. 52  examples/gcharttestapp/GChartTestAppUtil.py
  4. 29  examples/gcharttestapp/public/.svn/all-wcprops
  5. 18  examples/gcharttestapp/public/.svn/dir-prop-base
  6. 164  examples/gcharttestapp/public/.svn/entries
  7. 5  examples/gcharttestapp/public/.svn/prop-base/alternating-black-white-row.gif.svn-base
  8. 5  examples/gcharttestapp/public/.svn/prop-base/red.gif.svn-base
  9. 39  examples/gcharttestapp/public/.svn/text-base/GChartTestApp.html.svn-base
  10. BIN  examples/gcharttestapp/public/.svn/text-base/alternating-black-white-row.gif.svn-base
  11. 94  examples/gcharttestapp/public/.svn/text-base/gcharttestapp.css.svn-base
  12. BIN  examples/gcharttestapp/public/.svn/text-base/red.gif.svn-base
  13. 40  examples/gcharttestapp/public/GChartTestApp.html
  14. BIN  examples/gcharttestapp/public/alternating-black-white-row.gif
  15. 94  examples/gcharttestapp/public/gcharttestapp.css
  16. BIN  examples/gcharttestapp/public/red.gif
  17. 6  library/pyjamas/chart/Annotation.py
  18. 8  library/pyjamas/chart/AnnotationLocation.py
  19. 17  library/pyjamas/chart/Axis.py
  20. 8  library/pyjamas/chart/Curve.py
  21. 18  library/pyjamas/chart/GChart.py
  22. 8  library/pyjamas/chart/GChartWidgets.py
  23. 6  library/pyjamas/chart/HovertextChunk.py
  24. 8  library/pyjamas/chart/Point.py
  25. 8  library/pyjamas/chart/Symbol.py
  26. 8  library/pyjamas/chart/SymbolType.py
  27. 6  library/pyjamas/chart/TickLocation.py
  28. 0  library/pyjamas/chart/__init__.py
19  examples/gcharttestapp/GChartExample00.py
... ...
@@ -0,0 +1,19 @@
  1
+
  2
+from pyjamas.chart import GChart
  3
+
  4
+"""*
  5
+* Defines a scatter-plot of x*x vs. x.
  6
+"""
  7
+class GChartExample00(GChart):
  8
+    def __init__(self):
  9
+        self.setChartTitle("<b>x<sup>2</sup> vs x</b>")
  10
+        self.setChartSize(150, 150)
  11
+        self.addCurve()
  12
+        for int i = 0; i < 10; i++)
  13
+            self.getCurve().addPoint(i,i*i)
  14
+        self.getCurve().setLegendLabel("x<sup>2</sup>")
  15
+        self.getXAxis().setAxisLabel("x")
  16
+        self.getYAxis().setAxisLabel("x<sup>2</sup>")
  17
+    
  18
+
  19
+
381  examples/gcharttestapp/GChartTestApp.py
... ...
@@ -0,0 +1,381 @@
  1
+import pyjd
  2
+
  3
+from pyjamas import DeferredCommand
  4
+from pyjamas.ui.HTML import HTML
  5
+from pyjamas.ui.RootPanel import RootPanel
  6
+from pyjamas.Canvas2D import Canvas
  7
+from pyjamas.chart import GChart
  8
+
  9
+from TestGChart00 import TestGChart00 
  10
+
  11
+"""*
  12
+*
  13
+* Displays the test  chart in the browser, and checks the HTML
  14
+* generated against previous, visually validated, browser
  15
+* output HTML hash codes to see if HTML output from the test
  16
+* has changed (possibly due to an error).
  17
+*
  18
+* As long as GChart and the test set itself has not changed,
  19
+* these tests can be performed by first running in hosted
  20
+* mode, then clicking on the "Compile/Browse" button. If
  21
+* "Test passed" is displayed in hosted mode and also in
  22
+* Firefox after the compile (this assumes Firefox is your default browser)
  23
+* it means that the generated HTML has not changed since
  24
+* the last time it was visually inspected--test passed.
  25
+*
  26
+* If the test or GChart changes so as to change browser output,
  27
+* you will have to visually verify the charts, and then (assuming the
  28
+* charts are correct) enter the hashcodes.
  29
+*
  30
+* In the most common case where the test and output are unchanged,
  31
+* the test should go through very quickly.
  32
+*
  33
+"""
  34
+    
  35
+""" Linear congruent random number generator.
  36
+*
  37
+* Cannot use GWT's Math.random() because, for automated
  38
+* testing, we require that the exact same random sequence
  39
+* be used each time (GWT does not support the JDK's more
  40
+* generic Random class, which would have allowed this).
  41
+*
  42
+* Constants are from Knuth via Numerical Recipes in C.
  43
+*
  44
+"""
  45
+i = 0
  46
+def rnd(self):
  47
+    m = 217728
  48
+    a = 84589
  49
+    c = 45989
  50
+    i = (a*i + c) % m
  51
+    return i/m
  52
+
  53
+
  54
+"""
  55
+* Allows us to quickly check if test charts changed since last time
  56
+* they were manually inspected, thus eliminating the many tedious
  57
+* re-inspections I used to have to do.
  58
+*
  59
+* Whenever the test changes, or GChart changes in a way that changes
  60
+* generated HTML, manual chart re-inspection is needed and
  61
+* the various hashcodes below need to be re-entered.
  62
+*
  63
+* Note that sometimes the hosted mode cold-start hash code is generated by
  64
+* a refresh, so if you get the same hash code the first time
  65
+* you press refresh, try again to produce the second, refresh, hash code.
  66
+*
  67
+* Note, that if you open the compiled app directly from the file system
  68
+* rather than via the Compile/Browse button, Firefox produces a different
  69
+* HTML/hash code, so you must run the test via the Compile/Browse button.
  70
+*
  71
+"""
  72
+    
  73
+class AddOneChart:
  74
+    def __init__(self, gchart, needsUpdate=True):
  75
+        self.gchart = gchart
  76
+        self.needsUpdate = needsUpdate
  77
+    
  78
+    def execute(self):
  79
+        RootPanel.get("testappcharts").add(HTML(getTitle(gchart)))
  80
+        RootPanel.get("testappcharts").add(gchart)
  81
+        if self.needsUpdate:
  82
+            gchart.update()
  83
+        
  84
+
  85
+
  86
+
  87
+def addChart(self, gchart):
  88
+    DeferredCommand.addCommand(AddOneChart(gchart, True))
  89
+
  90
+def addChartNoUpdate(self, gchart):
  91
+    DeferredCommand.addCommand(AddOneChart(gchart, False))
  92
+
  93
+class GWTCanvasBasedCanvasFactory :
  94
+    def create(self):
  95
+        return Canvas()
  96
+
  97
+
  98
+def onModuleLoad(self):
  99
+    
  100
+    GChart.setCanvasFactory(GWTCanvasBasedCanvasFactory())
  101
+    
  102
+    # thinking about retiring these tests:
  103
+    #    addChart(GChartExample11(0,2,False))
  104
+    #    addChart(GChartExample11(0,3,False))
  105
+    #    addChart(GChartExample11(0,4,False))
  106
+    #    addChart(GChartExample11(0,5,False))
  107
+    #    addChart(GChartExample11(0,6,False))
  108
+    #    addChart(GChartExample11(0,7,False))
  109
+    #    addChart(GChartExample11(0,8,False))
  110
+    #    addChart(TestGChart40())
  111
+    #    DeferredCommand.addCommand(Command() { void execute() {
  112
+    #    RootPanel.get().add(TestGChart41a())
  113
+    #  }})
  114
+    
  115
+    # To focus on a single test, simply use Eclipse's Source, Toggle comment
  116
+    #    addChart(GChartExample00())
  117
+    #    addChart(GChartExample00a())
  118
+    #    addChart(GChartExample00b())
  119
+    #    addChart(GChartExample00c())
  120
+    #    addChart(GChartExample01())
  121
+    #    addChart(GChartExample01a(3))
  122
+    #    addChart(GChartExample01a(0))
  123
+    #    addChart(GChartExample01b())
  124
+    #    addChart(GChartExample01c())
  125
+    #    addChart(GChartExample02())
  126
+    #    addChart(GChartExample03())
  127
+    #    addChart(GChartExample04())
  128
+    #    addChart(GChartExample04a())
  129
+    #    addChart(GChartExample04b())
  130
+    #    addChart(GChartExample05())
  131
+    #    addChart(GChartExample06())
  132
+    #    addChart(GChartExample07())
  133
+    #    addChart(GChartExample08())
  134
+    #    addChart(GChartExample09())
  135
+    #    addChart(GChartExample10())
  136
+    #    addChart(GChartExample11(0,1,True))
  137
+    #    addChart(GChartExample11(0,1,False))
  138
+    #    addChart(GChartExample11(1,1,False))
  139
+    #    addChart(GChartExample11(2,1,False))
  140
+    #    addChart(GChartExample11(3,1,False))
  141
+    #    addChart(GChartExample12())
  142
+    #    addChart(GChartExample14())
  143
+    #    addChart(GChartExample15())
  144
+    #    addChart(GChartExample15a())
  145
+    #    addChart(GChartExample15b())
  146
+    #    addChart(GChartExample16())
  147
+    #      addChart(GChartExample17())
  148
+    #      addChart(GChartExample17a())
  149
+    #      addChart(GChartExample18())
  150
+    #      addChart(GChartExample18a())
  151
+    #      addChart(GChartExample19())
  152
+    #        addChart(GChartExample20())
  153
+    #      addChart(GChartExample20a())
  154
+    #      addChart(GChartExample21())
  155
+    #      addChart(GChartExample22())
  156
+    #      addChart(GChartExample22a())
  157
+    #      addChart(GChartExample23(False, False))
  158
+    #      addChart(GChartExample23(False, True))
  159
+    #      addChart(GChartExample23(True, False))
  160
+    #      addChart(GChartExample23(True, True))
  161
+    #addChart(GChartExample24())
  162
+    #DeferredCommand.addCommand(Command() {
  163
+    #    def execute(self):
  164
+    #        RootPanel.get().add(GChartExample25())
  165
+    #    
  166
+    #)
  167
+    #    addChart(TestGChart00())
  168
+    #    addChartNoUpdate(TestGChart01(0,0))
  169
+    #    addChartNoUpdate(TestGChart01(1,0))
  170
+    #    addChartNoUpdate(TestGChart01(2,0))
  171
+    #    addChartNoUpdate(TestGChart01(3,0))
  172
+    #    addChartNoUpdate(TestGChart01(0,1))
  173
+    #    addChartNoUpdate(TestGChart01(1,1))
  174
+    #    addChartNoUpdate(TestGChart01(2,1))
  175
+    #    addChartNoUpdate(TestGChart01(3,1))
  176
+    #    addChartNoUpdate(TestGChart01(0,2))
  177
+    #    addChartNoUpdate(TestGChart01(1,2))
  178
+    #    addChartNoUpdate(TestGChart01(2,2))
  179
+    #    addChartNoUpdate(TestGChart01(3,2))
  180
+    #    addChart(TestGChart01a())
  181
+    #    addChart(TestGChart02())
  182
+    #    addChart(TestGChart03())
  183
+    #    addChart(TestGChart04())
  184
+    #    addChart(TestGChart04a())
  185
+    #    addChart(TestGChart05(False))
  186
+    #    addChart(TestGChart05(True))
  187
+    #    addChart(TestGChart06(False))
  188
+    #    addChart(TestGChart06(True))
  189
+    #    addChart(TestGChart07(0,0,10,1))
  190
+    #    addChart(TestGChart07(10,0,10,1))
  191
+    #    addChart(TestGChart07(-10,0,10,1))
  192
+    #    addChart(TestGChart07(0,10,10,1))
  193
+    #    addChart(TestGChart07(0,-10,10,1))
  194
+    #    addChart(TestGChart07(0,0,30,1))
  195
+    #    addChart(TestGChart07(0,0,10,3))
  196
+    #    addChart(TestGChart07(0,0,10,-1))
  197
+    #    addChart(TestGChart07(0,0,10,-2))
  198
+    #    addChart(TestGChart07(0,0,10,-3))
  199
+    #    addChart(TestGChart07a())
  200
+    #    addChart(TestGChart08())
  201
+    #    addChart(TestGChart09())
  202
+    #    addChart(TestGChart10())
  203
+    #    addChart(TestGChart11())
  204
+    #    addChart(TestGChart12())
  205
+    #    addChart(TestGChart14())
  206
+    #    addChart(TestGChart14a())
  207
+    #    addChart(TestGChart14b())
  208
+    #    addChart(TestGChart14c())
  209
+    #    addChart(TestGChart14d())
  210
+    #    addChart(TestGChart15(1))
  211
+    #    addChart(TestGChart15(0))
  212
+    #    addChart(TestGChart16(0,1))
  213
+    #    addChart(TestGChart16(1,1))
  214
+    #    addChart(TestGChart16(2,1))
  215
+    #    addChart(TestGChart16(3,1))
  216
+    #    addChart(TestGChart16(4,1))
  217
+    #    addChart(TestGChart16(5,1))
  218
+    #    addChart(TestGChart16(0,10))
  219
+    #    addChart(TestGChart16(1,10))
  220
+    #    addChart(TestGChart16(2,10))
  221
+    #    addChart(TestGChart16(3,10))
  222
+    #    addChart(TestGChart16(4,10))
  223
+    #    addChart(TestGChart16(5,10))
  224
+    #    addChart(TestGChart17())
  225
+    #    addChart(TestGChart17a())
  226
+    #    addChart(TestGChart17b())
  227
+    #    addChart(TestGChart18())
  228
+    #    addChart(TestGChart19(0))
  229
+    #    addChart(TestGChart19(1))
  230
+    #    addChart(TestGChart19(2))
  231
+    #    addChart(TestGChart19(3))
  232
+    #    addChart(TestGChart20())
  233
+    #    addChart(TestGChart20a())
  234
+    #    # extra layer to stop "this script is taking too long" browser msg
  235
+    #    DeferredCommand.addCommand(Command() < void execute() <
  236
+    #    addChart(TestGChart21())
  237
+    #    addChart(TestGChart22(False))
  238
+    #    addChart(TestGChart22(True))
  239
+    #    addChart(TestGChart23(1))
  240
+    #    addChart(TestGChart23(2))
  241
+    #    addChart(TestGChart23(3))
  242
+    #    addChart(TestGChart24(1))
  243
+    #    addChart(TestGChart24(2))
  244
+    #    addChart(TestGChart25(8,1,1,1,20,20))
  245
+    #    addChart(TestGChart25(8,2,2,1,1,1))
  246
+    #    addChart(TestGChart25(8,5,5,1,0,0))
  247
+    #    addChart(TestGChart25(8,1,1,.5,10,10))
  248
+    #    addChart(TestGChart25(8,2,2,.5,10,10))
  249
+    #    addChart(TestGChart25(8,4,4,.5,10,10))
  250
+    #    addChart(TestGChart25(8,8,8,.5,10,10))
  251
+    #    addChart(TestGChart25(8,1,1,1.5,20,20))
  252
+    #    addChart(TestGChart25b(8,1,0,1.5,20,20))
  253
+    #    addChart(TestGChart25b(8,5,5,1,0,0))
  254
+    #    addChart(TestGChart26())
  255
+    #    addChart(TestGChart27())
  256
+    #    addChart(TestGChart28(False, 1, False))
  257
+    #    addChart(TestGChart28(True, 1, False))
  258
+    #    addChart(TestGChart28(False, 2, False))
  259
+    #    addChart(TestGChart28(True, 2, False))
  260
+    #    addChart(TestGChart28(False, 4, False))
  261
+    #    addChart(TestGChart28(True, 4, False))
  262
+    #
  263
+    #    addChart(TestGChart28(False, 1, True))
  264
+    #    addChart(TestGChart28(True, 1, True))
  265
+    #    addChart(TestGChart28(False, 2, True))
  266
+    #    addChart(TestGChart28(True, 2, True))
  267
+    #    addChart(TestGChart28(False, 4, True))
  268
+    ## Hover testing charts start here
  269
+    #    addChart(TestGChart28(True, 4, True))
  270
+    #    addChart(TestGChart29())
  271
+    #    addChart(TestGChart30(False, False))
  272
+    #    addChart(TestGChart30(True, False))
  273
+    #    addChart(TestGChart30(False, True))
  274
+    #    addChart(TestGChart30(True, True))
  275
+    #    addChart(TestGChart31())
  276
+    #    addChart(TestGChart32())
  277
+    ## Not a GCchart, a ScrollPanel that contains a Gchart:
  278
+    #    DeferredCommand.addCommand(Command() < void execute() <
  279
+    #      RootPanel.get().add(TestGChart33())
  280
+    #    >>)
  281
+    #     addChart(TestGChart34())
  282
+    #     addChart(TestGChart35())
  283
+    #      addChart( TestGChart36(GChart.TouchedPointUpdateOption.TOUCHED_POINT_CLEARED))
  284
+    #      addChart(TestGChart36(GChart.TouchedPointUpdateOption.TOUCHED_POINT_LOCKED))
  285
+    #      addChart(TestGChart36(GChart.TouchedPointUpdateOption.TOUCHED_POINT_UPDATED))
  286
+    #        addChart(TestGChart37(GChart.TouchedPointUpdateOption.TOUCHED_POINT_CLEARED))
  287
+    #        addChart(TestGChart37(GChart.TouchedPointUpdateOption.TOUCHED_POINT_LOCKED))
  288
+    #        addChart(TestGChart37(GChart.TouchedPointUpdateOption.TOUCHED_POINT_UPDATED))
  289
+    #        addChart(TestGChart38(GChart.TouchedPointUpdateOption.TOUCHED_POINT_CLEARED))
  290
+    #        addChart(TestGChart38(GChart.TouchedPointUpdateOption.TOUCHED_POINT_LOCKED))
  291
+    #        addChart(TestGChart38(GChart.TouchedPointUpdateOption.TOUCHED_POINT_UPDATED))
  292
+    #        addChart(TestGChart39())
  293
+    #        DeferredCommand.addCommand(Command() < void execute() <
  294
+    #            RootPanel.get().add(TestGChart41())
  295
+    #        >>)
  296
+    #        DeferredCommand.addCommand(Command() < void execute() <
  297
+    #            RootPanel.get().add(TestGChart41a())
  298
+    #        >>)
  299
+    #      addChart(TestGChart42())
  300
+    #      addChart(TestGChart43())
  301
+    #      addChart(TestGChart44())
  302
+    #        addChart(TestGChart45(0))
  303
+    #      addChart(TestGChart45(1))
  304
+    #    	addChart(TestGChart45(2))
  305
+    #      addChart(TestGChart45(3))
  306
+    #      addChart(TestGChart45(4))
  307
+    #      DeferredCommand.addCommand(Command() < void execute() <
  308
+    #      RootPanel.get().add(TestGChart46())
  309
+    #  >>)
  310
+    #      addChart(TestGChart47(0,1,5))
  311
+    #      addChart(TestGChart47(1,1,5))
  312
+    #      addChart(TestGChart47(2,1,5))
  313
+    #      addChart(TestGChart47(3,1,5))
  314
+    #      addChart(TestGChart47(4,1,5))
  315
+    #      addChart(TestGChart47(5,1,5))
  316
+    #      addChart(TestGChart47(6,1,5))
  317
+    #      addChart(TestGChart47(7,1,5))
  318
+    #      addChart(TestGChart47(0,0,2))
  319
+    #      addChart(TestGChart47(1,0,2))
  320
+    #      addChart(TestGChart47(2,0,2))
  321
+    #      addChart(TestGChart47(3,0,2))
  322
+    #      addChart(TestGChart47(4,0,2))
  323
+    #      addChart(TestGChart47(5,0,2))
  324
+    #      addChart(TestGChart47(6,0,2))
  325
+    #      addChart(TestGChart47(7,0,2))
  326
+    #      addChart(TestGChart47(0,1,3))
  327
+    #      addChart(TestGChart47(1,1,3))
  328
+    #      addChart(TestGChart47(2,1,3))
  329
+    #      addChart(TestGChart47(3,1,3))
  330
+    #      addChart(TestGChart47(4,1,3))
  331
+    #      addChart(TestGChart47(5,1,3))
  332
+    #      addChart(TestGChart47(6,1,3))
  333
+    #      addChart(TestGChart47(7,1,3))
  334
+    #      addChart(TestGChart47(8,3,5))
  335
+    #      addChart(TestGChart47(9,3,5))
  336
+    #      addChart(TestGChart48(3))
  337
+    #      addChart(TestGChart48(4))
  338
+    #      addChart(TestGChart48(5))
  339
+    #      addChart(TestGChart48(6))
  340
+    #      addChart(TestGChart48(8))
  341
+    #      addChart(TestGChart48(9))
  342
+    #      addChart(TestGChart48(10))
  343
+    #      addChart(TestGChart49(3,False, False))
  344
+    #      addChart(TestGChart49(3, False, True))
  345
+    #      addChart(TestGChart49(3,True, False))
  346
+    #      addChart(TestGChart49(3, True, True))
  347
+    #      addChart(TestGChart50(GChart.TickLocation.CENTERED,0))
  348
+    #      addChart(TestGChart50(GChart.TickLocation.INSIDE,0))
  349
+    #      addChart(TestGChart50(GChart.TickLocation.OUTSIDE,0))
  350
+    #      addChart(TestGChart50(GChart.TickLocation.CENTERED,5))
  351
+    #      addChart(TestGChart50(GChart.TickLocation.INSIDE,5))
  352
+    #      addChart(TestGChart50(GChart.TickLocation.OUTSIDE,5))
  353
+    #      addChart(TestGChart51(0))
  354
+    #      addChart(TestGChart51(1))
  355
+    #      addChart(TestGChart52())
  356
+    #      addChart(TestGChart53())
  357
+    #    >>)
  358
+    #    addChart(TestGChart54())
  359
+    #  DeferredCommand.addCommand(Command() < void execute() <
  360
+    #      RootPanel.get().add(TestGChart55())
  361
+    #  >>)
  362
+    #  DeferredCommand.addCommand(Command() < void execute() <
  363
+    #      RootPanel.get().add(TestGChart55a())
  364
+    #  >>)
  365
+    #  addChart(TestGChart56())
  366
+    #
  367
+    #addChart(TestGChart57())
  368
+    #RootPanel.get().add(TestGChart57a())
  369
+    #RootPanel.get().add(TestGChart58())
  370
+
  371
+    addChart(TestGChart00())
  372
+    
  373
+    RootPanel.get("loadingMessage").setVisible(False)
  374
+    
  375
+    
  376
+    
  377
+    
  378
+
  379
+pyjd.setup("./public/GChartTestApp.html")
  380
+onModuleLoad()
  381
+pyjd.run()
52  examples/gcharttestapp/GChartTestAppUtil.py
... ...
@@ -0,0 +1,52 @@
  1
+import pyjd
  2
+
  3
+"""*
  4
+*
  5
+* Displays the test  chart in the browser, and checks the HTML
  6
+* generated against previous, visually validated, browser
  7
+* output HTML hash codes to see if HTML output from the test
  8
+* has changed (possibly due to an error).
  9
+*
  10
+* As long as GChart and the test set itself has not changed,
  11
+* these tests can be performed by first running in hosted
  12
+* mode, then clicking on the "Compile/Browse" button. If
  13
+* "Test passed" is displayed in hosted mode and also in
  14
+* Firefox after the compile (this assumes Firefox is your default browser)
  15
+* it means that the generated HTML has not changed since
  16
+* the last time it was visually inspected--test passed.
  17
+*
  18
+* If the test or GChart changes so as to change browser output,
  19
+* you will have to visually verify the charts, and then (assuming the
  20
+* charts are correct) enter the hashcodes.
  21
+*
  22
+* In the most common case where the test and output are unchanged,
  23
+* the test should go through very quickly.
  24
+*
  25
+"""
  26
+    
  27
+# convenience method to create a short, class-name-based title
  28
+def getTitle(self, obj):
  29
+    result = obj.getClass().getName()
  30
+    result = result[:result.rfind(".")+1]
  31
+    return "<h4><br>" + result + "</h4>"
  32
+
  33
+
  34
+""" Linear congruent random number generator.
  35
+*
  36
+* Cannot use GWT's Math.random() because, for automated
  37
+* testing, we require that the exact same random sequence
  38
+* be used each time (GWT does not support the JDK's more
  39
+* generic Random class, which would have allowed this).
  40
+*
  41
+* Constants are from Knuth via Numerical Recipes in C.
  42
+*
  43
+"""
  44
+i = 0
  45
+def rnd(self):
  46
+    m = 217728
  47
+    a = 84589
  48
+    c = 45989
  49
+    i = (a*i + c) % m
  50
+    return i/m
  51
+
  52
+
29  examples/gcharttestapp/public/.svn/all-wcprops
... ...
@@ -0,0 +1,29 @@
  1
+K 25
  2
+svn:wc:ra_dav:version-url
  3
+V 84
  4
+/svn/!svn/ver/235/trunk/gcharttestapp/src/com/googlecode/gchart/gcharttestapp/public
  5
+END
  6
+gcharttestapp.css
  7
+K 25
  8
+svn:wc:ra_dav:version-url
  9
+V 102
  10
+/svn/!svn/ver/195/trunk/gcharttestapp/src/com/googlecode/gchart/gcharttestapp/public/gcharttestapp.css
  11
+END
  12
+alternating-black-white-row.gif
  13
+K 25
  14
+svn:wc:ra_dav:version-url
  15
+V 116
  16
+/svn/!svn/ver/235/trunk/gcharttestapp/src/com/googlecode/gchart/gcharttestapp/public/alternating-black-white-row.gif
  17
+END
  18
+GChartTestApp.html
  19
+K 25
  20
+svn:wc:ra_dav:version-url
  21
+V 103
  22
+/svn/!svn/ver/233/trunk/gcharttestapp/src/com/googlecode/gchart/gcharttestapp/public/GChartTestApp.html
  23
+END
  24
+red.gif
  25
+K 25
  26
+svn:wc:ra_dav:version-url
  27
+V 91
  28
+/svn/!svn/ver/77/trunk/gcharttestapp/src/com/googlecode/gchart/gcharttestapp/public/red.gif
  29
+END
18  examples/gcharttestapp/public/.svn/dir-prop-base
... ...
@@ -0,0 +1,18 @@
  1
+K 10
  2
+svn:ignore
  3
+V 95
  4
+.gwt-cache
  5
+tomcat
  6
+www
  7
+*.jardesc
  8
+*.zip
  9
+*.jar
  10
+bin
  11
+.
  12
+gwt
  13
+.svn
  14
+.metadata
  15
+.externalToolBuilders
  16
+bin
  17
+
  18
+END
164  examples/gcharttestapp/public/.svn/entries
... ...
@@ -0,0 +1,164 @@
  1
+10
  2
+
  3
+dir
  4
+265
  5
+http://gchart.googlecode.com/svn/trunk/gcharttestapp/src/com/googlecode/gchart/gcharttestapp/public
  6
+http://gchart.googlecode.com/svn
  7
+
  8
+
  9
+
  10
+2009-06-26T03:51:19.733795Z
  11
+235
  12
+johncurtisgunther
  13
+has-props
  14
+
  15
+
  16
+
  17
+
  18
+
  19
+
  20
+
  21
+
  22
+
  23
+
  24
+
  25
+
  26
+
  27
+b14cb85a-523c-0410-a92e-510c53a610b1
  28
+
  29
+gcharttestapp.css
  30
+file
  31
+
  32
+
  33
+
  34
+
  35
+2009-08-26T21:12:02.000000Z
  36
+595c2ec0bc6a410aa28e8d0d46d9a153
  37
+2009-01-07T05:43:59.117842Z
  38
+195
  39
+johncurtisgunther
  40
+
  41
+
  42
+
  43
+
  44
+
  45
+
  46
+
  47
+
  48
+
  49
+
  50
+
  51
+
  52
+
  53
+
  54
+
  55
+
  56
+
  57
+
  58
+
  59
+
  60
+
  61
+2316
  62
+
  63
+alternating-black-white-row.gif
  64
+file
  65
+
  66
+
  67
+
  68
+
  69
+2009-08-26T21:12:02.000000Z
  70
+39ab7f5169428c1901b35c3374c5b733
  71
+2009-06-26T03:51:19.733795Z
  72
+235
  73
+johncurtisgunther
  74
+has-props
  75
+
  76
+
  77
+
  78
+
  79
+
  80
+
  81
+
  82
+
  83
+
  84
+
  85
+
  86
+
  87
+
  88
+
  89
+
  90
+
  91
+
  92
+
  93
+
  94
+
  95
+845
  96
+
  97
+GChartTestApp.html
  98
+file
  99
+
  100
+
  101
+
  102
+
  103
+2009-08-26T21:12:02.000000Z
  104
+8b2f1eef2c55b02fcbfaf7a08ffc54d9
  105
+2009-06-06T05:12:46.342443Z
  106
+233
  107
+johncurtisgunther
  108
+
  109
+
  110
+
  111
+
  112
+
  113
+
  114
+
  115
+
  116
+
  117
+
  118
+
  119
+
  120
+
  121
+
  122
+
  123
+
  124
+
  125
+
  126
+
  127
+
  128
+
  129
+933
  130
+
  131
+red.gif
  132
+file
  133
+
  134
+
  135
+
  136
+
  137
+2009-08-26T21:12:02.000000Z
  138
+9ac8a7cf4bef3fe598f728bb4569a567
  139
+2008-04-10T15:43:01.651991Z
  140
+77
  141
+johncurtisgunther
  142
+has-props
  143
+
  144
+
  145
+
  146
+
  147
+
  148
+
  149
+
  150
+
  151
+
  152
+
  153
+
  154
+
  155
+
  156
+
  157
+
  158
+
  159
+
  160
+
  161
+
  162
+
  163
+78
  164
+
5  examples/gcharttestapp/public/.svn/prop-base/alternating-black-white-row.gif.svn-base
... ...
@@ -0,0 +1,5 @@
  1
+K 13
  2
+svn:mime-type
  3
+V 24
  4
+application/octet-stream
  5
+END
5  examples/gcharttestapp/public/.svn/prop-base/red.gif.svn-base
... ...
@@ -0,0 +1,5 @@
  1
+K 13
  2
+svn:mime-type
  3
+V 24
  4
+application/octet-stream
  5
+END
39  examples/gcharttestapp/public/.svn/text-base/GChartTestApp.html.svn-base
... ...
@@ -0,0 +1,39 @@
  1
+<html>
  2
+	<head>	
  3
+		<title>GChartTestApp - The GChart Paint Test</title>
  4
+		<script language='javascript' src='com.googlecode.gchart.gcharttestapp.GChartTestApp.nocache.js'></script>
  5
+   <style>
  6
+         body {
  7
+            background-color: white;
  8
+            color: black;
  9
+            margin: 20px;
  10
+            font-family: Arial, sans-serif;
  11
+         }
  12
+      </style>
  13
+	</head>
  14
+	<body>
  15
+
  16
+<div id="loadingMessage">
  17
+<h1>
  18
+It takes a few seconds to initialize the over 200 charts of the
  19
+Client-side GChart paint test...
  20
+<p>
  21
+<small><i>Note:</i> Because
  22
+this test page is jam-packed with charts, performance
  23
+is greatly degraded; the live demo page gives a better sense of
  24
+performance on a more realistically sized page.<p>
  25
+</small>
  26
+
  27
+</h1>
  28
+</div> 
  29
+
  30
+<div id="testappcharts"></div>
  31
+
  32
+
  33
+
  34
+
  35
+
  36
+
  37
+      <iframe src="javascript:''" id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
  38
+	</body>
  39
+</html>
BIN  examples/gcharttestapp/public/.svn/text-base/alternating-black-white-row.gif.svn-base
Binary file not shown
94  examples/gcharttestapp/public/.svn/text-base/gcharttestapp.css.svn-base
... ...
@@ -0,0 +1,94 @@
  1
+/* stylesheet used to test GChart's style-related features */
  2
+
  3
+
  4
+/* styles attached to default stylename (pasted from javadoc example)*/
  5
+
  6
+.gchart-GChart {
  7
+   background-color: white;   /* setBackgroundColor("white"); */
  8
+   border-width: 1px;         /* setBorderWidth("1px"); */
  9
+   border-color: black;       /* setBorderColor("black"); */ 
  10
+   border-style: solid;       /* setBorderStyle("solid");  */ 
  11
+   font-family: Arial, sans-serif;  /* setFontFamily("Arial, sans-serif"); */
  12
+ }
  13
+
  14
+/* alternate stylename used only by TestGChart19.java */
  15
+.gcharttestapp-TestGChart19 {
  16
+   background-color: yellow;   
  17
+   border-width: 50px;         
  18
+   border-color: red;       
  19
+   border-style: dotted;    
  20
+   font-family: monospace;  
  21
+}
  22
+
  23
+
  24
+/* stylename used only by GChartExample18.java */
  25
+.gchartestapp-GChartExample19-CurveEditingForm {
  26
+   background-color: #DDF;   
  27
+   border-width: 10px;         
  28
+   border-color: black;       
  29
+   border-style: solid;
  30
+   border-width: 1px;    
  31
+   padding: 10px;
  32
+}
  33
+
  34
+/* All CSS styles below were copied from the GWT "Showcase of    
  35
+   Features", and then chopped down significantly. <p>
  36
+ 
  37
+   You may want to go back to that original source for guidance if      
  38
+   something isn't working for you, on, say, IE6, or 
  39
+   if you just need a better looking widget. I just didn't want to 
  40
+   pull, say, 5 pages of DialogBox CSS replete with "html *" hacks
  41
+   and all the trimmings, into what is supposed to be a 
  42
+   GChart example.
  43
+
  44
+*/
  45
+
  46
+
  47
+.gwt-MenuBar .gwt-MenuItem-selected {
  48
+  background: #AAA;
  49
+}
  50
+
  51
+.gwt-MenuBar-vertical {
  52
+  margin-top: 0px;
  53
+  margin-left: 0px;
  54
+  background: #EEF;
  55
+}
  56
+
  57
+.gwt-SuggestBox {
  58
+  padding: 2px;
  59
+}
  60
+
  61
+.gwt-SuggestBoxPopup {
  62
+  margin-left: 3px;
  63
+}
  64
+
  65
+.gwt-SuggestBoxPopup .item {
  66
+  padding: 2px 6px;
  67
+  color: #424242;
  68
+  cursor: default;
  69
+}
  70
+
  71
+.gwt-SuggestBoxPopup .item-selected {
  72
+  background: #b7d6f6;
  73
+}
  74
+
  75
+.gwt-SuggestBoxPopup .suggestPopupContent {
  76
+  background: white;
  77
+}
  78
+
  79
+.gwt-DialogBox .Caption {
  80
+  font-size: 18;
  81
+  color: #eef;
  82
+  background: #00f repeat-x 0px -2003px;
  83
+  padding: 4px 4px 4px 8px;
  84
+  cursor: default;
  85
+  border-bottom: 2px solid #008;
  86
+  border-top: 3px solid #448;
  87
+}
  88
+
  89
+.gwt-DialogBox .dialogContent {
  90
+  border: 1px solid #008;
  91
+  background: #ddd;  
  92
+  padding: 3px;   
  93
+}
  94
+
BIN  examples/gcharttestapp/public/.svn/text-base/red.gif.svn-base
Binary file not shown
40  examples/gcharttestapp/public/GChartTestApp.html
... ...
@@ -0,0 +1,40 @@
  1
+<html>
  2
+	<head>	
  3
+        <meta name="pygwt:module" content="GChartTestApp">
  4
+		<title>GChartTestApp - The GChart Paint Test</title>
  5
+		<script language='javascript' src='bootstrap.js'></script>
  6
+   <style>
  7
+         body {
  8
+            background-color: white;
  9
+            color: black;
  10
+            margin: 20px;
  11
+            font-family: Arial, sans-serif;
  12
+         }
  13
+      </style>
  14
+	</head>
  15
+	<body>
  16
+
  17
+<div id="loadingMessage">
  18
+<h1>
  19
+It takes a few seconds to initialize the over 200 charts of the
  20
+Client-side GChart paint test...
  21
+<p>
  22
+<small><i>Note:</i> Because
  23
+this test page is jam-packed with charts, performance
  24
+is greatly degraded; the live demo page gives a better sense of
  25
+performance on a more realistically sized page.<p>
  26
+</small>
  27
+
  28
+</h1>
  29
+</div> 
  30
+
  31
+<div id="testappcharts"></div>
  32
+
  33
+
  34
+
  35
+
  36
+
  37
+
  38
+      <iframe src="javascript:''" id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
  39
+	</body>
  40
+</html>
BIN  examples/gcharttestapp/public/alternating-black-white-row.gif
94  examples/gcharttestapp/public/gcharttestapp.css
... ...
@@ -0,0 +1,94 @@
  1
+/* stylesheet used to test GChart's style-related features */
  2
+
  3
+
  4
+/* styles attached to default stylename (pasted from javadoc example)*/
  5
+
  6
+.gchart-GChart {
  7
+   background-color: white;   /* setBackgroundColor("white"); */
  8
+   border-width: 1px;         /* setBorderWidth("1px"); */
  9
+   border-color: black;       /* setBorderColor("black"); */ 
  10
+   border-style: solid;       /* setBorderStyle("solid");  */ 
  11
+   font-family: Arial, sans-serif;  /* setFontFamily("Arial, sans-serif"); */
  12
+ }
  13
+
  14
+/* alternate stylename used only by TestGChart19.java */
  15
+.gcharttestapp-TestGChart19 {
  16
+   background-color: yellow;   
  17
+   border-width: 50px;         
  18
+   border-color: red;       
  19
+   border-style: dotted;    
  20
+   font-family: monospace;  
  21
+}
  22
+
  23
+
  24
+/* stylename used only by GChartExample18.java */
  25
+.gchartestapp-GChartExample19-CurveEditingForm {
  26
+   background-color: #DDF;   
  27
+   border-width: 10px;         
  28
+   border-color: black;       
  29
+   border-style: solid;
  30
+   border-width: 1px;    
  31
+   padding: 10px;
  32
+}
  33
+
  34
+/* All CSS styles below were copied from the GWT "Showcase of    
  35
+   Features", and then chopped down significantly. <p>
  36
+ 
  37
+   You may want to go back to that original source for guidance if      
  38
+   something isn't working for you, on, say, IE6, or 
  39
+   if you just need a better looking widget. I just didn't want to 
  40
+   pull, say, 5 pages of DialogBox CSS replete with "html *" hacks
  41
+   and all the trimmings, into what is supposed to be a 
  42
+   GChart example.
  43
+
  44
+*/
  45
+
  46
+
  47
+.gwt-MenuBar .gwt-MenuItem-selected {
  48
+  background: #AAA;
  49
+}
  50
+
  51
+.gwt-MenuBar-vertical {
  52
+  margin-top: 0px;
  53
+  margin-left: 0px;
  54
+  background: #EEF;
  55
+}
  56
+
  57
+.gwt-SuggestBox {
  58
+  padding: 2px;
  59
+}
  60
+
  61
+.gwt-SuggestBoxPopup {
  62
+  margin-left: 3px;
  63
+}
  64
+
  65
+.gwt-SuggestBoxPopup .item {
  66
+  padding: 2px 6px;
  67
+  color: #424242;
  68
+  cursor: default;
  69
+}
  70
+
  71
+.gwt-SuggestBoxPopup .item-selected {
  72
+  background: #b7d6f6;
  73
+}
  74
+
  75
+.gwt-SuggestBoxPopup .suggestPopupContent {
  76
+  background: white;
  77
+}
  78
+
  79
+.gwt-DialogBox .Caption {
  80
+  font-size: 18;
  81
+  color: #eef;
  82
+  background: #00f repeat-x 0px -2003px;
  83
+  padding: 4px 4px 4px 8px;
  84
+  cursor: default;
  85
+  border-bottom: 2px solid #008;
  86
+  border-top: 3px solid #448;
  87
+}
  88
+
  89
+.gwt-DialogBox .dialogContent {
  90
+  border: 1px solid #008;
  91
+  background: #ddd;  
  92
+  padding: 3px;   
  93
+}
  94
+
BIN  examples/gcharttestapp/public/red.gif
6  library/pyjamas/chart/Annotation.py
@@ -49,14 +49,14 @@
49 49
 
50 50
 
51 51
 
52  
-from pyjamas import Event
  52
+from pyjamas.ui import Event
53 53
 from pyjamas.ui.AbsolutePanel import AbsolutePanel
54 54
 from pyjamas.ui.Composite import Composite
55 55
 from pyjamas.ui.Grid import Grid
56 56
 from pyjamas.ui.HasHTML import HasHTML
57  
-from pyjamas.ui.HasHorizontalAlignment import HasHorizontalAlignment
  57
+from pyjamas.ui import HasHorizontalAlignment
58 58
 from pyjamas.ui.HasText import HasText
59  
-from pyjamas.ui.HasVerticalAlignment import HasVerticalAlignment
  59
+from pyjamas.ui import HasVerticalAlignment
60 60
 from pyjamas.ui.HTML import HTML
61 61
 from pyjamas.ui.Image import Image
62 62
 from pyjamas.ui.SimplePanel import SimplePanel
8  library/pyjamas/chart/AnnotationLocation.py
@@ -49,14 +49,12 @@
49 49
 
50 50
 
51 51
 
52  
-from pyjamas import Event
  52
+from pyjamas.ui import Event
53 53
 from pyjamas.ui.AbsolutePanel import AbsolutePanel
54 54
 from pyjamas.ui.Composite import Composite
55 55
 from pyjamas.ui.Grid import Grid
56  
-from pyjamas.ui.HasHTML import HasHTML
57  
-from pyjamas.ui.HasHorizontalAlignment import HasHorizontalAlignment
58  
-from pyjamas.ui.HasText import HasText
59  
-from pyjamas.ui.HasVerticalAlignment import HasVerticalAlignment
  56
+from pyjamas.ui import HasHorizontalAlignment
  57
+from pyjamas.ui import HasVerticalAlignment
60 58
 from pyjamas.ui.HTML import HTML
61 59
 from pyjamas.ui.Image import Image
62 60
 from pyjamas.ui.SimplePanel import SimplePanel
17  library/pyjamas/chart/Axis.py
@@ -49,14 +49,12 @@
49 49
 
50 50
 
51 51
 
52  
-from pyjamas import Event
  52
+from pyjamas.ui import Event
53 53
 from pyjamas.ui.AbsolutePanel import AbsolutePanel
54 54
 from pyjamas.ui.Composite import Composite
55 55
 from pyjamas.ui.Grid import Grid
56  
-from pyjamas.ui.HasHTML import HasHTML
57  
-from pyjamas.ui.HasHorizontalAlignment import HasHorizontalAlignment
58  
-from pyjamas.ui.HasText import HasText
59  
-from pyjamas.ui.HasVerticalAlignment import HasVerticalAlignment
  56
+from pyjamas.ui import HasHorizontalAlignment
  57
+from pyjamas.ui import HasVerticalAlignment
60 58
 from pyjamas.ui.HTML import HTML
61 59
 from pyjamas.ui.Image import Image
62 60
 from pyjamas.ui.SimplePanel import SimplePanel
@@ -505,15 +503,14 @@ def getAxisLabelThickness(self):
505 503
         elif GChart.NAI != axisLabelThickness:
506 504
             result = axisLabelThickness
507 505
 
508  
-        elif isinstance(getAxisLabel(), HasHTML):
509  
-            charWidth = htmlWidth(
510  
-                    ((HasHTML) (getAxisLabel())).getHTML())
  506
+        elif hasattr(getAxisLabel(), 'getHTML'):
  507
+            charWidth = htmlWidth( getAxisLabel().getHTML())
511 508
             result = int ( Math.round((charWidth + EXTRA_CHARWIDTH) *
512 509
                             getTickLabelFontSize() *
513 510
                             TICK_CHARWIDTH_TO_FONTSIZE_LOWERBOUND))
514 511
 
515  
-        elif isinstance(getAxisLabel(), HasText):
516  
-            text = ((HasText) (getAxisLabel())).getText()
  512
+        elif hasattr(getAxisLabel(), "getText"):
  513
+            text = getAxisLabel().getText()
517 514
             result = int (Math.round((EXTRA_CHARWIDTH +
518 515
                             (text and len(text) or 0)) *
519 516
                             getTickLabelFontSize() *
8  library/pyjamas/chart/Curve.py
@@ -49,14 +49,12 @@
49 49
 
50 50
 
51 51
 
52  
-from pyjamas import Event
  52
+from pyjamas.ui import Event
53 53
 from pyjamas.ui.AbsolutePanel import AbsolutePanel
54 54
 from pyjamas.ui.Composite import Composite
55 55
 from pyjamas.ui.Grid import Grid
56  
-from pyjamas.ui.HasHTML import HasHTML
57  
-from pyjamas.ui.HasHorizontalAlignment import HasHorizontalAlignment
58  
-from pyjamas.ui.HasText import HasText
59  
-from pyjamas.ui.HasVerticalAlignment import HasVerticalAlignment
  56
+from pyjamas.ui import HasHorizontalAlignment
  57
+from pyjamas.ui import HasVerticalAlignment
60 58
 from pyjamas.ui.HTML import HTML
61 59
 from pyjamas.ui.Image import Image
62 60
 from pyjamas.ui.SimplePanel import SimplePanel
18  library/pyjamas/chart/GChart.py
@@ -49,14 +49,12 @@
49 49
 
50 50
 
51 51
 
52  
-from pyjamas import Event
  52
+from pyjamas.ui import Event
53 53
 from pyjamas.ui.AbsolutePanel import AbsolutePanel
54 54
 from pyjamas.ui.Composite import Composite
55 55
 from pyjamas.ui.Grid import Grid
56  
-from pyjamas.ui.HasHTML import HasHTML
57  
-from pyjamas.ui.HasHorizontalAlignment import HasHorizontalAlignment
58  
-from pyjamas.ui.HasText import HasText
59  
-from pyjamas.ui.HasVerticalAlignment import HasVerticalAlignment
  56
+from pyjamas.ui import HasHorizontalAlignment
  57
+from pyjamas.ui import HasVerticalAlignment
60 58
 from pyjamas.ui.HTML import HTML
61 59
 from pyjamas.ui.Image import Image
62 60
 from pyjamas.ui.SimplePanel import SimplePanel
@@ -1073,7 +1071,7 @@ def htmlWidth(self, sIn):
1073 1071
 
1074 1072
 # number of <br> delimited lines in an HTML string
1075 1073
 def htmlHeight(self, s):
1076  
-    BR_LEN = "<br>".length()
  1074
+    BR_LEN = len("<br>")
1077 1075
     iBr = 0
1078 1076
     result = 1
1079 1077
     if None != s:
@@ -2034,9 +2032,9 @@ def getChartFootnotesThickness(self):
2034 2032
         elif GChart.NAI != self.footnotesThickness:
2035