Revision 9d5ae601
Added by Andreas Kohlbecker almost 7 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItem.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import static eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStyles.LABEL_NOWRAP; |
12 | 12 |
|
13 |
import java.util.Collection; |
|
14 |
|
|
13 | 15 |
import org.joda.time.DateTime; |
14 | 16 |
import org.joda.time.format.ISODateTimeFormat; |
15 | 17 |
|
... | ... | |
19 | 21 |
import com.vaadin.shared.ui.label.ContentMode; |
20 | 22 |
import com.vaadin.ui.Alignment; |
21 | 23 |
import com.vaadin.ui.Button; |
24 |
import com.vaadin.ui.Button.ClickListener; |
|
22 | 25 |
import com.vaadin.ui.CssLayout; |
23 | 26 |
import com.vaadin.ui.GridLayout; |
24 | 27 |
import com.vaadin.ui.Label; |
... | ... | |
75 | 78 |
private Label publishedLabel = new Label(); |
76 | 79 |
private Label releasedLabel = new Label(); |
77 | 80 |
|
78 |
private String citationString; |
|
79 |
// -------------------------------------------------- |
|
80 |
|
|
81 | 81 |
/** |
82 | 82 |
* |
83 | 83 |
*/ |
... | ... | |
154 | 154 |
public void setItem(RegistrationDTO regDto, AbstractView<?> parentView){ |
155 | 155 |
this.parentView = parentView; |
156 | 156 |
|
157 |
NavigationEvent openButtonEvent = new NavigationEvent(
|
|
157 |
NavigationEvent navigationEvent = new NavigationEvent(
|
|
158 | 158 |
RegistrationWorkflowViewBean.NAME, |
159 | 159 |
RegistrationWorkflowViewBean.ACTION_EDIT, |
160 | 160 |
Integer.toString(regDto.getId()) |
161 | 161 |
); |
162 | 162 |
|
163 | 163 |
updateUI(regDto.getBibliographicCitationString(), regDto.getCreated(), regDto.getDatePublished(), regDto.getMessages().size(), |
164 |
openButtonEvent, null, regDto);
|
|
164 |
navigationEvent, null, regDto);
|
|
165 | 165 |
} |
166 | 166 |
|
167 | 167 |
public void setWorkingSet(RegistrationWorkingSet workingSet, AbstractView<?> parentView){ |
168 | 168 |
this.parentView = parentView; |
169 |
ReferenceEditorAction openButtonEvent; |
|
169 |
|
|
170 |
ReferenceEditorAction referenceEditorAction; |
|
170 | 171 |
if(workingSet.getCitationId() != null){ |
171 |
openButtonEvent = new ReferenceEditorAction(Type.EDIT, workingSet.getCitationId());
|
|
172 |
referenceEditorAction = new ReferenceEditorAction(Type.EDIT, workingSet.getCitationId());
|
|
172 | 173 |
} else { |
173 |
openButtonEvent = new ReferenceEditorAction(Type.ADD);
|
|
174 |
referenceEditorAction = new ReferenceEditorAction(Type.ADD);
|
|
174 | 175 |
} |
175 | 176 |
TimePeriod datePublished = workingSet.getRegistrationDTOs().get(0).getDatePublished(); |
176 | 177 |
updateUI(workingSet.getCitation(), workingSet.getCreated(), datePublished, workingSet.messagesCount(), |
177 |
openButtonEvent, FontAwesome.EDIT, null);
|
|
178 |
referenceEditorAction, FontAwesome.EDIT, null);
|
|
178 | 179 |
} |
179 | 180 |
|
180 |
|
|
181 | 181 |
/** |
182 | 182 |
* |
183 | 183 |
*/ |
... | ... | |
217 | 217 |
if(openButtonEvent != null){ |
218 | 218 |
// Buttons |
219 | 219 |
getOpenButton().setVisible(true); |
220 |
Collection<?> removeCandidates = getOpenButton().getListeners(ClickListener.class); |
|
221 |
removeCandidates.forEach(l -> getOpenButton().removeClickListener((ClickListener)l)); |
|
220 | 222 |
getOpenButton().addClickListener(e -> publishEvent(openButtonEvent)); |
221 | 223 |
} |
222 | 224 |
|
Also available in: Unified diff
ref #6612 updating UI components on modified References