![JAR search and dependency download from the Maven repository](/logo.png)
com.jwebmp.plugins.bootstrapswitch.BootstrapSwitchPageConfigurator Maven / Gradle / Ivy
/*
* Copyright (C) 2017 Marc Magon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package com.jwebmp.plugins.bootstrapswitch;
import com.jwebmp.core.Page;
import com.jwebmp.core.plugins.PluginInformation;
import com.jwebmp.core.plugins.jquery.JQueryPageConfigurator;
import com.jwebmp.core.services.IPageConfigurator;
import javax.validation.constraints.NotNull;
/**
* Configures the Bootstrap Page Configurator
*
* @author Marc Magon
* @since 08 Jun 2017
*/
@PluginInformation(pluginName = "Bootstrap Switch",
pluginDescription = "Turn checkboxes and radio buttons into toggle switches ",
pluginUniqueName = "jwebswing-bootstrap-switch",
pluginVersion = "3.3.4",
pluginCategories = "toggle, radio button, checkbox, bootstrap, ui,web ui, framework",
pluginSubtitle = "Turn checkboxes and radio buttons into toggle switches ",
pluginSourceUrl = "https://github.com/Bttstrp/bootstrap-switch/",
pluginWikiUrl = "https://github.com/GedMarc/JWebSwing-Bootstrap-Switch/wiki",
pluginGitUrl = "https://github.com/GedMarc/JWebSwing-Bootstrap-Switch",
pluginIconUrl = "",
pluginIconImageUrl = "",
pluginOriginalHomepage = "http://bootstrapswitch.com/",
pluginDownloadUrl = "https://sourceforge.net/projects/jwebswing/files/plugins/BootstrapSwitch.jar/download")
public class BootstrapSwitchPageConfigurator
implements IPageConfigurator
{
/**
* If this configurator is enabled
*/
private static boolean enabled = true;
/*
* Constructs a new BootstrapSwitchPageConfigurator
*/
public BootstrapSwitchPageConfigurator()
{
//Nothing needed
}
/**
* Method isEnabled returns the enabled of this AngularAnimatedChangePageConfigurator object.
*
* If this configurator is enabled
*
* @return the enabled (type boolean) of this AngularAnimatedChangePageConfigurator object.
*/
public static boolean isEnabled()
{
return BootstrapSwitchPageConfigurator.enabled;
}
/**
* Method setEnabled sets the enabled of this AngularAnimatedChangePageConfigurator object.
*
* If this configurator is enabled
*
* @param mustEnable
* the enabled of this AngularAnimatedChangePageConfigurator object.
*/
public static void setEnabled(boolean mustEnable)
{
BootstrapSwitchPageConfigurator.enabled = mustEnable;
}
@NotNull
@Override
public Page configure(Page page)
{
if (!page.isConfigured())
{
JQueryPageConfigurator.setRequired(true);
page.getBody()
.addJavaScriptReference(BootstrapSwitchReferencePool.BootstrapSwitch.getJavaScriptReference());
page.getBody()
.addCssReference(BootstrapSwitchReferencePool.BootstrapSwitch.getCssReference());
}
return page;
}
@Override
public boolean enabled()
{
return BootstrapSwitchPageConfigurator.enabled;
}
}