Project

General

Profile

« Previous | Next » 

Revision b99cbf31

Added by Andreas Kohlbecker almost 7 years ago

ref #6169 Overview on Names and Types in RegistrationWorkingSets

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItem.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.component.registration;
10 10

  
11
import org.apache.commons.lang.StringUtils;
11
import static eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStyles.STYLE_LABEL_NOWRAP;
12

  
12 13
import org.joda.time.format.ISODateTimeFormat;
13 14

  
14 15
import com.vaadin.server.ExternalResource;
......
24 25

  
25 26
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent;
26 27
import eu.etaxonomy.cdm.vaadin.presenter.registration.RegistrationDTO;
27
import eu.etaxonomy.cdm.vaadin.presenter.registration.RegistrationType;
28 28
import eu.etaxonomy.cdm.vaadin.view.registration.RegistrationTypeConverter;
29 29
import eu.etaxonomy.cdm.vaadin.view.registration.RegistrationWorkflowViewBean;
30 30
import eu.etaxonomy.vaadin.mvp.AbstractView;
......
46 46

  
47 47
    private static final int GRID_COLS = 3;
48 48

  
49
    private static final String STYLE_LABEL_NOWRAP = "label-nowrap";
50

  
51 49
    private static final long serialVersionUID = -211003770452173644L;
52 50

  
53 51
    private RegistrationDTO regDto;
......
57 55
    private AbstractView<?> parentView;
58 56

  
59 57
    // --------------------------------------------------
60
    private Label typeStateLabel = new Label();
58
    private TypeStateLabel typeStateLabel = new TypeStateLabel();
61 59
    private Link identifierLink = new Link();
62 60
    private Label citationSummaryLabel = new Label();
63 61
    private Button blockedByButton = new Button(FontAwesome.WARNING);
......
129 127
     *
130 128
     */
131 129
    private void updateUI() {
132
        updateTypeStateLabel();
130
        typeStateLabel.update(regDto.getRegistrationType(), regDto.getStatus());
133 131
        getCitationSummaryLabel().setValue(regDto.getCitationString() + "</br>" + regDto.getSummary());
134 132
        updateIdentifierLink();
135 133

  
......
154 152
        updateDateLabels();
155 153
    }
156 154

  
157

  
158
    /**
159
     *
160
     */
161
    private void updateTypeStateLabel() {
162

  
163
        FontAwesome icon;
164
        if(regDto.getRegistrationType().equals(RegistrationType.NAME)) {
165
            icon = FontAwesome.TAG;
166
        } else if(regDto.getRegistrationType().equals(RegistrationType.TYPIFICATION)) {
167
            icon = FontAwesome.TAGS;
168
        } else {
169
            icon = FontAwesome.WARNING;
170
        }
171
        typeStateLabel.setContentMode(ContentMode.HTML);
172
        typeStateLabel.setValue(icon.getHtml() + "&nbsp;" + StringUtils.capitalize((regDto.getStatus().name().toLowerCase())));
173
        typeStateLabel.addStyleName("status-" + regDto.getStatus().name());
174
    }
175

  
176 155
    /**
177 156
     *
178 157
     */
src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationStyles.java
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.vaadin.component.registration;
10

  
11
/**
12
 * @author a.kohlbecker
13
 * @since Mar 30, 2017
14
 *
15
 */
16
public class RegistrationStyles {
17

  
18
    public static final String STYLE_LABEL_NOWRAP = "label-nowrap";
19

  
20
}
src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/TypeStateLabel.java
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.vaadin.component.registration;
10

  
11

  
12
import static eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStyles.STYLE_LABEL_NOWRAP;
13

  
14
import org.apache.commons.lang.StringUtils;
15

  
16
import com.vaadin.server.FontAwesome;
17
import com.vaadin.shared.ui.label.ContentMode;
18
import com.vaadin.ui.Label;
19

  
20
import eu.etaxonomy.cdm.mock.RegistrationStatus;
21
import eu.etaxonomy.cdm.vaadin.presenter.registration.RegistrationType;
22

  
23
/**
24
 * @author a.kohlbecker
25
 * @since Mar 30, 2017
26
 *
27
 */
