diff --git a/Model/lib/rng/wdkModel.rng b/Model/lib/rng/wdkModel.rng index aba16e5280..c3c1a98408 100644 --- a/Model/lib/rng/wdkModel.rng +++ b/Model/lib/rng/wdkModel.rng @@ -1555,6 +1555,12 @@ + + + + + + diff --git a/Model/src/main/java/org/gusdb/wdk/core/api/JsonKeys.java b/Model/src/main/java/org/gusdb/wdk/core/api/JsonKeys.java index cef857d651..e62618bf32 100644 --- a/Model/src/main/java/org/gusdb/wdk/core/api/JsonKeys.java +++ b/Model/src/main/java/org/gusdb/wdk/core/api/JsonKeys.java @@ -59,6 +59,7 @@ public class JsonKeys { public static final String ICON_NAME = "iconName"; public static final String DISPLAY_TEXT = "displayText"; public static final String HELP = "help"; + public static final String HTML_HELP = "htmlHelp"; public static final String DESCRIPTION = "description"; public static final String SHORT_DESCRIPTION = "shortDescription"; public static final String SUMMARY = "summary"; diff --git a/Model/src/main/java/org/gusdb/wdk/model/ModelXmlParser.java b/Model/src/main/java/org/gusdb/wdk/model/ModelXmlParser.java index 7f595e505b..34c02fc6ad 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/ModelXmlParser.java +++ b/Model/src/main/java/org/gusdb/wdk/model/ModelXmlParser.java @@ -1027,6 +1027,8 @@ private static void configureAttributeFields(Digester digester) { configureNode(digester, "*/columnAttribute", QueryColumnAttributeField.class, "addAttributeField"); configureNode(digester, "*/columnAttribute/propertyList", PropertyList.class, "addPropertyList"); configureNode(digester, "*/columnAttribute/filterRef", FilterReference.class, "addFilterReference"); + configureNode(digester, "*/columnAttribute/htmlHelp", WdkModelText.class, "addHtmlHelp"); + digester.addCallMethod("*/columnAttribute/htmlHelp", "setText", 0); configureAttributeReporters(digester, "columnAttribute"); // link attribute diff --git a/Model/src/main/java/org/gusdb/wdk/model/record/attribute/AttributeField.java b/Model/src/main/java/org/gusdb/wdk/model/record/attribute/AttributeField.java index 10c5473a9c..8ad8060c36 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/record/attribute/AttributeField.java +++ b/Model/src/main/java/org/gusdb/wdk/model/record/attribute/AttributeField.java @@ -13,6 +13,7 @@ import org.gusdb.wdk.model.RngAnnotations.RngUndefined; import org.gusdb.wdk.model.WdkModel; import org.gusdb.wdk.model.WdkModelException; +import org.gusdb.wdk.model.WdkModelText; import org.gusdb.wdk.model.columntool.ColumnTool; import org.gusdb.wdk.model.columntool.ColumnToolBundle; import org.gusdb.wdk.model.columntool.ColumnToolElementRefPair; @@ -39,11 +40,14 @@ */ public abstract class AttributeField extends Field implements Cloneable { + private List _htmlHelps = new ArrayList(); + private boolean _sortable = true; private String _align; private boolean _nowrap; private boolean _removable = true; private String _categoryName; + protected String _htmlHelp; protected AttributeFieldDataType _dataType = AttributeFieldDataType.OTHER; protected AttributeFieldContainer _container; @@ -160,6 +164,17 @@ public boolean isDerived() { return false; } + /** + * @return Returns the htmlHelp. + */ + public String getHtmlHelp() { + return _htmlHelp; + } + + public void addHtmlHelp(WdkModelText htmlHelp) { + _htmlHelps.add(htmlHelp); + } + @RngOptional public void setToolBundleRef(String toolBundleRef) { _toolBundleRef = toolBundleRef; @@ -195,6 +210,33 @@ public void excludeResources(String projectId) throws WdkModelException { } _reporterList = null; + if (_container != null) { + _htmlHelp = excludeModelText(_htmlHelps, projectId, "htmlHelp", false); + } + } + + protected String excludeModelText(List texts, String projectId, + String textTag, boolean isRequired) throws WdkModelException { + String source = "The " + getClass().getSimpleName() + " " + _container.getNameForLogging() + "." + getName(); + String selectedText = null; + boolean hasText = false; + for (WdkModelText text : texts) { + if (text.include(projectId)) { + if (hasText) { + throw new WdkModelException(source + " has more than one " + textTag + " tag for project " + projectId); + } + else { + selectedText = text.getText(); + hasText = true; + } + } + } + // check if all texts are excluded + if (selectedText == null && isRequired) { + throw new WdkModelException(source + " does not have a " + textTag + " tag for project " + projectId); + } + texts.clear(); + return selectedText; } @Override diff --git a/Model/src/main/java/org/gusdb/wdk/model/record/attribute/DerivedAttributeField.java b/Model/src/main/java/org/gusdb/wdk/model/record/attribute/DerivedAttributeField.java index be9ef7af68..a460f51864 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/record/attribute/DerivedAttributeField.java +++ b/Model/src/main/java/org/gusdb/wdk/model/record/attribute/DerivedAttributeField.java @@ -49,30 +49,6 @@ public Map getColumnAttributeFields() throws WdkMo return leaves; } - protected String excludeModelText(List texts, String projectId, - String textTag, boolean isRequired) throws WdkModelException { - String source = "The " + getClass().getSimpleName() + " " + _container.getNameForLogging() + "." + getName(); - String selectedText = null; - boolean hasText = false; - for (WdkModelText text : texts) { - if (text.include(projectId)) { - if (hasText) { - throw new WdkModelException(source + " has more than one " + textTag + " tag for project " + projectId); - } - else { - selectedText = text.getText(); - hasText = true; - } - } - } - // check if all texts are excluded - if (selectedText == null && isRequired) { - throw new WdkModelException(source + " does not have a " + textTag + " tag for project " + projectId); - } - texts.clear(); - return selectedText; - } - /** * Several kinds of fields can embed other fields in their properties. This method * parses out the embedded fields from the text. diff --git a/Service/src/main/java/org/gusdb/wdk/service/formatter/AttributeFieldFormatter.java b/Service/src/main/java/org/gusdb/wdk/service/formatter/AttributeFieldFormatter.java index a282b94e48..8ae8ce7396 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/formatter/AttributeFieldFormatter.java +++ b/Service/src/main/java/org/gusdb/wdk/service/formatter/AttributeFieldFormatter.java @@ -45,6 +45,7 @@ public static JSONObject getAttributeJson(AttributeField attribute) { .put(JsonKeys.DISPLAY_NAME, attribute.getDisplayName()) .put(JsonKeys.FORMATS, RecordClassFormatter.getAnswerFormatsJson(attribute.getReporters().values(), FieldScope.ALL)) .put(JsonKeys.HELP, attribute.getHelp()) + .put(JsonKeys.HTML_HELP, attribute.getHtmlHelp()) .put(JsonKeys.IS_DISPLAYABLE, FieldScope.NON_INTERNAL.isFieldInScope(attribute)) .put(JsonKeys.IS_IN_REPORT, FieldScope.REPORT_MAKER.isFieldInScope(attribute)) .put(JsonKeys.IS_REMOVABLE, attribute.isRemovable())