Project

General

Profile

Revision 5b4537c4

ID5b4537c465516b4c4650ea1a7d92b0c10eb0be6f
Parent eaee371d
Child c21c9bf6

Added by Andreas Kohlbecker over 2 years ago

ref #6169 replacing declarative WorkflowViewDesign

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItem.java
95 95
        messageButton.setEnabled(false);
96 96
        openButton.setStyleName(ValoTheme.BUTTON_TINY);
97 97
        openButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
98
        openButton.addClickListener(e -> parentView.getEventBus().publishEvent(new NavigationEvent(
99
                RegistrationWorkflowViewBean.NAME,
100
                RegistrationWorkflowViewBean.ACTION_EDIT,
101
                regDto.getSpecificIdentifier().toString()
102
                )));
98

  
103 99
        buttonGroup.setStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
104 100
        addComponent(buttonGroup, 2, 0);
105 101
        setComponentAlignment(buttonGroup, Alignment.TOP_RIGHT);
src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/WorkflowSteps.java
19 19
 */
20 20
public class WorkflowSteps extends WorkflowStepsDesign {
21 21

  
22
    /**
23
     *
24
     */
22
    private static final long serialVersionUID = 7224620045791102584L;
23

  
25 24
    public WorkflowSteps() {
26 25
        // TODO Auto-generated constructor stub
27 26
    }
src/main/java/eu/etaxonomy/cdm/vaadin/design/registration/RegistrationWorkflowDesign.java
1
package eu.etaxonomy.cdm.vaadin.design.registration;
2

  
3
import com.vaadin.annotations.AutoGenerated;
4
import com.vaadin.annotations.DesignRoot;
5
import com.vaadin.ui.CssLayout;
6
import com.vaadin.ui.Label;
7
import com.vaadin.ui.VerticalLayout;
8
import com.vaadin.ui.declarative.Design;
9

  
10
/** 
11
 * !! DO NOT EDIT THIS FILE !!
12
 * 
13
 * This class is generated by Vaadin Designer and will be overwritten.
14
 * 
15
 * Please make a subclass with logic and additional interfaces as needed,
16
 * e.g class LoginView extends LoginDesign implements View { }
17
 */
18
@DesignRoot
19
@AutoGenerated
20
@SuppressWarnings("serial")
21
public class RegistrationWorkflowDesign extends VerticalLayout {
22
    protected Label title;
23
    protected CssLayout workflow;
24

  
25
    public RegistrationWorkflowDesign() {
26
        Design.read(this);
27
    }
28
}
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/registration/RegistrationWorkflowPresenter.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.presenter.registration;
10 10

  
11
import org.apache.log4j.Logger;
11 12
import org.springframework.beans.factory.annotation.Autowired;
12 13
import org.springframework.context.event.EventListener;
13 14

  
......
46 47
    @EventListener
47 48
    protected void onRegistrationStartEvent(RegistrationWorkflowEvent e){
48 49

  
50
        if(registration != null){
51
            Logger.getLogger(RegistrationWorkflowPresenter.class).warn("Foiling attempt to start another registration in existing workflow");
52
            return;
53
        }
54

  
49 55
        if(e.isStart()) {
50 56
            registration = new Registration();
51 57
            registration.setName(TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()));
......
53 59
            registration = serviceMock.loadByRegistrationID(e.getRegistrationID());
54 60
        }
55 61
        if(registration != null){
56
            getView().getTitle().setValue("Workflow for a " + registrationType().name());
62
            // getView().getTitle().setValue("Workflow for a " + registrationType().name());
57 63
            getView().makeWorflow(registrationType());
58 64
        }
59 65
    }
src/main/java/eu/etaxonomy/cdm/vaadin/view/AbstractPageView.java
43 43
        header.setStyleName(ValoTheme.LABEL_HUGE);
44 44
        header.setWidth(100, Unit.PERCENTAGE);
45 45
        header.setContentMode(ContentMode.HTML);