28
public class TypeStateLabel extends Label {
29

  
30

  
31
    /**
32
     *
33
     */
34
    private static final long serialVersionUID = -7462726193336938780L;
35

  
36
    /**
37
     *
38
     */
39
    public TypeStateLabel() {
40
        setStyleName(STYLE_LABEL_NOWRAP);
41
    }
42

  
43
    /**
44
    *
45
    */
46
   public TypeStateLabel update(RegistrationType type, RegistrationStatus status) {
47

  
48
       FontAwesome icon;
49
       if(type.equals(RegistrationType.NAME)) {
50
           icon = FontAwesome.TAG;
51
       } else if(type.equals(RegistrationType.TYPIFICATION)) {
52
           icon = FontAwesome.TAGS;
53
       } else {
54
           icon = FontAwesome.WARNING;
55
       }
56
       setContentMode(ContentMode.HTML);
57
       setValue(icon.getHtml() + "&nbsp;" + StringUtils.capitalize((status.name().toLowerCase())));
58
       addStyleName("status-" + status.name());
59
       return this;
60
   }
61

  
62

  
63

  
64

  
65
}
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkflowViewBean.java
25 25
import com.vaadin.ui.CssLayout;
26 26
import com.vaadin.ui.GridLayout;
27 27
import com.vaadin.ui.Label;
28
import com.vaadin.ui.Panel;
29
import com.vaadin.ui.TabSheet;
30
import com.vaadin.ui.TabSheet.Tab;
28 31
import com.vaadin.ui.themes.ValoTheme;
29 32

  
30 33
import eu.etaxonomy.cdm.mock.RegistrationStatus;
34
import eu.etaxonomy.cdm.vaadin.component.registration.TypeStateLabel;
31 35
import eu.etaxonomy.cdm.vaadin.component.registration.WorkflowSteps;
32 36
import eu.etaxonomy.cdm.vaadin.event.EntityEventType;
33 37
import eu.etaxonomy.cdm.vaadin.event.ReferenceEvent;
......
110 114

  
111 115
        CssLayout registration = new CssLayout();
112 116
        registration.setWidth(100, Unit.PERCENTAGE);
117

  
118
        Panel namesTypesPanel = createNamesAndTypesList(workingset);
119
        namesTypesPanel.setCaption("Names & Types");
120

  
121
        registration.addComponent(createWorkflowTabSheet(workingset, null));
113 122
        registration.addComponent(createRegistrationCaption(workingset));
123
        registration.addComponent(namesTypesPanel);
124

  
114 125
        registrations.add(registration);
115 126
        workflow.addComponent(registration);
116 127

  
117 128
    }
118 129

  
130
    /**
131
     * {@inheritDoc}
132
     */
133
    @Override
134
    public void addBlockingRegistration(RegistrationDTO blocking) {
135
        if(registrations == null) {
136
            throw new RuntimeException("A Workingset must be present prior adding blocking registrations.");
137
        }
138
        // add the blocking registration
139

  
140
    }
141

  
119 142
    /**
120 143
     * @param workingset
121 144
     * @return
......
132 155
     * @param workingset
133 156
     * @return
134 157
     */
135
    private Component createRegistrationCaption(RegistrationDTO regitrationDto) {
136
        String citation = regitrationDto.getCitation();
137
        int messagesCount = regitrationDto.getMessages().size();
138
        RegistrationStatus status = regitrationDto.getStatus();
158
    private Component createRegistrationCaption(RegistrationDTO registrationDto) {
159
        String citation = registrationDto.getCitation();
160
        int messagesCount = registrationDto.getMessages().size();
161
        RegistrationStatus status = registrationDto.getStatus();
139 162

  
140 163
        return createRegistrationCaption(citation, status, messagesCount);
141 164
    }
......
149 172
        GridLayout grid = new GridLayout(2, 1);
150 173
        grid.addStyleName("registration-workflow-item");
151 174
        grid.setWidth(100, Unit.PERCENTAGE);
152
        Label citationLabel = new Label(citation);
153
        grid.addComponent(citationLabel, 0, 0);
175
        Button citationButton = new Button(citation + "&nbsp;&nbsp;" + FontAwesome.EDIT.getHtml());
176
        citationButton.setHtmlContentAllowed(true);
177
        citationButton.setStyleName(ValoTheme.BUTTON_BORDERLESS);
178
        grid.addComponent(citationButton, 0, 0);
179
        grid.setComponentAlignment(citationButton, Alignment.MIDDLE_LEFT);
154 180
        grid.setColumnExpandRatio(0, 1.0f);
155 181

  
156 182
        CssLayout iconContainer = new CssLayout();
......
162 188
        }
