Project

General

Profile

Download (2.68 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

    
11
package eu.etaxonomy.taxeditor.bulkeditor;
12

    
13
import org.apache.log4j.Logger;
14
import org.eclipse.swt.graphics.Image;
15

    
16
import eu.etaxonomy.cdm.api.service.ICommonService;
17
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
18
import eu.etaxonomy.taxeditor.propertysheet.reference.ReferencePropertySource;
19
import eu.etaxonomy.taxeditor.store.CdmStore;
20

    
21
/**
22
 * @author p.ciardelli
23
 * @created 07.07.2009
24
 * @version 1.0
25
 */
26
public class BulkEditorLineDisplay implements ILineDisplayStrategy {
27
	private static final Logger logger = Logger
28
			.getLogger(BulkEditorLineDisplay.class);
29

    
30
	/* (non-Javadoc)
31
	 * @see eu.etaxonomy.taxeditor.bulkeditor.ILineDisplayStrategy#getIcon(java.lang.Object)
32
	 */
33
	public Image getIcon(Object entity) {
34
		// TODO Auto-generated method stub
35
		return null;
36
	}
37

    
38
	/* (non-Javadoc)
39
	 * @see eu.etaxonomy.taxeditor.bulkeditor.ILineDisplayStrategy#getIndent(java.lang.Object)
40
	 */
41
	public int getIndent(Object entity) {
42
		// TODO Auto-generated method stub
43
		return 0;
44
	}
45

    
46
	/* (non-Javadoc)
47
	 * @see eu.etaxonomy.taxeditor.bulkeditor.ILineDisplayStrategy#getPropertySource(java.lang.Object)
48
	 */
49
	public Object getPropertySource(Object entity) {
50
		if (entity instanceof ReferenceBase) {
51
			return new ReferencePropertySource((ReferenceBase) entity);			
52
		}
53
		return null;
54
	}
55

    
56
	/* (non-Javadoc)
57
	 * @see eu.etaxonomy.taxeditor.bulkeditor.ILineDisplayStrategy#getText(java.lang.Object)
58
	 */
59
	public String getText(Object entity) {		
60
		if (entity instanceof ReferenceBase) {
61
			return ((ReferenceBase) entity).getTitleCache();
62
		}
63
		return null;
64
	}
65

    
66
	/* (non-Javadoc)
67
	 * @see eu.etaxonomy.taxeditor.bulkeditor.ILineDisplayStrategy#setText(java.lang.String, java.lang.Object)
68
	 */
69
	public void setText(String text, Object entity) {
70
		if (entity instanceof ReferenceBase) {
71
			((ReferenceBase) entity).setTitleCache(text);			
72
		}
73
	}
74

    
75
	/* (non-Javadoc)
76
	 * @see eu.etaxonomy.taxeditor.bulkeditor.ILineDisplayStrategy#getHoverText(java.lang.Object)
77
	 */
78
	public String getHoverText(Object entity) {
79
//		ICommonService commonService = CdmStore.getApplicationController().getCommonService();
80
//		commonService.
81
		String content = "<b>" + getText(entity) + "</b> is used in the following contexts:";
82
		content += "<ol>";
83
		content += "<li><b>Description:</b> Some description</li>";
84
		content += "<li><b>Name:</b> Some name</li>";
85
		content += "</ol>";
86
		return content;
87
	}
88
}
(3-3/21)