    001// Licensed under the Apache License, Version 2.0 (the "License");
    002// you may not use this file except in compliance with the License.
    003// You may obtain a copy of the License at
    004//
    005// http://www.apache.org/licenses/LICENSE-2.0
    006//
    007// Unless required by applicable law or agreed to in writing, software
    008// distributed under the License is distributed on an "AS IS" BASIS,
    009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    010// See the License for the specific language governing permissions and
    011// limitations under the License.
    012
    013package org.apache.tapestry5.modules;
    014
    015import org.apache.tapestry5.SymbolConstants;
    016import org.apache.tapestry5.commons.MappedConfiguration;
    017import org.apache.tapestry5.ioc.annotations.Contribute;
    018import org.apache.tapestry5.services.compatibility.Compatibility;
    019import org.apache.tapestry5.services.compatibility.Trait;
    020
    021/**
    022 * Module which defines the options needed to run Tapestry using Bootstrap 4 instead of the default
    023 * Bootstrap 3.
    024 *
    025 * @since 5.5
    026 */
    027public class Bootstrap4Module
    028{
    029    public static void contributeApplicationDefaults(MappedConfiguration<String, Object> configuration)
    030    {
    031        configuration.add(SymbolConstants.BOOTSTRAP_ROOT, "${tapestry.asset.root}/bootstrap4");
    032        configuration.add(SymbolConstants.ERROR_CSS_CLASS, "form-text text-danger");
    033//        configuration.add(SymbolConstants.BEAN_DISPLAY_CSS_CLASS, "card");
    034    }
    035
    036    @Contribute(Compatibility.class)
    037    public static void setupCompatibilityDefaults(MappedConfiguration<Trait, Boolean> configuration)
    038    {
    039        configuration.override(Trait.BOOTSTRAP_4, true);
    040        configuration.add(Trait.BOOTSTRAP_3, false);
    041    }
    042
    043}