2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.editor
.key
;
12 import java
.util
.Vector
;
14 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
15 import eu
.etaxonomy
.cdm
.persistence
.hibernate
.CdmDataChangeEvent
;
16 import eu
.etaxonomy
.cdm
.persistence
.hibernate
.CdmDataChangeEvent
.EventType
;
17 import eu
.etaxonomy
.cdm
.persistence
.hibernate
.CdmDataChangeMap
;
18 import eu
.etaxonomy
.taxeditor
.editor
.key
.polytomous
.PolytomousKeyEditorInput
;
19 import eu
.etaxonomy
.taxeditor
.model
.AbstractDataChangeBehaviour
;
23 * @created May 5, 2011
26 public class KeyEditorDataChangeBehaviour
extends AbstractDataChangeBehaviour
{
28 private final KeyEditor source
;
29 private PolytomousKeyEditorInput input
;
34 public KeyEditorDataChangeBehaviour(KeyEditor keyEditor
) {
39 * @see eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour#reactOnDataChange(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
42 public void reactOnDataChange(CdmDataChangeMap changeEvents
) {
43 input
= (PolytomousKeyEditorInput
) source
.getEditorInput();
45 if(changeEvents
.sizeByEventType(EventType
.UPDATE
) > 0){
46 reactOnUpdate(changeEvents
.getEvents(EventType
.UPDATE
));
52 public void reactOnUpdate(Vector
<CdmDataChangeEvent
> events
){
54 for(CdmDataChangeEvent event
: events
){
56 // update editor title
57 if(event
.getEntity() instanceof PolytomousKey
){
58 if(input
.getKey().equals(event
.getEntity())){
59 // set the name of the editor window