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/registration/RegistrationWorkflowViewBean.java
22 22
import com.vaadin.server.GenericFontIcon;
23 23
import com.vaadin.server.Page;
24 24
import com.vaadin.spring.annotation.SpringView;
25
import com.vaadin.ui.AbstractLayout;
25 26
import com.vaadin.ui.Alignment;
26 27
import com.vaadin.ui.Button;
27 28
import com.vaadin.ui.Component;
......
69 70
public class RegistrationWorkflowViewBean extends AbstractPageView<RegistrationWorkflowPresenter>
70 71
    implements RegistrationWorkflowView, View, AccessRestrictedView {
71 72

  
72

  
73
    public static final String DOM_ID_WORKFLOW = "workflow-container";
74

  
75 73
    public static final String DOM_ID_WORKINGSET = "workingset";
76 74

  
77 75
    private static final long serialVersionUID = -213040114015958970L;
......
82 80

  
83 81
    public RegistrationType regType = null;
84 82

  
85
    private CssLayout workflow;
86

  
87 83
    private List<CssLayout> registrations = new ArrayList<>();
88 84

  
89 85
    private String headerText = "-- empty --";
......
97 93

  
98 94
    private LazyComboBox<TaxonName> existingNameCombobox;
99 95

  
100
    // private Button addExistingNameRegistrationButton;
101

  
102 96
    private GridLayout registrationsGrid;
103 97

  
104 98
    private Button addExistingNameButton;
105 99

  
100
    private RegistrationItem workingsetHeader;
101

  
102
    private Panel registrationListPanel;
103

  
106 104
    public RegistrationWorkflowViewBean() {
107 105
        super();
108 106
    }
109 107

  
108

  
109
    /**
110
     * {@inheritDoc}
111
     */
110 112
    @Override
111 113
    protected void initContent() {
112
        workflow = new CssLayout();
113
        workflow.setSizeFull();
114
        workflow.setId(DOM_ID_WORKFLOW);
115
        getLayout().addComponent(workflow);
114
        getLayout().setId(NAME);
115
        // all content is added in createRegistrationsList()
116 116
    }
117 117

  
118

  
118 119
    /**
119 120
     * {@inheritDoc}
120 121
     */
......
132 133
     */
133 134
    @Override
134 135
    public void setWorkingset(RegistrationWorkingSet workingset) {
136
        if(workingsetHeader != null){
137
            getLayout().removeComponent(workingsetHeader);
138
            getLayout().removeComponent(registrationListPanel);
139
        }
135 140

  
136
        CssLayout registration = new CssLayout();
137
        registration.setId(DOM_ID_WORKINGSET);
138
        registration.setWidth(100, Unit.PERCENTAGE);
139

  
140
        Panel registrationListPanel = createRegistrationsList(workingset);
141
        registrationListPanel = createRegistrationsList(workingset);
141 142
        registrationListPanel.setStyleName("registration-list");
142 143
        registrationListPanel.setCaption("Registrations");
143 144

  
144

  
145
        // registration.addComponent(createWorkflowTabSheet(workingset, null));
146
        RegistrationItem registrationItem = new RegistrationItem(workingset, this);
145
        workingsetHeader = new RegistrationItem(workingset, this);
147 146
        if(UserHelper.fromSession().userIsRegistrationCurator() || UserHelper.fromSession().userIsAdmin()){
148
            registrationItem.getSubmitterLabel().setVisible(true);
149
        };
150
        registration.addComponent(registrationItem);
151
        registration.addComponent(registrationListPanel);
152

  
153
        registrations.add(registration);
154
        workflow.removeAllComponents();
155
        workflow.addComponent(registration);
147
            workingsetHeader.getSubmitterLabel().setVisible(true);
148
        }
149
        addContentComponent(workingsetHeader, null);
150
        addContentComponent(registrationListPanel, 1.0f);
151

  
156 152
    }
157 153

  
158 154
    /**
......
202 198
    public Panel createRegistrationsList(RegistrationWorkingSet workingset) {
203 199

  
204 200
        registrationsGrid = new GridLayout(3, 1);
205
        registrationsGrid.setSizeUndefined();
206
        registrationsGrid.setColumnExpandRatio(0, 0.1f);
207
        registrationsGrid.setColumnExpandRatio(1, 0.9f);
201
        registrationsGrid.setWidth("100%");
202
        // allow vertical scrolling:
203
        registrationsGrid.setHeightUndefined();
204

  
205
        //registrationsGrid.setColumnExpandRatio(0, 0.1f);
206
        registrationsGrid.setColumnExpandRatio(1, 1f);
208 207

  
209 208
        int row = 0;
210 209
        for(RegistrationDTO dto : workingset.getRegistrationDTOs()) {
211 210
            putRegistrationListComponent(registrationsGrid, row++, dto);
212 211
        }
213 212

  
214

  
215 213
        Label addRegistrationLabel_1 = new Label("Add a new registration for a");
216 214
        Label addRegistrationLabel_2 = new Label("or an");
217 215

  
......
235 233

  
236 234
        HorizontalLayout buttonContainer = new HorizontalLayout(addRegistrationLabel_1, addNewNameRegistrationButton, addRegistrationLabel_2, addExistingNameButton, existingNameCombobox);
237 235
        buttonContainer.setSpacing(true);
238
        buttonContainer.setWidth(100, Unit.PERCENTAGE);
236
//        buttonContainer.setWidth(100, Unit.PERCENTAGE);
239 237
        buttonContainer.setComponentAlignment(addRegistrationLabel_1, Alignment.MIDDLE_LEFT);
240 238
        buttonContainer.setComponentAlignment(addRegistrationLabel_2, Alignment.MIDDLE_LEFT);
241
        registrationsGrid.addComponent(buttonContainer, 1, row, 1, row);
239
        registrationsGrid.addComponent(buttonContainer, 0, row, 2, row);
240
        registrationsGrid.setComponentAlignment(buttonContainer, Alignment.MIDDLE_RIGHT);
242 241

  
243 242
        Panel namesTypesPanel = new Panel(registrationsGrid);
244
        namesTypesPanel.setHeight("300px");
243
        namesTypesPanel.setSizeFull();
245 244
        return namesTypesPanel;
246 245
    }
247 246

  
......
513 512
     * {@inheritDoc}
514 513
     */
515 514
    @Override
516
    public CssLayout getWorkflow() {
517
        return workflow;
515
    public AbstractLayout getWorkflow() {
516
        return getLayout();
518 517
    }
519 518

  
520 519
    /**
......
572 571
    }
573 572

  
574 573

  
575

  
576 574
}

Also available in: Unified diff