Revision 707b6237
Added by Niels Hoffmann over 12 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPart.java | ||
---|---|---|
38 | 38 |
import eu.etaxonomy.cdm.model.description.PolytomousKey; |
39 | 39 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
40 | 40 |
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter; |
41 |
import eu.etaxonomy.taxeditor.model.DataChangeBridge; |
|
41 | 42 |
import eu.etaxonomy.taxeditor.model.IContextListener; |
42 | 43 |
import eu.etaxonomy.taxeditor.navigation.NavigationUtil; |
43 | 44 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
... | ... | |
104 | 105 |
private ListViewer viewer; |
105 | 106 |
private ConversationHolder conversation; |
106 | 107 |
private IContextListener contextListener; |
107 |
private CdmFormFactory formFactory; |
|
108 |
private final CdmFormFactory formFactory;
|
|
108 | 109 |
private Text text_filter; |
109 | 110 |
|
111 |
private PolytomousKeyViewPartDataChangeBehavior dataChangeBehavior; |
|
112 |
|
|
110 | 113 |
public PolytomousKeyViewPart(){ |
111 | 114 |
formFactory = new CdmFormFactory(Display.getDefault()); |
112 | 115 |
} |
... | ... | |
127 | 130 |
text_filter.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); |
128 | 131 |
text_filter.addModifyListener(new FilterModifyListener()); |
129 | 132 |
|
130 |
viewer = new ListViewer(container, SWT.H_SCROLL | SWT.V_SCROLL); |
|
133 |
viewer = new ListViewer(container, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
|
|
131 | 134 |
viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
132 | 135 |
|
133 | 136 |
viewer.setContentProvider(new PolytomousKeyContentProvider()); |
... | ... | |
177 | 180 |
|
178 | 181 |
private void setInput() { |
179 | 182 |
conversation = CdmStore.createConversation(); |
183 |
conversation.registerForDataStoreChanges(this); |
|
180 | 184 |
List<PolytomousKey> input = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null); |
181 | 185 |
viewer.setInput(input); |
182 | 186 |
} |
... | ... | |
193 | 197 |
* @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap) |
194 | 198 |
*/ |
195 | 199 |
@Override |
196 |
public void update(CdmDataChangeMap changeEvents) {} |
|
200 |
public void update(CdmDataChangeMap changeEvents) { |
|
201 |
if (dataChangeBehavior == null) { |
|
202 |
dataChangeBehavior = new PolytomousKeyViewPartDataChangeBehavior(this); |
|
203 |
} |
|
204 |
|
|
205 |
DataChangeBridge.handleDataChange(changeEvents, dataChangeBehavior); |
|
206 |
} |
|
197 | 207 |
|
198 | 208 |
/* (non-Javadoc) |
199 | 209 |
* @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder() |
... | ... | |
208 | 218 |
*/ |
209 | 219 |
@Override |
210 | 220 |
public void dispose() { |
221 |
conversation.unregisterForDataStoreChanges(this); |
|
222 |
conversation.close(); |
|
211 | 223 |
CdmStore.getContextManager().removeContextListener(contextListener); |
212 | 224 |
super.dispose(); |
213 | 225 |
} |
... | ... | |
229 | 241 |
return true; |
230 | 242 |
} |
231 | 243 |
|
244 |
/** |
|
245 |
* |
|
246 |
*/ |
|
247 |
public void refresh() { |
|
248 |
getConversationHolder().bind(); |
|
249 |
List<PolytomousKey> input = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null); |
|
250 |
viewer.setInput(input); |
|
251 |
} |
|
252 |
|
|
232 | 253 |
} |
Also available in: Unified diff
Merged with trunk