Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| slam4:gui:jface [2014/03/20 09:37] – créée jcheron | slam4:gui:jface [2019/08/31 14:21] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | ====== JFace ====== | ||
| + | |||
| + | ===== -- Composants ===== | ||
| + | |||
| + | ==== -- ListViewer ==== | ||
| + | |||
| + | === Instanciation === | ||
| + | <sxh java> | ||
| + | lvTest = new ListViewer(compositeParent, | ||
| + | List listTest = lvTest.getList(); | ||
| + | </ | ||
| + | |||
| + | === Affectation du contenu et définition du ContentProvider === | ||
| + | <sxh java> | ||
| + | lvCategories.setContentProvider(new ArrayContentProvider()); | ||
| + | lvCategories.setInput(getModeles()); | ||
| + | </ | ||
| + | |||
| <sxh java> | <sxh java> | ||
| package net.ex.categorie.main; | package net.ex.categorie.main; | ||
| Ligne 10: | Ligne 28: | ||
| private java.util.List< | private java.util.List< | ||
| private ListViewer lvCategories; | private ListViewer lvCategories; | ||
| + | private Categorie categorieActive; | ||
| + | private TableColumnLayout tLayout; | ||
| /** | /** | ||
| Ligne 56: | Ligne 76: | ||
| lvCategories = new ListViewer(compoLeft, | lvCategories = new ListViewer(compoLeft, | ||
| List listCategories = lvCategories.getList(); | List listCategories = lvCategories.getList(); | ||
| + | listCategories.addSelectionListener(new SelectionAdapter() { | ||
| + | @Override | ||
| + | public void widgetSelected(SelectionEvent e) { | ||
| + | StructuredSelection sel = (StructuredSelection) lvCategories.getSelection(); | ||
| + | categorieActive = (Categorie) sel.getFirstElement(); | ||
| + | } | ||
| + | }); | ||
| Composite compoRight = new Composite(sashMain, | Composite compoRight = new Composite(sashMain, | ||
| Ligne 63: | Ligne 90: | ||
| Composite composite = new Composite(sashForm, | Composite composite = new Composite(sashForm, | ||
| - | TableColumnLayout | + | tLayout = new TableColumnLayout(); |
| composite.setLayout(tLayout); | composite.setLayout(tLayout); | ||
| Ligne 84: | Ligne 111: | ||
| TableColumn col = new TableColumn(table, | TableColumn col = new TableColumn(table, | ||
| col.setText(caption); | col.setText(caption); | ||
| - | ((TableColumnLayout) table.getParent().getLayout()).setColumnData(col, | + | tLayout.setColumnData(col, |
| } | } | ||