Revision c7627153
Added by Andreas Kohlbecker about 7 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkflowViewBean.java | ||
---|---|---|
20 | 20 |
import com.vaadin.server.GenericFontIcon; |
21 | 21 |
import com.vaadin.server.Page; |
22 | 22 |
import com.vaadin.spring.annotation.SpringView; |
23 |
import com.vaadin.ui.Alignment; |
|
23 | 24 |
import com.vaadin.ui.Button; |
24 | 25 |
import com.vaadin.ui.Component; |
25 | 26 |
import com.vaadin.ui.CssLayout; |
... | ... | |
32 | 33 |
import com.vaadin.ui.themes.ValoTheme; |
33 | 34 |
|
34 | 35 |
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItem; |
36 |
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStyles; |
|
35 | 37 |
import eu.etaxonomy.cdm.vaadin.component.registration.TypeStateLabel; |
36 | 38 |
import eu.etaxonomy.cdm.vaadin.component.registration.WorkflowSteps; |
37 | 39 |
import eu.etaxonomy.cdm.vaadin.event.EntityEventType; |
38 | 40 |
import eu.etaxonomy.cdm.vaadin.event.ReferenceEvent; |
41 |
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent; |
|
39 | 42 |
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEvent; |
40 | 43 |
import eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkflowEvent; |
41 | 44 |
import eu.etaxonomy.cdm.vaadin.model.registration.RegistrationWorkingSet; |
... | ... | |
55 | 58 |
implements RegistrationWorkflowView, View { |
56 | 59 |
|
57 | 60 |
|
58 |
public static final String CSS_CLASS_WORKFLOW = "workflow-container"; |
|
61 |
public static final String DOM_ID_WORKFLOW = "workflow-container"; |
|
62 |
|
|
63 |
public static final String DOM_ID_WORKINGSET = "workingset"; |
|
59 | 64 |
|
60 | 65 |
public static final String SUBHEADER_DEEFAULT = "Advance step by step through the registration workflow."; |
61 | 66 |
|
... | ... | |
82 | 87 |
|
83 | 88 |
workflow = new CssLayout(); |
84 | 89 |
workflow.setSizeFull(); |
85 |
workflow.setId(CSS_CLASS_WORKFLOW);
|
|
90 |
workflow.setId(DOM_ID_WORKFLOW);
|
|
86 | 91 |
getLayout().addComponent(workflow); |
87 | 92 |
} |
88 | 93 |
|
... | ... | |
114 | 119 |
public void setWorkingset(RegistrationWorkingSet workingset) { |
115 | 120 |
|
116 | 121 |
CssLayout registration = new CssLayout(); |
122 |
registration.setId(DOM_ID_WORKINGSET); |
|
117 | 123 |
registration.setWidth(100, Unit.PERCENTAGE); |
118 | 124 |
|
119 | 125 |
Panel namesTypesPanel = createNamesAndTypesList(workingset); |
126 |
namesTypesPanel.setStyleName("names-types-list"); |
|
120 | 127 |
namesTypesPanel.setCaption("Names & Types"); |
121 | 128 |
|
129 |
|
|
122 | 130 |
registration.addComponent(createWorkflowTabSheet(workingset, null)); |
123 | 131 |
registration.addComponent(new RegistrationItem(workingset, this)); |
124 | 132 |
registration.addComponent(namesTypesPanel); |
... | ... | |
174 | 182 |
*/ |
175 | 183 |
public Panel createNamesAndTypesList(RegistrationWorkingSet workingset) { |
176 | 184 |
// prepare name and type list |
177 |
GridLayout namesTypesList = new GridLayout(4, workingset.getRegistrationDTOs().size());
|
|
185 |
GridLayout namesTypesList = new GridLayout(3, workingset.getRegistrationDTOs().size());
|
|
178 | 186 |
int row = 0; |
179 | 187 |
for(RegistrationDTO dto : workingset.getRegistrationDTOs()) { |
180 |
Button commentButton = new Button(FontAwesome.COMMENT); |
|
181 |
commentButton.setStyleName(ValoTheme.BUTTON_BORDERLESS); |
|
188 |
|
|
189 |
Button messageButton = new Button(FontAwesome.COMMENT); |
|
190 |
messageButton.setStyleName(ValoTheme.BUTTON_TINY); // + " " + RegistrationStyles.STYLE_FRIENDLY_FOREGROUND); |
|
191 |
if(dto.getMessages().isEmpty()){ |
|
192 |
messageButton.setEnabled(false); |
|
193 |
} else { |
|
194 |
messageButton.addClickListener(e -> eventBus.publishEvent( |
|
195 |
new ShowDetailsEvent<RegistrationDTO, Integer>( |
|
196 |
e, |
|
197 |
RegistrationDTO.class, |
|
198 |
dto.getId(), |
|
199 |
"messages" |
|
200 |
) |
|
201 |
) |
|
202 |
); |
|
203 |
} |
|
204 |
messageButton.setCaption("<span class=\"" + RegistrationStyles.BUTTON_BADGE +"\"> " + dto.getMessages().size() + "</span>"); |
|
205 |
messageButton.setCaptionAsHtml(true); |
|
206 |
|
|
182 | 207 |
Button editButton = new Button(FontAwesome.EDIT); |
183 |
editButton.setStyleName(ValoTheme.BUTTON_BORDERLESS);
|
|
208 |
editButton.setStyleName(ValoTheme.BUTTON_TINY + " " + ValoTheme.BUTTON_PRIMARY);
|
|
184 | 209 |
|
185 | 210 |
namesTypesList.addComponent(new TypeStateLabel().update(dto.getRegistrationType(), dto.getStatus()), 0, row); |
186 | 211 |
namesTypesList.addComponent(new Label(dto.getSummary()), 1, row); |
187 |
namesTypesList.addComponent(commentButton, 2, row); |
|
188 |
namesTypesList.addComponent(editButton, 3, row); |
|
212 |
CssLayout buttonGroup = new CssLayout(); |
|
213 |
buttonGroup.setStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); |
|
214 |
buttonGroup.addComponent(messageButton); |
|
215 |
buttonGroup.addComponent(editButton); |
|
216 |
namesTypesList.addComponent(buttonGroup, 2, row); |
|
217 |
namesTypesList.setComponentAlignment(buttonGroup, Alignment.TOP_RIGHT); |
|
189 | 218 |
row++; |
190 | 219 |
} |
191 | 220 |
namesTypesList.setSizeUndefined(); |
221 |
namesTypesList.setWidth(100, Unit.PERCENTAGE); |
|
222 |
namesTypesList.setColumnExpandRatio(0, 0.1f); |
|
223 |
namesTypesList.setColumnExpandRatio(1, 0.9f); |
|
192 | 224 |
Panel namesTypesPanel = new Panel(namesTypesList); |
193 | 225 |
namesTypesPanel.setHeight("300px"); |
194 | 226 |
return namesTypesPanel; |
Also available in: Unified diff
ref #6169 message count indicator, edit reference button and impoved layout