Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Basic SWT widgets enhancement"

(Personal Info)
(Source code)
 
(12 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
SWT has been developed as a light-weight library to establish rich java GUI programmes, but there still are some popular features that current widget does not have. For example,the combo box widget still does not support an image item or a mix(image and text).Actually,there are many aspects for basic SWT widgets to be enhanced. Here, my work is just to add some basic and popular features to some widgets in SWT or Nebula.
 
SWT has been developed as a light-weight library to establish rich java GUI programmes, but there still are some popular features that current widget does not have. For example,the combo box widget still does not support an image item or a mix(image and text).Actually,there are many aspects for basic SWT widgets to be enhanced. Here, my work is just to add some basic and popular features to some widgets in SWT or Nebula.
  
== Primary goals ==
+
== Preliminary Ideas ==
 
===Enhance some basic widgets in SWT or Nebula===
 
===Enhance some basic widgets in SWT or Nebula===
 
* '''rich combo box''': this combo box will support image and mix(image and text)
 
* '''rich combo box''': this combo box will support image and mix(image and text)
I have found that there are two ways of implements such a extended combobox widget:
+
I have found that there are two ways of implements such an extended combobox widget. The following are two web page links about method to implement such an enhanced combo box:
  
''Enhancing the Combo-Widget with Images'': you can see it on page http://www.richclient2.eu/2006_03_03/enhancing-the-combo-widget-with-images/
+
''Enhancing the Combo-Widget with Images'' [http://www.richclient2.eu/2006_03_03/enhancing-the-combo-widget-with-images/]
''ComboBoxEx'': you can see the introduction of this widget on page http://www.milewski.ws/2009/04/combo-box-with-images-in-swt/
+
  
The first implementation is a good way to fulfil such a function,in which it just make some modifications of combobox source code in swt.It is simple and we do not need consider much about cross-platform problem,because it just builds on basic widgets afforded by swt like primary combobox widget.But what the problem is: maybe the SWT group does not like this coding style and it is just a workaround to implement a function,thus should not be as a part of SWT.
+
The first implementation is a good way to fulfil such a feature,in which it just make some modifications of combobox source code in SWT. It just replaces the List in ComboBox with a Table or CTable , so it's very simple and we do not need consider much about cross-platform problems.But what the problem is: the SWT group may not accept it because it is just a workaround to add this feature: a table to show a list, strange?.
  
The second implementation may be a good style that SWT group likes.But there are many problems in it,of which the most import is the cross-platform and we will deal much  with Java Native Access library.
+
''ComboBoxEx'' [http://www.milewski.ws/2009/04/combo-box-with-images-in-swt/]
  
* '''rich list''': this list will also support image and mix
+
The second way may be a good style that SWT group or at least Nebula group think it's a good idea .But there are many problems in it, of which the most import problem is the cross-platform problem because it is built on JNI(Java Native Access library) which depends on Windows native features.
There are not many solutions to solve this problem.I think it's a good and very fundamental function that SWT should support.And if this problem were well settled, a rich combo box supporting image,shown above,will be easily implemented.Because the combo box is just composed of three basic widgets:Text,Button,List,we can simplely replace the basic list widget with our rich list widget.The 'text' area may still only show texts;to solve this,the CLabel can be introduced to support image and text.
+
  
 
I have reported this as an enhancement bug and you can see the details of it at [https://bugs.eclipse.org/bugs/show_bug.cgi?id=275285 Bug 275285]
 
I have reported this as an enhancement bug and you can see the details of it at [https://bugs.eclipse.org/bugs/show_bug.cgi?id=275285 Bug 275285]
  
 
* '''cell merging capabilities in Grid''': enhance this widget to support row merge
 
* '''cell merging capabilities in Grid''': enhance this widget to support row merge
A [http://www.eclipse.org/nebula/widgets/grid/grid.php Grid] widget of Nebula has been created to offer features like cell selection,column grouping,column spanning,row headers and so on,which are not currently supported in the base SWT Table.But this Nebula widget currently only supports column merge,but not row merge.So I think it would be a good idea to enhance this widget.(''This idea comes from Ivar Meikas,who is my mentor in this google summer code.Then many thanks to him!'')
+
The [http://www.eclipse.org/nebula/widgets/grid/grid.php Grid] widget is a spreadsheet/table component that offers features not currently found in the base SWT Table.It offers features like cell selection,column grouping,column spanning,row headers and so on,which are not currently supported in the base SWT Table.But this Nebula widget currently only supports column merging,but row merging not.So I think it would be a good idea to add this feature because it is a popular and very-often-used feature.(''This idea comes from Ivar Meikas,who is my mentor in this google summer code.Then many thanks to him!'')
  
 
===Fix bugs===
 
===Fix bugs===
 
* [https://bugs.eclipse.org/bugs/show_bug.cgi?id=189888 Bug 189888][Nebula]''Request for IP Address input widget control''  
 
* [https://bugs.eclipse.org/bugs/show_bug.cgi?id=189888 Bug 189888][Nebula]''Request for IP Address input widget control''  
There should be a widget control to input an ip address for SWT package,then I found it is just a bug in Nebula.But I haven't found that somebody has fixed this bug.Inputting an ip address is a popular and often used function,so I'll try to fix it.
+
There should be a widget control to input an ip address for SWT package,then I find it is just a bug which has been reported in Nebula.But I haven't found that somebody has fixed it.Inputting an ip address is a popular and often used functionality,so I'll try to fix it.
  
===Add some functionality===
+
== Schedule ==
* '''a batch of rich buttons''': e.g. if the button style as been set style_ok, a button containing a "ok" image will be created.And there are many styles will be supported:style_ok,style_cancel,style_info,style_err,etc.
+
* [[Image:Glass.gif]] [https://bugs.eclipse.org/bugs/show_bug.cgi?id=275285 Bug 275285]
You can see the snapshot of these buttons in the following pic as a sample that our rich buttons would be implemented.If you ever used C++ Builder to developement desk GUIs,you will be familiar with these buttons containing a small image showing its apparent meaning.[[Image:Buttons.jpg]]
+
 
 +
I badly want to implement this enhanced widget with the second method which Lukasz Milewski offered, but I can not get response from him. So, I have to give up this idea and do my other things.
 +
 
 +
* [[Image:Ok_green.gif]] [https://bugs.eclipse.org/bugs/show_bug.cgi?id=189888 Bug 189888]
 +
 
 +
I have submitted my patch to fix this bug. If anyone want to use an IP input feature within Java Interface, he can install this patch. There are still some defects in it and some places may need to enhance, so more feedbacks are welcome.
 +
 
 +
* [[Image:Ok_green.gif]] ''cell merging of Grid widget''
 +
 
 +
The enhanced Grid now can not only support column merging(it is called 'spanning' in Grid source), but also support row merging. So, more complex functionality such as a big spanning area, can be fulfiled. Thus, this widget can be used like a spreadsheet/table component more similarly.
 +
 
 +
The following is a snapshot of the usage of this enhanced widget:
 +
[[Image:Snapshot.JPG]]
 +
 
 +
== Future Work ==
 +
Try to fix [https://bugs.eclipse.org/bugs/show_bug.cgi?id=275285 Bug 275285].
  
 
== Source code ==
 
== Source code ==
The code will be hosted on google code.
+
The code is hosted on google code. You can check out my code at [http://code.google.com/p/eclipse-soc/source/browse/#svn/trunk/2009-nebulawidgetsenhancement]. More feedbacks are welcome.

Latest revision as of 02:30, 10 August 2009

Personal Info

Name: Zhong Nanhai

GTalk: higerinbeijing@gmail.com

Mentor: Ivar Meikas

About

SWT has been developed as a light-weight library to establish rich java GUI programmes, but there still are some popular features that current widget does not have. For example,the combo box widget still does not support an image item or a mix(image and text).Actually,there are many aspects for basic SWT widgets to be enhanced. Here, my work is just to add some basic and popular features to some widgets in SWT or Nebula.

Preliminary Ideas

Enhance some basic widgets in SWT or Nebula

  • rich combo box: this combo box will support image and mix(image and text)

I have found that there are two ways of implements such an extended combobox widget. The following are two web page links about method to implement such an enhanced combo box:

Enhancing the Combo-Widget with Images [1]

The first implementation is a good way to fulfil such a feature,in which it just make some modifications of combobox source code in SWT. It just replaces the List in ComboBox with a Table or CTable , so it's very simple and we do not need consider much about cross-platform problems.But what the problem is: the SWT group may not accept it because it is just a workaround to add this feature: a table to show a list, strange?.

ComboBoxEx [2]

The second way may be a good style that SWT group or at least Nebula group think it's a good idea .But there are many problems in it, of which the most import problem is the cross-platform problem because it is built on JNI(Java Native Access library) which depends on Windows native features.

I have reported this as an enhancement bug and you can see the details of it at Bug 275285

  • cell merging capabilities in Grid: enhance this widget to support row merge

The Grid widget is a spreadsheet/table component that offers features not currently found in the base SWT Table.It offers features like cell selection,column grouping,column spanning,row headers and so on,which are not currently supported in the base SWT Table.But this Nebula widget currently only supports column merging,but row merging not.So I think it would be a good idea to add this feature because it is a popular and very-often-used feature.(This idea comes from Ivar Meikas,who is my mentor in this google summer code.Then many thanks to him!)

Fix bugs

  • Bug 189888[Nebula]Request for IP Address input widget control

There should be a widget control to input an ip address for SWT package,then I find it is just a bug which has been reported in Nebula.But I haven't found that somebody has fixed it.Inputting an ip address is a popular and often used functionality,so I'll try to fix it.

Schedule

I badly want to implement this enhanced widget with the second method which Lukasz Milewski offered, but I can not get response from him. So, I have to give up this idea and do my other things.

I have submitted my patch to fix this bug. If anyone want to use an IP input feature within Java Interface, he can install this patch. There are still some defects in it and some places may need to enhance, so more feedbacks are welcome.

  • Ok green.gif cell merging of Grid widget

The enhanced Grid now can not only support column merging(it is called 'spanning' in Grid source), but also support row merging. So, more complex functionality such as a big spanning area, can be fulfiled. Thus, this widget can be used like a spreadsheet/table component more similarly.

The following is a snapshot of the usage of this enhanced widget: Snapshot.JPG

Future Work

Try to fix Bug 275285.

Source code

The code is hosted on google code. You can check out my code at [3]. More feedbacks are welcome.

Back to the top