Project

General

Profile

« Previous | Next » 

Revision 10cc0e5e

Added by Cherian Mathew almost 9 years ago

NewTaxonBaseComposite : add exception handling when name already exists
StatusComposite : added tab sheet with main / excluded tabs
CdmQueryFactory, LeafNodeTaxonContainer : added rank filter for ranks below species aggregate
NewTaxonBasePresenter : added check if name exists
NewTaxonBasePresenterTest (.xml) : corrected data for valid names and added test for name check
CdmVaadinOperation : added method to set exception

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/util/CdmVaadinOperation.java
15 15

  
16 16
import org.apache.log4j.Logger;
17 17

  
18
import com.vaadin.server.Page;
19
import com.vaadin.ui.Notification;
20
import com.vaadin.ui.Notification.Type;
18 21
import com.vaadin.ui.UI;
19 22

  
20 23
import eu.etaxonomy.cdm.vaadin.component.CdmProgressComponent;
......
37 40

  
38 41
    private Date now = new java.util.Date();
39 42

  
43
    private Exception exception;
44

  
45

  
46

  
40 47
    public CdmVaadinOperation(int pollInterval, CdmProgressComponent progressComponent) {
41 48
        this.pollInterval = pollInterval;
42 49
        this.progressComponent = progressComponent;
......
115 122
     */
116 123
    @Override
117 124
    public void run() {
118

  
119
        final boolean success = execute();
120
        //logger.warn(new Timestamp(now.getTime()) + " : ran execute");
121
        endProgress();
122

  
123
        if(isAsync()) {
124
            UI.getCurrent().access(new Runnable() {
125
                @Override
126
                public void run() {
127
                    try {
128
                        if(success) {
129
                            fireDelayedEvents();
125
        try {
126
            final boolean success = execute();
127
            //logger.warn(new Timestamp(now.getTime()) + " : ran execute");
128

  
129
            if(isAsync()) {
130
                UI.getCurrent().access(new Runnable() {
131
                    @Override
132
                    public void run() {
133
                        try {
134
                            if(success) {
135
                                fireDelayedEvents();
136
                            }
137
                            if(exception != null) {
138
                                Notification notification = new Notification(exception.getMessage(), "", Type.WARNING_MESSAGE);
139
                                notification.show(Page.getCurrent());
140
                                exception = null;
141
                            }
142
                            postOpUIUpdate(success);
143
                            //logger.warn(new Timestamp(now.getTime()) + " : ran postOpUIUpdate ");
144
                        } finally {
145
                            UI.getCurrent().setPollInterval(-1);
146
                            opDone = true;
147
                            //logger.warn(new Timestamp(now.getTime()) + " : switched off pollling");
130 148
                        }
131
                        postOpUIUpdate(success);
132
                        //logger.warn(new Timestamp(now.getTime()) + " : ran postOpUIUpdate ");
133
                    } finally {
134
                        UI.getCurrent().setPollInterval(-1);
135
                        opDone = true;
136
                        //logger.warn(new Timestamp(now.getTime()) + " : switched off pollling");
137 149
                    }
138
                }
139
            });
140
        } else {
141
            postOpUIUpdate(success);
150
                });
151
            } else {
152
                postOpUIUpdate(success);
153
            }
154
        } finally {
155
            endProgress();
142 156
        }
143

  
144 157
    }
145 158

  
146 159
    public abstract  boolean execute();
......
166 179
        return pollInterval > 0;
167 180
    }
168 181

  
182
    /**
183
     * @return the exception
184
     */
185
    public Exception getException() {
186
        return exception;
187
    }
188

  
189
    /**
190
     * @param exception the exception to set
191
     */
192
    public void setException(Exception exception) {
193
        this.exception = exception;
194
    }
169 195

  
170 196

  
171 197
}

Also available in: Unified diff