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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
Display display = PlatformUI.getWorkbench().getDisplay();
final Shell shell = new Shell(display, SWT.APPLICATION_MODAL
| SWT.CLOSE
| SWT.TITLE
| SWT.MAX
| SWT.RESIZE);
shell.setText("shell");
shell.setSize(700, 700);
shell.setLayout(new GridLayout(2, true));
TabFolder tabFolder = new TabFolder(shell, SWT.NONE);
tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
TabItem item = new TabItem(tabFolder, SWT.NONE);
item.setText(Util.METRICS_LABEL);
Composite composite = new Composite(tabFolder, SWT.NONE);
composite.setLayout(new GridLayout());
item.setControl(composite);
//création de tree
Tree tree = new Tree(composite, SWT.BORDER);
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
TreeColumn column1 = new TreeColumn(tree, SWT.NONE);
column1.setText("C1");
TreeColumn column2 = new TreeColumn(tree, SWT.NONE);
column2.setText("C2");
TreeColumn column3 = new TreeColumn(tree, SWT.NONE);
column3.setText("C3");
TreeColumn column4 = new TreeColumn(tree, SWT.NONE);
column4.setText("C4");
TreeColumn column5 = new TreeColumn(tree, SWT.NONE);
column5.setText("C5");
TreeColumn column6 = new TreeColumn(tree, SWT.NONE);
column6.setText("C6");
// la racine
TreeItem racine= new TreeItem(tree, SWT.NONE);
branch.setText("Racine");
// 1er noeud sous la racine
TreeItem wpitem = new TreeItem(racine, SWT.NONE);
wpitem.setText("noeud1");
for (/*parcour d'une liste d'objets*/)
{/*
Cette boucle crée un noeud sous la racine "racine" pour chaque objet.
*/
}
racine.setExpanded(true);
column1.pack();
column2.pack();
column3.pack();
column4.pack();
column5.pack();
column6.pack();
Button rapport = new Button(composite, 0);
rapport.setText("Générer un rapport");
TabItem item2 = new TabItem(tabFolder, SWT.NONE);
item2.setText("Configuration");
Composite composite2 = new Composite(tabFolder, SWT.NONE);
composite2.setLayout(new GridLayout(2, true));
composite2.setBackground(new Color(null, 240, 240, 240));
item2.setControl(composite2);
Button fermer = new Button(shell, 1);
fermer.setText("Fermer");
fermer.pack(true);
fermer.addSelectionListener(new SelectionAdapter()
{
@Override
public void widgetSelected(SelectionEvent event)
{
shell.close();
}
});
shell.setLocation(300, 100);
shell.pack();
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
display.sleep();
}
} |
Partager