You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/09/03 14:32:07 UTC
[16/87] [abbrv] [partial] isis git commit: ISIS-1194: moving the
wicket submodules to be direct children of core;
removing the isis-viewer-wicket parent pom.
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java b/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
deleted file mode 100644
index 85107cf..0000000
--- a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
+++ /dev/null
@@ -1,689 +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.model.models;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.Set;
-import com.google.common.collect.Maps;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.isis.applib.annotation.BookmarkPolicy;
-import org.apache.isis.applib.services.memento.MementoService.Memento;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacet;
-import org.apache.isis.core.metamodel.facets.object.bookmarkpolicy.BookmarkPolicyFacet;
-import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.ObjectSpecifications.MemberGroupLayoutHint;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.core.runtime.services.memento.MementoServiceDefault;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.wicket.model.common.PageParametersUtils;
-import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-import org.apache.isis.viewer.wicket.model.mementos.PageParameterNames;
-import org.apache.isis.viewer.wicket.model.mementos.PropertyMemento;
-
-/**
- * Backing model to represent a {@link ObjectAdapter}.
- *
- * <p>
- * So that the model is {@link Serializable}, the {@link ObjectAdapter} is
- * stored as a {@link ObjectAdapterMemento}.
- */
-public class EntityModel extends BookmarkableModel<ObjectAdapter> {
-
- private static final long serialVersionUID = 1L;
-
-
- // //////////////////////////////////////////////////////////
- // factory methods for PageParameters
- // //////////////////////////////////////////////////////////
-
- /**
- * Factory method for creating {@link PageParameters} to represent an
- * entity.
- */
- public static PageParameters createPageParameters(final ObjectAdapter adapter) {
-
- final PageParameters pageParameters = PageParametersUtils.newPageParameters();
-
- final Boolean persistent = adapter != null && adapter.representsPersistent();
-
- if (persistent) {
- final String oidStr = adapter.getOid().enStringNoVersion(getOidMarshaller());
-
- PageParameterNames.OBJECT_OID.addStringTo(pageParameters, oidStr);
- } else {
- // don't do anything; instead the page should be redirected back to
- // an EntityPage so that the underlying EntityModel that contains
- // the memento for the transient ObjectAdapter can be accessed.
- }
- return pageParameters;
- }
-
-
- public enum RenderingHint {
- REGULAR,
- PROPERTY_COLUMN,
- PARENTED_TITLE_COLUMN,
- STANDALONE_TITLE_COLUMN;
-
- public boolean isRegular() {
- return this == REGULAR;
- }
-
- public boolean isInTablePropertyColumn() {
- return this == PROPERTY_COLUMN;
- }
-
- public boolean isInTable() {
- return isInTablePropertyColumn() || isInTableTitleColumn();
- }
-
- public boolean isInTableTitleColumn() {
- return isInParentedTableTitleColumn() || isInStandaloneTableTitleColumn();
- }
-
- public boolean isInParentedTableTitleColumn() {
- return this == PARENTED_TITLE_COLUMN;
- }
-
- public boolean isInStandaloneTableTitleColumn() {
- return this == STANDALONE_TITLE_COLUMN;
- }
- }
-
- public enum Mode {
- VIEW, EDIT;
- }
-
- private ObjectAdapterMemento adapterMemento;
- private Mode mode = Mode.VIEW;
- private RenderingHint renderingHint = RenderingHint.REGULAR;
- private final Map<PropertyMemento, ScalarModel> propertyScalarModels = Maps.newHashMap();
- private MemberGroupLayoutHint memberGroupLayoutHint;
-
- /**
- * Toggled by 'entityDetailsButton'.
- */
- private boolean entityDetailsVisible;
-
- /**
- * {@link ConcurrencyException}, if any, that might have occurred previously
- */
- private ConcurrencyException concurrencyException;
-
- private final HintPageParameterSerializer hintPageParameterSerializer = new HintPageParameterSerializerDirect();
-
- // //////////////////////////////////////////////////////////
- // constructors
- // //////////////////////////////////////////////////////////
-
- public EntityModel() {
- pendingModel = new PendingModel(this);
- }
-
- public EntityModel(final PageParameters pageParameters) {
- this(ObjectAdapterMemento.createPersistent(rootOidFrom(pageParameters)));
- hintPageParameterSerializer.pageParametersToHints(pageParameters, getHints());
- }
- public EntityModel(final ObjectAdapter adapter) {
- this(ObjectAdapterMemento.createOrNull(adapter));
- setObject(adapter);
- }
-
- public EntityModel(final ObjectAdapterMemento adapterMemento) {
- this.adapterMemento = adapterMemento;
- this.pendingModel = new PendingModel(this);
- }
-
- public static String oidStr(final PageParameters pageParameters) {
- return PageParameterNames.OBJECT_OID.getStringFrom(pageParameters);
- }
-
- private static RootOid rootOidFrom(final PageParameters pageParameters) {
- return getOidMarshaller().unmarshal(oidStr(pageParameters), RootOid.class);
- }
-
-
- //////////////////////////////////////////////////
- // BookmarkableModel
- //////////////////////////////////////////////////
-
-
- @Override
- public PageParameters getPageParameters() {
- PageParameters pageParameters = createPageParameters(getObject());
- hintPageParameterSerializer.hintsToPageParameters(getHints(), pageParameters);
- return pageParameters;
- }
-
- @Deprecated
- public PageParameters asPageParameters() {
- return getPageParameters();
- }
-
- public PageParameters getPageParametersWithoutUiHints() {
- return createPageParameters(getObject());
- }
-
-
- static interface HintPageParameterSerializer {
- public void hintsToPageParameters(Map<String,String> hints, PageParameters pageParameters);
- public void pageParametersToHints(final PageParameters pageParameters, Map<String,String> hints);
- }
-
- static class HintPageParameterSerializerDirect implements HintPageParameterSerializer, Serializable {
-
- private static final long serialVersionUID = 1L;
-
- public void hintsToPageParameters(Map<String,String> hints, PageParameters pageParameters) {
- Set<String> hintKeys = hints.keySet();
- for (String key : hintKeys) {
- String value = hints.get(key);
- pageParameters.add("hint-" + key, value);
- }
- }
-
- @Override
- public void pageParametersToHints(final PageParameters pageParameters, Map<String,String> hints) {
- Set<String> namedKeys = pageParameters.getNamedKeys();
- for (String namedKey : namedKeys) {
- if(namedKey.startsWith("hint-")) {
- String value = pageParameters.get(namedKey).toString(null);
- String key = namedKey.substring(5);
- hints.put(key, value); // may replace
- }
- }
- }
- }
-
- static class HintPageParameterSerializerUsingViewModelSupport implements HintPageParameterSerializer, Serializable {
- private static final long serialVersionUID = 1L;
-
- public void hintsToPageParameters(Map<String,String> hints, PageParameters pageParameters) {
- if(hints.isEmpty()) {
- return;
- }
- MementoServiceDefault vms = new MementoServiceDefault();
- Memento memento = vms.create();
- Set<String> hintKeys = hints.keySet();
- for (String key : hintKeys) {
- String safeKey = key.replace(':', '_');
- Serializable value = hints.get(key);
- memento.set(safeKey, value);
- }
- String serializedHints = memento.asString();
- PageParameterNames.ANCHOR.addStringTo(pageParameters, serializedHints);
- }
-
- public void pageParametersToHints(final PageParameters pageParameters, Map<String,String> hints) {
- String hintsStr = PageParameterNames.ANCHOR.getStringFrom(pageParameters);
- if(hintsStr != null) {
- try {
- Memento memento = new MementoServiceDefault().parse(hintsStr);
- Set<String> keys = memento.keySet();
- for (String safeKey : keys) {
- String value = memento.get(safeKey, String.class);
- String key = safeKey.replace('_', ':');
- hints.put(key, value);
- }
- } catch(RuntimeException ex) {
- // fail gracefully, ie ignore.
- System.err.println(ex);
- }
- }
- }
- }
-
-
-
-
- @Override
- public String getTitle() {
- return getObject().titleString(null);
- }
-
- public boolean hasAsRootPolicy() {
- return hasBookmarkPolicy(BookmarkPolicy.AS_ROOT);
- }
-
- public boolean hasAsChildPolicy() {
- return hasBookmarkPolicy(BookmarkPolicy.AS_CHILD);
- }
-
- private boolean hasBookmarkPolicy(final BookmarkPolicy policy) {
- final BookmarkPolicyFacet facet = getBookmarkPolicyFacetIfAny();
- return facet != null && facet.value() == policy;
- }
-
- private BookmarkPolicyFacet getBookmarkPolicyFacetIfAny() {
- final ObjectSpecId specId = getObjectAdapterMemento().getObjectSpecId();
- final ObjectSpecification objectSpec = getSpecificationLoader().lookupBySpecId(specId);
- return objectSpec.getFacet(BookmarkPolicyFacet.class);
- }
-
-
-
- // //////////////////////////////////////////////////////////
- // ObjectAdapterMemento, typeOfSpecification
- // //////////////////////////////////////////////////////////
-
- public ObjectAdapterMemento getObjectAdapterMemento() {
- return adapterMemento;
- }
-
- /**
- * Overridable for submodels (eg {@link ScalarModel}) that know the type of
- * the adapter without there being one.
- */
- public ObjectSpecification getTypeOfSpecification() {
- if (adapterMemento == null) {
- return null;
- }
- return getSpecificationFor(adapterMemento.getObjectSpecId());
- }
-
- private ObjectSpecification getSpecificationFor(ObjectSpecId objectSpecId) {
- return getSpecificationLoader().lookupBySpecId(objectSpecId);
- }
-
- // //////////////////////////////////////////////////////////
- // loadObject, load, setObject
- // //////////////////////////////////////////////////////////
-
- /**
- * Not Wicket API, but used by <tt>EntityPage</tt> to do eager loading
- * when rendering after post-and-redirect.
- * @return
- */
- public ObjectAdapter load(ConcurrencyChecking concurrencyChecking) {
- if (adapterMemento == null) {
- return null;
- }
-
- final ObjectAdapter objectAdapter = adapterMemento.getObjectAdapter(concurrencyChecking);
- return objectAdapter;
- }
-
-
- /**
- * Callback from {@link #getObject()}, defaults to loading the object
- * using {@link ConcurrencyChecking#CHECK strict} checking.
- *
- * <p>
- * If non-strict checking is required, then just call {@link #load(ConcurrencyChecking)} with an
- * argument of {@link ConcurrencyChecking#NO_CHECK} first.
- */
- @Override
- public ObjectAdapter load() {
- return load(ConcurrencyChecking.CHECK);
- }
-
-
- @Override
- public void setObject(final ObjectAdapter adapter) {
- super.setObject(adapter);
- adapterMemento = ObjectAdapterMemento.createOrNull(adapter);
- }
-
-
- // //////////////////////////////////////////////////////////
- // PropertyModels
- // //////////////////////////////////////////////////////////
-
- /**
- * Lazily populates with the current value of each property.
- */
- public ScalarModel getPropertyModel(final PropertyMemento pm) {
- ScalarModel scalarModel = propertyScalarModels.get(pm);
- if (scalarModel == null) {
- scalarModel = new ScalarModel(getObjectAdapterMemento(), pm);
- if (isViewMode()) {
- scalarModel.toViewMode();
- } else {
- scalarModel.toEditMode();
- }
- propertyScalarModels.put(pm, scalarModel);
- }
- return scalarModel;
-
- }
-
- /**
- * Resets the {@link #propertyScalarModels hash} of {@link ScalarModel}s for
- * each {@link PropertyMemento property} to the value held in the underlying
- * {@link #getObject() entity}.
- */
- public void resetPropertyModels() {
- adapterMemento.resetVersion();
- for (final PropertyMemento pm : propertyScalarModels.keySet()) {
- final ScalarModel scalarModel = propertyScalarModels.get(pm);
- final ObjectAdapter associatedAdapter = pm.getProperty().get(getObject());
- scalarModel.setObject(associatedAdapter);
- }
- }
-
- // //////////////////////////////////////////////////////////
- // RenderingHint, Mode, entityDetailsVisible
- // //////////////////////////////////////////////////////////
-
-
- public RenderingHint getRenderingHint() {
- return renderingHint;
- }
- public void setRenderingHint(RenderingHint renderingHint) {
- this.renderingHint = renderingHint;
- }
-
- public ObjectAdapterMemento getContextAdapterIfAny() {
- return contextAdapterIfAny;
- }
-
- /**
- * Used as a hint when the {@link #getRenderingHint()} is {@link RenderingHint#PARENTED_TITLE_COLUMN},
- * provides a context adapter to obtain the title.
- */
- public void setContextAdapterIfAny(ObjectAdapterMemento contextAdapterIfAny) {
- this.contextAdapterIfAny = contextAdapterIfAny;
- }
-
- public Mode getMode() {
- return mode;
- }
-
- protected void setMode(final Mode mode) {
- this.mode = mode;
- }
-
- public boolean isViewMode() {
- return mode == Mode.VIEW;
- }
-
- public boolean isEditMode() {
- return mode == Mode.EDIT;
- }
-
- public EntityModel toEditMode() {
- setMode(Mode.EDIT);
- for (final ScalarModel scalarModel : propertyScalarModels.values()) {
- scalarModel.toEditMode();
- }
- return this;
- }
-
- public EntityModel toViewMode() {
- setMode(Mode.VIEW);
- for (final ScalarModel scalarModel : propertyScalarModels.values()) {
- scalarModel.toViewMode();
- }
- return this;
- }
-
- public boolean isEntityDetailsVisible() {
- return entityDetailsVisible;
- }
-
- public void toggleDetails() {
- entityDetailsVisible = !entityDetailsVisible;
- }
-
- public MemberGroupLayoutHint getMemberGroupLayoutHint() {
- return memberGroupLayoutHint;
- }
- public void setMemberGroupLayoutHint(MemberGroupLayoutHint memberGroupLayoutHint) {
- this.memberGroupLayoutHint = memberGroupLayoutHint;
- }
-
-
-
-
-
- // //////////////////////////////////////////////////////////
- // concurrency exceptions
- // //////////////////////////////////////////////////////////
-
- public void setException(ConcurrencyException ex) {
- this.concurrencyException = ex;
- }
-
- public String getAndClearConcurrencyExceptionIfAny() {
- if(concurrencyException == null) {
- return null;
- }
- final String message = concurrencyException.getMessage();
- concurrencyException = null;
- return message;
- }
-
- // //////////////////////////////////////////////////////////
- // validation & apply
- // //////////////////////////////////////////////////////////
-
- public String getReasonInvalidIfAny() {
- final ObjectAdapter adapter = getObjectAdapterMemento().getObjectAdapter(ConcurrencyChecking.CHECK);
- final Consent validity = adapter.getSpecification().isValid(adapter);
- return validity.isAllowed() ? null : validity.getReason();
- }
-
- /**
- * Apply changes to the underlying adapter (possibly returning a new adapter).
- *
- * @return adapter, which may be different from the original (if a {@link org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet#isCloneable(Object) cloneable} view model, for example.
- */
- public ObjectAdapter apply() {
- ObjectAdapter adapter = getObjectAdapterMemento().getObjectAdapter(ConcurrencyChecking.CHECK);
- for (final ScalarModel scalarModel : propertyScalarModels.values()) {
- final OneToOneAssociation property = scalarModel.getPropertyMemento().getProperty();
-
- //
- // previously there was a guard here to only apply changes provided:
- //
- // property.containsDoOpFacet(NotPersistedFacet.class) == null
- //
- // however, that logic is wrong; although a property may not be directly
- // persisted so far as JDO is concerned, it may be indirectly persisted
- // as the result of business logic in the setter.
- //
- // for example, see ExampleTaggableEntity (in isisaddons-module-tags).
- //
-
- //
- // on the other hand, we mustn't attempt to apply changes for disabled properties...
- // even if the property is persisted (it might be written to by an action), it is never updated by
- // an edit.
- //
- // Fundamentally, then, any non-disabled property (whether persisted or not) should be updated in the
- // Isis runtime.
- //
-
- if(property.containsDoOpFacet(DisabledFacet.class)) {
- // skip, as per comments above
- continue;
- }
-
- final ObjectAdapter associate = scalarModel.getObject();
- property.set(adapter, associate);
- }
-
- final ViewModelFacet recreatableObjectFacet = adapter.getSpecification().getFacet(ViewModelFacet.class);
- if(recreatableObjectFacet != null) {
- final Object viewModel = adapter.getObject();
- final boolean cloneable = recreatableObjectFacet.isCloneable(viewModel);
- if(cloneable) {
- final Object newViewModel = recreatableObjectFacet.clone(viewModel);
- adapter = getAdapterManager().adapterFor(newViewModel);
- }
- }
-
- getObjectAdapterMemento().setAdapter(adapter);
- toViewMode();
-
- return adapter;
- }
-
-
- // //////////////////////////////////////////////////////////
- // Pending
- // //////////////////////////////////////////////////////////
-
- private static final class PendingModel extends Model<ObjectAdapterMemento> {
- private static final long serialVersionUID = 1L;
-
- private final EntityModel entityModel;
-
- /**
- * Whether pending has been set (could have been set to null)
- */
- private boolean hasPending;
- /**
- * The new value (could be set to null; hasPending is used to distinguish).
- */
- private ObjectAdapterMemento pending;
-
-
- public PendingModel(EntityModel entityModel) {
- this.entityModel = entityModel;
- }
-
- @Override
- public ObjectAdapterMemento getObject() {
- if (hasPending) {
- return pending;
- }
- final ObjectAdapter adapter = entityModel.getObject();
- return ObjectAdapterMemento.createOrNull(adapter);
- }
-
- @Override
- public void setObject(final ObjectAdapterMemento adapterMemento) {
- pending = adapterMemento;
- hasPending = true;
- }
-
- public void clearPending() {
- this.hasPending = false;
- this.pending = null;
- }
-
- private ObjectAdapter getPendingAdapter() {
- final ObjectAdapterMemento memento = getObject();
- return memento != null ? memento.getObjectAdapter(ConcurrencyChecking.NO_CHECK) : null;
- }
-
- public ObjectAdapter getPendingElseCurrentAdapter() {
- return hasPending ? getPendingAdapter() : entityModel.getObject();
- }
-
- public ObjectAdapterMemento getPending() {
- return pending;
- }
-
- public void setPending(ObjectAdapterMemento selectedAdapterMemento) {
- this.pending = selectedAdapterMemento;
- hasPending=true;
- }
- }
-
- private final PendingModel pendingModel;
- private ObjectAdapterMemento contextAdapterIfAny;
-
- public ObjectAdapter getPendingElseCurrentAdapter() {
- return pendingModel.getPendingElseCurrentAdapter();
- }
-
- public ObjectAdapter getPendingAdapter() {
- return pendingModel.getPendingAdapter();
- }
-
- public ObjectAdapterMemento getPending() {
- return pendingModel.getPending();
- }
-
- public void setPending(ObjectAdapterMemento selectedAdapterMemento) {
- pendingModel.setPending(selectedAdapterMemento);
- }
-
- public void clearPending() {
- pendingModel.clearPending();
- }
-
-
- // //////////////////////////////////////////////////////////
- // equals, hashCode
- // //////////////////////////////////////////////////////////
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((adapterMemento == null) ? 0 : adapterMemento.hashCode());
- return result;
- }
-
- /**
- * In order that <tt>IsisAjaxFallbackDataTable</tt> can use a
- * <tt>ReuseIfModelsEqualStrategy</tt> to preserve any concurrency exception
- * information in original model.
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- EntityModel other = (EntityModel) obj;
- if (adapterMemento == null) {
- if (other.adapterMemento != null)
- return false;
- } else if (!adapterMemento.equals(other.adapterMemento))
- return false;
- return true;
-
- }
-
-
- // //////////////////////////////////////////////////////////
- // Dependencies (from context)
- // //////////////////////////////////////////////////////////
-
- protected static OidMarshaller getOidMarshaller() {
- return IsisContext.getOidMarshaller();
- }
-
- protected SpecificationLoaderSpi getSpecificationLoader() {
- return IsisContext.getSpecificationLoader();
- }
-
-
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ImageResourceCache.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ImageResourceCache.java b/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ImageResourceCache.java
deleted file mode 100644
index b0828df..0000000
--- a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ImageResourceCache.java
+++ /dev/null
@@ -1,39 +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.model.models;
-
-import java.io.Serializable;
-
-import org.apache.wicket.request.resource.ResourceReference;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-/**
- * Ideally I'd like to move this to the <tt>org.apache.isis.viewer.wicket.model.isis</tt>
- * package, however to do so would break existing API (gmap3 has a dependency on this, for example).
- */
-public interface ImageResourceCache extends Serializable {
-
- ResourceReference resourceReferenceFor(ObjectAdapter adapter);
-
- ResourceReference resourceReferenceForSpec(ObjectSpecification objectSpecification);
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java b/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java
deleted file mode 100644
index ce17a7c..0000000
--- a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java
+++ /dev/null
@@ -1,129 +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.model.models;
-
-import java.util.Map;
-import com.google.common.collect.Maps;
-import org.apache.wicket.Component;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.util.string.PrependingStringBuffer;
-import org.apache.wicket.util.string.Strings;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
-import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
-
-/**
- * Adapter for {@link LoadableDetachableModel}s, providing access to some of the
- * Isis' dependencies.
- */
-public abstract class ModelAbstract<T> extends LoadableDetachableModel<T> implements UiHintContainer {
-
- private static final long serialVersionUID = 1L;
-
- public ModelAbstract() {
- }
-
- public ModelAbstract(final T t) {
- super(t);
- }
-
-
- // //////////////////////////////////////////////////////////
- // Hint support
- // //////////////////////////////////////////////////////////
-
- private final Map<String, String> hints = Maps.newTreeMap();
-
- public String getHint(final Component component, final String key) {
- if(component == null) {
- return null;
- }
- String hintKey = hintKey(component, key);
- return hints.get(hintKey);
- }
-
- @Override
- public void setHint(Component component, String key, String value) {
- if(component == null) {
- return;
- }
- String hintKey = hintKey(component, key);
- if(value != null) {
- hints.put(hintKey, value);
- } else {
- hints.remove(hintKey);
- }
- }
-
- @Override
- public void clearHint(Component component, String key) {
- setHint(component, key, null);
- }
-
-
- private static String hintKey(Component component, String key) {
- return hintPathFor(component) + "-" + key;
- }
-
- private static String hintPathFor(Component component)
- {
- return Strings.afterFirstPathComponent(fullHintPathFor(component), Component.PATH_SEPARATOR);
- }
-
- private static String fullHintPathFor(Component component)
- {
- final PrependingStringBuffer buffer = new PrependingStringBuffer(32);
- for (Component c = component; c != null; c = c.getParent())
- {
- if(c instanceof UiHintPathSignificant) {
- if (buffer.length() > 0)
- {
- buffer.prepend(Component.PATH_SEPARATOR);
- }
- buffer.prepend(c.getId());
- }
- }
- return buffer.toString();
- }
-
- protected Map<String, String> getHints() {
- return hints;
- }
-
- // //////////////////////////////////////////////////////////////
- // Dependencies
- // //////////////////////////////////////////////////////////////
-
- protected AuthenticationSession getAuthenticationSession() {
- return IsisContext.getAuthenticationSession();
- }
-
- protected PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
- protected AdapterManager getAdapterManager() {
- return getPersistenceSession().getAdapterManager();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/PageType.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/PageType.java b/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/PageType.java
deleted file mode 100644
index f23b506..0000000
--- a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/PageType.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.model.models;
-
-
-
-/**
- * Enumerates the different types of pages that can be rendered.
- *
- * <p>
- * Is used by {@link PageClassRegistry} to lookup the concrete page to render
- * different types of pages. This allows the large-scale structure of page
- * layout (eg headers, footers) to be altered.
- */
-public enum PageType {
- SIGN_IN,
- SIGN_UP,
- SIGN_UP_VERIFY,
- PASSWORD_RESET,
- HOME,
- ABOUT,
- ENTITY,
- ACTION_PROMPT,
- STANDALONE_COLLECTION,
- VALUE,
- VOID_RETURN;
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModel.java b/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModel.java
deleted file mode 100644
index dee9bce..0000000
--- a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModel.java
+++ /dev/null
@@ -1,788 +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.model.models;
-
-import java.math.BigDecimal;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.apache.wicket.Session;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.profiles.Localization;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
-import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.facets.objectvalue.mandatory.MandatoryFacet;
-import org.apache.isis.core.metamodel.facets.objectvalue.typicallen.TypicalLengthFacet;
-import org.apache.isis.core.metamodel.facets.value.bigdecimal.BigDecimalValueFacet;
-import org.apache.isis.core.metamodel.facets.value.string.StringValueSemanticsProvider;
-import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-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.links.LinksProvider;
-import org.apache.isis.viewer.wicket.model.mementos.ActionParameterMemento;
-import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-import org.apache.isis.viewer.wicket.model.mementos.PropertyMemento;
-import org.apache.isis.viewer.wicket.model.mementos.SpecUtils;
-
-/**
- * Represents a scalar of an entity, either a {@link Kind#PROPERTY property} or
- * a {@link Kind#PARAMETER parameter}.
- *
- * <p>
- * Is the backing model to each of the fields that appear in forms (for entities
- * or action dialogs).
- */
-public class ScalarModel extends EntityModel implements LinksProvider {
-
- private static final long serialVersionUID = 1L;
-
- public enum Kind {
- PROPERTY {
- @Override
- public String getName(final ScalarModel scalarModel) {
- return scalarModel.getPropertyMemento().getProperty().getName();
- }
-
- @Override
- public ObjectSpecification getScalarTypeSpec(final ScalarModel scalarModel) {
- ObjectSpecId type = scalarModel.getPropertyMemento().getType();
- return SpecUtils.getSpecificationFor(type);
- }
-
- @Override
- public String getIdentifier(final ScalarModel scalarModel) {
- return scalarModel.getPropertyMemento().getIdentifier();
- }
-
- @Override
- public String getLongName(final ScalarModel scalarModel) {
- ObjectSpecId objectSpecId = scalarModel.parentObjectAdapterMemento.getObjectSpecId();
- final String specShortName = SpecUtils.getSpecificationFor(objectSpecId).getShortIdentifier();
- return specShortName + "-" + scalarModel.getPropertyMemento().getProperty().getId();
- }
-
- @Override
- public String disable(final ScalarModel scalarModel, final Where where) {
- final ObjectAdapter parentAdapter = scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK);
- final OneToOneAssociation property = scalarModel.getPropertyMemento().getProperty();
- try {
- final AuthenticationSession session = scalarModel.getAuthenticationSession();
- final Consent usable = property.isUsable(session, parentAdapter, where);
- return usable.isAllowed() ? null : usable.getReason();
- } catch (final Exception ex) {
- return ex.getLocalizedMessage();
- }
- }
-
- @Override
- public String parseAndValidate(final ScalarModel scalarModel, final String proposedPojoAsStr) {
- final OneToOneAssociation property = scalarModel.getPropertyMemento().getProperty();
- ParseableFacet parseableFacet = property.getFacet(ParseableFacet.class);
- if (parseableFacet == null) {
- parseableFacet = property.getSpecification().getFacet(ParseableFacet.class);
- }
- try {
- final ObjectAdapter parentAdapter = scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK);
- final ObjectAdapter currentValue = property.get(parentAdapter);
- Localization localization = IsisContext.getLocalization();
- final ObjectAdapter proposedAdapter = parseableFacet.parseTextEntry(currentValue, proposedPojoAsStr, localization);
- final Consent valid = property.isAssociationValid(parentAdapter, proposedAdapter);
- return valid.isAllowed() ? null : valid.getReason();
- } catch (final ConcurrencyException ex) {
- // disregard concurrency exceptions because will pick up at the IFormValidator level rather
- // than each individual property.
- return null;
- } catch (final Exception ex) {
- return ex.getLocalizedMessage();
- }
- }
-
- @Override
- public String validate(final ScalarModel scalarModel, final ObjectAdapter proposedAdapter) {
- final ObjectAdapter parentAdapter = scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK);
- final OneToOneAssociation property = scalarModel.getPropertyMemento().getProperty();
- try {
- final Consent valid = property.isAssociationValid(parentAdapter, proposedAdapter);
- return valid.isAllowed() ? null : valid.getReason();
- } catch (final Exception ex) {
- return ex.getLocalizedMessage();
- }
- }
-
- @Override
- public boolean isRequired(final ScalarModel scalarModel) {
- final FacetHolder facetHolder = scalarModel.getPropertyMemento().getProperty();
- return isRequired(facetHolder);
- }
-
- @Override
- public <T extends Facet> T getFacet(final ScalarModel scalarModel, final Class<T> facetType) {
- final FacetHolder facetHolder = scalarModel.getPropertyMemento().getProperty();
- return facetHolder.getFacet(facetType);
- }
-
- @Override
- public boolean hasChoices(final ScalarModel scalarModel) {
- final PropertyMemento propertyMemento = scalarModel.getPropertyMemento();
- final OneToOneAssociation property = propertyMemento.getProperty();
- return property.hasChoices();
- }
-
- @Override
- public List<ObjectAdapter> getChoices(
- final ScalarModel scalarModel,
- final ObjectAdapter[] argumentsIfAvailable,
- final AuthenticationSession authenticationSession,
- final DeploymentCategory deploymentCategory) {
- final PropertyMemento propertyMemento = scalarModel.getPropertyMemento();
- final OneToOneAssociation property = propertyMemento.getProperty();
- final ObjectAdapter[] choices = property.getChoices(scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.NO_CHECK),
- authenticationSession, deploymentCategory);
- return choicesAsList(choices);
- }
-
- @Override
- public boolean hasAutoComplete(final ScalarModel scalarModel) {
- final PropertyMemento propertyMemento = scalarModel.getPropertyMemento();
- final OneToOneAssociation property = propertyMemento.getProperty();
- return property.hasAutoComplete();
- }
-
- @Override
- public List<ObjectAdapter> getAutoComplete(
- final ScalarModel scalarModel,
- final String searchArg,
- final AuthenticationSession authenticationSession,
- final DeploymentCategory deploymentCategory) {
- final PropertyMemento propertyMemento = scalarModel.getPropertyMemento();
- final OneToOneAssociation property = propertyMemento.getProperty();
- final ObjectAdapter parentAdapter =
- scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.NO_CHECK);
- final ObjectAdapter[] choices = property.getAutoComplete(
- parentAdapter, searchArg,
- authenticationSession, deploymentCategory);
- return choicesAsList(choices);
- }
-
- @Override
- public int getAutoCompleteOrChoicesMinLength(ScalarModel scalarModel) {
-
- if (scalarModel.hasAutoComplete()) {
- final PropertyMemento propertyMemento = scalarModel.getPropertyMemento();
- final OneToOneAssociation property = propertyMemento.getProperty();
- return property.getAutoCompleteMinLength();
- } else {
- return 0;
- }
- }
-
-
- @Override
- public void resetVersion(ScalarModel scalarModel) {
- scalarModel.parentObjectAdapterMemento.resetVersion();
- }
-
- @Override
- public String getDescribedAs(final ScalarModel scalarModel) {
- final PropertyMemento propertyMemento = scalarModel.getPropertyMemento();
- final OneToOneAssociation property = propertyMemento.getProperty();
- return property.getDescription();
- }
-
- @Override
- public Integer getLength(ScalarModel scalarModel) {
- final PropertyMemento propertyMemento = scalarModel.getPropertyMemento();
- final OneToOneAssociation property = propertyMemento.getProperty();
- final BigDecimalValueFacet facet = property.getFacet(BigDecimalValueFacet.class);
- return facet != null? facet.getLength(): null;
- }
-
- @Override
- public Integer getScale(ScalarModel scalarModel) {
- final PropertyMemento propertyMemento = scalarModel.getPropertyMemento();
- final OneToOneAssociation property = propertyMemento.getProperty();
- final BigDecimalValueFacet facet = property.getFacet(BigDecimalValueFacet.class);
- return facet != null? facet.getScale(): null;
- }
-
- @Override
- public int getTypicalLength(ScalarModel scalarModel) {
- final PropertyMemento propertyMemento = scalarModel.getPropertyMemento();
- final OneToOneAssociation property = propertyMemento.getProperty();
- final TypicalLengthFacet facet = property.getFacet(TypicalLengthFacet.class);
- return facet != null? facet.value() : StringValueSemanticsProvider.TYPICAL_LENGTH;
- }
-
- @Override
- public void init(final ScalarModel scalarModel) {
- reset(scalarModel);
- }
-
- @Override
- public void reset(ScalarModel scalarModel) {
- final OneToOneAssociation property = scalarModel.propertyMemento.getProperty();
- final ObjectAdapter associatedAdapter = property.get(scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK)
- );
-
- scalarModel.setObject(associatedAdapter);
- }
- },
- PARAMETER {
- @Override
- public String getName(final ScalarModel scalarModel) {
- return scalarModel.getParameterMemento().getActionParameter().getName();
- }
-
- @Override
- public ObjectSpecification getScalarTypeSpec(final ScalarModel scalarModel) {
- return scalarModel.getParameterMemento().getSpecification();
- }
-
- @Override
- public String getIdentifier(final ScalarModel scalarModel) {
- return "" + scalarModel.getParameterMemento().getNumber();
- }
-
- @Override
- public String getLongName(final ScalarModel scalarModel) {
- final ObjectAdapterMemento adapterMemento = scalarModel.getObjectAdapterMemento();
- if (adapterMemento == null) {
- // shouldn't happen
- return null;
- }
- ObjectSpecId objectSpecId = adapterMemento.getObjectSpecId();
- final String specShortName = SpecUtils.getSpecificationFor(objectSpecId).getShortIdentifier();
- final String parmId = scalarModel.getParameterMemento().getActionParameter().getIdentifier().toNameIdentityString();
- return specShortName + "-" + parmId + "-" + scalarModel.getParameterMemento().getNumber();
- }
-
- @Override
- public String disable(final ScalarModel scalarModel, Where where) {
- // always enabled
- return null;
- }
-
- @Override
- public String parseAndValidate(final ScalarModel scalarModel, final String proposedPojoAsStr) {
- final ObjectActionParameter parameter = scalarModel.getParameterMemento().getActionParameter();
- try {
- final ObjectAdapter parentAdapter = scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK);
- Localization localization = IsisContext.getLocalization();
- final String invalidReasonIfAny = parameter.isValid(parentAdapter, proposedPojoAsStr, localization);
- return invalidReasonIfAny;
- } catch (final Exception ex) {
- return ex.getLocalizedMessage();
- }
- }
-
- @Override
- public String validate(final ScalarModel scalarModel, final ObjectAdapter proposedAdapter) {
- final ObjectActionParameter parameter = scalarModel.getParameterMemento().getActionParameter();
- try {
- final ObjectAdapter parentAdapter = scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK);
- Localization localization = IsisContext.getLocalization();
- final String invalidReasonIfAny = parameter.isValid(parentAdapter, proposedAdapter.getObject(), localization);
- return invalidReasonIfAny;
- } catch (final Exception ex) {
- return ex.getLocalizedMessage();
- }
- }
-
- @Override
- public boolean isRequired(final ScalarModel scalarModel) {
- final FacetHolder facetHolder = scalarModel.getParameterMemento().getActionParameter();
- return isRequired(facetHolder);
- }
-
- @Override
- public <T extends Facet> T getFacet(final ScalarModel scalarModel, final Class<T> facetType) {
- final FacetHolder facetHolder = scalarModel.getParameterMemento().getActionParameter();
- return facetHolder.getFacet(facetType);
- }
-
- @Override
- public boolean hasChoices(final ScalarModel scalarModel) {
- final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
- final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
- return actionParameter.hasChoices();
- }
- @Override
- public List<ObjectAdapter> getChoices(
- final ScalarModel scalarModel,
- final ObjectAdapter[] argumentsIfAvailable,
- final AuthenticationSession authenticationSession,
- final DeploymentCategory deploymentCategory) {
- final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
- final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
- final ObjectAdapter parentAdapter =
- scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK);
- final ObjectAdapter[] choices = actionParameter.getChoices(
- parentAdapter, argumentsIfAvailable,
- authenticationSession, deploymentCategory);
- return choicesAsList(choices);
- }
-
- @Override
- public boolean hasAutoComplete(final ScalarModel scalarModel) {
- final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
- final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
- return actionParameter.hasAutoComplete();
- }
- @Override
- public List<ObjectAdapter> getAutoComplete(
- final ScalarModel scalarModel,
- final String searchArg,
- final AuthenticationSession authenticationSession,
- final DeploymentCategory deploymentCategory) {
- final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
- final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
-
- final ObjectAdapter parentAdapter =
- scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.NO_CHECK);
- final ObjectAdapter[] choices = actionParameter.getAutoComplete(
- parentAdapter, searchArg,
- authenticationSession, deploymentCategory);
- return choicesAsList(choices);
- }
-
- @Override
- public int getAutoCompleteOrChoicesMinLength(ScalarModel scalarModel) {
- if (scalarModel.hasAutoComplete()) {
- final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
- final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
- return actionParameter.getAutoCompleteMinLength();
- } else {
- return 0;
- }
- }
-
- @Override
- public void resetVersion(ScalarModel scalarModel) {
- // no-op?
- }
- @Override
- public String getDescribedAs(final ScalarModel scalarModel) {
- final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
- final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
- return actionParameter.getDescription();
- }
-
- @Override
- public Integer getLength(ScalarModel scalarModel) {
- final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
- final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
- final BigDecimalValueFacet facet = actionParameter.getFacet(BigDecimalValueFacet.class);
- return facet != null? facet.getLength(): null;
- }
-
- @Override
- public Integer getScale(ScalarModel scalarModel) {
- final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
- final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
- final BigDecimalValueFacet facet = actionParameter.getFacet(BigDecimalValueFacet.class);
- return facet != null? facet.getScale(): null;
- }
-
- @Override
- public int getTypicalLength(ScalarModel scalarModel) {
- final ActionParameterMemento parameterMemento = scalarModel.getParameterMemento();
- final ObjectActionParameter actionParameter = parameterMemento.getActionParameter();
- final TypicalLengthFacet facet = actionParameter.getFacet(TypicalLengthFacet.class);
- return facet != null? facet.value() : StringValueSemanticsProvider.TYPICAL_LENGTH;
- }
-
- @Override
- public void init(final ScalarModel scalarModel) {
- // no-op
- }
-
- @Override
- public void reset(ScalarModel scalarModel) {
- final ObjectActionParameter actionParameter = scalarModel.parameterMemento.getActionParameter();
- final ObjectAdapter defaultAdapter = actionParameter.getDefault(scalarModel.parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.NO_CHECK));
- scalarModel.setObject(defaultAdapter);
- }
- };
-
- private static List<ObjectAdapter> choicesAsList(final ObjectAdapter[] choices) {
- if (choices != null && choices.length > 0) {
- return Arrays.asList(choices);
- }
- return Collections.emptyList();
- }
-
- public abstract String getName(ScalarModel scalarModel);
-
- public abstract ObjectSpecification getScalarTypeSpec(ScalarModel scalarModel);
-
- public abstract String getIdentifier(ScalarModel scalarModel);
-
- public abstract String disable(ScalarModel scalarModel, Where where);
-
- public abstract String parseAndValidate(ScalarModel scalarModel, String proposedPojoAsStr);
-
- public abstract String validate(ScalarModel scalarModel, ObjectAdapter proposedAdapter);
-
- public abstract String getLongName(ScalarModel scalarModel);
-
- public abstract boolean isRequired(ScalarModel scalarModel);
-
- public abstract <T extends Facet> T getFacet(ScalarModel scalarModel, Class<T> facetType);
-
- static boolean isRequired(final FacetHolder facetHolder) {
- final MandatoryFacet mandatoryFacet = facetHolder.getFacet(MandatoryFacet.class);
- final boolean required = mandatoryFacet != null && !mandatoryFacet.isInvertedSemantics();
- return required;
- }
-
- public abstract boolean hasChoices(ScalarModel scalarModel);
- public abstract List<ObjectAdapter> getChoices(
- final ScalarModel scalarModel,
- final ObjectAdapter[] argumentsIfAvailable,
- final AuthenticationSession authenticationSession,
- final DeploymentCategory deploymentCategory);
-
- public abstract boolean hasAutoComplete(ScalarModel scalarModel);
- public abstract List<ObjectAdapter> getAutoComplete(
- ScalarModel scalarModel,
- String searchArg,
- final AuthenticationSession authenticationSession, final DeploymentCategory deploymentCategory);
- public abstract int getAutoCompleteOrChoicesMinLength(ScalarModel scalarModel);
-
- public abstract void resetVersion(ScalarModel scalarModel);
-
- public abstract String getDescribedAs(ScalarModel scalarModel);
-
-
- public abstract Integer getLength(ScalarModel scalarModel);
- public abstract Integer getScale(ScalarModel scalarModel);
-
- public abstract int getTypicalLength(ScalarModel scalarModel);
-
- public abstract void init(ScalarModel scalarModel);
- public abstract void reset(ScalarModel scalarModel);
-
-
- }
-
- private final Kind kind;
-
- private final ObjectAdapterMemento parentObjectAdapterMemento;
-
-
- /**
- * Populated only if {@link #getKind()} is {@link Kind#PARAMETER}
- */
- private ActionParameterMemento parameterMemento;
-
- /**
- * Populated only if {@link #getKind()} is {@link Kind#PROPERTY}
- */
- private PropertyMemento propertyMemento;
-
- /**
- * Creates a model representing an action parameter of an action of a parent
- * object, with the {@link #getObject() value of this model} to be default
- * value (if any) of that action parameter.
- */
- public ScalarModel(final ObjectAdapterMemento parentObjectAdapterMemento, final ActionParameterMemento apm) {
- this.kind = Kind.PARAMETER;
- this.parentObjectAdapterMemento = parentObjectAdapterMemento;
- this.parameterMemento = apm;
-
- init();
- setMode(Mode.EDIT);
- }
-
- /**
- * Creates a model representing a property of a parent object, with the
- * {@link #getObject() value of this model} to be current value of the
- * property.
- */
- public ScalarModel(final ObjectAdapterMemento parentObjectAdapterMemento, final PropertyMemento pm) {
- this.kind = Kind.PROPERTY;
- this.parentObjectAdapterMemento = parentObjectAdapterMemento;
- this.propertyMemento = pm;
-
- init();
- setObject(parentObjectAdapterMemento);
- setMode(Mode.VIEW);
- }
-
- private void init() {
- kind.init(this);
- }
-
- public void reset() {
- kind.reset(this);
- }
-
- public ObjectAdapterMemento getParentObjectAdapterMemento() {
- return parentObjectAdapterMemento;
- }
-
- protected void setObject(final ObjectAdapterMemento parentObjectAdapterMemento) {
- final OneToOneAssociation property = propertyMemento.getProperty();
- final ObjectAdapter associatedAdapter = property.get(parentObjectAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK)
- );
-
- setObject(associatedAdapter);
- }
-
- /**
- * Whether the scalar represents a {@link Kind#PROPERTY property} or a
- * {@link Kind#PARAMETER}.
- */
- public Kind getKind() {
- return kind;
- }
-
- public String getName() {
- return kind.getName(this);
- }
-
- /**
- * Populated only if {@link #getKind()} is {@link Kind#PROPERTY}
- */
- public PropertyMemento getPropertyMemento() {
- return propertyMemento;
- }
-
- /**
- * Populated only if {@link #getKind()} is {@link Kind#PARAMETER}
- */
- public ActionParameterMemento getParameterMemento() {
- return parameterMemento;
- }
-
- /**
- * Overrides superclass' implementation, because a {@link ScalarModel} can
- * know the {@link ObjectSpecification of} the {@link ObjectAdapter adapter}
- * without there necessarily being any adapter being
- * {@link #setObject(ObjectAdapter) set}.
- */
- @Override
- public ObjectSpecification getTypeOfSpecification() {
- return kind.getScalarTypeSpec(this);
- }
-
- public boolean isScalarTypeAnyOf(final Class<?>... requiredClass) {
- final String fullName = getTypeOfSpecification().getFullIdentifier();
- for (final Class<?> requiredCls : requiredClass) {
- if (fullName.equals(requiredCls.getName())) {
- return true;
- }
- }
- return false;
- }
-
- public String getObjectAsString() {
- final ObjectAdapter adapter = getObject();
- if (adapter == null) {
- return null;
- }
- return adapter.titleString(null);
- }
-
- @Override
- public void setObject(final ObjectAdapter adapter) {
- super.setObject(adapter); // associated value
- }
-
- public void setObjectAsString(final String enteredText) {
- // parse text to get adapter
- final ParseableFacet parseableFacet = getTypeOfSpecification().getFacet(ParseableFacet.class);
- if (parseableFacet == null) {
- throw new RuntimeException("unable to parse string for " + getTypeOfSpecification().getFullIdentifier());
- }
- Localization localization = IsisContext.getLocalization();
- final ObjectAdapter adapter = parseableFacet.parseTextEntry(getObject(), enteredText, localization);
-
- setObject(adapter);
- }
-
- public String disable(Where where) {
- return kind.disable(this, where);
- }
-
- public String parseAndValidate(final String proposedPojoAsStr) {
- return kind.parseAndValidate(this, proposedPojoAsStr);
- }
-
- public String validate(final ObjectAdapter proposedAdapter) {
- return kind.validate(this, proposedAdapter);
- }
-
- /**
- * Default implementation looks up from singleton, but can be overridden for
- * testing.
- */
- protected AuthenticationSession getAuthenticationSession() {
- return ((AuthenticationSessionProvider) Session.get()).getAuthenticationSession();
- }
-
- public boolean isRequired() {
- return kind.isRequired(this);
- }
-
- public String getLongName() {
- return kind.getLongName(this);
- }
-
- public <T extends Facet> T getFacet(final Class<T> facetType) {
- return kind.getFacet(this, facetType);
- }
-
- public void resetVersion() {
- kind.resetVersion(this);
- }
-
- public String getDescribedAs() {
- return kind.getDescribedAs(this);
- }
-
- public boolean hasChoices() {
- return kind.hasChoices(this);
- }
-
- public List<ObjectAdapter> getChoices(
- final ObjectAdapter[] argumentsIfAvailable,
- final AuthenticationSession authenticationSession,
- final DeploymentCategory deploymentCategory) {
- return kind.getChoices(this, argumentsIfAvailable, authenticationSession, deploymentCategory);
- }
-
- public boolean hasAutoComplete() {
- return kind.hasAutoComplete(this);
- }
-
- public List<ObjectAdapter> getAutoComplete(
- final String searchTerm,
- final AuthenticationSession authenticationSession,
- final DeploymentCategory deploymentCategory) {
- return kind.getAutoComplete(this, searchTerm, authenticationSession, deploymentCategory);
- }
-
- /**
- * for {@link BigDecimal}s only.
- *
- * @see #getScale()
- */
- public int getLength() {
- return kind.getLength(this);
- }
-
- /**
- * for {@link BigDecimal}s only.
- *
- * @see #getLength()
- */
- public Integer getScale() {
- return kind.getScale(this);
- }
-
- public int getTypicalLength() {
- return kind.getTypicalLength(this);
- }
-
- /**
- * Additional links to render (if any)
- */
- private List<LinkAndLabel> entityActions = Lists.newArrayList();
-
-
- public void addEntityActions(List<LinkAndLabel> entityActions) {
- this.entityActions.addAll(entityActions);
- }
-
- @Override
- public List<LinkAndLabel> getLinks() {
- return Collections.unmodifiableList(entityActions);
- }
-
- /**
- * @return
- */
- public int getAutoCompleteMinLength() {
- return kind.getAutoCompleteOrChoicesMinLength(this);
- }
-
- /**
- * @return
- */
- public ScalarModelWithPending asScalarModelWithPending() {
- return new ScalarModelWithPending(){
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public ObjectAdapterMemento getPending() {
- return ScalarModel.this.getPending();
- }
-
- @Override
- public void setPending(ObjectAdapterMemento pending) {
- ScalarModel.this.setPending(pending);
- }
-
- @Override
- public ScalarModel getScalarModel() {
- return ScalarModel.this;
- }
- };
- }
-
-
- // //////////////////////////////////////
-
- /**
- * transient because only temporary hint.
- */
- private transient ObjectAdapter[] actionArgsHint;
-
- public void setActionArgsHint(ObjectAdapter[] actionArgsHint) {
- this.actionArgsHint = actionArgsHint;
- }
-
- /**
- * The initial call of choicesXxx() for any given scalar argument needs the current values
- * of all args (possibly as initialized through a defaultNXxx().
- */
- public ObjectAdapter[] getActionArgsHint() {
- return actionArgsHint;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModelWithPending.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModelWithPending.java b/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModelWithPending.java
deleted file mode 100644
index d153f08..0000000
--- a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModelWithPending.java
+++ /dev/null
@@ -1,90 +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.model.models;
-
-import java.io.Serializable;
-
-import org.apache.wicket.model.Model;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
-import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-
-/**
- * For widgets that use a <tt>com.vaynberg.wicket.select2.Select2Choice</tt>;
- * synchronizes the {@link Model} of the <tt>Select2Choice</tt>
- * with the parent {@link ScalarModel}, allowing also for pending values.
- */
-public interface ScalarModelWithPending extends Serializable {
-
- public ObjectAdapterMemento getPending();
- public void setPending(ObjectAdapterMemento pending);
-
- public ScalarModel getScalarModel();
-
- static class Util {
-
- private static final Logger LOG = LoggerFactory.getLogger(ScalarModelWithPending.Util.class);
-
- public static Model<ObjectAdapterMemento> createModel(final ScalarModelWithPending owner) {
- return new Model<ObjectAdapterMemento>() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public ObjectAdapterMemento getObject() {
- if (owner.getPending() != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("pending not null: " + owner.getPending().toString());
- }
- return owner.getPending();
- }
- if (LOG.isDebugEnabled()) {
- LOG.debug("pending is null");
- }
-
- final ObjectAdapterMemento objectAdapterMemento = owner.getScalarModel().getObjectAdapterMemento();
- owner.setPending(objectAdapterMemento);
-
- return objectAdapterMemento;
- }
-
- @Override
- public void setObject(final ObjectAdapterMemento adapterMemento) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("setting to: " + adapterMemento!=null?adapterMemento.toString():null);
- }
- owner.setPending(adapterMemento);
- if (owner.getScalarModel() != null) {
- if(adapterMemento == null) {
- owner.getScalarModel().setObject((ObjectAdapter)null);
- } else {
- if (owner.getPending() != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("setting to pending: " + owner.getPending().toString());
- }
- owner.getScalarModel().setObject(owner.getPending().getObjectAdapter(ConcurrencyChecking.NO_CHECK));
- }
- }
- }
- }
- };
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ServiceActionsModel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ServiceActionsModel.java b/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ServiceActionsModel.java
deleted file mode 100644
index d0bcc36..0000000
--- a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ServiceActionsModel.java
+++ /dev/null
@@ -1,74 +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.model.models;
-
-import java.util.List;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import org.apache.isis.applib.annotation.DomainServiceLayout;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.domainservicelayout.DomainServiceLayoutFacet;
-
-/**
- * Backing model for actions of application services menu bar (typically, as
- * displayed along the top or side of the page).
- */
-public class ServiceActionsModel extends ModelAbstract<List<ObjectAdapter>> {
-
- private static final long serialVersionUID = 1L;
-
- private final DomainServiceLayout.MenuBar menuBar;
-
- /**
- * @param menuBar - may be null in special case of rendering the tertiary menu on the error page.
- */
- public ServiceActionsModel(final DomainServiceLayout.MenuBar menuBar) {
- this.menuBar = menuBar;
- }
-
- /**
- * The menu bar being rendered; may be null in special case of rendering the tertiary menu on the error page.
- */
- public DomainServiceLayout.MenuBar getMenuBar() {
- return menuBar;
- }
-
- protected List<ObjectAdapter> load() {
- return Lists.newArrayList(Iterables.filter(getServiceAdapters(), with(menuBar)));
- }
-
- private static Predicate<ObjectAdapter> with(final DomainServiceLayout.MenuBar menuBar) {
- return new Predicate<ObjectAdapter>() {
- @Override
- public boolean apply(ObjectAdapter input) {
- final DomainServiceLayoutFacet facet = input.getSpecification().getFacet
- (DomainServiceLayoutFacet.class);
- return facet != null && facet.getMenuBar() == menuBar;
- }
- };
- }
-
- protected List<ObjectAdapter> getServiceAdapters() {
- return getPersistenceSession().getServices();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ValueModel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ValueModel.java b/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ValueModel.java
deleted file mode 100644
index 9ddd054..0000000
--- a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ValueModel.java
+++ /dev/null
@@ -1,66 +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.model.models;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-
-/**
- * Represents a standalone value.
- */
-public class ValueModel extends ModelAbstract<ObjectAdapter> {
-
- private static final long serialVersionUID = 1L;
-
- private final ObjectAdapterMemento adapterMemento;
-
- public ValueModel(final ObjectAdapter adapter) {
- adapterMemento = ObjectAdapterMemento.createOrNull(adapter);
- }
-
- @Override
- protected ObjectAdapter load() {
- return adapterMemento.getObjectAdapter(ConcurrencyChecking.NO_CHECK);
- }
-
- // //////////////////////////////////////
-
- private ActionModel actionModelHint;
- /**
- * The {@link ActionModel model} of the {@link ObjectAction action}
- * that generated this {@link ValueModel}.
- *
- * @see #setActionHint(ActionModel)
- */
- public ActionModel getActionModelHint() {
- return actionModelHint;
- }
- /**
- * Called by action.
- *
- * @see #getActionModelHint()
- */
- public void setActionHint(ActionModel actionModelHint) {
- this.actionModelHint = actionModelHint;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/VoidModel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/VoidModel.java b/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/VoidModel.java
deleted file mode 100644
index c0437d3..0000000
--- a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/VoidModel.java
+++ /dev/null
@@ -1,61 +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.model.models;
-
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-
-
-/**
- * Represents the result of invoking a <tt>void</tt> action.
- */
-public class VoidModel extends ModelAbstract<Void> {
-
- private static final long serialVersionUID = 1L;
-
- public VoidModel() {
- }
-
- @Override
- protected Void load() {
- return null;
- }
-
-
- // //////////////////////////////////////
-
- private ActionModel actionModelHint;
- /**
- * The {@link ActionModel model} of the {@link ObjectAction action}
- * that generated this {@link VoidModel}.
- *
- * @see #setActionHint(ActionModel)
- */
- public ActionModel getActionModelHint() {
- return actionModelHint;
- }
- /**
- * Called by action.
- *
- * @see #getActionModelHint()
- */
- public void setActionHint(ActionModel actionModelHint) {
- this.actionModelHint = actionModelHint;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/WelcomeModel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/WelcomeModel.java b/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/WelcomeModel.java
deleted file mode 100644
index 8e43887..0000000
--- a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/WelcomeModel.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.model.models;
-
-/**
- * Model providing welcome text.
- */
-public class WelcomeModel extends ModelAbstract<String> {
-
- private static final long serialVersionUID = 1L;
-
- public WelcomeModel(final String message) {
- setObject(message);
- }
-
- @Override
- protected String load() {
- return getObject();
- }
-
- @Override
- public void setObject(final String message) {
- if(message == null) {
- return;
- }
- super.setObject(message);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/WicketComponentUtils.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/WicketComponentUtils.java b/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/WicketComponentUtils.java
deleted file mode 100644
index 1fba4ed..0000000
--- a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/WicketComponentUtils.java
+++ /dev/null
@@ -1,57 +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.model.models;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.Page;
-import org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor;
-import org.apache.wicket.util.visit.IVisit;
-
-public class WicketComponentUtils {
-
- public WicketComponentUtils(){}
-
- /**
- * Locates a component implementing the required class on the same page as the supplied component.
- */
- public static <T> T getFrom(Component component, final Class<T> cls) {
- return getFrom(component.getPage(), cls);
- }
-
- /**
- * Locates a component implementing the required class on the supplied page.
- */
- public static <T> T getFrom(Page page, final Class<T> cls) {
- final Object[] pComponent = new Object[1];
- page.visitChildren(new DeepChildFirstVisitor() {
- @Override
- public void component(Component component, IVisit<Void> visit) {
- if(cls.isAssignableFrom(component.getClass())) {
- pComponent[0] = component;
- visit.stop();
- }
- }
- @Override
- public boolean preCheck(Component component) {
- return false;
- }
- });
-
- return (T) pComponent[0];
- }
-
-}