Project

General

Profile

Revision be1478a2

IDbe1478a2026ec5a2d4e60832574b55eda558d1e8
Parent 19a6274b
Child 2af066eb

Added by Alexander Oppermann over 5 years ago

Fixed problem for toolbar and new authentification object. Added getter method to CdmVaadinAuthentication, in order to get the principal object with user name and roles.

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/HorizontalToolbar.java
6 6
import org.springframework.security.core.context.SecurityContext;
7 7
import org.springframework.security.core.context.SecurityContextHolder;
8 8

  
9
import com.vaadin.server.Page;
9 10
import com.vaadin.server.ThemeResource;
11
import com.vaadin.server.VaadinServlet;
10 12
import com.vaadin.server.VaadinSession;
11 13
import com.vaadin.ui.Alignment;
12 14
import com.vaadin.ui.Button;
......
17 19
import com.vaadin.ui.Label;
18 20
import com.vaadin.ui.UI;
19 21

  
22
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinAuthentication;
23

  
20 24
public class HorizontalToolbar extends HorizontalLayout implements Serializable{
21 25

  
22 26

  
......
40 44
//	private ExcelExporter exporter = new ExcelExporter();
41 45

  
42 46
	public HorizontalToolbar() {
43
		authentication = (Authentication) VaadinSession.getCurrent().getAttribute("authentication");
47
//		authentication = (Authentication) VaadinSession.getCurrent().getAttribute("authentication");
48
		CdmVaadinAuthentication authentication = (CdmVaadinAuthentication) VaadinSession.getCurrent().getAttribute(CdmVaadinAuthentication.KEY);
49
		this.authentication = authentication.getAuthentication(Page.getCurrent().getLocation(), VaadinServlet.getCurrent().getServletContext().getContextPath());
44 50
		init();
45 51
	}
46 52

  
src/main/java/eu/etaxonomy/cdm/vaadin/util/CdmVaadinAuthentication.java
54 54
        return false;
55 55
    }
56 56

  
57
    public Authentication getAuthentication(URI uri, String context){
58
        return hostAuthenticationMap.get(getRequestSource(uri, context));
59
    }
60

  
57 61
    public boolean setSecurityContextAuthentication(URI uri, String context) {
58 62
        if(uri != null && context != null && !context.isEmpty()) {
59 63
            Authentication authentication = hostAuthenticationMap.get(getRequestSource(uri, context));
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/DistributionTableView.java
52 52
    private static final long serialVersionUID = 1L;
53 53
    @AutoGenerated
54 54
	private AbsoluteLayout mainLayout;
55
    private HorizontalToolbar toolbar;
55 56
	@AutoGenerated
56 57
	private Table table;
57 58

  
......
65 66

  
66 67
	List<String> columnList;
67 68
	ArrayList<String> headerList;
68
	private HorizontalToolbar toolbar;
69 69

  
70 70
	/**
71 71
	 * The constructor should first build the main layout, set the
......
288 288
	        public Object generateCell(Table source, Object itemId, Object columnId) {
289 289
	            Property containerProperty = source.getContainerProperty(itemId, columnId);
290 290
	            Object item = itemId;
291
	            final Object value = containerProperty.getValue();
291
	            Object value = null;
292
	            if(containerProperty != null){
293
	                value = containerProperty.getValue();
294
	            }
292 295
	            Container containerDataSource = source.getContainerDataSource();
293 296
	            final UUID uuid = UUID.fromString(table.getItem(itemId).getItemProperty("uuid").getValue().toString());
294 297
	            final ComboBox box = new ComboBox("Occurrence Status: ", listener.getPresenceAbsenceContainer());
295 298
	            final String area = columnId.toString();
296 299
	            box.setImmediate(true);
300
	            final Object value1 = value;
297 301
	            box.addValueChangeListener(new ValueChangeListener() {
298 302
	                @Override
299 303
	                public void valueChange(ValueChangeEvent event) {
300 304
	                    Taxon taxon = (Taxon)listener.getTaxonService().load(uuid);
301
	                    if(value==null){
305

  
306
	                    if(value1==null){
302 307
	                        listener.createDistributionField(taxon, box.getValue(), area);
303 308
	                        Notification.show("Create Status", Notification.Type.TRAY_NOTIFICATION);
304 309
	                    }else{
......
315 320
	                private static final long serialVersionUID = 1L;
316 321
	                @Override
317 322
	                public String getMinimizedValueAsHTML() {
318
	                    return refreshValue(box, value);
323
	                    return refreshValue(box, value1);
319 324
	                }
320 325
	                @Override
321 326
	                public Component getPopupComponent() {
322 327
	                    //FIXME: find a better solution
323
	                    box.setValue(compareObjectToPAT(value));
328
	                    box.setValue(compareObjectToPAT(value1));
324 329
	                    box.setBuffered(true);
325 330
	                    return box;
326 331
	                }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)