/*
 *  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.value;

import org.apache.isis.core.metamodel.spec.ManagedObject;
import org.apache.isis.viewer.wicket.model.models.ValueModel;
import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelAbstract;
import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
import org.apache.isis.viewer.wicket.ui.util.Wkt;

/**
 * Panel for rendering any value types that do not have their own custom
 * {@link ScalarPanelAbstract panel} to render them.
 */
public class StandaloneValuePanel
extends PanelAbstract<ManagedObject, ValueModel> {

    private static final long serialVersionUID = 1L;
    private static final String ID_STANDALONE_VALUE = "standaloneValue";

    public StandaloneValuePanel(final String id, final ValueModel valueModel) {
        super(id, valueModel);
        Wkt.labelAdd(this, ID_STANDALONE_VALUE, ()->getModel().getObject().titleString());
    }

}

@@ -890,57 +890,309 @@
 ort 
-org.apache.isis.core.metamodel.spec.ManagedObject
+java.net.URL;%0Aimport java.util.UUID;%0A%0Aimport org.apache.isis.applib.services.bookmark.idstringifiers.PredefinedSerializables;%0Aimport org.apache.isis.applib.value.LocalResourcePath;%0Aimport org.apache.isis.core.metamodel.spec.ManagedObject;%0Aimport org.apache.isis.core.metamodel.spec.ObjectSpecification
 ;%0Aim
@@ -1444,16 +1444,36 @@
 l.Wkt;%0A%0A
+import lombok.val;%0A%0A
 /**%0A * P
@@ -1922,16 +1922,585 @@
 Model);%0A
+%0A        //XXX StandaloneValuePanel has its limitations compared to the ScalarPanel infrastructure,%0A        // which has far better rendering support%0A        // (we probably need to remove StandaloneValuePanel and utilize the ScalarPanel for standalone values instead)%0A        if(isProbablySimpleInlineHtml(valueModel.getObjectMember().getElementType())) %7B%0A            Wkt.markupAdd(this, ID_STANDALONE_VALUE, ()-%3E%0A                getModel().getObject().htmlString(getModel().getObjectMember()));%0A        %7D else %7B%0A            // resort to (textual) title rendering%0A    
         
@@ -2543,16 +2543,33 @@
 UE, ()-%3E
+%0A                
 getModel
@@ -2603,13 +2603,397 @@
 ));%0A    
-%7D
+    %7D%0A    %7D%0A%0A    // -- HELPER%0A%0A    private boolean isProbablySimpleInlineHtml(final ObjectSpecification valueSpec) %7B%0A        val cls = valueSpec.getCorrespondingClass();%0A%0A        return PredefinedSerializables.isPredefinedSerializable(cls)%0A                %7C%7C UUID.class.equals(cls)%0A                %7C%7C URL.class.equals(cls)%0A                %7C%7C LocalResourcePath.class.equals(cls);%0A    %7D%0A
 %0A%0A%7D%0A

implement poor man html rendering for standalone value panels