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/04/26 06:47:20 UTC
[isis] branch master updated: ISIS-3024: consolidate component decorators into single package
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 9990a797bc ISIS-3024: consolidate component decorators into single package
9990a797bc is described below
commit 9990a797bc1b11238f1ce88a391f7532f75f210f
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Apr 26 08:47:13 2022 +0200
ISIS-3024: consolidate component decorators into single package
---
.../viewer/javafx/model/context/UiContextFx.java | 6 +-
.../viewer/javafx/model/icon/IconService.java | 4 +-
.../javafx/ui/components/UiComponentFactoryFx.java | 6 +-
.../javafx/ui/components/object/ObjectViewFx.java | 6 +-
.../disabling/DisablingDecoratorForButton.java | 5 +-
.../disabling/DisablingDecoratorForFormField.java | 5 +-
.../ui/decorator/icon/IconDecoratorForLabeled.java | 7 +-
.../decorator/icon/IconDecoratorForMenuItem.java | 7 +-
.../ui/decorator/icon/IconServiceDefault.java | 8 +--
.../prototyping/PrototypingDecoratorForButton.java | 7 +-
.../PrototypingDecoratorForFormField.java | 7 +-
.../prototyping/PrototypingInfoPopupProvider.java | 14 ++--
.../viewer/javafx/ui/main/UiContextFxDefault.java | 6 +-
.../viewer/vaadin/model/decorator/Decorators.java | 12 ++--
.../vaadin/ui/components/object/ObjectViewVaa.java | 6 +-
.../viewer/vaadin/ui/pages/main/MainViewVaa.java | 2 +-
.../viewers/common/wkt/InteractionTestWkt.java | 6 +-
.../common/model/action/HasManagedAction.java | 12 ++--
.../model/action/decorator/ActionUiDecorator.java | 10 +--
.../model/components/UiComponentFactory.java | 6 +-
.../model/decorator/confirm/ConfirmDecorator.java | 25 -------
.../model/decorator/confirm/ConfirmUiModel.java | 70 ------------------
.../decorator/disable/DisablingDecorator.java | 25 -------
.../model/decorator/icon/FontAwesomeUiModel.java | 59 ----------------
.../common/model/decorator/icon/IconDecorator.java | 37 ----------
.../prototyping/PrototypingDecorator.java | 32 ---------
.../decorator/prototyping/PrototypingUiModel.java | 69 ------------------
.../model/decorator/tooltip/TooltipDecorator.java | 25 -------
.../model/decorator/tooltip/TooltipUiModel.java | 62 ----------------
.../common/model/decorators/ConfirmDecorator.java | 77 ++++++++++++++++++++
.../danger => decorators}/DangerDecorator.java | 2 +-
.../DisablingDecorator.java} | 32 +++++----
.../common/model/decorators/IconDecorator.java | 73 +++++++++++++++++++
.../model/decorators/PrototypingDecorator.java | 82 ++++++++++++++++++++++
.../common/model/decorators/TooltipDecorator.java | 68 ++++++++++++++++++
.../components/actionmenu/CssClassFaBehavior.java | 12 ++--
.../components/actions/ActionParametersForm.java | 4 +-
.../wicket/ui/util/FontAwesomeCssReferenceWkt.java | 2 +-
.../isis/viewer/wicket/ui/util/WktDecorators.java | 54 +++++++-------
.../isis/viewer/wicket/ui/util/WktLinks.java | 6 +-
.../isis/viewer/wicket/ui/util/WktTooltips.java | 20 +++---
41 files changed, 434 insertions(+), 544 deletions(-)
diff --git a/incubator/viewers/javafx/model/src/main/java/org/apache/isis/incubator/viewer/javafx/model/context/UiContextFx.java b/incubator/viewers/javafx/model/src/main/java/org/apache/isis/incubator/viewer/javafx/model/context/UiContextFx.java
index 5d5f71bb11..563afd8baf 100644
--- a/incubator/viewers/javafx/model/src/main/java/org/apache/isis/incubator/viewer/javafx/model/context/UiContextFx.java
+++ b/incubator/viewers/javafx/model/src/main/java/org/apache/isis/incubator/viewer/javafx/model/context/UiContextFx.java
@@ -26,9 +26,9 @@ import org.apache.isis.applib.services.iactnlayer.InteractionService;
import org.apache.isis.core.metamodel.spec.ManagedObject;
import org.apache.isis.incubator.viewer.javafx.model.action.ActionUiModelFactoryFx;
import org.apache.isis.incubator.viewer.javafx.model.events.JavaFxViewerConfig;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingDecorator;
-import org.apache.isis.viewer.common.model.decorator.icon.IconDecorator;
-import org.apache.isis.viewer.common.model.decorator.prototyping.PrototypingDecorator;
+import org.apache.isis.viewer.common.model.decorators.DisablingDecorator;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator;
+import org.apache.isis.viewer.common.model.decorators.PrototypingDecorator;
import javafx.scene.Node;
import javafx.scene.control.Button;
diff --git a/incubator/viewers/javafx/model/src/main/java/org/apache/isis/incubator/viewer/javafx/model/icon/IconService.java b/incubator/viewers/javafx/model/src/main/java/org/apache/isis/incubator/viewer/javafx/model/icon/IconService.java
index 1729bfeeeb..b86cb7937e 100644
--- a/incubator/viewers/javafx/model/src/main/java/org/apache/isis/incubator/viewer/javafx/model/icon/IconService.java
+++ b/incubator/viewers/javafx/model/src/main/java/org/apache/isis/incubator/viewer/javafx/model/icon/IconService.java
@@ -20,12 +20,12 @@ package org.apache.isis.incubator.viewer.javafx.model.icon;
import java.util.Optional;
-import org.apache.isis.viewer.common.model.decorator.icon.FontAwesomeUiModel;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator.FontAwesomeDecorationModel;
import javafx.scene.image.Image;
public interface IconService {
- Optional<Image> fontAwesome(FontAwesomeUiModel fontAwesomeUiModel);
+ Optional<Image> fontAwesome(FontAwesomeDecorationModel fontAwesomeDecorationModel);
}
diff --git a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/components/UiComponentFactoryFx.java b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/components/UiComponentFactoryFx.java
index 50ad0a1ad7..4c16f742f0 100644
--- a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/components/UiComponentFactoryFx.java
+++ b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/components/UiComponentFactoryFx.java
@@ -32,7 +32,7 @@ import org.apache.isis.core.metamodel.interactions.managed.ManagedMember;
import org.apache.isis.core.metamodel.util.Facets;
import org.apache.isis.incubator.viewer.javafx.model.context.UiContextFx;
import org.apache.isis.viewer.common.model.components.UiComponentFactory;
-import org.apache.isis.viewer.common.model.decorator.prototyping.PrototypingUiModel;
+import org.apache.isis.viewer.common.model.decorators.PrototypingDecorator.PrototypingDecorationModel;
import lombok.Getter;
import lombok.val;
@@ -79,7 +79,7 @@ public class UiComponentFactoryFx implements UiComponentFactory<Node, Node> {
return isPrototyping
? uiContext.getPrototypingDecoratorForFormField()
- .decorate(formField, PrototypingUiModel.of(managedMember))
+ .decorate(formField, PrototypingDecorationModel.of(managedMember))
: formField;
}
@@ -100,7 +100,7 @@ public class UiComponentFactoryFx implements UiComponentFactory<Node, Node> {
return isPrototyping
? uiContext.getPrototypingDecoratorForButton()
- .decorate(uiButton, PrototypingUiModel.of(managedAction))
+ .decorate(uiButton, PrototypingDecorationModel.of(managedAction))
: uiButton;
}
diff --git a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/components/object/ObjectViewFx.java b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/components/object/ObjectViewFx.java
index cec9f7985d..e397cc91f2 100644
--- a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/components/object/ObjectViewFx.java
+++ b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/components/object/ObjectViewFx.java
@@ -45,7 +45,7 @@ import org.apache.isis.incubator.viewer.javafx.ui.components.collections.TableVi
import org.apache.isis.incubator.viewer.javafx.ui.components.form.FormPane;
import org.apache.isis.incubator.viewer.javafx.ui.components.panel.TitledPanel;
import org.apache.isis.viewer.common.model.components.UiComponentFactory;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingUiModel;
+import org.apache.isis.viewer.common.model.decorators.DisablingDecorator.DisablingDecorationModel;
import org.apache.isis.viewer.common.model.gridlayout.UiGridLayout;
import lombok.NonNull;
@@ -179,7 +179,7 @@ public class ObjectViewFx extends VBox {
val uiButton = uiComponentFactory.buttonFor(
UiComponentFactory.ButtonRequest.of(
managedAction,
- DisablingUiModel.of(interaction),
+ DisablingDecorationModel.of(interaction),
actionEventHandler));
if(container instanceof FormPane) {
@@ -211,7 +211,7 @@ public class ObjectViewFx extends VBox {
val request = UiComponentFactory.ComponentRequest.of(
propNeg,
managedProperty,
- DisablingUiModel.of(interaction));
+ DisablingDecorationModel.of(interaction));
val uiPropertyField = uiComponentFactory.componentFor(request);
val labelAndPostion = uiComponentFactory.labelFor(request);
diff --git a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/disabling/DisablingDecoratorForButton.java b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/disabling/DisablingDecoratorForButton.java
index fe36fd13d4..e58ebb4682 100644
--- a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/disabling/DisablingDecoratorForButton.java
+++ b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/disabling/DisablingDecoratorForButton.java
@@ -22,8 +22,7 @@ import javax.inject.Inject;
import org.springframework.stereotype.Component;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingDecorator;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingUiModel;
+import org.apache.isis.viewer.common.model.decorators.DisablingDecorator;
import lombok.RequiredArgsConstructor;
import lombok.val;
@@ -36,7 +35,7 @@ import javafx.scene.control.Tooltip;
public class DisablingDecoratorForButton implements DisablingDecorator<Button> {
@Override
- public void decorate(Button uiButton, DisablingUiModel disableUiModel) {
+ public void decorate(final Button uiButton, final DisablingDecorationModel disableUiModel) {
val reason = disableUiModel.getReason();
diff --git a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/disabling/DisablingDecoratorForFormField.java b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/disabling/DisablingDecoratorForFormField.java
index 347e914df9..c4ba661816 100644
--- a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/disabling/DisablingDecoratorForFormField.java
+++ b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/disabling/DisablingDecoratorForFormField.java
@@ -22,8 +22,7 @@ import javax.inject.Inject;
import org.springframework.stereotype.Component;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingDecorator;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingUiModel;
+import org.apache.isis.viewer.common.model.decorators.DisablingDecorator;
import lombok.RequiredArgsConstructor;
import lombok.val;
@@ -35,7 +34,7 @@ import javafx.scene.Node;
public class DisablingDecoratorForFormField implements DisablingDecorator<Node> {
@Override
- public void decorate(Node formField, DisablingUiModel disableUiModel) {
+ public void decorate(final Node formField, final DisablingDecorationModel disableUiModel) {
val reason = disableUiModel.getReason();
diff --git a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/icon/IconDecoratorForLabeled.java b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/icon/IconDecoratorForLabeled.java
index d0ac68230d..771d9aa1d5 100644
--- a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/icon/IconDecoratorForLabeled.java
+++ b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/icon/IconDecoratorForLabeled.java
@@ -26,8 +26,7 @@ import org.springframework.stereotype.Component;
import org.apache.isis.incubator.viewer.javafx.model.icon.IconService;
import org.apache.isis.incubator.viewer.javafx.model.util._fx;
-import org.apache.isis.viewer.common.model.decorator.icon.FontAwesomeUiModel;
-import org.apache.isis.viewer.common.model.decorator.icon.IconDecorator;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator;
import lombok.RequiredArgsConstructor;
import lombok.val;
@@ -43,8 +42,8 @@ public class IconDecoratorForLabeled implements IconDecorator<Labeled, Labeled>
private final IconService iconService;
@Override
- public Labeled decorate(Labeled uiComponent, Optional<FontAwesomeUiModel> fontAwesomeUiModel) {
- fontAwesomeUiModel.ifPresent(fa->{
+ public Labeled decorate(Labeled uiComponent, Optional<FontAwesomeDecorationModel> fontAwesomeDecorationModel) {
+ fontAwesomeDecorationModel.ifPresent(fa->{
val icon = iconService.fontAwesome(fa);
icon
.map(this::iconForImage)
diff --git a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/icon/IconDecoratorForMenuItem.java b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/icon/IconDecoratorForMenuItem.java
index bfdc30fdce..bbfe53a072 100644
--- a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/icon/IconDecoratorForMenuItem.java
+++ b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/icon/IconDecoratorForMenuItem.java
@@ -26,8 +26,7 @@ import org.springframework.stereotype.Component;
import org.apache.isis.incubator.viewer.javafx.model.icon.IconService;
import org.apache.isis.incubator.viewer.javafx.model.util._fx;
-import org.apache.isis.viewer.common.model.decorator.icon.FontAwesomeUiModel;
-import org.apache.isis.viewer.common.model.decorator.icon.IconDecorator;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator;
import lombok.RequiredArgsConstructor;
import lombok.val;
@@ -43,10 +42,10 @@ public class IconDecoratorForMenuItem implements IconDecorator<MenuItem, MenuIte
private final IconService iconService;
@Override
- public MenuItem decorate(MenuItem menuItem, Optional<FontAwesomeUiModel> fontAwesomeUiModel) {
+ public MenuItem decorate(MenuItem menuItem, Optional<FontAwesomeDecorationModel> fontAwesomeDecorationModel) {
// TODO honor icon position
- fontAwesomeUiModel.ifPresent(fa->{
+ fontAwesomeDecorationModel.ifPresent(fa->{
val icon = iconService.fontAwesome(fa);
icon
.map(this::iconForImage)
diff --git a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/icon/IconServiceDefault.java b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/icon/IconServiceDefault.java
index fff010bbb9..08a1336ca0 100644
--- a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/icon/IconServiceDefault.java
+++ b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/icon/IconServiceDefault.java
@@ -28,7 +28,7 @@ import org.springframework.stereotype.Service;
import org.apache.isis.commons.internal.collections._Maps;
import org.apache.isis.incubator.viewer.javafx.model.icon.IconService;
-import org.apache.isis.viewer.common.model.decorator.icon.FontAwesomeUiModel;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator.FontAwesomeDecorationModel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@@ -54,13 +54,13 @@ public class IconServiceDefault implements IconService {
// see also https://www.jensd.de/wordpress/?p=132
}
- public Optional<Image> fontAwesome(String faCssClassName) {
+ public Optional<Image> fontAwesome(final String faCssClassName) {
return Optional.ofNullable(faIconCache.get(faCssClassName));
}
@Override
- public Optional<Image> fontAwesome(FontAwesomeUiModel fontAwesomeUiModel) {
- return Optional.ofNullable(faIconCache.get(fontAwesomeUiModel.getCssClassesSpaceSeparated()));
+ public Optional<Image> fontAwesome(final FontAwesomeDecorationModel fontAwesomeDecorationModel) {
+ return Optional.ofNullable(faIconCache.get(fontAwesomeDecorationModel.getCssClassesSpaceSeparated()));
}
}
diff --git a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/prototyping/PrototypingDecoratorForButton.java b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/prototyping/PrototypingDecoratorForButton.java
index 77c12c1522..dc96ccacd1 100644
--- a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/prototyping/PrototypingDecoratorForButton.java
+++ b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/prototyping/PrototypingDecoratorForButton.java
@@ -23,8 +23,7 @@ import javax.inject.Inject;
import org.springframework.stereotype.Component;
import org.apache.isis.incubator.viewer.javafx.model.util._fx;
-import org.apache.isis.viewer.common.model.decorator.prototyping.PrototypingDecorator;
-import org.apache.isis.viewer.common.model.decorator.prototyping.PrototypingUiModel;
+import org.apache.isis.viewer.common.model.decorators.PrototypingDecorator;
import lombok.RequiredArgsConstructor;
import lombok.val;
@@ -42,13 +41,13 @@ public class PrototypingDecoratorForButton implements PrototypingDecorator<Butto
private final PrototypingInfoPopupProvider prototypingInfoService;
@Override
- public Node decorate(Button uiButton, PrototypingUiModel prototypingUiModel) {
+ public Node decorate(Button uiButton, PrototypingDecorationModel prototypingDecorationModel) {
val span = new HBox();
val prototypingLabel = _fx.add(span, new Label("ⓘ"));
_fx.add(span, uiButton);
prototypingLabel.setTooltip(new Tooltip("Inspect Metamodel"));
prototypingLabel.setOnMouseClicked(e->
- prototypingInfoService.showPrototypingPopup(prototypingUiModel));
+ prototypingInfoService.showPrototypingPopup(prototypingDecorationModel));
uiButton.getStyleClass().add("button-prototyping");
diff --git a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/prototyping/PrototypingDecoratorForFormField.java b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/prototyping/PrototypingDecoratorForFormField.java
index a2bb2e174b..b228a40516 100644
--- a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/prototyping/PrototypingDecoratorForFormField.java
+++ b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/prototyping/PrototypingDecoratorForFormField.java
@@ -23,8 +23,7 @@ import javax.inject.Inject;
import org.springframework.stereotype.Component;
import org.apache.isis.incubator.viewer.javafx.model.util._fx;
-import org.apache.isis.viewer.common.model.decorator.prototyping.PrototypingDecorator;
-import org.apache.isis.viewer.common.model.decorator.prototyping.PrototypingUiModel;
+import org.apache.isis.viewer.common.model.decorators.PrototypingDecorator;
import lombok.RequiredArgsConstructor;
import lombok.val;
@@ -41,14 +40,14 @@ public class PrototypingDecoratorForFormField implements PrototypingDecorator<No
private final PrototypingInfoPopupProvider prototypingInfoService;
@Override
- public Node decorate(final Node formField, final PrototypingUiModel prototypingUiModel) {
+ public Node decorate(final Node formField, final PrototypingDecorationModel prototypingDecorationModel) {
val container = new HBox();
val infoLabel = _fx.add(container, new Label("ⓘ"));
_fx.add(container, formField);
infoLabel.setTooltip(new Tooltip("Inspect Metamodel"));
- infoLabel.setOnMouseClicked(e->prototypingInfoService.showPrototypingPopup(prototypingUiModel));
+ infoLabel.setOnMouseClicked(e->prototypingInfoService.showPrototypingPopup(prototypingDecorationModel));
return container;
}
diff --git a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/prototyping/PrototypingInfoPopupProvider.java b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/prototyping/PrototypingInfoPopupProvider.java
index 40ac429bd0..87b48f98cd 100644
--- a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/prototyping/PrototypingInfoPopupProvider.java
+++ b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/decorator/prototyping/PrototypingInfoPopupProvider.java
@@ -32,7 +32,7 @@ import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
import org.apache.isis.incubator.viewer.javafx.model.util._fx;
import org.apache.isis.incubator.viewer.javafx.ui.components.UiComponentFactoryFx;
import org.apache.isis.incubator.viewer.javafx.ui.components.dialog.Dialogs;
-import org.apache.isis.viewer.common.model.decorator.prototyping.PrototypingUiModel;
+import org.apache.isis.viewer.common.model.decorators.PrototypingDecorator.PrototypingDecorationModel;
import lombok.RequiredArgsConstructor;
import lombok.Value;
@@ -51,10 +51,10 @@ public class PrototypingInfoPopupProvider {
private final Provider<UiComponentFactoryFx> uiComponentFactory;
- public void showPrototypingPopup(final PrototypingUiModel prototypingUiModel) {
- val infoNode = getPrototypingInfoUiComponent(prototypingUiModel);
- val headerText = prototypingUiModel.getFeatureFriendlyIdentifier();
- val contentText = prototypingUiModel.getFeatureType().toString();
+ public void showPrototypingPopup(final PrototypingDecorationModel prototypingDecorationModel) {
+ val infoNode = getPrototypingInfoUiComponent(prototypingDecorationModel);
+ val headerText = prototypingDecorationModel.getFeatureFriendlyIdentifier();
+ val contentText = prototypingDecorationModel.getFeatureType().toString();
Dialogs.message("Inspect Metamodel", headerText, contentText, infoNode);
}
@@ -70,7 +70,7 @@ public class PrototypingInfoPopupProvider {
}
}
- private Node getPrototypingInfoUiComponent(final PrototypingUiModel prototypingUiModel) {
+ private Node getPrototypingInfoUiComponent(final PrototypingDecorationModel prototypingDecorationModel) {
val infos = _Sets.<Info>newTreeSet();
@@ -82,7 +82,7 @@ public class PrototypingInfoPopupProvider {
infos.add(Info.of("Handlers", handlerInfo));
- prototypingUiModel.streamFeatureFacets()
+ prototypingDecorationModel.streamFeatureFacets()
.forEach(facet ->
infos.add(Info.of(
facet.facetType().getSimpleName(),
diff --git a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/main/UiContextFxDefault.java b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/main/UiContextFxDefault.java
index a2e0f3c5fc..905f4beae5 100644
--- a/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/main/UiContextFxDefault.java
+++ b/incubator/viewers/javafx/ui/src/main/java/org/apache/isis/incubator/viewer/javafx/ui/main/UiContextFxDefault.java
@@ -31,9 +31,9 @@ import org.apache.isis.core.metamodel.spec.ManagedObject;
import org.apache.isis.incubator.viewer.javafx.model.action.ActionUiModelFactoryFx;
import org.apache.isis.incubator.viewer.javafx.model.context.UiContextFx;
import org.apache.isis.incubator.viewer.javafx.model.events.JavaFxViewerConfig;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingDecorator;
-import org.apache.isis.viewer.common.model.decorator.icon.IconDecorator;
-import org.apache.isis.viewer.common.model.decorator.prototyping.PrototypingDecorator;
+import org.apache.isis.viewer.common.model.decorators.DisablingDecorator;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator;
+import org.apache.isis.viewer.common.model.decorators.PrototypingDecorator;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git a/incubator/viewers/vaadin/model/src/main/java/org/apache/isis/incubator/viewer/vaadin/model/decorator/Decorators.java b/incubator/viewers/vaadin/model/src/main/java/org/apache/isis/incubator/viewer/vaadin/model/decorator/Decorators.java
index 221b2e7a56..391eec017d 100644
--- a/incubator/viewers/vaadin/model/src/main/java/org/apache/isis/incubator/viewer/vaadin/model/decorator/Decorators.java
+++ b/incubator/viewers/vaadin/model/src/main/java/org/apache/isis/incubator/viewer/vaadin/model/decorator/Decorators.java
@@ -33,10 +33,8 @@ import org.apache.isis.applib.layout.component.CssClassFaPosition;
import org.apache.isis.core.runtime.context.IsisAppCommonContext;
import org.apache.isis.viewer.common.applib.services.userprof.UserProfileUiModel;
import org.apache.isis.viewer.common.applib.services.userprof.UserProfileUiModelProvider;
-import org.apache.isis.viewer.common.model.decorator.icon.FontAwesomeUiModel;
-import org.apache.isis.viewer.common.model.decorator.icon.IconDecorator;
-import org.apache.isis.viewer.common.model.decorator.tooltip.TooltipDecorator;
-import org.apache.isis.viewer.common.model.decorator.tooltip.TooltipUiModel;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator;
+import org.apache.isis.viewer.common.model.decorators.TooltipDecorator;
import lombok.Getter;
import lombok.val;
@@ -60,7 +58,7 @@ public class Decorators {
public final static class Tooltip implements TooltipDecorator<Component> {
@Override
- public void decorate(Component uiComponent, TooltipUiModel tooltipUiModel) {
+ public void decorate(Component uiComponent, TooltipDecorationModel tooltipDecorationModel) {
log.warn("not implemented yet");
}
@@ -71,9 +69,9 @@ public class Decorators {
@Override
public Component decorate(
final Component uiComponent,
- final Optional<FontAwesomeUiModel> fontAwesomeUiModel) {
+ final Optional<FontAwesomeDecorationModel> fontAwesomeDecorationModel) {
- val decoratedUiComponent = fontAwesomeUiModel
+ val decoratedUiComponent = fontAwesomeDecorationModel
.map(fontAwesome->{
val faIcon = new Span();
diff --git a/incubator/viewers/vaadin/ui/src/main/java/org/apache/isis/incubator/viewer/vaadin/ui/components/object/ObjectViewVaa.java b/incubator/viewers/vaadin/ui/src/main/java/org/apache/isis/incubator/viewer/vaadin/ui/components/object/ObjectViewVaa.java
index f6387a23fd..654e8ef95a 100644
--- a/incubator/viewers/vaadin/ui/src/main/java/org/apache/isis/incubator/viewer/vaadin/ui/components/object/ObjectViewVaa.java
+++ b/incubator/viewers/vaadin/ui/src/main/java/org/apache/isis/incubator/viewer/vaadin/ui/components/object/ObjectViewVaa.java
@@ -55,7 +55,7 @@ import org.apache.isis.incubator.viewer.vaadin.model.util._vaa;
import org.apache.isis.incubator.viewer.vaadin.ui.components.UiComponentFactoryVaa;
import org.apache.isis.incubator.viewer.vaadin.ui.components.collection.TableViewVaa;
import org.apache.isis.viewer.common.model.components.UiComponentFactory;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingUiModel;
+import org.apache.isis.viewer.common.model.decorators.DisablingDecorator.DisablingDecorationModel;
import org.apache.isis.viewer.common.model.gridlayout.UiGridLayout;
import lombok.NonNull;
@@ -200,7 +200,7 @@ public class ObjectViewVaa extends VerticalLayout {
uiComponentFactory.buttonFor(
UiComponentFactory.ButtonRequest.of(
managedAction,
- DisablingUiModel.of(interaction),
+ DisablingDecorationModel.of(interaction),
actionEventHandler)));
});
@@ -226,7 +226,7 @@ public class ObjectViewVaa extends VerticalLayout {
UiComponentFactory.ComponentRequest.of(
propNeg,
managedProperty,
- DisablingUiModel.of(interaction))));
+ DisablingDecorationModel.of(interaction))));
// handle associated actions
val actionBar = newActionPanel(container);
diff --git a/incubator/viewers/vaadin/ui/src/main/java/org/apache/isis/incubator/viewer/vaadin/ui/pages/main/MainViewVaa.java b/incubator/viewers/vaadin/ui/src/main/java/org/apache/isis/incubator/viewer/vaadin/ui/pages/main/MainViewVaa.java
index ae429d2dfb..07812af364 100644
--- a/incubator/viewers/vaadin/ui/src/main/java/org/apache/isis/incubator/viewer/vaadin/ui/pages/main/MainViewVaa.java
+++ b/incubator/viewers/vaadin/ui/src/main/java/org/apache/isis/incubator/viewer/vaadin/ui/pages/main/MainViewVaa.java
@@ -39,7 +39,7 @@ import org.apache.isis.incubator.viewer.vaadin.ui.components.UiComponentFactoryV
import org.apache.isis.incubator.viewer.vaadin.ui.components.collection.TableViewVaa;
import org.apache.isis.incubator.viewer.vaadin.ui.components.object.ObjectViewVaa;
import org.apache.isis.incubator.viewer.vaadin.ui.util.LocalResourceUtil;
-import org.apache.isis.viewer.common.model.decorator.icon.IconDecorator;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator;
import org.apache.isis.viewer.common.model.header.HeaderUiModelProvider;
import lombok.val;
diff --git a/regressiontests/stable-viewers-common/src/test/java/org/apache/isis/testdomain/viewers/common/wkt/InteractionTestWkt.java b/regressiontests/stable-viewers-common/src/test/java/org/apache/isis/testdomain/viewers/common/wkt/InteractionTestWkt.java
index 20be6fd917..377a4d22e2 100644
--- a/regressiontests/stable-viewers-common/src/test/java/org/apache/isis/testdomain/viewers/common/wkt/InteractionTestWkt.java
+++ b/regressiontests/stable-viewers-common/src/test/java/org/apache/isis/testdomain/viewers/common/wkt/InteractionTestWkt.java
@@ -46,7 +46,7 @@ import org.apache.isis.testdomain.conf.Configuration_usingWicket.WicketTesterFac
import org.apache.isis.testdomain.model.interaction.Configuration_usingInteractionDomain;
import org.apache.isis.testdomain.model.interaction.InteractionDemo;
import org.apache.isis.testdomain.util.interaction.InteractionTestAbstract;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingUiModel;
+import org.apache.isis.viewer.common.model.decorators.DisablingDecorator.DisablingDecorationModel;
import org.apache.isis.viewer.common.model.object.ObjectUiModel.RenderingHint;
import org.apache.isis.viewer.wicket.model.models.EntityModel;
import org.apache.isis.viewer.wicket.model.models.ScalarPropertyModel;
@@ -182,7 +182,7 @@ class InteractionTestWkt extends InteractionTestAbstract {
.checkVisibility()
.checkUsability();
- val disablingUiModel = DisablingUiModel.of(actionInteraction);
+ val disablingUiModel = DisablingDecorationModel.of(actionInteraction);
assertFalse(disablingUiModel.isPresent());
}
@@ -193,7 +193,7 @@ class InteractionTestWkt extends InteractionTestAbstract {
.checkVisibility()
.checkUsability();
- val disablingUiModel = DisablingUiModel.of(actionInteraction).get();
+ val disablingUiModel = DisablingDecorationModel.of(actionInteraction).get();
assertEquals("Disabled for demonstration.", disablingUiModel.getReason());
}
}
\ No newline at end of file
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/action/HasManagedAction.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/action/HasManagedAction.java
index b2da4ac0bc..226f27b16c 100644
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/action/HasManagedAction.java
+++ b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/action/HasManagedAction.java
@@ -30,8 +30,8 @@ import org.apache.isis.core.metamodel.interactions.managed.ManagedAction;
import org.apache.isis.core.metamodel.spec.ManagedObject;
import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
import org.apache.isis.core.metamodel.util.Facets;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingUiModel;
-import org.apache.isis.viewer.common.model.decorator.icon.FontAwesomeUiModel;
+import org.apache.isis.viewer.common.model.decorators.DisablingDecorator.DisablingDecorationModel;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator.FontAwesomeDecorationModel;
import lombok.val;
@@ -91,9 +91,9 @@ public interface HasManagedAction {
// -- UI SPECIFICS
- default Optional<FontAwesomeUiModel> getFontAwesomeUiModel() {
+ default Optional<FontAwesomeDecorationModel> getFontAwesomeUiModel() {
val managedAction = getManagedAction();
- return FontAwesomeUiModel.of(ObjectAction.Util.cssClassFaFactoryFor(
+ return FontAwesomeDecorationModel.of(ObjectAction.Util.cssClassFaFactoryFor(
managedAction.getAction(),
managedAction.getOwner()));
}
@@ -111,8 +111,8 @@ public interface HasManagedAction {
return a -> a.getPosition() == position;
}
- default Optional<DisablingUiModel> getDisableUiModel() {
- return DisablingUiModel.of(getManagedAction().checkUsability()) ;
+ default Optional<DisablingDecorationModel> getDisableUiModel() {
+ return DisablingDecorationModel.of(getManagedAction().checkUsability()) ;
}
}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/action/decorator/ActionUiDecorator.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/action/decorator/ActionUiDecorator.java
index 3e9c90012c..7aece9eb24 100644
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/action/decorator/ActionUiDecorator.java
+++ b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/action/decorator/ActionUiDecorator.java
@@ -18,11 +18,11 @@
*/
package org.apache.isis.viewer.common.model.action.decorator;
-import org.apache.isis.viewer.common.model.decorator.confirm.ConfirmDecorator;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingDecorator;
-import org.apache.isis.viewer.common.model.decorator.icon.IconDecorator;
-import org.apache.isis.viewer.common.model.decorator.prototyping.PrototypingDecorator;
-import org.apache.isis.viewer.common.model.decorator.tooltip.TooltipDecorator;
+import org.apache.isis.viewer.common.model.decorators.ConfirmDecorator;
+import org.apache.isis.viewer.common.model.decorators.DisablingDecorator;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator;
+import org.apache.isis.viewer.common.model.decorators.PrototypingDecorator;
+import org.apache.isis.viewer.common.model.decorators.TooltipDecorator;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/components/UiComponentFactory.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/components/UiComponentFactory.java
index ff40643bf9..186e9b60b0 100644
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/components/UiComponentFactory.java
+++ b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/components/UiComponentFactory.java
@@ -36,7 +36,7 @@ import org.apache.isis.core.metamodel.spec.ManagedObject;
import org.apache.isis.core.metamodel.spec.ManagedObjects;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.util.Facets;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingUiModel;
+import org.apache.isis.viewer.common.model.decorators.DisablingDecorator.DisablingDecorationModel;
import lombok.NonNull;
import lombok.Value;
@@ -58,7 +58,7 @@ public interface UiComponentFactory<B, C> {
@Value(staticConstructor = "of")
public static class ButtonRequest {
@NonNull private final ManagedAction managedAction;
- @NonNull private final Optional<DisablingUiModel> disablingUiModelIfAny;
+ @NonNull private final Optional<DisablingDecorationModel> disablingUiModelIfAny;
@NonNull private final Consumer<ManagedAction> actionEventHandler;
}
@@ -67,7 +67,7 @@ public interface UiComponentFactory<B, C> {
@NonNull private final ManagedValue managedValue;
@NonNull private final ManagedFeature managedFeature;
- @NonNull private final Optional<DisablingUiModel> disablingUiModelIfAny;
+ @NonNull private final Optional<DisablingDecorationModel> disablingUiModelIfAny;
public static ComponentRequest of(final ManagedParameter managedParameter) {
return of(managedParameter, managedParameter, Optional.empty());
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/confirm/ConfirmDecorator.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/confirm/ConfirmDecorator.java
deleted file mode 100644
index 91fc9ab91a..0000000000
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/confirm/ConfirmDecorator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.common.model.decorator.confirm;
-
-public interface ConfirmDecorator<T> {
-
- void decorate(T uiComponent, ConfirmUiModel confirmUiModel);
-
-}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/confirm/ConfirmUiModel.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/confirm/ConfirmUiModel.java
deleted file mode 100644
index c9e85b4cca..0000000000
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/confirm/ConfirmUiModel.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.common.model.decorator.confirm;
-
-import java.io.Serializable;
-import java.util.Optional;
-
-import org.apache.isis.applib.services.i18n.TranslationContext;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.core.config.messages.MessageRegistry;
-import org.apache.isis.viewer.common.model.PlacementDirection;
-
-import lombok.Getter;
-import lombok.NonNull;
-import lombok.RequiredArgsConstructor;
-import lombok.val;
-
-@Getter
-@RequiredArgsConstructor(staticName = "of")
-public class ConfirmUiModel implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- final @NonNull String title;
- final @NonNull Optional<String> message;
- final @NonNull String okLabel;
- final @NonNull String cancelLabel;
- final @NonNull PlacementDirection placement;
-
- public static ConfirmUiModel ofAreYouSure(
- final TranslationService translationService,
- final PlacementDirection placement) {
-
- val context = TranslationContext.forClassName(MessageRegistry.class);
-
- val areYouSure = translate(translationService, context, MessageRegistry.MSG_ARE_YOU_SURE);
- val confirm = translate(translationService, context, MessageRegistry.MSG_CONFIRM);
- val cancel = translate(translationService, context, MessageRegistry.MSG_CANCEL);
-
- val message = Optional.<String>empty(); // not used yet
-
- return of(areYouSure, message, confirm, cancel, placement);
- }
-
- // -- HELPER
-
- private static String translate(final TranslationService translationService, final TranslationContext context, final String msg) {
- if(translationService!=null) {
- return translationService.translate(context, msg);
- }
- return msg;
- }
-
-}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/disable/DisablingDecorator.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/disable/DisablingDecorator.java
deleted file mode 100644
index e650d4e276..0000000000
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/disable/DisablingDecorator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.common.model.decorator.disable;
-
-public interface DisablingDecorator<T> {
-
- void decorate(T uiComponent, DisablingUiModel disableUiModel);
-
-}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/icon/FontAwesomeUiModel.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/icon/FontAwesomeUiModel.java
deleted file mode 100644
index 1f10b31989..0000000000
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/icon/FontAwesomeUiModel.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.common.model.decorator.icon;
-
-import java.io.Serializable;
-import java.util.Optional;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import org.apache.isis.applib.layout.component.CssClassFaPosition;
-import org.apache.isis.commons.internal.base._Strings;
-import org.apache.isis.core.metamodel.facets.members.cssclassfa.CssClassFaFactory;
-
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.NonNull;
-import lombok.RequiredArgsConstructor;
-
-@Getter
-@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
-public class FontAwesomeUiModel implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @NonNull private final String cssClassesSpaceSeparated;
- @NonNull private final CssClassFaPosition position;
-
- public static Optional<FontAwesomeUiModel> of(Optional<CssClassFaFactory> cssClassFaFactoryIfAny) {
-
- return cssClassFaFactoryIfAny
- .map(cssClassFaFactory->new FontAwesomeUiModel(
- cssClassFaFactory.streamCssClasses().collect(Collectors.joining(" ")),
- Optional.ofNullable(cssClassFaFactory.getPosition()).orElse(CssClassFaPosition.LEFT)));
-
- }
-
- public Stream<String> streamCssClasses() {
- return _Strings.splitThenStream(getCssClassesSpaceSeparated(), " ");
- }
-
-}
-
-
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/icon/IconDecorator.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/icon/IconDecorator.java
deleted file mode 100644
index 03a7f2fc01..0000000000
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/icon/IconDecorator.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.common.model.decorator.icon;
-
-import java.util.Optional;
-
-/**
- * @param <T> UI component type to decorate
- * @param <R> resulting UI component type
- */
-public interface IconDecorator<T, R> {
-
- /**
- * corresponds to the webjars path as provided by the maven artifact
- * {@code org.webjars:font-awesome}
- */
- public static final String FONTAWESOME_RESOURCE = "font-awesome/6.1.0/css/all.min.css";
-
- R decorate(T uiComponent, Optional<FontAwesomeUiModel> fontAwesomeUiModel);
-
-}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/prototyping/PrototypingDecorator.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/prototyping/PrototypingDecorator.java
deleted file mode 100644
index 90f9533ef7..0000000000
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/prototyping/PrototypingDecorator.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.common.model.decorator.prototyping;
-
-/**
- *
- * When in PROTOTYPING mode adds additional UI aspects, which are otherwise (production mode) not visible.
- *
- * @param <T> UI component type to decorate
- * @param <R> resulting UI component type
- */
-public interface PrototypingDecorator<T, R> {
-
- R decorate(T uiComponent, PrototypingUiModel prototypingUiModel);
-
-}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/prototyping/PrototypingUiModel.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/prototyping/PrototypingUiModel.java
deleted file mode 100644
index 601b62e127..0000000000
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/prototyping/PrototypingUiModel.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.common.model.decorator.prototyping;
-
-import java.util.function.Supplier;
-import java.util.stream.Stream;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.interactions.managed.ManagedAction;
-import org.apache.isis.core.metamodel.interactions.managed.ManagedMember;
-
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-@Getter
-@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
-public class PrototypingUiModel {
-
- private final Class<?> featureType;
- private final String featureFriendlyName;
- private final String featureFriendlyIdentifier;
- private final Supplier<Stream<Facet>> facetStreamProvider;
-
- public static PrototypingUiModel of(final ManagedAction managedAction) {
- Class<?> featureType = managedAction.getAction().getReturnType().getCorrespondingClass();
- String featureShortLabel = managedAction.getFriendlyName();
- String featureFullLabel = String.format("%s: %s",
- managedAction.getMemberType(),
- managedAction.getId());
-
- return new PrototypingUiModel(featureType, featureShortLabel, featureFullLabel,
- managedAction.getAction()::streamFacets);
- }
-
- public static PrototypingUiModel of(final ManagedMember managedMember) {
- Class<?> featureType = managedMember.getElementClass();
- String featureShortLabel = managedMember.getFriendlyName();
- String featureFullLabel = String.format("%s: %s",
- managedMember.getMemberType(),
- managedMember.getId());
-
- return new PrototypingUiModel(featureType, featureShortLabel, featureFullLabel,
- managedMember.getElementType()::streamFacets);
- }
-
- public Stream<Facet> streamFeatureFacets() {
- return facetStreamProvider.get();
- }
-
-
-
-}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/tooltip/TooltipDecorator.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/tooltip/TooltipDecorator.java
deleted file mode 100644
index 75c19675fb..0000000000
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/tooltip/TooltipDecorator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.common.model.decorator.tooltip;
-
-public interface TooltipDecorator<T> {
-
- void decorate(T uiComponent, TooltipUiModel tooltipUiModel);
-
-}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/tooltip/TooltipUiModel.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/tooltip/TooltipUiModel.java
deleted file mode 100644
index 8d54edc3e8..0000000000
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/tooltip/TooltipUiModel.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.common.model.decorator.tooltip;
-
-import java.io.Serializable;
-import java.util.Optional;
-
-import org.springframework.lang.Nullable;
-
-import org.apache.isis.commons.internal.base._Strings;
-import org.apache.isis.viewer.common.model.PlacementDirection;
-
-import lombok.NonNull;
-import lombok.Value;
-
-@Value(staticConstructor = "of")
-public class TooltipUiModel implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- final @NonNull PlacementDirection placementDirection;
- final @NonNull Optional<String> title;
- final @NonNull String body;
-
- public static TooltipUiModel ofBody(
- final @NonNull PlacementDirection placementDirection,
- final @Nullable String body) {
- return of(placementDirection, Optional.empty(), _Strings.nullToEmpty(body));
- }
-
- public static TooltipUiModel ofTitleAndBody(
- final @NonNull PlacementDirection placementDirection,
- final @Nullable String title,
- final @Nullable String body) {
- return of(placementDirection, Optional.ofNullable(_Strings.emptyToNull(title)), _Strings.nullToEmpty(body));
- }
-
- public static TooltipUiModel empty() {
- return ofBody(PlacementDirection.BOTTOM, "");
- }
-
- public boolean isEmpty() {
- return body.isEmpty();
- }
-
-}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/ConfirmDecorator.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/ConfirmDecorator.java
new file mode 100644
index 0000000000..a3313a6661
--- /dev/null
+++ b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/ConfirmDecorator.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.common.model.decorators;
+
+import java.io.Serializable;
+import java.util.Optional;
+
+import org.apache.isis.applib.services.i18n.TranslationContext;
+import org.apache.isis.applib.services.i18n.TranslationService;
+import org.apache.isis.core.config.messages.MessageRegistry;
+import org.apache.isis.viewer.common.model.PlacementDirection;
+
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.RequiredArgsConstructor;
+import lombok.val;
+
+public interface ConfirmDecorator<T> {
+
+ void decorate(T uiComponent, ConfirmDecorationModel confirmDecorationModel);
+
+ @Getter
+ @RequiredArgsConstructor(staticName = "of", access = AccessLevel.PRIVATE)
+ public static class ConfirmDecorationModel implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ final @NonNull String title;
+ final @NonNull Optional<String> message;
+ final @NonNull String okLabel;
+ final @NonNull String cancelLabel;
+ final @NonNull PlacementDirection placement;
+
+ public static ConfirmDecorationModel areYouSure(
+ final TranslationService translationService,
+ final PlacementDirection placement) {
+
+ val context = TranslationContext.forClassName(MessageRegistry.class);
+
+ val areYouSure = translate(translationService, context, MessageRegistry.MSG_ARE_YOU_SURE);
+ val confirm = translate(translationService, context, MessageRegistry.MSG_CONFIRM);
+ val cancel = translate(translationService, context, MessageRegistry.MSG_CANCEL);
+
+ val message = Optional.<String>empty(); // not used yet
+
+ return of(areYouSure, message, confirm, cancel, placement);
+ }
+
+ // -- HELPER
+
+ private static String translate(final TranslationService translationService, final TranslationContext context, final String msg) {
+ if(translationService!=null) {
+ return translationService.translate(context, msg);
+ }
+ return msg;
+ }
+
+ }
+
+}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/danger/DangerDecorator.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/DangerDecorator.java
similarity index 93%
rename from viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/danger/DangerDecorator.java
rename to viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/DangerDecorator.java
index 18ea6827ae..813900fd2c 100644
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/danger/DangerDecorator.java
+++ b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/DangerDecorator.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.viewer.common.model.decorator.danger;
+package org.apache.isis.viewer.common.model.decorators;
public interface DangerDecorator<T> {
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/disable/DisablingUiModel.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/DisablingDecorator.java
similarity index 58%
rename from viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/disable/DisablingUiModel.java
rename to viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/DisablingDecorator.java
index ac962d297a..785eef07a8 100644
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/disable/DisablingUiModel.java
+++ b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/DisablingDecorator.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.viewer.common.model.decorator.disable;
+package org.apache.isis.viewer.common.model.decorators;
import java.io.Serializable;
import java.util.Optional;
@@ -29,22 +29,28 @@ import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
-@Getter
-@RequiredArgsConstructor(staticName = "of", access = AccessLevel.PRIVATE)
-public class DisablingUiModel implements Serializable {
+public interface DisablingDecorator<T> {
- private static final long serialVersionUID = 1L;
+ void decorate(T uiComponent, DisablingDecorationModel disableUiModel);
- final @NonNull String reason;
+ @Getter
+ @RequiredArgsConstructor(staticName = "of", access = AccessLevel.PRIVATE)
+ public static class DisablingDecorationModel implements Serializable {
- public static Optional<DisablingUiModel> of(@NonNull final Optional<InteractionVeto> usabilityVeto) {
- return usabilityVeto
- .map(veto->of(veto.getReason()));
- }
+ private static final long serialVersionUID = 1L;
- public static Optional<DisablingUiModel> of(@NonNull final MemberInteraction<?, ?> memberInteraction) {
- return of(memberInteraction.getInteractionVeto());
- }
+ final @NonNull String reason;
+
+ public static Optional<DisablingDecorationModel> of(@NonNull final Optional<InteractionVeto> usabilityVeto) {
+ return usabilityVeto
+ .map(veto->of(veto.getReason()));
+ }
+ public static Optional<DisablingDecorationModel> of(@NonNull final MemberInteraction<?, ?> memberInteraction) {
+ return of(memberInteraction.getInteractionVeto());
+ }
+
+
+ }
}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/IconDecorator.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/IconDecorator.java
new file mode 100644
index 0000000000..1504a0c762
--- /dev/null
+++ b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/IconDecorator.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.common.model.decorators;
+
+import java.io.Serializable;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.apache.isis.applib.layout.component.CssClassFaPosition;
+import org.apache.isis.commons.internal.base._Strings;
+import org.apache.isis.core.metamodel.facets.members.cssclassfa.CssClassFaFactory;
+
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.RequiredArgsConstructor;
+
+/**
+ * @param <T> UI component type to decorate
+ * @param <R> resulting UI component type
+ */
+public interface IconDecorator<T, R> {
+
+ /**
+ * corresponds to the webjars path as provided by the maven artifact
+ * {@code org.webjars:font-awesome}
+ */
+ public static final String FONTAWESOME_RESOURCE = "font-awesome/6.1.0/css/all.min.css";
+
+ R decorate(T uiComponent, Optional<FontAwesomeDecorationModel> fontAwesomeDecorationModel);
+
+ @Getter
+ @RequiredArgsConstructor(access = AccessLevel.PRIVATE)
+ public class FontAwesomeDecorationModel implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @NonNull private final String cssClassesSpaceSeparated;
+ @NonNull private final CssClassFaPosition position;
+
+ public static Optional<FontAwesomeDecorationModel> of(final Optional<CssClassFaFactory> cssClassFaFactoryIfAny) {
+
+ return cssClassFaFactoryIfAny
+ .map(cssClassFaFactory->new FontAwesomeDecorationModel(
+ cssClassFaFactory.streamCssClasses().collect(Collectors.joining(" ")),
+ Optional.ofNullable(cssClassFaFactory.getPosition()).orElse(CssClassFaPosition.LEFT)));
+
+ }
+
+ public Stream<String> streamCssClasses() {
+ return _Strings.splitThenStream(getCssClassesSpaceSeparated(), " ");
+ }
+
+ }
+
+}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/PrototypingDecorator.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/PrototypingDecorator.java
new file mode 100644
index 0000000000..f8190eb5f7
--- /dev/null
+++ b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/PrototypingDecorator.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.common.model.decorators;
+
+import java.util.function.Supplier;
+import java.util.stream.Stream;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.interactions.managed.ManagedAction;
+import org.apache.isis.core.metamodel.interactions.managed.ManagedMember;
+
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+/**
+ *
+ * When in PROTOTYPING mode adds additional UI aspects, which are otherwise (production mode) not visible.
+ *
+ * @param <T> UI component type to decorate
+ * @param <R> resulting UI component type
+ */
+public interface PrototypingDecorator<T, R> {
+
+ R decorate(T uiComponent, PrototypingDecorationModel prototypingDecorationModel);
+
+ @Getter
+ @RequiredArgsConstructor(access = AccessLevel.PRIVATE)
+ public static class PrototypingDecorationModel {
+
+ private final Class<?> featureType;
+ private final String featureFriendlyName;
+ private final String featureFriendlyIdentifier;
+ private final Supplier<Stream<Facet>> facetStreamProvider;
+
+ public static PrototypingDecorationModel of(final ManagedAction managedAction) {
+ Class<?> featureType = managedAction.getAction().getReturnType().getCorrespondingClass();
+ String featureShortLabel = managedAction.getFriendlyName();
+ String featureFullLabel = String.format("%s: %s",
+ managedAction.getMemberType(),
+ managedAction.getId());
+
+ return new PrototypingDecorationModel(featureType, featureShortLabel, featureFullLabel,
+ managedAction.getAction()::streamFacets);
+ }
+
+ public static PrototypingDecorationModel of(final ManagedMember managedMember) {
+ Class<?> featureType = managedMember.getElementClass();
+ String featureShortLabel = managedMember.getFriendlyName();
+ String featureFullLabel = String.format("%s: %s",
+ managedMember.getMemberType(),
+ managedMember.getId());
+
+ return new PrototypingDecorationModel(featureType, featureShortLabel, featureFullLabel,
+ managedMember.getElementType()::streamFacets);
+ }
+
+ public Stream<Facet> streamFeatureFacets() {
+ return facetStreamProvider.get();
+ }
+
+
+
+ }
+
+}
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/TooltipDecorator.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/TooltipDecorator.java
new file mode 100644
index 0000000000..ac8274ddc0
--- /dev/null
+++ b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorators/TooltipDecorator.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.common.model.decorators;
+
+import java.io.Serializable;
+import java.util.Optional;
+
+import org.springframework.lang.Nullable;
+
+import org.apache.isis.commons.internal.base._Strings;
+import org.apache.isis.viewer.common.model.PlacementDirection;
+
+import lombok.NonNull;
+import lombok.Value;
+
+public interface TooltipDecorator<T> {
+
+ void decorate(T uiComponent, TooltipDecorationModel tooltipDecorationModel);
+
+ @Value(staticConstructor = "of")
+ public static class TooltipDecorationModel implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ final @NonNull PlacementDirection placementDirection;
+ final @NonNull Optional<String> title;
+ final @NonNull String body;
+
+ public static TooltipDecorationModel ofBody(
+ final @NonNull PlacementDirection placementDirection,
+ final @Nullable String body) {
+ return of(placementDirection, Optional.empty(), _Strings.nullToEmpty(body));
+ }
+
+ public static TooltipDecorationModel ofTitleAndBody(
+ final @NonNull PlacementDirection placementDirection,
+ final @Nullable String title,
+ final @Nullable String body) {
+ return of(placementDirection, Optional.ofNullable(_Strings.emptyToNull(title)), _Strings.nullToEmpty(body));
+ }
+
+ public static TooltipDecorationModel empty() {
+ return ofBody(PlacementDirection.BOTTOM, "");
+ }
+
+ public boolean isEmpty() {
+ return body.isEmpty();
+ }
+
+ }
+
+}
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/CssClassFaBehavior.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/CssClassFaBehavior.java
index d0cd87f389..2c56f7ac85 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/CssClassFaBehavior.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/CssClassFaBehavior.java
@@ -22,7 +22,7 @@ import org.apache.wicket.Component;
import org.apache.wicket.behavior.Behavior;
import org.apache.isis.applib.layout.component.CssClassFaPosition;
-import org.apache.isis.viewer.common.model.decorator.icon.FontAwesomeUiModel;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator.FontAwesomeDecorationModel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
@@ -37,23 +37,23 @@ public class CssClassFaBehavior extends Behavior {
private static final long serialVersionUID = 1L;
- @NonNull private final FontAwesomeUiModel fontAwesomeUiModel;
+ @NonNull private final FontAwesomeDecorationModel fontAwesomeDecorationModel;
@Override
public void beforeRender(final Component component) {
super.beforeRender(component);
- val position = fontAwesomeUiModel.getPosition();
+ val position = fontAwesomeDecorationModel.getPosition();
if (position == null || CssClassFaPosition.LEFT == position) {
- val cssClassFa = fontAwesomeUiModel.getCssClassesSpaceSeparated();
+ val cssClassFa = fontAwesomeDecorationModel.getCssClassesSpaceSeparated();
component.getResponse().write("<span class=\""+cssClassFa+" fontAwesomeIcon\"></span>");
}
}
@Override
public void afterRender(final Component component) {
- val position = fontAwesomeUiModel.getPosition();
+ val position = fontAwesomeDecorationModel.getPosition();
if (CssClassFaPosition.RIGHT == position) {
- val cssClassFa = fontAwesomeUiModel.getCssClassesSpaceSeparated();
+ val cssClassFa = fontAwesomeDecorationModel.getCssClassesSpaceSeparated();
component.getResponse().write("<span class=\""+cssClassFa+" fontAwesomeIcon\"></span>");
}
super.afterRender(component);
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersForm.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersForm.java
index a83c2deae2..cc2276b635 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersForm.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersForm.java
@@ -35,7 +35,7 @@ import org.apache.isis.commons.internal.exceptions._Exceptions;
import org.apache.isis.core.metamodel.spec.ManagedObjects;
import org.apache.isis.viewer.common.model.PlacementDirection;
import org.apache.isis.viewer.common.model.components.ComponentType;
-import org.apache.isis.viewer.common.model.decorator.confirm.ConfirmUiModel;
+import org.apache.isis.viewer.common.model.decorators.ConfirmDecorator.ConfirmDecorationModel;
import org.apache.isis.viewer.common.model.feature.ParameterUiModel;
import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
import org.apache.isis.viewer.wicket.model.models.ActionModel;
@@ -126,7 +126,7 @@ extends PromptFormAbstract<ActionModel> {
val action = actionModel.getAction();
if (action.getSemantics().isAreYouSure()) {
- val confirmUiModel = ConfirmUiModel.ofAreYouSure(getTranslationService(), PlacementDirection.BOTTOM);
+ val confirmUiModel = ConfirmDecorationModel.areYouSure(getTranslationService(), PlacementDirection.BOTTOM);
WktDecorators.getConfirm().decorate(button, confirmUiModel);
}
}
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/FontAwesomeCssReferenceWkt.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/FontAwesomeCssReferenceWkt.java
index d8b4cb9c36..2671622267 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/FontAwesomeCssReferenceWkt.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/FontAwesomeCssReferenceWkt.java
@@ -18,7 +18,7 @@
*/
package org.apache.isis.viewer.wicket.ui.util;
-import org.apache.isis.viewer.common.model.decorator.icon.IconDecorator;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator;
import de.agilecoders.wicket.webjars.request.resource.WebjarsCssResourceReference;
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/WktDecorators.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/WktDecorators.java
index 5ecb5b8220..2d507fc09a 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/WktDecorators.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/WktDecorators.java
@@ -26,17 +26,15 @@ import org.apache.wicket.markup.html.form.Button;
import org.apache.isis.applib.services.i18n.TranslationService;
import org.apache.isis.viewer.common.model.PlacementDirection;
import org.apache.isis.viewer.common.model.action.decorator.ActionUiDecorator;
-import org.apache.isis.viewer.common.model.decorator.confirm.ConfirmDecorator;
-import org.apache.isis.viewer.common.model.decorator.confirm.ConfirmUiModel;
-import org.apache.isis.viewer.common.model.decorator.danger.DangerDecorator;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingDecorator;
-import org.apache.isis.viewer.common.model.decorator.disable.DisablingUiModel;
-import org.apache.isis.viewer.common.model.decorator.icon.FontAwesomeUiModel;
-import org.apache.isis.viewer.common.model.decorator.icon.IconDecorator;
-import org.apache.isis.viewer.common.model.decorator.prototyping.PrototypingDecorator;
-import org.apache.isis.viewer.common.model.decorator.prototyping.PrototypingUiModel;
-import org.apache.isis.viewer.common.model.decorator.tooltip.TooltipDecorator;
-import org.apache.isis.viewer.common.model.decorator.tooltip.TooltipUiModel;
+import org.apache.isis.viewer.common.model.decorators.ConfirmDecorator;
+import org.apache.isis.viewer.common.model.decorators.ConfirmDecorator.ConfirmDecorationModel;
+import org.apache.isis.viewer.common.model.decorators.DangerDecorator;
+import org.apache.isis.viewer.common.model.decorators.DisablingDecorator;
+import org.apache.isis.viewer.common.model.decorators.IconDecorator;
+import org.apache.isis.viewer.common.model.decorators.PrototypingDecorator;
+import org.apache.isis.viewer.common.model.decorators.PrototypingDecorator.PrototypingDecorationModel;
+import org.apache.isis.viewer.common.model.decorators.TooltipDecorator;
+import org.apache.isis.viewer.common.model.decorators.TooltipDecorator.TooltipDecorationModel;
import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
import org.apache.isis.viewer.wicket.ui.components.actionmenu.CssClassFaBehavior;
import org.apache.isis.viewer.wicket.ui.util.BootstrapConstants.ButtonSemantics;
@@ -62,8 +60,6 @@ public class WktDecorators {
@Getter(lazy = true) private final static Prototyping prototyping = new Prototyping();
@Getter(lazy = true) private final static Confirm confirm = new Confirm();
@Getter(lazy = true) private final static Danger danger = new Danger();
-
-
@Getter(lazy = true) private final static IconDecoratorWkt icon = new IconDecoratorWkt();
@Getter(lazy = true) private final static MissingIconDecorator missingIcon = new MissingIconDecorator();
@@ -75,15 +71,15 @@ public class WktDecorators {
public final static class Tooltip implements TooltipDecorator<Component> {
@Override
- public void decorate(final Component uiComponent, final TooltipUiModel tooltipUiModel) {
- WktTooltips.addTooltip(uiComponent, tooltipUiModel);
+ public void decorate(final Component uiComponent, final TooltipDecorationModel tooltipDecorationModel) {
+ WktTooltips.addTooltip(uiComponent, tooltipDecorationModel);
}
}
public final static class Disable implements DisablingDecorator<Component> {
@Override
- public void decorate(final Component uiComponent, final DisablingUiModel disableUiModel) {
- val tooltipUiModel = TooltipUiModel.ofBody(PlacementDirection.BOTTOM, disableUiModel.getReason());
+ public void decorate(final Component uiComponent, final DisablingDecorationModel disableUiModel) {
+ val tooltipUiModel = TooltipDecorationModel.ofBody(PlacementDirection.BOTTOM, disableUiModel.getReason());
getTooltip().decorate(uiComponent, tooltipUiModel);
Wkt.cssAppend(uiComponent, "disabled");
@@ -93,7 +89,7 @@ public class WktDecorators {
public final static class Prototyping implements PrototypingDecorator<Component, Component> {
@Override
- public Component decorate(final Component uiComponent, final PrototypingUiModel prototypingUiModel) {
+ public Component decorate(final Component uiComponent, final PrototypingDecorationModel prototypingDecorationModel) {
Wkt.cssAppend(uiComponent, "prototype");
return uiComponent;
}
@@ -101,15 +97,15 @@ public class WktDecorators {
public final static class Confirm implements ConfirmDecorator<Component> {
@Override
- public void decorate(final Component uiComponent, final ConfirmUiModel confirmUiModel) {
+ public void decorate(final Component uiComponent, final ConfirmDecorationModel confirmDecorationModel) {
val confirmationConfig = new ConfirmationConfig()
- .withTitle(confirmUiModel.getTitle())
- .withBtnOkLabel(confirmUiModel.getOkLabel())
- .withBtnCancelLabel(confirmUiModel.getCancelLabel())
+ .withTitle(confirmDecorationModel.getTitle())
+ .withBtnOkLabel(confirmDecorationModel.getOkLabel())
+ .withBtnCancelLabel(confirmDecorationModel.getCancelLabel())
.withBtnOkClass(ButtonSemantics.DANGER.fullButtonCss())
.withBtnCancelClass(ButtonSemantics.SECONDARY.fullButtonCss())
- .withPlacement(Placement.valueOf(confirmUiModel.getPlacement().name().toLowerCase()));
+ .withPlacement(Placement.valueOf(confirmDecorationModel.getPlacement().name().toLowerCase()));
uiComponent.add(new ConfirmationBehavior(confirmationConfig));
@@ -138,7 +134,7 @@ public class WktDecorators {
public final static class IconDecoratorWkt implements IconDecorator<Component, Component> {
@Override
- public Component decorate(final Component uiComponent, final Optional<FontAwesomeUiModel> fontAwesome) {
+ public Component decorate(final Component uiComponent, final Optional<FontAwesomeDecorationModel> fontAwesome) {
if(fontAwesome.isPresent()) {
uiComponent.add(new CssClassFaBehavior(fontAwesome.get()));
}
@@ -148,7 +144,7 @@ public class WktDecorators {
public final static class MissingIconDecorator implements IconDecorator<Component, Component> {
@Override
- public Component decorate(final Component uiComponent, final Optional<FontAwesomeUiModel> fontAwesome) {
+ public Component decorate(final Component uiComponent, final Optional<FontAwesomeDecorationModel> fontAwesome) {
if(!fontAwesome.isPresent()) {
Wkt.cssAppend(uiComponent, "menuLinkSpacer");
}
@@ -179,7 +175,7 @@ public class WktDecorators {
linkAndLabel.getDisableUiModel().ifPresent(disableUiModel->{
getDisableDecorator().decorate(uiComponent, disableUiModel);
getTooltipDecorator().decorate(uiComponent,
- TooltipUiModel.ofBody(PlacementDirection.BOTTOM, disableUiModel.getReason()));
+ TooltipDecorationModel.ofBody(PlacementDirection.BOTTOM, disableUiModel.getReason()));
});
if (!linkAndLabel.getDisableUiModel().isPresent()) {
@@ -189,12 +185,12 @@ public class WktDecorators {
.ifPresent(describedAs->
getTooltipDecorator()
.decorate(uiComponent,
- TooltipUiModel.ofBody(PlacementDirection.BOTTOM, describedAs)));
+ TooltipDecorationModel.ofBody(PlacementDirection.BOTTOM, describedAs)));
//XXX ISIS-1626, confirmation dialog for no-parameter menu actions
if (actionMeta.isImmediateConfirmationRequired()) {
- val confirmUiModel = ConfirmUiModel.ofAreYouSure(translationService, PlacementDirection.BOTTOM);
+ val confirmUiModel = ConfirmDecorationModel.areYouSure(translationService, PlacementDirection.BOTTOM);
getConfirmDecorator().decorate(actionLinkUiComponent, confirmUiModel);
}
@@ -203,7 +199,7 @@ public class WktDecorators {
if (actionMeta.isPrototype()) {
getPrototypingDecorator()
- .decorate(actionLinkUiComponent, PrototypingUiModel.of(linkAndLabel.getManagedAction()));
+ .decorate(actionLinkUiComponent, PrototypingDecorationModel.of(linkAndLabel.getManagedAction()));
}
}
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/WktLinks.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/WktLinks.java
index 61f741be6b..c87e8c4280 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/WktLinks.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/WktLinks.java
@@ -37,7 +37,7 @@ import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.isis.commons.internal.base._Strings;
import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
import org.apache.isis.viewer.common.model.PlacementDirection;
-import org.apache.isis.viewer.common.model.decorator.confirm.ConfirmUiModel;
+import org.apache.isis.viewer.common.model.decorators.ConfirmDecorator.ConfirmDecorationModel;
import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
import org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLink;
import org.apache.isis.viewer.wicket.ui.util.BootstrapConstants.ButtonSemantics;
@@ -83,8 +83,8 @@ public final class WktLinks {
if (!hasDisabledReason) {
val translationService = linkAndLabel.getAction().getMetaModelContext()
.getTranslationService();
- val confirmUiModel = ConfirmUiModel
- .ofAreYouSure(translationService, PlacementDirection.BOTTOM);
+ val confirmUiModel = ConfirmDecorationModel
+ .areYouSure(translationService, PlacementDirection.BOTTOM);
WktDecorators.getConfirm().decorate(link, confirmUiModel);
}
}
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/WktTooltips.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/WktTooltips.java
index 88845a241f..8fe398dfd2 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/WktTooltips.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/WktTooltips.java
@@ -26,7 +26,7 @@ import org.springframework.lang.Nullable;
import org.apache.isis.commons.internal.base._Strings;
import org.apache.isis.commons.internal.exceptions._Exceptions;
import org.apache.isis.viewer.common.model.PlacementDirection;
-import org.apache.isis.viewer.common.model.decorator.tooltip.TooltipUiModel;
+import org.apache.isis.viewer.common.model.decorators.TooltipDecorator.TooltipDecorationModel;
import org.apache.isis.viewer.wicket.ui.util.ExtendedPopoverConfig.PopoverBoundary;
import lombok.NonNull;
@@ -46,23 +46,23 @@ public class WktTooltips {
/**
* Adds popover behavior to the {@code target}, if at least the body is not empty/blank.
* @param target
- * @param tooltipUiModel
+ * @param tooltipDecorationModel
*/
public <T extends Component> T addTooltip(
final @Nullable T target,
- final @Nullable TooltipUiModel tooltipUiModel) {
+ final @Nullable TooltipDecorationModel tooltipDecorationModel) {
if(target==null
- || tooltipUiModel==null
- || tooltipUiModel.isEmpty()) {
+ || tooltipDecorationModel==null
+ || tooltipDecorationModel.isEmpty()) {
return target; // no body so don't render tooltip
}
- val placementDirection = tooltipUiModel.getPlacementDirection();
+ val placementDirection = tooltipDecorationModel.getPlacementDirection();
- final IModel<String> bodyModel = Model.of(tooltipUiModel.getBody());
+ final IModel<String> bodyModel = Model.of(tooltipDecorationModel.getBody());
- val tooltipBehavior = tooltipUiModel
+ val tooltipBehavior = tooltipDecorationModel
.getTitle()
.map(title->Model.of(title))
.map(titleModel->createTooltipBehavior(placementDirection, titleModel, bodyModel))
@@ -102,7 +102,7 @@ public class WktTooltips {
final @Nullable String body) {
return addTooltip(target, _Strings.isEmpty(body)
? null
- : TooltipUiModel.ofBody(placementDirection, body));
+ : TooltipDecorationModel.ofBody(placementDirection, body));
}
public <T extends Component> T addTooltip(
@@ -110,7 +110,7 @@ public class WktTooltips {
final @Nullable T target,
final @Nullable String title,
final @Nullable String body) {
- return addTooltip(target, TooltipUiModel.ofTitleAndBody(placementDirection, title, body));
+ return addTooltip(target, TooltipDecorationModel.ofTitleAndBody(placementDirection, title, body));
}
// -- HELPER