You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/09/03 14:32:33 UTC
[42/87] [abbrv] [partial] isis git commit: ISIS-1194: moving the
wicket submodules to be direct children of core;
removing the isis-viewer-wicket parent pom.
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanel.java
new file mode 100644
index 0000000..e024e5c
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanel.java
@@ -0,0 +1,105 @@
+/*
+ * 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.wicket.ui.components.actionmenu.serviceactions;
+
+import java.util.List;
+
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.request.resource.CssResourceReference;
+
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+
+import de.agilecoders.wicket.extensions.markup.html.bootstrap.button.DropdownAutoOpenJavaScriptReference;
+
+/**
+ * A panel responsible to render the application actions as menu in a navigation bar.
+ *
+ * <p>
+ * The multi-level sub menu support is borrowed from
+ * <a href="http://bootsnipp.com/snippets/featured/multi-level-dropdown-menu-bs3">Bootsnip</a>
+ * </p>
+ */
+public class ServiceActionsPanel extends Panel {
+
+ public ServiceActionsPanel(String id, List<CssMenuItem> menuItems) {
+ super(id);
+ ListView<CssMenuItem> menuItemsView = new ListView<CssMenuItem>("menuItems", menuItems) {
+ @Override
+ protected void populateItem(ListItem<CssMenuItem> listItem) {
+ CssMenuItem menuItem = listItem.getModelObject();
+ listItem.add(new Label("name", menuItem.getName()));
+ MarkupContainer topMenu = new WebMarkupContainer("topMenu");
+ topMenu.add(new CssClassAppender("top-menu-" + CssClassAppender.asCssStyle(menuItem.getName())));
+ listItem.add(topMenu);
+ List<CssMenuItem> subMenuItems = ServiceActionUtil.withSeparators(menuItem);
+
+// fake data to test multi-level menus
+// if (menuItem.getName().equals("ToDos")) {
+// CssMenuItem fakeItem = menuItem.newSubMenuItem("Fake item").build();
+//
+// fakeItem.newSubMenuItem("Fake item 1").link(new ExternalLink("menuLink", "http://abv.bg")).build();
+// CssMenuItem fakeMenu12 = fakeItem.newSubMenuItem("Fake item 2").link(new ExternalLink("menuLink", "http://google.com")).build();
+//
+// fakeMenu12.newSubMenuItem("Fake item 2.1").link(new ExternalLink("menuLink", "http://web.de")).build();
+// }
+
+ ListView<CssMenuItem> subMenuItemsView = new ListView<CssMenuItem>("subMenuItems", subMenuItems) {
+ @Override
+ protected void populateItem(ListItem<CssMenuItem> listItem) {
+ CssMenuItem subMenuItem = listItem.getModelObject();
+
+ if (subMenuItem.hasSubMenuItems()) {
+ addFolderItem(subMenuItem, listItem);
+ } else {
+
+ final MarkupContainer parent = ServiceActionsPanel.this;
+ ServiceActionUtil.addLeafItem(subMenuItem, listItem, parent);
+
+ }
+ }
+ };
+ topMenu.add(subMenuItemsView);
+ }
+ };
+ add(menuItemsView);
+ }
+
+ private void addFolderItem(CssMenuItem subMenuItem, ListItem<CssMenuItem> listItem) {
+ final MarkupContainer parent = ServiceActionsPanel.this;
+ ServiceActionUtil.addFolderItem(subMenuItem, listItem, parent, ServiceActionUtil.SeparatorStrategy.WITH_SEPARATORS);
+ }
+
+ @Override
+ public void renderHead(IHeaderResponse response) {
+ super.renderHead(response);
+ response.render(CssHeaderItem.forReference(new CssResourceReference(ServiceActionsPanel.class, "ServiceActionsPanel.css")));
+ response.render(JavaScriptHeaderItem.forReference(DropdownAutoOpenJavaScriptReference.instance()));
+ response.render(OnDomReadyHeaderItem.forScript("$('.dropdown-toggle').dropdownHover();"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanelFactory.java
new file mode 100644
index 0000000..43c255f
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanelFactory.java
@@ -0,0 +1,61 @@
+/*
+ * 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.wicket.ui.components.actionmenu.serviceactions;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.viewer.wicket.model.models.ServiceActionsModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+
+/**
+ * {@link ComponentFactory} for a {@link ServiceActionsPanel} to represent the
+ * {@link org.apache.isis.viewer.wicket.model.models.ServiceActionsModel application action}s.
+ */
+public class ServiceActionsPanelFactory extends ComponentFactoryAbstract {
+
+ private final static long serialVersionUID = 1L;
+
+ public ServiceActionsPanelFactory() {
+ super(ComponentType.SERVICE_ACTIONS, ServiceActionsPanel.class);
+ }
+
+ /**
+ * Applies to primary and secondary service action models.
+ */
+ @Override
+ protected ApplicationAdvice appliesTo(final IModel<?> model) {
+ if(!(model instanceof ServiceActionsModel)) {
+ return ApplicationAdvice.DOES_NOT_APPLY;
+ }
+ final ServiceActionsModel serviceActionsModel = (ServiceActionsModel) model;
+ final DomainServiceLayout.MenuBar menuBar = serviceActionsModel.getMenuBar();
+ return appliesIf(menuBar != DomainServiceLayout.MenuBar.TERTIARY && menuBar != null);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final ServiceActionsModel serviceActionsModel = (ServiceActionsModel) model;
+ return new ServiceActionsPanel(id, ServiceActionUtil.buildMenu(serviceActionsModel));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.css
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.css b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.css
new file mode 100644
index 0000000..eaeea17
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.css
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.html
new file mode 100644
index 0000000..8b45fed
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.html
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE html>
+<html xmlns:wicket="http://wicket.apache.org">
+ <body>
+ <wicket:panel>
+
+ <li wicket:id="subMenuItems">
+ <wicket:container wicket:id="content"></wicket:container>
+ </li>
+
+ <li class="divider" wicket:id="divider"></li>
+
+ <li>
+ <a class="menuLink" wicket:id="logoutLink" >
+ <span class="fontAwesomeIcon fa fa-fw fa-sign-out"></span>
+ <span class="menuLinkLabel">
+ <wicket:message key="logoutLabel"></wicket:message>
+ </span>
+ </a>
+ </li>
+
+ <wicket:fragment wicket:id="leafItem">
+ <a class="menuLink" wicket:id="menuLink">
+ <span class="menuLinkLabel" wicket:id="menuLinkLabel"></span>
+ </a>
+ </wicket:fragment>
+
+
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.java
new file mode 100644
index 0000000..c6f112c
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryActionsPanel.java
@@ -0,0 +1,121 @@
+/*
+ * 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.wicket.ui.components.actionmenu.serviceactions;
+
+import java.util.List;
+
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.html.WebComponent;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.request.resource.CssResourceReference;
+
+import org.apache.isis.viewer.wicket.model.models.PageType;
+import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
+
+/**
+ * A panel responsible to render the application actions as menu in a navigation bar.
+ *
+ * <p>
+ * The multi-level sub menu support is borrowed from
+ * <a href="http://bootsnipp.com/snippets/featured/multi-level-dropdown-menu-bs3">Bootsnip</a>
+ * </p>
+ */
+public class TertiaryActionsPanel extends Panel {
+
+ public TertiaryActionsPanel(String id, List<CssMenuItem> menuItems) {
+ super(id);
+ addLogoutLink(this);
+ final List<CssMenuItem> subMenuItems = flatten(menuItems);
+ final ListView<CssMenuItem> subMenuItemsView = new ListView<CssMenuItem>("subMenuItems", subMenuItems) {
+ @Override
+ protected void populateItem(ListItem<CssMenuItem> listItem) {
+ CssMenuItem subMenuItem = listItem.getModelObject();
+ if (subMenuItem.hasSubMenuItems()) {
+ addFolderItem(subMenuItem, listItem);
+ } else {
+ ServiceActionUtil.addLeafItem(subMenuItem, listItem, TertiaryActionsPanel.this);
+ }
+ }
+ };
+
+ WebComponent divider = new WebComponent("divider") {
+ @Override
+ protected void onConfigure() {
+ super.onConfigure();
+
+ subMenuItemsView.configure();
+ setVisible(!subMenuItems.isEmpty());
+ }
+ };
+
+ add(subMenuItemsView, divider);
+ }
+
+ protected List<CssMenuItem> flatten(List<CssMenuItem> menuItems) {
+ List<CssMenuItem> subMenuItems = Lists.newArrayList();
+ for (CssMenuItem menuItem : menuItems) {
+ subMenuItems.addAll(menuItem.getSubMenuItems());
+ }
+ return subMenuItems;
+ }
+
+ private void addLogoutLink(MarkupContainer themeDiv) {
+ Link logoutLink = new Link("logoutLink") {
+
+ @Override
+ public void onClick() {
+ getSession().invalidate();
+ setResponsePage(getSignInPage());
+ }
+ };
+ themeDiv.add(logoutLink);
+ }
+
+ private Class<? extends Page> getSignInPage() {
+ return pageClassRegistry.getPageClass(PageType.SIGN_IN);
+ }
+
+
+ private void addFolderItem(CssMenuItem subMenuItem, ListItem<CssMenuItem> listItem) {
+ final MarkupContainer parent = TertiaryActionsPanel.this;
+ ServiceActionUtil.addFolderItem(subMenuItem, listItem, parent, ServiceActionUtil.SeparatorStrategy.WITHOUT_SEPARATORS);
+ }
+
+ @Override
+ public void renderHead(IHeaderResponse response) {
+ super.renderHead(response);
+ response.render(CssHeaderItem.forReference(new CssResourceReference(TertiaryActionsPanel.class, "TertiaryActionsPanel.css")));
+ }
+
+ /**
+ * {@link com.google.inject.Inject}ed when {@link #init() initialized}.
+ */
+ @Inject
+ private PageClassRegistry pageClassRegistry;
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryMenuPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryMenuPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryMenuPanelFactory.java
new file mode 100644
index 0000000..5d28543
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryMenuPanelFactory.java
@@ -0,0 +1,61 @@
+/*
+ * 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.wicket.ui.components.actionmenu.serviceactions;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.viewer.wicket.model.models.ServiceActionsModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+
+/**
+ * {@link org.apache.isis.viewer.wicket.ui.ComponentFactory} for a {@link org.apache.isis.viewer.wicket.ui.components.actionmenu.serviceactions.ServiceActionsPanel} to represent the
+ * {@link org.apache.isis.viewer.wicket.model.models.ServiceActionsModel application action}s.
+ */
+public class TertiaryMenuPanelFactory extends ComponentFactoryAbstract {
+
+ private final static long serialVersionUID = 1L;
+
+ public TertiaryMenuPanelFactory() {
+ super(ComponentType.SERVICE_ACTIONS, ServiceActionsPanel.class);
+ }
+
+ /**
+ * Applies only to tertiary service action models.
+ */
+ @Override
+ protected ApplicationAdvice appliesTo(final IModel<?> model) {
+ if(!(model instanceof ServiceActionsModel)) {
+ return ApplicationAdvice.DOES_NOT_APPLY;
+ }
+ final ServiceActionsModel serviceActionsModel = (ServiceActionsModel) model;
+ final DomainServiceLayout.MenuBar menuBar = serviceActionsModel.getMenuBar();
+ final boolean applicability = menuBar == DomainServiceLayout.MenuBar.TERTIARY || menuBar == null;
+ return appliesIf(applicability);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final ServiceActionsModel serviceActionsModel = (ServiceActionsModel) model;
+ return new TertiaryActionsPanel(id, ServiceActionUtil.buildMenu(serviceActionsModel));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptHeaderPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptHeaderPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptHeaderPanel.html
new file mode 100644
index 0000000..32f2d35
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptHeaderPanel.html
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org"
+ xml:lang="en"
+ lang="en">
+ <body>
+ <wicket:panel>
+ <div class="iconAndTitle actionPanelHeaderNew">
+ <span wicket:enclosure="entityIconAndTitle"><span wicket:id="entityIconAndTitle">[icon and title]</span> :</span> <span wicket:id="actionName" class="actionName">[action name]</span>
+ </div>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptHeaderPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptHeaderPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptHeaderPanel.java
new file mode 100644
index 0000000..a18f658
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptHeaderPanel.java
@@ -0,0 +1,51 @@
+/*
+ * 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.wicket.ui.components.actionprompt;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.model.AbstractReadOnlyModel;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+/**
+ * A panel used as a title for the action prompts
+ */
+public class ActionPromptHeaderPanel extends PanelAbstract<ActionModel> {
+
+ private static final String ID_ACTION_NAME = "actionName";
+
+ public ActionPromptHeaderPanel(String id, final ActionModel model) {
+ super(id, model);
+
+ ObjectAdapter targetAdapter = model.getTargetAdapter();
+
+ getComponentFactoryRegistry().addOrReplaceComponent(this, ComponentType.ENTITY_ICON_AND_TITLE, new EntityModel(targetAdapter));
+
+ add(new Label(ID_ACTION_NAME, new AbstractReadOnlyModel<String>() {
+ @Override
+ public String getObject() {
+ return model.getActionMemento().getAction().getName();
+ }
+ }));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.html
new file mode 100644
index 0000000..90acad9
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.html
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE html>
+<html xmlns:wicket="http://wicket.apache.org">
+ <head lang="en">
+ <meta charset="UTF-8">
+ <title></title>
+ </head>
+ <body>
+ <wicket:extend>
+ <div wicket:id="content"></div>
+ </wicket:extend>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.java
new file mode 100644
index 0000000..8c0bc85
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionprompt/ActionPromptModalWindow.java
@@ -0,0 +1,60 @@
+/**
+ * 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.wicket.ui.components.actionprompt;
+
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.wicket.ui.components.widgets.bootstrap.ModalDialog;
+
+public class ActionPromptModalWindow extends ModalDialog<Void> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static ActionPromptModalWindow getActionPromptModalWindowIfEnabled(ActionPromptModalWindow modalWindow) {
+ return !isActionPromptModalDialogDisabled() ? modalWindow : null;
+ }
+
+ public static boolean isActionPromptModalDialogDisabled() {
+ return getConfiguration().getBoolean("isis.viewer.wicket.disableModalDialogs", false);
+ }
+
+ private static IsisConfiguration getConfiguration() {
+ return IsisContext.getConfiguration();
+ }
+
+ public static ActionPromptModalWindow newModalWindow(String id) {
+ return new ActionPromptModalWindow(id);
+ }
+
+
+ // //////////////////////////////////////
+
+
+ public ActionPromptModalWindow(String id) {
+ super(id);
+ }
+
+ @Override
+ public void renderHead(IHeaderResponse response) {
+ super.renderHead(response);
+
+ response.render(OnDomReadyHeaderItem.forScript(
+ String.format("Wicket.Event.publish(Isis.Topic.FOCUS_FIRST_ACTION_PARAMETER, '%s')", getMarkupId())));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.html
new file mode 100644
index 0000000..18935b9
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.html
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
+ xml:lang="en"
+ lang="en">
+ <body>
+ <wicket:panel>
+ <div class="actionInfoPanel actionInfoComponentType">
+ <ul>
+ <li>Target: <span wicket:id="target">[target title here]</span></li>
+ <li>Action: <span wicket:id="actionName">[target title here]</span></li>
+ </ul>
+ <br/>
+ </div>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.java
new file mode 100644
index 0000000..11c1436
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.java
@@ -0,0 +1,50 @@
+/*
+ * 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.wicket.ui.components.actions;
+
+import org.apache.wicket.markup.html.basic.Label;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+/**
+ * Renders a panel providing summary information about an action.
+ */
+public class ActionInfoPanel extends PanelAbstract<ActionModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_ACTION_NAME = "actionName";
+ private static final String ID_TARGET = "target";
+
+ public ActionInfoPanel(final String id, final ActionModel actionModel) {
+ super(id, actionModel);
+
+ final ObjectAdapter targetAdapter = getModel().getTargetAdapter();
+ final ObjectAction objectAction = getModel().getActionMemento().getAction();
+
+ // TODO: render instead as links (providing isn't a service; provide a
+ // component for this?)
+ add(new Label(ID_TARGET, targetAdapter.titleString()));
+ add(new Label(ID_ACTION_NAME, objectAction.getName()));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanelFactory.java
new file mode 100644
index 0000000..ffc7094
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanelFactory.java
@@ -0,0 +1,52 @@
+/*
+ * 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.wicket.ui.components.actions;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+
+/**
+ * {@link ComponentFactory} for {@link ActionInfoPanel}.
+ */
+public class ActionInfoPanelFactory extends ComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public ActionInfoPanelFactory() {
+ super(ComponentType.ACTION_INFO, ActionInfoPanel.class);
+ }
+
+ @Override
+ public ApplicationAdvice appliesTo(final IModel<?> model) {
+ return appliesIf(model instanceof ActionModel);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final ActionModel actionModel = (ActionModel) model;
+ return new ActionInfoPanel(id, actionModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.html
new file mode 100644
index 0000000..eb68afd
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.html
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
+ xml:lang="en"
+ lang="en">
+ <body>
+ <wicket:panel>
+ <div class="actionPanel actionComponentType">
+ <div class="myBlockContainer">
+ <div wicket:id="header" class="iconAndTitle panel panel-default actionPanelHeaderNew">
+ <wicket:container wicket:id="entityIconAndTitle">[icon and title]</wicket:container>
+ <h3 wicket:id="actionName" class="actionName">[action name]</h3>
+ </div>
+ <div wicket:id="parameters"></div>
+ </div>
+ </div>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.java
new file mode 100644
index 0000000..ad157b8
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.java
@@ -0,0 +1,341 @@
+/*
+ * 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.wicket.ui.components.actions;
+
+import java.util.List;
+import com.google.common.base.Throwables;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.model.Model;
+import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.applib.services.command.Command.Executor;
+import org.apache.isis.applib.services.command.CommandContext;
+import org.apache.isis.applib.services.exceprecog.ExceptionRecognizer;
+import org.apache.isis.applib.services.exceprecog.ExceptionRecognizerComposite;
+import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+import org.apache.isis.viewer.wicket.model.models.ActionExecutor;
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.model.models.ActionPrompt;
+import org.apache.isis.viewer.wicket.model.models.BookmarkableModel;
+import org.apache.isis.viewer.wicket.model.models.BookmarkedPagesModel;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponse;
+import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseHandlingStrategy;
+import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseType;
+import org.apache.isis.viewer.wicket.ui.pages.BookmarkedPagesModelProvider;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+/**
+ * {@link PanelAbstract Panel} representing an action invocation, backed by an
+ * {@link ActionModel}.
+ *
+ * <p>
+ * Based on the {@link ActionModel.Mode mode}, will render either parameter
+ * dialog or the results.
+ *
+ * <p>
+ * TODO: on results panel, have a button to resubmit?
+ */
+public class ActionPanel extends PanelAbstract<ActionModel> implements ActionExecutor {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_HEADER = "header";
+
+ static final String ID_ACTION_NAME = "actionName";
+
+ private ActionPrompt actionPrompt;
+
+ /**
+ * Gives a chance to hide the header part of this action panel, e.g. when shown in an action prompt
+ */
+ private boolean showHeader = true;
+
+ public ActionPanel(final String id, final ActionModel actionModel) {
+ super(id, actionModel);
+ actionModel.setExecutor(this);
+ buildGui(actionModel);
+ }
+
+ /**
+ * Sets the owning action prompt (modal window), if any.
+ */
+ public void setActionPrompt(ActionPrompt actionPrompt) {
+ this.actionPrompt = actionPrompt;
+ }
+
+ @Override
+ protected void onConfigure() {
+ super.onConfigure();
+
+ buildGui(getModel());
+ }
+
+ private void buildGui(final ActionModel actionModel) {
+ if (actionModel.hasParameters()) {
+ buildGuiForParameters();
+ } else {
+
+ boolean succeeded = executeActionAndProcessResults(null, null);
+ if(succeeded) {
+ // nothing to do
+ } else {
+
+ // render the target entity again
+ //
+ // (One way this can occur is if an event subscriber has a defect and throws an exception; in which case
+ // the EventBus' exception handler will automatically veto. This results in a growl message rather than
+ // an error page, but is probably 'good enough').
+ final ObjectAdapter targetAdapter = actionModel.getTargetAdapter();
+
+ ActionResultResponse resultResponse = ActionResultResponseType.OBJECT.interpretResult(this.getActionModel(), targetAdapter, null);
+ resultResponse.getHandlingStrategy().handleResults(this, resultResponse);
+ }
+ }
+ }
+
+ ActionModel getActionModel() {
+ return super.getModel();
+ }
+
+ public ActionPanel setShowHeader(boolean showHeader) {
+ this.showHeader = showHeader;
+ return this;
+ }
+
+ private void buildGuiForParameters() {
+
+ WebMarkupContainer header = new WebMarkupContainer(ID_HEADER) {
+ @Override
+ protected void onConfigure() {
+ super.onConfigure();
+
+ setVisible(showHeader);
+ }
+ };
+ addOrReplace(header);
+
+ ObjectAdapter targetAdapter = null;
+ try {
+ targetAdapter = getActionModel().getTargetAdapter();
+
+ getComponentFactoryRegistry().addOrReplaceComponent(this, ComponentType.PARAMETERS, getActionModel());
+ getComponentFactoryRegistry().addOrReplaceComponent(header, ComponentType.ENTITY_ICON_AND_TITLE, new EntityModel(targetAdapter));
+
+ final String actionName = getActionModel().getActionMemento().getAction().getName();
+ header.add(new Label(ID_ACTION_NAME, Model.of(actionName)));
+
+ } catch (final ConcurrencyException ex) {
+
+ // second attempt should succeed, because the Oid would have
+ // been updated in the attempt
+ if (targetAdapter == null) {
+ targetAdapter = getModel().getTargetAdapter();
+ }
+
+ // forward onto the target page with the concurrency exception
+ ActionResultResponse resultResponse = ActionResultResponseType.OBJECT.interpretResult(this.getActionModel(), targetAdapter, ex);
+ resultResponse.getHandlingStrategy().handleResults(this, resultResponse);
+
+ getMessageBroker().addWarning(ex.getMessage());
+ }
+ }
+
+ protected void bookmarkPage(BookmarkableModel<?> model) {
+ getBookmarkedPagesModel().bookmarkPage(model);
+ }
+
+ private BookmarkedPagesModel getBookmarkedPagesModel() {
+ BookmarkedPagesModelProvider application = (BookmarkedPagesModelProvider) getSession();
+ return application.getBookmarkedPagesModel();
+ }
+
+
+ /**
+ * @param feedbackForm - for feedback messages.
+ * @return
+ */
+ @Override
+ public boolean executeActionAndProcessResults(AjaxRequestTarget target, Form<?> feedbackForm) {
+
+ permanentlyHide(ComponentType.ENTITY_ICON_AND_TITLE);
+
+ ObjectAdapter targetAdapter = null;
+ try {
+ targetAdapter = getModel().getTargetAdapter();
+
+ // no concurrency exception, so continue...
+ return executeActionOnTargetAndProcessResults(targetAdapter, target, feedbackForm);
+
+ } catch (ConcurrencyException ex) {
+
+ // second attempt should succeed, because the Oid would have
+ // been updated in the attempt
+ if (targetAdapter == null) {
+ targetAdapter = getModel().getTargetAdapter();
+ }
+
+ // forward onto the target page with the concurrency exception
+ ActionResultResponse resultResponse = ActionResultResponseType.OBJECT.interpretResult(this.getActionModel(), targetAdapter, ex);
+ resultResponse.getHandlingStrategy().handleResults(this, resultResponse);
+
+ getMessageBroker().addWarning(ex.getMessage());
+ return false;
+ }
+ }
+
+ /**
+ * @param target
+ * @return whether to clear args or not (they aren't if there was a validation exception)
+ */
+ private boolean executeActionOnTargetAndProcessResults(
+ final ObjectAdapter targetAdapter,
+ final AjaxRequestTarget target,
+ final Form<?> feedbackForm) {
+
+ final ActionModel actionModel = getActionModel();
+
+ // validate the action parameters (if any)
+ final String invalidReasonIfAny = actionModel.getReasonInvalidIfAny();
+
+ if (invalidReasonIfAny != null) {
+ raiseWarning(target, feedbackForm, invalidReasonIfAny);
+ return false;
+ }
+
+ final CommandContext commandContext = getServicesInjector().lookupService(CommandContext.class);
+ final Command command;
+ if (commandContext != null) {
+ command = commandContext.getCommand();
+ command.setExecutor(Executor.USER);
+ } else {
+ command = null;
+ }
+
+
+ // the object store could raise an exception (eg uniqueness constraint)
+ // so we handle it here.
+ try {
+ // could be programmatic flushing, so must include in the try... finally
+ final ObjectAdapter resultAdapter = getActionModel().executeHandlingApplicationExceptions();
+
+ // flush any queued changes, so concurrency or violation exceptions (if any)
+ // will be thrown here
+ getTransactionManager().flushTransaction();
+
+ ActionResultResponse resultResponse = ActionResultResponseType.determineAndInterpretResult(this.getActionModel(), target, resultAdapter);
+ resultResponse.getHandlingStrategy().handleResults(this, resultResponse);
+
+ if (actionModel.isBookmarkable()) {
+ bookmarkPage(actionModel);
+ }
+
+ if(actionPrompt != null) {
+ actionPrompt.closePrompt(target);
+ // cos will be reused next time, so mustn't cache em.
+ actionModel.clearArguments();
+ }
+
+ return true;
+
+ } catch (RuntimeException ex) {
+
+ String message = recognizeException(ex, target, feedbackForm);
+
+ if (message != null) {
+ // no need to add to message broker, should already have been added...
+
+ if(feedbackForm == null) {
+ // forward on instead to void page
+ // (otherwise, we'll have rendered an action parameters page
+ // and so we'll be staying on that page)
+ ActionResultResponseHandlingStrategy.REDIRECT_TO_VOID.handleResults(this, null);
+ }
+
+ return false;
+ }
+
+ // not handled, so capture and propagate
+ if(command != null) {
+ command.setException(Throwables.getStackTraceAsString(ex));
+ }
+
+ throw ex;
+ }
+ }
+
+
+ private String recognizeException(RuntimeException ex, AjaxRequestTarget target, Form<?> feedbackForm) {
+
+ // REVIEW: this code is similar to stuff in EntityPropertiesForm, perhaps move up to superclass?
+ // REVIEW: similar code also in WebRequestCycleForIsis; combine?
+
+ // see if the exception is recognized as being a non-serious error
+ // (nb: similar code in WebRequestCycleForIsis, as a fallback)
+ List<ExceptionRecognizer> exceptionRecognizers = getServicesInjector().lookupServices(ExceptionRecognizer.class);
+ String recognizedErrorIfAny = new ExceptionRecognizerComposite(exceptionRecognizers).recognize(ex);
+ if(recognizedErrorIfAny != null) {
+
+ // recognized
+ raiseWarning(target, feedbackForm, recognizedErrorIfAny);
+
+ getTransactionManager().getTransaction().clearAbortCause();
+
+ // there's no need to abort the transaction, it will have already been done
+ // (in IsisTransactionManager#executeWithinTransaction(...)).
+ }
+ return recognizedErrorIfAny;
+ }
+
+ public void raiseWarning(AjaxRequestTarget target, Form<?> feedbackForm, String error) {
+ if(target != null && feedbackForm != null) {
+ target.add(feedbackForm);
+ feedbackForm.error(error);
+ } else {
+ getMessageBroker().addWarning(error);
+ }
+ }
+
+
+ ///////////////////////////////////////////////////////
+ // Dependencies (from context)
+ ///////////////////////////////////////////////////////
+
+ protected IsisTransactionManager getTransactionManager() {
+ return IsisContext.getTransactionManager();
+ }
+
+ protected ServicesInjector getServicesInjector() {
+ return IsisContext.getPersistenceSession().getServicesInjector();
+ }
+
+ protected MessageBroker getMessageBroker() {
+ return getAuthenticationSession().getMessageBroker();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanelFactory.java
new file mode 100644
index 0000000..30af5e9
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanelFactory.java
@@ -0,0 +1,52 @@
+/*
+ * 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.wicket.ui.components.actions;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+
+/**
+ * {@link ComponentFactory} for {@link ActionPanel}.
+ */
+public class ActionPanelFactory extends ComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public ActionPanelFactory() {
+ super(ComponentType.ACTION_PROMPT, ActionPanel.class);
+ }
+
+ @Override
+ public ApplicationAdvice appliesTo(final IModel<?> model) {
+ return appliesIf(model instanceof ActionModel);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final ActionModel actionModel = (ActionModel) model;
+ return new ActionPanel(id, actionModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.html
new file mode 100644
index 0000000..05eaaec
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.html
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+ <body>
+ <wicket:panel>
+ <div class="actionParametersForm inputForm">
+ <form wicket:id="inputForm" method="post" class="form-horizontal actionParametersForm">
+ <fieldset class="inputFormTable parameters">
+ <div wicket:id="parameters" class="parameter">
+ <div wicket:id="scalarNameAndValue">[scalar]</div>
+ </div>
+ <span wicket:id="feedback"></span>
+ <div class="buttons">
+ <input type="submit" wicket:id="okButton" value="OK" class="ok btn btn-sm btn-primary"/>
+ <input type="submit" wicket:id="cancelButton" value="Cancel" class="cancel btn btn-sm btn-default"/>
+ </div>
+ </fieldset>
+ </form>
+ </div>
+ </wicket:panel>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java
new file mode 100644
index 0000000..8416491
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java
@@ -0,0 +1,260 @@
+/*
+ * 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.wicket.ui.components.actions;
+
+import java.util.List;
+import com.google.common.collect.Lists;
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.repeater.RepeatingView;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.isis.core.commons.ensure.Ensure;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.wicket.model.hints.IsisActionCompletedEvent;
+import org.apache.isis.viewer.wicket.model.mementos.ActionParameterMemento;
+import org.apache.isis.viewer.wicket.model.models.ActionExecutor;
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.model.models.ActionPrompt;
+import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.actionprompt.ActionPromptModalWindow;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarModelSubscriber;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelAbstract;
+import org.apache.isis.viewer.wicket.ui.components.scalars.TextFieldValueModel.ScalarModelProvider;
+import org.apache.isis.viewer.wicket.ui.components.widgets.formcomponent.FormFeedbackPanel;
+import org.apache.isis.viewer.wicket.ui.errors.JGrowlBehaviour;
+import org.apache.isis.viewer.wicket.ui.errors.JGrowlUtil;
+import org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+import static org.hamcrest.CoreMatchers.*;
+
+/**
+ * {@link PanelAbstract Panel} to capture the arguments for an action
+ * invocation.
+ */
+public class ActionParametersFormPanel extends PanelAbstract<ActionModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_OK_BUTTON = "okButton";
+ private static final String ID_CANCEL_BUTTON = "cancelButton";
+ private static final String ID_ACTION_PARAMETERS = "parameters";
+
+ private final ActionExecutor actionExecutor;
+ //private final ActionPrompt actionPromptIfAny;
+
+ public ActionParametersFormPanel(final String id, final ActionModel model) {
+ super(id, model);
+
+ Ensure.ensureThatArg(model.getExecutor(), is(not(nullValue())));
+
+ this.actionExecutor = model.getExecutor();
+ //this.actionPromptIfAny = model.getActionPrompt();
+ buildGui();
+ }
+
+ private void buildGui() {
+ ActionModel model = getModel();
+ // in case previously used, eg prompt displayed then cancelled
+ model.clearArguments();
+
+ add(new ActionParameterForm("inputForm", model));
+ }
+
+ class ActionParameterForm extends Form<ObjectAdapter> implements ScalarModelSubscriber {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_FEEDBACK = "feedback";
+
+ private final List<ScalarPanelAbstract> paramPanels = Lists.newArrayList();
+
+ public ActionParameterForm(final String id, final ActionModel actionModel) {
+ super(id, actionModel);
+
+ setOutputMarkupId(true); // for ajax button
+
+ addParameters();
+
+ FormFeedbackPanel formFeedback = new FormFeedbackPanel(ID_FEEDBACK);
+ addOrReplace(formFeedback);
+ addButtons();
+ }
+
+ private ActionModel getActionModel() {
+ return (ActionModel) super.getModel();
+ }
+
+ private void addParameters() {
+ final ActionModel actionModel = getActionModel();
+ List<ActionParameterMemento> parameterMementos = actionModel.primeArgumentModels();
+
+ final RepeatingView rv = new RepeatingView(ID_ACTION_PARAMETERS);
+ add(rv);
+
+ paramPanels.clear();
+ for (final ActionParameterMemento apm : parameterMementos) {
+ final WebMarkupContainer container = new WebMarkupContainer(rv.newChildId());
+ rv.add(container);
+
+ final ScalarModel argumentModel = actionModel.getArgumentModel(apm);
+ argumentModel.setActionArgsHint(actionModel.getArgumentsAsArray());
+ final Component component = getComponentFactoryRegistry().addOrReplaceComponent(container, ComponentType.SCALAR_NAME_AND_VALUE, argumentModel);
+ final ScalarPanelAbstract paramPanel = component instanceof ScalarPanelAbstract ? (ScalarPanelAbstract) component : null;
+ paramPanels.add(paramPanel);
+ if(paramPanel != null) {
+ paramPanel.setOutputMarkupId(true);
+ paramPanel.notifyOnChange(this);
+ }
+ }
+ }
+
+
+ private void addButtons() {
+ AjaxButton okButton = new AjaxButton(ID_OK_BUTTON, new ResourceModel("okLabel")) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ boolean succeeded = actionExecutor.executeActionAndProcessResults(target, form);
+ if(succeeded) {
+ // the Wicket ajax callbacks will have just started to hide the veil
+ // we now show it once more, so that a veil continues to be shown until the
+ // new page is rendered.
+ target.appendJavaScript("isisShowVeil();\n");
+
+ send(getPage(), Broadcast.EXACT, new IsisActionCompletedEvent(getActionModel(), target, form));
+
+ target.add(form);
+ } else {
+ //if (actionPromptIfAny != null) {
+
+ final StringBuilder builder = new StringBuilder();
+
+ // ensure any jGrowl errors are shown
+ // (normally would be flushed when traverse to next page).
+ String errorMessagesIfAny = JGrowlUtil.asJGrowlCalls(IsisContext.getMessageBroker());
+ builder.append(errorMessagesIfAny);
+
+ // append the JS to the response.
+ String buf = builder.toString();
+ target.appendJavaScript(buf);
+ target.add(form);
+ //}
+ }
+ };
+
+ /**
+ * On validation error
+ */
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ super.onError(target, form);
+ target.add(form);
+ }
+ };
+ okButton.add(new JGrowlBehaviour());
+ setDefaultButton(okButton);
+ add(okButton);
+
+ AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON, new ResourceModel("cancelLabel")) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void onSubmit(final AjaxRequestTarget target, Form<?> form) {
+ final ActionPrompt actionPromptIfAny = ActionPromptProvider.Util.getFrom(ActionParametersFormPanel.this).getActionPrompt();
+ if(actionPromptIfAny != null) {
+ actionPromptIfAny.closePrompt(target);
+ }
+ }
+ };
+ // so can submit with invalid content (eg mandatory params missing)
+ cancelButton.setDefaultFormProcessing(false);
+ add(cancelButton);
+
+ // TODO: hide cancel button if dialogs disabled, as not yet implemented.
+ if(ActionPromptModalWindow.isActionPromptModalDialogDisabled()) {
+ cancelButton.setVisible(false);
+ }
+ }
+
+ @Override
+ public void onUpdate(AjaxRequestTarget target, ScalarModelProvider provider) {
+
+ final ActionModel actionModel = getActionModel();
+
+ final ObjectAdapter[] pendingArguments = actionModel.getArgumentsAsArray();
+
+ try {
+ final ObjectAction action = actionModel.getActionMemento().getAction();
+ final int numParams = action.getParameterCount();
+ for (int i = 0; i < numParams; i++) {
+ final ScalarPanelAbstract paramPanel = paramPanels.get(i);
+ if(paramPanel != null) {
+ // this could throw a ConcurrencyException as we may have to reload the
+ // object adapter of the action in order to compute the choices
+ // (and that object adapter might have changed)
+ if(paramPanel.updateChoices(pendingArguments)) {
+ target.add(paramPanel);
+ }
+ }
+ }
+ } catch(ConcurrencyException ex) {
+
+ // second attempt should succeed, because the Oid would have
+ // been updated in the attempt
+ ObjectAdapter targetAdapter = getActionModel().getTargetAdapter();
+
+ // forward onto the target page with the concurrency exception
+ final EntityPage entityPage = new EntityPage(targetAdapter, ex);
+
+ ActionParametersFormPanel.this.setResponsePage(entityPage);
+
+ getAuthenticationSession().getMessageBroker().addWarning(ex.getMessage());
+ return;
+ }
+
+ // previously this method was also doing:
+ // target.add(this);
+ // ie to update the entire form (in addition to the updates to the individual impacted parameter fields
+ // done in the loop above). However, that logic is wrong, because any values entered in the browser
+ // get trampled over (ISIS-629).
+ }
+
+ @Override
+ public void onError(AjaxRequestTarget target, ScalarModelProvider provider) {
+ if(provider instanceof Component) {
+ // ensure that any feedback error associated with the providing component is shown.
+ target.add((Component)provider);
+ }
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.properties
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.properties b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.properties
new file mode 100644
index 0000000..71edcd9
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.properties
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+okLabel=OK
+cancelLabel=Cancel
+editLabel=Edit
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanelFactory.java
new file mode 100644
index 0000000..bb515d0
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanelFactory.java
@@ -0,0 +1,53 @@
+/*
+ * 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.wicket.ui.components.actions;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.request.resource.CssResourceReference;
+
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+
+/**
+ * {@link ComponentFactory} for {@link ActionParametersFormPanel}.
+ */
+public class ActionParametersFormPanelFactory extends ComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public ActionParametersFormPanelFactory() {
+ super(ComponentType.PARAMETERS, ActionParametersFormPanel.class);
+ }
+
+ @Override
+ public ApplicationAdvice appliesTo(final IModel<?> model) {
+ return appliesIf(model instanceof ActionModel);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final ActionModel actionModel = (ActionModel) model;
+ return new ActionParametersFormPanel(id, actionModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.css
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.css b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.css
new file mode 100644
index 0000000..8a37d5e
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.css
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+.bookmarkedPagesPanel .bookmarkedPagesPanelHolder .bookmarkedPagesList {
+ margin-top:30px;
+}
+
+.bookmarkedPagesPanel .bookmarkedPagesPanelHolder .bookmarkedPageItem {
+ margin-top:10px;
+ margin-bottom:10px;
+}
+
+.bookmarkedPagesPanel .bookmarkedPagesPanelHolder span.bookmarkedPageImageAndTitle:hover {
+ background-color:#FFFFFF;
+}
+
+.bookmarkedPagesPanel .bookmarkedPagesList a img.bookmarkedPageImage {
+ background-color: transparent;
+ width: 16px;
+ height: 16px;
+}
+
+.bookmarkedPagesPanel .bookmarkRibbon {
+ width:10px;
+ margin-top: -120px;
+ height:120px;
+ position:fixed;
+ left:0;
+ top:120px;
+ display:block;
+ cursor:pointer;
+ z-index: 1997;
+ margin-left: 1px;
+ font-weight:bold;
+ border-right:6px solid transparent;
+ border-left:6px solid transparent;
+ border-bottom:6px solid white;
+}
+
+.bookmarkedPagesPanel #bookmarkedPagesSlidingDiv {
+ position:fixed;
+ left:0;
+ top:0;
+ width:500px;
+ z-index: 1998;
+ display: none;
+}
+
+.bookmarkedPagesPanel #bookmarkedPagesSlidingDiv .content {
+ width:490px;
+}
+
+.content>.list-group .list-group-item:first-child {
+ border-top-right-radius: 0;
+ border-top-left-radius: 0;
+}
+.content>.list-group .list-group-item {
+ border-width: 0 0;
+}
+.content>.list-group {
+ margin-bottom: 0;
+}
+.content .list-group-item {
+ border-radius:0;
+ /*background-color: inherit;*/
+}
+
+.content .list-group .list-group {
+ margin: 10px 0 0;
+}
+.content .list-group-item li.list-group-item {margin: 0 -15px;border-top: 1px solid #ddd;border-bottom: 0;padding-left: 30px;}
+.content .list-group-item li.list-group-item:last-child {padding-bottom: 0;}
+
+.content div.list-group div.list-group{margin: 0;}
+.content div.list-group .list-group a.list-group-item {border-top: 1px solid #ddd;border-bottom: 0;padding-left: 30px;}
+#bookmarkedPagesSlidingDiv .panel-group {margin-bottom: 0}
+
+
+ul#bookmarkedPages li.list-group-item.bookmarkDepth0 {
+}
+ul#bookmarkedPages li.list-group-item.bookmarkDepth1 {
+ margin-left: 20px;
+}
+ul#bookmarkedPages li.list-group-item.bookmarkDepth2 {
+ margin-left: 40px;
+}
+ul#bookmarkedPages li.list-group-item.bookmarkDepth3 {
+ margin-left: 60px;
+}
+ul#bookmarkedPages li.list-group-item.bookmarkDepth4 {
+ margin-left: 80px;
+}
+ul#bookmarkedPages li.list-group-item.bookmarkDepth5 {
+ margin-left: 100px;
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.html
new file mode 100644
index 0000000..8df8ad7
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.html
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
+ xml:lang="en"
+ lang="en">
+ <body>
+ <wicket:panel>
+ <div class="bookmarkedPagesPanel">
+ <div class="showPanelTab bookmarkRibbon navbar-inverse"></div>
+ <div id="bookmarkedPagesSlidingDiv">
+ <div class="row">
+ <div class="col-xs-12">
+ <div class="panel-group">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title"><span class="fa fa-fw fa-bookmark"></span> Bookmarks</h4>
+ </div>
+
+ <div class="panel-body" wicket:enclosure="helpText">
+ <span wicket:id="helpText"></span>
+ </div>
+
+ <ul id="bookmarkedPages" class="list-group">
+ <li class="list-group-item">
+ <ul wicket:id="bookmarkList" class="bookmarkedPagesList list-group">
+ <li wicket:id="bookmarkedPageItem" class="bookmarkedPageItem list-group-item">
+ <div>
+ <a href="#" wicket:id="bookmarkedPageLink">
+ <div class="bookmarkedPageImageAndTitle" style="display: inline-block">
+ <img wicket:id="bookmarkedPageImage" class="bookmarkedPageImage"/>
+ <span wicket:id="bookmarkedPageTitle" class="bookmarkedPageTitle">[link title]</span>
+ </div>
+ </a>
+
+ <a href="#" wicket:id="clearBookmarkLink" class="clearBookmarkPlaceHolder pull-right">
+ <span class="fa fa-fw fa-ban text-danger"></span>
+ </a>
+ </div>
+ </li>
+ </ul>
+ </li>
+ </ul>
+
+ <div class="panel-footer" wicket:enclosure="clearBookmarks">
+ <span> </span>
+ <a href="#" wicket:id="clearBookmarks" class="clearBookmarksA btn-link pull-right" title="Clear Bookmarks">
+ <span class="text-danger">Clear all</span>
+ </a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </wicket:panel>
+ </body>
+</html>