com.jwebmp.plugins.bootstrap.popovers.BSPopOver Maven / Gradle / Ivy
Show all versions of jwebmp-bootstrap Show documentation
/*
* 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.bootstrap.popovers;
import com.jwebmp.core.base.ComponentHierarchyBase;
import com.jwebmp.core.base.html.Div;
import com.jwebmp.core.plugins.ComponentInformation;
/**
* Popovers
*
* Add small overlay content, like those found in iOS, to any element for housing secondary information.
*
* Overview
*
* Things to know when using the popover plugin:
*
* Popovers rely on the 3rd party library Tether for positioning. You must include tether.min.js before bootstrap.js in order for popovers to work! Popovers require the tooltip
* plugin as a dependency.
* Popovers are opt-in for performance reasons, so you must initialize them yourself. Zero-length title and content values will never show a popover. Specify container: 'body' to
* avoid rendering
* problems in more complex components (like our input groups, button groups, etc). Triggering popovers on hidden elements will not work. Popovers for .disabled or disabled
* elements must be triggered
* on a wrapper element. When triggered from hyperlinks that span multiple lines, popovers will be centered. Use white-space: nowrap; on your as to avoid this behavior.
*
*
*
* @author Marc Magon
* @version 1.0
* @since 17 Jan 2017
*/
@ComponentInformation(name = "Bootstrap Popovers",
description = "Add small overlay content, like those found in iOS, to any element for housing secondary information.",
url = "https://v4-alpha.getbootstrap.com/components/popovers/",
wikiUrl = "https://github.com/GedMarc/JWebSwing-BootstrapPlugin/wiki")
public class BSPopOver
extends Div
implements IBSPopOver
{
private static final long serialVersionUID = 1L;
/**
* P
*/
private BSPopOverFeature feature;
/**
* Popovers
*
* Add small overlay content, like those found in iOS, to any element for housing secondary information.
*
* Overview
*
* Things to know when using the popover plugin:
*
* Popovers rely on the 3rd party library Tether for positioning.
*
* You must include tether.min.js before bootstrap.js in order for popovers to work!
*
* Popovers require the tooltip plugin as a
*
* dependency. Popovers are opt-in for performance reasons, so you must initialize them yourself.
*
* Zero-length title and content values will never show a popover. Specify container: 'body' to avoid
*
* rendering problems in more complex components (like our input groups, button groups, etc).
*
* Triggering popovers on hidden elements will not work. Popovers for .disabled or disabled elements must be triggered on a wrapper element. When triggered from hyperlinks that
* span multiple
* lines, popovers will be centered.
*
* Use white-space: nowrap; on your as to avoid this behavior.
*
*
*
* @param displayedComponent
* Shortcut for getOptions().setContent
*/
public BSPopOver(ComponentHierarchyBase displayedComponent)
{
addFeature(getFeature());
addAttribute(BSPopOverAttributes.Rel, "bs4popover");
if (displayedComponent != null)
{
displayedComponent.setTiny(true);
getOptions().setContent(displayedComponent.toString(true));
}
}
/**
* Returns the feature if any is required
*
* @return
*/
public final BSPopOverFeature getFeature()
{
if (feature == null)
{
feature = new BSPopOverFeature(this);
}
return feature;
}
/**
* Returns the options if any is required
*
* @return
*/
@Override
public final BSPopOverOptions getOptions()
{
return getFeature().getOptions();
}
/**
* Neater representation
*
* @return
*/
public IBSPopOver asMe()
{
return this;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
return super.equals(obj);
}
@Override
public int hashCode()
{
int hash = 7;
hash = 79 * hash + (getID().hashCode());
return hash;
}
}