-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathBBjGridExWidget.bbj
4298 lines (4200 loc) · 156 KB
/
BBjGridExWidget.bbj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
rem /**
rem * The package exports a few helper classes along with the BBjGridExWidget class which is the entry point of the plugin. Most of the time you only need to use the BBjGridExWidget class from it
rem */
rem package BBjGridExWidget
rem /**
rem * This file is part of the BBjGridExWidget plugin.
rem * (c) Basis Europe <[email protected]>
rem *
rem * For the full copyright and license information, please view the LICENSE
rem * file that was distributed with this source code.
rem */
use java.util.Arrays
use java.util.ArrayList
use java.util.HashSet
use java.util.LinkedHashMap
use java.util.UUID
use java.lang.StringBuilder
use java.sql.Types
use com.google.gson.Gson
use com.google.gson.JsonParser
use com.google.gson.JsonObject
use com.google.gson.JsonArray
use com.google.gson.JsonPrimitive
use java.security.MessageDigest
use java.io.File
rem Basis Components
rem ==========================
use com.basiscomponents.db.ResultSet
use com.basiscomponents.db.DataRow
rem BBjWidget
rem ==========================
use ::BBjWidget/BBjWidget.bbj::BBjWidget
rem BBjGridExWidget Package
rem ==========================
use ::BBjGridExWidget/GxOptions.bbj::GxOptions
use ::BBjGridExWidget/util/LicenseManager.bbj::LicenseManager
use ::BBjGridExWidget/GxExecutor.bbj::GxExecutor
use ::BBjGridExWidget/GxState.bbj::GxState
use ::BBjGridExWidget/GxLanguageManager.bbj::GxLanguageManager
use ::BBjGridExWidget/GxClientJsonFactory.bbj::GxClientJsonFactory
use ::BBjGridExWidget/GxLogger.bbj::GxLogger
rem Client Events
rem ==========================
use ::BBjGridExWidget/GxClientEvents.bbj::GxClientEventsRowSelection
use ::BBjGridExWidget/GxClientEvents.bbj::GxClientEventsContextMenu
use ::BBjGridExWidget/GxClientEvents.bbj::GxClientEventsCell
use ::BBjGridExWidget/GxClientEvents.bbj::GxClientEventsRowEditing
use ::BBjGridExWidget/GxClientEvents.bbj::GxClientEventsRangeSelection
use ::BBjGridExWidget/GxClientEvents.bbj::GxClientEventsKeypress
rem Sidebars
rem ==========================
use ::BBjGridExWidget/GxSidebar.bbj::GxSidebar
use ::BBjGridExWidget/GxSidebar.bbj::GxDefaultSidebar
use ::BBjGridExWidget/GxSidebar.bbj::GxFiltersToolpanel
rem Statusbar
rem ==========================
use ::BBjGridExWidget/GxStatusBar.bbj::GxStatusBar
rem Context Menu
rem ==========================
use ::BBjGridExWidget/GxContextMenu.bbj::GxContextMenu
use ::BBjGridExWidget/GxContextMenu.bbj::GxDefaultContextMenu
rem Expressions
rem ==========================
use ::BBjGridExWidget/GxExpressions.bbj::GxExpressionInterface
use ::BBjGridExWidget/GxExpressions.bbj::GxExpression
rem Columns
rem ==========================
use ::BBjGridExWidget/GxColumns.bbj::GxDefaultColumnDefinition
use ::BBjGridExWidget/GxColumns.bbj::GxAutoGroupColumn
use ::BBjGridExWidget/GxColumns.bbj::GxColumn
use ::BBjGridExWidget/GxColumns.bbj::GxDefaultColumnGroup
use ::BBjGridExWidget/GxColumns.bbj::GxColumnGroup
use ::BBjGridExWidget/GxColumns.bbj::GxColumnsManagerInterface
use ::BBjGridExWidget/GxColumns.bbj::GxColumnsManager
rem Renderers
rem ==========================
use ::BBjGridExWidget/GxRenderers.bbj::GxRendererImageRenderer
rem Client Models
rem ==========================
use ::BBjGridExWidget/GxClientModels.bbj::GxClientRowModel
use ::BBjGridExWidget/GxClientModels.bbj::GxClientAddRangeSelectionModel
use ::BBjGridExWidget/GxClientModels.bbj::GxClientAddRangeChartModel
use ::BBjGridExWidget/GxClientModels.bbj::GxClientSortModel
use ::BBjGridExWidget/GxClientModels.bbj::GxClientTransactionModel
use ::BBjGridExWidget/GxClientModels.bbj::GxClientFilterModel
use ::BBjGridExWidget/GxClientModels.bbj::GxClientFilterNumberModel
use ::BBjGridExWidget/GxClientModels.bbj::GxClientFilterTextModel
use ::BBjGridExWidget/GxClientModels.bbj::GxClientFilterDateTimeModel
use ::BBjGridExWidget/GxClientModels.bbj::GxClientFilterBooleanModel
use ::BBjGridExWidget/GxClientModels.bbj::GxClientFilterCombinedModel
use ::BBjGridExWidget/GxClientModels.bbj::GxClientFilterSetFilterModel
rem Filter Components
rem ==========================
use ::BBjGridExWidget/GxFilters.bbj::GxFilterText
use ::BBjGridExWidget/GxFilters.bbj::GxFilterNumber
use ::BBjGridExWidget/GxFilters.bbj::GxFilterBasicBoolean
use ::BBjGridExWidget/GxFilters.bbj::GxFilterBasicTimestamp
use ::BBjGridExWidget/GxFilters.bbj::GxFilterSetFilter
rem /**
rem * The Grid Core Class.This class works as a columns manager and api provider.
rem * It contains a big number of methods and properties to configure the column from A..Z.
rem * Every property and method has one or more tag attached.
rem *
rem * The following is the meaning for each tag :<br><br>
rem *
rem *
rem * <table border="1" cellpadding="10">
rem * <tbody>
rem * <tr>
rem * <td><strong> Enterprise</strong></td>
rem * <td>The property/method is used only with the enterprise version. using it without having a valid license will<br />be ignored.</td>
rem * </tr>
rem * <tr>
rem * <td> <strong>Configuration</strong></td>
rem * <td>Properties and methods which are tagged with this tag are used to configure the grid before it is rendered on the client.<br />Changing these properties or calling these methods won't affect the grid which is displayed on the client.<br />In order to reflect your changes on the client, you need to re-render the whole grid <br />or re-render the column definition once again.</td>
rem * </tr>
rem * <tr>
rem * <td> <strong>API</strong></td>
rem * <td>Methods/properties tagged with this tag can be called before or after the grid is rendered on the client and they don't require a refresh.</td>
rem * </tr>
rem * <tr>
rem * <td><strong> ColumnsRenderer</strong></td>
rem * <td>Changing this property or calling this method after the first render require columns re-render using <i>updateColumns()</i> method</td>
rem * </tr>
rem * <tr>
rem * <td><strong> GridRenderer</strong></td>
rem * <td>Changing this property or calling this method after the first render require full re-render using <i>render()</i> method</td>
rem * </tr>
rem * </tbody>
rem * </table>
rem *
rem * @author Stephan Wald
rem * @author Hyyan Abo Fakher
rem */
class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterface
rem /**
rem * The Grid enterprise key
rem */
field public static BBjString LicenseKey$
rem /**
rem * When true, the grid will force using the community version of the grid whether there
rem * is a license key or not.
rem */
field public static BBjNumber ForceCommunityBuild! = 0
rem /**
rem * When true the grid will use the unmingled version of the Javascript code then open the debugger
rem * in a new window.
rem */
field public static BBjNumber Debug! = 0
rem /**
rem * The unique string to use as row index. default is __ROW_INDEX
rem */
field public BBjString RowNodeId$ = "__ROW_INDEX"
rem /**
rem * The ResultSet instance
rem */
field public ResultSet RS! = new ResultSet()
rem /**
rem * Columns Manager instance
rem */
field public GxColumnsManager ColumnsManager! = new GxColumnsManager()
rem /**
rem * Instance of the grid options class
rem */
field public GxOptions Options! = new GxOptions(#this!)
rem /**
rem * Instance of he scripts executor
rem */
field public GxExecutor Executor! = new GxExecutor(#this!, 250)
rem /**
rem * Instance of the created HTMLView
rem */
field public BBjHtmlView HTMLView!
rem /**
rem * A flag which defines when the grid is ready and the process events started
rem */
field public Boolean IsReady! = BBjAPI.FALSE
rem /**
rem * Instance of GxClientJsonFactory to convert client JSON strings to Client Models
rem */
field protected GxClientJsonFactory ClientJsonFactory! = new GxClientJsonFactory(#this!)
rem /**
rem * The vector holds the registered events
rem */
field protected JsonArray Interests! = new JsonArray()
rem /**
rem * An array which contains the supported toolbar items
rem */
field protected JsonArray ChartToolbarItems! = new JsonArray()
rem /**
rem * The client's HTML template to use in order to build the grid.
rem */
field protected BBjString Template$ = ""
rem /**
rem * Instance of the grid's license manager
rem */
field protected static LicenseManager LicenseManager! = new LicenseManager()
rem /**
rem * A boolean which indicates whether the grid has its first renderer
rem */
field protected Boolean IsFirstRender! = BBjAPI.TRUE
rem /**
rem * Unique auto-generated id for the grid instance.
rem * This id is used in the client to distinguish instances
rem */
field protected BBjString RootId!
rem /**
rem * Number of initiated instances per session
rem */
field protected static BBjNumber InstanceCount! = 0
field protected BBjNumber newW!
field protected BBjNumber newH!
field private static BBjNumber AssetsCopied! = 0
field private static BBjString AssestsPath! = null()
field private static BBjNumber FullyLoaded! = 0
rem /**
rem * A Constant value to define row selection (selected/deselected) change events
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_SELECT_ROW()
methodret BBjAPI.ON_GRID_SELECT_ROW
methodend
rem /**
rem * Alias for ON_GRID_SELECT_ROW
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_ROW_SELECT()
methodret #ON_GRID_SELECT_ROW()
methodend
rem /**
rem * Constant value to define row double-click event
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_ROW_DOUBLE_CLICK()
methodret BBjAPI.ON_GRID_DOUBLE_CLICK
methodend
rem /**
rem * Alias to <i>ON_GRID_ROW_DOUBLE_CLICK()</i>
rem *
rem * @see ON_GRID_ROW_DOUBLE_CLICK()
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_DOUBLE_CLICK()
methodret #ON_GRID_ROW_DOUBLE_CLICK()
methodend
rem /**
rem * Constant value to define cell click event
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_CELL_CLICK()
methodret 5001
methodend
rem /**
rem * Constant value to define cell double-click event
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_CELL_DOUBLE_CLICK()
methodret 5002
methodend
rem /**
rem * Constant value to define cell editing start event
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_CELL_EDITING_STARTED()
methodret 5003
methodend
rem /**
rem * Constant value to define cell editing stop event
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_CELL_EDITING_STOPPED()
methodret 5004
methodend
rem /**
rem * Constant value to define cell value changed event
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_CELL_VALUE_CHANGED()
methodret 5005
methodend
rem /**
rem * Constant value to define row editing start event
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_ROW_EDITING_STARTED()
methodret 5006
methodend
rem /**
rem * Constant value to define row editing stop event
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_ROW_EDITING_STOPPED()
methodret 5007
methodend
rem /**
rem * Constant value to define grid state changes
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_STATE_CHANGE()
methodret 5008
methodend
rem /**
rem * Constant value to define range selection event
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_RANGE_SELECTION_CHANGED()
methodret 5009
methodend
rem /**
rem * Constant value to define keyboard keypress
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_KEYPRESS()
methodret 5010
methodend
rem /**
rem * Constant value to define row click events
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_ROW_CLICK()
methodret 5011
methodend
rem /**
rem * Constant value to define A row has changed.
rem * This event corresponds to Full Row Editing only.
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_ROW_VALUE_CHANGED()
methodret 5012
methodend
rem /**
rem * Constant value to define A filter changed event.
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_FILTER_CHANGED()
methodret 5013
methodend
rem /**
rem * Constant value to define the grid ready event.
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_READY()
methodret 5014
methodend
rem /**
rem * Alias for <i>ON_GRID_STATE_CHANGE()</i>
rem *
rem * @see ON_GRID_STATE_CHANGE()
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber ON_GRID_COLUMN_STATE_CHANGE()
methodret #ON_GRID_STATE_CHANGE()
methodend
rem /**
rem * Constant value to define left aligned column
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber GRID_ALIGN_LEFT()
methodret BBjGrid.GRID_ALIGN_LEFT
methodend
rem /**
rem * Constant value to define right aligned column
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber GRID_ALIGN_RIGHT()
methodret BBjGrid.GRID_ALIGN_RIGHT
methodend
rem /**
rem * Constant value to define centered column
rem *
rem * @return BBjNumber
rem */
method public static BBjNumber GRID_ALIGN_CENTER()
methodret BBjGrid.GRID_ALIGN_CENTER
methodend
rem /**
rem * Constant value to define row position
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_ROWPOS_TOP()
methodret "top"
methodend
rem /**
rem * Constant value to define row position
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_ROWPOS_MIDDLE()
methodret "middle"
methodend
rem /**
rem * Constant value to define row position
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_ROWPOS_BOTTOM()
methodret "bottom"
methodend
rem /**
rem * Constant value to define editing mode "row"
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_EDITTYPE_ROW()
methodret "fullRow"
methodend
rem /**
rem * Constant value to define editing mode "cell"
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_EDITTYPE_CELL()
methodret ""
methodend
rem /**
rem * Constant value to define enter key behavior (Move to next cell)
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_ENTER_NEXT_CELL()
methodret "next"
methodend
rem /**
rem * Constant value to define navigation behavior (Move to next cell)
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_NAVIGATION_BEHAVIOUR_NEXT_CELL()
methodret "navigate_next_cell"
methodend
rem /**
rem * Constant value to define navigation behavior (Move to next row)
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_NAVIGATION_BEHAVIOUR_NEXT_ROW()
methodret "navigate_next_row"
methodend
rem /**
rem * Constant value to define enter key behavior (Stop editing)
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_ENTER_STOP_EDITING()
methodret "stop"
methodend
rem /**
rem * Constant value which defines that group panel must always be shown
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_GROUPPANEL_SHOW_VISIBLE()
methodret "always"
methodend
rem /**
rem * Constant value which defines that group panel must be shown only when grouping
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_GROUPPANEL_SHOW_ONGROUPING()
methodret "onlyWhenGrouping"
methodend
rem /**
rem * Constant value which defines that group panel must always be hidden
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_GROUPPANEL_SHOW_HIDDEN()
methodret "never"
methodend
rem /**
rem * Constant value which describes the rows in before sorting and
rem * filtering phase.
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_ROWS_PHASE_ALL()
methodret "forEachNode"
methodend
rem /**
rem * Constant value which describes the rows in after filtering phase.
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_ROWS_PHASE_AFTER_FILTER()
methodret "forEachNodeAfterFilter"
methodend
rem /**
rem * Constant value which describes the rows in after filtering and sorting
rem * phase.
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_ROWS_PHASE_AFTER_FILTER_SORT()
methodret "forEachNodeAfterFilterAndSort"
methodend
rem /**
rem * Constant value which defines that chart toolbar settings item
rem *
rem * @return BBjString
rem */
method public static BBjString CHART_TOOLBAR_SETTINGS()
methodret "chartSettings"
methodend
rem /**
rem * Constant value which defines that chart toolbar data item
rem *
rem * @return BBjString
rem */
method public static BBjString CHART_TOOLBAR_DATA()
methodret "chartData"
methodend
rem /**
rem * Constant value which defines that chart toolbar format item
rem *
rem * @return BBjString
rem */
method public static BBjString CHART_TOOLBAR_FORMAT()
methodret "chartFormat"
methodend
rem /**
rem * Constant value which defines that chart toolbar download item
rem *
rem * @return BBjString
rem */
method public static BBjString CHART_TOOLBAR_DOWNLOAD()
methodret "chartDownload"
methodend
rem /**
rem * Constant value which defines that balham theme
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_THEME_BALHAM()
methodret "balham"
methodend
rem /**
rem * Constant value which defines that balham dark theme
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_THEME_BALHAM_DARK()
methodret "balham-dark"
methodend
rem /**
rem * Constant value which defines the material theme
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_THEME_MATERIAL()
methodret "material"
methodend
rem /**
rem * Constant value which defines the alpine theme
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_THEME_ALPINE()
methodret "alpine"
methodend
rem /**
rem * Constant value which defines the alpine dark theme
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_THEME_ALPINE_DARK()
methodret "alpine-dark"
methodend
rem /**
rem * Constant value which defines the rows floating on top
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_FLOATING_TOP()
methodret "top"
methodend
rem /**
rem * Constant value which defines the rows floating on bottom
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_FLOATING_BOTTOM()
methodret "bottom"
methodend
rem /**
rem * Constant value which defines the rows with no floating
rem *
rem * @return BBjString
rem */
method public static BBjString GRID_FLOATING_NONE()
methodret ""
methodend
rem /**
rem * Make Hex Color
rem *
rem * Convert the given BBjColor to a hex color string
rem *
rem * @param BBjColor color! BBj color
rem *
rem * @return BBjString hex color
rem */
method public static BBjString makeHexColor(BBjColor color!)
methodret "#"+hta(chr(color!.getRed()))+hta(chr(color!.getGreen()))+hta(chr(color!.getBlue()))
methodend
rem /**
rem * Convert the image at the given path to base64 string
rem *
rem * @param BBjString filename! The image's path
rem *
rem * @return BBjString Image as base64 string
rem */
method public static BBjString imageToBase64(BBjString filename!)
imageSlice!=BBjAPI().getSysGui().getImageManager().loadImageFromFile(filename!)
bytes$ = str(imageSlice!.getBytes("png"))
b64$ = java.util.Base64.getEncoder().encode(bytes$)
methodret "data:image/png;base64, "+b64$
methodend
rem /**
rem * Alias for <i>imageToBase64()</i>
rem *
rem * @see imageToBase64()
rem */
method public static BBjString getImageData(BBjString filename!)
methodret BBjGridExWidget.imageToBase64(filename!)
methodend
rem /**
rem * The method will check whether the grid has license key or not.
rem *
rem * @return BBjNumber true when a license key is found, false otherwise
rem */
method public static BBjNumber isLicensed()
#getLicenseManager().setLicenseKey(#getLicenseKey())
methodret #getLicenseManager().isLicensed()
methodend
rem /**
rem * disabled default constructor
rem */
method public BBjGridExWidget()
methodend
rem /**
rem * The constructor that creates the widget on wnd!
rem *
rem * @param BBjWindow wnd!! parent window
rem * @param BBjNumber id! the control ID
rem * @param BBjNumber x! x-location
rem * @param BBjNumber y! y-location
rem * @param BBjNumber w! width
rem * @param BBjNumber h! height
rem */
method public BBjGridExWidget(BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h!)
#this!(null(), wnd!, id!, x!, y!, w!, h!, "")
methodend
rem /**
rem * The constructor that creates the widget on wnd!
rem *
rem * @param BBjWindow wnd!! parent window
rem * @param BBjNumber id! the control ID
rem * @param BBjNumber x! x-location
rem * @param BBjNumber y! y-location
rem * @param BBjNumber w! width
rem * @param BBjNumber h! height
rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
rem * By default you will never need to change the default Template.
rem * Unless you want to do something really unusual
rem */
method public BBjGridExWidget(BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h! , BBjString template$)
#this!(null(), wnd!, id!, x!, y!, w!, h!, template$)
methodend
rem /**
rem * The constructor that creates the widget on wnd!
rem *
rem * @param BBjString rootId! The root ID of the grid. This is used to identify the grid in the client side.
rem * This is useful when you have multiple grids in the same window.
rem * By default the root ID is a random string.
rem * @param BBjWindow wnd!! parent window
rem * @param BBjNumber id! the control ID
rem * @param BBjNumber x! x-location
rem * @param BBjNumber y! y-location
rem * @param BBjNumber w! width
rem * @param BBjNumber h! height
rem */
method public BBjGridExWidget(BBjString rootId!, BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h!)
#this!(rootId!, wnd!, id!, x!, y!, w!, h!, "")
methodend
rem /**
rem * The constructor that creates the widget on wnd!
rem *
rem * @param BBjString rootId! The root ID of the grid. This is used to identify the grid in the client side.
rem * This is useful when you have multiple grids in the same window.
rem * By default the root ID is a random string.
rem * @param BBjWindow wnd!! parent window
rem * @param BBjNumber id! the control ID
rem * @param BBjNumber x! x-location
rem * @param BBjNumber y! y-location
rem * @param BBjNumber w! width
rem * @param BBjNumber h! height
rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
rem * By default you will never need to change the default Template.
rem * Unless you want to do something really unusual
rem */
method public BBjGridExWidget(BBjString rootId!, BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h! , BBjString template$)
#RootId! = rootId!
#create(wnd!, id!, x!, y!, w!, h!, template$)
methodend
rem /**
rem * The constructor that creates the widget in the ChildWindow
rem *
rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
rem */
method public BBjGridExWidget(BBjChildWindow wnd!)
#this!(null(), wnd!, "")
methodend
rem /**
rem * The constructor that creates the widget in the ChildWindow
rem *
rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
rem * By default you will never need to change the default Template.
rem * Unless you want to do something really unusual
rem */
method public BBjGridExWidget(BBjChildWindow wnd!, BBjString template$)
#this!(null(), wnd!, template$)
methodend
rem /**
rem * The constructor that creates the widget in the ChildWindow
rem *
rem * @param BBjString rootId! The root ID of the grid. This is used to identify the grid in the client side.
rem * This is useful when you have multiple grids in the same window.
rem * By default the root ID is a random string.
rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
rem */
method public BBjGridExWidget(BBjString rootId!, BBjChildWindow wnd!)
#this!(RootId!, wnd!, "")
methodend
rem /**
rem * The constructor that creates the widget in the ChildWindow
rem *
rem * @param BBjString rootId! The root ID of the grid. This is used to identify the grid in the client side.
rem * This is useful when you have multiple grids in the same window.
rem * By default the root ID is a random string.
rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
rem * By default you will never need to change the default Template.
rem * Unless you want to do something really unusual
rem */
method public BBjGridExWidget(BBjString rootId!, BBjChildWindow wnd!, BBjString template$)
#RootId! = rootId!
#create(wnd!, template$)
methodend
rem /**
rem * Create the widget
rem *
rem * @param BBjWindow wnd!! parent window
rem * @param BBjNumber id! the control ID
rem * @param BBjNumber x! x-location
rem * @param BBjNumber y! y-location
rem * @param BBjNumber w! width
rem * @param BBjNumber h! height
rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
rem * By default you will never need to change the default Template.
rem * Unless you want to do something really unusual
rem *
rem * @Override
rem */
method protected void create(BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h!, BBjString template$)
#super!.setCanvas(wnd!.addChildWindow(id!,x!,y!,w!,h!,"",$00000800$,BBjAPI().getSysGui().getAvailableContext()))
#super!.setX(x!)
#super!.setY(y!)
#super!.setW(w!)
#super!.setH(h!)
#RS!.createIndex()
#fillChartToolbarItems()
#setTemplate(template$)
#redraw(BBjAPI.TRUE)
methodend
rem /**
rem * Create the widget
rem *
rem * @param BBjWindow wnd!! parent window
rem * @param BBjNumber id! the control ID
rem * @param BBjNumber x! x-location
rem * @param BBjNumber y! y-location
rem * @param BBjNumber w! width
rem * @param BBjNumber h! height
rem *
rem * @Override
rem */
method protected void create(BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h!)
#create(wnd!,id!,x!,y!,w!,h!,"")
methodend
rem /**
rem * Create the widget
rem *
rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
rem * By default you will never need to change the default Template.
rem * Unless you want to do something really unusual
rem *
rem * @Override
rem */
method protected void create(BBjChildWindow wnd!,BBjString template$)
#super!.setCanvas(wnd!)
#super!.setX(wnd!.getX())
#super!.setY(wnd!.getY())
#super!.setW(wnd!.getWidth())
#super!.setH(wnd!.getHeight())
#RS!.createIndex()
#fillChartToolbarItems()
#setTemplate(template$)
#redraw(BBjAPI.TRUE)
methodend
rem /**
rem * Create the widget
rem *
rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
rem * @param BBjString template$ the html template to use for the grid initialization
rem *
rem * @Override
rem */
method protected void create(BBjChildWindow wnd!)
#create(wnd!,"")
methodend
REM /**
REM * Get the unique control type
REM *
REM * @returns int controlType = 65001
REM */
method public int getControlType()
methodret 65001
methodend
rem /**
rem * Register an event handler
rem *
rem * @param Int type! The event's type
rem * @param String callback! The event's callback
rem *
rem * @Override
rem */
method public void setCallback(int type!, String callback!)
#super!.setCallback(type!,callback!)
#getInterests().add(type!)
#updateClientWithInterests()
methodend
rem /**
rem * Register an event handler
rem *
rem * @param Int type! The event's type
rem * @param CustomObject instance! class instance
rem * @param String method! method name
rem *
rem * @Override
rem */
method public void setCallback(int type!, CustomObject instance!, String method!)
#super!.setCallback(type!, instance!, method!)
#getInterests().add(type!)
#updateClientWithInterests()
methodend
rem /**
rem * Remove callback
rem *
rem * @param Int type! The event's type
rem *
rem * @Override
rem */
method public void clearCallback(int type!)
#super!.clearCallback(type!)
interests! = #getInterests()
el! = new JsonPrimitive(type!)
if(interests!.contains(el!)) then
interests!.remove(el!)
#updateClientWithInterests()
FI
methodend
rem /**
rem * Enable remote debugging on the given port
rem *
rem * @param BBjNumber debug! true to enable debug , false otherwise
rem * @param BBjNumber port! the debugging port
rem *
rem * @return void
rem */
method public static void setDebug(BBjNumber debug! , BBjNumber port!)
if(debug!.booleanValue())
chromiumSwitches$ = stbl("!CHROMIUM_SWITCHES","--remote-allow-origins=* --remote-debugging-port=" + str(port!))
fi
#Debug! = debug!
methodend
rem /**
rem * Enable remote debugging on the 9222 port
rem *
rem * @param BBjNumber debug! true to enable debug , false otherwise
rem *
rem * @return void
rem */
method public static void setDebug(BBjNumber debug!)
#setDebug(Debug! , 9222)
methodend
rem /**
rem * Get the root id of the grid
rem *
rem * The root id is a unique & auto-generated id for the grid instance.
rem * This id is used in the client to distinguish the grid instances
rem *
rem * @return BBjString the root id
rem */
method public BBjString getRootId()
if(null() = #RootId!)
rem not used anymore. We keep it for the getInstancesCount() method
#InstanceCount! = #InstanceCount! + 1
uuid! = UUID.randomUUID().toString().replace("-","").substring(0,8)
#RootId! = "gx-grid-" + uuid!
fi
methodret #RootId!
methodend
rem /**
rem * Return the number of initiated instances of the grid
rem *
rem * @return BBjNumber The number of instances
rem * @deprecated this method is deprecated and will be removed in the next release.
rem * The method will return a wrong value if the BBj session is different from the one
rem * in which the grid was initiated.
rem * @see <a href="https://github.com/BBj-Plugins/BBjGridExWidget/issues/251">Issue 251</a>
rem */
method public static BBjNumber getInstanceCount()
msg$ = "Since version 1.11.1, BBjGridExWidget.getInstanceCount is deprecated and will be removed in the next release. The method will return a wrong value if the BBj session is different from the one in which the grid was initiated."
GxLogger.warn(msg$)
methodret #InstanceCount!
methodend
rem /**
rem * @Override
rem *
rem * This method is called whenever the widget needs to be rendered
rem *
rem * @param Boolean f_init! if TRUE then the control is rendered for the first time so this method
rem * has to perform initial rendering
rem */
method public void redraw(Boolean f_init!)
declare BBjHtmlView htmlview!
if (f_init!) then
rem @see https://bugzilla.basis.cloud/show_bug.cgi?id=33048
enableInternalSpecialKeysHandling! = stbl("!OPTIONS","HTMLVIEW_INTERNAL_TABS=TRUE")
if (info(3,6)="6")
#getCanvas().setStyle("width", "100%")
#getCanvas().setStyle("height", "100%")
fi
html$ = #getTemplate()
if #isWebGui() then
if !#getCanvas().getParentWindow().isVisible()
rem if the parent window is not visible, we need to make it visible first
rem else the HtmlView won't render
#getCanvas().getParentWindow().setVisible(1)
rem show a short msgbox to trigger the rendering
a=msgbox("Show Window",tim=1)
fi
tmp=pos("<head>"=html$)
bundle$=#getBundle()
path$ = #copyWebAssets(bundle$)
scr$="<script type=""text/javascript"" src="""+path$+""" id=""bbj-grid-widget""></script>"
scr$=scr$+"<script>function whenGridLibLoaded (callback) {if (typeof agGrid === 'undefined') {setTimeout (function () {whenGridLibLoaded (callback);}, 50);} else { callback (); }}</script>"
html$=html$(1,tmp+5)+scr$+html$(tmp+6)
htmlview! = #getCanvas().addHtmlView(101,0,0,#getCanvas().getWidth(),#getCanvas().getHeight(),html$,$0000$)
else
htmlview! = #getCanvas().addHtmlView(101,0,0,#getCanvas().getWidth(),#getCanvas().getHeight(),"",$0000$)
fi
htmlview!.setOpaque(0)
htmlview!.setNoEdge(1)
htmlview!.setTabTraversable(1)
htmlview!.setFocusable(1)
htmlview!.addStyle("htmlview-" + #getRootId())
if (info(3,6)="6" AND AND(#getCanvas().getWindowFlags(),$00100000$) = $00100000$) then
rem in DWC, if parent window is client-side sized, make the htmlview same size as surrunding canvas
htmlview!.setStyle("width","100%")
htmlview!.setStyle("height","100%")