163 189

  
164 190
        WorkflowStep step = WorkflowStep.from(status, citation != null && !citation.isEmpty());
191

  
165 192
        Label statusIndicator = new Label(WorkflowStep.from(status, citation != null && !citation.isEmpty()).getHtml());
166 193
        statusIndicator.setCaptionAsHtml(true);
167 194
        statusIndicator.setStyleName("workflow-step label-nowrap");
168 195
        statusIndicator.setIcon(new GenericFontIcon("IcoMoon", 0xe900)); // triangle-right
169 196
        CssLayout statusWrap = new CssLayout(statusIndicator);
170
        statusWrap.setStyleName("workflow-step-wrap bg-status-" + status.name());
171
        iconContainer.addComponent(statusWrap);
197
        statusWrap.setStyleName("workflow-step-wrap"); // bg-status-" + status.name());
198
        // iconContainer.addComponent(statusWrap);
172 199

  
173 200
        grid.addComponent(iconContainer, 1, 0);
174 201
        grid.setComponentAlignment(iconContainer, Alignment.TOP_RIGHT);
......
176 203
        return grid;
177 204
    }
178 205

  
206
    private Component createWorkflowTabSheet(RegistrationWorkingSet workingset, Component namesTypesPanel){
207

  
208
        if(namesTypesPanel == null){
209
            namesTypesPanel = new CssLayout();
210
        }
211
        Component citationComponent = new CssLayout(); // new Label(workingset.getCitation());
212
        Component curationComponent = new CssLayout(); // new Label("Curation in progress ...")
213
        Component releaseComponent = new CssLayout(); // new Label("Not yet published")
214

  
215
        GenericFontIcon tabIcon = new GenericFontIcon("IcoMoon", 0xe900);
216
        TabSheet tabsheet = new TabSheet();
217
        // tabsheet.addStyleName(ValoTheme.TABSHEET_FRAMED);
218
        //tabsheet.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
219
        tabsheet.addStyleName("workflow-tabsheet");
220

  
221
        Tab pubDetailsTab = tabsheet.addTab(citationComponent, WorkflowStep.PUBLICATION_DETAILS.getRepresentation(), tabIcon);
222
        Tab namesTypesTab = tabsheet.addTab(namesTypesPanel, WorkflowStep.NAMES_N_TYPES.getRepresentation(), tabIcon);
223
        Tab curationTab = tabsheet.addTab(curationComponent, WorkflowStep.CURATION.getRepresentation(), tabIcon);
224
        Tab awaitingPubTab = tabsheet.addTab(releaseComponent, WorkflowStep.AWAITING_PUBLICATION.getRepresentation(), tabIcon);
225

  
226
        pubDetailsTab.setStyleName("bg-status-" + WorkflowStep.PUBLICATION_DETAILS.name());
227
        namesTypesTab.setStyleName("bg-status-" + WorkflowStep.NAMES_N_TYPES.name());
228
        curationTab.setStyleName("bg-status-" + WorkflowStep.CURATION.name());
229
        awaitingPubTab.setStyleName("bg-status-" + WorkflowStep.AWAITING_PUBLICATION.name());
230

  
231
        return tabsheet;
232
    }
233

  
179 234
    /**
180
     * {@inheritDoc}
235
     * @param workingset
236
     * @return
181 237
     */
182
    @Override
