http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/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 deleted file mode 100644 index 49be8db..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java +++ /dev/null @@ -1,204 +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.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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummaryFactory.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummaryFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummaryFactory.java deleted file mode 100644 index 1c75d2a..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummaryFactory.java +++ /dev/null @@ -1,94 +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.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.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 Model.of("Summary"); - } - - @Override - public IModel<String> getCssClass() { - return Model.of("fa fa-fw fa-usd"); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.html deleted file mode 100644 index 8a1f128..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.html +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<html xmlns="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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.java deleted file mode 100644 index fd36e9a..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanel.java +++ /dev/null @@ -1,43 +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.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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanelFactory.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanelFactory.java deleted file mode 100644 index d2f340b..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/unresolved/CollectionContentsAsUnresolvedPanelFactory.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved; - -import org.apache.wicket.Component; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; - -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 Model.of("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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.html deleted file mode 100644 index f9e6a25..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.html +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" - xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" - xml:lang="en" - lang="en"> - <body> - <wicket:panel> - <div class="emptyCollectionPanel"> - <form> - <p>No objects returned</p> - </form> - </div> - </wicket:panel> - </body> -</html> http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.java deleted file mode 100644 index 0bc44f3..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanel.java +++ /dev/null @@ -1,38 +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.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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanelFactory.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanelFactory.java deleted file mode 100644 index 0fc2fde..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/empty/EmptyCollectionPanelFactory.java +++ /dev/null @@ -1,52 +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.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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/EntityComponentFactoryAbstract.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/EntityComponentFactoryAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/EntityComponentFactoryAbstract.java deleted file mode 100644 index 717caf3..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/EntityComponentFactoryAbstract.java +++ /dev/null @@ -1,65 +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.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.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; - final ObjectAdapter adapter = entityModel.getObject(); - 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/d84c6609/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 deleted file mode 100644 index 2d39517..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<html xmlns:wicket="http://wicket.apache.org"> - <body> - <wicket:panel> - <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/d84c6609/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 deleted file mode 100644 index 5b50367..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.viewer.wicket.ui.components.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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanelFactory.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanelFactory.java deleted file mode 100644 index e2947a0..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanelFactory.java +++ /dev/null @@ -1,49 +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.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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.html deleted file mode 100644 index 540bb11..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.html +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<html xmlns:wicket="http://wicket.apache.org"> -<body> -<wicket:panel> - <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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.java deleted file mode 100644 index ee26581..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanel.java +++ /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. - */ - -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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanelFactory.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanelFactory.java deleted file mode 100644 index a42f062..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/combined/EntityCombinedPanelFactory.java +++ /dev/null @@ -1,48 +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.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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.html deleted file mode 100644 index 76d70e6..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.html +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<html xmlns:wicket="http://wicket.apache.org"> - <body> - <wicket:panel> - <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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.java deleted file mode 100644 index e1ab0c1..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.java +++ /dev/null @@ -1,106 +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.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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanelFactory.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanelFactory.java deleted file mode 100644 index d9bef9b..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanelFactory.java +++ /dev/null @@ -1,46 +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.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/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.html deleted file mode 100644 index 4c919af..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.html +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<html xmlns:wicket="http://wicket.apache.org"> - <body> - <wicket:panel> - <span wicket:id="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> - http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java deleted file mode 100644 index 54f64f4..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java +++ /dev/null @@ -1,217 +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.entity.icontitle; - -import com.google.inject.Inject; -import org.apache.wicket.AttributeModifier; -import org.apache.wicket.Page; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.image.Image; -import org.apache.wicket.markup.html.link.AbstractLink; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.request.resource.ResourceReference; -import org.apache.isis.core.metamodel.adapter.ObjectAdapter; -import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking; -import org.apache.isis.core.metamodel.facets.members.cssclassfa.CssClassFaFacet; -import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings; -import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento; -import org.apache.isis.viewer.wicket.model.models.EntityModel; -import org.apache.isis.viewer.wicket.model.models.ImageResourceCache; -import org.apache.isis.viewer.wicket.model.models.PageType; -import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.EntityActionLinkFactory; -import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry; -import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistryAccessor; -import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract; -import org.apache.isis.viewer.wicket.ui.util.Components; -import org.apache.isis.viewer.wicket.ui.util.CssClassAppender; -import org.apache.isis.viewer.wicket.ui.util.Links; - -/** - * {@link PanelAbstract Panel} representing the icon and title of an entity, - * as per the provided {@link EntityModel}. - */ -public class EntityIconAndTitlePanel extends PanelAbstract<EntityModel> { - - private static final long serialVersionUID = 1L; - - private static final String ID_ENTITY_LINK_WRAPPER = "entityLinkWrapper"; - private static final String ID_ENTITY_FONT_AWESOME = "entityFontAwesome"; - private static final String ID_ENTITY_LINK = "entityLink"; - private static final String ID_ENTITY_TITLE = "entityTitle"; - private static final String ID_ENTITY_ICON = "entityImage"; - - @SuppressWarnings("unused") - private Label label; - @SuppressWarnings("unused") - private Image image; - - public EntityIconAndTitlePanel(final String id, final EntityModel entityModel) { - super(id, entityModel); - } - - /** - * For the {@link EntityActionLinkFactory}. - */ - public EntityModel getEntityModel() { - return getModel(); - } - - @Override - protected void onBeforeRender() { - buildGui(); - super.onBeforeRender(); - } - - private void buildGui() { - addOrReplaceLinkWrapper(); - setOutputMarkupId(true); - } - - private void addOrReplaceLinkWrapper() { - EntityModel entityModel = getModel(); - final WebMarkupContainer entityLinkWrapper = addOrReplaceLinkWrapper(entityModel); - addOrReplace(entityLinkWrapper); - } - - protected WebMarkupContainer addOrReplaceLinkWrapper(final EntityModel entityModel) { - final ObjectAdapter adapter = entityModel.getObject(); - - final WebMarkupContainer entityLinkWrapper = new WebMarkupContainer(ID_ENTITY_LINK_WRAPPER); - - final AbstractLink link = createIconAndTitle(adapter); - entityLinkWrapper.addOrReplace(link); - - return entityLinkWrapper; - } - - private AbstractLink createIconAndTitle(final ObjectAdapter adapter) { - final AbstractLink link = createLinkWrapper(); - - final String title = determineTitle(); - - final String iconName = adapter.getIconName(); - final CssClassFaFacet cssClassFaFacet = adapter.getSpecification().getFacet(CssClassFaFacet.class); - if (iconName != null || cssClassFaFacet == null) { - link.addOrReplace(this.image = newImage(ID_ENTITY_ICON, adapter)); - Components.permanentlyHide(link, ID_ENTITY_FONT_AWESOME); - } else { - Label dummy = new Label(ID_ENTITY_FONT_AWESOME, ""); - link.addOrReplace(dummy); - dummy.add(new CssClassAppender(cssClassFaFacet.value() + " fa-2x")); - Components.permanentlyHide(link, ID_ENTITY_ICON); - } - - link.addOrReplace(this.label = newLabel(ID_ENTITY_TITLE, titleAbbreviated(title))); - - String entityTypeName = adapter.getSpecification().getSingularName(); - link.add(new AttributeModifier("title", entityTypeName + ": " + title)); - - return link; - } - - private AbstractLink createLinkWrapper() { - final PageParameters pageParameters = getModel().getPageParametersWithoutUiHints(); - - final Class<? extends Page> pageClass = getPageClassRegistry().getPageClass(PageType.ENTITY); - return Links.newBookmarkablePageLink(ID_ENTITY_LINK, pageParameters, pageClass); - } - - private Label newLabel(final String id, final String title) { - return new Label(id, title); - } - - private String titleAbbreviated(String titleString) { - int maxTitleLength = abbreviateTo(getModel(), titleString); - return abbreviated(titleString, maxTitleLength); - } - - private String determineTitle() { - EntityModel model = getModel(); - final ObjectAdapter adapter = model.getObject(); - return adapter != null ? adapter.titleString(getContextAdapterIfAny()) : "(no object)"; - } - - private int abbreviateTo(EntityModel model, String titleString) { - if(model.getRenderingHint().isInStandaloneTableTitleColumn()) { - return getSettings().getMaxTitleLengthInStandaloneTables(); - } - if(model.getRenderingHint().isInParentedTableTitleColumn()) { - return getSettings().getMaxTitleLengthInParentedTables(); - } - return titleString.length(); - } - - protected Image newImage(final String id, final ObjectAdapter adapter) { - final ResourceReference imageResource = imageCache.resourceReferenceFor(adapter); - - final Image image = new Image(id, imageResource) { - private static final long serialVersionUID = 1L; - @Override - protected boolean shouldAddAntiCacheParameter() { - return false; - } - }; - return image; - } - - public ObjectAdapter getContextAdapterIfAny() { - EntityModel model = getModel(); - ObjectAdapterMemento contextAdapterMementoIfAny = model.getContextAdapterIfAny(); - return contextAdapterMementoIfAny != null? contextAdapterMementoIfAny.getObjectAdapter(ConcurrencyChecking.NO_CHECK): null; - } - - static String abbreviated(final String str, final int maxLength) { - int length = str.length(); - if (length <= maxLength) { - return str; - } - return maxLength <= 3 ? "" : str.substring(0, maxLength - 3) + "..."; - } - - - - // /////////////////////////////////////////////////////////////////// - // Convenience - // /////////////////////////////////////////////////////////////////// - - protected PageClassRegistry getPageClassRegistry() { - final PageClassRegistryAccessor pcra = (PageClassRegistryAccessor) getApplication(); - return pcra.getPageClassRegistry(); - } - - - // /////////////////////////////////////////////// - // Dependency Injection - // /////////////////////////////////////////////// - - @Inject - private ImageResourceCache imageCache; - protected ImageResourceCache getImageCache() { - return imageCache; - } - - @Inject - private WicketViewerSettings settings; - protected WicketViewerSettings getSettings() { - return settings; - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanelFactory.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanelFactory.java deleted file mode 100644 index 9a2db9b..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanelFactory.java +++ /dev/null @@ -1,46 +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.entity.icontitle; - -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 EntityIconAndTitlePanel}. - */ -public class EntityIconAndTitlePanelFactory extends EntityComponentFactoryAbstract { - - private static final long serialVersionUID = 1L; - - public EntityIconAndTitlePanelFactory() { - super(ComponentType.ENTITY_ICON_AND_TITLE, EntityIconAndTitlePanel.class); - } - - @Override - public Component createComponent(final String id, final IModel<?> model) { - final EntityModel entityModel = (EntityModel) model; - return new EntityIconAndTitlePanel(id, entityModel); - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconTitleAndCopyLinkPanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconTitleAndCopyLinkPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconTitleAndCopyLinkPanel.html deleted file mode 100644 index 18b0521..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconTitleAndCopyLinkPanel.html +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<html xmlns:wicket="http://wicket.apache.org"> - <body> - <wicket:extend> - <span wicket:id="copyLink"></span> - </wicket:extend> - </body> -</html> http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconTitleAndCopyLinkPanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconTitleAndCopyLinkPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconTitleAndCopyLinkPanel.java deleted file mode 100644 index e6500b9..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconTitleAndCopyLinkPanel.java +++ /dev/null @@ -1,49 +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.entity.icontitle; - -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.isis.viewer.wicket.model.models.EntityModel; -import org.apache.isis.viewer.wicket.ui.components.widgets.zclip.ZeroClipboardPanel; - -/** - * An extension of {@link org.apache.isis.viewer.wicket.ui.components.entity.icontitle.EntityIconAndTitlePanel} - * that additionally has a link allowing to copy the url to the shown entity - */ -public class EntityIconTitleAndCopyLinkPanel extends EntityIconAndTitlePanel { - - private static final long serialVersionUID = 1L; - - private static final String ID_COPY_LINK = "copyLink"; - - public EntityIconTitleAndCopyLinkPanel(final String id, final EntityModel entityModel) { - super(id, entityModel); - } - - @Override - protected WebMarkupContainer addOrReplaceLinkWrapper(final EntityModel entityModel) { - WebMarkupContainer linkWrapper = super.addOrReplaceLinkWrapper(entityModel); - - ZeroClipboardPanel zClipCopyLink = new ZeroClipboardPanel(ID_COPY_LINK, entityModel); - linkWrapper.add(zClipCopyLink); - - return linkWrapper; - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconTitleAndCopyLinkPanelFactory.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconTitleAndCopyLinkPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconTitleAndCopyLinkPanelFactory.java deleted file mode 100644 index a13e1dd..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconTitleAndCopyLinkPanelFactory.java +++ /dev/null @@ -1,44 +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.entity.icontitle; - -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.ComponentType; -import org.apache.isis.viewer.wicket.ui.components.entity.EntityComponentFactoryAbstract; - -/** - * {@link org.apache.isis.viewer.wicket.ui.ComponentFactory} for {@link org.apache.isis.viewer.wicket.ui.components.entity.icontitle.EntityIconAndTitlePanel}. - */ -public class EntityIconTitleAndCopyLinkPanelFactory extends EntityComponentFactoryAbstract { - - private static final long serialVersionUID = 1L; - - public EntityIconTitleAndCopyLinkPanelFactory() { - super(ComponentType.ENTITY_ICON_TITLE_AND_COPYLINK, EntityIconTitleAndCopyLinkPanel.class); - } - - @Override - public Component createComponent(final String id, final IModel<?> model) { - final EntityModel entityModel = (EntityModel) model; - return new EntityIconTitleAndCopyLinkPanel(id, entityModel); - } -}