Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » What SWT Layout ?
What SWT Layout ? [message #458983] Thu, 28 July 2005 05:02 Go to next message
Eclipse User
Originally posted by: vducloux.cosmosbay-vectis.com

Hi,

I need to know what layout to use to have the following behaviour:

2 parts in my eclipse editor:

- one table editor (on top & fill horizontal)
- underneath this table a dash board (fill horizontal)

The main features are :

- the dash board should be of a certain exact size and ALWAYS visible
- the table editor should take all the rest of the vertical place.
Horizontal and/or Vertical scroll should appear when the window is
resized smaller.

I've already done this but the vertical scroll for the table never
appears !!!

Underneath is the code...

Here are some screenshots of what I'm getting :

Normal size:
http://leplusnet.free.fr/images/forums/te01.gif

Horizontal resize to smaller (the H_Scroll appears):
http://leplusnet.free.fr/images/forums/te02.gif

Vertical resize to smaller (the V_Scroll doesn't appear, and the dash
board disappears underneath the table !!):
http://leplusnet.free.fr/images/forums/te03.gif



Please can someone HELP me, I'm breaking my head on this stuff !!!!

And here's the source code :

/**
* LAYOUT 0 : Séparation en 2 parties, 'Table d'édition' et
'Tableau de
* Bord'
*/
GridLayout gridLayout = new GridLayout();
parent.setLayout(gridLayout);

Group tabGroup = new Group(parent, SWT.NONE);
//Création du Group 0, Table d'édition
tabGroup.setText("Table d'édition");
//Mise en place de ses propriétées
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.BEGINNING;
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
// data.heightHint = 400;
tabGroup.setLayoutData(data);

//Création du Group 1, Tableau de bord
Group dashboardGroup = new Group(parent, SWT.NONE);
dashboardGroup.setText("Tableau de bord Selenium");
//Mise en place de ses propriétées
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
data.heightHint = 60;
dashboardGroup.setLayoutData(data);

/**
* LAYOUT 1 : La table d'édition, occupe l'ensemble de l'espace du
* layout
*/
FillLayout tabGroupLayout = new FillLayout(SWT.NONE);
tabGroup.setLayout(tabGroupLayout);
tabGroupLayout.marginHeight = GLOBAL_MARGIN_HEIGHT;
tabGroupLayout.marginWidth = GLOBAL_MARGIN_WIDTH;

int style = SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
| SWT.CHECK | SWT.FULL_SELECTION;

table = new Table(tabGroup, style);
table.setLinesVisible(true);
table.setHeaderVisible(true);

GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.grabExcessVerticalSpace = true;
gridData.horizontalSpan = 3;
table.setLayoutData(gridData);

// 1st column with image/checkboxes - NOTE: The SWT.CENTER has no
// effect!!
TableColumn column = new TableColumn(table, SWT.CENTER, 0);
column.setText(Test.getActiveTitle());
column.setWidth(45);

// 2nd column : Selenium Command
column = new TableColumn(table, SWT.LEFT, 1);
column.setText(Test.getCommandTitle());
column.setWidth(150);

// 3rd column Target of Selenium Command
column = new TableColumn(table, SWT.LEFT, 2);
column.setText(Test.getTargetTitle());
column.setWidth(360);

// 4th column Value of Selenium Command
column = new TableColumn(table, SWT.CENTER, 3);
column.setText(Test.getValueTitle());
column.setWidth(120);

for (int i = 0; i < 40; i++) {
TableItem item = new TableItem(table, SWT.NONE);

}

/**
* Layout dans le group Tableau de bord
*/
GridLayout dashboardGridLayout = new GridLayout();
dashboardGridLayout.numColumns = 4;
dashboardGridLayout.marginHeight = GLOBAL_MARGIN_HEIGHT;
dashboardGridLayout.marginWidth = GLOBAL_MARGIN_WIDTH;
dashboardGridLayout.horizontalSpacing = 3;
dashboardGridLayout.verticalSpacing = 3;

dashboardGroup.setLayout(dashboardGridLayout);

Button button0 = new Button(dashboardGroup, SWT.PUSH);
button0.setText("Sélectionner tout");
data = new GridData();
data.horizontalAlignment = GridData.FILL;
button0.setLayoutData(data);

Button button1 = new Button(dashboardGroup, SWT.PUSH);
button1.setText("Nouveau test");
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.verticalSpan = 2;
button1.setLayoutData(data);

Button button2 = new Button(dashboardGroup, SWT.PUSH);
button2.setText("Monter");
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
button2.setLayoutData(data);

Button button3 = new Button(dashboardGroup, SWT.PUSH);
button3.setText("Insérer");
data = new GridData();
data.horizontalAlignment = GridData.FILL;
button3.setLayoutData(data);

Button button4 = new Button(dashboardGroup, SWT.PUSH);
button4.setText("Déselectionner tout");
data = new GridData();
data.horizontalAlignment = GridData.FILL;
button4.setLayoutData(data);

Button button5 = new Button(dashboardGroup, SWT.PUSH);
button5.setText("Descendre");
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
button5.setLayoutData(data);

Button button6 = new Button(dashboardGroup, SWT.PUSH);
button6.setText("Effacer sélectionner");
data = new GridData();
data.horizontalAlignment = GridData.FILL;
button6.setLayoutData(data);
Re: What SWT Layout ? [message #458984 is a reply to message #458983] Thu, 28 July 2005 06:47 Go to previous messageGo to next message
Eclipse User
Originally posted by: john.obyrne.gmail.com

Hi, just try to use a FormLayout

setLayout(new FormLayout());

FormData data = new FormData();
data.bottom= new FormAttachment(100, 0); // 100% of the screen + 0 pixels
offset
data.height = 150; // If your dashboard should be 150 pixels height
data.left = new FormAttachment(0, 100); // 0% of the screen + 0 pixels
offset
data.right = new FormAttachment(100, 0); // 100% of the screen + 0 pixels
offset
dashboard.setLayoutData(data);

FormData data = new FormData();
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(dashboard, 0);
data.left = new FormAttachment(0, 100); // 0% of the screen + 0 pixels
offset
data.right = new FormAttachment(100, 0); // 100% of the screen + 0 pixels
offset
table.setLayoutData(data);

Something like this should work

John

"Ducloux Victor" <vducloux@cosmosbay-vectis.com> wrote in message
news:dca6u6$383$2@news.eclipse.org...
> Hi,
>
> I need to know what layout to use to have the following behaviour:
>
> 2 parts in my eclipse editor:
>
> - one table editor (on top & fill horizontal)
> - underneath this table a dash board (fill horizontal)
>
> The main features are :
>
> - the dash board should be of a certain exact size and ALWAYS visible
> - the table editor should take all the rest of the vertical place.
> Horizontal and/or Vertical scroll should appear when the window is resized
> smaller.
>
> I've already done this but the vertical scroll for the table never appears
> !!!
>
> Underneath is the code...
>
> Here are some screenshots of what I'm getting :
>
> Normal size:
> http://leplusnet.free.fr/images/forums/te01.gif
>
> Horizontal resize to smaller (the H_Scroll appears):
> http://leplusnet.free.fr/images/forums/te02.gif
>
> Vertical resize to smaller (the V_Scroll doesn't appear, and the dash
> board disappears underneath the table !!):
> http://leplusnet.free.fr/images/forums/te03.gif
>
>
>
> Please can someone HELP me, I'm breaking my head on this stuff !!!!
>
> And here's the source code :
>
> /**
> * LAYOUT 0 : S
Re: What SWT Layout ? [message #459116 is a reply to message #458984] Tue, 02 August 2005 08:30 Go to previous message
Eclipse User
Originally posted by: vducloux.cosmosbay-vectis.com

John O'Byrne wrote:
> Hi, just try to use a FormLayout
>
> setLayout(new FormLayout());
>
> FormData data = new FormData();
> data.bottom= new FormAttachment(100, 0); // 100% of the screen + 0 pixels
> offset
> data.height = 150; // If your dashboard should be 150 pixels height
> data.left = new FormAttachment(0, 100); // 0% of the screen + 0 pixels
> offset
> data.right = new FormAttachment(100, 0); // 100% of the screen + 0 pixels
> offset
> dashboard.setLayoutData(data);
>
> FormData data = new FormData();
> data.top = new FormAttachment(0, 0);
> data.bottom = new FormAttachment(dashboard, 0);
> data.left = new FormAttachment(0, 100); // 0% of the screen + 0 pixels
> offset
> data.right = new FormAttachment(100, 0); // 100% of the screen + 0 pixels
> offset
> table.setLayoutData(data);
>
> Something like this should work
>
> John
>
> "Ducloux Victor" <vducloux@cosmosbay-vectis.com> wrote in message
> news:dca6u6$383$2@news.eclipse.org...
>
>>Hi,
>>
>>I need to know what layout to use to have the following behaviour:
>>
>>2 parts in my eclipse editor:
>>
>>- one table editor (on top & fill horizontal)
>>- underneath this table a dash board (fill horizontal)
>>
>>The main features are :
>>
>>- the dash board should be of a certain exact size and ALWAYS visible
>>- the table editor should take all the rest of the vertical place.
>>Horizontal and/or Vertical scroll should appear when the window is resized
>>smaller.
>>
>>I've already done this but the vertical scroll for the table never appears
>>!!!
>>
>>Underneath is the code...
>>
>>Here are some screenshots of what I'm getting :
>>
>>Normal size:
>>http://leplusnet.free.fr/images/forums/te01.gif
>>
>>Horizontal resize to smaller (the H_Scroll appears):
>>http://leplusnet.free.fr/images/forums/te02.gif
>>
>>Vertical resize to smaller (the V_Scroll doesn't appear, and the dash
>>board disappears underneath the table !!):
>>http://leplusnet.free.fr/images/forums/te03.gif
>>
>>
>>
>>Please can someone HELP me, I'm breaking my head on this stuff !!!!
>>
>>And here's the source code :
>>
>> /**
>> * LAYOUT 0 : Séparation en 2 parties, 'Table d'édition' et
>>'Tableau de
>> * Bord'
>> */
>> GridLayout gridLayout = new GridLayout();
>> parent.setLayout(gridLayout);
>>
>> Group tabGroup = new Group(parent, SWT.NONE);
>> //Création du Group 0, Table d'édition
>> tabGroup.setText("Table d'édition");
>> //Mise en place de ses propriétées
>> GridData data = new GridData();
>> data.horizontalAlignment = GridData.FILL;
>> data.verticalAlignment = GridData.BEGINNING;
>> data.grabExcessHorizontalSpace = true;
>> data.grabExcessVerticalSpace = true;
>> // data.heightHint = 400;
>> tabGroup.setLayoutData(data);
>>
>> //Création du Group 1, Tableau de bord
>> Group dashboardGroup = new Group(parent, SWT.NONE);
>> dashboardGroup.setText("Tableau de bord Selenium");
>> //Mise en place de ses propriétées
>> data = new GridData();
>> data.horizontalAlignment = GridData.FILL;
>> data.grabExcessHorizontalSpace = true;
>> data.heightHint = 60;
>> dashboardGroup.setLayoutData(data);
>>
>> /**
>> * LAYOUT 1 : La table d'édition, occupe l'ensemble de l'espace du
>> * layout
>> */
>> FillLayout tabGroupLayout = new FillLayout(SWT.NONE);
>> tabGroup.setLayout(tabGroupLayout);
>> tabGroupLayout.marginHeight = GLOBAL_MARGIN_HEIGHT;
>> tabGroupLayout.marginWidth = GLOBAL_MARGIN_WIDTH;
>>
>> int style = SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
>> | SWT.CHECK | SWT.FULL_SELECTION;
>>
>> table = new Table(tabGroup, style);
>> table.setLinesVisible(true);
>> table.setHeaderVisible(true);
>>
>> GridData gridData = new GridData(GridData.FILL_BOTH);
>> gridData.grabExcessVerticalSpace = true;
>> gridData.horizontalSpan = 3;
>> table.setLayoutData(gridData);
>>
>> // 1st column with image/checkboxes - NOTE: The SWT.CENTER has no
>> // effect!!
>> TableColumn column = new TableColumn(table, SWT.CENTER, 0);
>> column.setText(Test.getActiveTitle());
>> column.setWidth(45);
>>
>> // 2nd column : Selenium Command
>> column = new TableColumn(table, SWT.LEFT, 1);
>> column.setText(Test.getCommandTitle());
>> column.setWidth(150);
>>
>> // 3rd column Target of Selenium Command
>> column = new TableColumn(table, SWT.LEFT, 2);
>> column.setText(Test.getTargetTitle());
>> column.setWidth(360);
>>
>> // 4th column Value of Selenium Command
>> column = new TableColumn(table, SWT.CENTER, 3);
>> column.setText(Test.getValueTitle());
>> column.setWidth(120);
>>
>> for (int i = 0; i < 40; i++) {
>> TableItem item = new TableItem(table, SWT.NONE);
>>
>> }
>>
>> /**
>> * Layout dans le group Tableau de bord
>> */
>> GridLayout dashboardGridLayout = new GridLayout();
>> dashboardGridLayout.numColumns = 4;
>> dashboardGridLayout.marginHeight = GLOBAL_MARGIN_HEIGHT;
>> dashboardGridLayout.marginWidth = GLOBAL_MARGIN_WIDTH;
>> dashboardGridLayout.horizontalSpacing = 3;
>> dashboardGridLayout.verticalSpacing = 3;
>>
>> dashboardGroup.setLayout(dashboardGridLayout);
>>
>> Button button0 = new Button(dashboardGroup, SWT.PUSH);
>> button0.setText("Sélectionner tout");
>> data = new GridData();
>> data.horizontalAlignment = GridData.FILL;
>> button0.setLayoutData(data);
>>
>> Button button1 = new Button(dashboardGroup, SWT.PUSH);
>> button1.setText("Nouveau test");
>> data = new GridData();
>> data.horizontalAlignment = GridData.FILL;
>> data.verticalSpan = 2;
>> button1.setLayoutData(data);
>>
>> Button button2 = new Button(dashboardGroup, SWT.PUSH);
>> button2.setText("Monter");
>> data = new GridData();
>> data.horizontalAlignment = GridData.FILL;
>> data.grabExcessHorizontalSpace = true;
>> button2.setLayoutData(data);
>>
>> Button button3 = new Button(dashboardGroup, SWT.PUSH);
>> button3.setText("Insérer");
>> data = new GridData();
>> data.horizontalAlignment = GridData.FILL;
>> button3.setLayoutData(data);
>>
>> Button button4 = new Button(dashboardGroup, SWT.PUSH);
>> button4.setText("Déselectionner tout");
>> data = new GridData();
>> data.horizontalAlignment = GridData.FILL;
>> button4.setLayoutData(data);
>>
>> Button button5 = new Button(dashboardGroup, SWT.PUSH);
>> button5.setText("Descendre");
>> data = new GridData();
>> data.horizontalAlignment = GridData.FILL;
>> data.grabExcessHorizontalSpace = true;
>> button5.setLayoutData(data);
>>
>> Button button6 = new Button(dashboardGroup, SWT.PUSH);
>> button6.setText("Effacer sélectionner");
>> data = new GridData();
>> data.horizontalAlignment = GridData.FILL;
>> button6.setLayoutData(data);
>>
>
>
>


thanks for the help ,

Victor
Previous Topic:Modal dialog with Swing content
Next Topic:Problems with CellEditor
Goto Forum:
  


Current Time: Sat Aug 30 06:41:14 EDT 2014

Powered by FUDForum. Page generated in 0.01686 seconds