StackLayout resizing problem

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

StackLayout resizing problem

Postby Sebastien » Tue Aug 09, 2005 8:01 am

Hi,

I've bin stuck with the following resizing problem for weeks and I can't
seem to find a solution nor the reason. I have an SWT/JFace
ApplicationWindow containing a ScrolledComposite that holds a Composite
having a StackLayout. The goal is to be able to stack within a
ScrolledComposite.

A Goto... Menu Actions adds composites to the StackLayout, but right
now, only my search Composite is giving me an headache. The search
Composite has a search Button that dynamically displays the results
(equipments) within Tabs. After insertion of a new Tab, I do a
getShell().pack(true); but for some reason, only the outer
ApplicationWindow resizes correctly and not what is within the StackLayout.

To better understand, I've added to this post a stripped version of my
search
application with three classes: the ApplicationWindow (v_navigator), the
search Composite (v_search) and the search results Composite (v_equipment).
The code is really simple.

If anyone can free me from my desperation I would truly appreciate.

Sebastien
P.S. Three classes follow


V_NavigatorCIP.java
Code: Select all
/***************************************************************************
**
Navigator
****************************************************************************
**/
package navigator;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.StatusLineManager;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class V_NavigatorCIP extends ApplicationWindow {
private Action actEquipment;
private ScrolledComposite scrolledContainerAppl;
private Composite containerAppl;

public V_NavigatorCIP() {
  super(null);
  createActions();
  addToolBar(SWT.FLAT | SWT.WRAP);
  addMenuBar();
  addStatusLine();
}

protected Control createContents(Composite parent) {
  // Le scrolled composite ne peut pas contenir de layout car c'est le
  // layout
  // listner qui s'en occupe pour les redimensionnements.
  scrolledContainerAppl = new ScrolledComposite(parent, SWT.V_SCROLL
    | SWT.BORDER | SWT.H_SCROLL);
  scrolledContainerAppl.setAlwaysShowScrollBars(true);
  scrolledContainerAppl.setExpandHorizontal(true);
  scrolledContainerAppl.setExpandVertical(false);

  containerAppl = new Composite(scrolledContainerAppl, SWT.NONE);
  final StackLayout stackLayout = new StackLayout();
  containerAppl.setLayout(stackLayout);
  containerAppl.setSize(containerAppl.computeSize(SWT.DEFAULT,
    SWT.DEFAULT));
  scrolledContainerAppl.setContent(containerAppl);

  return scrolledContainerAppl;
}

private void createActions() {
  {
   actEquipment = new Action("Equipment") { //$NON-NLS-1$
    public void run() {
     showEquipment(containerAppl);
    }
   };
   actEquipment.setAccelerator(SWT.CTRL | 'E');
   actEquipment.setToolTipText("Goto ..."); //$NON-NLS-1$
  }
}

protected MenuManager createMenuManager() {
  MenuManager menuPrincipal = new MenuManager("menu"); //$NON-NLS-1$
  {
   final MenuManager menuAllerA = new MenuManager("Goto ...");
   menuAllerA.add(actEquipment);
   menuPrincipal.add(menuAllerA);
  }
  return menuPrincipal;
}

protected ToolBarManager createToolBarManager(int style) {
  ToolBarManager toolBarManager = new ToolBarManager(style);
  return toolBarManager;
}

protected StatusLineManager createStatusLineManager() {
  StatusLineManager statusLineManager = new StatusLineManager();
  statusLineManager.setMessage(null, "");
  return statusLineManager;
}

public static void main(String args[]) {
  try {
   V_NavigatorCIP window = new V_NavigatorCIP();
   window.setBlockOnOpen(true);
   window.open();
   Display.getCurrent().dispose();
  } catch (Exception e) {
   e.printStackTrace();
  }
}

protected void configureShell(Shell newShell) {
  super.configureShell(newShell);
  newShell.setText("New Application");
}

protected Point getInitialSize() {
  return new Point(500, 375);
}

private void showEquipment(Composite container){
  V_Search searchComposite = new V_Search(container, SWT.NONE);
  StackLayout sl = (StackLayout) containerAppl.getLayout();
  sl.topControl = searchComposite;
  // C'est le conteneur qui doit exécuter la méthode du layout car c'est
  // son contenu qui change.
  containerAppl.layout();
  // Utiliser la taille recommandée de la vue pour dimensionner le
  // conteneur
  containerAppl.setSize(searchComposite.computeSize(SWT.DEFAULT,
SWT.DEFAULT));
  this.getShell().pack(true);
}
}


V_Search.java
Code: Select all
/***************************************************************************
**
Search Composite
****************************************************************************
**/
package navigator;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;

public class V_Search extends Composite implements
  SelectionListener, KeyListener, DisposeListener {

private Button btnSearch;


private Text txtEquipmentSearch;

private CTabFolder tabFolder;

private Group equipmentGroup;

Cursor cursorWait = new Cursor(this.getDisplay(), SWT.CURSOR_WAIT);

public V_Search(Composite parent, int style) {
  super(parent, style);

  final GridLayout gridLayout_1 = new GridLayout();
  gridLayout_1.verticalSpacing = 3;
  gridLayout_1.marginHeight = 3;
  setLayout(gridLayout_1);

  {
   final Group grpSearch = new Group(this, SWT.NONE);
   grpSearch.setLayoutData(new GridData(
     GridData.HORIZONTAL_ALIGN_FILL));
   final GridLayout gridLayout = new GridLayout();
   gridLayout.verticalSpacing = 3;
   gridLayout.marginHeight = 3;
   gridLayout.numColumns = 5;
   grpSearch.setLayout(gridLayout);
   grpSearch.setText("Search");
   txtEquipmentSearch = new Text(grpSearch, SWT.BORDER);
   final GridData gridData_1 = new GridData(GridData.GRAB_HORIZONTAL |
GridData.HORIZONTAL_ALIGN_END);
   gridData_1.widthHint = 80;
   txtEquipmentSearch.setLayoutData(gridData_1);
   txtEquipmentSearch.addKeyListener(this);
   txtEquipmentSearch.setTopIndex(1);
   txtEquipmentSearch.setFocus();

   btnSearch = new Button(grpSearch, SWT.NONE);
   btnSearch.setSelection(true);
   btnSearch.addSelectionListener(this);
   final GridData gridData_4 = new GridData(
     GridData.HORIZONTAL_ALIGN_END);
   gridData_4.widthHint = 83;
   btnSearch.setLayoutData(gridData_4);
   btnSearch.setText("Search");

  }
  {
   equipmentGroup = new Group(this, SWT.NONE);
   equipmentGroup.setLayout(new FillLayout());
   equipmentGroup.setText("Equipment");
   final GridData gridData_7 = new GridData(GridData.FILL_BOTH);
   //gridData_7.heightHint = 500;
   //gridData_7.widthHint = 890;
   equipmentGroup.setLayoutData(gridData_7);
   {
    tabFolder = new CTabFolder(equipmentGroup, SWT.CLOSE | SWT.FLAT);
    tabFolder.addSelectionListener(this);
    tabFolder.setUnselectedCloseVisible(false);
    tabFolder.setSimple(false);
    //tabFolder.setSize(550, 975);
   }
  }

}

public void addCustomTab(Composite vue, String titre) {
  CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE);
  tabItem.addDisposeListener(this);
  {
   vue.setLayout(new GridLayout());
   tabItem.setControl(vue);
   tabItem.setText(titre);
   tabFolder.setSelection(tabItem);
  }
  getShell().pack(true);
  txtEquipmentSearch.setFocus();
  txtEquipmentSearch.selectAll();
}

public Composite getContainer() {
  return tabFolder;
}

public void dispose() {
  cursorWait.dispose();
  super.dispose();
}

public void widgetDefaultSelected(SelectionEvent e) {
}

public void widgetSelected(SelectionEvent e) {
  if (e.getSource() == getContainer())
   do_tabFolder_widgetSelected(e);
  if (e.getSource() == btnSearch)
   do_btnRechercher_widgetSelected(e);
}

public void keyPressed(KeyEvent e) {
  if (e.getSource() == txtEquipmentSearch)
   do_txtEquipementRecherche_keyPressed(e);
}

public void keyReleased(KeyEvent e) {
}

protected void do_txtEquipementRecherche_keyPressed(KeyEvent e) {
  if (e.keyCode == SWT.KEYPAD_CR || e.keyCode == SWT.CR) {
   searchEquipment();
  }
}

protected void do_btnRechercher_widgetSelected(SelectionEvent e) {
  searchEquipment();
}

private void searchEquipment() {
  this.setCursor(cursorWait);
  V_Equipment equip = new V_Equipment(getContainer(),SWT.NONE);
  addCustomTab(equip, "99999");

  this.setCursor(null);
  txtEquipmentSearch.setFocus();
  txtEquipmentSearch.selectAll();
}

public void widgetDisposed(DisposeEvent e) {
  if (e.getSource() instanceof CTabItem)
   do_tabItem_widgetDisposed(e);
}

protected void do_tabItem_widgetDisposed(DisposeEvent e) {
}

protected void do_comboRecherche_widgetSelected(SelectionEvent e) {
  txtEquipmentSearch.setFocus();
}

protected void do_tabFolder_widgetSelected(SelectionEvent e) {
}

}


V_Equipment.java
Code: Select all
/***************************************************************************
**
Result / Equipment Composite
****************************************************************************
**/
package navigator;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
import com.swtdesigner.SWTResourceManager;


public class V_Equipment extends Composite implements SelectionListener,
KeyListener {

private Button btnRefresh;
static V_Equipment EquipmentCourant;

private Button btnAccess;

private Button btnComplet;

private Button btnOpen;

private Button btnModifyId;

private Button btnModifyModel;

private Button btnPassword;

private Button btnRestart;

private Button btnNoAccess;

Cursor cursorWait = new Cursor(this.getDisplay(), SWT.CURSOR_WAIT);

private Group grpEquipment;

private Group grpStatistics;

String[] modeles;

private Table tblProfilTemporaire;

private Text txtAccesSysteme;

private Text txtCity;

private Text txtAigEtat;

private Text txtDernMessageRecu;

private Text txtDernMsgEnvoye;

private Text txtDetaillant;

private Text txtDistAdresseIP;

private Text txtDistErreurCode;

private Text txtDistErreurDesc;

private Text txtDistErreurTimestamp;

private Text txtDistEtat;

private Text txtDistId;

private Text txtDistNbErreurs;

private Text txtDistPort;

private Text txtDistTimestamp;

private Text txtFinOperation;

private Text txtIdAig;

private Text txtIdElectronic;

private Text txtIntersection;

private Text txtModel;

private Text txtNbMsgsEnvoyes;

private Text txtNbMsgsRecus;

private Text txtNoDetaillant;

private Text txtNoEquipment;

private Text txtProfilBase;

private Text txtResponsable;

private Text txtStatus;

private Text txtPhone;

private Text txtTransactionEnCours;

private Text txtUtilisation;

private Text txtCity2;

public V_Equipment(Composite parent, int style) {
  super(parent, style);
  EquipmentCourant = this;
  final GridLayout gridLayout_1 = new GridLayout();
  gridLayout_1.verticalSpacing = 0;
  gridLayout_1.marginWidth = 0;
  gridLayout_1.marginHeight = 0;
  gridLayout_1.horizontalSpacing = 0;
  setLayout(gridLayout_1);
  {
   final GridLayout gridLayout = new GridLayout();
   gridLayout.marginHeight = 3;
   gridLayout.verticalSpacing = 0;
   gridLayout.numColumns = 2;
   grpEquipment = new Group(this, SWT.NONE);
   grpEquipment.setLayout(gridLayout);
   grpEquipment.setText("Équipment");
   grpEquipment.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
     | GridData.VERTICAL_ALIGN_BEGINNING));

   final Composite compositeInfoEquipment = new Composite(grpEquipment,
SWT.NONE);
   compositeInfoEquipment.setLayoutData(new
GridData(GridData.FILL_HORIZONTAL));
   final GridLayout gridLayout_8 = new GridLayout();
   gridLayout_8.verticalSpacing = 0;
   gridLayout_8.marginWidth = 0;
   gridLayout_8.marginHeight = 0;
   gridLayout_8.makeColumnsEqualWidth = true;
   gridLayout_8.numColumns = 2;
   compositeInfoEquipment.setLayout(gridLayout_8);

   final Composite compositeDetailEquipment = new
Composite(compositeInfoEquipment, SWT.NONE);
   compositeDetailEquipment.setLayoutData(new
GridData(GridData.FILL_HORIZONTAL));
   final GridLayout gridLayout_6 = new GridLayout();
   gridLayout_6.numColumns = 2;
   compositeDetailEquipment.setLayout(gridLayout_6);
    {
     final Label lblNoEquipment = new Label(compositeDetailEquipment,
       SWT.NONE);
     lblNoEquipment.setText("No equipment");
    }
    {
     txtNoEquipment = new Text(compositeDetailEquipment, SWT.READ_ONLY
       | SWT.BORDER);
     final GridData gridData = new GridData();
     gridData.widthHint = 45;
     txtNoEquipment.setLayoutData(gridData);
     txtNoEquipment.setBackground(SWTResourceManager.getColor(
       218, 218, 218));
    }
    {
     final Label lblIdElectronic = new Label(compositeDetailEquipment,
       SWT.RIGHT);
     lblIdElectronic.setText("Id. electronic");
    }
    {
     txtIdElectronic = new Text(compositeDetailEquipment, SWT.READ_ONLY
       | SWT.BORDER);
     final GridData gridData = new GridData();
     gridData.widthHint = 50;
     txtIdElectronic.setLayoutData(gridData);
     txtIdElectronic.setBackground(SWTResourceManager
       .getColor(218, 218, 218));
    }
    {
     final Label modelLabel = new Label(compositeDetailEquipment, SWT.NONE);
     modelLabel.setText("Model");
    }
    {
     txtModel = new Text(compositeDetailEquipment, SWT.READ_ONLY
       | SWT.BORDER);
     final GridData gridData = new GridData();
     gridData.widthHint = 50;
     txtModel.setLayoutData(gridData);
     txtModel.setBackground(SWTResourceManager.getColor(218,
       218, 218));
    }
    {
     final Label lblUtilisation = new Label(compositeDetailEquipment,
       SWT.SHADOW_NONE);
     lblUtilisation.setText("Utilisation");
    }
    {
     txtUtilisation = new Text(compositeDetailEquipment, SWT.READ_ONLY
       | SWT.BORDER);
     final GridData gridData = new GridData();
     gridData.widthHint = 90;
     txtUtilisation.setLayoutData(gridData);
     txtUtilisation.setBackground(SWTResourceManager.getColor(
       218, 218, 218));
    }
    {
     final Label lblStatus = new Label(compositeDetailEquipment, SWT.NONE);
     lblStatus.setText("Status");
    }
    {
     txtStatus = new Text(compositeDetailEquipment, SWT.READ_ONLY
       | SWT.BORDER);
     final GridData gridData = new GridData();
     gridData.widthHint = 30;
     txtStatus.setLayoutData(gridData);
     txtStatus.setBackground(SWTResourceManager.getColor(218,
       218, 218));
    }
    {
     final Label lblEndOperation = new Label(compositeDetailEquipment,
       SWT.NONE);
     lblEndOperation.setText("End operation");
    }
    {
     txtFinOperation = new Text(compositeDetailEquipment, SWT.READ_ONLY
       | SWT.BORDER);
     final GridData gridData = new GridData();
     gridData.widthHint = 90;
     txtFinOperation.setLayoutData(gridData);
     txtFinOperation.setBackground(SWTResourceManager.getColor(
       218, 218, 218));
    }
    {
     final Label lblProfilBase = new Label(compositeDetailEquipment,
       SWT.NONE);
     lblProfilBase.setText("Profil ");
    }
    {
     txtProfilBase = new Text(compositeDetailEquipment, SWT.READ_ONLY
       | SWT.BORDER);
     final GridData gridData = new GridData();
     gridData.widthHint = 150;
     txtProfilBase.setLayoutData(gridData);
     txtProfilBase.setBackground(SWTResourceManager.getColor(
       218, 218, 218));
    }

   final Composite compositeDetail = new Composite(compositeInfoEquipment,
SWT.NONE);
   compositeDetail.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   final GridLayout gridLayout_7 = new GridLayout();
   gridLayout_7.marginRight = 10;
   gridLayout_7.numColumns = 2;
   compositeDetail.setLayout(gridLayout_7);
    {
     final Label lblNoDetail = new Label(compositeDetail,
       SWT.RIGHT);
     lblNoDetail.setText("No");
    }
    {
     txtNoDetaillant = new Text(compositeDetail, SWT.READ_ONLY
       | SWT.BORDER);
     final GridData gridData = new GridData();
     gridData.widthHint = 70;
     txtNoDetaillant.setLayoutData(gridData);
     txtNoDetaillant.setBackground(SWTResourceManager.getColor(
       218, 218, 218));
    }
    {
     final Label lblName = new Label(compositeDetail,
       SWT.RIGHT);
     lblName.setText("Name");
    }
    {
     txtDetaillant = new Text(compositeDetail, SWT.READ_ONLY
       | SWT.BORDER);
     final GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
     txtDetaillant.setLayoutData(gridData);
     txtDetaillant.setBackground(SWTResourceManager.getColor(
       218, 218, 218));
    }
    {
     final Label lblResponsible = new Label(compositeDetail,
       SWT.NONE);
     lblResponsible.setText("Responsable");
    }
    {
     txtResponsable = new Text(compositeDetail, SWT.READ_ONLY
       | SWT.BORDER);
     txtResponsable.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
     txtResponsable.setBackground(SWTResourceManager.getColor(
       218, 218, 218));
    }

    {
     final Label lblAddress = new Label(compositeDetail, SWT.RIGHT);
     lblAddress.setText("Address");
    }
    {
     txtCity = new Text(compositeDetail, SWT.READ_ONLY
       | SWT.BORDER);
     txtCity.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
     txtCity.setBackground(SWTResourceManager.getColor(218,
       218, 218));
    }
    {
     final Label lblPadding = new Label(compositeDetail,
       SWT.NONE);
    }
    {
     txtCity2 = new Text(compositeDetail, SWT.READ_ONLY
       | SWT.BORDER);
     txtCity2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
GridData.VERTICAL_ALIGN_BEGINNING));
     txtCity2.setBackground(SWTResourceManager.getColor(218,
       218, 218));
    }
    {
     final Label lblIntersecton = new Label(compositeDetail,
       SWT.RIGHT);
     lblIntersecton.setText("Intersection");
    }
    {
     txtIntersection = new Text(compositeDetail, SWT.READ_ONLY
       | SWT.BORDER);
     txtIntersection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
     txtIntersection.setBackground(SWTResourceManager.getColor(
       218, 218, 218));
    }
    {
     final Label lblPhone = new Label(compositeDetail,
       SWT.NONE);
     lblPhone.setText("Phone");
    }
    {
     txtPhone = new Text(compositeDetail, SWT.READ_ONLY
       | SWT.BORDER);
     final GridData gridData = new GridData();
     gridData.widthHint = 144;
     txtPhone.setLayoutData(gridData);
     txtPhone.setBackground(SWTResourceManager.getColor(218,
       218, 218));
    }
   {

    final Group grpBoutonModification = new Group(grpEquipment,
      SWT.NONE);
    grpBoutonModification.setText("Modification");
    final GridData gridData_4 = new GridData(
      GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL);
    gridData_4.widthHint = 115;
    grpBoutonModification.setLayoutData(gridData_4);
    final GridLayout gridLayout_3 = new GridLayout();
    gridLayout_3.marginHeight = 3;
    gridLayout_3.verticalSpacing = 15;
    grpBoutonModification.setLayout(gridLayout_3);
    {
     btnModifyModel = new Button(grpBoutonModification,
       SWT.NONE);
     btnModifyModel.setLayoutData(new GridData(
       GridData.FILL_HORIZONTAL));
     btnModifyModel.addSelectionListener(this);
     btnModifyModel.setText("Model");
    }
    {
     btnModifyId = new Button(grpBoutonModification,
       SWT.NONE);
     btnModifyId.setLayoutData(new GridData(
       GridData.HORIZONTAL_ALIGN_FILL));
     btnModifyId.addSelectionListener(this);
     btnModifyId.setText("Id");
    }
    {

     btnPassword = new Button(grpBoutonModification, SWT.NONE);
     final GridData gridData = new GridData(
       GridData.HORIZONTAL_ALIGN_FILL);
     btnPassword.setLayoutData(gridData);
     btnPassword.addSelectionListener(this);
     btnPassword.setText("Password");
    }
    {

     btnComplet = new Button(
       grpBoutonModification, SWT.WRAP);
     final GridData gridData = new GridData(
       GridData.HORIZONTAL_ALIGN_FILL);
     btnComplet.setLayoutData(gridData);
     btnComplet.addSelectionListener(this);
     btnComplet.setText("Complet");
    }
   }
   grpStatistics = new Group(this, SWT.NONE);
   grpStatistics.setText("Statistics");
   final GridLayout gridLayout_3 = new GridLayout();
   gridLayout_3.marginWidth = 3;
   gridLayout_3.verticalSpacing = 0;
   gridLayout_3.marginHeight = 3;
   gridLayout_3.numColumns = 2;
   grpStatistics.setLayout(gridLayout_3);
   grpStatistics.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING));
   {
    {
     final Group grpDistributor = new Group(grpStatistics,
       SWT.NONE);
     grpDistributor.setText("Distributor");
     final GridData gridData = new GridData(
       GridData.FILL_HORIZONTAL
         | GridData.VERTICAL_ALIGN_BEGINNING);
     gridData.verticalSpan = 2;
     grpDistributor.setLayoutData(gridData);
     final GridLayout gridLayout_2 = new GridLayout();
     gridLayout_2.verticalSpacing = 3;
     gridLayout_2.marginHeight = 3;
     gridLayout_2.numColumns = 6;
     grpDistributor.setLayout(gridLayout_2);
     {
      final Label lblDistState = new Label(grpDistributor,
        SWT.SHADOW_NONE);
      final GridData gridData_1 = new GridData(GridData.GRAB_VERTICAL);
      gridData_1.widthHint = 30;
      lblDistState.setLayoutData(gridData_1);
      lblDistState.setText("State");
     }
     {
      txtDistEtat = new Text(grpDistributor, SWT.READ_ONLY
        | SWT.BORDER);
      txtDistEtat.setBackground(SWTResourceManager.getColor(
        218, 218, 218));
      final GridData gridData_1 = new GridData(GridData.GRAB_VERTICAL);
      gridData_1.widthHint = 90;
      txtDistEtat.setLayoutData(gridData_1);
     }
     {
      final Label lblDistId = new Label(grpDistributor,
        SWT.NONE);
      lblDistId.setLayoutData(new GridData(GridData.GRAB_VERTICAL));
      lblDistId.setText("Id. Dist.");
     }
     {
      txtDistId = new Text(grpDistributor, SWT.READ_ONLY
        | SWT.BORDER);
      txtDistId.setBackground(SWTResourceManager.getColor(
        218, 218, 218));
      final GridData gridData_1 = new GridData(GridData.GRAB_VERTICAL);
      gridData_1.widthHint = 20;
      txtDistId.setLayoutData(gridData_1);
     }
     {
      final Group grpIdSocket = new Group(grpDistributor,
        SWT.NONE);
      grpIdSocket.setText("Id. Socket");
      final GridData gridData_1 = new GridData(
        GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END);
      gridData_1.verticalSpan = 2;
      gridData_1.horizontalSpan = 2;
      gridData_1.heightHint = 35;
      grpIdSocket.setLayoutData(gridData_1);
      final GridLayout gridLayout_4 = new GridLayout();
      gridLayout_4.marginHeight = 3;
      gridLayout_4.verticalSpacing = 3;
      gridLayout_4.numColumns = 6;
      grpIdSocket.setLayout(gridLayout_4);
      {
       final Label lblDistTimestamp = new Label(
         grpIdSocket, SWT.NONE);
       final GridData gridData_2 = new GridData(
         GridData.HORIZONTAL_ALIGN_END);
       lblDistTimestamp.setLayoutData(gridData_2);
       lblDistTimestamp.setText("Timestamp");
      }
      {
       txtDistTimestamp = new Text(grpIdSocket,
         SWT.READ_ONLY | SWT.BORDER);
       txtDistTimestamp.setBackground(SWTResourceManager
         .getColor(218, 218, 218));
       final GridData gridData_2 = new GridData(
         GridData.HORIZONTAL_ALIGN_FILL);
       gridData_2.widthHint = 185;

       txtDistTimestamp.setLayoutData(gridData_2);
      }
      {
       final Label lblDistAddressIP = new Label(
         grpIdSocket, SWT.NONE);
       final GridData gridData_2 = new GridData(
         GridData.HORIZONTAL_ALIGN_END);
       lblDistAddressIP.setLayoutData(gridData_2);
       lblDistAddressIP.setText("Address IP");
      }
      {
       txtDistAdresseIP = new Text(grpIdSocket,
         SWT.READ_ONLY | SWT.BORDER);
       txtDistAdresseIP.setBackground(SWTResourceManager
         .getColor(218, 218, 218));
       final GridData gridData_2 = new GridData(
         GridData.HORIZONTAL_ALIGN_FILL);
       gridData_2.widthHint = 115;
       txtDistAdresseIP.setLayoutData(gridData_2);
      }
      {
       final Label lblDistPort = new Label(grpIdSocket,
         SWT.NONE);
       final GridData gridData_2 = new GridData(
         GridData.HORIZONTAL_ALIGN_END);
       lblDistPort.setLayoutData(gridData_2);
       lblDistPort.setText("Port");
      }
      {
       txtDistPort = new Text(grpIdSocket, SWT.READ_ONLY
         | SWT.BORDER);
       txtDistPort.setBackground(SWTResourceManager
         .getColor(218, 218, 218));
       final GridData gridData_2 = new GridData(
         GridData.HORIZONTAL_ALIGN_END);
       gridData_2.widthHint = 50;
       txtDistPort.setLayoutData(gridData_2);
      }
     }

     final Group grpError = new Group(grpDistributor, SWT.NONE);
     grpError.setText("Error");
     final GridData gridData_5 = new GridData(
       GridData.FILL_HORIZONTAL);
     gridData_5.horizontalSpan = 5;
     grpError.setLayoutData(gridData_5);
     final GridLayout gridLayout_4 = new GridLayout();
     gridLayout_4.marginHeight = 3;
     gridLayout_4.verticalSpacing = 3;
     gridLayout_4.numColumns = 6;
     grpError.setLayout(gridLayout_4);
     {
      final Label lblDistErreurTimestamp = new Label(
        grpError, SWT.NONE);
      lblDistErreurTimestamp.setText("Timestamp");
     }
     {
      txtDistErreurTimestamp = new Text(grpError,
        SWT.READ_ONLY | SWT.BORDER);
      txtDistErreurTimestamp.setBackground(SWTResourceManager
        .getColor(218, 218, 218));
      final GridData gridData_1 = new GridData(
        GridData.HORIZONTAL_ALIGN_FILL);
      gridData_1.widthHint = 185;
      txtDistErreurTimestamp.setLayoutData(gridData_1);
     }

     final Label lblDistErreurCode = new Label(grpError,
       SWT.NONE);
     lblDistErreurCode.setText("Code");

     txtDistErreurCode = new Text(grpError, SWT.READ_ONLY
       | SWT.BORDER);
     txtDistErreurCode.setBackground(SWTResourceManager
       .getColor(218, 218, 218));
     final GridData gridData_3 = new GridData(
       GridData.HORIZONTAL_ALIGN_FILL);
     gridData_3.widthHint = 42;
     txtDistErreurCode.setLayoutData(gridData_3);

     final Label lblDistErreurDesc = new Label(grpError,
       SWT.NONE);
     lblDistErreurDesc.setText("Desc.");

     txtDistErreurDesc = new Text(grpError, SWT.READ_ONLY
       | SWT.BORDER);
     txtDistErreurDesc.setBackground(SWTResourceManager
       .getColor(218, 218, 218));
     final GridData gridData_4 = new GridData(
       GridData.FILL_HORIZONTAL);
     gridData_4.widthHint = 125;
     txtDistErreurDesc.setLayoutData(gridData_4);

     final Composite composite = new Composite(grpDistributor, SWT.NONE);
     composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
     final GridLayout gridLayout_5 = new GridLayout();
     gridLayout_5.marginWidth = 8;
     gridLayout_5.numColumns = 2;
     composite.setLayout(gridLayout_5);
     {
      final Label lblDistNbErrors = new Label(
        composite, SWT.NONE);
      lblDistNbErrors.setText("Total errors");
     }
     {
      txtDistNbErreurs = new Text(composite,
        SWT.READ_ONLY | SWT.BORDER);
      final GridData gridData_1 = new GridData();
      gridData_1.widthHint = 50;
      txtDistNbErreurs.setLayoutData(gridData_1);
      txtDistNbErreurs.setBackground(SWTResourceManager
        .getColor(218, 218, 218));
     }
    }

    final Group grpControls = new Group(grpStatistics,
      SWT.NONE);
    grpControls.setText("Controls");
    final GridData gridData_6 = new GridData(
      GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    gridData_6.widthHint = 115;
    gridData_6.verticalSpan = 3;
    grpControls.setLayoutData(gridData_6);
    final GridLayout gridLayout_5 = new GridLayout();
    gridLayout_5.marginHeight = 3;
    gridLayout_5.verticalSpacing = 15;
    grpControls.setLayout(gridLayout_5);
    {
     btnAccess = new Button(grpControls, SWT.NONE);
     btnAccess.setLayoutData(new GridData(
       GridData.FILL_HORIZONTAL));
     btnAccess.addSelectionListener(this);
     btnAccess.setText("Access");
    }
    {
     btnNoAccess = new Button(grpControls, SWT.NONE);
     btnNoAccess.addSelectionListener(this);
     btnNoAccess.setLayoutData(new GridData(
       GridData.HORIZONTAL_ALIGN_FILL));
     btnNoAccess.setText("No access");
    }
    {
     btnRestart = new Button(grpControls, SWT.NONE);
     btnRestart.addSelectionListener(this);
     btnRestart.setLayoutData(new GridData(
       GridData.HORIZONTAL_ALIGN_FILL));
     btnRestart.setText("Restart");
    }
    {
     btnOpen = new Button(grpControls, SWT.NONE);
     btnOpen.addSelectionListener(this);
     btnOpen.setLayoutData(new GridData(
       GridData.HORIZONTAL_ALIGN_FILL));
     btnOpen.setText("Open");
    }
    {
     final Group grpSwitch = new Group(grpStatistics,
       SWT.NONE);
     final GridLayout gridLayout_2 = new GridLayout();
     gridLayout_2.verticalSpacing = 3;
     gridLayout_2.horizontalSpacing = 10;
     gridLayout_2.marginHeight = 3;
     gridLayout_2.numColumns = 7;
     grpSwitch.setLayout(gridLayout_2);
     final GridData gridData = new GridData(GridData.FILL_BOTH);
     gridData.verticalSpan = 2;
     grpSwitch.setLayoutData(gridData);
     grpSwitch.setText("Switch");

     final Label lblState = new Label(grpSwitch, SWT.NONE);
     final GridData gridData_4 = new GridData();
     gridData_4.widthHint = 30;
     lblState.setLayoutData(gridData_4);
     lblState.setText("State");
     {
      txtAigEtat = new Text(grpSwitch, SWT.READ_ONLY
        | SWT.BORDER);
      txtAigEtat.setBackground(SWTResourceManager.getColor(
        218, 218, 218));
      final GridData gridData_1 = new GridData();
      gridData_1.widthHint = 75;
      txtAigEtat.setLayoutData(gridData_1);
     }
     {
      final Label lblIdAig = new Label(grpSwitch,
        SWT.NONE);
      lblIdAig.setText("Id. Aig.");
     }
     {
      txtIdAig = new Text(grpSwitch, SWT.READ_ONLY
        | SWT.BORDER);
      txtIdAig.setBackground(SWTResourceManager.getColor(218,
        218, 218));
      final GridData gridData_1 = new GridData();
      gridData_1.widthHint = 25;
      txtIdAig.setLayoutData(gridData_1);
     }
     {
      final Label lblDernMessageRecu = new Label(
        grpSwitch, SWT.NONE);
      final GridData gridData_1 = new GridData();
      gridData_1.horizontalIndent = 110;
      lblDernMessageRecu.setLayoutData(gridData_1);
      lblDernMessageRecu.setText("Last msg");
     }
     {
      txtDernMessageRecu = new Text(grpSwitch,
        SWT.READ_ONLY | SWT.BORDER);
      txtDernMessageRecu.setBackground(SWTResourceManager
        .getColor(218, 218, 218));
      final GridData gridData_1 = new GridData();
      gridData_1.widthHint = 135;
      txtDernMessageRecu.setLayoutData(gridData_1);
     }

     final Composite composite = new Composite(grpSwitch, SWT.NONE);
     final GridData gridData_2 = new GridData(GridData.GRAB_HORIZONTAL |
GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_BEGINNING);
     gridData_2.verticalSpan = 3;
     composite.setLayoutData(gridData_2);
     final GridLayout gridLayout_4 = new GridLayout();
     gridLayout_4.marginWidth = 0;
     gridLayout_4.marginRight = 8;
     gridLayout_4.marginHeight = 0;
     gridLayout_4.numColumns = 2;
     composite.setLayout(gridLayout_4);
     {
      final Label nbMsgsReceivedLabel = new Label(composite, SWT.NONE);
      nbMsgsReceivedLabel.setText("Nb msgs received");
     }
     {
      txtNbMsgsRecus = new Text(composite, SWT.READ_ONLY
        | SWT.BORDER);
      final GridData gridData_1 = new
GridData(GridData.HORIZONTAL_ALIGN_END);
      gridData_1.widthHint = 50;
      txtNbMsgsRecus.setLayoutData(gridData_1);
      txtNbMsgsRecus.setBackground(SWTResourceManager
        .getColor(218, 218, 218));
     }
     {
      final Label nbMsgsSentLabel = new Label(composite, SWT.NONE);
      nbMsgsSentLabel.setText("Nb msgs sent");
     }
     {
      txtNbMsgsEnvoyes = new Text(composite,
        SWT.READ_ONLY | SWT.BORDER);
      txtNbMsgsEnvoyes.setData("nom", "txtNbMsgsEnvoyes");
      final GridData gridData_1 = new
GridData(GridData.HORIZONTAL_ALIGN_END);
      gridData_1.widthHint = 50;
      txtNbMsgsEnvoyes.setLayoutData(gridData_1);
      txtNbMsgsEnvoyes.setBackground(SWTResourceManager
        .getColor(218, 218, 218));
     }
     {
      final Label transLabel = new Label(composite, SWT.NONE);
      transLabel.setText("Trans.");
     }
     {
      txtTransactionEnCours = new Text(composite,
        SWT.READ_ONLY | SWT.BORDER);
      final GridData gridData_1 = new
GridData(GridData.HORIZONTAL_ALIGN_END);
      gridData_1.widthHint = 50;
      txtTransactionEnCours.setLayoutData(gridData_1);
      txtTransactionEnCours.setBackground(SWTResourceManager
        .getColor(218, 218, 218));
     }
     {
      final Label accessLabel = new Label(grpSwitch, SWT.NONE);
      final GridData gridData_1 = new GridData();
      gridData_1.horizontalSpan = 2;
      accessLabel.setLayoutData(gridData_1);
      accessLabel.setText("Access");
     }
     {
      txtAccesSysteme = new Text(grpSwitch, SWT.READ_ONLY
        | SWT.BORDER);
      txtAccesSysteme.setBackground(SWTResourceManager
        .getColor(218, 218, 218));
      final GridData gridData_1 = new GridData();
      gridData_1.widthHint = 70;
      gridData_1.horizontalSpan = 2;
      txtAccesSysteme.setLayoutData(gridData_1);
     }
     {
      final Label lastMsgSentLabel = new Label(grpSwitch, SWT.NONE);
      final GridData gridData_1 = new GridData();
      gridData_1.horizontalIndent = 110;
      lastMsgSentLabel.setLayoutData(gridData_1);
      lastMsgSentLabel.setText("Last msg sent");
     }
     {
      txtDernMsgEnvoye = new Text(grpSwitch,
        SWT.READ_ONLY | SWT.BORDER);
      txtDernMsgEnvoye.setBackground(SWTResourceManager
        .getColor(218, 218, 218));
      final GridData gridData_1 = new GridData();
      gridData_1.widthHint = 135;
      txtDernMsgEnvoye.setLayoutData(gridData_1);
     }
     {
      final Label profilLabel = new Label(grpSwitch, SWT.NONE);
      final GridData gridData_1 = new GridData(
        GridData.VERTICAL_ALIGN_BEGINNING);
      gridData_1.horizontalSpan = 2;
      profilLabel.setLayoutData(gridData_1);
      profilLabel.setText("Profil");
     }

     tblProfilTemporaire = new Table(grpSwitch,
       SWT.FULL_SELECTION | SWT.BORDER);
     tblProfilTemporaire.setBackground(SWTResourceManager
       .getColor(218, 218, 218));
     final GridData gridData_3 = new GridData(
       GridData.HORIZONTAL_ALIGN_FILL
         | GridData.FILL_VERTICAL);
     gridData_3.widthHint = 396;
     gridData_3.horizontalSpan = 4;
     gridData_3.heightHint = 50;
     tblProfilTemporaire.setLayoutData(gridData_3);
     tblProfilTemporaire.setHeaderVisible(true);

     final TableColumn colProfilNom = new TableColumn(
       tblProfilTemporaire, SWT.NONE);
     colProfilNom.setWidth(73);
     colProfilNom.setText("Nom");

     final TableColumn colProfilDescription = new TableColumn(
       tblProfilTemporaire, SWT.NONE);
     colProfilDescription.setWidth(166);
     colProfilDescription.setText("Description");

     final TableColumn colProfilAssignation = new TableColumn(
       tblProfilTemporaire, SWT.NONE);
     colProfilAssignation.setResizable(false);
     colProfilAssignation.setWidth(174);
     colProfilAssignation.setText("Assignation");
    }
   }
   {
   btnRefresh = new Button(grpStatistics, SWT.NONE);
   btnRefresh.addSelectionListener(this);
   final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
   gridData.widthHint = 105;
   btnRefresh.setLayoutData(gridData);
   btnRefresh.setText("Refresh");
   }
  }
}

public void dispose() {
  super.dispose();
  SWTResourceManager.disposeColors();
  cursorWait.dispose();
}
public void keyPressed(KeyEvent e) {
}

public void keyReleased(KeyEvent e) {
}

public void widgetDefaultSelected(SelectionEvent e) {
}

public void widgetSelected(SelectionEvent e) {
}

}


This message also has bin posted on eclipse.org at http://www.eclipse.org/newsportal/artic ... comer#3993
Sebastien
Sebastien
 
Posts: 16
Joined: Thu Jun 02, 2005 12:18 pm
Location: Canada

Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest