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:05 UTC
[14/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/about/AboutPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/AboutPanel.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/AboutPanel.java
deleted file mode 100644
index 68f16fa..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/AboutPanel.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.wicket.ui.components.about;
-
-import java.io.InputStream;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-
-import org.apache.isis.viewer.wicket.model.models.AboutModel;
-import org.apache.isis.viewer.wicket.ui.pages.home.HomePage;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-/**
- * {@link PanelAbstract Panel} displaying welcome message (as used on
- * {@link HomePage}).
- */
-public class AboutPanel extends PanelAbstract<AboutModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_MANIFEST_ATTRIBUTES = "manifestAttributes";
-
- @Inject
- @Named("aboutMessage")
- private String aboutMessage;
-
- /**
- * We take care to read this only once.
- *
- * <p>
- * Is <code>transient</code> because
- * </p>
- */
- @Inject
- @Named("metaInfManifest")
- private transient InputStream metaInfManifestIs;
-
- private JarManifestModel jarManifestModel;
-
- public AboutPanel(final String id) {
- super(id);
-
- if(jarManifestModel == null) {
- jarManifestModel = new JarManifestModel(aboutMessage, metaInfManifestIs);
- }
-
- add(new JarManifestPanel(ID_MANIFEST_ATTRIBUTES, jarManifestModel));
- }
-
-
-}
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/about/AboutPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/AboutPanelFactory.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/AboutPanelFactory.java
deleted file mode 100644
index 3439855..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/AboutPanelFactory.java
+++ /dev/null
@@ -1,50 +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.wicket.ui.components.about;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-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 AboutPanel}.
- */
-public class AboutPanelFactory extends ComponentFactoryAbstract {
-
- private static final long serialVersionUID = 1L;
-
- public AboutPanelFactory() {
- super(ComponentType.ABOUT, AboutPanel.class);
- }
-
- @Override
- public ApplicationAdvice appliesTo(final IModel<?> model) {
- return ApplicationAdvice.APPLIES;
- }
-
- @Override
- public Component createComponent(final String id, final IModel<?> model) {
- return new AboutPanel(id);
- }
-
-
-}
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/about/JarManifestAttributes.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestAttributes.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestAttributes.java
deleted file mode 100644
index fac290c..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestAttributes.java
+++ /dev/null
@@ -1,68 +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.wicket.ui.components.about;
-
-import java.io.Serializable;
-import java.net.URL;
-import java.util.Map.Entry;
-
-public class JarManifestAttributes implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- public static JarManifestAttributes jarName(String jarName) {
- return new JarManifestAttributes(JarManifestAttributes.Type.JAR_NAME, jarName);
- }
-
- public static JarManifestAttributes jarUrl(URL jarUrl) {
- return new JarManifestAttributes(JarManifestAttributes.Type.JAR_URL, jarUrl != null? jarUrl.toExternalForm(): "");
- }
-
- public static JarManifestAttributes attribute(Entry<Object,Object> entry) {
- StringBuilder buf = new StringBuilder();
- buf .append(" ")
- .append(entry.getKey())
- .append(": ")
- .append(entry.getValue())
- .append("\n")
- ;
- return new JarManifestAttributes(JarManifestAttributes.Type.MANIFEST_ATTRIBUTE, buf.toString());
- }
-
- enum Type {
- JAR_NAME,
- JAR_URL,
- MANIFEST_ATTRIBUTE
- }
-
- private final Type type;
- private final String line;
-
- public JarManifestAttributes(Type type, String line) {
- this.type = type;
- this.line = line;
- }
- public JarManifestAttributes.Type getType() {
- return type;
- }
- public String getLine() {
- return line;
- }
-
-}
\ No newline at end of file
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/about/JarManifestListView.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestListView.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestListView.java
deleted file mode 100644
index 1565ac9..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestListView.java
+++ /dev/null
@@ -1,45 +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.wicket.ui.components.about;
-
-import java.util.List;
-
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-
-public final class JarManifestListView extends ListView<JarManifestAttributes> {
-
- private static final long serialVersionUID = 1L;
- private final String idLine;
-
- public JarManifestListView(String id, String idLine, List<? extends JarManifestAttributes> list) {
- super(id, list);
- this.idLine = idLine;
- }
-
- @Override
- protected void populateItem(ListItem<JarManifestAttributes> item) {
- final JarManifestAttributes detail = item.getModelObject();
- Label label = new Label(idLine, detail.getLine());
- item.add(new AttributeAppender("class", detail.getType().name().toLowerCase()));
- item.add(label);
- }
-}
\ No newline at end of file
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/about/JarManifestModel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestModel.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestModel.java
deleted file mode 100644
index d78a290..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestModel.java
+++ /dev/null
@@ -1,233 +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.wicket.ui.components.about;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-
-import com.google.common.base.CharMatcher;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Lists;
-
-import org.apache.isis.core.commons.lang.CloseableExtensions;
-import org.apache.isis.viewer.wicket.model.models.ModelAbstract;
-
-public class JarManifestModel extends ModelAbstract<JarManifestModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final List<String> VERSION_KEY_CANDIDATES = Arrays.asList("Implementation-Version", "Build-Time");
-
- private String aboutMessage;
-
- private final List<JarManifestAttributes> manifests = Lists.newArrayList();
-
- /**
- * @param aboutMessage
- * @param metaInfManifestIs provide using <tt>getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF")</tt>
- */
- public JarManifestModel(String aboutMessage, InputStream metaInfManifestIs) {
-
- this.aboutMessage = aboutMessage;
-
- Manifest manifest;
- try {
- manifest = new Manifest(metaInfManifestIs);
- manifests.add(JarManifestAttributes.jarName("Web archive (war file)"));
- manifests.add(JarManifestAttributes.jarUrl(null));
- addAttributes(manifest, manifests);
-
- // append the version if able to guess
- String versionIfAny = guessVersion(manifest);
- this.aboutMessage = this.aboutMessage + (versionIfAny != null? "\n\n" + versionIfAny: "");
-
- } catch (Exception ex) {
- // ignore
- } finally {
- CloseableExtensions.closeSafely(metaInfManifestIs);
- }
-
- Enumeration<?> resEnum;
- try {
- resEnum = Thread.currentThread().getContextClassLoader().getResources(JarFile.MANIFEST_NAME);
- } catch (IOException e) {
- return;
- }
- final List<JarManifest> jarManifests = Lists.newArrayList();
- while (resEnum.hasMoreElements()) {
- URL url = (URL)resEnum.nextElement();
- JarManifest jarManifest = new JarManifest(url);
- jarManifests.add(jarManifest);
-
- InputStream is = null;
- try {
- is = url.openStream();
- if (is != null) {
- manifest = new Manifest(is);
- jarManifest.addAttributesFrom(manifest);
- }
- } catch(Exception e3) {
- // ignore
- } finally {
- CloseableExtensions.closeSafely(is);
- }
- }
-
- Collections.sort(jarManifests);
-
- for (JarManifest jarManifest : jarManifests) {
- jarManifest.addAttributesTo(manifests);
- }
- }
-
- private static class JarManifest implements Comparable<JarManifest> {
- private final List<JarManifestAttributes> attributes = Lists.newArrayList();
-
- private final URL url;
-
- private JarName jarName;
-
- public JarManifest(URL url) {
- this.url = url;
- jarName = asJarName(url);
- }
-
- void addAttributesFrom(Manifest manifest) {
- addAttributes(manifest, attributes);
- }
-
- void addAttributesTo(List<JarManifestAttributes> manifests) {
- manifests.add(JarManifestAttributes.jarName(jarName.name));
- manifests.add(JarManifestAttributes.jarUrl(url));
- manifests.addAll(attributes);
- }
-
- @Override
- public int compareTo(JarManifest o) {
- return jarName.compareTo(o.jarName);
- }
- }
-
- static class JarName implements Comparable<JarName>{
- enum Type {
- CLASSES, JAR, OTHER
- }
- Type type;
- String name;
- JarName(Type type, String name) {
- this.type = type;
- this.name = name;
- }
- @Override
- public int compareTo(JarName o) {
- int x = type.compareTo(o.type);
- if(x != 0) return x;
- return name.compareTo(o.name);
- }
- }
-
- private static JarName asJarName(URL url) {
- final String path = url.getPath();
- // strip off the meta-inf
- String strippedPath = stripSuffix(path, "/META-INF/MANIFEST.MF");
- strippedPath = stripSuffix(strippedPath, "!");
-
- // split the path into parts, and reverse
- List<String> parts = Lists.newArrayList(Splitter.on(CharMatcher.anyOf("/\\")).split(strippedPath));
- Collections.reverse(parts);
-
- // searching from the end, return the jar name if possible
- for (String part : parts) {
- if(part.endsWith(".jar")) {
- return new JarName(JarName.Type.JAR, part);
- }
- }
-
- // see if running in an IDE, under target*/classes; return the part prior to that.
- if(parts.size()>=3) {
- if(parts.get(0).equals("classes") && parts.get(1).startsWith("target")) {
- return new JarName(JarName.Type.CLASSES, parts.get(2));
- }
- }
-
- // otherwise, return the stripped path
- return new JarName(JarName.Type.OTHER, strippedPath);
- }
-
- public static String stripSuffix(String path, String suffix) {
- int indexOf = path.indexOf(suffix);
- if(indexOf != -1) {
- path = path.substring(0, indexOf);
- }
- return path;
- }
-
- static void addAttributes(Manifest manifest, List<JarManifestAttributes> attributes) {
- final Attributes mainAttribs = manifest.getMainAttributes();
- Set<Entry<Object, Object>> entrySet = mainAttribs.entrySet();
- for (Entry<Object, Object> entry : entrySet) {
- JarManifestAttributes attribute = JarManifestAttributes.attribute(entry);
- attributes.add(attribute);
- }
- }
-
-
- private static String guessVersion(Manifest manifest) {
- final Attributes mainAttribs = manifest.getMainAttributes();
- Set<Entry<Object, Object>> entrySet = mainAttribs.entrySet();
- for (String candidate : VERSION_KEY_CANDIDATES) {
- for (Entry<Object, Object> entry : entrySet) {
- if(candidate.equals(entry.getKey().toString())) {
- return entry.getValue().toString();
- }
- }
- }
- return null;
- }
-
-
- @Override
- protected JarManifestModel load() {
- return this;
- }
-
- @Override
- public void setObject(JarManifestModel ex) {
- // no-op
- }
-
- public String getAboutMessage() {
- return aboutMessage;
- }
-
- public List<JarManifestAttributes> getDetail() {
- return manifests;
- }
-
-}
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/about/JarManifestPanel.css
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestPanel.css b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestPanel.css
deleted file mode 100644
index 2f05abd..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestPanel.css
+++ /dev/null
@@ -1,91 +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.
- */
-
- .jarManifestPanel .aboutInfo {
- margin-left: 50px;
- margin-right: 50px;
- padding-top: 50px;
-}
-
-
-.jarManifestPanel .aboutMessage {
- background:#FFFFFF;
- border-radius:4px;
- -moz-border-radius:4px;
- -webkit-border-radius:4px;
- padding: 15px;
- display: block;
- text-align:center;
- font-size:1.2em;
-}
-
- .jarManifestPanel .manifestAttributes {
- margin-top: 30px;
-}
-
-.jarManifestPanel .heading {
- display:block;
- font-style:normal !important;
-
- padding:1px 6px 1px 6px;
-}
-
-.jarManifestPanel .heading span {
- display:block;
- font-style:normal !important;
- padding:3px 3px 3px 3px;
- font-size: 0.8em;
- font-weight:bold;
-}
-
-.jarManifestPanel .heading:hover {
- background-color:#FFFFFF;
- cursor: pointer;
-}
-
-.jarManifestPanel h3 {
- font-size: larger;
-}
-
-.jarManifestPanel .manifestAttributesList .caused_by_label {
- margin-top: 30px;
- font-style:normal !important;
- font-size: 0.8em;
- font-weight:bold;
- color: #46423C;
-}
-
-.jarManifestPanel .manifestAttributesList .jar_name {
- margin-top: 15px;
- font-size: 1.2em;
- font-weight:bold;
- color: #46423C;
-}
-
-.jarManifestPanel .manifestAttributesList .jar_url {
- margin-top: 10px;
- margin-bottom: 10px;
- font-style: italic;
- font-size: 1.0em;
- color: #00477F;
-}
-
-.jarManifestPanel .manifestAttributesList .manifest_attribute{
- margin-left: 30px;
-}
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/about/JarManifestPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestPanel.html b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestPanel.html
deleted file mode 100644
index 340922a..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestPanel.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html>
-<!--
- 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="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="jarManifestPanel">
- <div class="aboutInfo clear">
- <h2 wicket:id="aboutMessage" class="aboutMessage">[about message text]</h2>
- <div class="manifestAttributes" wicket:id="manifestAttributes">
- <h4 class="heading well">Jar manifest attributes</h4>
- <div class="content">
- <div class="manifestAttributesList">
- <ul>
- <li wicket:id="manifestAttribute">
- <span wicket:id="manifestAttributeLine">[manifest attribute line]</span>
- </li>
- </ul>
- </div>
- </div>
- </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/about/JarManifestPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestPanel.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestPanel.java
deleted file mode 100644
index 8a76487..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/JarManifestPanel.java
+++ /dev/null
@@ -1,68 +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.wicket.ui.components.about;
-
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptReferenceHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.request.resource.JavaScriptResourceReference;
-import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
-
-public class JarManifestPanel extends Panel {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_ABOUT_MESSAGE = "aboutMessage";
-
- private static final String ID_MANIFEST_ATTRIBUTES = "manifestAttributes";
-
- private static final String ID_MANIFEST_ATTRIBUTE = "manifestAttribute";
- private static final String ID_LINE = "manifestAttributeLine";
-
- private static final JavaScriptResourceReference DIV_TOGGLE_JS = new JavaScriptResourceReference(JarManifestPanel.class, "div-toggle.js");
-
- public JarManifestPanel(String id, JarManifestModel manifestModel) {
- super(id, manifestModel);
-
- final String aboutMessage = manifestModel.getAboutMessage();
- final Label label = new Label(ID_ABOUT_MESSAGE, aboutMessage);
- // safe to not escape, about message is read from file (part of deployed WAR)
- label.setEscapeModelStrings(false);
- add(label);
-
- MarkupContainer container = new WebMarkupContainer(ID_MANIFEST_ATTRIBUTES) {
- private static final long serialVersionUID = 1L;
- @Override
- public void renderHead(IHeaderResponse response) {
- response.render(JavaScriptReferenceHeaderItem.forReference(DIV_TOGGLE_JS));
- }
- };
- container.add(new JarManifestListView(ID_MANIFEST_ATTRIBUTE, JarManifestPanel.ID_LINE, manifestModel.getDetail()));
- add(container);
- }
-
- public void renderHead(final IHeaderResponse response) {
- PanelUtil.renderHead(response, this.getClass());
- }
-
-}
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/about/div-toggle.js
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/div-toggle.js b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/div-toggle.js
deleted file mode 100644
index d51175a..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/div-toggle.js
+++ /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.
- */
-jQuery(document).ready(function() {
- jQuery(".jarManifestPanel .content").hide();
- jQuery(".jarManifestPanel .heading").click(function()
- {
- jQuery(this).next(".jarManifestPanel .content").slideToggle(500);
- });
-});
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/actionlink/ActionLinkPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionlink/ActionLinkPanel.html b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionlink/ActionLinkPanel.html
deleted file mode 100644
index e239527..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionlink/ActionLinkPanel.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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>
- <span wicket:id="actionLinkWrapper" class="actionLinkPanel actionLinkComponentType">
- <a href="#" wicket:id="actionLink">
- <span wicket:id="actionTitle" class="actionTitle">[action title]</span>
- </a>
- </span>
- </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/actionlink/ActionLinkPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionlink/ActionLinkPanel.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionlink/ActionLinkPanel.java
deleted file mode 100644
index 0b81418..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionlink/ActionLinkPanel.java
+++ /dev/null
@@ -1,101 +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.wicket.ui.components.actionlink;
-
-import org.apache.wicket.Page;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-import org.apache.isis.viewer.wicket.model.models.ActionModel;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.model.models.PageType;
-import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
-import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistryAccessor;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-import org.apache.isis.viewer.wicket.ui.util.Links;
-
-/**
- * {@link PanelAbstract Panel} representing the icon and title of an entity,
- * as per the provided {@link EntityModel}.
- */
-public class ActionLinkPanel extends PanelAbstract<ActionModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_ACTION_LINK_WRAPPER = "actionLinkWrapper";
- private static final String ID_ACTION_LINK = "actionLink";
- private static final String ID_ACTION_TITLE = "actionTitle";
-
- private Label label;
-
- public ActionLinkPanel(final String id, final ActionModel actionModel) {
- super(id, actionModel);
- }
-
- @Override
- protected void onBeforeRender() {
- buildGui();
- super.onBeforeRender();
- }
-
- private void buildGui() {
- addOrReplaceLinkWrapper();
- }
-
- private void addOrReplaceLinkWrapper() {
- final WebMarkupContainer entityLinkWrapper = addOrReplaceLinkWrapper(getModel());
- addOrReplace(entityLinkWrapper);
- }
-
- private WebMarkupContainer addOrReplaceLinkWrapper(final ActionModel actionModel) {
-
- final PageParameters pageParameters = actionModel.getPageParameters();
- final Class<? extends Page> pageClass = getPageClassRegistry().getPageClass(PageType.ACTION_PROMPT);
- final AbstractLink link = newLink(ID_ACTION_LINK, pageClass, pageParameters);
-
- label = new Label(ID_ACTION_TITLE, determineTitle());
- link.add(label);
-
- final WebMarkupContainer actionLinkWrapper = new WebMarkupContainer(ID_ACTION_LINK_WRAPPER);
- actionLinkWrapper.addOrReplace(link);
- return actionLinkWrapper;
- }
-
- private String determineTitle() {
- return getModel().getActionMemento().getAction().getId();
- }
-
- private AbstractLink newLink(final String linkId, final Class<? extends Page> pageClass, final PageParameters pageParameters) {
- return Links.newBookmarkablePageLink(linkId, pageParameters, pageClass);
- }
-
-
- // ///////////////////////////////////////////////////////////////////
- // Convenience
- // ///////////////////////////////////////////////////////////////////
-
- protected PageClassRegistry getPageClassRegistry() {
- final PageClassRegistryAccessor pcra = (PageClassRegistryAccessor) getApplication();
- return pcra.getPageClassRegistry();
- }
-
-}
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/actionlink/ActionLinkPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionlink/ActionLinkPanelFactory.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionlink/ActionLinkPanelFactory.java
deleted file mode 100644
index f36ac36..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionlink/ActionLinkPanelFactory.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.wicket.ui.components.actionlink;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-
-import org.apache.isis.applib.annotation.ActionSemantics;
-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 ActionLinkPanel}.
- */
-public class ActionLinkPanelFactory extends ComponentFactoryAbstract {
-
- private static final long serialVersionUID = 1L;
-
- public ActionLinkPanelFactory() {
- super(ComponentType.ACTION_LINK, ActionLinkPanel.class);
- }
-
- @Override
- protected ApplicationAdvice appliesTo(IModel<?> model) {
- if(!(model instanceof ActionModel)) {
- return ApplicationAdvice.DOES_NOT_APPLY;
- }
- final ActionModel actionModel = (ActionModel) model;
- final ActionSemantics.Of semantics = actionModel.getActionMemento().getAction().getSemantics();
- return ApplicationAdvice.appliesIf(semantics.isSafeInNature());
- }
-
- @Override
- public Component createComponent(final String id, final IModel<?> model) {
- final ActionModel actionModel = (ActionModel) model;
- return new ActionLinkPanel(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/actionmenu/CssClassFaBehavior.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/CssClassFaBehavior.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/CssClassFaBehavior.java
deleted file mode 100644
index 58294c9..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/CssClassFaBehavior.java
+++ /dev/null
@@ -1,54 +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.wicket.ui.components.actionmenu;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.isis.core.metamodel.facets.members.cssclassfa.CssClassFaPosition;
-
-/**
- * A behavior that prepends or appends the markup needed to show a Font Awesome icon
- * for a LinkAndLabel
- */
-public class CssClassFaBehavior extends Behavior {
-
- private final String cssClassFa;
- private final CssClassFaPosition position;
-
- public CssClassFaBehavior(final String cssClassFa, final CssClassFaPosition position) {
- this.cssClassFa = cssClassFa;
- this.position = position;
- }
-
- @Override
- public void beforeRender(final Component component) {
- super.beforeRender(component);
- if (position == null || CssClassFaPosition.LEFT == position) {
- component.getResponse().write("<span class=\""+cssClassFa+" fontAwesomeIcon\"></span>");
- }
- }
-
- @Override
- public void afterRender(final Component component) {
- if (CssClassFaPosition.RIGHT == position) {
- component.getResponse().write("<span class=\""+cssClassFa+" fontAwesomeIcon\"></span>");
- }
- super.afterRender(component);
- }
-}
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/entityactions/AdditionalLinksAsDropDownPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksAsDropDownPanel.html b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksAsDropDownPanel.html
deleted file mode 100644
index a240cce..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksAsDropDownPanel.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<?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 wicket:id="additionalLinkList" class="additionalLinkList additionalLinkListDropDown">
- <div class="btn-group">
- <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
- <span class="fa fa-ellipsis-v"></span>
- </button>
- <ul class="dropdown-menu dropdown-menu-right" role="menu">
- <li wicket:id="additionalLinkItem" class="additionalLinkItem">
- <a href="#" wicket:id="additionalLink">
- <span wicket:id="additionalLinkTitle" class="additionalLinkItem">[link title]</span>
- </a>
- </li>
- </ul>
- </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/actionmenu/entityactions/AdditionalLinksAsDropDownPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksAsDropDownPanel.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksAsDropDownPanel.java
deleted file mode 100644
index 9b5d793..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksAsDropDownPanel.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.wicket.ui.components.actionmenu.entityactions;
-
-import java.util.List;
-import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
-
-public class AdditionalLinksAsDropDownPanel extends AdditionalLinksPanel {
-
- private static final long serialVersionUID = 1L;
-
- public AdditionalLinksAsDropDownPanel(String id, List<LinkAndLabel> links) {
- super(id, links);
- }
-}
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/entityactions/AdditionalLinksAsListInlinePanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksAsListInlinePanel.html b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksAsListInlinePanel.html
deleted file mode 100644
index 7cc41f1..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksAsListInlinePanel.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<?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>
- <ul wicket:id="additionalLinkList" class="additionalLinkList additionalLinkListInline list-unstyled list-inline">
- <li wicket:id="additionalLinkItem" class="additionalLinkItem">
- <a href="#" wicket:id="additionalLink" class="btn btn-sm btn-default">
- <span wicket:id="additionalLinkTitle" class="additionalLinkItem">[link title]</span>
- </a>
- </li>
- </ul>
- </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/entityactions/AdditionalLinksAsListInlinePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksAsListInlinePanel.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksAsListInlinePanel.java
deleted file mode 100644
index 049c1a6..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksAsListInlinePanel.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.wicket.ui.components.actionmenu.entityactions;
-
-import java.util.List;
-import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
-
-public class AdditionalLinksAsListInlinePanel extends AdditionalLinksPanel {
-
- private static final long serialVersionUID = 1L;
-
- public AdditionalLinksAsListInlinePanel(String id, List<LinkAndLabel> links) {
- super(id, links);
- }
-}
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/entityactions/AdditionalLinksPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksPanel.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksPanel.java
deleted file mode 100644
index d80374a..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksPanel.java
+++ /dev/null
@@ -1,146 +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.wicket.ui.components.actionmenu.entityactions;
-
-import java.util.List;
-import com.google.common.base.Strings;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.isis.core.metamodel.facets.members.cssclassfa.CssClassFaPosition;
-import org.apache.isis.core.commons.lang.StringExtensions;
-import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
-import org.apache.isis.viewer.wicket.model.links.ListOfLinksModel;
-import org.apache.isis.viewer.wicket.ui.components.actionmenu.CssClassFaBehavior;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-import org.apache.isis.viewer.wicket.ui.util.Components;
-import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
-
-public class AdditionalLinksPanel extends PanelAbstract<ListOfLinksModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_ADDITIONAL_LINK_LIST = "additionalLinkList";
- private static final String ID_ADDITIONAL_LINK_ITEM = "additionalLinkItem";
- private static final String ID_ADDITIONAL_LINK_TITLE = "additionalLinkTitle";
-
- public static final String ID_ADDITIONAL_LINK = "additionalLink";
-
- public enum Style {
- INLINE_LIST {
- @Override
- AdditionalLinksPanel newPanel(String id, List<LinkAndLabel> links) {
- return new AdditionalLinksAsListInlinePanel(id, links);
- }
- },
- DROPDOWN {
- @Override
- AdditionalLinksPanel newPanel(String id, List<LinkAndLabel> links) {
- return new AdditionalLinksAsDropDownPanel(id, links);
- }
- };
- abstract AdditionalLinksPanel newPanel(String id, List<LinkAndLabel> links);
- }
-
- public static AdditionalLinksPanel addAdditionalLinks(
- final MarkupContainer markupContainer,
- final String id,
- final List<LinkAndLabel> links,
- final Style style) {
- if(links.isEmpty()) {
- Components.permanentlyHide(markupContainer, id);
- return null;
- }
-
- final AdditionalLinksPanel additionalLinksPanel = style.newPanel(id, links);
- markupContainer.addOrReplace(additionalLinksPanel);
- return additionalLinksPanel;
- }
-
-
- private List<LinkAndLabel> linkAndLabels;
-
- protected AdditionalLinksPanel(final String id, final List<LinkAndLabel> links) {
- super(id, new ListOfLinksModel(links));
-
- this.linkAndLabels = getModel().getObject();
-
- final WebMarkupContainer container = new WebMarkupContainer(ID_ADDITIONAL_LINK_LIST);
- addOrReplace(container);
-
- container.setOutputMarkupId(true);
-
- setOutputMarkupId(true);
-
- final ListView<LinkAndLabel> listView = new ListView<LinkAndLabel>(ID_ADDITIONAL_LINK_ITEM, this.linkAndLabels) {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void populateItem(ListItem<LinkAndLabel> item) {
- final LinkAndLabel linkAndLabel = item.getModelObject();
-
- final AbstractLink link = linkAndLabel.getLink();
-
- final String itemTitle = first(linkAndLabel.getDisabledReasonIfAny(), linkAndLabel.getDescriptionIfAny());
- if(itemTitle != null) {
- item.add(new AttributeAppender("title", itemTitle));
- }
-
- final Label viewTitleLabel = new Label(ID_ADDITIONAL_LINK_TITLE, linkAndLabel.getLabel());
- if(linkAndLabel.isBlobOrClob()) {
- link.add(new CssClassAppender("noVeil"));
- }
- if(linkAndLabel.isPrototype()) {
- link.add(new CssClassAppender("prototype"));
- }
- link.add(new CssClassAppender(linkAndLabel.getActionIdentifier()));
-
- final String cssClass = linkAndLabel.getCssClass();
- CssClassAppender.appendCssClassTo(link, cssClass);
-
- viewTitleLabel.add(new CssClassAppender(StringExtensions.asLowerDashed(linkAndLabel.getLabel())));
-
- link.addOrReplace(viewTitleLabel);
-
- final String cssClassFa = linkAndLabel.getCssClassFa();
- if(!Strings.isNullOrEmpty(cssClassFa)) {
- final CssClassFaPosition position = linkAndLabel.getCssClassFaPosition();
- viewTitleLabel.add(new CssClassFaBehavior(cssClassFa, position));
- }
-
- item.addOrReplace(link);
- }
- };
- container.addOrReplace(listView);
- }
-
- private static String first(String... str) {
- for (String s : str) {
- if(s != null) return s;
- }
- return null;
- }
-
-}
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/entityactions/EntityActionLinkFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/EntityActionLinkFactory.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/EntityActionLinkFactory.java
deleted file mode 100644
index 67ebf38..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/EntityActionLinkFactory.java
+++ /dev/null
@@ -1,95 +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.wicket.ui.components.actionmenu.entityactions;
-
-import org.apache.wicket.markup.html.link.AbstractLink;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
-import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-import org.apache.isis.viewer.wicket.model.models.*;
-import org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLinkFactoryAbstract;
-
-public final class EntityActionLinkFactory extends ActionLinkFactoryAbstract {
-
- private static final long serialVersionUID = 1L;
-
- @SuppressWarnings("unused")
- private final EntityModel entityModel;
-
- public EntityActionLinkFactory(final EntityModel entityModel) {
- this.entityModel = entityModel;
- }
-
- @Override
- public LinkAndLabel newLink(
- final ObjectAdapterMemento adapterMemento,
- final ObjectAction action,
- final String linkId) {
-
- final ObjectAdapter objectAdapter = adapterMemento.getObjectAdapter(ConcurrencyChecking.NO_CHECK);
-
- final Boolean persistent = objectAdapter.representsPersistent();
- if (!persistent) {
- throw new IllegalArgumentException("Object '" + objectAdapter.titleString(null) + "' is not persistent.");
- }
-
- // check visibility and whether enabled
- final AuthenticationSession session = getAuthenticationSession();
-
- final Consent visibility = action.isVisible(session, objectAdapter, Where.OBJECT_FORMS);
- if (visibility.isVetoed()) {
- return null;
- }
-
-
- final AbstractLink link = newLink(linkId, objectAdapter, action);
-
- final Consent usability = action.isUsable(session, objectAdapter, Where.OBJECT_FORMS);
- final String disabledReasonIfAny = usability.getReason();
- if(disabledReasonIfAny != null) {
- link.setEnabled(false);
- }
-
- return newLinkAndLabel(objectAdapter, action, link, disabledReasonIfAny);
- }
-
-
-
- // ///////////////////////////////////////////////////////////////////
- // Dependencies (from IsisContext)
- // ///////////////////////////////////////////////////////////////////
-
- protected PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
- protected AuthenticationSession getAuthenticationSession() {
- return IsisContext.getAuthenticationSession();
- }
-
-}
\ No newline at end of file
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/entityactions/EntityActionUtil.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/EntityActionUtil.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/EntityActionUtil.java
deleted file mode 100644
index c987980..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/EntityActionUtil.java
+++ /dev/null
@@ -1,174 +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.wicket.ui.components.actionmenu.entityactions;
-
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-import org.apache.wicket.Session;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.filter.Filter;
-import org.apache.isis.applib.filter.Filters;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
-import org.apache.isis.core.metamodel.facets.members.order.MemberOrderFacet;
-import org.apache.isis.core.metamodel.layout.memberorderfacet.MemberOrderFacetComparator;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
-import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.model.models.ScalarModel;
-import org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLinkFactory;
-
-public final class EntityActionUtil {
-
- private EntityActionUtil(){}
-
- private final static MemberOrderFacetComparator memberOrderFacetComparator = new MemberOrderFacetComparator(false);
-
- public static List<LinkAndLabel> getEntityActionLinksForAssociation(
- final ScalarModel scalarModel,
- final DeploymentType deploymentType) {
- final List<LinkAndLabel> entityActions = Lists.newArrayList();
-
- if (scalarModel.getKind() != ScalarModel.Kind.PROPERTY) {
- return entityActions;
- } else {
- final ObjectAdapterMemento parentMemento = scalarModel.getParentObjectAdapterMemento();
- final EntityModel parentEntityModel = new EntityModel(parentMemento);
- final OneToOneAssociation oneToOneAssociation = scalarModel.getPropertyMemento().getProperty();
-
- final List<ObjectAction> associatedActions = getObjectActionsForAssociation(parentEntityModel, oneToOneAssociation, deploymentType);
-
- entityActions.addAll(asLinkAndLabelsForAdditionalLinksPanel(parentEntityModel, associatedActions));
- return entityActions;
- }
- }
-
- public static List<ObjectAction> getObjectActionsForAssociation(
- final EntityModel entityModel,
- final ObjectAssociation association,
- final DeploymentType deploymentType) {
- final List<ObjectAction> associatedActions = Lists.newArrayList();
-
- addActions(ActionType.USER, entityModel, association, associatedActions);
- if(deploymentType.isPrototyping()) {
- addActions(ActionType.EXPLORATION, entityModel, association, associatedActions);
- addActions(ActionType.PROTOTYPE, entityModel, association, associatedActions);
- }
-
- Collections.sort(associatedActions, new Comparator<ObjectAction>() {
-
- @Override
- public int compare(ObjectAction o1, ObjectAction o2) {
- final MemberOrderFacet m1 = o1.getFacet(MemberOrderFacet.class);
- final MemberOrderFacet m2 = o2.getFacet(MemberOrderFacet.class);
- return memberOrderFacetComparator.compare(m1, m2);
- }
- });
- return associatedActions;
- }
-
- /**
- * Converts an {@link org.apache.isis.viewer.wicket.model.models.EntityModel} and a (subset of its) {@link org.apache.isis.core.metamodel.spec.feature.ObjectAction}s into a
- * list of {@link org.apache.isis.viewer.wicket.model.links.LinkAndLabel}s intended to be apassed
- * to the {@link AdditionalLinksPanel}.
- */
- public static List<LinkAndLabel> asLinkAndLabelsForAdditionalLinksPanel(
- final EntityModel entityModel,
- final List<ObjectAction> actions) {
-
- final String linkId = AdditionalLinksPanel.ID_ADDITIONAL_LINK;
- final ActionLinkFactory linkFactory = new EntityActionLinkFactory(entityModel);
-
- final ObjectAdapterMemento adapterMemento = entityModel.getObjectAdapterMemento();
- return Lists.transform(actions, new Function<ObjectAction, LinkAndLabel>() {
-
- @Override
- public LinkAndLabel apply(ObjectAction objectAction) {
- return linkFactory.newLink(adapterMemento, objectAction, linkId);
- }
- });
- }
-
- private static List<ObjectAction> addActions(
- final ActionType type,
- final EntityModel entityModel,
- final ObjectAssociation association,
- final List<ObjectAction> associatedActions) {
- final ObjectSpecification adapterSpec = entityModel.getTypeOfSpecification();
- final ObjectAdapter adapter = entityModel.load(ConcurrencyChecking.NO_CHECK);
-
- final AuthenticationSessionProvider asa = (AuthenticationSessionProvider) Session.get();
- AuthenticationSession authSession = asa.getAuthenticationSession();
-
- final ObjectSpecification objectSpecification = entityModel.getTypeOfSpecification();
- @SuppressWarnings({ "unchecked", "deprecation" })
- Filter<ObjectAction> filter = Filters.and(
- ObjectAction.Filters.memberOrderOf(association),
- ObjectAction.Filters.dynamicallyVisible(authSession, adapter, Where.ANYWHERE),
- ObjectAction.Filters.notBulkOnly(),
- ObjectAction.Filters.excludeWizardActions(objectSpecification));
-
- final List<ObjectAction> userActions = adapterSpec.getObjectActions(type, Contributed.INCLUDED, filter);
- associatedActions.addAll(userActions);
- return userActions;
- }
-
-
- public static void addTopLevelActions(
- final ObjectAdapter adapter,
- final ActionType actionType,
- final List<ObjectAction> topLevelActions,
- final AuthenticationSession authenticationSession) {
-
- final ObjectSpecification adapterSpec = adapter.getSpecification();
-
- @SuppressWarnings({ "unchecked", "deprecation" })
- Filter<ObjectAction> filter = Filters.and(
- ObjectAction.Filters.memberOrderNotAssociationOf(adapterSpec),
- ObjectAction.Filters.dynamicallyVisible(authenticationSession, adapter, Where.ANYWHERE),
- ObjectAction.Filters.notBulkOnly(),
- ObjectAction.Filters.excludeWizardActions(adapterSpec));
-
- final List<ObjectAction> userActions = adapterSpec.getObjectActions(actionType, Contributed.INCLUDED, filter);
- topLevelActions.addAll(userActions);
- }
-
- public static List<ObjectAction> getTopLevelActions(final ObjectAdapter adapter, final DeploymentType deploymentType, final AuthenticationSession authenticationSession) {
- final List<ObjectAction> topLevelActions = Lists.newArrayList();
-
- addTopLevelActions(adapter, ActionType.USER, topLevelActions, authenticationSession);
- if(deploymentType.isPrototyping()) {
- addTopLevelActions(adapter, ActionType.EXPLORATION, topLevelActions, authenticationSession);
- addTopLevelActions(adapter, ActionType.PROTOTYPE, topLevelActions, authenticationSession);
- }
- return topLevelActions;
- }
-}
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/CssMenuItem.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/CssMenuItem.java b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/CssMenuItem.java
deleted file mode 100644
index f6d847b..0000000
--- a/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/CssMenuItem.java
+++ /dev/null
@@ -1,450 +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.wicket.ui.components.actionmenu.serviceactions;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.List;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.Page;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.SubmitLink;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.model.Model;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.ensure.Ensure;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
-import org.apache.isis.core.metamodel.facets.members.cssclassfa.CssClassFaPosition;
-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.links.LinkAndLabel;
-import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-import org.apache.isis.viewer.wicket.model.models.ActionModel;
-import org.apache.isis.viewer.wicket.ui.components.actionmenu.CssClassFaBehavior;
-import org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLinkFactory;
-import org.apache.isis.viewer.wicket.ui.pages.PageAbstract;
-import org.apache.isis.viewer.wicket.ui.util.Components;
-import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
-
-import static org.hamcrest.CoreMatchers.is;
-
-class CssMenuItem implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- public static final String ID_MENU_LINK = "menuLink";
-
- public static class Builder {
- private final CssMenuItem cssMenuItem;
-
- private Builder(final String name) {
- cssMenuItem = new CssMenuItem(name);
- }
-
- public Builder parent(final CssMenuItem parent) {
- cssMenuItem.setParent(parent);
- return this;
- }
-
- public <T extends Page> Builder link() {
- final AbstractLink link = new SubmitLink(ID_MENU_LINK);
- return link(link);
- }
-
- public <T extends Page> Builder link(final AbstractLink link) {
- Ensure.ensureThatArg(link.getId(), is(ID_MENU_LINK));
- cssMenuItem.setLink(link);
- return this;
- }
-
- public <T extends Page> Builder enabled(final String disabledReasonIfAny) {
- cssMenuItem.setEnabled(disabledReasonIfAny == null);
- cssMenuItem.setDisabledReason(disabledReasonIfAny);
- return this;
- }
-
- public Builder describedAs(String descriptionIfAny) {
- cssMenuItem.setDescription(descriptionIfAny);
- return this;
- }
-
- public Builder returnsBlobOrClob(boolean blobOrClob) {
- cssMenuItem.setReturnsBlobOrClob(blobOrClob);
- return this;
- }
-
- public Builder prototyping(boolean prototype) {
- cssMenuItem.setPrototyping(prototype);
- return this;
- }
-
- public Builder requiresSeparator(boolean separator) {
- cssMenuItem.setRequiresSeparator(separator);
- return this;
- }
-
- public Builder withActionIdentifier(String actionIdentifier) {
- cssMenuItem.setActionIdentifier(actionIdentifier);
- return this;
- }
-
- public Builder withCssClass(String cssClass) {
- cssMenuItem.setCssClass(cssClass);
- return this;
- }
-
- public Builder withCssClassFa(String cssClassFa) {
- cssMenuItem.setCssClassFa(cssClassFa);
- return this;
- }
-
- public Builder withCssClassFaPosition(final CssClassFaPosition position) {
- cssMenuItem.setCssClassFaPosition(position);
- return this;
- }
-
- /**
- * Returns the built {@link CssMenuItem}, associating with {@link #parent(CssMenuItem) parent} (if specified).
- */
- public CssMenuItem build() {
- if (cssMenuItem.parent != null) {
- cssMenuItem.parent.subMenuItems.add(cssMenuItem);
- }
- return cssMenuItem;
- }
-
- }
-
- private final String name;
- private final List<CssMenuItem> subMenuItems = Lists.newArrayList();
- private CssMenuItem parent;
-
- private AbstractLink link;
- private boolean enabled = true; // unless disabled
- private String disabledReason;
- private boolean blobOrClob = false; // unless set otherwise
- private boolean prototype = false; // unless set otherwise
- private boolean requiresSeparator = false; // unless set otherwise
-
- static final String ID_MENU_LABEL = "menuLabel";
-
- static final String ID_SUB_MENU_ITEMS = "subMenuItems";
-
- private String actionIdentifier;
- private String cssClass;
- private String cssClassFa;
- private CssClassFaPosition cssClassFaPosition;
-
- private String description;
-
- /**
- * Factory method returning {@link Builder builder}.
- */
- public static Builder newMenuItem(final String name) {
- return new Builder(name);
- }
-
- public void setActionIdentifier(String actionIdentifier) {
- this.actionIdentifier = actionIdentifier;
- }
-
- public void setPrototyping(boolean prototype) {
- this.prototype = prototype;
- }
-
- public boolean isPrototyping() {
- return prototype;
- }
-
- private boolean separator;
-
- public boolean isSeparator() {
- return separator;
- }
- public void setSeparator(final boolean separator) {
- this.separator = separator;
- }
-
- public void setRequiresSeparator(boolean requiresSeparator) {
- this.requiresSeparator = requiresSeparator;
- }
-
- /**
- * Requires a separator before it
- */
- public boolean requiresSeparator() {
- return requiresSeparator;
- }
-
- private CssMenuItem(final String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public boolean hasParent() {
- return parent != null;
- }
-
- private void setParent(final CssMenuItem parent) {
- this.parent = parent;
- }
-
- public Builder newSubMenuItem(final String name) {
- return CssMenuItem.newMenuItem(name).parent(this);
- }
-
- public List<CssMenuItem> getSubMenuItems() {
- return Collections.unmodifiableList(subMenuItems);
- }
-
- public void replaceSubMenuItems(List<CssMenuItem> menuItems) {
- subMenuItems.clear();
- subMenuItems.addAll(menuItems);
- }
-
- public boolean hasSubMenuItems() {
- return subMenuItems.size() > 0;
- }
-
- public AbstractLink getLink() {
- return link;
- }
-
- private void setLink(final AbstractLink link) {
- this.link = link;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- private void setEnabled(final boolean enabled) {
- this.enabled = enabled;
- }
-
- public void setReturnsBlobOrClob(boolean blobOrClob) {
- this.blobOrClob = blobOrClob;
- }
-
- public void setCssClass(String cssClass) {
- this.cssClass = cssClass;
- }
-
- public String getCssClass() {
- return cssClass;
- }
-
- public void setCssClassFa(String cssClassFa) {
- this.cssClassFa = cssClassFa;
- }
-
- public String getCssClassFa() {
- return cssClassFa;
- }
-
- public void setCssClassFaPosition(final CssClassFaPosition position) {
- this.cssClassFaPosition = position;
- }
-
- public CssClassFaPosition getCssClassFaPosition() {
- return cssClassFaPosition;
- }
-
- /**
- * Only populated if not {@link #isEnabled() enabled}.
- */
- public String getDisabledReason() {
- return disabledReason;
- }
-
- public void setDisabledReason(final String disabledReason) {
- this.disabledReason = disabledReason;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- // //////////////////////////////////////////////////////////////
- // To add submenu items
- // //////////////////////////////////////////////////////////////
-
- /**
- * Creates a {@link Builder} for a submenu item invoking an action on the provided {@link ObjectAdapterMemento
- * target adapter}.
- */
- public Builder newSubMenuItem(
- final ObjectAdapterMemento targetAdapterMemento,
- final ObjectAction objectAction,
- final boolean separator,
- final ActionLinkFactory actionLinkFactory) {
-
- // check visibility
- final AuthenticationSession session = getAuthenticationSession();
- final ObjectAdapter adapter = targetAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK);
- final Consent visibility = objectAction.isVisible(session, adapter, ActionModel.WHERE_FOR_ACTION_INVOCATION);
- if (visibility.isVetoed()) {
- return null;
- }
-
- // build the link
- final LinkAndLabel linkAndLabel = actionLinkFactory.newLink(
- targetAdapterMemento, objectAction, PageAbstract.ID_MENU_LINK
- );
- if (linkAndLabel == null) {
- // can only get a null if invisible, so this should not happen given guard above
- return null;
- }
- final AbstractLink link = linkAndLabel.getLink();
- final String actionLabel = linkAndLabel.getLabel();
-
- final Consent usability = objectAction.isUsable(session, adapter, ActionModel.WHERE_FOR_ACTION_INVOCATION);
- final String reasonDisabledIfAny = usability.getReason();
-
- final DescribedAsFacet describedAsFacet = objectAction.getFacet(DescribedAsFacet.class);
- final String descriptionIfAny = describedAsFacet != null ? describedAsFacet.value() : null;
-
- Builder builder = newSubMenuItem(actionLabel)
- .link(link)
- .describedAs(descriptionIfAny)
- .enabled(reasonDisabledIfAny)
- .returnsBlobOrClob(ObjectAction.Utils.returnsBlobOrClob(objectAction))
- .prototyping(ObjectAction.Utils.isExplorationOrPrototype(objectAction))
- .requiresSeparator(separator)
- .withActionIdentifier(ObjectAction.Utils.actionIdentifierFor(objectAction))
- .withCssClass(ObjectAction.Utils.cssClassFor(objectAction, adapter))
- .withCssClassFa(ObjectAction.Utils.cssClassFaFor(objectAction))
- .withCssClassFaPosition(ObjectAction.Utils.cssClassFaPositionFor(objectAction));
-
- return builder;
- }
-
- // //////////////////////////////////////////////////////////////
- // Build wicket components from the menu item.
- // //////////////////////////////////////////////////////////////
-
- void addTo(final MarkupContainer markupContainer) {
-
- final Component menuItemComponent = addMenuItemComponentTo(markupContainer);
- addSubMenuItemComponentsIfAnyTo(markupContainer);
-
- addCssClassAttributesIfRequired(menuItemComponent);
- }
-
- private Component addMenuItemComponentTo(final MarkupContainer markupContainer) {
- final AbstractLink link = getLink();
- final Label label = new Label(CssMenuItem.ID_MENU_LABEL, Model.of(this.getName()));
-
- if (link != null) {
-
- // show link...
- markupContainer.add(link);
- link.add(label);
-
- if (this.description != null) {
- label.add(new AttributeModifier("title", Model.of(description)));
- }
- if (this.blobOrClob) {
- link.add(new CssClassAppender("noVeil"));
- }
- if (this.prototype) {
- link.add(new CssClassAppender("prototype"));
- }
-
- if (this.cssClass != null) {
- link.add(new CssClassAppender(this.cssClass));
- }
- link.add(new CssClassAppender(this.actionIdentifier));
-
- String cssClassFa = getCssClassFa();
- if (!Strings.isNullOrEmpty(cssClassFa)) {
- label.add(new CssClassFaBehavior(cssClassFa, getCssClassFaPosition()));
- }
-
- if (!this.isEnabled()) {
- link.add(new AttributeModifier("title", Model.of(this.getDisabledReason())));
- link.add(new CssClassAppender("disabled"));
-
- link.setEnabled(false);
- }
-
- // .. and hide label
- Components.permanentlyHide(markupContainer, CssMenuItem.ID_MENU_LABEL);
- return link;
- }
- else {
- // hide link...
- Components.permanentlyHide(markupContainer, ID_MENU_LINK);
- // ... and show label, along with disabled reason
- label.add(new AttributeModifier("title", Model.of(this.getDisabledReason())));
- label.add(new AttributeModifier("class", Model.of("disabled")));
-
- markupContainer.add(label);
-
- return label;
- }
- }
-
- private void addSubMenuItemComponentsIfAnyTo(final MarkupContainer menuItemMarkup) {
- final List<CssMenuItem> subMenuItems = getSubMenuItems();
- if (subMenuItems.isEmpty()) {
- Components.permanentlyHide(menuItemMarkup, CssMenuItem.ID_SUB_MENU_ITEMS);
- }
- else {
- menuItemMarkup.add(new CssSubMenuItemsPanel(CssMenuItem.ID_SUB_MENU_ITEMS, subMenuItems));
- }
- }
-
- private void addCssClassAttributesIfRequired(final Component linkComponent) {
- if (!hasSubMenuItems()) {
- return;
- }
- if (this.hasParent()) {
- linkComponent.add(new CssClassAppender("parent"));
- }
- else {
- linkComponent.add(new CssClassAppender("top-parent"));
- }
- }
-
- // //////////////////////////////////////////////////////////////
- // dependencies
- // //////////////////////////////////////////////////////////////
-
- protected AuthenticationSession getAuthenticationSession() {
- return IsisContext.getAuthenticationSession();
- }
-
-}