TableViewer : limit the height of Table in section

100 Views Asked by At

i have many section in FormPage on EclipseRPC. in a Section, i have a TableViewer with Add and others buttons.

My problem is simple. the items are added correctly to the table and the table keep his same height and vertical scrollbar appears (Perfect). But when I reopen the page, the table expands (height) to display all of the items while the table has a vertical scrollbar.

I want the table height to remain fixed.

Her my code

private void createSectionStructureSimple(FormToolkit toolkit, ScrolledForm form) {
        
        Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.EXPANDED|Section.TWISTIE);
        
        section.setText("Structure simple");
        section.setDescription("Indiquez ci-dessous les donn\u00e9es brutes de structures simples et les donn\u00e9es communes qui seront export\u00e9es :");
        section.setLayoutData("grow");
    
        MigLayout lm = new MigLayout("wrap 2", "[grow] []","[] [] [] [grow]");
        Composite comp = toolkit.createComposite(section);
        comp.setLayout(lm);
        
        Label label = new Label(comp, SWT.NONE);
        label.setText("Nom du fichier CSV : ");
        FontDescriptor boldDescriptor = FontDescriptor.createFrom(label.getFont()).setStyle(SWT.BOLD);
        Font boldFont = boldDescriptor.createFont(label.getDisplay());
        label.setFont( boldFont );
        toolkit.createLabel(comp, "");
        

        filenameSimpleField = new Text(comp, SWT.BORDER | SWT.SINGLE);
        filenameSimpleField.setLayoutData("grow");
        filenameSimpleField.setText(metaInfo.getNomFichierExportStructureSimple());
        filenameSimpleField.addModifyListener(new StructureSimpleNameModifyListener(metaInfo));
        toolkit.createLabel(comp, "");
    
        Table managerTable = toolkit.createTable(comp, SWT.MULTI);
        TableViewer viewerStructSimple = new TableViewer(managerTable);
        managerTable.setLayoutData("span 1 4, grow");
        
        addDonneesimple = toolkit.createButton(comp, "Ajouter donnée brute", SWT.PUSH); 
        addDonneesimple.addSelectionListener(new StructureSimpleAddingListener((PollEditor)getEditor(), getSite(), viewerStructSimple, toolkit));
        addDonneesimple.setLayoutData("growx");
        
        suppDonneesimple = toolkit.createButton(comp, "Supprimer donnée brute", SWT.PUSH); 
        suppDonneesimple.setLayoutData("growx");
        suppDonneesimple.setEnabled(false);
        suppDonneesimple.addSelectionListener(new StructureSimpleDeletionListener(getSite(), viewerStructSimple));
        viewerStructSimple.addSelectionChangedListener(new StructureSimpleTableSelectionListener(suppDonneesimple));
        viewerStructSimple.setContentProvider(new StructureSimpleContentProvider(this));
        viewerStructSimple.setLabelProvider(new StructureSimpleLabelProvider());
        viewerStructSimple.setInput(((PollEditor) getEditor()).getMetaInfo());
        CapibaraUIActivator.getDefault().addPropertyChangeListener(this);
        
        toolkit.paintBordersFor(comp);
        section.setClient(comp);

    }

Thanks by advance.

0

There are 0 best solutions below