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

com.phloc.html.hc.IHCHasCSSClasses Maven / Gradle / Ivy

There is a newer version: 4.4.9
Show newest version
/**
 * Copyright (C) 2006-2015 phloc systems
 * http://www.phloc.com
 * office[at]phloc[dot]com
 *
 * 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.phloc.html.hc;

import java.util.Set;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.phloc.commons.annotations.DevelopersNote;
import com.phloc.commons.annotations.ReturnsMutableCopy;
import com.phloc.html.css.ICSSClassProvider;

/**
 * Base interface for objects having CSS classes
 * 
 * @author Philip Helger
 * @param 
 *        Implementation type
 */
public interface IHCHasCSSClasses >
{
  @Nonnull
  THISTYPE addClass (@Nullable ICSSClassProvider aProvider);

  @Deprecated
  @DevelopersNote ("Use addClass instead!")
  @Nonnull
  THISTYPE addClasses (@Nullable ICSSClassProvider aProvider);

  /**
   * Add multiple unique CSS classes at once. Each CSS class that is already
   * present, is ignored.
   * 
   * @param aProviders
   *        The CSS classed to add. May neither be null nor empty.
   * @return this
   */
  @Nonnull
  THISTYPE addClasses (@Nullable ICSSClassProvider... aProviders);

  /**
   * Add multiple unique CSS classes at once. Each CSS class that is already
   * present, is ignored.
   * 
   * @param aProviders
   *        The CSS classed to add. May neither be null nor empty.
   * @return this
   */
  @Nonnull
  THISTYPE addClasses (@Nullable Iterable  aProviders);

  @Nonnull
  THISTYPE removeClass (@Nullable ICSSClassProvider aProvider);

  @Nonnull
  THISTYPE removeAllClasses ();

  boolean containsClass (@Nullable ICSSClassProvider aProvider);

  @Nonnull
  @ReturnsMutableCopy
  Set  getAllClasses ();

  @Nonnull
  @ReturnsMutableCopy
  Set  getAllClassNames ();

  /**
   * @return true if at least one CSS class is assigned,
   *         false otherwise.
   */
  boolean hasAnyClass ();

  /**
   * Get the string representation of all contained classes as it should be set
   * to the HTML class attribute.
   * 
   * @return null if no classes are present.
   */
  @Nullable
  String getAllClassesAsString ();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy