You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2022/05/09 11:25:01 UTC
[isis] branch master updated: ISIS-3040: adds java-doc; also cleaning up code further
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 34bbde4bbd ISIS-3040: adds java-doc; also cleaning up code further
34bbde4bbd is described below
commit 34bbde4bbd6fabc3e8cf37aa4032cd3006646267
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon May 9 13:24:55 2022 +0200
ISIS-3040: adds java-doc; also cleaning up code further
---
.../repainting/PdfJsViewerAdvisorFallback.java | 2 +-
.../pdfjs/applib/annotations/PdfJsViewer.java | 6 +++
.../viewer/wicket/pdfjs/applib/config/Scale.java | 22 +++++----
.../pdfjs/applib/spi/PdfJsViewerAdvisor.java | 55 +++++++---------------
4 files changed, 38 insertions(+), 47 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/repainting/PdfJsViewerAdvisorFallback.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/repainting/PdfJsViewerAdvisorFallback.java
index 451742ff3c..b78f960596 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/repainting/PdfJsViewerAdvisorFallback.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/repainting/PdfJsViewerAdvisorFallback.java
@@ -28,7 +28,7 @@ public class PdfJsViewerAdvisorFallback implements PdfJsViewerAdvisor {
@Override
public Advice advise(final InstanceKey instanceKey) {
- return new Advice(1, new Advice.TypeAdvice(Scale._1_00, 400));
+ return new Advice(1, Scale._1_00, 400);
}
@Override
diff --git a/extensions/vw/pdfjs/applib/src/main/java/org/apache/isis/extensions/viewer/wicket/pdfjs/applib/annotations/PdfJsViewer.java b/extensions/vw/pdfjs/applib/src/main/java/org/apache/isis/extensions/viewer/wicket/pdfjs/applib/annotations/PdfJsViewer.java
index 7c82db2922..549e63216a 100644
--- a/extensions/vw/pdfjs/applib/src/main/java/org/apache/isis/extensions/viewer/wicket/pdfjs/applib/annotations/PdfJsViewer.java
+++ b/extensions/vw/pdfjs/applib/src/main/java/org/apache/isis/extensions/viewer/wicket/pdfjs/applib/annotations/PdfJsViewer.java
@@ -37,8 +37,14 @@ import org.apache.isis.extensions.viewer.wicket.pdfjs.applib.config.Scale;
@Target(value = {ElementType.METHOD, ElementType.FIELD})
public @interface PdfJsViewer {
+ /** The page (number) to render the first time,
+ * this particular domain object('s property) is rendered.*/
int initialPageNum() default 1;
+
+ /** The scale to render; defaults to 100%.*/
Scale initialScale() default Scale._1_00;
+
+ /** The (pixel) height of the panel; defaults to 800px.*/
int initialHeight() default 800;
}
diff --git a/extensions/vw/pdfjs/applib/src/main/java/org/apache/isis/extensions/viewer/wicket/pdfjs/applib/config/Scale.java b/extensions/vw/pdfjs/applib/src/main/java/org/apache/isis/extensions/viewer/wicket/pdfjs/applib/config/Scale.java
index 7c57e2b9be..459a61f76d 100644
--- a/extensions/vw/pdfjs/applib/src/main/java/org/apache/isis/extensions/viewer/wicket/pdfjs/applib/config/Scale.java
+++ b/extensions/vw/pdfjs/applib/src/main/java/org/apache/isis/extensions/viewer/wicket/pdfjs/applib/config/Scale.java
@@ -20,33 +20,39 @@ package org.apache.isis.extensions.viewer.wicket.pdfjs.applib.config;
import org.apache.wicket.util.lang.Objects;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
/**
* @since 2.0 {@index}
*/
+@RequiredArgsConstructor
public enum Scale {
+ /** predefined scaling strategies, depend on the width/height of the panel available to render in */
AUTOMATIC("auto"),
ACTUAL_SIZE("page-actual"),
PAGE_FIT("page-fit"),
PAGE_WIDTH("page-width"),
+ /** 50% */
_0_50("0.50"),
+ /** 75% */
_0_75("0.75"),
+ /** 100% */
_1_00("1.00"),
+ /** 125% */
_1_25("1.25"),
+ /** 150% */
_1_50("1.50"),
+ /** 200% */
_2_00("2.00"),
+ /** 300% */
_3_00("3.00"),
+ /** 400% */
_4_00("4.00"),;
+ @Getter
private final String value;
- Scale(final String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
public static Scale forValue(final String scaleValue) {
if (scaleValue == null) {
return null;
diff --git a/extensions/vw/pdfjs/applib/src/main/java/org/apache/isis/extensions/viewer/wicket/pdfjs/applib/spi/PdfJsViewerAdvisor.java b/extensions/vw/pdfjs/applib/src/main/java/org/apache/isis/extensions/viewer/wicket/pdfjs/applib/spi/PdfJsViewerAdvisor.java
index 4c5a91cf0a..c8ba0efc5d 100644
--- a/extensions/vw/pdfjs/applib/src/main/java/org/apache/isis/extensions/viewer/wicket/pdfjs/applib/spi/PdfJsViewerAdvisor.java
+++ b/extensions/vw/pdfjs/applib/src/main/java/org/apache/isis/extensions/viewer/wicket/pdfjs/applib/spi/PdfJsViewerAdvisor.java
@@ -36,17 +36,28 @@ import lombok.With;
*/
public interface PdfJsViewerAdvisor {
+ /** The main SPI called by the viewer. */
Advice advise(final InstanceKey instanceKey);
+
+ /** Updates the service implementation whenever the user updates the page number,
+ * for a particular object/property/user (ie ViewerKey). */
void pageNumChangedTo(final InstanceKey instanceKey, final int pageNum);
+
+ /** Updates the service implementation whenever the user updates the scale,
+ * for a particular object/property/user (ie ViewerKey). */
void scaleChangedTo(final InstanceKey instanceKey, final Scale scale);
+
+ /** Updates the service implementation whenever the user updates the height,
+ * for a particular object/property/user (ie ViewerKey). */
void heightChangedTo(final InstanceKey instanceKey, final int height);
/**
- * Key for the rendering of a specific property of an object for an named individual.
+ * Value type that identifies an object's type and identifier,
+ * its (PDF) property and the user that is viewing the object.
*
* <p>
- * This is a (serializable) value type so that, for example, implementations can use as a key within a hash structure.
- * </p>
+ * This is a (serializable) value type so that, for example,
+ * implementations can use as a key within a hash structure.
*/
@Programmatic
@Value @RequiredArgsConstructor
@@ -103,18 +114,11 @@ public interface PdfJsViewerAdvisor {
*/
private final String userName;
- /**
- * The object type of the object being rendered.
- */
- @Deprecated // don't duplicate this getter
- public String getType() {
- return logicalTypeName;
- }
}
}
/**
- * Immutable value type.
+ * Immutable value type, that specifies the page number, scale and height to render the object with.
* <p>
* The <code>withXxx</code> allow clones of the value to be created,
* for convenience of implementors.
@@ -126,33 +130,8 @@ public interface PdfJsViewerAdvisor {
private static final long serialVersionUID = 1L;
private final Integer pageNum;
- private final TypeAdvice typeAdvice;
-
- public Scale getScale() {
- return typeAdvice.getScale();
- }
-
- public Integer getHeight() {
- return typeAdvice.getHeight();
- }
-
- /**
- * Immutable value type representing the scale/height to render a PDF.
- * <p>
- * The <code>withXxx</code> allow clones of the value to be created,
- * for convenience of implementors.
- */
- @Programmatic
- @Value @With
- @Deprecated // why not just inline?
- public static class TypeAdvice implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private final Scale scale;
- private final Integer height;
-
- }
+ private final Scale scale;
+ private final Integer height;
}
}