com.foreach.across.modules.bootstrapui.attributes.HtmlAriaAttributes Maven / Gradle / Ivy
/*
* Copyright 2019 the original author or authors
*
* 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 com.foreach.across.modules.bootstrapui.attributes;
import com.foreach.across.modules.web.ui.elements.support.AttributeWitherFunction;
import lombok.NonNull;
/**
* HTML {@code aria-} attributes.
*
* @author Arne Vandamme
* @since 3.0.0
*/
@SuppressWarnings("WeakerAccess")
public class HtmlAriaAttributes
{
public final static HtmlAriaAttributes aria = new HtmlAriaAttributes();
public final DefaultValueAttributeWitherFunction hasPopup = of( "haspopup", true );
public final AttributeWitherFunction expanded = of( "expanded" );
public final AttributeWitherFunction label = of( "label" );
public final DefaultValueAttributeWitherFunction hidden = of( "hidden", true );
public AttributeWitherFunction.AttributeValueWitherFunction hasPopup( boolean value ) {
return hasPopup.withValue( value );
}
public AttributeWitherFunction.AttributeValueWitherFunction expanded( boolean value ) {
return expanded.withValue( value );
}
public AttributeWitherFunction.AttributeValueWitherFunction hidden( boolean value ) {
return hidden.withValue( value );
}
public AttributeWitherFunction.AttributeValueWitherFunction label( @NonNull String text ) {
return label.withValue( text );
}
public AttributeWitherFunction of( @NonNull String attributeName ) {
return new AttributeWitherFunction( "aria-" + attributeName );
}
public DefaultValueAttributeWitherFunction of( @NonNull String attributeName, S defaultValue ) {
return new DefaultValueAttributeWitherFunction<>( "aria-" + attributeName, defaultValue );
}
}