package eu.etaxonomy.taxeditor.ui.section;
import java.util.Arrays;
+import java.util.EnumSet;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
-import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
+import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement;
/**
public abstract class AbstractIdentifiableEntityDetailElement<T extends IIdentifiableEntity> extends
AbstractCdmDetailElement<T> {
+ /**
+ *
+ */
+ private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE);
protected ToggleableTextElement toggleable_cache;
public AbstractIdentifiableEntityDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
super(formFactory, formElement);
+ updateToggleableCacheState();
+
}
public void updateToggleableCacheField() {
setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache }));
updateToggleableCacheField();
}
+
+
+ @Override
+ protected void updateControlStates(){
+ super.updateControlStates();
+ updateToggleableCacheState();
+ }
+
+
+ private void updateToggleableCacheState() {
+ if(toggleable_cache != null){
+ toggleable_cache.setEnabled(getEntity() != null && CdmStore.currentAuthentiationHasPermission((CdmBase) getEntity(), UPDATE));
+ }
+ }
+
}