Skip to content

Commit

Permalink
Add optional visibleHelpPosition attribute to params
Browse files Browse the repository at this point in the history
  • Loading branch information
jernestmyers committed Apr 11, 2024
1 parent dc30553 commit 2d06feb
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Model/lib/rng/wdkModel.rng
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@

<define name="ParamBaseTags">
<choice>
<optional>
<attribute name="visibleHelpPosition" />
</optional>
<element name="visibleHelp">
<ref name="IncludeExclude" />
<text />
Expand Down Expand Up @@ -986,6 +989,9 @@
<data type="double" />
</attribute>
</optional>
<optional>
<attribute name="visibleHelpPosition" />
</optional>
<zeroOrMore>
<element name="help">
<ref name="IncludeExclude" />
Expand Down
1 change: 1 addition & 0 deletions Model/src/main/java/org/gusdb/wdk/core/api/JsonKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public class JsonKeys {
public static final String PARSER = "parser";
public static final String ALLOW_EMPTY_VALUE = "allowEmptyValue";
public static final String VISIBLE_HELP = "visibleHelp";
public static final String VISIBLE_HELP_POSITION = "visibleHelpPosition";

// dataset-related keys
public static final String DEFAULT_ID_LIST = "defaultIdList";
Expand Down
11 changes: 11 additions & 0 deletions Model/src/main/java/org/gusdb/wdk/model/query/param/Param.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ protected abstract ParamValidity validateValue(PartiallyValidatedStableValues co
// requested by PRISM, array will contain different values for different projects
private List<WdkModelText> _visibleHelps;
protected String _visibleHelp;
protected String _visibleHelpPosition;

// both default value and empty values will be used to construct default raw value. these values themselves
// are neither valid raw values nor stable values. See FIXME below in getInternalValue()
Expand Down Expand Up @@ -191,6 +192,7 @@ public Param(Param param) {
_prompt = param._prompt;
_help = param._help;
_visibleHelp = param._visibleHelp;
_visibleHelpPosition = param._visibleHelpPosition;
_xmlDefaultValue = param._xmlDefaultValue;
_sanityDefaultValue = param._sanityDefaultValue;
_visible = param._visible;
Expand Down Expand Up @@ -292,6 +294,14 @@ void setVisibleHelp(String visibleHelp) {
_visibleHelp = visibleHelp;
}

public void setVisibleHelpPosition(String visibleHelpPosition) {
_visibleHelpPosition = visibleHelpPosition;
}

public String getVisibleHelpPosition() {
return _visibleHelpPosition;
}

/**
* Sets and validates a default value assigned in the model XML
*
Expand Down Expand Up @@ -422,6 +432,7 @@ public String toString() {
.append(" prompt='").append(_prompt).append("'").append(NL)
.append(" help='").append(_help).append("'").append(NL)
.append(" visibleHelp='").append(_visibleHelp).append("'").append(NL)
.append(" visibleHelpPosition='").append(_visibleHelpPosition).append("'").append(NL)
.append(" xmlDefault='").append(_xmlDefaultValue).append("'").append(NL)
.append(" sanityDefault='").append(_sanityDefaultValue).append("'").append(NL)
.append(" readonly=").append(_readonly).append(NL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public static Param resolveReference(WdkModel wdkModel,
if (visibleHelp != null)
param.setVisibleHelp(visibleHelp);

String visibleHelpPosition = paramRef.getVisibleHelpPosition();
if (visibleHelpPosition != null)
param.setVisibleHelpPosition(visibleHelpPosition);

// set prompt if any
String prompt = paramRef.getPrompt();
if (prompt != null)
Expand Down Expand Up @@ -276,6 +280,7 @@ public static Param resolveReference(WdkModel wdkModel,

private List<WdkModelText> _visibleHelps = new ArrayList<WdkModelText>();
private String _visibleHelp;
private String _visibleHelpPosition;

// this property only applies to timestamp param.
private Long _interval;
Expand Down Expand Up @@ -570,6 +575,14 @@ public String getVisibleHelp() {
return _visibleHelp;
}

public void setVisibleHelpPosition(String visibleHelpPosition) {
_visibleHelpPosition = visibleHelpPosition;
}

public String getVisibleHelpPosition() {
return _visibleHelpPosition;
}

public void setPrompt(String prompt) {
_prompt = prompt;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ protected <S extends ParameterContainerInstanceSpec<S>> JSONObject getBaseJson(D
pJson.put(JsonKeys.IS_READ_ONLY, _param.isReadonly());
pJson.put(JsonKeys.ALLOW_EMPTY_VALUE, _param.isAllowEmpty());
pJson.put(JsonKeys.VISIBLE_HELP, _param.getVisibleHelp());
pJson.put(JsonKeys.VISIBLE_HELP_POSITION, _param.getVisibleHelpPosition());
pJson.put(JsonKeys.DEPENDENT_PARAMS, new JSONArray(
mapToList(_param.getDependentParams(), NamedObject::getName)));
pJson.put(JsonKeys.INITIAL_DISPLAY_VALUE,
Expand Down

0 comments on commit 2d06feb

Please sign in to comment.