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 2014/11/10 11:23:28 UTC
[21/23] isis git commit: ISIS-537: tidy up of (entity) collections
panel;
standalone collections panel no longer failing (but still need to sort out CSS
and bulk actions)
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/HasSelectorDropdownPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/HasSelectorDropdownPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/HasSelectorDropdownPanel.java
deleted file mode 100644
index 9011edf..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/HasSelectorDropdownPanel.java
+++ /dev/null
@@ -1,23 +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.collectioncontents.selector.dropdown;
-
-public interface HasSelectorDropdownPanel {
- CollectionContentsSelectorDropdownPanel getSelectorDropdownPanel();
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css
deleted file mode 100644
index 8c3902e..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css
+++ /dev/null
@@ -1,60 +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.
- */
-.linksSelectorPanel .viewLinks {
- float:right;
- display:block;
-}
-
-.linksSelectorPanel ul.dropdown-menu {
- min-width: 0;
-}
-
-.linksSelectorPanel ul.dropdown-menu li.viewItem {
- min-width: 0;
-}
-
-.linksSelectorPanel ul.viewList li.viewItem:first-child span {
- border-radius:4px 0 0 4px;
- -moz-border-radius:4px 0 0 4px;
- -webkit-border-radius:4px 0 0 4px;
-}
-
-.linksSelectorPanel ul.viewList li.viewItem:last-child span {
- border-radius:0 4px 4px 0;
- -moz-border-radius:0 4px 4px 0;
- -webkit-border-radius:0 4px 4px 0;
-}
-
-
-.linksSelectorPanel .link-selector-panel-invisible {
- display:none;
-}
-
-.linksSelectorPanel .list-inline {
- margin-left: 0;
-}
-
-.linksSelectorPanel .list-inline li {
- padding-left: 0;
-}
-
-
-.collectionContentsLinksSelectorPanel select {
- margin-bottom: 1em;
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
deleted file mode 100644
index 0a6d242..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
+++ /dev/null
@@ -1,41 +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: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/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
deleted file mode 100644
index 42616ff..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
+++ /dev/null
@@ -1,243 +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.collectioncontents.selector.links;
-
-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.wicket.markup.head.IHeaderResponse;
-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.CollectionCountProvider;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorDropdownPanel;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorHelper;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.HasSelectorDropdownPanel;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
-import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
-import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
-
-/**
- * Provides a list of links for selecting other views that support
- * {@link ComponentType#COLLECTION_CONTENTS} with a backing
- * {@link EntityCollectionModel}.
- */
-public class CollectionContentsLinksSelectorPanel
- 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 ID_SELECTOR_DROPDOWN = "selectorDropdown";
-
- private static final String UIHINT_VIEW = "view";
-
- private final ComponentFactory ignoreFactory;
-
- private final ComponentType componentType;
- private final String underlyingIdPrefix;
- private final CollectionContentsSelectorHelper selectorHelper;
-
- private ComponentFactory selectedComponentFactory;
- private Component selectedComponent;
-
- private Component[] underlyingViews;
- private CollectionContentsSelectorDropdownPanel selectorDropdownPanel;
-
- public CollectionContentsLinksSelectorPanel(
- 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 CollectionContentsSelectorHelper(model, getComponentFactoryRegistry(), ignoreFactory);
-
- }
-
- /**
- * Build UI only after added to parent.
- */
- public void onInitialize() {
- super.onInitialize();
- addUnderlyingViews();
- }
-
-
- private void addUnderlyingViews() {
- final EntityCollectionModel model = getModel();
-
- final int selected = selectorHelper.honourViewHintElseDefault(getSelectorDropdownPanel());
- final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
-
- // create all, hide the one not selected
- underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
- int i = 0;
- 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++;
- }
-
- // selector
-// if (componentFactories.size() <= 1) {
-// permanentlyHide(ID_SELECTOR_DROPDOWN);
-// } else {
-// final Model<ComponentFactory> componentFactoryModel = new Model<>();
-//
-// this.selectedComponentFactory = componentFactories.get(selected);
-// componentFactoryModel.setObject(this.selectedComponentFactory);
-//
-// selectorDropdownPanel = new CollectionContentsSelectorDropdownPanel(ID_SELECTOR_DROPDOWN, getModel(), ignoreFactory);
-//
-// addOrReplace(selectorDropdownPanel);
-// }
-
- 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;
- String viewStr = uiHintContainer.getHint(this.getSelectorDropdownPanel(), UIHINT_VIEW);
-
- List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
-
- if(viewStr != null) {
- try {
- int view = Integer.parseInt(viewStr);
- if(view >= 0 && view < componentFactories.size()) {
- underlyingViewNum = view;
- }
- } catch(NumberFormatException ex) {
- // ignore
- }
- }
-
- 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, getSelectorDropdownPanel());
- }
-
- }
-
-
- 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 void renderHead(final IHeaderResponse response) {
- super.renderHead(response);
- PanelUtil.renderHead(response, CollectionContentsLinksSelectorPanel.class);
- }
-
-
-
- @Override
- public Integer getCount() {
- if(selectedComponent instanceof CollectionCountProvider) {
- final CollectionCountProvider collectionCountProvider = (CollectionCountProvider) selectedComponent;
- return collectionCountProvider.getCount();
- } else {
- return null;
- }
- }
-
- /**
- * Searches up the component hierarchy looking for a parent that implements
- * {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.HasSelectorDropdownPanel}.
- * @return
- */
- private CollectionContentsSelectorDropdownPanel getSelectorDropdownPanel() {
- Component component = this;
- while(component != null) {
- if(component instanceof HasSelectorDropdownPanel) {
- final CollectionContentsSelectorDropdownPanel selectorDropdownPanel1 = ((HasSelectorDropdownPanel) component).getSelectorDropdownPanel();
- if(selectorDropdownPanel1 == null) {
- throw new IllegalStateException("Found parent that implements HasSelectorDropdownPanel, but no SelectorDropdownPanel available (is null)");
-
- }
- return selectorDropdownPanel1;
- }
- component = component.getParent();
- }
- throw new IllegalStateException("Could not locate parent that implements HasSelectorDropdownPanel");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java
deleted file mode 100644
index a93790e..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java
+++ /dev/null
@@ -1,53 +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.collectioncontents.selector.links;
-
-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 CollectionContentsLinksSelectorPanel}.
- */
-public class CollectionContentsLinksSelectorPanelFactory extends ComponentFactoryAbstract {
-
- private static final long serialVersionUID = 1L;
-
- public CollectionContentsLinksSelectorPanelFactory() {
- super(ComponentType.COLLECTION_CONTENTS,
- CollectionContentsLinksSelectorPanel.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 CollectionContentsLinksSelectorPanel(id, collectionModel, this);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java
index 4d0bf49..32809e5 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java
@@ -42,7 +42,7 @@ 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.CollectionCountProvider;
+import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
index 106afa7..9d0ac51 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
@@ -28,14 +28,6 @@
<span wicket:id="collectionName" class="panel-title">[collection name]</span>
<div class="pull-right">
- <!--
- <div class="btn-group">
- <a href="#" class="btn btn-default btn-sm">## Lock</a>
- <a href="#" class="btn btn-default btn-sm">## Delete</a>
- <a href="#" class="btn btn-default btn-sm">## Move</a>
- </div>
- -->
-
<div class="btn-group">
<div wicket:id="additionalLinks"></div>
</div>
@@ -43,23 +35,9 @@
<span wicket:id="selectorDropdown"/>
</div>
- <!--
- <div class="btn-group">
- <ul xxwicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">
- <li xxwicket:id="viewItem" class="viewItem">
- <a href="#" xxwicket:id="viewLink">
- <span xxwicket:id="viewItemIcon" class="ViewLinkItem"></span> <span xxwicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
- </a>
- </li>
- </ul>
- </div>
- -->
-
</div>
</div>
-
-
<div wicket:id="collection" class="collection panel-body">
[collection]
</div>
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
index 1a8649c..876177d 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
@@ -20,7 +20,6 @@
package org.apache.isis.viewer.wicket.ui.components.entity.collections;
import java.util.List;
-import org.apache.wicket.Component;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.repeater.RepeatingView;
@@ -40,9 +39,9 @@ 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.additionallinks.AdditionalLinksPanel;
import org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorDropdownPanel;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorHelper;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links.CollectionContentsLinksSelectorPanelFactory;
+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.collectioncontents.multiple.CollectionContentsMultipleViewsPanelFactory;
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;
@@ -62,13 +61,8 @@ public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
private static final String ID_COLLECTION = "collection";
private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
-
private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
-
- private ComponentFactory selectedComponentFactory;
- private Component selectedComponent;
-
public EntityCollectionsPanel(final String id, final EntityModel entityModel) {
super(id, entityModel);
@@ -130,24 +124,26 @@ public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
final EntityCollectionModel entityCollectionModel = collectionPanel.getModel();
List<LinkAndLabel> links = entityCollectionModel.getLinks();
+
AdditionalLinksPanel additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
fieldset.addOrReplace(additionalLinks);
- CollectionContentsSelectorHelper selectorHelper = new CollectionContentsSelectorHelper(entityCollectionModel, getComponentFactoryRegistry(), new CollectionContentsLinksSelectorPanelFactory());
+ final CollectionSelectorHelper selectorHelper = new CollectionSelectorHelper(entityCollectionModel, getComponentFactoryRegistry(), new CollectionContentsMultipleViewsPanelFactory());
final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
if (componentFactories.size() <= 1) {
permanentlyHide(ID_SELECTOR_DROPDOWN);
} else {
- CollectionContentsSelectorDropdownPanel selectorDropdownPanel;
- selectorDropdownPanel = new CollectionContentsSelectorDropdownPanel(ID_SELECTOR_DROPDOWN, entityCollectionModel, new CollectionContentsLinksSelectorPanelFactory());
+ CollectionSelectorPanel selectorDropdownPanel;
+ selectorDropdownPanel = new CollectionSelectorPanel(ID_SELECTOR_DROPDOWN, entityCollectionModel, new CollectionContentsMultipleViewsPanelFactory());
final Model<ComponentFactory> componentFactoryModel = new Model<>();
final int selected = selectorHelper.honourViewHintElseDefault(selectorDropdownPanel);
- this.selectedComponentFactory = componentFactories.get(selected);
- componentFactoryModel.setObject(this.selectedComponentFactory);
+
+ ComponentFactory selectedComponentFactory = componentFactories.get(selected);
+ componentFactoryModel.setObject(selectedComponentFactory);
this.setOutputMarkupId(true);
fieldset.addOrReplace(selectorDropdownPanel);
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css
index b88fe0c..eea4518 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css
@@ -39,4 +39,4 @@ div.standaloneCollectionPanel .iconAndTitle {
line-height:150%;
clear:both;
}
-
\ No newline at end of file
+
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
index e664e3a..d09c0bd 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
@@ -24,12 +24,29 @@
lang="en">
<body>
<wicket:panel>
+
<div class="standaloneCollectionPanel actionComponentType myBlockContainer panel panel-default">
<div class="iconAndTitle panel-heading actionPanelHeaderNew">
<div wicket:id="actionName" class="actionName panel-title">[action name]</div>
+
+ <div class="pull-right">
+
+ <!--
+ <div class="btn-group">
+ <div xxxwicket:id="additionalLinks"></div>
+ </div>
+ -->
+ <div class="btn-group">
+ <span wicket:id="selectorDropdown"/>
+ </div>
+
+ </div>
+
</div>
+
<div wicket:id="collectionContents" class="panel-body"></div>
</div>
+
</wicket:panel>
</body>
</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
index 80fd5fe..7ac4640 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
@@ -19,22 +19,32 @@
package org.apache.isis.viewer.wicket.ui.components.standalonecollection;
+import java.util.List;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.Model;
import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
import org.apache.isis.viewer.wicket.model.models.ActionModel;
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.app.registry.ComponentFactoryRegistry;
-import org.apache.isis.viewer.wicket.ui.components.collection.CollectionCountProvider;
+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.components.collectioncontents.multiple.CollectionContentsMultipleViewsPanelFactory;
import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionModel> implements CollectionCountProvider {
+public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionModel>
+ implements CollectionCountProvider, CollectionSelectorProvider {
private static final long serialVersionUID = 1L;
private static final String ID_ACTION_NAME = "actionName";
+ private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
+ private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
+ private CollectionSelectorPanel selectorDropdownPanel;
public StandaloneCollectionPanel(final String id, final EntityCollectionModel entityCollectionModel) {
super(id, entityCollectionModel);
@@ -42,11 +52,34 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
}
private void buildGui(final EntityCollectionModel entityCollectionModel) {
-
+
ActionModel actionModel = entityCollectionModel.getActionModelHint();
ObjectAction action = actionModel.getActionMemento().getAction();
addOrReplace(new Label(StandaloneCollectionPanel.ID_ACTION_NAME, Model.of(action.getName())));
-
+
+ final CollectionSelectorHelper selectorHelper = new CollectionSelectorHelper(entityCollectionModel, getComponentFactoryRegistry(), new CollectionContentsMultipleViewsPanelFactory());
+
+ final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
+
+ if (componentFactories.size() <= 1) {
+ permanentlyHide(ID_SELECTOR_DROPDOWN);
+ } else {
+ CollectionSelectorPanel selectorDropdownPanel;
+ selectorDropdownPanel = new CollectionSelectorPanel(ID_SELECTOR_DROPDOWN, entityCollectionModel, new CollectionContentsMultipleViewsPanelFactory());
+
+ final Model<ComponentFactory> componentFactoryModel = new Model<>();
+
+ final int selected = selectorHelper.honourViewHintElseDefault(selectorDropdownPanel);
+
+ ComponentFactory selectedComponentFactory = componentFactories.get(selected);
+ componentFactoryModel.setObject(selectedComponentFactory);
+
+ this.setOutputMarkupId(true);
+ addOrReplace(selectorDropdownPanel);
+
+ this.selectorDropdownPanel = selectorDropdownPanel;
+ }
+
final ComponentFactoryRegistry componentFactoryRegistry = getComponentFactoryRegistry();
componentFactoryRegistry.addOrReplaceComponent(this, ComponentType.COLLECTION_CONTENTS, entityCollectionModel);
}
@@ -57,4 +90,8 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
return model.getCount();
}
+ @Override
+ public CollectionSelectorPanel getSelectorDropdownPanel() {
+ return selectorDropdownPanel;
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionContentsSelectorDropdownPanelTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionContentsSelectorDropdownPanelTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionContentsSelectorDropdownPanelTest.java
new file mode 100644
index 0000000..408dd28
--- /dev/null
+++ b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionContentsSelectorDropdownPanelTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.collection.selector;
+
+import java.util.Arrays;
+import java.util.List;
+import org.jmock.auto.Mock;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class CollectionContentsSelectorDropdownPanelTest {
+
+ @Rule
+ public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+ @Mock
+ private ComponentFactory one;
+
+ @Mock
+ private ComponentFactory two;
+
+ private ComponentFactory ajaxTableComponentFactory;
+
+ @Before
+ public void setUp() throws Exception {
+ ajaxTableComponentFactory = new CollectionContentsAsAjaxTablePanelFactory();
+ }
+
+ @Test
+ public void testOrderAjaxTableToEnd() {
+
+ List<ComponentFactory> componentFactories =
+ Arrays.<ComponentFactory>asList(
+ one,
+ ajaxTableComponentFactory,
+ two);
+ List<ComponentFactory> orderAjaxTableToEnd = CollectionSelectorHelper.orderAjaxTableToEnd(componentFactories);
+ assertThat(orderAjaxTableToEnd.get(0), is(one));
+ assertThat(orderAjaxTableToEnd.get(1), is(two));
+ assertThat(orderAjaxTableToEnd.get(2), is(ajaxTableComponentFactory));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
deleted file mode 100644
index 6b94417..0000000
--- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
+++ /dev/null
@@ -1,67 +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.collectioncontents.selector.dropdown;
-
-import java.util.Arrays;
-import java.util.List;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.wicket.ui.ComponentFactory;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public class CollectionContentsSelectorDropdownPanelTest {
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- @Mock
- private ComponentFactory one;
-
- @Mock
- private ComponentFactory two;
-
- private ComponentFactory ajaxTableComponentFactory;
-
- @Before
- public void setUp() throws Exception {
- ajaxTableComponentFactory = new CollectionContentsAsAjaxTablePanelFactory();
- }
-
- @Test
- public void testOrderAjaxTableToEnd() {
-
- List<ComponentFactory> componentFactories =
- Arrays.<ComponentFactory>asList(
- one,
- ajaxTableComponentFactory,
- two);
- List<ComponentFactory> orderAjaxTableToEnd = CollectionContentsSelectorHelper.orderAjaxTableToEnd(componentFactories);
- assertThat(orderAjaxTableToEnd.get(0), is(one));
- assertThat(orderAjaxTableToEnd.get(1), is(two));
- assertThat(orderAjaxTableToEnd.get(2), is(ajaxTableComponentFactory));
- }
-
-}