46
        header.setValue("<div id=\"header\">" + getHeaderText() + "</div><div id=\"subheader\">" + getSubHeaderText() + "</div>");
46
        updateHeader();
47 47
        layout.addComponent(header);
48 48

  
49 49
        setCompositionRoot(layout);
50 50
        this.setSizeFull();
51 51
    }
52 52

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

  
53 60
    protected CssLayout getLayout() {
54 61
        return layout;
55 62
    }
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkflowView.java
11 11
import java.util.UUID;
12 12

  
13 13
import com.vaadin.ui.CssLayout;
14
import com.vaadin.ui.Label;
15 14

  
16 15
import eu.etaxonomy.cdm.vaadin.presenter.registration.RegistrationType;
17 16
import eu.etaxonomy.vaadin.mvp.ApplicationView;
......
26 25

  
27 26
    CssLayout getWorkflow();
28 27

  
29
    Label getTitle();
30

  
31 28

  
32 29
    /**
33 30
     * Open a popup editor for an existing TaxonName if the nameUuid is
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkflowViewBean.java
16 16
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
17 17
import com.vaadin.spring.annotation.SpringView;
18 18
import com.vaadin.ui.CssLayout;
19
import com.vaadin.ui.Label;
20 19

  
21
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationWorkflowComponent;
22 20
import eu.etaxonomy.cdm.vaadin.component.registration.WorkflowSteps;
23 21
import eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkflowEvent;
24 22
import eu.etaxonomy.cdm.vaadin.presenter.registration.RegistrationType;
25 23
import eu.etaxonomy.cdm.vaadin.presenter.registration.RegistrationWorkflowPresenter;
26
import eu.etaxonomy.vaadin.mvp.AbstractView;
24
import eu.etaxonomy.cdm.vaadin.view.AbstractPageView;
27 25

  
28 26
/**
29 27
 * @author a.kohlbecker
......
31 29
 *
32 30
 */
