Project

General

Profile

« Previous | Next » 

Revision 179110e9

Added by Katja Luther about 6 years ago

add symbol to unplaced and excluded taxa in taxonnavigator

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/ContainerFactoryE4.java
45 45
		}
46 46

  
47 47
		for(HomotypicalGroup homotypicalGroup : taxonNameEditor.getTaxon().getHeterotypicSynonymyGroups()){
48
		    homotypicalGroup = HibernateProxyHelper.deproxy(homotypicalGroup, HomotypicalGroup.class);
48 49
		    HomotypicalSynonymGroupE4 group = createOrUpdateHeterotypicSynonymyGroup(taxonNameEditor, homotypicalGroup);
49 50

  
50 51
			retainedGroups.remove(group);
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewLabelProvider.java
83 83
                    }
84 84

  
85 85
                }
86
                URI uri = smallestPart.getUri();
87
                if (uri == null){
88
                    return null;
89
                }
90
                InputStream imageStream;
91
                try {
92
                    imageStream = UriUtils.getInputStream(uri);
93
                    image = new Image(Display.getCurrent(), imageStream);
94
                    int height = image.getBounds().height;
95
                    int width = image.getBounds().width;
96

  
97
                    if (height>width){
98
                        width = width/(height/scale);
99
                        height = scale;
100
                    }else{
101
                        height = height/(width/scale);
102
                        width = scale;
86
                if (smallestPart != null){
87
                    URI uri = smallestPart.getUri();
88
                    if (uri == null){
89
                        return null;
103 90
                    }
104
                    Image scaled = new Image(Display.getDefault(), scale, scale);
91
                    InputStream imageStream;
92
                    try {
93
                        imageStream = UriUtils.getInputStream(uri);
94
                        image = new Image(Display.getCurrent(), imageStream);
95
                        int height = image.getBounds().height;
96
                        int width = image.getBounds().width;
97

  
98
                        if (height>width){
99
                            width = width/(height/scale);
100
                            height = scale;
101
                        }else{
102
                            height = height/(width/scale);
103
                            width = scale;
104
                        }
105
                        Image scaled = new Image(Display.getDefault(), scale, scale);
105 106

  
106
                    GC gc = new GC(scaled);
107
                    gc.setAntialias(SWT.ON);
108
                    gc.setInterpolation(SWT.HIGH);
107
                        GC gc = new GC(scaled);
108
                        gc.setAntialias(SWT.ON);
109
                        gc.setInterpolation(SWT.HIGH);
109 110

  
110 111

  
111
                    gc.drawImage(image, 0, 0,
112
                    image.getBounds().width, image.getBounds().height,
113
                    0, 0, width, height);
112
                        gc.drawImage(image, 0, 0,
113
                        image.getBounds().width, image.getBounds().height,
114
                        0, 0, width, height);
114 115

  
115
                    gc.dispose();
116
                    image.dispose(); // don't forget about me!
117
                    return scaled;
116
                        gc.dispose();
117
                        image.dispose(); // don't forget about me!
118
                        return scaled;
118 119

  
119
                } catch (Exception e) {
120
                    // TODO Auto-generated catch block
121
                   return null;
120
                    } catch (Exception e) {
121
                        // TODO Auto-generated catch block
122
                       return null;
123
                    }
124

  
125
                }else{
126
                    return null;
122 127
                }
123 128

  
124 129
            }
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorLabelProviderE4.java
10 10
package eu.etaxonomy.taxeditor.navigation.navigator.e4;
11 11

  
12 12
import org.eclipse.jface.viewers.StyledString;
13
import org.eclipse.jface.viewers.StyledString.Styler;
14
import org.eclipse.swt.graphics.TextStyle;
13 15
import org.eclipse.ui.navigator.IDescriptionProvider;
14 16

  
15 17
import eu.etaxonomy.cdm.model.taxon.Classification;
16 18
import eu.etaxonomy.cdm.model.taxon.Taxon;
17 19
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
18 20
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
21
import eu.etaxonomy.taxeditor.preference.Resources;
22
import eu.etaxonomy.taxeditor.store.StoreUtil;
19 23
import eu.etaxonomy.taxeditor.util.TaxonTreeNodeLabelProvider;
20 24

  
21 25
/**
......
38 42
//            return "= " + ((Synonym) element).getName().getTitleCache(); //$NON-NLS-1$
39 43
//        }
40 44
    }
45
//    @Override
46
//    public Font getFont(Object element) {
47
//
48
//        return new Font(null, "Arial Unicode MS", 10, SWT.NORMAL);
49
//
50
//    }
41 51

  
42 52
    /**
43 53
     * {@inheritDoc}
......
76 86
//        }
77 87
    }
78 88

  
89

  
90
    private Styler getNotGrantedStyler() {
91
        if (notGrantedStyler  == null) {
92
            notGrantedStyler = new Styler() {
93
                @Override
94
                public void applyStyles(TextStyle textStyle) {
95
                    textStyle.underline = false;
96
                    textStyle.foreground = StoreUtil.getColor(Resources.COLOR_TEXT_DISABLED);
97
                }
98
            };
99
        }
100
        return notGrantedStyler;
101
    }
102

  
103

  
79 104
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/util/TaxonTreeNodeLabelProvider.java
36 36
public class TaxonTreeNodeLabelProvider extends ColumnLabelProvider
37 37
implements IStyledLabelProvider {
38 38

  
39
    private Styler notGrantedStyler = null;
39
    protected Styler notGrantedStyler = null;
40 40

  
41 41
    /**
42 42
     * {@inheritDoc}
......
51 51
        //taxon node
52 52
        else if (element instanceof TaxonNode){
53 53
            TaxonNode taxonNode = (TaxonNode) HibernateProxyHelper.deproxy(element);
54

  
55
            try{
54
          try{
56 55
                Taxon taxon = HibernateProxyHelper.deproxy(taxonNode.getTaxon());
57 56
                if(taxon == null){
58 57
                    String text = taxonNode.getClassification().getName() == null ? null : taxonNode.getClassification().getName().getText();
......
62 61
                    return text;
63 62
                }else{
64 63
                    try{
65
                        return taxon.getName() != null ? ((IIdentifiableEntity) HibernateProxyHelper.deproxy(taxon.getName())).getTitleCache() : new String();
64
                        String text= "";
65
                            if (taxonNode.isUnplaced()){
66
                                text += Character.toString((char)248) + " ";
67
                            }
68
                            if (taxonNode.isExcluded()){
69
                                text +=Character.toString((char)191) + " ";
70
                            }
71
                        text += taxon.getName() != null ? ((IIdentifiableEntity) HibernateProxyHelper.deproxy(taxon.getName())).getTitleCache() : new String();
72
                        return text;
66 73
                    }catch(Exception e){
67 74
                        MessagingUtils.error(getClass(), e);
68 75
                    }

Also available in: Unified diff