Skip to content

Commit

Permalink
partial fix on forms
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsilaghi committed Jun 24, 2024
1 parent 9097c77 commit d9c4bae
Show file tree
Hide file tree
Showing 45 changed files with 211 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface EntityFormStackViewImplUiBinder extends UiBinder<HTMLPanel, EntityForm
private EnterEditModeHandler enterEditModeHandler = () -> {};

@Nonnull
private ApplyEditsHandler applyEditsHandler = () -> {};
private ApplyEditsHandler applyEditsHandler = () -> {throw new RuntimeException("Error applying edits"); };

@Nonnull
private CancelEditsHandler cancelEditsHandler = () -> {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import edu.stanford.bmir.protege.web.client.progress.BusyViewImpl;
import edu.stanford.bmir.protege.web.client.user.LoggedInUserProvider;
import edu.stanford.bmir.protege.web.client.uuid.UuidV4;
import edu.stanford.bmir.protege.web.client.uuid.UuidV4Provider;
import edu.stanford.bmir.protege.web.shared.HasDispose;
import edu.stanford.bmir.protege.web.shared.perspective.*;
import edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace;
Expand Down Expand Up @@ -70,6 +71,8 @@ public class PerspectivePresenter implements HasDispose {

private HandlerRegistration placeChangedHandlerRegistration;

private UuidV4Provider uuidV4Provider;


@Inject
public PerspectivePresenter(final PerspectiveView perspectiveView,
Expand All @@ -80,6 +83,7 @@ public PerspectivePresenter(final PerspectiveView perspectiveView,
PerspectiveFactory perspectiveFactory,
EmptyPerspectivePresenterFactory emptyPerspectivePresenterFactory,
PortletChooserPresenter portletChooserPresenter,
UuidV4Provider uuidV4Provider,
MessageBox messageBox, LanguageMapCurrentLocaleMapper localeMapper) {
this.perspectiveView = perspectiveView;
this.loggedInUserProvider = loggedInUserProvider;
Expand All @@ -91,6 +95,7 @@ public PerspectivePresenter(final PerspectiveView perspectiveView,
this.portletChooserPresenter = portletChooserPresenter;
this.messageBox = messageBox;
this.localeMapper = localeMapper;
this.uuidV4Provider = uuidV4Provider;
}

public void start(AcceptsOneWidget container, EventBus eventBus, ProjectViewPlace place) {
Expand All @@ -117,7 +122,7 @@ private void handleResetPerspective(ResetPerspectiveEvent event) {

private void executeResetPerspective(PerspectiveId perspectiveId) {
logger.fine("[PerspectivePresenter] Reset Perspective: " + perspectiveId);
dispatchServiceManager.execute(resetPerspective(projectId, perspectiveId),
dispatchServiceManager.execute(resetPerspective(ChangeRequestId.get(uuidV4Provider.get()), projectId, perspectiveId),
result -> {
removePerspective(perspectiveId);
installPerspective(result.getResetLayout());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,22 @@ else if(node.isObject()) {
}
switch (type) {
case "owl:Class" :
case "Class" :
return PrimitiveFormControlData.get(df.getOWLClass(iri));
case "owl:ObjectProperty":
case "ObjectProperty":
return PrimitiveFormControlData.get(df.getOWLObjectProperty(iri));
case "owl:DatatypeProperty" :
case "DatatypeProperty" :
return PrimitiveFormControlData.get(df.getOWLDataProperty(iri));
case "owl:AnnotationProperty":
case "AnnotationProperty":
return PrimitiveFormControlData.get(df.getOWLAnnotationProperty(iri));
case "rdfs:Datatype" :
case "Datatype" :
return PrimitiveFormControlData.get(df.getOWLDatatype(iri));
case "owl:NamedIndividual" :
case "NamedIndividual" :
return PrimitiveFormControlData.get(df.getOWLNamedIndividual(iri));
}
throw new JsonParseException(p, "Unrecognised entity type: " + type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ResetPerspectiveLayout_Serialization_TestCase {

@Test
public void shouldSerializeAction() throws IOException {
var action = ResetPerspectiveLayoutAction.create(mockProjectId(),
var action = ResetPerspectiveLayoutAction.create(ChangeRequestId.get("12345678-1234-1234-1234-123456789abc"), mockProjectId(),
PerspectiveId.generate());
JsonSerializationTestUtil.testSerialization(action, Action.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,9 @@ public class RpcWhiteList implements IsSerializable, Action, Result {

SetEntityWatchesResult _SetEntityWatchesResult;

FilterState _FilterState;


SetManchesterSyntaxFrameAction _SetManchesterSyntaxFrameAction;

SetManchesterSyntaxFrameResult _SetManchesterSyntaxFrameResult;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package edu.stanford.bmir.protege.web.shared.form;

import com.google.gwt.user.client.rpc.IsSerializable;

import java.io.Serializable;

/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 2020-06-25
*/
public enum FilterState {
public enum FilterState implements IsSerializable, Serializable {

UNFILTERED,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;
import com.google.common.annotations.GwtCompatible;
import com.google.gwt.user.client.rpc.IsSerializable;
import org.semanticweb.owlapi.model.EntityType;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLClass;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.Serializable;
import java.util.Optional;

/**
Expand All @@ -20,7 +22,11 @@
*/
@AutoValue
@GwtCompatible(serializable = true)
public abstract class FormSubjectFactoryDescriptor {
public abstract class FormSubjectFactoryDescriptor implements IsSerializable, Serializable {

public FormSubjectFactoryDescriptor(){

}

@JsonCreator
public static FormSubjectFactoryDescriptor get(@Nonnull @JsonProperty("entityType") EntityType entityType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public abstract class EntityNameControlData implements FormControlData {

@JsonCreator
public static EntityNameControlData get(@JsonProperty("descriptor") @Nonnull EntityNameControlDescriptor descriptor,
@Nullable OWLEntity entity) {
@JsonProperty("entity") @Nullable OWLEntity entity) {
return new AutoValue_EntityNameControlData(descriptor, entity);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
@JsonTypeName("EntityNameControlDataDto")
public abstract class EntityNameControlDataDto implements FormControlDataDto {

public EntityNameControlDataDto(){

}

@JsonCreator
public static EntityNameControlDataDto get(@JsonProperty("descriptor") @Nonnull EntityNameControlDescriptor descriptor,
@JsonProperty("entity") @Nonnull OWLEntityData entityData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import edu.stanford.bmir.protege.web.shared.form.field.*;

import javax.annotation.Nonnull;
import java.io.Serializable;

@JsonSubTypes({
@Type(EntityNameControlDataDto.class),
Expand All @@ -20,7 +21,7 @@
@Type(FormDataDto.class)
})
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
public interface FormControlDataDto extends IsSerializable {
public interface FormControlDataDto extends IsSerializable, Serializable {

<R> R accept(FormControlDataDtoVisitorEx<R> visitor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
import com.google.auto.value.AutoValue;
import com.google.common.annotations.GwtCompatible;
import com.google.gwt.user.client.rpc.IsSerializable;
import edu.stanford.bmir.protege.web.shared.form.field.FormFieldDescriptorDto;
import edu.stanford.bmir.protege.web.shared.pagination.Page;

import javax.annotation.Nonnull;
import java.io.Serializable;

@AutoValue
@GwtCompatible(serializable = true)
public abstract class FormFieldDataDto {
public abstract class FormFieldDataDto implements IsSerializable, Serializable {

@JsonCreator
@Nonnull
Expand All @@ -20,6 +22,11 @@ public static FormFieldDataDto get(@JsonProperty("formFieldDescriptor") @Nonnull
return new AutoValue_FormFieldDataDto(descriptor, formControlData);
}


public FormFieldDataDto(){

}

@Nonnull
public abstract FormFieldDescriptorDto getFormFieldDescriptor();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;
import com.google.common.annotations.GwtCompatible;
import com.google.gwt.user.client.rpc.IsSerializable;
import edu.stanford.bmir.protege.web.shared.form.FilterState;
import edu.stanford.bmir.protege.web.shared.form.HasFilterState;
import edu.stanford.bmir.protege.web.shared.form.PropertyNames;
Expand All @@ -13,10 +14,11 @@

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.Serializable;

@AutoValue
@GwtCompatible(serializable = true)
public abstract class GridCellDataDto implements HasFilterState {
public abstract class GridCellDataDto implements HasFilterState, IsSerializable, Serializable {

@JsonCreator
public static GridCellDataDto get(@JsonProperty(PropertyNames.COLUMN_ID) @Nonnull GridColumnId columnId,
Expand All @@ -25,6 +27,10 @@ public static GridCellDataDto get(@JsonProperty(PropertyNames.COLUMN_ID) @Nonnul
return new AutoValue_GridCellDataDto(columnId, values, filterState);
}

public GridCellDataDto(){

}

@Nonnull
@JsonProperty(PropertyNames.COLUMN_ID)
public abstract GridColumnId getColumnId();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package edu.stanford.bmir.protege.web.shared.form.data;

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 com.google.common.collect.ImmutableSet;
import edu.stanford.bmir.protege.web.shared.form.PropertyNames;
import edu.stanford.bmir.protege.web.shared.form.field.FormRegionOrdering;
import edu.stanford.bmir.protege.web.shared.form.field.GridControlDescriptor;
import edu.stanford.bmir.protege.web.shared.pagination.Page;
Expand All @@ -20,10 +23,11 @@
@JsonTypeName("GridControlData")
public abstract class GridControlData implements ComplexFormControlValue {

@JsonCreator
@Nonnull
public static GridControlData get(@Nonnull GridControlDescriptor descriptor,
@Nonnull Page<GridRowData> rows,
@Nonnull ImmutableSet<FormRegionOrdering> ordering) {
public static GridControlData get(@JsonProperty(PropertyNames.DESCRIPTOR) @Nonnull GridControlDescriptor descriptor,
@JsonProperty(PropertyNames.ROWS) @Nonnull Page<GridRowData> rows,
@JsonProperty(PropertyNames.ORDERING) @Nonnull ImmutableSet<FormRegionOrdering> ordering) {
return new AutoValue_GridControlData(descriptor, rows, ordering);
}

Expand All @@ -37,12 +41,15 @@ public void accept(@Nonnull FormControlDataVisitor visitor) {
visitor.visit(this);
}

@JsonProperty(PropertyNames.DESCRIPTOR)
@Nonnull
public abstract GridControlDescriptor getDescriptor();

@JsonProperty(PropertyNames.ROWS)
@Nonnull
public abstract Page<GridRowData> getRows();

@JsonProperty(PropertyNames.ORDERING)
@Nonnull
public abstract ImmutableSet<FormRegionOrdering> getOrdering();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
@JsonTypeName("GridControlDataDto")
public abstract class GridControlDataDto implements FormControlDataDto, HasFilterState {

public GridControlDataDto(){

}

@JsonCreator
@Nonnull
public static GridControlDataDto get(@JsonProperty("descriptor") @Nonnull GridControlDescriptor descriptor,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package edu.stanford.bmir.protege.web.shared.form.data;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;
import com.google.common.annotations.GwtCompatible;
import com.google.common.collect.ImmutableList;
import edu.stanford.bmir.protege.web.shared.form.PropertyNames;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
Expand All @@ -17,13 +20,16 @@
@GwtCompatible(serializable = true)
public abstract class GridRowData implements Comparable<GridRowData> {

public static GridRowData get(@Nullable FormEntitySubject subject,
@Nonnull ImmutableList<GridCellData> cellData) {

@JsonCreator
public static GridRowData get(@JsonProperty(PropertyNames.SUBJECT) @Nullable FormEntitySubject subject,
@JsonProperty(PropertyNames.CELLS) @Nonnull ImmutableList<GridCellData> cellData) {
return new AutoValue_GridRowData(subject, cellData);
}


@Nullable
@JsonProperty(PropertyNames.SUBJECT)
protected abstract FormEntitySubject getSubjectInternal();

@Nonnull
Expand All @@ -32,6 +38,7 @@ public Optional<FormEntitySubject> getSubject() {
}

@Nonnull
@JsonProperty(PropertyNames.CELLS)
public abstract ImmutableList<GridCellData> getCells();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
@JsonTypeName("ImageControlDataDto")
public abstract class ImageControlDataDto implements FormControlDataDto {

public ImageControlDataDto(){

}
@JsonCreator
@Nonnull
public static ImageControlDataDto get(@JsonProperty("descriptor") @Nonnull ImageControlDescriptor descriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
public abstract class NumberControlData implements FormControlData {

@JsonCreator
public static NumberControlData get(@Nonnull NumberControlDescriptor descriptor,
@Nullable OWLLiteral value) {
public static NumberControlData get(@Nonnull @JsonProperty("descriptor") NumberControlDescriptor descriptor, @JsonProperty("value") @Nullable OWLLiteral value) {
return new AutoValue_NumberControlData(descriptor, value);
}

Expand All @@ -40,6 +39,7 @@ public void accept(@Nonnull FormControlDataVisitor visitor) {
}

@Nonnull
@JsonProperty("descriptor")
public abstract NumberControlDescriptor getDescriptor();

@JsonProperty("value")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
@JsonTypeName("EntityNameControlDescriptorDto")
public abstract class EntityNameControlDescriptorDto implements FormControlDescriptorDto {

public EntityNameControlDescriptorDto(){

}

@JsonCreator
@Nonnull
public static EntityNameControlDescriptorDto get(@JsonProperty("placeholder") @Nonnull LanguageMap placeholder,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package edu.stanford.bmir.protege.web.shared.form.field;

import com.google.gwt.user.client.rpc.IsSerializable;

import java.io.Serializable;

/**
* Matthew Horridge
* Stanford Center for Biomedical Informatics Research
* 2019-11-07
*/
public enum FieldRun {
public enum FieldRun implements IsSerializable, Serializable {

START,

Expand Down
Loading

0 comments on commit d9c4bae

Please sign in to comment.