183
    public void addBlockingRegistration(RegistrationDTO blocking) {
184
        if(registrations == null) {
185
            throw new RuntimeException("A Workingset must be present prior adding blocking registrations.");
238
    public Panel createNamesAndTypesList(RegistrationWorkingSet workingset) {
239
        // prepare name and type list
240
        GridLayout namesTypesList = new GridLayout(4, workingset.getRegistrationDTOs().size());
241
        int row = 0;
242
        for(RegistrationDTO dto : workingset.getRegistrationDTOs()) {
243
            Button commentButton = new Button(FontAwesome.COMMENT);
244
            commentButton.setStyleName(ValoTheme.BUTTON_BORDERLESS);
245
            Button editButton = new Button(FontAwesome.EDIT);
246
            editButton.setStyleName(ValoTheme.BUTTON_BORDERLESS);
247

  
248
            namesTypesList.addComponent(new TypeStateLabel().update(dto.getRegistrationType(), dto.getStatus()), 0, row);
249
            namesTypesList.addComponent(new Label(dto.getSummary()), 1, row);
250
            namesTypesList.addComponent(commentButton, 2, row);
251
            namesTypesList.addComponent(editButton, 3, row);
252
            row++;
186 253
        }
187
        // add the blocking registration
188

  
254
        namesTypesList.setSizeUndefined();
255
        Panel namesTypesPanel = new Panel(namesTypesList);
256
        namesTypesPanel.setHeight("300px");
257
        return namesTypesPanel;
189 258
    }
190 259

  
260

  
191 261
    /**
192 262
    *
193 263
    */
src/main/webapp/VAADIN/themes/edit-valo/edit-valo.scss
160 160

  
161 161
    #workflow-container {
162 162
        text-align: center;
163
        margin-top: $v-unit-size;
163 164
    }
164 165
    
165 166
    $workflow-icon-size: 110px;
......
231 232
    }
232 233

  
233 234
    // tab element being part of a process ----------- //
235
    // use $v-unit-size instead of $v-font-size * 3?
234 236
    .workflow-step-wrap {
235 237
        padding-right: 10px;
236 238
        height: $v-font-size * 3;
......
249 251
            padding-right: 10px;
250 252
            color: $v-background-color;
251 253
        }
252
  
254
    }
255

  
256
    .workflow-tabsheet {
257
        
258
        table.v-tabsheet-tabs, .v-tabsheet-tabs tr, .v-tabsheet-tabs tbody {
259
          width: 100%; 
260
        }
261
        
262
        .v-tabsheet-tabitemcell {
263
              width: 25%;
264
        }
265

  
266
        .v-tabsheet-tabitem {
267
            
268
            // background-color: scale-color(lighten($v-app-background-color, 20%), $saturation: -20%);
269
            // @include valo-gradient($color: $v-background-color, $gradient: $v-gradient, $fallback: null, $direction: to right);
270
            // @include box-shadow(inset 0 0 5px $v-app-background-color);
271
            // background-color: $v-font-color
272
            
273
            // border: valo-border($border: 2px solid, $color: $v-font-color, $strength: 1);
274
            
275
            background-color: scale-color(lighten($v-app-background-color, 20%), $saturation: -20%);
276
            @include box-shadow(inset 0 0 5px $v-app-background-color);
277
            border: valo-border($border: 2px solid, $color: $v-app-background-color, $strength: 1);
278
            border-color: $v-app-background-color;
279
            .v-caption {
280
                // line-height: $v-unit-size;
281
                margin: 0;
282
                padding: 0;
283
                padding-right: $v-unit-size / 2;
284
                border: 0px none;
285
            }
286
            .v-icon {
287
                line-height: $v-unit-size;
288
                font-size: $v-unit-size * 1.8;
289
                vertical-align: middle;
290
                // padding-right: $v-unit-size / 2;
291
                
292
                //color: $v-font-color;
293
                
294
                color: $v-app-background-color;
295
            }
296
        }
253 297
    }
254 298

  
255 299
    // ----------------------------------------------- //
300
    
301
   // status colors --------------------------------- //
256 302
    .status-REJECTED {
257 303
        color: $status-rejected-color;
258 304
    }

Also available in: Unified diff