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 "Nebula CTreeCombo"

(Created page with "< Back to Nebula Main Page =Introduction= This widget is an extension of a CCombo text field. It allows user to select a data, but instead of displaying data as a...")
 
m
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
=Introduction=
 
=Introduction=
  
This widget is an extension of a CCombo text field. It allows user to select a data, but instead of displaying data as a list it displays data as a tree:
+
This widget is an extension of a <code>CCombo</code> text field. It allows user to select a data, but instead of displaying data as a list it displays data as a tree:
  
 
[[File:Ctreecombo.png]]
 
[[File:Ctreecombo.png]]
Line 16: Line 16:
 
   ctc.setLayoutData(new GridData(200, SWT.DEFAULT));
 
   ctc.setLayoutData(new GridData(200, SWT.DEFAULT));
  
You fill the widget like a Tree widget, so you create CTreeComboItem that can have children:
+
You fill the widget like a Tree widget, so you have to create <code>CTreeComboItem</code> that may have children:
  
 
   for (final Country country : modelList) {
 
   for (final Country country : modelList) {
 
     final CTreeComboItem item = new CTreeComboItem(ctc, SWT.NONE);
 
     final CTreeComboItem item = new CTreeComboItem(ctc, SWT.NONE);
 
     item.setText(country.getName());
 
     item.setText(country.getName());
 
 
     for (final String commiter : country.getCommiters()) {
 
     for (final String commiter : country.getCommiters()) {
 
       final CTreeComboItem commiterItem = new CTreeComboItem(item, SWT.NONE);
 
       final CTreeComboItem commiterItem = new CTreeComboItem(item, SWT.NONE);

Latest revision as of 06:18, 19 March 2020

< Back to Nebula Main Page

Introduction

This widget is an extension of a CCombo text field. It allows user to select a data, but instead of displaying data as a list it displays data as a tree:

Ctreecombo.png

Usage

You use this widget like a CCombo widget :

 CTreeCombo ctc = new CTreeCombo(group, SWT.BORDER | SWT.READ_ONLY);
 ctc.setLayoutData(new GridData(200, SWT.DEFAULT));

You fill the widget like a Tree widget, so you have to create CTreeComboItem that may have children:

 for (final Country country : modelList) {
   final CTreeComboItem item = new CTreeComboItem(ctc, SWT.NONE);
   item.setText(country.getName());
   for (final String commiter : country.getCommiters()) {
     final CTreeComboItem commiterItem = new CTreeComboItem(item, SWT.NONE);
     commiterItem.setText(commiter);
   }
 }


Examples

An example called PasswordRevealerSnippet.java is located in the plugin org.eclipse.nebula.widgets.passwordrevealer.snippets.

This example is also available here : CTreeComboSnippet.java

Copyright © Eclipse Foundation, Inc. All Rights Reserved.