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 2020/03/24 09:22:44 UTC
[isis] branch master updated: ISIS-2093: extends Tooltip Demo to
show the issue
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 b1f2185 ISIS-2093: extends Tooltip Demo to show the issue
b1f2185 is described below
commit b1f2185c767ec936c39ab90cf6950a4b3d5e758a
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Mar 24 10:22:31 2020 +0100
ISIS-2093: extends Tooltip Demo to show the issue
---
.../main/java/demoapp/dom/tooltip/TooltipDemo.java | 32 ++++++++++++++++++++--
.../demoapp/dom/tooltip/TooltipDemo.layout.xml | 7 +++--
.../entityactions/AdditionalLinksPanel.java | 20 ++++++++------
3 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/examples/demo/src/main/java/demoapp/dom/tooltip/TooltipDemo.java b/examples/demo/src/main/java/demoapp/dom/tooltip/TooltipDemo.java
index a442028..a99218c 100644
--- a/examples/demo/src/main/java/demoapp/dom/tooltip/TooltipDemo.java
+++ b/examples/demo/src/main/java/demoapp/dom/tooltip/TooltipDemo.java
@@ -38,6 +38,7 @@ import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.annotation.PromptStyle;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.SemanticsOf;
@@ -72,8 +73,7 @@ public class TooltipDemo extends DemoStub {
@Action(semantics=SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
@ActionLayout(
cssClass="btn-danger",
- describedAs="This is a no-arg action with a tooltip and 'are you sure' "
- + "semantics.")
+ describedAs="This is a no-arg action with a tooltip and 'are you sure' semantics.")
public TooltipDemo noArgActionWithConfirm(){
return this;
}
@@ -81,7 +81,9 @@ public class TooltipDemo extends DemoStub {
// -- WITH ARG
@Action
- @ActionLayout(describedAs="This is an action with arguments and a tooltip.")
+ @ActionLayout(
+ describedAs="This is an action with arguments and a tooltip.",
+ promptStyle=PromptStyle.DIALOG_MODAL)
public TooltipDemo biArgAction(
@Parameter(optionality=Optionality.MANDATORY)
@@ -100,6 +102,30 @@ public class TooltipDemo extends DemoStub {
return this;
}
+
+ @Action(semantics=SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
+ @ActionLayout(
+ describedAs="This is an action with arguments, a tooltip and 'are you sure' semantics.",
+ promptStyle=PromptStyle.DIALOG_MODAL)
+ public TooltipDemo biArgActionWithConfirm(
+
+ @Parameter(optionality=Optionality.MANDATORY)
+ @ParameterLayout(
+ named="first",
+ describedAs="This is a mandatory parameter with a tooltip.")
+ String firstArg,
+
+ @Parameter(optionality=Optionality.OPTIONAL)
+ @ParameterLayout(
+ named="second",
+ describedAs="This is an optional parameter with a tooltip.")
+ String secondArg
+
+ ){
+
+ return this;
+ }
+
// -- DISABLED
diff --git a/examples/demo/src/main/java/demoapp/dom/tooltip/TooltipDemo.layout.xml b/examples/demo/src/main/java/demoapp/dom/tooltip/TooltipDemo.layout.xml
index 7ca44da..8ccc1f4 100644
--- a/examples/demo/src/main/java/demoapp/dom/tooltip/TooltipDemo.layout.xml
+++ b/examples/demo/src/main/java/demoapp/dom/tooltip/TooltipDemo.layout.xml
@@ -17,18 +17,19 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="Actions" id="a1">
+ <cpt:fieldSet name="Actions without Arguments" id="a1">
<cpt:action id="noArgAction" />
<cpt:action id="noArgActionWithConfirm" />
<cpt:property id="text1"/>
</cpt:fieldSet>
- <cpt:fieldSet name="Actions" id="a2">
+ <cpt:fieldSet name="Actions with Arguments" id="a2">
<cpt:action id="biArgAction" />
+ <cpt:action id="biArgActionWithConfirm" />
<cpt:property id="text2"/>
</cpt:fieldSet>
- <cpt:fieldSet name="Actions" id="a3">
+ <cpt:fieldSet name="Actions disabled" id="a3">
<cpt:action id="disabledAction" />
<cpt:action id="disabledActionWithConfirmation" />
<cpt:property id="text3"/>
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksPanel.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksPanel.java
index 10506d8..3b49945 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksPanel.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksPanel.java
@@ -29,7 +29,6 @@ import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.Model;
-import org.apache.isis.applib.annotation.SemanticsOf;
import org.apache.isis.applib.layout.component.CssClassFaPosition;
import org.apache.isis.core.commons.internal.base._Strings;
import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
@@ -136,7 +135,7 @@ public class AdditionalLinksPanel extends PanelAbstract<ListOfLinksModel> {
Tooltips.addTooltip(link, tooltipModel);
- final Label viewTitleLabel = new Label(ID_ADDITIONAL_LINK_TITLE, linkAndLabel.getLabel());
+ val viewTitleLabel = new Label(ID_ADDITIONAL_LINK_TITLE, linkAndLabel.getLabel());
if(linkAndLabel.isBlobOrClob()) {
link.add(new CssClassAppender("noVeil"));
}
@@ -145,19 +144,22 @@ public class AdditionalLinksPanel extends PanelAbstract<ListOfLinksModel> {
}
link.add(new CssClassAppender(linkAndLabel.getActionIdentifier()));
- SemanticsOf semantics = linkAndLabel.getSemantics();
- if (linkAndLabel.getParameters().isNoParameters() &&
- (link instanceof ActionLink ? ((ActionLink)link).getReasonDisabledIfAny() : null) == null
- ) {
- addConfirmationDialogIfAreYouSureSemantics(link, semantics);
+ val semantics = linkAndLabel.getSemantics();
+ if (linkAndLabel.getParameters().isNoParameters()) {
+ val hasDisabledReason = link instanceof ActionLink
+ ? _Strings.isNotEmpty(((ActionLink)link).getReasonDisabledIfAny())
+ : false;
+ if (!hasDisabledReason) {
+ addConfirmationDialogIfAreYouSureSemantics(link, semantics);
+ }
}
- final String cssClass = linkAndLabel.getCssClass();
+ val cssClass = linkAndLabel.getCssClass();
CssClassAppender.appendCssClassTo(link, cssClass);
link.addOrReplace(viewTitleLabel);
- final String cssClassFa = linkAndLabel.getCssClassFa();
+ val cssClassFa = linkAndLabel.getCssClassFa();
if (_Strings.isNullOrEmpty(cssClassFa)) {
viewTitleLabel.add(new CssClassAppender("menuLinkSpacer"));
} else {