All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.bootsfaces.component.container.Container Maven / Gradle / Ivy

There is a newer version: 2.0.1
Show newest version
/**
 *  Copyright 2014-15 by Riccardo Massera (TheCoder4.Eu) and Stephan Rauh (http://www.beyondjava.net).
 *  
 *  This file is part of BootsFaces.
 *  
* Licensed 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 net.bootsfaces.component.container;

import javax.el.ValueExpression;
import javax.faces.component.FacesComponent;
import javax.faces.component.UIOutput;

import net.bootsfaces.listeners.AddResourcesListener;
import net.bootsfaces.render.Tooltip;
import net.bootsfaces.utils.BsfUtils;

/** This class holds the attributes of <b:container />. */
@FacesComponent("net.bootsfaces.component.container.Container")
public class Container extends UIOutput implements net.bootsfaces.render.IHasTooltip {

	public static final String COMPONENT_TYPE = "net.bootsfaces.component.container.Container";

	public static final String COMPONENT_FAMILY = "net.bootsfaces.component";

	public static final String DEFAULT_RENDERER = "net.bootsfaces.component.container.Container";

	public Container() {
		Tooltip.addResourceFiles();
		AddResourcesListener.addThemedCSSResource("core.css");
		setRendererType(DEFAULT_RENDERER);
	}

	public String getFamily() {
		return COMPONENT_FAMILY;
	}

	public void setValueExpression(String name, ValueExpression binding) {
		name = BsfUtils.snakeCaseToCamelCase(name);
		super.setValueExpression(name, binding);
	}

	protected enum PropertyKeys {
		dir,
		fluid,
		style,
		styleClass,
		tooltip,
		tooltipContainer,
		tooltipDelay,
		tooltipDelayHide,
		tooltipDelayShow,
		tooltipPosition
;
        String toString;

        PropertyKeys(String toString) {
            this.toString = toString;
        }

        PropertyKeys() {}

        public String toString() {
            return ((this.toString != null) ? this.toString : super.toString());
        }
    }
	

	/**
	 * Direction indication for text that does not inherit directionality. Legal values: ltr (Default. Left-to-right text direction), rtl (Right-to-left text direction) and auto (let the browser figure out the direction of your alphabet, based on the page content). 

* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getDir() { return (String)getStateHelper().eval(PropertyKeys.dir); } /** * Direction indication for text that does not inherit directionality. Legal values: ltr (Default. Left-to-right text direction), rtl (Right-to-left text direction) and auto (let the browser figure out the direction of your alphabet, based on the page content).

* Usually this method is called internally by the JSF engine. */ public void setDir(String _dir) { getStateHelper().put(PropertyKeys.dir, _dir); } /** * Boolean value default is false; when set to true, the container will be "fluid": a full width container, spanning the entire width of the viewport.

* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public boolean isFluid() { return (boolean) (Boolean)getStateHelper().eval(PropertyKeys.fluid, false); } /** * Boolean value default is false; when set to true, the container will be "fluid": a full width container, spanning the entire width of the viewport.

* Usually this method is called internally by the JSF engine. */ public void setFluid(boolean _fluid) { getStateHelper().put(PropertyKeys.fluid, _fluid); } /** * Inline style of the input element.

* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getStyle() { return (String)getStateHelper().eval(PropertyKeys.style); } /** * Inline style of the input element.

* Usually this method is called internally by the JSF engine. */ public void setStyle(String _style) { getStateHelper().put(PropertyKeys.style, _style); } /** * Style class of this element.

* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getStyleClass() { return (String)getStateHelper().eval(PropertyKeys.styleClass); } /** * Style class of this element.

* Usually this method is called internally by the JSF engine. */ public void setStyleClass(String _styleClass) { getStateHelper().put(PropertyKeys.styleClass, _styleClass); } /** * The text of the tooltip.

* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getTooltip() { return (String)getStateHelper().eval(PropertyKeys.tooltip); } /** * The text of the tooltip.

* Usually this method is called internally by the JSF engine. */ public void setTooltip(String _tooltip) { getStateHelper().put(PropertyKeys.tooltip, _tooltip); } /** * Where is the tooltip div generated? That's primarily a technical value that can be used to fix rendering errors in special cases. Also see data-container in the documentation of Bootstrap. The default value is body.

* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getTooltipContainer() { return (String)getStateHelper().eval(PropertyKeys.tooltipContainer, "body"); } /** * Where is the tooltip div generated? That's primarily a technical value that can be used to fix rendering errors in special cases. Also see data-container in the documentation of Bootstrap. The default value is body.

* Usually this method is called internally by the JSF engine. */ public void setTooltipContainer(String _tooltipContainer) { getStateHelper().put(PropertyKeys.tooltipContainer, _tooltipContainer); } /** * The tooltip is shown and hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public int getTooltipDelay() { return (int) (Integer)getStateHelper().eval(PropertyKeys.tooltipDelay, 0); } /** * The tooltip is shown and hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

* Usually this method is called internally by the JSF engine. */ public void setTooltipDelay(int _tooltipDelay) { getStateHelper().put(PropertyKeys.tooltipDelay, _tooltipDelay); } /** * The tooltip is hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public int getTooltipDelayHide() { return (int) (Integer)getStateHelper().eval(PropertyKeys.tooltipDelayHide, 0); } /** * The tooltip is hidden with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

* Usually this method is called internally by the JSF engine. */ public void setTooltipDelayHide(int _tooltipDelayHide) { getStateHelper().put(PropertyKeys.tooltipDelayHide, _tooltipDelayHide); } /** * The tooltip is shown with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public int getTooltipDelayShow() { return (int) (Integer)getStateHelper().eval(PropertyKeys.tooltipDelayShow, 0); } /** * The tooltip is shown with a delay. This value is the delay in milliseconds. Defaults to 0 (no delay).

* Usually this method is called internally by the JSF engine. */ public void setTooltipDelayShow(int _tooltipDelayShow) { getStateHelper().put(PropertyKeys.tooltipDelayShow, _tooltipDelayShow); } /** * Where is the tooltip to be displayed? Possible values: "top", "bottom", "right", "left", "auto", "auto top", "auto bottom", "auto right" and "auto left". Default to "bottom".

* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file. */ public String getTooltipPosition() { return (String)getStateHelper().eval(PropertyKeys.tooltipPosition); } /** * Where is the tooltip to be displayed? Possible values: "top", "bottom", "right", "left", "auto", "auto top", "auto bottom", "auto right" and "auto left". Default to "bottom".

* Usually this method is called internally by the JSF engine. */ public void setTooltipPosition(String _tooltipPosition) { getStateHelper().put(PropertyKeys.tooltipPosition, _tooltipPosition); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy