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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
// Set the shell's layout
GridLayout layout = new GridLayout();
layout.numColumns = 2;
shell.setLayout(layout);
//-----------------------------------------------------------------------------------------
// Note : For all composite, you can specify a heighHint (or widthHint)
// It's especially useful for composite which use grabExcessVerticalSpace
// (or grabExcessHorizontalSpace) to avoid a very small height
// (or width) when reducing the shell.
//-----------------------------------------------------------------------------------------
GridData constraint;
//-------- Buttons composite container
Composite btnContainer = new Composite(shell, SWT.NONE);
btnContainer.setBackground(new Color(null, 0, 0, 255));
constraint = new GridData();
constraint.verticalSpan = 2;
constraint.verticalAlignment = GridData.FILL;
constraint.horizontalAlignment = GridData.FILL;
btnContainer.setLayoutData(constraint);
// Set the btnContainer's layout
GridLayout btnLayout = new GridLayout();
btnLayout.numColumns = 1;
btnContainer.setLayout(btnLayout);
//================== Composite in btnContainer =================
//-------- Buttons composite
Composite btnComposite = new Composite(btnContainer, SWT.NONE);
btnComposite.setBackground(new Color(null, 127, 127, 0));
constraint = new GridData();
constraint.grabExcessVerticalSpace = true;
constraint.verticalAlignment = GridData.FILL;
constraint.horizontalAlignment = GridData.FILL;
btnComposite.setLayoutData(constraint);
//-------- Options composite
Composite optComposite = new Composite(btnContainer, SWT.NONE);
optComposite.setBackground(new Color(null, 0, 127, 127));
constraint = new GridData();
constraint.grabExcessVerticalSpace = true;
constraint.verticalAlignment = GridData.FILL;
constraint.horizontalAlignment = GridData.FILL;
optComposite.setLayoutData(constraint);
//================== Composite in btnContainer =================
//-------- Header composite
Composite headComposite = new Composite(shell, SWT.NONE);
headComposite.setBackground(new Color(null, 0, 255, 0));
constraint = new GridData();
constraint.verticalAlignment = GridData.FILL;
constraint.horizontalAlignment = GridData.FILL;
// Don't need to grab horizontal : done by editComposite
headComposite.setLayoutData(constraint);
//-------- Editor composite
Composite editComposite = new Composite(shell, SWT.NONE);
editComposite.setBackground(new Color(null, 0, 255, 255));
constraint = new GridData();
constraint.grabExcessVerticalSpace = true;
constraint.verticalAlignment = GridData.FILL;
constraint.grabExcessHorizontalSpace = true;
constraint.horizontalAlignment = GridData.FILL;
editComposite.setLayoutData(constraint);
//-------- Search composite
Composite searchComposite = new Composite(shell, SWT.NONE);
searchComposite.setBackground(new Color(null, 255, 0, 0));
constraint = new GridData();
constraint.verticalAlignment = GridData.FILL;
constraint.horizontalSpan = 2;
// Don't need horizontal grab : done by editComposite
constraint.horizontalAlignment = GridData.FILL;
searchComposite.setLayoutData(constraint);
//-------- Table composite
Composite tableComposite = new Composite(shell, SWT.NONE);
tableComposite.setBackground(new Color(null, 255, 0, 255));
constraint = new GridData();
constraint.grabExcessVerticalSpace = true;
constraint.verticalAlignment = GridData.FILL;
constraint.horizontalSpan = 2;
// Don't need horizontal grab : done by editComposite
constraint.horizontalAlignment = GridData.FILL;
tableComposite.setLayoutData(constraint);
//-------- Footer composite
Composite footerComposite = new Composite(shell, SWT.NONE);
footerComposite.setBackground(new Color(null, 255, 255, 0));
constraint = new GridData();
constraint.verticalAlignment = GridData.FILL;
constraint.horizontalSpan = 2;
// Don't need horizontal grab : done by editComposite
constraint.horizontalAlignment = GridData.FILL;
footerComposite.setLayoutData(constraint); |
Partager