Project

General

Profile

« Previous | Next » 

Revision 8407c42c

Added by Katja Luther over 7 years ago

ref #6159: fix that some column show no data

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java
10 10

  
11 11
package eu.etaxonomy.taxeditor.ui.section.reference;
12 12

  
13

  
13 14
import java.util.ArrayList;
14 15
import java.util.Arrays;
15 16
import java.util.List;
16 17

  
17 18
import org.eclipse.swt.SWT;
19
import org.eclipse.swt.widgets.Display;
20
import org.eclipse.swt.widgets.Label;
21
import org.eclipse.swt.graphics.Color;
22
import org.eclipse.swt.graphics.FontData;
18 23

  
24
import eu.etaxonomy.cdm.common.CdmUtils;
19 25
import eu.etaxonomy.cdm.model.agent.AgentBase;
20 26
import eu.etaxonomy.cdm.model.agent.Institution;
21 27
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
22 28
import eu.etaxonomy.cdm.model.reference.Reference;
23 29
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
24 30
import eu.etaxonomy.cdm.model.reference.ReferenceType;
31
import eu.etaxonomy.taxeditor.store.CdmStore;
25 32
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
26 33
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
27 34
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
28 35
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
29 36
import eu.etaxonomy.taxeditor.ui.element.IErrorIntolerableElement;
30 37
import eu.etaxonomy.taxeditor.ui.element.IExceptionHandler;
38
import eu.etaxonomy.taxeditor.ui.element.LabelElement;
39
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
31 40
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
32 41
import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
33 42
import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement;
......
47 56
public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElement<Reference>
48 57
		implements IErrorIntolerableElement, IExceptionHandler {
49 58

  
59
	private LabelElement warnForReferencedObjects;
60
	
50 61
    private ToggleableTextElement toggleableAbbrevCache;
51 62

  
52 63
	private TextWithLabelElement text_edition;
......
102 113
	@Override
103 114
	protected void createControls(ICdmFormElement formElement,
104 115
			Reference entity, int style) {
116
		setWarnForReferencingObjects(formElement);
117
		
105 118
		toggleable_cache = formFactory.createToggleableTextField(formElement,
106 119
				"Reference Cache", entity.getTitleCache(),
107 120
				entity.isProtectedTitleCache(), style);
......
588 601
	    }
589 602
	    setIrrelevant(pushedState, except);
590 603
	}
604
	
605
	public void setWarnForReferencingObjects(ICdmFormElement formElement){
606
		Integer referencingObjectsCount = CdmStore.getCommonService().getReferencingObjectsCount(getEntity());
607
		if (referencingObjectsCount > 1){
608
			if (warnForReferencedObjects == null){
609
				warnForReferencedObjects = formFactory.createLabel(formElement, CdmUtils.Nz("The reference is referenced by " + referencingObjectsCount+ " objects, if you change it, it is changed for all these objects"));
610
				warnForReferencedObjects.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
611
				warnForReferencedObjects.setLayout(LayoutConstants.FILL(2, 2));
612
				warnForReferencedObjects.setForeground(Display.getCurrent().getSystemColor(
613
						SWT.COLOR_RED));
614
				
615
			}else{
616
				warnForReferencedObjects.setText(CdmUtils.Nz("The reference is referenced by " + referencingObjectsCount+ " objects, if you change it, it is changed for all these objects"));
617
			}
618
		}
619
	}
620
	
591 621
}

Also available in: Unified diff