33 31
@SpringView(name=RegistrationWorkflowViewBean.NAME)
34
public class RegistrationWorkflowViewBean extends AbstractView<RegistrationWorkflowPresenter>
32
public class RegistrationWorkflowViewBean extends AbstractPageView<RegistrationWorkflowPresenter>
35 33
    implements RegistrationWorkflowView, View {
36 34

  
35
    /**
36
     *
37
     */
38
    private static final String CSS_CLASS_WORKFLOW = "workflow-container";
39

  
40
    private static final String SUBHEADER_PREFIX = "Advance step by step through the registration workflow for scientific names.";
41

  
42
    private static final String HEADER_PREFIX = "Registration of the ...";
43

  
37 44
    private static final long serialVersionUID = -213040114015958970L;
38 45

  
39 46
    public static final String NAME = "workflow";
......
44 51

  
45 52
    public RegistrationType regType = null;
46 53

  
47
    RegistrationWorkflowComponent design;
54
    CssLayout workflow;
55

  
56
    String headerSuffix = "";
48 57

  
49 58
    public RegistrationWorkflowViewBean() {
50
        design = new RegistrationWorkflowComponent();
51
        setCompositionRoot(design);
59
        super();
60

  
61
        workflow = new CssLayout();
62
        workflow.setSizeFull();
63
        workflow.setId(CSS_CLASS_WORKFLOW);
64
        getLayout().addComponent(workflow);
52 65
    }
53 66

  
54 67
    /**
......
61 74

  
62 75
           if(params[0].equals(ACTION_NEW)) {
63 76
               regType = RegistrationType.valueOf(params[1]);
64
               design.getTitle().setValue(design.getTitle().getValue() + "  " + regType.name() + " ...");
77
               headerSuffix = regType.name() + " ...";
65 78
               eventBus.publishEvent(new RegistrationWorkflowEvent(regType));
66 79

  
67 80
           } else if( params[0].equals(ACTION_EDIT)) {
68
               design.getTitle().setValue(design.getTitle().getValue() + "  " + params[1]);
81
               headerSuffix = params[1];
69 82
               eventBus.publishEvent(new RegistrationWorkflowEvent(Integer.parseInt(params[1])));
70 83
           }
71

  
84
           updateHeader();
72 85
        }
73 86
    }
74 87

  
......
121 134
        setPresenter(presenter);
122 135
    }
123 136

  
124
    /* ------- RegistrationWorkflowView implementation ------- */
125

  
126 137
    /**
127
     * @return the title
138
     * {@inheritDoc}
128 139
     */
129 140
    @Override
130
    public Label getTitle() {
131
        return design.getTitle();
141
    public void openNameEditor(UUID nameUuid) {
142
        // TODO Auto-generated method stub
143

  
132 144
    }
133 145

  
134 146
    /**
135
     * @return the workflow
147
     * {@inheritDoc}
136 148
     */
137 149
    @Override
138
    public CssLayout getWorkflow() {
139
        return design.getWorkflow();
150
    protected String getHeaderText() {
151
        return HEADER_PREFIX + " " + headerSuffix;
140 152
    }
141 153

  
142 154
    /**
143 155
     * {@inheritDoc}
144 156
     */
145 157
    @Override
146
    public void openNameEditor(UUID nameUuid) {
147
        // TODO Auto-generated method stub
158
    protected String getSubHeaderText() {
159
        return SUBHEADER_PREFIX;
160
    }
148 161

  
162
    /**
163
     * {@inheritDoc}
164
     */
165
    @Override
166
    public CssLayout getWorkflow() {
167
        return workflow;
149 168
    }
150 169

  
170

  
151 171
}
src/main/resources/eu/etaxonomy/cdm/vaadin/design/registration/RegistrationWorkflowDesign.html
1
<!doctype html>
2
<html>
3
 <head>
4
  <meta charset="UTF-8">
5
  <meta name="design-properties" content="{&quot;RULERS_VISIBLE&quot;:true,&quot;GUIDELINES_VISIBLE&quot;:false,&quot;SNAP_TO_OBJECTS&quot;:true,&quot;SNAP_TO_GRID&quot;:true,&quot;SNAPPING_DISTANCE&quot;:10,&quot;JAVA_SOURCES_ROOT&quot;:&quot;src/main/java&quot;,&quot;THEME&quot;:&quot;edit-valo&quot;}">
6
  <meta name="vaadin-version" content="7.7.0">
7
 </head>
8
 <body>
9
  <vaadin-vertical-layout spacing>
10
   <vaadin-label style-name="huge" size-auto plain-text _id="title" :center>
11
     Registration of the 
12
   </vaadin-label>
13
   <vaadin-label size-auto plain-text :middle :center>
14
     Advance step by step through the registration workflow for scientific names. 
15
   </vaadin-label>
16
   <vaadin-css-layout style-name="workflow" responsive _id="workflow" :center></vaadin-css-layout>
17
  </vaadin-vertical-layout>
18
 </body>
19
</html>
src/main/webapp/VAADIN/themes/edit-valo/edit-valo.scss
141 141
    }
142 142

  
143 143
    // ===== workflow ==== // 
144

  
145
    #workflow-container {
146
        text-align: center;
147
    }
144 148
    
145 149
    $workflow-icon-size: 110px;
146 150
    // can not be set per css as this need to set as property to the component in vaadin
......
150 154

  
151 155
    $workflow-icon-margin-h: $workflow-icon-size / 5;
152 156
    $workflow-icon-left: $workflow-icon-margin-h / 2;
153
    $workflow-caption-font-size: $workflow-icon-size * $workflow-caption-shrink;
154
        
157
    $workflow-caption-font-size: $workflow-icon-size * $workflow-caption-shrink;        
158
    
155 159
    .workflow {
156 160
        .steps {
157 161
            z-index: 10;
src/main/webapp/WEB-INF/web.xml
77 77
    <context-param>
78 78
      <description>Vaadin production mode</description>
79 79
      <param-name>productionMode</param-name>
80
      <param-value>true</param-value>
80
      <param-value>false</param-value>
81 81
    </context-param>
82 82
</web-app>

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)