-
Notifications
You must be signed in to change notification settings - Fork 7
/
ColumnGroupingDemo.bbj
82 lines (59 loc) · 2.31 KB
/
ColumnGroupingDemo.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
use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget
use com.basiscomponents.bc.SqlQueryBC
use java.sql.Types
use com.google.gson.JsonObject
? 'HIDE'
declare auto BBjTopLevelWindow wnd!
declare auto BBjListButton lb_db!
declare auto BBjListButton lb_tbl!
declare auto BBjToolButton btn_fit!
declare BBjGridExWidget grid!
wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,800,600,"BBj Grid Ex Demo")
grid! = new BBjGridExWidget(wnd!,100,0,0,800,600)
wnd! .setCallback(BBjAPI.ON_CLOSE,"byebye")
wnd! .setCallback(BBjAPI.ON_RESIZE,"resize")
gosub fillGrid
process_events
fillGrid:
declare SqlQueryBC sbc!
sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore"))
rs! = sbc!.retrieve("SELECT * FROM CDINVENTORY")
grid!.addColumn("CDNUMBER","Item#")
grid!.addColumn("ARTIST","Artist Name")
grid!.addColumn("TITLE","Record Title")
grid!.addColumn("LABEL","Publisher")
grid!.addColumn("PLAYINGTIME","Playing Time (min)")
grid!.setColumnBackColor("CDNUMBER",BBjAPI().makeColor("LTGRAY"))
grid!.setColumnForeColor("CDNUMBER",BBjAPI().makeColor("BLUE"))
grid!.pinColumn("CDNUMBER","left")
grid!.setColumnWidth("CDNUMBER",120)
grid!.setColumnAlignment("CDNUMBER",grid!.GRID_ALIGN_CENTER())
grid!.setSelectionMode(grid!.GRID_SELECT_ROW())
grid!.setMultipleSelection(0)
grid!.setEnableFilter(1)
grid!.setEnableFloatingFilter(1)
groupStyle! = new JsonObject()
groupStyle!.addProperty("background","#03a9f4")
groupStyle!.addProperty("color","white")
groupStyle!.addProperty("font-weight","bolder")
groupStyle!.addProperty("border-bottom","3px solid black")
grid!.addStyle(".my-group-class" , groupStyle!)
group! = new BBjVector()
group!.addItem("CDNUMBER")
grid!.addColumnGroup("group1" , "Inventory",group! , 0 , "my-group-class")
group! = new BBjVector()
group!.addItem("ARTIST")
group!.addItem("TITLE")
grid!.addColumnGroup("group2" , "CD Information",group! , 0 , "my-group-class")
group! = new BBjVector()
group!.addItem("LABEL")
group!.addItem("PLAYINGTIME")
grid!.addColumnGroup("group3" , "Misc",group! , 0 , "my-group-class")
grid!.setData(rs!)
return
byebye:
bye
resize:
ev! = BBjAPI().getLastEvent()
grid!.setSize(ev!.getWidth(),ev!.getHeight())
return