import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
*/
private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE);
protected ToggleableTextElement toggleable_cache;
+ protected boolean isAdvancedView ;
public AbstractIdentifiableEntityDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
super(formFactory, formElement);
updateToggleableCacheState();
+ initIsAdvancedDetailsView();
}
public void updateToggleableCacheField() {
- if (!getEntity().isProtectedTitleCache()) {
- toggleable_cache.setText(getEntity().generateTitle());
+ if (toggleable_cache != null){
+ if (!getEntity().isProtectedTitleCache()) {
+ toggleable_cache.setText(getEntity().generateTitle());
+ }
}
}
toggleable_cache.setEnabled(getEntity() != null && CdmStore.currentAuthentiationHasPermission((CdmBase) getEntity(), UPDATE));
}
}
+ protected void initIsAdvancedDetailsView(){
+ if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
+ isAdvancedView = false;
+ } else{
+ isAdvancedView = true;
+ }
+
+
+
+ }
}
@Override
protected void createControls(ICdmFormElement formElement,
NonViralName entity, int style) {
- toggleable_cache = formFactory.createToggleableTextField(this,
+ if (isAdvancedView){
+ toggleable_cache = formFactory.createToggleableTextField(this,
"Authorship Cache", entity.getAuthorshipCache(),
entity.isProtectedAuthorshipCache(), style);
+ //TODO RL
+ if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+ toggleable_cache.setVisible(false);
+ }
+ }
- //TODO RL
- if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
- toggleable_cache.setVisible(false);
- }
selectionCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
getConversationHolder(),
formElement, "Author",
}
super.updateContent();
- toggleable_cache.setEnabled(getEntity().isProtectedAuthorshipCache());
+ if (toggleable_cache != null){
+ toggleable_cache.setEnabled(getEntity().isProtectedAuthorshipCache());
+
- if (this.isIrrelevant()) {
- setIrrelevant(isIrrelevant());
- } else {
- setIrrelevant(toggleable_cache.getState(),
- Arrays.asList(new Object[] { toggleable_cache }));
+ if (this.isIrrelevant()) {
+ setIrrelevant(isIrrelevant());
+ } else {
+ setIrrelevant(toggleable_cache.getState(),
+ Arrays.asList(new Object[] { toggleable_cache }));
+ }
}
}
@Override
public void updateToggleableCacheField() {
- if(! getEntity().isProtectedAuthorshipCache()){
- toggleable_cache.setText(getEntity().getAuthorshipCache());
- }
+ if (toggleable_cache != null){
+ if(! getEntity().isProtectedAuthorshipCache()){
+ toggleable_cache.setText(getEntity().getAuthorshipCache());
+ }
+ }
}
}
private TaxonBase taxonBase;
+
public AuthorshipDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
+
}
/** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement, NonViralName nonViralName, int style) {
- toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
-
+ if (isAdvancedView){
+ toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
+ }
combo_rank = formFactory.createDefinedTermComboElement(TermType.Rank, this, "Rank", nonViralName.getRank(), style);
createGenusOrUninomialControls(this, nonViralName, style);
createInfragenerericEpithetControls(this, nonViralName, style);
createSpecificEpithetControls(this, nonViralName, style);
createInfraSpecificEpithetControls(this, nonViralName, style);
-
- createSpecificNameParts(this, nonViralName, style);
-
- text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
-
+ if (isAdvancedView){
+ createSpecificNameParts(this, nonViralName, style);
+ text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
+ }
}
/**
}
super.updateContent();
-
- if(isIrrelevant()){
- setIrrelevant(isIrrelevant());
- }else{
- setIrrelevant(toggleable_cache.getState(), Arrays.asList(new Object[]{toggleable_cache}));
+ if (isAdvancedView){
+ if(isIrrelevant()){
+ setIrrelevant(isIrrelevant());
+ }else{
+ setIrrelevant(toggleable_cache.getState(), Arrays.asList(new Object[]{toggleable_cache}));
+ }
}
}
@Override
public void updateToggleableCacheField() {
- if(! getEntity().isProtectedNameCache()){
- toggleable_cache.setText(getEntity().getNameCache());
- }
+ if (toggleable_cache != null){
+ if(! getEntity().isProtectedNameCache()){
+ toggleable_cache.setText(getEntity().getNameCache());
+ }
+ }
}
-
+
@Override
protected void handleToggleableCacheField() {
boolean pushedState = toggleable_cache.getState();
getEntity().setTitleCache(toggleable_cache.getText(), pushedState);
setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, text_appendedPhrase, checkbox_anamorphic }));
updateToggleableCacheField();
- }
+ }
+
+
}
@Override
protected AbstractCdmDetailElement<NonViralName> createCdmDetailElement(AbstractCdmDetailSection<NonViralName> parentElement, int style) {
return formFactory.createNameDetailElement(parentElement, style);
+
}
}
* @version 1.0
*/
public class NonViralNameDetailElement extends
- AbstractIdentifiableEntityDetailElement<NonViralName> {
+ AbstractIdentifiableEntityDetailElement<NonViralName> {
private NameDetailSection section_name;
private AuthorshipDetailSection section_author;
private HybridDetailSection section_hybrid;
private LsidWithExceptionLabelElement textLsid;
+
public NonViralNameDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
super(formFactory, formElement);
+ initIsAdvancedDetailsView();
+
}
/** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement, final NonViralName entity, int style) {
- toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
- combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
- combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
- //TODO RL
- if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
- toggleable_cache.setVisible(false);
- combo_nomenclaturalCode.setVisible(false);
- }
- textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style);
+ if (isAdvancedView){
+ toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
+
+ combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
+ combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
+ textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style);
+ //TODO RL
+ if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+ toggleable_cache.setVisible(false);
+ combo_nomenclaturalCode.setVisible(false);
+ }
+ }
+
+
section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addControl(section_name);
addElement(section_author);
//TODO RL
- if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
- section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
- section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- addControl(section_hybrid);
- addElement(section_hybrid);
+ if (isAdvancedView){
+ if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+ section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
+ section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ addControl(section_hybrid);
+ addElement(section_hybrid);
+ }
}
setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, textLsid }));
updateToggleableCacheField();
}
+
+
+
+
+// @Override
+// public void toggleAdvancedMediaView(){
+// mediaDetailElement.toggleAdvancedMediaView();
+// }
}
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.model.ImageResources;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.dialog.selection.NameSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
protected Control createToolbar() {
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
- if(nameChoosable){
+ if(nameChoosable && !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
//choose name
Action chooseNameAction = new Action("Choose Name", IAction.AS_PUSH_BUTTON){
@Override
ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
+ if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
+ TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
+ addPart(taxonBaseDetailSection);
+ }
NonViralNameDetailSection nonViralNameSection = formFactory
.createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
+ NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ addPart(nomenclaturalStatusSection);
+ addPart(referenceDetailSection);
+ }
//TODO RL
- if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+ if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL) && !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
}
addPart(parsingMessagesSection);
- addPart(taxonBaseDetailSection);
+
addPart(nonViralNameSection);
- addPart(nomenclaturalStatusSection);
- addPart(referenceDetailSection);
+
}
private void createNameSections(RootElement parent) {