https://code.google.com/p/jabacoframewor…ce/detail?r=127 Update
Hey there,
after my last Update for the JBGrid:
JBGrid - Update
I have again added a couple of features.
Mainly I wanted to be able to use a SpinnerControl as an editor for the JBGrid cells to easily edit date values.
I had to change the JBCellEditor quite a bit to do so.
I also added the ability to use different SpinnerModels to the Jabaco Spinner.
Unfortunatly some of those changes break compatibility to previous versions of the Framework.
You can no longer use:
|
Jabaco Source
|
1
2
|
JBGrid1.ComboList
JBGrid1.CellButton
|
instead all editors have to be invoked with:
|
Jabaco Source
|
1
|
JBGrid1.CellEditor.Component =
|
and their properties are accessed through:
|
Jabaco Source
|
1
|
JBGrid1.CellEditor. ...
|
The way it is implemented now gives us many more options of using the different editors with the JBGrid and we have full access to their properties.
Just keep in mind that an Editor can only be addressed whithin the editing cell!!
The following Sub should pretty much demonstrate how to use all Editors.
Have a look at what has changed here:
https://code.google.com/p/jabacoframewor…ce/detail?r=127
|
Jabaco Source
|
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
|
Public Sub JBGrid1_BeforeCellEdit(row As Integer, col As Integer)
Select Case col
Case 0
JBGrid1.CellEditor.Component = JBCommandButton 'invokes CellButton
Case 1
JBGrid1.CellEditor.Component = JBComboBox 'invokes ComboBox
JBGrid1.CellEditor.JBComboBox.ComboList = "Test1|Test2|" & _
"Test3|Test4|Test5|Test6|Test7|" & _
"Test8|Test9"
JBGrid1.CellEditor.JBComboBox.BackColor = vbWhite
JBGrid1.CellEditor.JBComboBox.BackColorAlternating = RGB(212, 208, 200)
Case 2
JBGrid1.CellEditor.Component = JBCheckBox
Case 3
JBGrid1.CellEditor.Component = JBSpinner
' '#### SpinnerListModel/ListEditor
' Dim ArrList As ArrayList = New java#util#ArrayList
' ArrList.add("Apple")
' ArrList.add("Banana")
' ArrList.add("Orange")
' JBGrid1.CellEditor.JBSpinner.Model = New SpinnerListModel(ArrList)
'#### SpinnerDateModel/DateEditor
JBGrid1.CellEditor.JBSpinner.Model = New javax#swing#SpinnerDateModel(New Date(Now), Null, Null, java#util#Calendar.DATE)
JBGrid1.CellEditor.JBSpinner.Editor = New javax#swing#JSpinner$DateEditor(JBGrid1.CellEditor.JBSpinner, "dd.MM.yyyy")
'
' '#### SpinnerNumberModel/NumberEditor
' 'play with values here, sometimes it only works if you use e.g. 0.05; it depends on what is allready in the JBGridCell!!
' JBGrid1.CellEditor.JBSpinner.Model = New SpinnerNumberModel(1.05, -20.01, 100.00, 0.10)
' JBGrid1.CellEditor.JBSpinner.Editor = New javax#swing#JSpinner$NumberEditor(JBGrid1.CellEditor.JBSpinner, "#.##") '"#,###.##" "#,##.00"
'
JBGrid1.CellEditor.JBSpinner.BackColor = JBGrid1.CellEditor.getRowBackColor(row) 'get JBGridBackColorCells per row
If JBGrid1.CellForeColor(row, col) <> -1 Then JBGrid1.CellEditor.JBSpinner.ForeColor = JBGrid1.CellForeColor(row, col)
Case 4
JBGrid1.StopEdit() 'prevents editing this Cell
Case 5
JBGrid1.CellEditor.Component = JBCommandButton 'invokes CellButton
JBGrid1.CellEditor.JBCommandButton.Caption = "*" 'todo -> pass New Dimension for JBCommandButton
Case 6
JBGrid1.CellEditor.JBTextBox.BackColor = JBGrid1.CellEditor.getRowBackColor(row)
Case Else
' JBGrid1.CellEditor = jbText
End Select
End Sub
|
I have attached a sample
JBGrid Test Project. (Framework rev. 127 has to be installed!!)
Dani
EDIT 5/2014:
Framework rev. 135 has been released by now and is taking care of minor bugfixes regarding the JBGrid!
So please download the latest binary here:
http://www.jabaco.org/wiki/Latest_JabacoFramework_Binary