Project

General

Profile

« Previous | Next » 

Revision 84724c61

Added by Andreas Kohlbecker over 6 years ago

fix #6846 improving AbstractPageView layout

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/AbstractPageView.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.view;
10 10

  
11
import java.util.ArrayList;
12
import java.util.List;
13

  
11 14
import com.vaadin.shared.ui.label.ContentMode;
12
import com.vaadin.ui.CssLayout;
15
import com.vaadin.ui.AbstractLayout;
16
import com.vaadin.ui.Component;
13 17
import com.vaadin.ui.Label;
18
import com.vaadin.ui.VerticalLayout;
14 19
import com.vaadin.ui.themes.ValoTheme;
15 20

  
16 21
import eu.etaxonomy.vaadin.mvp.AbstractPresenter;
......
27 32
 */
28 33
public abstract class AbstractPageView<P extends AbstractPresenter> extends AbstractView<P>  {
29 34

  
30
    private CssLayout layout;
35
    private VerticalLayout layout;
36

  
37
    private List<Component> contentComponents = new ArrayList<>();
31 38

  
32 39
    private Label header;
33 40

  
......
36 43
     *
37 44
     */
38 45
    public AbstractPageView() {
39
        layout = new CssLayout();
46
        layout = new VerticalLayout();
40 47
        layout.setSizeFull();
41 48

  
42 49
        header = new Label();
......
51 58
    }
52 59

  
53 60
    /**
54
     * 
61
     *
55 62
     */
56 63
    public void updateHeader() {
57 64
        header.setValue("<div id=\"header\">" + getHeaderText() + "</div><div id=\"subheader\">" + getSubHeaderText() + "</div>");
58 65
    }
59 66

  
60
    protected CssLayout getLayout() {
67
    protected AbstractLayout getLayout() {
61 68
        return layout;
62 69
    }
63 70

  
71
    protected void removeContentComponents(){
72
        for(Component c : contentComponents){
73
            layout.removeComponent(c);
74
        }
75

  
76
    }
77

  
78
    protected void addContentComponent(Component component, Float expandRatio){
79
        contentComponents.add(component);
80
        layout.addComponent(component);
81
        if(expandRatio != null){
82
            layout.setExpandRatio(component, expandRatio);
83
        }
84
    }
85

  
86

  
87

  
64 88
    /**
65 89
     * Provides the sub header text
66 90
     *

Also available in: Unified diff