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:30 UTC
[39/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/collectioncontents/icons/CollectionContentsAsIconsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/icons/CollectionContentsAsIconsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/icons/CollectionContentsAsIconsPanelFactory.java
new file mode 100644
index 0000000..1c70fb8
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/icons/CollectionContentsAsIconsPanelFactory.java
@@ -0,0 +1,66 @@
+/*
+ * 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.collectioncontents.icons;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.core.metamodel.facets.object.icon.IconFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+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 CollectionContentsAsIconsPanel}.
+ */
+// TODO mgrigorov: Is this still needed ? It seems it is not used.
+public class CollectionContentsAsIconsPanelFactory extends ComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String NAME = "icons";
+
+ public CollectionContentsAsIconsPanelFactory() {
+ super(ComponentType.COLLECTION_CONTENTS, NAME, CollectionContentsAsIconsPanel.class);
+ }
+
+ @Override
+ public ApplicationAdvice appliesTo(final IModel<?> model) {
+ if (!(model instanceof EntityCollectionModel)) {
+ return ApplicationAdvice.DOES_NOT_APPLY;
+ }
+
+ final EntityCollectionModel entityCollectionModel = (EntityCollectionModel) model;
+ final ObjectSpecification typeOfSpec = entityCollectionModel.getTypeOfSpecification();
+ if (typeOfSpec.getFacet(IconFacet.class) == null) {
+ return ApplicationAdvice.DOES_NOT_APPLY;
+ }
+ return ApplicationAdvice.APPLIES;
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final EntityCollectionModel collectionModel = (EntityCollectionModel) model;
+ return new CollectionContentsAsIconsPanel(id, collectionModel);
+ }
+
+}
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/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.html
new file mode 100644
index 0000000..0a6d242
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.html
@@ -0,0 +1,41 @@
+<?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:wicket="http://wicket.apache.org">
+<body>
+<wicket:panel>
+ <div class="linksSelectorPanel">
+
+ <div class="views">
+ <div wicket:id="collectionContents-0" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+ <div wicket:id="collectionContents-1" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+ <div wicket:id="collectionContents-2" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+ <div wicket:id="collectionContents-3" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+ <div wicket:id="collectionContents-4" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+ <div wicket:id="collectionContents-5" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+ <div wicket:id="collectionContents-6" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+ <div wicket:id="collectionContents-7" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+ <div wicket:id="collectionContents-8" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+ <div wicket:id="collectionContents-9" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></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/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
new file mode 100644
index 0000000..8c3a1e6
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
@@ -0,0 +1,208 @@
+/*
+ * 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.collectioncontents.multiple;
+
+import java.util.List;
+import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.IEvent;
+import org.apache.isis.viewer.wicket.model.hints.IsisEnvelopeEvent;
+import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
+import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
+import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorHelper;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorProvider;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
+
+/**
+ * Subscribes to events generated by {@link org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel}, rendering the appropriate {@link ComponentType#COLLECTION_CONTENTS}
+ * view for a backing {@link EntityCollectionModel}.
+ */
+public class CollectionContentsMultipleViewsPanel
+ extends PanelAbstract<EntityCollectionModel> implements UiHintPathSignificant, CollectionCountProvider {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String INVISIBLE_CLASS = "link-selector-panel-invisible";
+ private static final int MAX_NUM_UNDERLYING_VIEWS = 10;
+
+ private static final String UIHINT_VIEW = "view";
+
+ private final ComponentFactory ignoreFactory;
+
+ private final ComponentType componentType;
+ private final String underlyingIdPrefix;
+ private final CollectionSelectorHelper selectorHelper;
+
+ private ComponentFactory selectedComponentFactory;
+ private Component selectedComponent;
+
+ private Component[] underlyingViews;
+ private CollectionSelectorPanel selectorDropdownPanel;
+
+ public CollectionContentsMultipleViewsPanel(
+ final String id,
+ final EntityCollectionModel model,
+ final ComponentFactory ignoreFactory) {
+ super(id, model);
+ this.ignoreFactory = ignoreFactory;
+ this.underlyingIdPrefix = ComponentType.COLLECTION_CONTENTS.toString();
+ this.componentType = ignoreFactory.getComponentType();
+ selectorHelper = new CollectionSelectorHelper(model, getComponentFactoryRegistry());
+
+ }
+
+ /**
+ * Build UI only after added to parent.
+ */
+ public void onInitialize() {
+ super.onInitialize();
+ addUnderlyingViews();
+ }
+
+
+ private void addUnderlyingViews() {
+ final EntityCollectionModel model = getModel();
+
+ final CollectionSelectorPanel selectorDropdownPanelIfAny = CollectionSelectorProvider.Util.getCollectionSelectorProvider(this);
+ final int selected = selectorDropdownPanelIfAny != null
+ ? selectorHelper.honourViewHintElseDefault(selectorDropdownPanelIfAny)
+ : 0;
+ final List<ComponentFactory> componentFactories = selectorHelper.getComponentFactories();
+
+ // create all, hide the one not selected
+ int i = 0;
+ underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
+ final EntityCollectionModel emptyModel = model.asDummy();
+ for (ComponentFactory componentFactory : componentFactories) {
+ final String underlyingId = underlyingIdPrefix + "-" + i;
+
+ Component underlyingView = componentFactory.createComponent(underlyingId,i==selected? model: emptyModel);
+ underlyingViews[i++] = underlyingView;
+ this.addOrReplace(underlyingView);
+ }
+
+ // hide any unused placeholders
+ while(i<MAX_NUM_UNDERLYING_VIEWS) {
+ String underlyingId = underlyingIdPrefix + "-" + i;
+ permanentlyHide(underlyingId);
+ i++;
+ }
+
+ this.setOutputMarkupId(true);
+
+ for(i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+ Component component = underlyingViews[i];
+ if(component != null) {
+ if(i != selected) {
+ component.add(new CssClassAppender(INVISIBLE_CLASS));
+ } else {
+ selectedComponent = component;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onEvent(IEvent<?> event) {
+ super.onEvent(event);
+
+ final IsisUiHintEvent uiHintEvent = IsisEnvelopeEvent.openLetter(event, IsisUiHintEvent.class);
+ if(uiHintEvent == null) {
+ return;
+ }
+ final UiHintContainer uiHintContainer = uiHintEvent.getUiHintContainer();
+
+ int underlyingViewNum = 0;
+ final CollectionSelectorPanel selectorDropdownPanel = CollectionSelectorProvider.Util.getCollectionSelectorProvider(this);
+ if(selectorDropdownPanel == null) {
+ // not expected, because this event shouldn't be called.
+ // but no harm in simply returning...
+ return;
+ }
+ String viewStr = uiHintContainer.getHint(selectorDropdownPanel, UIHINT_VIEW);
+
+ List<ComponentFactory> componentFactories = selectorHelper.getComponentFactories();
+
+ if(viewStr != null) {
+ try {
+ int view = Integer.parseInt(viewStr);
+ if(view >= 0 && view < componentFactories.size()) {
+ underlyingViewNum = view;
+ }
+
+
+ final EntityCollectionModel dummyModel = getModel().asDummy();
+ for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+ final Component component = underlyingViews[i];
+ if(component == null) {
+ continue;
+ }
+ final boolean isSelected = i == underlyingViewNum;
+ applyCssVisibility(component, isSelected);
+ component.setDefaultModel(isSelected? getModel(): dummyModel);
+ }
+
+ this.selectedComponentFactory = ignoreFactory;
+ this.selectedComponent = underlyingViews[underlyingViewNum];
+
+
+ final AjaxRequestTarget target = uiHintEvent.getTarget();
+ if(target != null) {
+ target.add(this, selectorDropdownPanel);
+ }
+
+ } catch(NumberFormatException ex) {
+ // ignore
+ }
+ }
+ }
+
+
+ protected static void applyCssVisibility(final Component component, final boolean visible) {
+ if(component == null) {
+ return;
+ }
+ AttributeModifier modifier = visible ? new CssClassRemover(INVISIBLE_CLASS) : new CssClassAppender(INVISIBLE_CLASS);
+ component.add(modifier);
+ }
+
+
+
+ @Override
+ public Integer getCount() {
+ if(selectedComponent instanceof CollectionCountProvider) {
+ final CollectionCountProvider collectionCountProvider = (CollectionCountProvider) selectedComponent;
+ return collectionCountProvider.getCount();
+ } else {
+ 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/collectioncontents/multiple/CollectionContentsMultipleViewsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanelFactory.java
new file mode 100644
index 0000000..53b8092
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanelFactory.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.collectioncontents.multiple;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+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 CollectionContentsMultipleViewsPanel}.
+ */
+public class CollectionContentsMultipleViewsPanelFactory extends ComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public CollectionContentsMultipleViewsPanelFactory() {
+ super(ComponentType.COLLECTION_CONTENTS,
+ CollectionContentsMultipleViewsPanel.class);
+ }
+
+ @Override
+ public ApplicationAdvice appliesTo(final IModel<?> model) {
+ return appliesIf(model instanceof EntityCollectionModel);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final EntityCollectionModel collectionModel = (EntityCollectionModel) model;
+ return new CollectionContentsMultipleViewsPanel(id, collectionModel, this);
+ }
+
+}
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/collectioncontents/summary/CollectionContentsAsSummary.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.html
new file mode 100644
index 0000000..1f55751
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.html
@@ -0,0 +1,46 @@
+<?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="collectionContentsAsSummary">
+ <div wicket:id="feedback"></div>
+
+ <table class="table table-condensed table-bordered table-striped">
+ <tr wicket:id="repeatingSummary">
+ <td class="propertyNameCell">
+ <span class="propertyName" wicket:id="propertyName">[propertyName]</span>
+ </td>
+ <td class="aggregatesCell">
+ <table class="table table-condensed" style="background-color: inherit; margin-bottom: 0">
+ <tr>
+ <td class="aggregateName">Sum:</td><td><input class="numberValue form-control" type="text" disabled="disabled" wicket:id="sum"/></td>
+ <td class="aggregateName">Avg:</td><td><input class="numberValue form-control" type="text" disabled="disabled" wicket:id="avg"/></td>
+ <td class="aggregateName">Min:</td><td><input class="numberValue form-control" type="text" disabled="disabled" wicket:id="min"/></td>
+ <td class="aggregateName">Max:</td><td><input class="numberValue form-control" type="text" disabled="disabled" wicket:id="max"/></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </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/collectioncontents/summary/CollectionContentsAsSummary.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java
new file mode 100644
index 0000000..49be8db
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java
@@ -0,0 +1,204 @@
+/*
+ * 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.collectioncontents.summary;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Collections;
+import java.util.List;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.list.AbstractItem;
+import org.apache.wicket.markup.repeater.RepeatingView;
+import org.apache.wicket.model.Model;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.ObjectAdapterUtils;
+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.ObjectAssociation;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+/**
+ * {@link PanelAbstract Panel} that represents a {@link EntityCollectionModel
+ * collection of entity}s rendered using as a table of summary values with a
+ * chart alongside.
+ */
+public class CollectionContentsAsSummary extends PanelAbstract<EntityCollectionModel> implements CollectionCountProvider {
+
+ private static final String ID_MAX = "max";
+
+ private static final String ID_MIN = "min";
+
+ private static final String ID_AVG = "avg";
+
+ private static final String ID_SUM = "sum";
+
+ private static final String ID_PROPERTY_NAME = "propertyName";
+
+ private static final String ID_REPEATING_SUMMARY = "repeatingSummary";
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_FEEDBACK = "feedback";
+
+ public CollectionContentsAsSummary(final String id, final EntityCollectionModel model) {
+ super(id, model);
+
+ buildGui();
+ }
+
+ private void buildGui() {
+
+ final EntityCollectionModel model = getModel();
+
+ final ObjectSpecification elementSpec = model.getTypeOfSpecification();
+
+ final NotificationPanel feedback = new NotificationPanel(ID_FEEDBACK);
+ feedback.setOutputMarkupId(true);
+ addOrReplace(feedback);
+
+ List<ObjectAssociation> numberAssociations = elementSpec.getAssociations(Contributed.EXCLUDED, CollectionContentsAsSummaryFactory.OF_TYPE_BIGDECIMAL);
+
+ RepeatingView repeating = new RepeatingView(ID_REPEATING_SUMMARY);
+ addOrReplace(repeating);
+
+ for (ObjectAssociation numberAssociation : numberAssociations) {
+ AbstractItem item = new AbstractItem(repeating.newChildId());
+
+ repeating.add(item);
+
+ String propertyName = numberAssociation.getName();
+ item.add(new Label(ID_PROPERTY_NAME, new Model<String>(propertyName)));
+
+
+ List<ObjectAdapter> adapters = model.getObject();
+ Summary summary = new Summary(propertyName, adapters, numberAssociation);
+ addItem(item, ID_SUM, summary.getTotal());
+ addItem(item, ID_AVG, summary.getAverage());
+ addItem(item, ID_MIN, summary.getMin());
+ addItem(item, ID_MAX, summary.getMax());
+ }
+ }
+
+ public static class Summary {
+
+ private BigDecimal sum = BigDecimal.ZERO;
+ private BigDecimal min = null;
+ private BigDecimal max = null;
+ private final List<String> titles = Lists.newArrayList();
+ private final List<BigDecimal> values = Lists.newArrayList();
+ private BigDecimal average;
+ private String propertyName;
+
+ public Summary(List<ObjectAdapter> adapters, ObjectAssociation numberAssociation) {
+ this(null, adapters, numberAssociation);
+ }
+
+ public Summary(String propertyName, List<ObjectAdapter> adapters, ObjectAssociation numberAssociation) {
+ this.propertyName = propertyName;
+ int nonNullCount = 0;
+ for (ObjectAdapter objectAdapter : adapters) {
+ titles.add(objectAdapter.titleString(null));
+ final ObjectAdapter valueAdapter = numberAssociation.get(objectAdapter);
+ if (valueAdapter == null) {
+ values.add(null);
+ continue;
+ }
+ final Object valueObj = ObjectAdapterUtils.unwrapObject(valueAdapter);
+ if (valueObj == null) {
+ values.add(null);
+ continue;
+ }
+
+ nonNullCount++;
+ BigDecimal value = (BigDecimal) valueObj;
+ sum = sum.add(value);
+ min = min != null && min.compareTo(value) < 0 ? min : value;
+ max = max != null && max.compareTo(value) > 0 ? max : value;
+ values.add(value);
+ }
+ average = nonNullCount != 0 ? sum.divide(BigDecimal.valueOf(nonNullCount), 2, RoundingMode.HALF_UP) : null;
+ }
+
+ public String getPropertyName() {
+ return propertyName;
+ }
+ public BigDecimal getTotal() {
+ return sum;
+ }
+ public BigDecimal getAverage() {
+ return average;
+ }
+ public BigDecimal getMax() {
+ return max;
+ }
+ public BigDecimal getMin() {
+ return min;
+ }
+ public List<String> getTitles() {
+ return Collections.unmodifiableList(titles);
+ }
+ public List<BigDecimal> getValues() {
+ return Collections.unmodifiableList(values);
+ }
+ public List<Number> getValuesAsNumbers() {
+ return asNumbers(getValues());
+ }
+
+ private static List<Number> asNumbers(List<BigDecimal> values) {
+ return Lists.newArrayList(Iterables.transform(values, BIGDECIMAL_TO_NUMBER));
+ }
+
+ private static final com.google.common.base.Function<BigDecimal, Number> BIGDECIMAL_TO_NUMBER = new com.google.common.base.Function<BigDecimal, Number>(){
+ public Number apply(BigDecimal value) {
+ return value;
+ }
+ };
+
+
+ }
+
+ private void addItem(AbstractItem item, String id, BigDecimal amt) {
+ TextField<String> textField = new TextField<String>(id, new Model<String>(format(amt)));
+ item.add(textField);
+ }
+
+ private String format(BigDecimal amt) {
+ return amt != null ? amt.setScale(2, RoundingMode.HALF_UP).toPlainString() : "";
+ }
+
+ @Override
+ protected void onModelChanged() {
+ buildGui();
+ }
+
+ @Override
+ public Integer getCount() {
+ final EntityCollectionModel model = getModel();
+ return model.getCount();
+ }
+
+}
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/collectioncontents/summary/CollectionContentsAsSummaryFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummaryFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummaryFactory.java
new file mode 100644
index 0000000..e0d25cf
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummaryFactory.java
@@ -0,0 +1,95 @@
+/*
+ * 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.collectioncontents.summary;
+
+import java.util.List;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.request.resource.CssResourceReference;
+
+import org.apache.isis.applib.filter.Filter;
+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.ObjectAssociation;
+import org.apache.isis.core.metamodel.facets.value.bigdecimal.BigDecimalValueFacet;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.CollectionContentsAsFactory;
+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 CollectionContentsAsSummary}.
+ */
+public class CollectionContentsAsSummaryFactory extends ComponentFactoryAbstract implements CollectionContentsAsFactory {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String NAME = "summary";
+
+ final static Filter<ObjectAssociation> OF_TYPE_BIGDECIMAL = new Filter<ObjectAssociation>(){
+ public boolean accept(final ObjectAssociation objectAssoc) {
+ ObjectSpecification objectSpec = objectAssoc.getSpecification();
+ return objectSpec.containsDoOpFacet(BigDecimalValueFacet.class);
+ }};
+
+ // //////////////////////////////////////
+
+ public CollectionContentsAsSummaryFactory() {
+ super(ComponentType.COLLECTION_CONTENTS, NAME, CollectionContentsAsSummary.class);
+ }
+
+ @Override
+ public ApplicationAdvice appliesTo(final IModel<?> model) {
+ if(!(model instanceof EntityCollectionModel)) {
+ return ApplicationAdvice.DOES_NOT_APPLY;
+ }
+ final EntityCollectionModel entityCollectionModel = (EntityCollectionModel) model;
+ final ObjectSpecification elementSpec = entityCollectionModel.getTypeOfSpecification();
+ List<ObjectAssociation> associations = elementSpec.getAssociations(Contributed.EXCLUDED, OF_TYPE_BIGDECIMAL);
+ return appliesIf(!associations.isEmpty());
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final EntityCollectionModel collectionModel = (EntityCollectionModel) model;
+ return new CollectionContentsAsSummary(id, collectionModel);
+ }
+
+ @Override
+ public CssResourceReference getCssResourceReference() {
+ // do not bundle, because of relative CSS images...
+ return null;
+ }
+
+ @Override
+ public IModel<String> getTitleLabel() {
+ return new ResourceModel("CollectionContentsAsSummaryFactory.Summary", "Summary");
+ }
+
+ @Override
+ public IModel<String> getCssClass() {
+ return Model.of("fa fa-fw fa-usd");
+ }
+
+}
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/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.html
new file mode 100644
index 0000000..8a1f128
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.html
@@ -0,0 +1,29 @@
+<?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="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="collectionContentsAsUnresolvedPanel collectionContentsComponentType"></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/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.java
new file mode 100644
index 0000000..fd36e9a
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.java
@@ -0,0 +1,43 @@
+/*
+ * 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.collectioncontents.unresolved;
+
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+/**
+ * {@link PanelAbstract Panel} that represents a placeholder for a
+ * {@link EntityCollectionModel collection of entity}s so that they can be only
+ * lazily resolved.
+ */
+public class CollectionContentsAsUnresolvedPanel extends PanelAbstract<EntityCollectionModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public CollectionContentsAsUnresolvedPanel(final String id, final EntityCollectionModel model) {
+ super(id, model);
+ buildGui();
+ }
+
+ private void buildGui() {
+ // nothing
+ }
+
+}
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/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanelFactory.java
new file mode 100644
index 0000000..2d06eda
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanelFactory.java
@@ -0,0 +1,70 @@
+/*
+ * 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.collectioncontents.unresolved;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.ResourceModel;
+
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.CollectionContentsAsFactory;
+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 CollectionContentsAsUnresolvedPanel}.
+ */
+public class CollectionContentsAsUnresolvedPanelFactory extends ComponentFactoryAbstract implements CollectionContentsAsFactory {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String NAME = "show...";
+
+ public CollectionContentsAsUnresolvedPanelFactory() {
+ super(ComponentType.COLLECTION_CONTENTS, NAME, CollectionContentsAsUnresolvedPanel.class);
+ }
+
+ @Override
+ public ApplicationAdvice appliesTo(final IModel<?> model) {
+ if (!(model instanceof EntityCollectionModel)) {
+ return ApplicationAdvice.DOES_NOT_APPLY;
+ }
+ final EntityCollectionModel entityCollectionModel = (EntityCollectionModel) model;
+ return appliesIf(entityCollectionModel.isParented());
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final EntityCollectionModel collectionModel = (EntityCollectionModel) model;
+ return new CollectionContentsAsUnresolvedPanel(id, collectionModel);
+ }
+
+ @Override
+ public IModel<String> getTitleLabel() {
+ return new ResourceModel("CollectionContentsAsUnresolvedPanel.Hide", "Hide");
+ }
+
+ @Override
+ public IModel<String> getCssClass() {
+ return Model.of("fa fa-fw fa-eye-slash");
+ }
+}
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/empty/EmptyCollectionPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.html
new file mode 100644
index 0000000..f9e6a25
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.html
@@ -0,0 +1,34 @@
+<?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="emptyCollectionPanel">
+ <form>
+ <p>No objects returned</p>
+ </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/empty/EmptyCollectionPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.java
new file mode 100644
index 0000000..0bc44f3
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.java
@@ -0,0 +1,38 @@
+/*
+ * 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.empty;
+
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+public class EmptyCollectionPanel extends PanelAbstract<ActionModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public EmptyCollectionPanel(final String id, final ActionModel model) {
+ super(id, model);
+ buildGui(id);
+ }
+
+ private void buildGui(final String id) {
+ // nothing to do...
+ }
+
+}
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/empty/EmptyCollectionPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanelFactory.java
new file mode 100644
index 0000000..0fc2fde
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanelFactory.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.empty;
+
+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;
+
+public class EmptyCollectionPanelFactory extends ComponentFactoryAbstract implements ComponentFactory {
+
+ private static final long serialVersionUID = 1L;
+
+ public EmptyCollectionPanelFactory() {
+ super(ComponentType.EMPTY_COLLECTION, EmptyCollectionPanel.class);
+ }
+
+ @Override
+ protected ApplicationAdvice appliesTo(final IModel<?> model) {
+ if (!(model instanceof ActionModel)) {
+ return ApplicationAdvice.DOES_NOT_APPLY;
+ }
+ return ApplicationAdvice.APPLIES;
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final ActionModel actionModel = (ActionModel) model;
+ return new EmptyCollectionPanel(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/entity/EntityComponentFactoryAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/EntityComponentFactoryAbstract.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/EntityComponentFactoryAbstract.java
new file mode 100644
index 0000000..a35d59b
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/EntityComponentFactoryAbstract.java
@@ -0,0 +1,71 @@
+/*
+ * 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.entity;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.facets.object.value.ValueFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+
+/**
+ * Convenience adapter for a number of {@link ComponentFactoryAbstract component
+ * factory}s that where the created {@link Component} are backed by an
+ * {@link EntityModel}.
+ */
+public abstract class EntityComponentFactoryAbstract extends ComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public EntityComponentFactoryAbstract(final ComponentType componentType, final @SuppressWarnings("rawtypes") Class componentClass) {
+ super(componentType, componentClass);
+ }
+
+ public EntityComponentFactoryAbstract(final ComponentType componentType, final String name, final @SuppressWarnings("rawtypes") Class componentClass) {
+ super(componentType, name, componentClass);
+ }
+
+ @Override
+ protected ApplicationAdvice appliesTo(final IModel<?> model) {
+ if (!(model instanceof EntityModel)) {
+ return ApplicationAdvice.DOES_NOT_APPLY;
+ }
+ final EntityModel entityModel = (EntityModel) model;
+ // hit a scenario on a redirect-and-post strategy where the component is rendered not on an
+ // EntityPage but instead using a custom home page. The hacky override in entity page (in EntityPage#onBeforeRender)
+ // is therefore not called. resulting in a concurrency exception.
+ //
+ // Therefore, we do the same processing here instead.
+ final ObjectAdapter adapter = entityModel.load(AdapterManager.ConcurrencyChecking.NO_CHECK);
+ if (adapter == null) {
+ // is ok;
+ }
+ final ObjectSpecification specification = entityModel.getTypeOfSpecification();
+ final boolean isObject = specification.isNotCollection();
+ final boolean isValue = specification.containsFacet(ValueFacet.class);
+ return appliesIf(isObject && !isValue);
+ }
+
+}
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/entity/collections/EntityCollectionsPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
new file mode 100644
index 0000000..2d39517
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.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.
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+ <body>
+ <wicket:panel>
+ <div class="entityCollectionsPanel entityCollectionsComponentType">
+ <div wicket:id="collections" class="myBlockContainer">
+ <div wicket:id="collectionGroup" class="panel panel-default">
+
+ <div class="panel-heading">
+ <span wicket:id="collectionName" class="panel-title">[collection name]</span>
+ <div class="additionalLinksAndSelectorDropDown pull-right">
+
+ <div class="btn-group">
+ <div wicket:id="additionalLinks"></div>
+ </div>
+ <div class="btn-group">
+ <span wicket:id="selectorDropdown"/>
+ </div>
+
+ </div>
+ </div>
+
+ <div wicket:id="collection" class="collection panel-body">
+ [collection]
+ </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/entity/collections/EntityCollectionsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
new file mode 100644
index 0000000..5b50367
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
@@ -0,0 +1,174 @@
+/*
+ * 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.entity.collections;
+
+import java.util.List;
+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.repeater.RepeatingView;
+import org.apache.wicket.model.Model;
+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.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+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.ObjectAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.AdditionalLinksPanel;
+import org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorHelper;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel;
+import org.apache.isis.viewer.wicket.ui.components.widgets.containers.UiHintPathSignificantWebMarkupContainer;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+
+/**
+ * {@link PanelAbstract Panel} representing the properties of an entity, as per
+ * the provided {@link EntityModel}.
+ */
+public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_ENTITY_COLLECTIONS = "entityCollections";
+ private static final String ID_COLLECTION_GROUP = "collectionGroup";
+ private static final String ID_COLLECTION_NAME = "collectionName";
+ private static final String ID_COLLECTIONS = "collections";
+ private static final String ID_COLLECTION = "collection";
+
+ private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
+ private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
+
+ public EntityCollectionsPanel(final String id, final EntityModel entityModel) {
+ super(id, entityModel);
+
+ buildGui();
+ }
+
+ private void buildGui() {
+ buildEntityPropertiesAndOrCollectionsGui();
+ setOutputMarkupId(true); // so can repaint via ajax
+ }
+
+ private void buildEntityPropertiesAndOrCollectionsGui() {
+ final EntityModel model = getModel();
+ final ObjectAdapter adapter = model.getObject();
+ if (adapter != null) {
+ addCollections();
+ } else {
+ permanentlyHide(ID_ENTITY_COLLECTIONS);
+ }
+ }
+
+ private void addCollections() {
+ final EntityModel entityModel = getModel();
+ final ObjectAdapter adapter = entityModel.getObject();
+ final ObjectSpecification noSpec = adapter.getSpecification();
+ final List<ObjectAssociation> associations = visibleCollections(adapter, noSpec);
+
+ final RepeatingView collectionRv = new RepeatingView(ID_COLLECTIONS);
+ add(collectionRv);
+
+ for (final ObjectAssociation association : associations) {
+
+ final WebMarkupContainer collectionRvContainer = new UiHintPathSignificantWebMarkupContainer(collectionRv.newChildId());
+ collectionRv.add(collectionRvContainer);
+
+ addCollectionToForm(entityModel, association, collectionRvContainer);
+ }
+ }
+
+ private void addCollectionToForm(final EntityModel entityModel,
+ final ObjectAssociation association,
+ final WebMarkupContainer collectionRvContainer) {
+
+ final CssClassFacet facet = association.getFacet(CssClassFacet.class);
+ if(facet != null) {
+ final ObjectAdapter objectAdapter = entityModel.getObject();
+ final String cssClass = facet.cssClass(objectAdapter);
+ CssClassAppender.appendCssClassTo(collectionRvContainer, cssClass);
+ }
+ final WebMarkupContainer fieldset = new WebMarkupContainer(ID_COLLECTION_GROUP);
+ collectionRvContainer.add(fieldset);
+
+ final OneToManyAssociation otma = (OneToManyAssociation) association;
+
+ final CollectionPanel collectionPanel = new CollectionPanel(ID_COLLECTION, entityModel, otma);
+ fieldset.addOrReplace(collectionPanel);
+
+ Label labelComponent = collectionPanel.createLabel(ID_COLLECTION_NAME, association.getName());
+ final NamedFacet namedFacet = association.getFacet(NamedFacet.class);
+ labelComponent.setEscapeModelStrings(namedFacet == null || namedFacet.escaped());
+
+ final String description = association.getDescription();
+ if(description != null) {
+ labelComponent.add(new AttributeAppender("title", Model.of(description)));
+ }
+
+ fieldset.add(labelComponent);
+
+ final EntityCollectionModel entityCollectionModel = collectionPanel.getModel();
+ List<LinkAndLabel> links = entityCollectionModel.getLinks();
+
+ AdditionalLinksPanel.addAdditionalLinks (fieldset,ID_ADDITIONAL_LINKS, links, AdditionalLinksPanel.Style.INLINE_LIST);
+
+ final CollectionSelectorHelper selectorHelper = new CollectionSelectorHelper(entityCollectionModel, getComponentFactoryRegistry());
+
+ final List<ComponentFactory> componentFactories = selectorHelper.getComponentFactories();
+
+ if (componentFactories.size() <= 1) {
+ permanentlyHide(ID_SELECTOR_DROPDOWN);
+ } else {
+ CollectionSelectorPanel selectorDropdownPanel;
+ selectorDropdownPanel = new CollectionSelectorPanel(ID_SELECTOR_DROPDOWN, entityCollectionModel);
+
+ final Model<ComponentFactory> componentFactoryModel = new Model<>();
+
+ final int selected = selectorHelper.honourViewHintElseDefault(selectorDropdownPanel);
+
+ ComponentFactory selectedComponentFactory = componentFactories.get(selected);
+ componentFactoryModel.setObject(selectedComponentFactory);
+
+ this.setOutputMarkupId(true);
+ fieldset.addOrReplace(selectorDropdownPanel);
+
+ collectionPanel.setSelectorDropdownPanel(selectorDropdownPanel);
+ }
+
+ }
+
+ private List<ObjectAssociation> visibleCollections(final ObjectAdapter adapter, final ObjectSpecification noSpec) {
+ return noSpec.getAssociations(Contributed.INCLUDED, visibleCollectionsFilter(adapter));
+ }
+
+ @SuppressWarnings("unchecked")
+ private Filter<ObjectAssociation> visibleCollectionsFilter(final ObjectAdapter adapter) {
+ return Filters.and(ObjectAssociation.Filters.COLLECTIONS, ObjectAssociation.Filters.dynamicallyVisible(getAuthenticationSession(), adapter, Where.PARENTED_TABLES));
+ }
+
+}
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/entity/collections/EntityCollectionsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanelFactory.java
new file mode 100644
index 0000000..e2947a0
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanelFactory.java
@@ -0,0 +1,49 @@
+/*
+ * 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.entity.collections;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.entity.EntityComponentFactoryAbstract;
+
+/**
+ * {@link ComponentFactory} for {@link EntityCollectionsPanel}.
+ */
+public class EntityCollectionsPanelFactory extends EntityComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public EntityCollectionsPanelFactory() {
+ super(ComponentType.ENTITY_COLLECTIONS, EntityCollectionsPanel.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final EntityModel entityModel = (EntityModel) model;
+ return new EntityCollectionsPanel(id, entityModel);
+ }
+}
+
+
+
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/entity/combined/EntityCombinedPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.html
new file mode 100644
index 0000000..540bb11
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.html
@@ -0,0 +1,29 @@
+<?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="entityCombined">
+ <div wicket:id="entitySummary"></div>
+ <div wicket:id="entityPropertiesAndCollections"></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/entity/combined/EntityCombinedPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.java
new file mode 100644
index 0000000..ee26581
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.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.entity.combined;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+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;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+
+/**
+ * {@link PanelAbstract Panel} to represent an entity on a single page made up
+ * of several <div> regions.
+ */
+public class EntityCombinedPanel extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_ENTITY_PROPERTIES_AND_COLLECTIONS = "entityPropertiesAndCollections";
+
+
+ public EntityCombinedPanel(final String id, final EntityModel entityModel) {
+ super(id, entityModel);
+ buildGui();
+ }
+
+ private void buildGui() {
+ final EntityModel model = getModel();
+ final ObjectAdapter objectAdapter = model.getObject();
+ final CssClassFacet facet = objectAdapter.getSpecification().getFacet(CssClassFacet.class);
+ if(facet != null) {
+ final String cssClass = facet.cssClass(objectAdapter);
+ CssClassAppender.appendCssClassTo(this, cssClass);
+ }
+
+ addOrReplace(ComponentType.ENTITY_SUMMARY, model);
+
+ getComponentFactoryRegistry().addOrReplaceComponent(this, ID_ENTITY_PROPERTIES_AND_COLLECTIONS, ComponentType.ENTITY_PROPERTIES, model);
+ }
+
+
+}
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/entity/combined/EntityCombinedPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanelFactory.java
new file mode 100644
index 0000000..a42f062
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanelFactory.java
@@ -0,0 +1,48 @@
+/*
+ * 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.entity.combined;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.entity.EntityComponentFactoryAbstract;
+
+/**
+ * {@link ComponentFactory} for {@link EntityCombinedPanel}.
+ */
+public class EntityCombinedPanelFactory extends EntityComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String NAME = "combined";
+
+ public EntityCombinedPanelFactory() {
+ super(ComponentType.ENTITY, NAME, EntityCombinedPanel.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final EntityModel entityModel = (EntityModel) model;
+ return new EntityCombinedPanel(id, entityModel);
+ }
+}
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/entity/header/EntityHeaderPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.html
new file mode 100644
index 0000000..76d70e6
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.html
@@ -0,0 +1,33 @@
+<?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="entityHeaderPanel">
+ <h4 class="iconAndTitle">
+ <div wicket:id="entityIconTitleAndCopylink" class="iconAndTitleLabel entityIconTitleAndCopylink">[icon and title]</div>
+ <div class="entityActions" wicket:id="entityActions"></div>
+ <div class="clearfix"></div>
+ </h4>
+ </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/entity/header/EntityHeaderPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.java
new file mode 100644
index 0000000..e1ab0c1
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.java
@@ -0,0 +1,106 @@
+/*
+ * 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.entity.header;
+
+import java.util.List;
+import org.apache.wicket.Component;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.runtime.system.DeploymentType;
+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.EntityModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.AdditionalLinksPanel;
+import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.EntityActionUtil;
+import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.EntityActionLinkFactory;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+/**
+ * {@link PanelAbstract Panel} representing the summary details (title, icon and
+ * actions) of an entity, as per the provided {@link EntityModel}.
+ */
+public class EntityHeaderPanel extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_ENTITY_ACTIONS = "entityActions";
+
+ private final EntityActionLinkFactory linkFactory;
+
+
+ public EntityHeaderPanel(final String id, final EntityModel entityModel) {
+ super(id, entityModel);
+ linkFactory = new EntityActionLinkFactory(getEntityModel());
+ }
+
+ /**
+ * For the {@link EntityActionLinkFactory}.
+ */
+ public EntityModel getEntityModel() {
+ return getModel();
+ }
+
+ @Override
+ protected void onBeforeRender() {
+ buildGui();
+ super.onBeforeRender();
+ }
+
+ private void buildGui() {
+ addOrReplaceIconAndTitle();
+ buildEntityActionsGui();
+ }
+
+ private void addOrReplaceIconAndTitle() {
+ final ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactory(ComponentType.ENTITY_ICON_TITLE_AND_COPYLINK, getEntityModel());
+ final Component component = componentFactory.createComponent(getEntityModel());
+ addOrReplace(component);
+ }
+
+
+ private void buildEntityActionsGui() {
+ final EntityModel model = getModel();
+ final ObjectAdapter adapter = model.getObject();
+ final ObjectAdapterMemento adapterMemento = model.getObjectAdapterMemento();
+ if (adapter != null) {
+ final List<ObjectAction> topLevelActions = EntityActionUtil.getTopLevelActions(adapter, getDeploymentType(), getAuthenticationSession());
+
+ final List<LinkAndLabel> entityActionLinks = EntityActionUtil.asLinkAndLabelsForAdditionalLinksPanel(model, topLevelActions);
+
+ AdditionalLinksPanel.addAdditionalLinks(this, ID_ENTITY_ACTIONS, entityActionLinks, AdditionalLinksPanel.Style.INLINE_LIST);
+ } else {
+ permanentlyHide(ID_ENTITY_ACTIONS);
+ }
+ }
+
+
+ // ///////////////////////////////////////////////
+ // Dependency Injection
+ // ///////////////////////////////////////////////
+
+ protected DeploymentType getDeploymentType() {
+ return IsisContext.getDeploymentType();
+ }
+
+
+}
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/entity/header/EntityHeaderPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanelFactory.java
new file mode 100644
index 0000000..d9bef9b
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanelFactory.java
@@ -0,0 +1,46 @@
+/*
+ * 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.entity.header;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.entity.EntityComponentFactoryAbstract;
+
+/**
+ * {@link ComponentFactory} for {@link EntityHeaderPanel}.
+ */
+public class EntityHeaderPanelFactory extends EntityComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public EntityHeaderPanelFactory() {
+ super(ComponentType.ENTITY_SUMMARY, EntityHeaderPanel.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final EntityModel entityModel = (EntityModel) model;
+ return new EntityHeaderPanel(id, entityModel);
+ }
+}
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/entity/icontitle/EntityIconAndTitlePanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.html
new file mode 100644
index 0000000..4c919af
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.html
@@ -0,0 +1,34 @@
+<?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="entityLinkWrapper" class="entityIconAndTitlePanel entityIconAndTitleComponentType">
+ <a href="#" wicket:id="entityLink" class="entityUrlSource">
+ <span wicket:id="entityFontAwesome"></span>
+ <img wicket:id="entityImage" class="entityImage"/>
+ <span wicket:id="entityTitle" class="entityTitle">[title]</span>
+ </a>
+ <wicket:child/>
+ </span>
+ </wicket:panel>
+ </body>
+</html>
+