diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/form/complexcheckbox/CheckboxValue.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/form/complexcheckbox/CheckboxValue.java index 3c64a13be..d7080cb37 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/form/complexcheckbox/CheckboxValue.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/form/complexcheckbox/CheckboxValue.java @@ -1,17 +1,19 @@ package edu.stanford.bmir.protege.web.client.form.complexcheckbox; import java.util.Objects; -import java.util.logging.Logger; public class CheckboxValue { private final String svgImage; private final String value; + private final String tooltip; - public CheckboxValue(String svgImage, String value) { + + public CheckboxValue(String svgImage, String value, String tooltip) { this.svgImage = svgImage; this.value = value; + this.tooltip = tooltip; } @@ -23,25 +25,21 @@ public String getValue() { return value; } + public String getTooltip() { + return tooltip; + } + @Override public boolean equals(Object o) { - if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CheckboxValue that = (CheckboxValue) o; - return Objects.equals(value, that.value); + return Objects.equals(svgImage, that.svgImage) && Objects.equals(value, that.value) && Objects.equals(tooltip, that.tooltip); } @Override public int hashCode() { - return Objects.hash(svgImage, value); - } - - @Override - public String toString() { - return "CheckboxValue{" + - "value=" + value + - '}'; + return Objects.hash(svgImage, value, tooltip); } } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/form/complexcheckbox/ConfigurableCheckBoxPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/form/complexcheckbox/ConfigurableCheckBoxPresenter.java index e12e7c01f..2803f8842 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/form/complexcheckbox/ConfigurableCheckBoxPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/form/complexcheckbox/ConfigurableCheckBoxPresenter.java @@ -58,6 +58,7 @@ private void toggleSelected() { } CheckboxValue nextSel = config.getNextValue(view.getValue()); view.setValue(nextSel); + view.asWidget().setTitle(nextSel.getTooltip()); isTouched = true; } @@ -80,6 +81,10 @@ public void setConfig(CheckBoxConfig config) { this.config = config; } + public void setTitle(String title) { + this.view.asWidget().setTitle(title); + } + @Override public void setValue(CheckboxValue value, boolean fireEvents) { view.setValue(value, fireEvents); diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/form/complexcheckbox/ConfigurableCheckbox.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/form/complexcheckbox/ConfigurableCheckbox.java index 1dbaeedb6..9de381bb9 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/form/complexcheckbox/ConfigurableCheckbox.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/form/complexcheckbox/ConfigurableCheckbox.java @@ -32,6 +32,7 @@ public ConfigurableCheckbox(CheckBoxConfig checkBoxConfig, String initialValue) presenter.setConfig(checkBoxConfig); CheckboxValue checkboxValue = checkBoxConfig.findValue(initialValue); this.setValue(checkboxValue); + presenter.setTitle(checkboxValue.getTooltip()); } public boolean isTouched() { diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationCheckboxConfig.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationCheckboxConfig.java index af5a065eb..f6a027a42 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationCheckboxConfig.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/linearization/LinearizationCheckboxConfig.java @@ -12,13 +12,13 @@ public class LinearizationCheckboxConfig extends CheckBoxConfig { private final static String UNKNOWN_SVG = " "; - public static List AVAILABLE_VALUES_LIST = Arrays.asList(new CheckboxValue(UNKNOWN_SVG, "UNKNOWN"), - new CheckboxValue(CHECK_SVG, "TRUE"), - new CheckboxValue(X_SVG, "FALSE")); + public static List AVAILABLE_VALUES_LIST = Arrays.asList(new CheckboxValue(UNKNOWN_SVG, "UNKNOWN", "Not set value"), + new CheckboxValue(CHECK_SVG, "TRUE", "Allowed"), + new CheckboxValue(X_SVG, "FALSE", "Not allowed")); protected LinearizationCheckboxConfig() { - super(new CheckboxValue(UNKNOWN_SVG, "UNKNOWN"), AVAILABLE_VALUES_LIST); + super(new CheckboxValue(UNKNOWN_SVG, "UNKNOWN", "Not set value"), AVAILABLE_VALUES_LIST); } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationCheckboxConfig.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationCheckboxConfig.java index 2ccaeb480..778501300 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationCheckboxConfig.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationCheckboxConfig.java @@ -9,8 +9,6 @@ import java.util.logging.Logger; public class PostCoordinationCheckboxConfig extends CheckBoxConfig { - private final Logger logger = Logger.getLogger("CheckBoxConfig"); - private final static String CHECK_SVG = " "; private final static String REQUIRED_SVG = " mandatory-done "; @@ -24,19 +22,19 @@ public class PostCoordinationCheckboxConfig extends CheckBoxConfig { private CheckboxValue parentValue; private boolean isDerived = false; - public static List AVAILABLE_VALUES_LIST = Arrays.asList(new CheckboxValue(NOT_ALLOWED, "NOT_ALLOWED"), - new CheckboxValue(CHECK_SVG, "ALLOWED"), - new CheckboxValue(REQUIRED_SVG, "REQUIRED") + public static List AVAILABLE_VALUES_LIST = Arrays.asList(new CheckboxValue(NOT_ALLOWED, "NOT_ALLOWED", "This axis cannot be used as a postcoordination axis for this linearization."), + new CheckboxValue(CHECK_SVG, "ALLOWED", "This axis can be used as a postcoordination axis for this linearization."), + new CheckboxValue(REQUIRED_SVG, "REQUIRED", "This axis is required to be used as a postcoordination axis for this linearization.") ); public static List AVAILABLE_DEFAULT_VALUE_LIST = Arrays.asList( - new CheckboxValue(DEFAULT_NOT_ALLOWED, "DEFAULT_NOT_ALLOWED"), - new CheckboxValue(DEFAULT_CHECK_SVG, "DEFAULT_ALLOWED"), - new CheckboxValue(DEFAULT_REQUIRED_SVG, "DEFAULT_REQUIRED") + new CheckboxValue(DEFAULT_NOT_ALLOWED, "DEFAULT_NOT_ALLOWED", "This axis inherits its behavior from its root linearization: This axis cannot be used as a postcoordination axis for this linearization."), + new CheckboxValue(DEFAULT_CHECK_SVG, "DEFAULT_ALLOWED", "This axis inherits its behavior from its root linearization: This axis can be used as a postcoordination axis for this linearization."), + new CheckboxValue(DEFAULT_REQUIRED_SVG, "DEFAULT_REQUIRED", "This axis inherits its behavior from its root linearization: This axis is required to be used as a postcoordination axis for this linearization.") ); protected PostCoordinationCheckboxConfig() { - super(new CheckboxValue(NOT_ALLOWED, "NOT_ALLOWED"), AVAILABLE_VALUES_LIST); + super(new CheckboxValue(NOT_ALLOWED, "NOT_ALLOWED", "This axis cannot be used as a postcoordination axis for this linearization."), AVAILABLE_VALUES_LIST); } @Override @@ -52,7 +50,7 @@ public CheckboxValue getNextValue(CheckboxValue checkboxValue) { @Override public CheckboxValue findValue(String inputValue) { if(inputValue == null || inputValue.isEmpty()) { - return new CheckboxValue(NOT_ALLOWED, "NOT_ALLOWED"); + return new CheckboxValue(NOT_ALLOWED, "NOT_ALLOWED", "This axis cannot be used as a postcoordination axis for this linearization."); } List allValues = new ArrayList<>(); allValues.addAll(AVAILABLE_VALUES_LIST); @@ -60,7 +58,7 @@ public CheckboxValue findValue(String inputValue) { return allValues.stream().filter(value -> value.getValue().equalsIgnoreCase(inputValue)) .findFirst() - .orElse(new CheckboxValue(NOT_ALLOWED, "NOT_ALLOWED")); + .orElse(new CheckboxValue(NOT_ALLOWED, "NOT_ALLOWED", "This axis cannot be used as a postcoordination axis for this linearization.")); } private CheckboxValue getNextValueForDerivedClasses(CheckboxValue checkboxValue) { diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTableCell.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTableCell.java index 6dff67ece..785cbabe3 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTableCell.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTableCell.java @@ -32,8 +32,8 @@ public PostCoordinationTableCell(LinearizationDefinition linearizationDefinition initialValue = "DEFAULT_NOT_ALLOWED"; } configurableCheckbox = new ConfigurableCheckbox(checkboxConfig, initialValue); - configurableCheckbox.setReadOnly(false); - configurableCheckbox.setEnabled(true); + configurableCheckbox.setReadOnly(true); + configurableCheckbox.setEnabled(false); } public Widget asWidget(){