Revision 239530ee
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java | ||
---|---|---|
765 | 765 |
getPreferenceStore().setDefault(createPreferenceString(OPENURL_IMAGE_MAX_WIDTH), "1000"); |
766 | 766 |
getPreferenceStore().setDefault(createPreferenceString(OPENURL_IMAGE_MAX_HEIGHT), "1000"); |
767 | 767 |
//Distribution Editor: |
768 |
getPreferenceStore().setDefault(createPreferenceString(DISTRIBUTION_AREA_PREFRENCES_ACTIVE), true);
|
|
769 |
getPreferenceStore().setDefault(createPreferenceString(CHECKLIST_AREA_DISPLAY), CHECKLIST_AREA_DISPLAY_TITLE);
|
|
770 |
getPreferenceStore().setDefault(createPreferenceString(CHECKLIST_STATUS_DISPLAY), false);
|
|
768 |
getPreferenceStore().setDefault(createPreferenceString(EditorPreferencePredicate.DistributionEditorActivated.getKey()), true);
|
|
769 |
getPreferenceStore().setDefault(createPreferenceString(EditorPreferencePredicate.DisplayOfAreasInDistributionEditor.getKey()), EditorPreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue().toString());
|
|
770 |
getPreferenceStore().setDefault(createPreferenceString(EditorPreferencePredicate.DisplayOfStatus.getKey()), EditorPreferencePredicate.DisplayOfStatus.getDefaultValue().toString());
|
|
771 | 771 |
|
772 | 772 |
|
773 | 773 |
//Name Details |
... | ... | |
1245 | 1245 |
* @return |
1246 | 1246 |
*/ |
1247 | 1247 |
public static boolean isShowIdInVocabularyInChecklistEditor() { |
1248 |
String area_display = getStringValue(IPreferenceKeys.CHECKLIST_AREA_DISPLAY);
|
|
1248 |
String area_display = getStringValue(EditorPreferencePredicate.DisplayOfAreasInDistributionEditor.getKey());
|
|
1249 | 1249 |
if (area_display.equals(TermDisplayEnum.IdInVocabulary.getKey())) { |
1250 | 1250 |
return true; |
1251 | 1251 |
}else{ |
... | ... | |
1253 | 1253 |
} |
1254 | 1254 |
} |
1255 | 1255 |
public static boolean isShowSymbol1InChecklistEditor() { |
1256 |
String area_display = getStringValue(IPreferenceKeys.CHECKLIST_AREA_DISPLAY);
|
|
1256 |
String area_display = getStringValue(EditorPreferencePredicate.DisplayOfAreasInDistributionEditor.getKey());
|
|
1257 | 1257 |
if (area_display.equals(TermDisplayEnum.Symbol1.getKey())) { |
1258 | 1258 |
return true; |
1259 | 1259 |
}else{ |
... | ... | |
1261 | 1261 |
} |
1262 | 1262 |
} |
1263 | 1263 |
public static boolean isShowSymbol2InChecklistEditor() { |
1264 |
String area_display = getStringValue(IPreferenceKeys.CHECKLIST_AREA_DISPLAY);
|
|
1264 |
String area_display = getStringValue(EditorPreferencePredicate.DisplayOfAreasInDistributionEditor.getKey());
|
|
1265 | 1265 |
if (area_display.equals(TermDisplayEnum.Symbol2.getKey())) { |
1266 | 1266 |
return true; |
1267 | 1267 |
}else{ |
... | ... | |
1269 | 1269 |
} |
1270 | 1270 |
} |
1271 | 1271 |
public static void setAreaDisplayInChecklistEditor(String selection) { |
1272 |
setStringValue(CHECKLIST_AREA_DISPLAY, selection); |
|
1272 |
setStringValue(EditorPreferencePredicate.DisplayOfAreasInDistributionEditor.getKey(), selection); |
|
1273 |
} |
|
1274 |
|
|
1275 |
public static void setOwnDescriptionForChecklistEditor(boolean selection) { |
|
1276 |
setBooleanValue(EditorPreferencePredicate.OwnDescriptionForDistributionEditor.getKey(), selection); |
|
1277 |
} |
|
1278 |
|
|
1279 |
public static boolean isOwnDescriptionForChecklistEditor() { |
|
1280 |
return getBooleanValue(EditorPreferencePredicate.OwnDescriptionForDistributionEditor.getKey()); |
|
1273 | 1281 |
} |
1274 | 1282 |
|
1275 | 1283 |
/** |
1276 | 1284 |
* @return |
1277 | 1285 |
*/ |
1278 | 1286 |
public static String displayStatusInChecklistEditor() { |
1279 |
return getStringValue(IPreferenceKeys.CHECKLIST_STATUS_DISPLAY);
|
|
1287 |
return getStringValue(EditorPreferencePredicate.DisplayOfStatus.getKey());
|
|
1280 | 1288 |
} |
1281 | 1289 |
public static void setDisplayStatusInChecklistEditor(String selection) { |
1282 |
setStringValue(CHECKLIST_STATUS_DISPLAY, selection);
|
|
1290 |
setStringValue(EditorPreferencePredicate.DisplayOfStatus.getKey(), selection);
|
|
1283 | 1291 |
} |
1284 | 1292 |
|
1285 | 1293 |
/** |
1286 | 1294 |
* @return |
1287 | 1295 |
*/ |
1288 | 1296 |
public static boolean isShowRankInChecklistEditor() { |
1289 |
return getBooleanValue(IPreferenceKeys.CHECKLIST_SHOW_RANK);
|
|
1297 |
return getBooleanValue(EditorPreferencePredicate.ShowRankInDistributionEditor.getKey());
|
|
1290 | 1298 |
} |
1291 | 1299 |
public static void setShowRankInChecklistEditor(boolean selection) { |
1292 |
setBooleanValue(CHECKLIST_SHOW_RANK, selection);
|
|
1300 |
setBooleanValue(EditorPreferencePredicate.ShowRankInDistributionEditor.getKey(), selection);
|
|
1293 | 1301 |
} |
1294 | 1302 |
|
1295 | 1303 |
/** |
... | ... | |
1671 | 1679 |
*/ |
1672 | 1680 |
public static boolean isSortNamedAreaByOrderInVocabulary() { |
1673 | 1681 |
|
1674 |
return getBooleanValue(IPreferenceKeys.SORT_NAMED_AREA_BY_VOCABULARY_ORDER);
|
|
1682 |
return getBooleanValue(EditorPreferencePredicate.AreasSortedByIdInVocabulary.getKey());
|
|
1675 | 1683 |
} |
1676 | 1684 |
|
1677 | 1685 |
public static void setSortNamedAreasByOrderInVocabulary(boolean isSortByVocabularyOrder) { |
1678 |
setBooleanValue(IPreferenceKeys.SORT_NAMED_AREA_BY_VOCABULARY_ORDER, isSortByVocabularyOrder);
|
|
1686 |
setBooleanValue(EditorPreferencePredicate.AreasSortedByIdInVocabulary.getKey(), isSortByVocabularyOrder);
|
|
1679 | 1687 |
|
1680 | 1688 |
} |
1681 | 1689 |
|
... | ... | |
1724 | 1732 |
public static void setPreferredNamedAreasForDistributionEditor( |
1725 | 1733 |
String saveCheckedElements, String saveGrayedElements, boolean local) { |
1726 | 1734 |
if (local){ |
1727 |
setStringValue(PreferencesUtil.DISTRIBUTION_AREA_OCCURENCE_STATUS, saveCheckedElements);
|
|
1735 |
setStringValue(PreferencePredicate.AvailableDistributionAreaTerms.getKey(), saveCheckedElements);
|
|
1728 | 1736 |
|
1729 | 1737 |
} |
1730 | 1738 |
else{ |
... | ... | |
1736 | 1744 |
if (preference == null){ |
1737 | 1745 |
return ; |
1738 | 1746 |
} else{ |
1739 |
setStringValue(DISTRIBUTION_AREA_OCCURENCE_STATUS,
|
|
1747 |
setStringValue(PreferencePredicate.AvailableDistributionAreaTerms.getKey(),
|
|
1740 | 1748 |
saveCheckedElements); |
1741 | 1749 |
preference = CdmPreference.NewInstance(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AvailableDistributionAreaTerms, saveCheckedElements); |
1742 | 1750 |
setPreferenceToDB(preference); |
... | ... | |
1745 | 1753 |
} else{ |
1746 | 1754 |
preference = CdmPreference.NewInstance(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AvailableDistributionAreaTerms, saveCheckedElements); |
1747 | 1755 |
setPreferenceToDB(preference); |
1748 |
setStringValue(DISTRIBUTION_AREA_OCCURENCE_STATUS,
|
|
1756 |
setStringValue(PreferencePredicate.AvailableDistributionAreaTerms.getKey(),
|
|
1749 | 1757 |
saveCheckedElements); |
1750 | 1758 |
|
1751 | 1759 |
} |
... | ... | |
1761 | 1769 |
public static void setPreferredVocabulariesForDistributionEditor(String saveCheckedElements, |
1762 | 1770 |
boolean local) { |
1763 | 1771 |
if (local){ |
1764 |
setStringValue(PreferencesUtil.DISTRIBUTION_VOCABULARIES, saveCheckedElements);
|
|
1772 |
setStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey(), saveCheckedElements);
|
|
1765 | 1773 |
} |
1766 | 1774 |
else{ |
1767 | 1775 |
ICdmRepository controller; |
... | ... | |
1773 | 1781 |
if (preference == null){ |
1774 | 1782 |
return ; |
1775 | 1783 |
} else{ |
1776 |
setStringValue(DISTRIBUTION_VOCABULARIES,
|
|
1784 |
setStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey(),
|
|
1777 | 1785 |
saveCheckedElements); |
1778 | 1786 |
preference = CdmPreference.NewInstance(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AvailableDistributionAreaVocabularies, saveCheckedElements); |
1779 | 1787 |
setPreferenceToDB(preference); |
... | ... | |
1781 | 1789 |
} else{ |
1782 | 1790 |
preference = CdmPreference.NewInstance(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AvailableDistributionAreaVocabularies, saveCheckedElements); |
1783 | 1791 |
setPreferenceToDB(preference); |
1784 |
setStringValue(DISTRIBUTION_VOCABULARIES,
|
|
1792 |
setStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey(),
|
|
1785 | 1793 |
saveCheckedElements); |
1786 | 1794 |
|
1787 | 1795 |
} |
... | ... | |
1799 | 1807 |
public static String getPreferredVocabulariesForDistributionEditor(boolean local) { |
1800 | 1808 |
if (local){ |
1801 | 1809 |
|
1802 |
String pref = getStringValue(DISTRIBUTION_VOCABULARIES);
|
|
1810 |
String pref = getStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey());
|
|
1803 | 1811 |
return pref; |
1804 | 1812 |
} |
1805 | 1813 |
else{ |
... | ... | |
1907 | 1915 |
preference = getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies); |
1908 | 1916 |
if (preference != null){ |
1909 | 1917 |
if (!getBooleanValue(DISTRIBUTION_VOCABULARIES_OVERRIDE) || !preference.isAllowOverride()){ |
1910 |
setStringValue(DISTRIBUTION_VOCABULARIES, preference.getValue());
|
|
1918 |
setStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey(), preference.getValue());
|
|
1911 | 1919 |
setBooleanValue(DISTRIBUTION_VOCABULARIES_ALLOW_OVERRIDE, preference.isAllowOverride()); |
1912 | 1920 |
} |
1913 | 1921 |
}else{ |
1914 | 1922 |
setBooleanValue(DISTRIBUTION_VOCABULARIES_ALLOW_OVERRIDE,true); |
1915 |
setStringValue(DISTRIBUTION_VOCABULARIES, "");
|
|
1923 |
setStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey(), "");
|
|
1916 | 1924 |
} |
1917 | 1925 |
|
1918 |
preference = getPreferenceFromDB(PreferencePredicate.DistributionEditorActivated); |
|
1926 |
preference = getPreferenceFromDB(EditorPreferencePredicate.DistributionEditorActivated);
|
|
1919 | 1927 |
if (preference != null){ |
1928 |
boolean test = getBooleanValue(DISTRIBUTION_AREA_PREFRENCES_ACTIVE_OVERRIDE); |
|
1920 | 1929 |
if (!getBooleanValue(DISTRIBUTION_AREA_PREFRENCES_ACTIVE_OVERRIDE) || !preference.isAllowOverride()){ |
1921 |
setBooleanValue(DISTRIBUTION_AREA_PREFRENCES_ACTIVE, Boolean.valueOf(preference.getValue())); |
|
1930 |
setBooleanValue(EditorPreferencePredicate.DistributionEditorActivated.getKey(), Boolean.valueOf(preference.getValue())); |
|
1931 |
}else{ |
|
1932 |
test = getBooleanValue(EditorPreferencePredicate.DistributionEditorActivated.getKey()); |
|
1933 |
System.err.println(test); |
|
1922 | 1934 |
} |
1923 | 1935 |
} |
1924 | 1936 |
|
... | ... | |
1942 | 1954 |
} |
1943 | 1955 |
} |
1944 | 1956 |
|
1957 |
preference = getPreferenceFromDB(EditorPreferencePredicate.DistributionEditorActivated); |
|
1958 |
if (preference != null){ |
|
1959 |
if (!getBooleanValue(DISTRIBUTION_DESCRIPTION_OVERRIDE) || !preference.isAllowOverride()){ |
|
1960 |
setBooleanValue(EditorPreferencePredicate.DistributionEditorActivated.getKey(), Boolean.valueOf(preference.getValue())); |
|
1961 |
} |
|
1962 |
} |
|
1963 |
|
|
1964 |
preference = getPreferenceFromDB(EditorPreferencePredicate.DisplayOfAreasInDistributionEditor); |
|
1965 |
if (preference != null){ |
|
1966 |
if (!getBooleanValue(DISTRIBUTION_DISPLAY_AREA_OVERRIDE) || !preference.isAllowOverride()){ |
|
1967 |
setStringValue(EditorPreferencePredicate.DisplayOfAreasInDistributionEditor.getKey(), preference.getValue()); |
|
1968 |
} |
|
1969 |
} |
|
1970 |
|
|
1971 |
preference = getPreferenceFromDB(EditorPreferencePredicate.DisplayOfStatus); |
|
1972 |
if (preference != null){ |
|
1973 |
if (!getBooleanValue(DISTRIBUTION_DISPLAY_STATUS_OVERRIDE) || !preference.isAllowOverride()){ |
|
1974 |
setStringValue(EditorPreferencePredicate.DisplayOfStatus.getKey(), preference.getValue()); |
|
1975 |
} |
|
1976 |
} |
|
1977 |
|
|
1978 |
preference = getPreferenceFromDB(EditorPreferencePredicate.ShowRankInDistributionEditor); |
|
1979 |
if (preference != null){ |
|
1980 |
if (!getBooleanValue(DISTRIBUTION_SHOW_RANK_OVERRIDE) || !preference.isAllowOverride()){ |
|
1981 |
setBooleanValue(EditorPreferencePredicate.ShowRankInDistributionEditor.getKey(), Boolean.valueOf(preference.getValue())); |
|
1982 |
} |
|
1983 |
} |
|
1984 |
|
|
1985 |
preference = getPreferenceFromDB(EditorPreferencePredicate.AreasSortedByIdInVocabulary); |
|
1986 |
if (preference != null){ |
|
1987 |
if (!getBooleanValue(DISTRIBUTION_AREAS_SORTED_BY_IDINVOC_OVERRIDE) || !preference.isAllowOverride()){ |
|
1988 |
setBooleanValue(EditorPreferencePredicate.AreasSortedByIdInVocabulary.getKey(), Boolean.valueOf(preference.getValue())); |
|
1989 |
} |
|
1990 |
} |
|
1991 |
|
|
1992 |
preference = getPreferenceFromDB(EditorPreferencePredicate.OwnDescriptionForDistributionEditor); |
|
1993 |
if (preference != null){ |
|
1994 |
if (!getBooleanValue(OWN_DESCRIPTION_OVERRIDE) || !preference.isAllowOverride()){ |
|
1995 |
setBooleanValue(EditorPreferencePredicate.OwnDescriptionForDistributionEditor.getKey(), Boolean.valueOf(preference.getValue())); |
|
1996 |
} |
|
1997 |
} |
|
1998 |
|
|
1999 |
//common names |
|
1945 | 2000 |
preference = getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies); |
1946 | 2001 |
if (preference != null){ |
1947 | 2002 |
if (!getBooleanValue(COMMON_NAME_AREA_VOCABULARIES) || !preference.isAllowOverride()){ |
... | ... | |
1963 | 2018 |
} |
1964 | 2019 |
|
1965 | 2020 |
|
1966 |
preference = getPreferenceFromDB(PreferencePredicate.ShowTaxonNodeWizard); |
|
1967 |
if (preference != null){ |
|
1968 |
if (!getBooleanValue(SHOW_TAXONNODE_WIZARD) || !preference.isAllowOverride()){ |
|
1969 |
setBooleanValue(SHOW_TAXONNODE_WIZARD, Boolean.valueOf(preference.getValue())); |
|
1970 |
} |
|
1971 |
}else{ |
|
1972 |
setBooleanValue(SHOW_TAXONNODE_WIZARD, true); |
|
1973 |
} |
|
1974 | 2021 |
|
2022 |
|
|
2023 |
//sources |
|
1975 | 2024 |
preference = getPreferenceFromDB(PreferencePredicate.ShowIdInSource); |
1976 | 2025 |
if (preference != null){ |
1977 | 2026 |
if (!getBooleanValue(SHOW_ID_IN_SOURCE) || !preference.isAllowOverride()){ |
... | ... | |
1989 | 2038 |
}else{ |
1990 | 2039 |
setBooleanValue(SHOW_NAMESPACE_IN_SOURCE, true); |
1991 | 2040 |
} |
1992 |
|
|
2041 |
//multiple classifications / taxon navigator |
|
1993 | 2042 |
preference = getPreferenceFromDB(PreferencePredicate.DisableMultiClassification); |
1994 | 2043 |
if (preference != null){ |
1995 | 2044 |
if (!getBooleanValue(DISABLE_MULTI_CLASSIFICATION) || !preference.isAllowOverride()){ |
... | ... | |
1999 | 2048 |
setBooleanValue(DISABLE_MULTI_CLASSIFICATION, false); |
2000 | 2049 |
} |
2001 | 2050 |
|
2051 |
preference = getPreferenceFromDB(PreferencePredicate.ShowTaxonNodeWizard); |
|
2052 |
if (preference != null){ |
|
2053 |
if (!getBooleanValue(SHOW_TAXONNODE_WIZARD) || !preference.isAllowOverride()){ |
|
2054 |
setBooleanValue(SHOW_TAXONNODE_WIZARD, Boolean.valueOf(preference.getValue())); |
|
2055 |
} |
|
2056 |
}else{ |
|
2057 |
setBooleanValue(SHOW_TAXONNODE_WIZARD, true); |
|
2058 |
} |
|
2059 |
|
|
2002 | 2060 |
} |
2003 | 2061 |
|
2004 | 2062 |
|
Also available in: Unified diff
ref #7922: add preference to save distribution editor factual data to their own fact