You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Dani

Intermediate

  • "Dani" started this thread

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

1

Wednesday, December 4th 2013, 1:25pm

JBGrid / Spinner - Update - with SpinnerModels

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

This post has been edited 3 times, last edit by "Dani" (May 10th 2014, 8:37am)


Dani

Intermediate

  • "Dani" started this thread

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

2

Thursday, December 5th 2013, 8:31am

... and a little picture



[img]http://www.jabaco.org/board/index.php?page=Attachment&attachmentID=378&h=669a209d016602dde9b130c079bd25437bc37413[/img]

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

3

Sunday, December 8th 2013, 4:49pm

Binary of the updated Framework is uploaded:
[ http://www.jabaco.org/wiki/Latest_JabacoFramework_Binary ]

Greatings
theuserbl

Rate this thread
WoltLab Burning Board