diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/Messages.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/Messages.java index 96145a7b7..2f37cab87 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/Messages.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/Messages.java @@ -1026,6 +1026,16 @@ public interface Messages extends com.google.gwt.i18n.client.Messages { @Key("linearization.upload") String linearizationUpload(); + @DefaultMessage("Apply PostCoordination changes") + @Key("postcoordination.upload") + String postCoordinationUpload(); + + + @DefaultMessage("Apply PostCoordination custom scales") + @Key("postcoordination.customscales") + String postCoordinationCustomScales(); + + @DefaultMessage("Merge Ontologies") @Key("uploadAndMergeAdditions") String uploadAndMergeAdditions(); 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 598837a20..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); @@ -94,6 +99,10 @@ public boolean isTouched() { return isTouched; } + public void setTouched(Boolean touched) { + this.isTouched = touched; + } + @Override public void fireEvent(GwtEvent event) { view.fireEvent(event); 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 fd69beb73..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 @@ -7,7 +7,6 @@ import edu.stanford.bmir.protege.web.client.HasReadOnly; import javax.annotation.Nonnull; -import java.util.logging.Logger; public class ConfigurableCheckbox implements IsWidget, HasValue, HasText, HasEnabled, HasReadOnly { @Nonnull @@ -26,7 +25,6 @@ public ConfigurableCheckbox(CheckBoxConfig checkBoxConfig, String initialValue) presenter = new ConfigurableCheckBoxPresenter(new ConfigurableCheckBoxViewImpl()); presenter.start(container); - this.checkBoxConfig = checkBoxConfig; presenter.setEnabled(checkBoxConfig.isEnabled()); @@ -34,12 +32,17 @@ public ConfigurableCheckbox(CheckBoxConfig checkBoxConfig, String initialValue) presenter.setConfig(checkBoxConfig); CheckboxValue checkboxValue = checkBoxConfig.findValue(initialValue); this.setValue(checkboxValue); + presenter.setTitle(checkboxValue.getTooltip()); } public boolean isTouched() { return this.presenter.isTouched(); } + public void setTouched(boolean touched) { + this.presenter.setTouched(touched); + } + @Override public Widget asWidget() { return container; diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/inject/ClientApplicationModule.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/inject/ClientApplicationModule.java index 7fe70fcd4..c2c59dd64 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/inject/ClientApplicationModule.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/inject/ClientApplicationModule.java @@ -96,6 +96,7 @@ import edu.stanford.bmir.protege.web.client.portlet.PortletUiImpl; import edu.stanford.bmir.protege.web.client.postcoordination.PostCoordinationPortletView; import edu.stanford.bmir.protege.web.client.postcoordination.PostCoordinationPortletViewImpl; +import edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.scaleValueSelectionModal.*; import edu.stanford.bmir.protege.web.client.primitive.PrimitiveDataEditorImageView; import edu.stanford.bmir.protege.web.client.primitive.PrimitiveDataEditorImageViewImpl; import edu.stanford.bmir.protege.web.client.progress.BusyView; @@ -623,4 +624,9 @@ AcceptsOneWidget provideAcceptsOneWidget() { CreateEntityFormView provideCreateEntityFormView(CreateEntityFormViewImpl impl) { return impl; } + + @Provides + ScaleValueSelectionView provideScaleValueSelectionView(ScaleValueSelectionViewImpl impl) { + return impl; + } } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/inject/ClientProjectModule.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/inject/ClientProjectModule.java index 2af25962f..580e8bcc7 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/inject/ClientProjectModule.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/inject/ClientProjectModule.java @@ -26,6 +26,8 @@ import edu.stanford.bmir.protege.web.client.permissions.*; import edu.stanford.bmir.protege.web.client.perspective.*; import edu.stanford.bmir.protege.web.client.portlet.*; +import edu.stanford.bmir.protege.web.client.postcoordination.PostCoordinationChangesHandler; +import edu.stanford.bmir.protege.web.client.postcoordination.PostCoordinationChangesHandlerImpl; import edu.stanford.bmir.protege.web.client.project.*; import edu.stanford.bmir.protege.web.client.projectsettings.*; import edu.stanford.bmir.protege.web.client.renderer.*; @@ -96,6 +98,11 @@ UploadAndProcessLinearizationHandler provideUploadAndProcessLinearizationHandler return handler; } + @Provides + PostCoordinationChangesHandler provideProcessPostCoordinationHandler(PostCoordinationChangesHandlerImpl impl) { + return impl; + } + @Provides UploadAndMergeAdditionsHandler provideUploadAndMergeAdditionsHandler(UploadAndMergeAdditionsHandlerImpl handler) { return handler; 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/CancelButtonHandler.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/CancelButtonHandler.java new file mode 100644 index 000000000..2c35330b7 --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/CancelButtonHandler.java @@ -0,0 +1,6 @@ +package edu.stanford.bmir.protege.web.client.postcoordination; + +public interface CancelButtonHandler { + + void handleCancelButton(); +} diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/EditButtonHandler.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/EditButtonHandler.java new file mode 100644 index 000000000..eae0682ff --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/EditButtonHandler.java @@ -0,0 +1,6 @@ +package edu.stanford.bmir.protege.web.client.postcoordination; + +public interface EditButtonHandler { + + void enableEditMode(); +} diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationChangesHandler.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationChangesHandler.java new file mode 100644 index 000000000..9c4cdaf41 --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationChangesHandler.java @@ -0,0 +1,8 @@ +package edu.stanford.bmir.protege.web.client.postcoordination; + +public interface PostCoordinationChangesHandler { + + void handleUploadPostCoordinationChanges(); + + void handlePostCoordinationCustomScales(); +} diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationChangesHandlerImpl.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationChangesHandlerImpl.java new file mode 100644 index 000000000..886e19c5b --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationChangesHandlerImpl.java @@ -0,0 +1,51 @@ +package edu.stanford.bmir.protege.web.client.postcoordination; + +import edu.stanford.bmir.protege.web.shared.postcoordination.ProcessUploadedCustomScalesAction; +import edu.stanford.bmir.protege.web.shared.postcoordination.ProcessUploadedPostCoordinationAction; +import edu.stanford.bmir.protege.web.shared.project.ProjectId; + +import javax.annotation.Nonnull; +import javax.inject.Inject; +import javax.inject.Provider; + +public class PostCoordinationChangesHandlerImpl implements PostCoordinationChangesHandler { + + + @Nonnull + private final Provider workflowProvider; + @Nonnull + private final ProjectId projectId; + + @Inject + public PostCoordinationChangesHandlerImpl(@Nonnull Provider workflowProvider, @Nonnull ProjectId projectId) { + this.workflowProvider = workflowProvider; + this.projectId = projectId; + } + + @Override + public void handleUploadPostCoordinationChanges() { + UploadPostCoordinationWorkflow workflow = workflowProvider.get(); + + UploadPostCoordinationWorkflowConfiguration configuration = new UploadPostCoordinationWorkflowConfiguration("Upload PostCoordination changes", + "Process postcoordination", + "Applying postcoordination changes to ontologies. Please wait.", + "The postcoordination where successfully processes and added to the project", + ProcessUploadedPostCoordinationAction::create); + + workflow.start(projectId, configuration); + + } + + @Override + public void handlePostCoordinationCustomScales() { + UploadPostCoordinationWorkflow workflow = workflowProvider.get(); + + UploadPostCoordinationWorkflowConfiguration configuration = new UploadPostCoordinationWorkflowConfiguration("Upload PostCoordination changes", + "Process postcoordination custom scales", + "Applying postcoordination custom scales changes to ontologies. Please wait.", + "The postcoordination scales where successfully processes and added to the project", + ProcessUploadedCustomScalesAction::create); + + workflow.start(projectId, configuration); + } +} 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 b733538df..614038df5 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,41 +9,40 @@ 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 "; + private final static String REQUIRED_SVG = " "; - private final static String UNKNOWN_SVG = " "; + private final static String NOT_ALLOWED = " "; private final static String DEFAULT_CHECK_SVG = " "; - private final static String DEFAULT_REQUIRED_SVG = " mandatory-done "; - - private final static String DEFAULT_UNKNOWN_SVG = " "; + private final static String DEFAULT_REQUIRED_SVG = " "; + private final static String DEFAULT_NOT_ALLOWED = " "; private CheckboxValue parentValue; + private boolean isDerived = false; - - public static List AVAILABLE_VALUES_LIST = Arrays.asList(new CheckboxValue(UNKNOWN_SVG, "UNKNOWN"), - 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_UNKNOWN_SVG, "DEFAULT_UNKNOWN"), - 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(UNKNOWN_SVG, "UNKNOWN"), 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 public CheckboxValue getNextValue(CheckboxValue checkboxValue) { - if(parentValue != null) { + if(isDerived) { return getNextValueForDerivedClasses(checkboxValue); } else { + return super.getNextValue(checkboxValue); } } @@ -51,7 +50,7 @@ public CheckboxValue getNextValue(CheckboxValue checkboxValue) { @Override public CheckboxValue findValue(String inputValue) { if(inputValue == null || inputValue.isEmpty()) { - return new CheckboxValue(UNKNOWN_SVG, "UNKNOWN"); + 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); @@ -59,7 +58,7 @@ public CheckboxValue findValue(String inputValue) { return allValues.stream().filter(value -> value.getValue().equalsIgnoreCase(inputValue)) .findFirst() - .orElse(new CheckboxValue(UNKNOWN_SVG, "UNKNOWN")); + .orElse(new CheckboxValue(NOT_ALLOWED, "NOT_ALLOWED", "This axis cannot be used as a postcoordination axis for this linearization.")); } private CheckboxValue getNextValueForDerivedClasses(CheckboxValue checkboxValue) { @@ -82,8 +81,15 @@ private CheckboxValue getNextValueForDerivedClasses(CheckboxValue checkboxValue) } } + public void setIsDerived(boolean isDerived){ + this.isDerived = isDerived; + } + + public boolean isDerived() { + return isDerived; + } + public void setParentValue(CheckboxValue parentValue) { this.parentValue = parentValue; } - } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletPresenter.java index f4f0c8533..02ff047c5 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletPresenter.java @@ -3,15 +3,19 @@ import com.google.web.bindery.event.shared.EventBus; import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; import edu.stanford.bmir.protege.web.client.lang.DisplayNameRenderer; -import edu.stanford.bmir.protege.web.client.library.msgbox.MessageBox; +import edu.stanford.bmir.protege.web.client.library.dlg.DialogButton; +import edu.stanford.bmir.protege.web.client.library.modal.ModalManager; +import edu.stanford.bmir.protege.web.client.library.msgbox.*; import edu.stanford.bmir.protege.web.client.portlet.*; import edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.*; +import edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.scaleValueSelectionModal.ScaleValueSelectionViewPresenter; import edu.stanford.bmir.protege.web.client.selection.SelectionModel; import edu.stanford.bmir.protege.web.client.user.LoggedInUserManager; import edu.stanford.bmir.protege.web.shared.event.WebProtegeEventBus; import edu.stanford.bmir.protege.web.shared.linearization.*; import edu.stanford.bmir.protege.web.shared.postcoordination.*; import edu.stanford.bmir.protege.web.shared.project.ProjectId; +import edu.stanford.bmir.protege.web.shared.renderer.GetEntityRenderingAction; import edu.stanford.webprotege.shared.annotations.Portlet; import org.semanticweb.owlapi.model.OWLEntity; @@ -35,13 +39,22 @@ public class PostCoordinationPortletPresenter extends AbstractWebProtegePortletP private final LoggedInUserManager loggedInUserManager; private final MessageBox messageBox; - private final Map scaleValueCardPresenters = new HashMap<>(); + private final Map scaleValueCardPresenters = new LinkedHashMap<>(); private final Map tableLabelsForAxes = new HashMap<>(); private final Map scaleLabelsForAxes = new HashMap<>(); private final List compositeAxisList = new ArrayList<>(); - private final Map genericScale = new HashMap<>(); + private final Map genericScale = new HashMap<>(); + private final List postCoordinationCustomScalesList = new ArrayList<>(); + + private final List scaleCardsOrderByAxis = new LinkedList<>(); + + private boolean editMode = false; + + private final ModalManager modalManager; + + private final ScaleValueSelectionViewPresenter scaleSelectionPresenter; @Inject public PostCoordinationPortletPresenter(@Nonnull SelectionModel selectionModel, @@ -51,13 +64,17 @@ public PostCoordinationPortletPresenter(@Nonnull SelectionModel selectionModel, @Nonnull PostCoordinationPortletView view, @Nonnull EventBus eventBus, @Nonnull MessageBox messageBox, - @Nonnull LoggedInUserManager loggedInUserManager) { + @Nonnull LoggedInUserManager loggedInUserManager, + ModalManager modalManager, + ScaleValueSelectionViewPresenter scaleSelectionPresenter) { super(selectionModel, projectId, displayNameRenderer, dispatch); this.view = view; this.messageBox = messageBox; this.dispatch = dispatch; this.eventBus = eventBus; this.loggedInUserManager = loggedInUserManager; + this.modalManager = modalManager; + this.scaleSelectionPresenter = scaleSelectionPresenter; this.view.setProjectId(projectId); } @@ -66,26 +83,33 @@ public void startPortlet(PortletUi portletUi, WebProtegeEventBus eventBus) { portletUi.setWidget(view.asWidget()); setDisplaySelectedEntityNameAsSubtitle(true); - scaleValueCardPresenters.clear(); - tableLabelsForAxes.clear(); - compositeAxisList.clear(); - scaleLabelsForAxes.clear(); - genericScale.clear(); - + clearAllDate(); + dispatch.beginBatch(); dispatch.execute(GetPostCoordinationTableConfigurationAction.create("ICD"), result -> { for (String availableAxis : result.getTableConfiguration().getPostCoordinationAxes()) { PostCoordinationTableAxisLabel existingLabel = result.getLabels().stream() .filter(label -> label.getPostCoordinationAxis().equalsIgnoreCase(availableAxis)) .findFirst() - .orElseThrow(() -> new RuntimeException("Couldn't find label for " + availableAxis)); + .orElseThrow(() -> { + logger.info("Couldn't find label for " + availableAxis); + return new RuntimeException("Couldn't find label for " + availableAxis); + }); tableLabelsForAxes.put(availableAxis, existingLabel); + scaleCardsOrderByAxis.add(availableAxis); } scaleLabelsForAxes.putAll(tableLabelsForAxes); view.setLabels(tableLabelsForAxes); + dispatch.execute(GetPostcoordinationAxisToGenericScaleAction.create(), axisToGenericScaleResult -> + axisToGenericScaleResult.getPostcoordinationAxisToGenericScales() + .forEach(axisToGenericScale -> + genericScale.put(axisToGenericScale.getPostcoordinationAxis(), axisToGenericScale) + ) + ); + compositeAxisList.addAll(result.getTableConfiguration().getCompositePostCoordinationAxes()); @@ -95,49 +119,24 @@ public void startPortlet(PortletUi portletUi, WebProtegeEventBus eventBus) { PostCoordinationTableAxisLabel existingLabel = result.getLabels().stream() .filter(label -> label.getPostCoordinationAxis().equalsIgnoreCase(subAxis)) .findFirst() +// .orElseThrow(() -> { +// logger.log(Level.SEVERE, "Couldn't find label for " + subAxis); +// return new RuntimeException("Couldn't find label for " + subAxis); +// }); /* - ToDo: - remove the orElseGet() and add back the orElseThrow() when we have proper labels - */ + ToDo: + remove the orElseGet() and add back the orElseThrow() when we have proper labels + */ .orElseGet(() -> new PostCoordinationTableAxisLabel(subAxis, "hardCodedTableName", "hardCodedTableName")); -// .orElseThrow(() -> new RuntimeException("Couldn't find label for " + subAxis)); scaleLabelsForAxes.put(subAxis, existingLabel); scaleLabelsForAxes.remove(compositeAxis.getPostCoordinationAxis()); } ) ); - /* - ToDo: - 1. populate genericScale using a dispatch request. - 2. populate a list of scaleCustomizations from BE with the real scale values for each axis/subaxis - */ -// Map axisMapWithValues = tableLabelsForAxes.values() -// .stream() -// .collect(Collectors.toMap( -// PostCoordinationTableAxisLabel::getPostCoordinationAxis, -// tabelAxisLabel -> { -// PostCoordinationAxisToGenericScale genericScale1 = genericScale.getOrDefault( -// tabelAxisLabel.getPostCoordinationAxis(), -// new PostCoordinationAxisToGenericScale(tabelAxisLabel.getPostCoordinationAxis(), "", ScaleAllowMultiValue.NotAllowed) -// ); -// return createScaleValueCardPresenter( -// tabelAxisLabel, -// new PostCoordinationScaleValue( -// tabelAxisLabel.getPostCoordinationAxis(), -// tabelAxisLabel.getScaleLabel(), -// new ArrayList<>(Arrays.asList("iri1.1", "iri1.2", "iri1.3")), -// genericScale1) -// ); -// } -// )); -// -// scaleValueCardPresenters.putAll(axisMapWithValues); - //Do batch action for all scaleValues - dispatch.beginBatch(); - scaleValueCardPresenters.values().forEach(presenter -> presenter.start(view.getScaleValueCardsView())); - dispatch.executeCurrentBatch(); + List orderedAxisListWithSubAxis = this.createOrderAxisListWithSubAxis(result.getTableConfiguration().getPostCoordinationAxes(), result.getTableConfiguration().getCompositePostCoordinationAxes()); + scaleCardsOrderByAxis.addAll(orderedAxisListWithSubAxis); view.setTableCellChangedHandler(handleTableCellChanged()); @@ -147,14 +146,81 @@ remove the orElseGet() and add back the orElseThrow() when we have proper labels definitionMap.put(definition.getWhoficEntityIri(), definition); } view.setLinearizationDefinitonMap(definitionMap); - view.setPostCoordinationEntity(); + view.initializeTable(); + handleAfterSetEntity(getSelectedEntity()); }); }); + + view.setEditButtonHandler(() -> this.setEditMode(true)); + + view.setCancelButtonHandler(() -> { + this.setEditMode(false); + handleAfterSetEntity(getSelectedEntity()); + }); + + view.setSaveButtonHandler(this::saveEntity); + + this.setEditMode(false); + + dispatch.executeCurrentBatch(); } - private ScaleValueCardPresenter createScaleValueCardPresenter(PostCoordinationTableAxisLabel axis, PostCoordinationScaleValue scaleValue) { - ScaleValueCardView view = new ScaleValueCardViewImpl(); - return new ScaleValueCardPresenter(axis, scaleValue, view, dispatch, getProjectId()); + //The corect order is determined by the order of the values that are stored in the database + private List createOrderAxisListWithSubAxis(List postCoordinationAxes, List compositeAxisList) { + List orderedAxisList = new LinkedList<>(postCoordinationAxes); + + compositeAxisList.forEach(compositeAxis -> + { + int indexForCurrAxis = orderedAxisList.indexOf(compositeAxis.getPostCoordinationAxis()); + List subAxisList = new LinkedList<>(compositeAxis.getSubAxis()); + orderedAxisList.addAll(indexForCurrAxis + 1, subAxisList); + orderedAxisList.remove(indexForCurrAxis); + } + ); + return orderedAxisList; + } + + private void saveEntity(Optional specification) { + this.setEditMode(false); + + List newCustomScales = getUpdateCustomScaleValues(); + + if (!newCustomScales.equals(postCoordinationCustomScalesList)) { + dispatch.execute(SaveEntityCustomScaleAction.create(getProjectId(), WhoficCustomScalesValues.create(getSelectedEntity().get().toStringID(), newCustomScales)), (result) -> { + }); + } + + specification.ifPresent(whoficEntityPostCoordinationSpecification -> + dispatch.execute(SaveEntityPostCoordinationAction.create(getProjectId(), whoficEntityPostCoordinationSpecification), + (result) -> { + } + ) + + ); + } + + private List getUpdateCustomScaleValues() { + Collection scaleValueCardPresenters1 = scaleValueCardPresenters.values(); + return scaleValueCardPresenters1 + .stream() + .map(scalePresenter -> { + List scaleValueIris = scalePresenter.getValues().getValueIris() + .stream() + .map(scaleValueIriAndName -> scaleValueIriAndName.getScaleValueIri()) // Directly map + .collect(Collectors.toList()); + + return PostCoordinationCustomScales.create(scaleValueIris, scalePresenter.getValues().getAxisIri()); + }) + .collect(Collectors.toList()); + } + + + private ScaleValueCardPresenter createScaleValueCardPresenter(PostCoordinationTableAxisLabel axis, PostcoordinationScaleValue scaleValue) { + ScaleValueCardPresenter cardPresenter = new ScaleValueCardPresenter(dispatch, getProjectId(), modalManager); + cardPresenter.setScaleValue(scaleValue); + cardPresenter.setPostCoordinationAxis(axis); + cardPresenter.setScaleValueSelectionPresenter(scaleSelectionPresenter); + return cardPresenter; } @Override @@ -163,6 +229,60 @@ protected void handleReloadRequest() { @Override protected void handleAfterSetEntity(Optional entityData) { + if (!entityData.isPresent()) { + setNothingSelectedVisible(true); + setDisplayedEntity(Optional.empty()); + } else { + dispatch.execute(GetEntityRenderingAction.create(getProjectId(), entityData.get()), + (result) -> setDisplayedEntity(Optional.of(result.getEntityData()))); + setNothingSelectedVisible(false); + if (this.editMode) { + messageBox.showConfirmBox(MessageStyle.ALERT, + "Save edits before switching?", + "Do you want to save your edits before changing selection?", + DialogButton.YES, + () -> { + saveEntity(view.getTableData()); + navigateToEntity(entityData.get()); + }, + DialogButton.NO, + () -> navigateToEntity(entityData.get()), + DialogButton.YES); + } else { + navigateToEntity(entityData.get()); + } + } + + + } + + private void navigateToEntity(OWLEntity entityData) { + dispatch.execute(GetEntityCustomScalesAction.create(entityData.getIRI().toString(), getProjectId()), + (result) -> { + logger.info(result.toString()); + clearScaleValueCards(); + postCoordinationCustomScalesList.addAll(result.getWhoficCustomScaleValues().getScaleCustomizations()); + }); + + dispatch.execute(GetEntityPostCoordinationAction.create(entityData.getIRI().toString(), getProjectId()), + (result) -> { + view.setTableData(result.getPostCoordinationSpecification()); + setEditMode(false); + }); + } + + private void clearScaleValueCards() { + scaleValueCardPresenters.clear(); + postCoordinationCustomScalesList.clear(); + view.getScaleValueCardsView().clear(); + } + + private void clearAllDate() { + clearScaleValueCards(); + tableLabelsForAxes.clear(); + compositeAxisList.clear(); + scaleLabelsForAxes.clear(); + genericScale.clear(); } public void removeScaleValueCardPresenter(String axisIri) { @@ -175,24 +295,45 @@ public void removeScaleValueCardPresenter(String axisIri) { private void addScaleValueCardPresenter(String axisIri) { PostCoordinationTableAxisLabel currentAxisLabels = scaleLabelsForAxes.get(axisIri); - PostCoordinationAxisToGenericScale genericScale1 = genericScale.getOrDefault( + PostcoordinationAxisToGenericScale genericScale1 = genericScale.getOrDefault( axisIri, /* ToDo: return an error here if we don't have a value in genericScale */ - new PostCoordinationAxisToGenericScale(axisIri, "", ScaleAllowMultiValue.NotAllowed) + PostcoordinationAxisToGenericScale.create(axisIri, "", "NotAllowed") ); + List existingScaleValueForAxis = postCoordinationCustomScalesList.stream().filter(customScaleValue -> customScaleValue.getPostcoordinationAxis().equals(axisIri)) + .flatMap(customScaleValue -> customScaleValue.getPostcoordinationScaleValues().stream()) + .map(ScaleValueIriAndName::create) + .collect(Collectors.toList()); ScaleValueCardPresenter newPresenter = createScaleValueCardPresenter( currentAxisLabels, - /* - ToDo: - create a post PostCoordinationScaleValue also using the scale value from BE if it exists. if not then use createEmpty() - */ - PostCoordinationScaleValue.createEmpty(axisIri, currentAxisLabels.getScaleLabel(), genericScale1) + PostcoordinationScaleValue.create(axisIri, currentAxisLabels.getScaleLabel(), existingScaleValueForAxis, genericScale1) ); scaleValueCardPresenters.put(axisIri, newPresenter); - newPresenter.start(view.getScaleValueCardsView()); + newPresenter.start(editMode); + updateScaleValueCards(); + } + + private void updateScaleValueCards() { + Map orderedScaleValueCardPresenters = getOrderedScaleValueCardPresenters(); + scaleValueCardPresenters.clear(); + scaleValueCardPresenters.putAll(orderedScaleValueCardPresenters); + + scaleValueCardPresenters.values().forEach(scaleValueCardPresenter -> view.getScaleValueCardsView().add(scaleValueCardPresenter.getView().asWidget())); + } + + private Map getOrderedScaleValueCardPresenters() { + Map orderedScaleValueCardPresenters = new LinkedHashMap<>(); + + for (String key : scaleCardsOrderByAxis) { + if (scaleValueCardPresenters.containsKey(key)) { + orderedScaleValueCardPresenters.put(key, scaleValueCardPresenters.get(key)); + } + } + + return orderedScaleValueCardPresenters; } private TableCellChangedHandler handleTableCellChanged() { @@ -242,13 +383,18 @@ private boolean isScaleValuePresenterCreated(String axisIri) { .filter(compositeAxis -> compositeAxis.getPostCoordinationAxis().equals(axisIri)) .findFirst(); - if (compositeAxesOptional.isPresent()) { - return compositeAxesOptional.get() - .getSubAxis() - .stream() - .anyMatch(subAxis -> scaleValueCardPresenters.get(subAxis) != null); - } - return scaleValueCardPresenters.get(axisIri) != null; + return compositeAxesOptional.map( + postCoordinationCompositeAxis -> postCoordinationCompositeAxis + .getSubAxis() + .stream() + .anyMatch(subAxis -> scaleValueCardPresenters.get(subAxis) != null)) + .orElseGet(() -> scaleValueCardPresenters.get(axisIri) != null); + } + + public void setEditMode(boolean editMode) { + this.editMode = editMode; + scaleValueCardPresenters.values().forEach(presenter -> presenter.setEditMode(editMode)); + view.setEditMode(editMode); } } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletView.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletView.java index 3f8b45dd0..c44aeee03 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletView.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletView.java @@ -5,6 +5,7 @@ import edu.stanford.bmir.protege.web.shared.HasDispose; import edu.stanford.bmir.protege.web.shared.linearization.LinearizationDefinition; import edu.stanford.bmir.protege.web.shared.postcoordination.PostCoordinationTableAxisLabel; +import edu.stanford.bmir.protege.web.shared.postcoordination.WhoficEntityPostCoordinationSpecification; import edu.stanford.bmir.protege.web.shared.project.ProjectId; import java.util.*; @@ -16,9 +17,17 @@ public interface PostCoordinationPortletView extends AcceptsOneWidget, IsWidget, void setLinearizationDefinitonMap(Map linearizationDefinitonMap); - void setPostCoordinationEntity(); + void initializeTable(); VerticalPanel getScaleValueCardsView(); void setTableCellChangedHandler(TableCellChangedHandler handler); + + void setTableData(WhoficEntityPostCoordinationSpecification specification); + void setEditButtonHandler(EditButtonHandler handler); + void setCancelButtonHandler(CancelButtonHandler handler); + void setSaveButtonHandler(SaveButtonHandler handler); + void setEditMode(boolean editMode); + + Optional getTableData(); } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletViewImpl.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletViewImpl.java index 349486e71..382061ffe 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletViewImpl.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletViewImpl.java @@ -6,15 +6,16 @@ import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; import edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.TableCellChangedHandler; import edu.stanford.bmir.protege.web.shared.linearization.LinearizationDefinition; -import edu.stanford.bmir.protege.web.shared.postcoordination.PostCoordinationTableAxisLabel; +import edu.stanford.bmir.protege.web.shared.postcoordination.*; import edu.stanford.bmir.protege.web.shared.project.ProjectId; import javax.inject.Inject; import java.util.*; +import java.util.logging.Logger; import java.util.stream.Collectors; public class PostCoordinationPortletViewImpl extends Composite implements PostCoordinationPortletView { - + Logger logger = java.util.logging.Logger.getLogger("PostCoordinationPortletViewImpl"); @UiField HTMLPanel paneContainer; @@ -23,16 +24,35 @@ public class PostCoordinationPortletViewImpl extends Composite implements PostCo protected FlexTable flexTable; @UiField public VerticalPanel scaleValueCardList; + @UiField + Button saveValuesButton; + @UiField + Button editValuesButton; + + @UiField + Button cancelButton; + + private boolean readOnly = true; + + private String entityIri; + private ProjectId projectId; private Map labels; private Map definitionMap; - private final List tableRows = new ArrayList<>(); + private List tableRows = new ArrayList<>(); private final DispatchServiceManager dispatch; private TableCellChangedHandler tableCellChanged = (isAxisEnabledOnAnyRow, checkboxValue, tableAxisLabel) -> { }; + private EditButtonHandler editButtonHandler = () -> { + }; + private CancelButtonHandler cancelButtonHandler = () -> { + }; + private SaveButtonHandler saveButtonHandler = (Optional specificationOptional) -> { + }; + private static final PostCoordinationTableResourceBundle.PostCoordinationTableCss style = PostCoordinationTableResourceBundle.INSTANCE.style(); private static final PostCoordinationPortletViewImpl.PostCoordinationPortletViewImplUiBinder ourUiBinder = GWT.create(PostCoordinationPortletViewImpl.PostCoordinationPortletViewImplUiBinder.class); @@ -41,13 +61,93 @@ public class PostCoordinationPortletViewImpl extends Composite implements PostCo public PostCoordinationPortletViewImpl(DispatchServiceManager dispatch) { initWidget(ourUiBinder.createAndBindUi(this)); + saveValuesButton.addClickHandler(event -> saveButtonHandler.saveValues(createEditedSpec())); + cancelButton.addClickHandler(event -> cancelButtonHandler.handleCancelButton()); + editValuesButton.addClickHandler(event -> editButtonHandler.enableEditMode()); + saveValuesButton.setVisible(!readOnly); + editValuesButton.setVisible(readOnly); this.dispatch = dispatch; style.ensureInjected(); } + + public void setEditMode(boolean editMode) { + readOnly = !editMode; + setTableState(readOnly); + saveValuesButton.setVisible(editMode); + cancelButton.setVisible(editMode); + editValuesButton.setVisible(!editMode); + } + @Override - public void setProjectId(ProjectId projectId) { + public Optional getTableData() { + return createEditedSpec(); + } + + @Override + public void setEditButtonHandler(EditButtonHandler handler) { + this.editButtonHandler = handler; + } + + @Override + public void setCancelButtonHandler(CancelButtonHandler handler) { + this.cancelButtonHandler = handler; + } + + @Override + public void setSaveButtonHandler(SaveButtonHandler handler) { + this.saveButtonHandler = handler; + } + + private void setTableState(boolean readOnly) { + for (PostCoordinationTableRow row : tableRows) { + for (PostCoordinationTableCell cell : row.getCellList()) { + cell.setState(readOnly); + } + } + } + + private Optional createEditedSpec() { + WhoficEntityPostCoordinationSpecification specification = new WhoficEntityPostCoordinationSpecification(entityIri, "ICD", new ArrayList<>()); + boolean somethingChanged = false; + for (PostCoordinationTableRow tableRow : this.tableRows) { + PostCoordinationSpecification postCoordinationSpecification = new PostCoordinationSpecification(tableRow.getLinearizationDefinition().getWhoficEntityIri(), + new ArrayList<>(), + new ArrayList<>(), + new ArrayList<>(), + new ArrayList<>()); + for (PostCoordinationTableCell cell : tableRow.getCellList()) { + if (cell.isTouched()) { + if (cell.getValue().equalsIgnoreCase("NOT_ALLOWED")) { + postCoordinationSpecification.getNotAllowedAxes().add(cell.getAxisLabel().getPostCoordinationAxis()); + somethingChanged = true; + } + if (cell.getValue().equalsIgnoreCase("ALLOWED")) { + postCoordinationSpecification.getAllowedAxes().add(cell.getAxisLabel().getPostCoordinationAxis()); + somethingChanged = true; + } + if (cell.getValue().equalsIgnoreCase("REQUIRED")) { + postCoordinationSpecification.getRequiredAxes().add(cell.getAxisLabel().getPostCoordinationAxis()); + somethingChanged = true; + } + if (cell.getValue().startsWith("DEFAULT")) { + postCoordinationSpecification.getDefaultAxes().add(cell.getAxisLabel().getPostCoordinationAxis()); + somethingChanged = true; + } + } + } + specification.getPostCoordinationSpecifications().add(postCoordinationSpecification); + } + if (somethingChanged) { + return Optional.of(specification); + } + return Optional.empty(); + } + + @Override + public void setProjectId(ProjectId projectId) { + this.projectId = projectId; } @Override @@ -61,7 +161,7 @@ public void setLinearizationDefinitonMap(Map li } @Override - public void setPostCoordinationEntity() { + public void initializeTable() { initializeTableHeader(); initializeTableContent(); } @@ -98,39 +198,50 @@ private void initializeTableHeader() { private void initializeTableContent() { List definitions = new ArrayList<>(this.definitionMap.values()); - for (int i = 0; i < definitions.size(); i++) { - PostCoordinationTableRow tableRow = new PostCoordinationTableRow(definitions.get(i)); - addRowLabel(tableRow.isDerived(), definitions.get(i).getDisplayLabel(), i + 1, 0); + for (LinearizationDefinition definition : definitions) { + PostCoordinationTableRow tableRow = new PostCoordinationTableRow(definition); List labelList = new ArrayList<>(this.labels.values()); - for (int j = 0; j < labelList.size(); j++) { - LinearizationDefinition linDef = definitions.get(i); - PostCoordinationTableAxisLabel axisLabel = labelList.get(j); - PostCoordinationTableCell cell = new PostCoordinationTableCell(linDef, axisLabel, tableRow); + for (PostCoordinationTableAxisLabel postCoordinationTableAxisLabel : labelList) { + PostCoordinationTableCell cell = new PostCoordinationTableCell(definition, postCoordinationTableAxisLabel, tableRow); cell.addValueChangeHandler(valueChanged -> { tableCellChanged.handleTableCellChanged( - isAxisEnabledOnAnyRow(axisLabel), + isAxisEnabledOnAnyRow(postCoordinationTableAxisLabel), valueChanged.getValue(), cell.getAxisLabel().getPostCoordinationAxis() ); - updateTelescopicLinearizations(cell); }); - flexTable.setWidget(i + 1, j + 1, cell.asWidget()); tableRow.addCell(cell); } - addRowLabel(false, definitions.get(i).getDisplayLabel(), i + 1, labelList.size() + 1); + this.tableRows.add(tableRow); + } + orderAndPopulateViewWithRows(); + bindCellsToParentCells(); + } + + private void orderAndPopulateViewWithRows() { + List orderedRows = tableRows.stream() + .sorted((o1, o2) -> o1.getLinearizationDefinition().getSortingCode().compareToIgnoreCase(o2.getLinearizationDefinition().getSortingCode())) + .collect(Collectors.toList()); + this.tableRows = orderedRows; + + for (int i = 0; i < orderedRows.size(); i++) { + + addRowLabel(orderedRows.get(i).isDerived(), orderedRows.get(i).getLinearizationDefinition().getDisplayLabel(), i + 1, 0); + + for(int j = 0; j < orderedRows.get(i).getCellList().size(); j ++) { + flexTable.setWidget(i + 1, j + 1, orderedRows.get(i).getCellList().get(j).asWidget()); + } flexTable.getRowFormatter().addStyleName(i + 1, style.getCustomRowStyle()); if ((i + 1) % 2 == 1) { flexTable.getRowFormatter().addStyleName(i + 1, style.getEvenRowStyle()); } - this.tableRows.add(tableRow); - } - for (PostCoordinationTableRow tableRow : tableRows) { - tableRow.bindToParentRow(tableRows); + addRowLabel(orderedRows.get(i).isDerived(), orderedRows.get(i).getLinearizationDefinition().getDisplayLabel(), i + 1, orderedRows.get(i).getCellList().size() + 1); } } + private boolean isAxisEnabledOnAnyRow(PostCoordinationTableAxisLabel axisLabel) { List tableRowsWithAxisChecked = this.tableRows.stream() .filter(tableRow -> tableRow.getCellList() @@ -144,9 +255,23 @@ private boolean isAxisEnabledOnAnyRow(PostCoordinationTableAxisLabel axisLabel) return tableRowsWithAxisChecked.size() > 0; } - private void updateTelescopicLinearizations(PostCoordinationTableCell cell) { - for (PostCoordinationTableRow tableRow : this.tableRows) { - tableRow.updateDerivedCell(cell); + + private void bindCellsToParentCells(){ + for(PostCoordinationTableRow row : this.tableRows) { + if(!row.isDerived()) { + for(PostCoordinationTableRow childRow : this.tableRows) { + if(childRow.isDerived() && childRow.getLinearizationDefinition().getCoreLinId().equalsIgnoreCase(row.getLinearizationDefinition().getId())) { + for(PostCoordinationTableCell parentCell: row.getCellList()) { + for(PostCoordinationTableCell childCell: childRow.getCellList()) { + if(parentCell.getAxisLabel().getPostCoordinationAxis().equalsIgnoreCase(childCell.getAxisLabel().getPostCoordinationAxis())) { + parentCell.addToChildCells(childCell); + childCell.setIsDerived(); + } + } + } + } + } + } } } @@ -161,7 +286,6 @@ private void addRowLabel(boolean isDerived, String label, int row, int column) { rowLabel.getElement().setInnerHTML(rowLabelString); rowLabel.addStyleName(style.getRowLabel()); flexTable.setWidget(row, column, rowLabel); - //flexTable.getCellFormatter().addStyleName(row, column, style.getRowLabel()); } private void addHeaderCell(String label, int position) { @@ -200,6 +324,61 @@ public void setTableCellChangedHandler(TableCellChangedHandler handler) { this.tableCellChanged = handler; } + @Override + public void setTableData(WhoficEntityPostCoordinationSpecification whoficSpecification) { + logger.info("Set table data"); + this.entityIri = whoficSpecification.getWhoficEntityIri(); + + for(PostCoordinationTableRow row: this.tableRows) { + for(PostCoordinationTableCell cell : row.getCellList()) { + cell.reset(); + } + } + + if(!whoficSpecification.getPostCoordinationSpecifications().isEmpty()) { + for (PostCoordinationTableRow row : this.tableRows) { + for (PostCoordinationTableCell cell : row.getCellList()) { + PostCoordinationSpecification specification = whoficSpecification.getPostCoordinationSpecifications().stream() + .filter(spec -> spec.getLinearizationView() + .equalsIgnoreCase(cell.getLinearizationDefinition().getWhoficEntityIri())) + .findFirst() + .orElse(null); + + if (specification != null) { + if (specification.getAllowedAxes().contains(cell.getAxisLabel().getPostCoordinationAxis())) { + cell.setValue("ALLOWED"); + } + + if (specification.getRequiredAxes().contains(cell.getAxisLabel().getPostCoordinationAxis())) { + cell.setValue("REQUIRED"); + } + + if (specification.getNotAllowedAxes().contains(cell.getAxisLabel().getPostCoordinationAxis())) { + cell.setValue("NOT_ALLOWED"); + } + + } else { + cell.setValue("NOT_ALLOWED"); + } + } + } + + } + bindCellsToParentCells(); + + for(PostCoordinationTableRow row: this.tableRows) { + for(PostCoordinationTableCell cell: row.getCellList()) { + cell.updateChildren(); + cell.initializeCallback(); + } + } + + setTableState(true); + editValuesButton.setVisible(true); + saveValuesButton.setVisible(false); + cancelButton.setVisible(false); + } + private static final String SVG = "
" + " " + diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletViewImpl.ui.xml b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletViewImpl.ui.xml index d6a4802aa..2a7122b2d 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletViewImpl.ui.xml +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationPortletViewImpl.ui.xml @@ -1,9 +1,59 @@ + + + .buttonsWrapper { + flex-direction: row; + align-content: end; + display: flex; + justify-content: end; + width: 97%; + margin:15px; + padding: 3px; + } + + .editValuesButton { + background-color: #186cd4; + border: none; + color: white; + padding: 10px 15px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 14px; + margin: 4px 2px; + cursor: pointer; + border-radius: 8px; + } + + .cancelButton { + background-color: #F7F7F7; + border: none; + color: var(--primary--color); + padding: 10px 15px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 14px; + margin: 4px 2px; + cursor: pointer; + border-radius: 8px; + } + + .cancelButton:hover { + background-color: #E3E3E3; + } + +
+ Edit values + Save values + Cancel +
+
\ No newline at end of file diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTable.css b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTable.css index 9faf9e186..3ae63c64d 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTable.css +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTable.css @@ -32,6 +32,15 @@ .evenRowStyle { background-color: #f2f7f4; + vertical-align: middle; +} + +.customRowStyle td { + vertical-align: middle!important; +} + +.evenRowStyle td { + vertical-align: middle!important; } @@ -54,7 +63,12 @@ vertical-align: middle; display: flex; margin-left: 5px; + align-items: center; +} +.disabled { + pointer-events: none; + opacity: 0.5; } @@ -73,7 +87,7 @@ color: #fff; line-height: 1.4; background-color: #186cd4; - padding: 10px; + padding: 4px; font-weight: bold; font-family: "Helvetica Neue", "Lucida Grande", "Segoe UI", Arial, Helvetica, Verdana, sans-serif; border-top-left-radius: 5px; @@ -119,4 +133,10 @@ .toggle-icon { cursor: pointer; margin-right: 5px; +} + +.header-icon { + vertical-align: text-top; + margin-left: 5px; + width: auto; } \ No newline at end of file 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 6a2d48fba..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 @@ -8,27 +8,32 @@ import edu.stanford.bmir.protege.web.shared.linearization.LinearizationDefinition; import edu.stanford.bmir.protege.web.shared.postcoordination.PostCoordinationTableAxisLabel; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Logger; public class PostCoordinationTableCell { private ConfigurableCheckbox configurableCheckbox; private LinearizationDefinition linearizationDefinition; - private PostCoordinationCheckboxConfig checkboxConfig; private PostCoordinationTableAxisLabel axisLabel; - - private PostCoordinationTableRow parentRow; + private List childCells = new ArrayList<>(); Logger logger = java.util.logging.Logger.getLogger("PostCoordinationTableCell"); public PostCoordinationTableCell(LinearizationDefinition linearizationDefinition, PostCoordinationTableAxisLabel axisLabel, PostCoordinationTableRow parentRow) { this.checkboxConfig = new PostCoordinationCheckboxConfig(); - configurableCheckbox = new ConfigurableCheckbox(checkboxConfig, "UNKNOWN"); - configurableCheckbox.setReadOnly(false); - configurableCheckbox.setEnabled(true); + this.linearizationDefinition = linearizationDefinition; + this.axisLabel = axisLabel; - this.parentRow = parentRow; + String initialValue = "NOT_ALLOWED"; + if(linearizationDefinition.getCoreLinId() != null && !linearizationDefinition.getCoreLinId().isEmpty()) { + initialValue = "DEFAULT_NOT_ALLOWED"; + } + configurableCheckbox = new ConfigurableCheckbox(checkboxConfig, initialValue); + configurableCheckbox.setReadOnly(true); + configurableCheckbox.setEnabled(false); } public Widget asWidget(){ @@ -38,15 +43,44 @@ public Widget asWidget(){ public HandlerRegistration addValueChangeHandler(ValueChangeHandler handler) { return this.configurableCheckbox.addValueChangeHandler(handler); } + public void setState(boolean readOnly) { + configurableCheckbox.setReadOnly(readOnly); + configurableCheckbox.setEnabled(!readOnly); + } public void setValue(String value) { this.configurableCheckbox.setValue(value); + for(PostCoordinationTableCell childCell: this.childCells) { + if(childCell.getValue().startsWith("DEFAULT")) { + childCell.setValue("DEFAULT_"+value); + } + } + } + + public void addToChildCells(PostCoordinationTableCell childCell) { + this.childCells.add(childCell); } public boolean isTouched(){ return configurableCheckbox.isTouched(); } + public void initializeCallback(){ + this.configurableCheckbox.addValueChangeHandler((checkboxValue -> { + this.updateChildCells(checkboxValue.getValue().getValue()); + })); + } + + public void reset(){ + this.childCells = new ArrayList<>(); + this.configurableCheckbox.setTouched(false); + if(this.checkboxConfig.isDerived()) { + this.setValue("DEFAULT_NOT_ALLOWED"); + } else { + this.setValue("NOT_ALLOWED"); + } + } + public String getValue() { return this.configurableCheckbox.getValue().getValue(); } @@ -63,6 +97,25 @@ public PostCoordinationTableAxisLabel getAxisLabel() { return axisLabel; } + public void setIsDerived(){ + this.checkboxConfig.setIsDerived(true); + } + + public void updateChildCells(String checkboxValue) { + if(!checkboxConfig.isDerived()) { + for(PostCoordinationTableCell childCell: this.childCells) { + if(childCell.getValue().startsWith("DEFAULT")) { + childCell.setValue("DEFAULT_"+checkboxValue); + } + childCell.setParentValue(this.getAsCheckboxValue()); + } + } + } + + public void updateChildren() { + updateChildCells(this.getValue()); + } + public void setParentValue(CheckboxValue parentValue) { this.checkboxConfig.setParentValue(parentValue); } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTableResourceBundle.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTableResourceBundle.java index 15aaf3770..0bc13907a 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTableResourceBundle.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTableResourceBundle.java @@ -59,6 +59,12 @@ interface PostCoordinationTableCss extends CssResource { @ClassName("toggle-icon") String toggleIcon(); + + @ClassName("disabled") + String disabled(); + + @ClassName("header-icon") + String headerIcon(); } } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTableRow.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTableRow.java index 578f883ca..5becb434e 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTableRow.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/PostCoordinationTableRow.java @@ -18,47 +18,12 @@ public void addCell(PostCoordinationTableCell cell) { this.cellList.add(cell); } - public void updateDerivedCell(PostCoordinationTableCell changedCell) { - if (isDerived() && linearizationDefinition.getCoreLinId().equalsIgnoreCase(changedCell.getLinearizationDefinition().getId())) { - Optional equivalentCell = this.cellList.stream() - .filter(cell -> cell.getAxisLabel().getPostCoordinationAxis().equalsIgnoreCase(changedCell.getAxisLabel().getPostCoordinationAxis())) - .findFirst(); - equivalentCell.ifPresent(cell -> { - if (!cell.isTouched() || cell.getValue().startsWith("DEFAULT")) { - cell.setParentValue(changedCell.getAsCheckboxValue()); - cell.setValue("DEFAULT_" + changedCell.getValue()); - - } - }); - } - } - public boolean isDerived() { return linearizationDefinition.getCoreLinId() != null && !linearizationDefinition.getCoreLinId().isEmpty(); } - public void bindToParentRow(List tableRows) { - if (isDerived()) { - PostCoordinationTableRow parentRow = findParentRow(linearizationDefinition.getCoreLinId(), tableRows); - bindCellsToParentCells(parentRow); - } - } - - - private void bindCellsToParentCells(PostCoordinationTableRow parentRow) { - for (PostCoordinationTableCell parentCell : parentRow.cellList) { - Optional cellToUpload = this.cellList.stream() - .filter(myCell -> myCell.getAxisLabel().getPostCoordinationAxis().equalsIgnoreCase(parentCell.getAxisLabel().getPostCoordinationAxis())) - .findFirst(); - - cellToUpload.ifPresent(cell -> cell.setParentValue(parentCell.getAsCheckboxValue())); - } - } - - PostCoordinationTableRow findParentRow(String parentIRI, List rows) { - return rows.stream().filter(row -> row.linearizationDefinition.getId().equalsIgnoreCase(parentIRI)) - .findFirst() - .orElseThrow(() -> new RuntimeException("Parent not found")); + public LinearizationDefinition getLinearizationDefinition() { + return linearizationDefinition; } public List getCellList() { diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/SaveButtonHandler.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/SaveButtonHandler.java new file mode 100644 index 000000000..ac3c98310 --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/SaveButtonHandler.java @@ -0,0 +1,10 @@ +package edu.stanford.bmir.protege.web.client.postcoordination; + +import edu.stanford.bmir.protege.web.shared.postcoordination.WhoficEntityPostCoordinationSpecification; + +import java.util.Optional; + +public interface SaveButtonHandler { + + void saveValues(Optional specificationOptional); +} diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/UploadPostCoordinationWorkflow.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/UploadPostCoordinationWorkflow.java new file mode 100644 index 000000000..00281ed20 --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/UploadPostCoordinationWorkflow.java @@ -0,0 +1,96 @@ +package edu.stanford.bmir.protege.web.client.postcoordination; + +import com.google.gwt.core.client.GWT; +import edu.stanford.bmir.protege.web.client.dispatch.DispatchErrorMessageDisplay; +import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallbackWithProgressDisplay; +import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; +import edu.stanford.bmir.protege.web.client.dispatch.ProgressDisplay; +import edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog; +import edu.stanford.bmir.protege.web.client.library.msgbox.MessageBox; +import edu.stanford.bmir.protege.web.client.upload.UploadFileDialogController; +import edu.stanford.bmir.protege.web.client.upload.UploadFileDialogControllerFactory; +import edu.stanford.bmir.protege.web.client.upload.UploadFileResultHandler; +import edu.stanford.bmir.protege.web.shared.csv.DocumentId; +import edu.stanford.bmir.protege.web.shared.postcoordination.ProcessUploadedPostCoordinationResult; +import edu.stanford.bmir.protege.web.shared.project.ProjectId; + +import javax.annotation.Nonnull; +import javax.inject.Inject; + + +public class UploadPostCoordinationWorkflow { + + + @Nonnull + private final UploadFileDialogControllerFactory uploadFileDialogControllerFactory; + + private final DispatchServiceManager dispatchServiceManager; + + @Nonnull + private final MessageBox messageBox; + + @Nonnull + private final DispatchErrorMessageDisplay errorDisplay; + + @Nonnull + private final ProgressDisplay progressDisplay; + + + @Inject + public UploadPostCoordinationWorkflow(@Nonnull UploadFileDialogControllerFactory uploadFileDialogControllerFactory, + DispatchServiceManager dispatchServiceManager, @Nonnull MessageBox messageBox, + @Nonnull DispatchErrorMessageDisplay errorDisplay, @Nonnull ProgressDisplay progressDisplay) { + this.uploadFileDialogControllerFactory = uploadFileDialogControllerFactory; + this.dispatchServiceManager = dispatchServiceManager; + this.messageBox = messageBox; + this.errorDisplay = errorDisplay; + this.progressDisplay = progressDisplay; + } + + + public void start(ProjectId projectId, UploadPostCoordinationWorkflowConfiguration configuration) { + uploadPostCoordination(projectId, configuration); + } + + + private void uploadPostCoordination(final ProjectId projectId, UploadPostCoordinationWorkflowConfiguration configuration) { + UploadFileDialogController uploadFileDialogController = uploadFileDialogControllerFactory.create( + configuration.getMenuTitle(), new UploadFileResultHandler() { + @Override + public void handleFileUploaded(DocumentId fileDocumentId) { + handleAfterFileUpload(projectId, fileDocumentId, configuration); + } + + @Override + public void handleFileUploadFailed(String errorMessage) { + GWT.log("Upload failed"); + } + } + ); + WebProtegeDialog.showDialog(uploadFileDialogController); + } + + private void handleAfterFileUpload(ProjectId projectId, DocumentId documentId, UploadPostCoordinationWorkflowConfiguration configuration) { + + dispatchServiceManager.execute( + configuration.getActionForDocumentUploadSupplier().apply(projectId, documentId), + new DispatchServiceCallbackWithProgressDisplay(errorDisplay, progressDisplay) { + + @Override + public String getProgressDisplayTitle() { + return configuration.getProgressDisplayTitle(); + } + + @Override + public String getProgressDisplayMessage() { + return configuration.getProgressDisplayMessages(); + } + + @Override + public void handleSuccess(ProcessUploadedPostCoordinationResult processUploadedLinearizationResult) { + messageBox.showMessage(configuration.getUploadSuccessMessage()); + } + } + ); + } +} diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/UploadPostCoordinationWorkflowConfiguration.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/UploadPostCoordinationWorkflowConfiguration.java new file mode 100644 index 000000000..d8702e908 --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/UploadPostCoordinationWorkflowConfiguration.java @@ -0,0 +1,49 @@ +package edu.stanford.bmir.protege.web.client.postcoordination; + +import edu.stanford.bmir.protege.web.shared.csv.DocumentId; +import edu.stanford.bmir.protege.web.shared.dispatch.AbstractHasProjectAction; +import edu.stanford.bmir.protege.web.shared.project.ProjectId; + +import java.util.function.BiFunction; + + +public class UploadPostCoordinationWorkflowConfiguration { + + private final String menuTitle; + + private final String progressDisplayTitle; + + private final String progressDisplayMessages; + + private final String uploadSuccessMessage; + + private final BiFunction actionForDocumentUploadSupplier; + + public UploadPostCoordinationWorkflowConfiguration(String menuTitle, String progressDisplayTitle, String progressDisplayMessages, String uploadSucessMessage, BiFunction actionForDocumentUpload) { + this.menuTitle = menuTitle; + this.progressDisplayTitle = progressDisplayTitle; + this.progressDisplayMessages = progressDisplayMessages; + this.uploadSuccessMessage = uploadSucessMessage; + this.actionForDocumentUploadSupplier = actionForDocumentUpload; + } + + public String getMenuTitle() { + return menuTitle; + } + + public String getProgressDisplayTitle() { + return progressDisplayTitle; + } + + public String getProgressDisplayMessages() { + return progressDisplayMessages; + } + + public String getUploadSuccessMessage() { + return uploadSuccessMessage; + } + + public BiFunction getActionForDocumentUploadSupplier() { + return actionForDocumentUploadSupplier; + } +} diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/DeleteScaleValueButtonHandler.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/DeleteScaleValueButtonHandler.java index da1db6b52..35ba40c99 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/DeleteScaleValueButtonHandler.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/DeleteScaleValueButtonHandler.java @@ -1,6 +1,8 @@ package edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard; +import edu.stanford.bmir.protege.web.shared.postcoordination.ScaleValueIriAndName; + public interface DeleteScaleValueButtonHandler { - void handleDeleteButton(String value); + void handleDeleteButton(ScaleValueIriAndName value); } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/PostCoordinationAxisToGenericScale.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/PostCoordinationAxisToGenericScale.java deleted file mode 100644 index da0902250..000000000 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/PostCoordinationAxisToGenericScale.java +++ /dev/null @@ -1,33 +0,0 @@ -package edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard; - -public class PostCoordinationAxisToGenericScale { - private final String postcoordinationAxis; - private final String genericPostcoordinationScaleTopClass; - private final ScaleAllowMultiValue allowMultiValue; - - public PostCoordinationAxisToGenericScale(String postcoordinationAxis, - String genericPostcoordinationScaleTopClass, - ScaleAllowMultiValue allowMultiValue) { - this.postcoordinationAxis = postcoordinationAxis; - this.genericPostcoordinationScaleTopClass = genericPostcoordinationScaleTopClass; - this.allowMultiValue = allowMultiValue; - } - - public PostCoordinationAxisToGenericScale create(String postcoordinationAxis, - String genericPostcoordinationScaleTopClass, - ScaleAllowMultiValue allowMultiValue) { - return new PostCoordinationAxisToGenericScale(postcoordinationAxis, genericPostcoordinationScaleTopClass, allowMultiValue); - } - - public String getPostcoordinationAxis() { - return postcoordinationAxis; - } - - public String getGenericPostcoordinationScaleTopClass() { - return genericPostcoordinationScaleTopClass; - } - - public ScaleAllowMultiValue getAllowMultiValue() { - return allowMultiValue; - } -} diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/PostCoordinationScaleValue.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/PostCoordinationScaleValue.java deleted file mode 100644 index e108b2b72..000000000 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/PostCoordinationScaleValue.java +++ /dev/null @@ -1,42 +0,0 @@ -package edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard; - -import java.util.*; - -public class PostCoordinationScaleValue { - - private final String axisIri; - private final String axisLabel; - private final List valueIris; - private final PostCoordinationAxisToGenericScale genericScale; - - public PostCoordinationScaleValue(String axisIri, - String axisLabel, - List valueIris, PostCoordinationAxisToGenericScale genericScale) { - this.axisIri = axisIri; - this.axisLabel = axisLabel; - this.valueIris = valueIris; - this.genericScale = genericScale; - } - - public static PostCoordinationScaleValue createEmpty(String axisIri, - String axisLabel, - PostCoordinationAxisToGenericScale genericScale) { - return new PostCoordinationScaleValue(axisIri, axisLabel, new ArrayList<>(), genericScale); - } - - public String getAxisIri() { - return axisIri; - } - - public String getAxisLabel() { - return axisLabel; - } - - public List getValueIris() { - return valueIris; - } - - public PostCoordinationAxisToGenericScale getGenericScale(){ - return genericScale; - } -} diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleAllowMultiValue.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleAllowMultiValue.java index 19fc103e1..446f31af8 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleAllowMultiValue.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleAllowMultiValue.java @@ -1,18 +1,33 @@ package edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard; +import com.google.gwt.resources.client.DataResource; + +import javax.annotation.Nullable; +import java.util.Optional; + +import static edu.stanford.bmir.protege.web.resources.WebProtegeClientBundle.BUNDLE; + public enum ScaleAllowMultiValue { - NotAllowed("This does not allow multiple values"), - AllowAlways("This always allows multiple values"), - AllowedExceptFromSameBlock("This allows multiple values except from the same block"); + NotAllowed(Optional.of(BUNDLE.singleScaleValue()), "In the Coding Tool, this axis allows the selection of multiple values"), + AllowAlways(Optional.of(BUNDLE.multipleScaleValues()),"In the Coding Tool, this axis allows the selection of a single value"), + AllowedExceptFromSameBlock(Optional.of(BUNDLE.allowScaleValueIfNotFromSameBlock()),"In the Coding Tool, this axis allows the selection of multiple values, but only one value from each block"); - private final String description; + private final String tooltip; + + @Nullable + private transient DataResource image; + + ScaleAllowMultiValue(Optional image, String tooltip) { + this.tooltip = tooltip; + this.image = image.orElse(null); + } - ScaleAllowMultiValue(String description) { - this.description = description; + public String getTooltip() { + return tooltip; } - public String getBrowserText() { - return description; + public Optional getImage() { + return Optional.ofNullable(image); } public static ScaleAllowMultiValue fromString(String value) { diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardPresenter.java index fa7697966..0fe2e6175 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardPresenter.java @@ -1,32 +1,54 @@ package edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard; -import com.google.gwt.user.client.ui.VerticalPanel; import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; +import edu.stanford.bmir.protege.web.client.library.dlg.DialogButton; +import edu.stanford.bmir.protege.web.client.library.modal.*; +import edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.scaleValueSelectionModal.ScaleValueSelectionViewPresenter; import edu.stanford.bmir.protege.web.shared.entity.GetRenderedOwlEntitiesAction; -import edu.stanford.bmir.protege.web.shared.postcoordination.PostCoordinationTableAxisLabel; +import edu.stanford.bmir.protege.web.shared.postcoordination.*; import edu.stanford.bmir.protege.web.shared.project.ProjectId; -import java.util.HashSet; +import java.util.Set; +import java.util.stream.*; public class ScaleValueCardPresenter { - private final ScaleValueCardView view; - private final PostCoordinationTableAxisLabel postCoordinationAxis; - private final PostCoordinationScaleValue scaleValue; + private ScaleValueCardView view; + + private PostCoordinationTableAxisLabel postCoordinationAxis; + private PostcoordinationScaleValue scaleValue; private final DispatchServiceManager dispatchServiceManager; private final ProjectId projectId; + private boolean isReadOnly = true; - public ScaleValueCardPresenter(PostCoordinationTableAxisLabel postCoordinationAxis, - PostCoordinationScaleValue scaleValue, - ScaleValueCardView view, - DispatchServiceManager dispatchServiceManager, - ProjectId projectId) { - this.view = view; - this.postCoordinationAxis = postCoordinationAxis; - this.scaleValue = scaleValue; + private final ModalManager modalManager; + + private ScaleValueSelectionViewPresenter scaleValueSelectionPresenter; + + + public ScaleValueCardPresenter(DispatchServiceManager dispatchServiceManager, + ProjectId projectId, + ModalManager modalManager) { this.dispatchServiceManager = dispatchServiceManager; this.projectId = projectId; + this.modalManager = modalManager; + } + + public void setPostCoordinationAxis(PostCoordinationTableAxisLabel postCoordinationAxis) { + this.postCoordinationAxis = postCoordinationAxis; + } + + public void setScaleValue(PostcoordinationScaleValue scaleValue) { + this.scaleValue = scaleValue; + } + + public void setReadOnly(boolean readOnly) { + isReadOnly = readOnly; + } + + public void setScaleValueSelectionPresenter(ScaleValueSelectionViewPresenter scaleValueSelectionPresenter) { + this.scaleValueSelectionPresenter = scaleValueSelectionPresenter; } /* @@ -34,38 +56,77 @@ public ScaleValueCardPresenter(PostCoordinationTableAxisLabel postCoordinationAx implement here the pop-up modal for selecting a scale value */ private void bindView() { - view.setAddButtonClickHandler(event -> addRow("New Value")); + view.setAddButtonClickHandler(event -> showModalForSelection()); } private void initTable() { view.clearTable(); - view.addHeader(postCoordinationAxis.getScaleLabel(), scaleValue.getGenericScale().getAllowMultiValue().getBrowserText()); + view.addHeader(postCoordinationAxis.getScaleLabel(), ScaleAllowMultiValue.fromString(scaleValue.getGenericScale().getAllowMultiValue())); view.addSelectValueButton(); - dispatchServiceManager.execute(GetRenderedOwlEntitiesAction.create(projectId, new HashSet<>(scaleValue.getValueIris())), - result -> result.getRenderedEntities().forEach(renderedEntity -> addRow(!renderedEntity.getBrowserText().equals("") ? renderedEntity.getBrowserText() : renderedEntity.getEntity().toStringID())) + Set scaleValueIris = scaleValue.getValueIris() + .stream() + .flatMap(scaleValueIriAndName -> Stream.of(scaleValueIriAndName.getScaleValueIri())) + .collect(Collectors.toSet()); + + dispatchServiceManager.execute(GetRenderedOwlEntitiesAction.create(projectId, scaleValueIris), + result -> { + result.getRenderedEntities() + .forEach(renderedEntity -> addRow(renderedEntity.getEntity().toStringID(), !renderedEntity.getBrowserText().equals("") ? renderedEntity.getBrowserText() : renderedEntity.getEntity().toStringID())); + view.setEditMode(!isReadOnly); + } ); view.setDeleteValueButtonHandler((value) -> scaleValue.getValueIris().remove(value)); } - private void addRow(String value) { - scaleValue.getValueIris().add(value); - view.addRow(value); + private void addRow(String iri, String value) { + scaleValue.getValueIris().removeIf(existingValueIriAndName -> existingValueIriAndName.getScaleValueIri().equals(iri)); + + ScaleValueIriAndName valueIriAndName = ScaleValueIriAndName.create(iri, value); + scaleValue.getValueIris().add(valueIriAndName); + + view.addRow(valueIriAndName); } public ScaleValueCardView getView() { return view; } - public PostCoordinationScaleValue getValues() { + public PostcoordinationScaleValue getValues() { return scaleValue; } - public void start(VerticalPanel panel) { + public void setEditMode(boolean editMode) { + isReadOnly = !editMode; + view.setEditMode(editMode); + } + + public void start(boolean isEditMode) { + this.view = new ScaleValueCardViewImpl(); bindView(); initTable(); - panel.add(view.asWidget()); + setEditMode(isEditMode); + } + + public void showModalForSelection() { + ModalPresenter modalPresenter = modalManager.createPresenter(); + modalPresenter.setTitle("Select Scale Value for " + this.scaleValue.getAxisLabel()); + modalPresenter.setView(scaleValueSelectionPresenter.getView()); + modalPresenter.setEscapeButton(DialogButton.CANCEL); + modalPresenter.setPrimaryButton(DialogButton.SELECT); + modalPresenter.setButtonHandler(DialogButton.SELECT, closer -> { + closer.closeModal(); + selectChosenEntity(); + }); + scaleValueSelectionPresenter.setAllowMultiValue(ScaleAllowMultiValue.fromString(scaleValue.getGenericScale().getAllowMultiValue())); + scaleValueSelectionPresenter.setScaleTopClass(scaleValue.getGenericScale().getGenericPostcoordinationScaleTopClass()); + scaleValueSelectionPresenter.start(); + modalManager.showModal(modalPresenter); + } + + private void selectChosenEntity() { + scaleValueSelectionPresenter.getSelections().forEach(scaleValue -> addRow(scaleValue, scaleValue)); } } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardView.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardView.java index da0040802..89a9f0b72 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardView.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardView.java @@ -2,6 +2,7 @@ import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.event.dom.client.ClickHandler; +import edu.stanford.bmir.protege.web.shared.postcoordination.ScaleValueIriAndName; public interface ScaleValueCardView extends IsWidget { @@ -9,11 +10,12 @@ public interface ScaleValueCardView extends IsWidget { void clearTable(); - void addHeader(String headerText, String description); + void addHeader(String headerText, ScaleAllowMultiValue scaleAllowMultiValue); - void addRow(String value) ; + void addRow(ScaleValueIriAndName value) ; void addSelectValueButton(); void setDeleteValueButtonHandler(DeleteScaleValueButtonHandler handler); + void setEditMode(boolean enabled); } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardViewImpl.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardViewImpl.java index e356baff6..ac85aad96 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardViewImpl.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/ScaleValueCardViewImpl.java @@ -7,6 +7,7 @@ import edu.stanford.bmir.protege.web.client.library.button.DeleteButton; import edu.stanford.bmir.protege.web.client.postcoordination.PostCoordinationTableResourceBundle; import edu.stanford.bmir.protege.web.resources.WebProtegeClientBundle; +import edu.stanford.bmir.protege.web.shared.postcoordination.ScaleValueIriAndName; public class ScaleValueCardViewImpl implements ScaleValueCardView { @@ -19,6 +20,7 @@ interface ScaleValueCardViewImplUiBinder extends UiBinder" + collapseIcon + " " + headerText + "
" + description + ""); - headerHtml.setStyleName(postCoordinationStyle.scaleValueHeader()); + String imageUri = ""; + if (scaleAllowMultiValue.getImage().isPresent()) { + imageUri = scaleAllowMultiValue.getImage().get().getSafeUri().asString(); + } + StringBuilder sb = new StringBuilder(); + sb.append("") + .append(collapseIcon) + .append(" ") + .append(headerText) + .append(spaceSymbol) + .append(""); + + headerHtml = new HTML(sb.toString()); valueTable.setWidget(0, 0, headerHtml); valueTable.getFlexCellFormatter().setColSpan(0, 0, 2); @@ -69,7 +92,7 @@ public void addHeader(String headerText, String description) { } @Override - public void addRow(String value) { + public void addRow(ScaleValueIriAndName value) { int addButtonRowIndex = valueTable.getRowCount(); valueTable.insertRow(addButtonRowIndex - 1); @@ -77,8 +100,8 @@ public void addRow(String value) { } - private void setRowContents(int rowIndex, String value) { - valueTable.setWidget(rowIndex, 0, new Label(value)); + private void setRowContents(int rowIndex, ScaleValueIriAndName value) { + valueTable.setWidget(rowIndex, 0, new Label(value.getScaleValueName())); Button deleteButton = new DeleteButton(); @@ -138,4 +161,22 @@ public void addSelectValueButton() { public Widget asWidget() { return rootPanel; } + + @Override + public void setEditMode(boolean enabled) { + setReadOnly(!enabled); + } + + private void setReadOnly(boolean readOnly) { + isReadOnly = readOnly; + + for (int i = 1; i < valueTable.getRowCount(); i++) { + if (readOnly) { + valueTable.getRowFormatter().addStyleName(i, postCoordinationStyle.disabled()); + } else { + valueTable.getRowFormatter().removeStyleName(i, postCoordinationStyle.disabled()); + } + } + } + } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionView.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionView.java new file mode 100644 index 000000000..478fbaab4 --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionView.java @@ -0,0 +1,16 @@ +package edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.scaleValueSelectionModal; + +import com.google.gwt.user.client.ui.IsWidget; +import edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.ScaleAllowMultiValue; +import edu.stanford.bmir.protege.web.client.progress.HasBusy; + +import java.util.List; + +public interface ScaleValueSelectionView extends IsWidget, HasBusy { + + void clear(); + + List getText(); + + void setTopClass(String scaleTopClass); +} diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.java new file mode 100644 index 000000000..5480e7967 --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.java @@ -0,0 +1,63 @@ +package edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.scaleValueSelectionModal; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.uibinder.client.*; +import com.google.gwt.user.client.ui.*; +import edu.stanford.bmir.protege.web.client.Messages; +import edu.stanford.bmir.protege.web.client.library.text.ExpandingTextBoxImpl; +import edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.ScaleAllowMultiValue; + +import javax.annotation.Nonnull; +import javax.inject.Inject; +import java.util.*; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +public class ScaleValueSelectionViewImpl extends Composite implements ScaleValueSelectionView { + + @UiField + ExpandingTextBoxImpl scaleValueSelection; + + private final Messages messages; + + private static final Logger logger = Logger.getLogger(ScaleValueSelectionViewImpl.class.getName()); + + interface ScaleValueSelectionModalImplUiBinder extends UiBinder { + } + + private static ScaleValueSelectionViewImpl.ScaleValueSelectionModalImplUiBinder ourUiBinder = GWT + .create(ScaleValueSelectionModalImplUiBinder.class); + + @Inject + public ScaleValueSelectionViewImpl(@Nonnull Messages messages) { + initWidget(ourUiBinder.createAndBindUi(this)); + this.messages = messages; + } + + @Override + public void setBusy(boolean busy) { + + } + + + @Override + protected void onAttach() { + super.onAttach(); + } + + + @Override + public void clear() { + scaleValueSelection.setText(""); + } + + @Override + public List getText() { + return Arrays.stream(scaleValueSelection.getText().trim().split("\n")).collect(Collectors.toList()); + } + + @Override + public void setTopClass(String scaleTopClass) { + + } +} diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.ui.xml b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.ui.xml new file mode 100644 index 000000000..e68a2f3cc --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewImpl.ui.xml @@ -0,0 +1,42 @@ + + + + + + .main-panel-style { + width: 800px; + max-width: 800px; + box-sizing: border-box; + overflow: hidden; + } + .main-panel-style * p { + padding-bottom: 10px; + } + .message-block { + width: 100%; + padding-left: 10px; + padding-top: 20px; + box-sizing: border-box; + } + + + + + + + + + + + +
+ + + +
+
+
\ No newline at end of file diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewPresenter.java new file mode 100644 index 000000000..37791b33d --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/postcoordination/scaleValuesCard/scaleValueSelectionModal/ScaleValueSelectionViewPresenter.java @@ -0,0 +1,46 @@ +package edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.scaleValueSelectionModal; + +import edu.stanford.bmir.protege.web.client.library.modal.ModalManager; +import edu.stanford.bmir.protege.web.client.postcoordination.scaleValuesCard.ScaleAllowMultiValue; + +import javax.annotation.Nonnull; +import javax.inject.Inject; +import java.util.List; + +public class ScaleValueSelectionViewPresenter { + + private ScaleValueSelectionView view; + private ScaleAllowMultiValue scaleAllowMultiValue; + private String scaleTopClass; + + @Nonnull + private final ModalManager modalManager; + + @Inject + public ScaleValueSelectionViewPresenter(ScaleValueSelectionView view, + @Nonnull ModalManager modalManager) { + this.view = view; + this.modalManager = modalManager; + } + + @Nonnull + public ScaleValueSelectionView getView() { + return view; + } + + public void start() { + } + + public List getSelections() { + return view.getText(); + } + + public void setAllowMultiValue(ScaleAllowMultiValue scaleAllowMultiValue) { + this.scaleAllowMultiValue = scaleAllowMultiValue; + } + + public void setScaleTopClass(String scaleTopClass) { + this.scaleTopClass = scaleTopClass; + this.view.setTopClass(scaleTopClass); + } +} diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/project/ProjectMenuPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/project/ProjectMenuPresenter.java index edf5608ef..5a91eac41 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/project/ProjectMenuPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/project/ProjectMenuPresenter.java @@ -7,6 +7,7 @@ import edu.stanford.bmir.protege.web.client.action.AbstractUiAction; import edu.stanford.bmir.protege.web.client.app.Presenter; import edu.stanford.bmir.protege.web.client.permissions.LoggedInUserProjectPermissionChecker; +import edu.stanford.bmir.protege.web.client.postcoordination.PostCoordinationChangesHandler; import edu.stanford.bmir.protege.web.client.projectsettings.*; import edu.stanford.bmir.protege.web.client.tag.EditProjectTagsUIActionHandler; import edu.stanford.bmir.protege.web.shared.HasDispose; @@ -33,6 +34,8 @@ public class ProjectMenuPresenter implements HasDispose, Presenter { private final UploadAndProcessLinearizationHandler linearizationChangesHandler; + private final PostCoordinationChangesHandler postCoordinationChangesHandler; + private final UploadAndMergeAdditionsHandler uploadAndMergeAdditionsHandler; private final LoggedInUserProjectPermissionChecker permissionChecker; @@ -69,6 +72,20 @@ public void execute() { } }; + private final AbstractUiAction uploadPostCoordinationChanges = new AbstractUiAction(MESSAGES.postCoordinationUpload()) { + @Override + public void execute() { + postCoordinationChangesHandler.handleUploadPostCoordinationChanges(); + } + }; + + private final AbstractUiAction uploadPostCoordinationCustomScales = new AbstractUiAction(MESSAGES.postCoordinationCustomScales()) { + @Override + public void execute() { + postCoordinationChangesHandler.handlePostCoordinationCustomScales(); + } + }; + private final AbstractUiAction uploadAndMergeAdditions = new AbstractUiAction(MESSAGES.uploadAndMergeAdditions()) { @Override public void execute() { @@ -117,7 +134,7 @@ public ProjectMenuPresenter(LoggedInUserProjectPermissionChecker permissionCheck ShowProjectDetailsHandler showProjectDetailsHandler, UploadAndMergeHandler uploadAndMergeHandler, UploadAndProcessLinearizationHandler linearizationChangesHandler, - UploadAndMergeAdditionsHandler uploadAndMergeAdditionsHandler, + PostCoordinationChangesHandler postCoordinationChangesHandler, UploadAndMergeAdditionsHandler uploadAndMergeAdditionsHandler, EditProjectPrefixDeclarationsHandler editProjectPrefixDeclarationsHandler, EditProjectTagsUIActionHandler editProjectTagsUIActionHandler, EditProjectFormsUiHandler editProjectFormsUiHandler, @@ -128,6 +145,7 @@ public ProjectMenuPresenter(LoggedInUserProjectPermissionChecker permissionCheck this.showProjectDetailsHandler = showProjectDetailsHandler; this.uploadAndMergeHandler = uploadAndMergeHandler; this.linearizationChangesHandler = linearizationChangesHandler; + this.postCoordinationChangesHandler = postCoordinationChangesHandler; this.uploadAndMergeAdditionsHandler = uploadAndMergeAdditionsHandler; this.editProjectPrefixDeclarationsHandler = editProjectPrefixDeclarationsHandler; this.editProjectTagsUIActionHandler = editProjectTagsUIActionHandler; @@ -142,6 +160,8 @@ public void start(@Nonnull AcceptsOneWidget container, @Nonnull EventBus eventBu uploadAndMerge.setEnabled(false); uploadAndMergeAdditions.setEnabled(false); uploadLinearizationChanges.setEnabled(false); + uploadPostCoordinationChanges.setEnabled(false); + uploadPostCoordinationCustomScales.setEnabled(false); displayButton(container); permissionChecker.hasPermission(EDIT_PROJECT_SETTINGS, editProjectSettings::setEnabled); permissionChecker.hasPermission(UPLOAD_AND_MERGE, uploadAndMerge::setEnabled); @@ -152,6 +172,8 @@ public void start(@Nonnull AcceptsOneWidget container, @Nonnull EventBus eventBu permissionChecker.hasPermission(EDIT_PROJECT_SETTINGS, importSettings::setEnabled); permissionChecker.hasPermission(UPLOAD_AND_MERGE_ADDITIONS, uploadAndMergeAdditions::setEnabled); permissionChecker.hasPermission(EDIT_ONTOLOGY, uploadLinearizationChanges::setEnabled); + permissionChecker.hasPermission(EDIT_ONTOLOGY, uploadPostCoordinationChanges::setEnabled); + permissionChecker.hasPermission(EDIT_ONTOLOGY, uploadPostCoordinationCustomScales::setEnabled); } @@ -170,6 +192,8 @@ private void setupActions() { view.addMenuAction(editProjectPrefixes); view.addSeparator(); view.addMenuAction(uploadLinearizationChanges); + view.addMenuAction(uploadPostCoordinationChanges); + view.addMenuAction(uploadPostCoordinationCustomScales); view.addSeparator(); view.addMenuAction(uploadAndMerge); diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/WebProtegeClientBundle.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/WebProtegeClientBundle.java index 3b6a100f4..1f884fcdc 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/WebProtegeClientBundle.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/WebProtegeClientBundle.java @@ -315,6 +315,18 @@ public interface WebProtegeClientBundle extends ClientBundle { @Source("primitive-data.css") WebProtegePrimitiveDataCss primitiveData(); + @Source("single.svg") + @DataResource.MimeType("image/svg+xml") + DataResource singleScaleValue(); + + @Source("multiple.svg") + @DataResource.MimeType("image/svg+xml") + DataResource multipleScaleValues(); + + @Source("block.svg") + @DataResource.MimeType("image/svg+xml") + DataResource allowScaleValueIfNotFromSameBlock(); + interface WebProtegePrimitiveDataCss extends CssResource { @ClassName("wp-pd") diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/block.svg b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/block.svg new file mode 100644 index 000000000..f17d64e47 --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/block.svg @@ -0,0 +1,17 @@ + + + + background + + + + + + + Layer 1 + + + + + + \ No newline at end of file diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/multiple.svg b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/multiple.svg new file mode 100644 index 000000000..f050fee93 --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/multiple.svg @@ -0,0 +1,17 @@ + + + + background + + + + + + + Layer 1 + + + + + + \ No newline at end of file diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/single.svg b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/single.svg new file mode 100644 index 000000000..3245067f1 --- /dev/null +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/resources/single.svg @@ -0,0 +1,17 @@ + + + + background + + + + + + + Layer 1 + + + + + + \ No newline at end of file diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Action.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Action.java index 78c630ba2..3e310a5d2 100644 --- a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Action.java +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Action.java @@ -29,9 +29,7 @@ import edu.stanford.bmir.protege.web.shared.itemlist.GetPossibleItemCompletionsAction; import edu.stanford.bmir.protege.web.shared.itemlist.GetUserIdCompletionsAction; import edu.stanford.bmir.protege.web.shared.lang.GetProjectLangTagsAction; -import edu.stanford.bmir.protege.web.shared.linearization.GetEntityLinearizationAction; -import edu.stanford.bmir.protege.web.shared.linearization.GetLinearizationDefinitionsAction; -import edu.stanford.bmir.protege.web.shared.linearization.SaveEntityLinearizationAction; +import edu.stanford.bmir.protege.web.shared.linearization.*; import edu.stanford.bmir.protege.web.shared.mail.GetEmailAddressAction; import edu.stanford.bmir.protege.web.shared.mail.SetEmailAddressAction; import edu.stanford.bmir.protege.web.shared.match.GetMatchingEntitiesAction; @@ -44,7 +42,7 @@ import edu.stanford.bmir.protege.web.shared.permissions.GetProjectPermissionsAction; import edu.stanford.bmir.protege.web.shared.permissions.RebuildPermissionsAction; import edu.stanford.bmir.protege.web.shared.perspective.*; -import edu.stanford.bmir.protege.web.shared.postcoordination.GetPostCoordinationTableConfigurationAction; +import edu.stanford.bmir.protege.web.shared.postcoordination.*; import edu.stanford.bmir.protege.web.shared.project.*; import edu.stanford.bmir.protege.web.shared.projectsettings.GetProjectSettingsAction; import edu.stanford.bmir.protege.web.shared.projectsettings.SetProjectSettingsAction; @@ -229,9 +227,15 @@ @Type(value = GetEntityLinearizationAction.class), @Type(value = GetClassAncestorsAction.class), @Type(value = SaveEntityLinearizationAction.class), + @Type(value = SaveEntityPostCoordinationAction.class), @Type(value = GetRenderedOwlEntitiesAction.class), + @Type(value = GetEntityPostCoordinationAction.class), @Type(value = GetPostCoordinationTableConfigurationAction.class), - @Type(value = GetProjectChangesForHistoryViewAction.class) + @Type(value = GetProjectChangesForHistoryViewAction.class), + @Type(value = ProcessUploadedLinearizationAction.class), + @Type(value = ProcessUploadedPostCoordinationAction.class), + @Type(value = GetPostcoordinationAxisToGenericScaleAction.class), + @Type(value = SaveEntityCustomScaleAction.class) }) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME) public interface Action extends IsSerializable { diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Result.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Result.java index 2059c9210..b3caca7fe 100644 --- a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Result.java +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Result.java @@ -64,9 +64,7 @@ import edu.stanford.bmir.protege.web.shared.itemlist.GetPossibleItemCompletionsResult; import edu.stanford.bmir.protege.web.shared.itemlist.GetUserIdCompletionsResult; import edu.stanford.bmir.protege.web.shared.lang.GetProjectLangTagsResult; -import edu.stanford.bmir.protege.web.shared.linearization.GetEntityLinearizationResult; -import edu.stanford.bmir.protege.web.shared.linearization.GetLinearizationDefinitionsResult; -import edu.stanford.bmir.protege.web.shared.linearization.SaveEntityLinearizationResult; +import edu.stanford.bmir.protege.web.shared.linearization.*; import edu.stanford.bmir.protege.web.shared.mail.GetEmailAddressResult; import edu.stanford.bmir.protege.web.shared.mail.SetEmailAddressResult; import edu.stanford.bmir.protege.web.shared.match.GetMatchingEntitiesResult; @@ -97,7 +95,7 @@ import edu.stanford.bmir.protege.web.shared.perspective.ResetPerspectivesResult; import edu.stanford.bmir.protege.web.shared.perspective.SetPerspectiveLayoutResult; import edu.stanford.bmir.protege.web.shared.perspective.SetPerspectivesResult; -import edu.stanford.bmir.protege.web.shared.postcoordination.GetPostCoordinationTableConfigurationResult; +import edu.stanford.bmir.protege.web.shared.postcoordination.*; import edu.stanford.bmir.protege.web.shared.project.CreateNewProjectResult; import edu.stanford.bmir.protege.web.shared.project.GetAvailableProjectsResult; import edu.stanford.bmir.protege.web.shared.project.GetAvailableProjectsWithPermissionResult; @@ -300,8 +298,16 @@ @JsonSubTypes.Type(SaveEntityLinearizationResult.class), @JsonSubTypes.Type(GetClassAncestorsResult.class), @JsonSubTypes.Type(GetRenderedOwlEntitiesResult.class), + @JsonSubTypes.Type(GetEntityPostCoordinationResult.class), + @JsonSubTypes.Type(ProcessUploadedCustomScalesResult.class), + @JsonSubTypes.Type(GetEntityCustomScalesResult.class), + @JsonSubTypes.Type(SaveEntityPostCoordinationResult.class), + @JsonSubTypes.Type(ProcessUploadedPostCoordinationResult.class), @JsonSubTypes.Type(GetPostCoordinationTableConfigurationResult.class), - @JsonSubTypes.Type(GetProjectChangesForHistoryViewResult.class) + @JsonSubTypes.Type(GetProjectChangesForHistoryViewResult.class), + @JsonSubTypes.Type(ProcessUploadedLinearizationResult.class), + @JsonSubTypes.Type(GetPostcoordinationAxisToGenericScaleResult.class), + @JsonSubTypes.Type(SaveEntityCustomScaleResult.class) }) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME) public interface Result extends IsSerializable { diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/RpcWhiteList.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/RpcWhiteList.java index 928f20999..93c9afcd0 100644 --- a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/RpcWhiteList.java +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/RpcWhiteList.java @@ -977,12 +977,22 @@ public class RpcWhiteList implements IsSerializable, Action, Result { GeneratedAnnotationsSettings _GeneratedAnnotationsSettings; GetLinearizationDefinitionsResult _GetLinearizationDefinitionsResult; + ProcessUploadedCustomScalesResult _ProcessUploadedCustomScalesResult; + ProcessUploadedPostCoordinationResult _ProcessUploadedPostCoordinationResult; + + SaveEntityPostCoordinationResult _SaveEntityPostCoordinationResult; LinearizationDefinition _LinearizationDefinition; GetEntityLinearizationResult _GetEntityLinearizationResult; + GetEntityCustomScalesResult _GetEntityCustomScalesResult; + WhoficEntityLinearizationSpecification _WhoficEntityLinearizationSpecification; + WhoficEntityPostCoordinationSpecification _WhoficEntityPostCoordinationSpecification; + + WhoficCustomScalesValues _WhoficCustomScalesValues; + SaveEntityLinearizationResult _SaveEntityLinearizationResult; GetRenderedOwlEntitiesResult _GetRenderedOwlEntitiesResult; @@ -992,6 +1002,7 @@ public class RpcWhiteList implements IsSerializable, Action, Result { AncestorClassHierarchy _AncestorClassHierarchy; GetPostCoordinationTableConfigurationResult _GetPostCoordinationTableConfigurationResult; + GetEntityPostCoordinationResult _GetEntityPostCoordinationResult; PostCoordinationTableConfiguration _PostCoordinationTableConfiguration; @@ -1001,6 +1012,23 @@ public class RpcWhiteList implements IsSerializable, Action, Result { GetProjectChangesForHistoryViewAction _GetProjectChangesForHistoryViewAction; GetProjectChangesForHistoryViewResult _GetProjectChangesForHistoryViewResult; + ProcessUploadedLinearizationAction _ProcessUploadedLinearizationAction; + ProcessUploadedLinearizationResult _ProcessUploadedLinearizationResult; + + + GetPostcoordinationAxisToGenericScaleAction _GetPostcoordinationAxisToGenericScaleAction; + GetPostcoordinationAxisToGenericScaleResult _GetPostcoordinationAxisToGenericScaleResult; + + PostcoordinationAxisToGenericScale _PostcoordinationAxisToGenericScale; + + PostcoordinationScaleValue _PostcoordinationScaleValue; + + SaveEntityCustomScaleAction _SaveEntityCustomScaleAction; + SaveEntityCustomScaleResult _SaveEntityCustomScaleResult; + + PostCoordinationCustomScales _PostCoordinationCustomScales; + + public RpcWhiteList() { } } diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetEntityCustomScalesAction.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetEntityCustomScalesAction.java new file mode 100644 index 000000000..524a9df84 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetEntityCustomScalesAction.java @@ -0,0 +1,24 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.Action; +import edu.stanford.bmir.protege.web.shared.project.ProjectId; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName("webprotege.postcoordination.GetEntityScaleValues") +public abstract class GetEntityCustomScalesAction implements Action { + @JsonProperty("entityIRI") + public abstract String getEntityIri(); + + @JsonProperty("projectId") + public abstract ProjectId getProjectId(); + + public static GetEntityCustomScalesAction create(String entityIri, ProjectId projectId) { + return new AutoValue_GetEntityCustomScalesAction(entityIri, projectId); + } +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetEntityCustomScalesResult.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetEntityCustomScalesResult.java new file mode 100644 index 000000000..18ca1cb14 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetEntityCustomScalesResult.java @@ -0,0 +1,21 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + + +import com.fasterxml.jackson.annotation.*; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.Result; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName("webprotege.postcoordination.GetEntityScaleValues") +public abstract class GetEntityCustomScalesResult implements Result { + + @JsonProperty("whoficCustomScaleValues") + public abstract WhoficCustomScalesValues getWhoficCustomScaleValues(); + + @JsonCreator + public static GetEntityCustomScalesResult create(@JsonProperty("whoficCustomScaleValues") WhoficCustomScalesValues whoficCustomScaleValues) { + return new AutoValue_GetEntityCustomScalesResult(whoficCustomScaleValues); + } +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetEntityPostCoordinationAction.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetEntityPostCoordinationAction.java new file mode 100644 index 000000000..4ddd1df54 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetEntityPostCoordinationAction.java @@ -0,0 +1,25 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.Action; +import edu.stanford.bmir.protege.web.shared.project.ProjectId; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName("webprotege.postcoordination.GetEntityPostCoordinations") +public abstract class GetEntityPostCoordinationAction implements Action { + + @JsonProperty("entityIRI") + public abstract String getEntityIri(); + + @JsonProperty("projectId") + public abstract ProjectId getProjectId(); + + public static GetEntityPostCoordinationAction create(String entityIri, ProjectId projectId){ + return new AutoValue_GetEntityPostCoordinationAction(entityIri, projectId); + } +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetEntityPostCoordinationResult.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetEntityPostCoordinationResult.java new file mode 100644 index 000000000..563fd1faf --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetEntityPostCoordinationResult.java @@ -0,0 +1,29 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.Result; + +import java.util.List; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName("webprotege.postcoordination.GetEntityPostCoordinations") +public abstract class GetEntityPostCoordinationResult implements Result { + + @JsonProperty("entityIri") + public abstract String getEntityIri(); + + @JsonProperty("postCoordinationSpecification") + public abstract WhoficEntityPostCoordinationSpecification getPostCoordinationSpecification(); + + @JsonCreator + public static GetEntityPostCoordinationResult create(@JsonProperty("entityIri") String entityIri, + @JsonProperty("postCoordinationSpecification") WhoficEntityPostCoordinationSpecification postCoordinationSpecification) { + return new AutoValue_GetEntityPostCoordinationResult(entityIri, postCoordinationSpecification); + } +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetPostcoordinationAxisToGenericScaleAction.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetPostcoordinationAxisToGenericScaleAction.java new file mode 100644 index 000000000..c06df9b17 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetPostcoordinationAxisToGenericScaleAction.java @@ -0,0 +1,20 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.Action; + +import static edu.stanford.bmir.protege.web.shared.postcoordination.GetPostcoordinationAxisToGenericScaleAction.CHANNEL; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName(CHANNEL) +public class GetPostcoordinationAxisToGenericScaleAction implements Action { + + public static final String CHANNEL = "webprotege.postcoordination.GetPostcoordinationAxisToGenericScale"; + + public static GetPostcoordinationAxisToGenericScaleAction create() { + return new AutoValue_GetPostcoordinationAxisToGenericScaleAction(); + } +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetPostcoordinationAxisToGenericScaleResult.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetPostcoordinationAxisToGenericScaleResult.java new file mode 100644 index 000000000..9e11fcd4f --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/GetPostcoordinationAxisToGenericScaleResult.java @@ -0,0 +1,24 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.*; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.Result; + +import java.util.List; + +import static edu.stanford.bmir.protege.web.shared.postcoordination.GetPostcoordinationAxisToGenericScaleAction.CHANNEL; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName(CHANNEL) +public abstract class GetPostcoordinationAxisToGenericScaleResult implements Result { + + @JsonCreator + public static GetPostcoordinationAxisToGenericScaleResult create(@JsonProperty("postcoordinationAxisToGenericScales") List postcoordinationAxisToGenericScales) { + return new AutoValue_GetPostcoordinationAxisToGenericScaleResult(postcoordinationAxisToGenericScales); + } + + @JsonProperty("postcoordinationAxisToGenericScales") + public abstract List getPostcoordinationAxisToGenericScales(); +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/PostCoordinationCustomScales.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/PostCoordinationCustomScales.java new file mode 100644 index 000000000..5ddda6503 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/PostCoordinationCustomScales.java @@ -0,0 +1,24 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.*; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; + +import java.util.List; + +@AutoValue +@GwtCompatible(serializable = true) +public abstract class PostCoordinationCustomScales { + + @JsonCreator + public static PostCoordinationCustomScales create(@JsonProperty("postcoordinationScaleValues") List postcoordinationScaleValues, + @JsonProperty("postcoordinationAxis") String postcoordinationAxis) { + return new AutoValue_PostCoordinationCustomScales(postcoordinationScaleValues, postcoordinationAxis); + } + + @JsonProperty("postcoordinationScaleValues") + public abstract List getPostcoordinationScaleValues(); + + @JsonProperty("postcoordinationAxis") + public abstract String getPostcoordinationAxis(); +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/PostCoordinationSpecification.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/PostCoordinationSpecification.java new file mode 100644 index 000000000..1b05e1397 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/PostCoordinationSpecification.java @@ -0,0 +1,61 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.GwtCompatible; +import com.google.gwt.user.client.rpc.IsSerializable; +import edu.stanford.bmir.protege.web.shared.annotations.GwtSerializationConstructor; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + + +@GwtCompatible(serializable = true) +public class PostCoordinationSpecification implements Serializable, IsSerializable { + private String linearizationView; + + private List allowedAxes; + + private List defaultAxes; + + private List notAllowedAxes; + + private List requiredAxes; + + @JsonCreator + public PostCoordinationSpecification(@JsonProperty("linearizationView") String linearizationView, + @JsonProperty("allowedAxes") List allowedAxes, + @JsonProperty("defaultAxes") List defaultAxes, + @JsonProperty("notAllowedAxes") List notAllowedAxes, + @JsonProperty("requiredAxes") List requiredAxes) { + this.linearizationView = linearizationView; + this.allowedAxes = allowedAxes == null ? new ArrayList<>() : allowedAxes; + this.defaultAxes = defaultAxes == null ? new ArrayList<>() : defaultAxes; + this.notAllowedAxes = notAllowedAxes == null ? new ArrayList<>() : notAllowedAxes; + this.requiredAxes = requiredAxes == null ? new ArrayList<>() : requiredAxes; + } + @GwtSerializationConstructor + private PostCoordinationSpecification() { + } + + public String getLinearizationView() { + return linearizationView; + } + + public List getAllowedAxes() { + return allowedAxes; + } + + public List getDefaultAxes() { + return defaultAxes; + } + + public List getNotAllowedAxes() { + return notAllowedAxes; + } + + public List getRequiredAxes() { + return requiredAxes; + } +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/PostcoordinationAxisToGenericScale.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/PostcoordinationAxisToGenericScale.java new file mode 100644 index 000000000..1e447cb15 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/PostcoordinationAxisToGenericScale.java @@ -0,0 +1,27 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.*; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; + +@AutoValue +@GwtCompatible(serializable = true) +public abstract class PostcoordinationAxisToGenericScale { + + + @JsonCreator + public static PostcoordinationAxisToGenericScale create(@JsonProperty("postcoordinationAxis") String postcoordinationAxis, + @JsonProperty("genericPostcoordinationScaleTopClass") String genericPostcoordinationScaleTopClass, + @JsonProperty("allowMultiValue") String allowMultiValue) { + return new AutoValue_PostcoordinationAxisToGenericScale(postcoordinationAxis, genericPostcoordinationScaleTopClass, allowMultiValue); + } + + @JsonProperty("postcoordinationAxis") + public abstract String getPostcoordinationAxis(); + + @JsonProperty("genericPostcoordinationScaleTopClass") + public abstract String getGenericPostcoordinationScaleTopClass(); + + @JsonProperty("allowMultiValue") + public abstract String getAllowMultiValue(); +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/PostcoordinationScaleValue.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/PostcoordinationScaleValue.java new file mode 100644 index 000000000..8ee507c45 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/PostcoordinationScaleValue.java @@ -0,0 +1,50 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import java.util.*; + +public class PostcoordinationScaleValue { + + private final String axisIri; + private final String axisLabel; + private final List scaleValueIriAndNames; + private final PostcoordinationAxisToGenericScale genericScale; + + public PostcoordinationScaleValue(String axisIri, + String axisLabel, + List scaleValueIriAndNames, + PostcoordinationAxisToGenericScale genericScale) { + this.axisIri = axisIri; + this.axisLabel = axisLabel; + this.scaleValueIriAndNames = scaleValueIriAndNames; + this.genericScale = genericScale; + } + + public static PostcoordinationScaleValue createEmpty(String axisIri, + String axisLabel, + PostcoordinationAxisToGenericScale genericScale) { + return create(axisIri, axisLabel, new ArrayList<>(), genericScale); + } + + public static PostcoordinationScaleValue create(String axisIri, + String axisLabel, + List valueIris, + PostcoordinationAxisToGenericScale genericScale) { + return new PostcoordinationScaleValue(axisIri, axisLabel, valueIris, genericScale); + } + + public String getAxisIri() { + return axisIri; + } + + public String getAxisLabel() { + return axisLabel; + } + + public List getValueIris() { + return scaleValueIriAndNames; + } + + public PostcoordinationAxisToGenericScale getGenericScale() { + return genericScale; + } +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ProcessUploadedCustomScalesAction.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ProcessUploadedCustomScalesAction.java new file mode 100644 index 000000000..27ad7a6ae --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ProcessUploadedCustomScalesAction.java @@ -0,0 +1,34 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.csv.DocumentId; +import edu.stanford.bmir.protege.web.shared.dispatch.AbstractHasProjectAction; +import edu.stanford.bmir.protege.web.shared.project.ProjectId; + +import javax.annotation.Nonnull; + +import static edu.stanford.bmir.protege.web.shared.postcoordination.ProcessUploadedCustomScalesAction.CHANNEL; + + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName(CHANNEL) +public abstract class ProcessUploadedCustomScalesAction extends AbstractHasProjectAction { + + public static final String CHANNEL = "webprotege.postcoordination.ProcessFirstPostCoordinationScaleValues"; + + @JsonCreator + public static ProcessUploadedCustomScalesAction create(@JsonProperty("projectId") ProjectId projectId, + @JsonProperty("documentId") DocumentId uploadedDocumentId) { + return new AutoValue_ProcessUploadedCustomScalesAction(projectId, uploadedDocumentId); + } + + @Nonnull + public abstract ProjectId getProjectId(); + + public abstract DocumentId getDocumentId(); +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ProcessUploadedCustomScalesResult.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ProcessUploadedCustomScalesResult.java new file mode 100644 index 000000000..4e28c1a6d --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ProcessUploadedCustomScalesResult.java @@ -0,0 +1,22 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.Result; + +import static edu.stanford.bmir.protege.web.shared.postcoordination.ProcessUploadedCustomScalesAction.CHANNEL; + + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName(CHANNEL) +public abstract class ProcessUploadedCustomScalesResult implements Result { + + + @JsonCreator + public static ProcessUploadedCustomScalesResult create() { + return new AutoValue_ProcessUploadedCustomScalesResult(); + } +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ProcessUploadedPostCoordinationAction.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ProcessUploadedPostCoordinationAction.java new file mode 100644 index 000000000..4664add27 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ProcessUploadedPostCoordinationAction.java @@ -0,0 +1,33 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.*; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.csv.DocumentId; +import edu.stanford.bmir.protege.web.shared.dispatch.AbstractHasProjectAction; +import edu.stanford.bmir.protege.web.shared.project.ProjectId; + +import javax.annotation.Nonnull; + +import static edu.stanford.bmir.protege.web.shared.postcoordination.ProcessUploadedPostCoordinationAction.CHANNEL; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName(CHANNEL) +public abstract class ProcessUploadedPostCoordinationAction extends AbstractHasProjectAction { + + public final static String CHANNEL = "webprotege.postcoordination.ProcessUploadedPostCoordination"; + + @JsonCreator + public static ProcessUploadedPostCoordinationAction create(@JsonProperty("projectId") ProjectId projectId, + @JsonProperty("documentId") DocumentId uploadedDocumentId) { + return new AutoValue_ProcessUploadedPostCoordinationAction(projectId, uploadedDocumentId); + } + + @Nonnull + @Override + public abstract ProjectId getProjectId(); + + public abstract DocumentId getDocumentId(); + +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ProcessUploadedPostCoordinationResult.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ProcessUploadedPostCoordinationResult.java new file mode 100644 index 000000000..c589b5a48 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ProcessUploadedPostCoordinationResult.java @@ -0,0 +1,22 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.Result; + +import static edu.stanford.bmir.protege.web.shared.postcoordination.ProcessUploadedPostCoordinationAction.CHANNEL; + + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName(CHANNEL) +public abstract class ProcessUploadedPostCoordinationResult implements Result { + + + @JsonCreator + public static ProcessUploadedPostCoordinationResult create() { + return new AutoValue_ProcessUploadedPostCoordinationResult(); + } +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/SaveEntityCustomScaleAction.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/SaveEntityCustomScaleAction.java new file mode 100644 index 000000000..a7687862c --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/SaveEntityCustomScaleAction.java @@ -0,0 +1,33 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.*; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.AbstractHasProjectAction; +import edu.stanford.bmir.protege.web.shared.project.ProjectId; + +import javax.annotation.Nonnull; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName(SaveEntityCustomScaleAction.CHANNEL) +public abstract class SaveEntityCustomScaleAction extends AbstractHasProjectAction { + public final static String CHANNEL = "webprotege.postcoordination.AddEntityCustomScalesRevision"; + + + @JsonCreator + public static SaveEntityCustomScaleAction create(@JsonProperty("projectId") + ProjectId projectId, + @JsonProperty("entityCustomScaleValues") + WhoficCustomScalesValues entityCustomScaleValues) { + return new AutoValue_SaveEntityCustomScaleAction(projectId, entityCustomScaleValues); + } + + + @Nonnull + @JsonProperty("projectId") + public abstract ProjectId getProjectId(); + + @JsonProperty("entityCustomScaleValues") + public abstract WhoficCustomScalesValues getEntityCustomScaleValues(); +} \ No newline at end of file diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/SaveEntityCustomScaleResult.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/SaveEntityCustomScaleResult.java new file mode 100644 index 000000000..c5ebae26e --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/SaveEntityCustomScaleResult.java @@ -0,0 +1,19 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.*; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.Result; + +import static edu.stanford.bmir.protege.web.shared.postcoordination.SaveEntityCustomScaleAction.CHANNEL; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName(CHANNEL) +public abstract class SaveEntityCustomScaleResult implements Result { + + @JsonCreator + public static SaveEntityCustomScaleResult create(){ + return new AutoValue_SaveEntityCustomScaleResult(); + } +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/SaveEntityPostCoordinationAction.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/SaveEntityPostCoordinationAction.java new file mode 100644 index 000000000..736d433ac --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/SaveEntityPostCoordinationAction.java @@ -0,0 +1,34 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.AbstractHasProjectAction; +import edu.stanford.bmir.protege.web.shared.project.ProjectId; + +import static edu.stanford.bmir.protege.web.shared.postcoordination.SaveEntityPostCoordinationAction.CHANNEL; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName(CHANNEL) +public abstract class SaveEntityPostCoordinationAction extends AbstractHasProjectAction { + + public final static String CHANNEL = "webprotege.postcoordination.AddEntitySpecificationRevision"; + + @JsonCreator + public static SaveEntityPostCoordinationAction create(@JsonProperty("projectId") + ProjectId projectId, + @JsonProperty("entitySpecification") + WhoficEntityPostCoordinationSpecification entitySpecification) { + return new AutoValue_SaveEntityPostCoordinationAction(projectId, entitySpecification); + } + + + @JsonProperty("projectId") + public abstract ProjectId getProjectId(); + + @JsonProperty("entitySpecification") + public abstract WhoficEntityPostCoordinationSpecification getEntitySpecification(); +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/SaveEntityPostCoordinationResult.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/SaveEntityPostCoordinationResult.java new file mode 100644 index 000000000..a01e3fc0b --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/SaveEntityPostCoordinationResult.java @@ -0,0 +1,14 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.Result; + +import static edu.stanford.bmir.protege.web.shared.postcoordination.SaveEntityPostCoordinationAction.CHANNEL; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName(CHANNEL) +public class SaveEntityPostCoordinationResult implements Result { +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ScaleValueIriAndName.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ScaleValueIriAndName.java new file mode 100644 index 000000000..549fd3d63 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/ScaleValueIriAndName.java @@ -0,0 +1,32 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.*; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; + +import javax.annotation.Nonnull; + +@AutoValue +@GwtCompatible(serializable = true) +public abstract class ScaleValueIriAndName { + + @JsonCreator + public static ScaleValueIriAndName create(@JsonProperty("scaleValueIri") + String scaleValueIri, + @JsonProperty("scaleValueName") + String scaleValueName) { + return new AutoValue_ScaleValueIriAndName(scaleValueIri, scaleValueName); + } + + public static ScaleValueIriAndName create(String scaleValueIri) { + return ScaleValueIriAndName.create(scaleValueIri, ""); + } + + + @Nonnull + @JsonProperty("scaleValueIri") + public abstract String getScaleValueIri(); + + @JsonProperty("scaleValueName") + public abstract String getScaleValueName(); +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/WhoficCustomScalesValues.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/WhoficCustomScalesValues.java new file mode 100644 index 000000000..e9494637d --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/WhoficCustomScalesValues.java @@ -0,0 +1,26 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.*; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import com.google.gwt.user.client.rpc.IsSerializable; + +import java.io.Serializable; +import java.util.List; + +@AutoValue +@GwtCompatible(serializable = true) +public abstract class WhoficCustomScalesValues implements IsSerializable, Serializable { + + @JsonCreator + public static WhoficCustomScalesValues create(@JsonProperty("whoficEntityIri") String whoficEntityIri, + @JsonProperty("scaleCustomizations") List scaleCustomizations) { + return new AutoValue_WhoficCustomScalesValues(whoficEntityIri, scaleCustomizations); + } + + @JsonProperty("whoficEntityIri") + public abstract String getWhoficEntityIri(); + + @JsonProperty("scaleCustomizations") + public abstract List getScaleCustomizations(); +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/WhoficEntityPostCoordinationSpecification.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/WhoficEntityPostCoordinationSpecification.java new file mode 100644 index 000000000..4264270e8 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/postcoordination/WhoficEntityPostCoordinationSpecification.java @@ -0,0 +1,46 @@ +package edu.stanford.bmir.protege.web.shared.postcoordination; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.annotations.GwtCompatible; +import com.google.gwt.user.client.rpc.IsSerializable; +import edu.stanford.bmir.protege.web.shared.annotations.GwtSerializationConstructor; + +import java.io.Serializable; +import java.util.List; + +@GwtCompatible(serializable = true) +public class WhoficEntityPostCoordinationSpecification implements IsSerializable, Serializable { + private String whoficEntityIri; + private String entityType; + private List postcoordinationSpecifications; + + @JsonCreator + public WhoficEntityPostCoordinationSpecification(@JsonProperty("whoficEntityIri") String whoficEntityIri, + @JsonProperty("entityType") String entityType, + @JsonProperty("postcoordinationSpecifications") List postcoordinationSpecifications) { + this.whoficEntityIri = whoficEntityIri; + this.entityType = entityType; + this.postcoordinationSpecifications = postcoordinationSpecifications; + } + + @GwtSerializationConstructor + private WhoficEntityPostCoordinationSpecification() { + } + + @JsonProperty("whoficEntityIri") + public String getWhoficEntityIri() { + return whoficEntityIri; + } + + @JsonProperty("postcoordinationSpecifications") + public List getPostCoordinationSpecifications() { + return postcoordinationSpecifications; + } + + @JsonProperty("entityType") + public String getEntityType() { + return entityType; + } + +}