Project

General

Profile

Revision 2bbdfed5

ID2bbdfed5db6eded399074eed25589a3487b8f543
Parent 4c9c08a9
Child 276ef31b

Added by Patrick Plitzner almost 2 years ago

Add facet information to term search result composite

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/facet/term/TermSearchResultComposite.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.view.search.facet.term;
10 10

  
11
import java.util.stream.Collectors;
12

  
11 13
import org.eclipse.jface.layout.GridDataFactory;
12 14
import org.eclipse.jface.resource.JFaceResources;
13 15
import org.eclipse.swt.SWT;
......
18 20
import org.eclipse.swt.widgets.Composite;
19 21
import org.eclipse.swt.widgets.Label;
20 22

  
23
import eu.etaxonomy.cdm.common.CdmUtils;
21 24
import eu.etaxonomy.cdm.persistence.dto.TermDto;
22 25
import eu.etaxonomy.taxeditor.view.search.facet.CheckBoxSearchResultComposite;
23 26

  
......
28 31
 */
29 32
public class TermSearchResultComposite extends CheckBoxSearchResultComposite<TermDto, TermSearchResult> {
30 33

  
31
    private Label label;
32

  
33 34
    public TermSearchResultComposite(TermSearchResult result, Composite parent, int style) {
34 35
        super(result, parent, style);
35 36
    }
......
40 41
        content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
41 42
        GridLayout layout = new GridLayout(1, false);
42 43
        content.setLayout(layout);
43
        label = new Label(content, SWT.WRAP);
44
        Label label = new Label(content, SWT.WRAP);
44 45
        label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
45 46
        label.setText(result.getContent().getRepresentation_L10n());
46 47
        label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
47 48
        GridDataFactory.fillDefaults().applyTo(label);
48 49

  
50
        String facetText = result.getFacets().stream()
51
                .map(facet -> (facet.getFacet() != null ? facet.getFacet() : "")
52
                        + (facet.getCategory() != null ? " (" + facet.getCategory() + ")" : ""))
53
                .collect(Collectors.joining(","));
54
        if (CdmUtils.isNotBlank(facetText)) {
55
            Label labelFacets = new Label(content, SWT.WRAP);
56
            labelFacets.setText(facetText);
57
            labelFacets.setFont(JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT));
58
        }
59

  
49 60
        Label lblDescription = new Label(content, SWT.WRAP);
50 61
        GridData layoutData = new GridData();
51 62
        lblDescription.setLayoutData(layoutData);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)