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

io.github.palexdev.mfxcomponents.controls.fab.MFXFab Maven / Gradle / Ivy

There is a newer version: 11.26.8
Show newest version
/*
 * Copyright (C) 2023 Parisi Alessandro - [email protected]
 * This file is part of MaterialFX (https://github.com/palexdev/MaterialFX)
 *
 * MaterialFX is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3 of the License,
 * or (at your option) any later version.
 *
 * MaterialFX 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with MaterialFX. If not, see .
 */

package io.github.palexdev.mfxcomponents.controls.fab;

import io.github.palexdev.mfxcomponents.skins.MFXFabSkin;
import io.github.palexdev.mfxcomponents.theming.base.WithVariants;
import io.github.palexdev.mfxcomponents.theming.enums.FABVariants;
import io.github.palexdev.mfxresources.fonts.MFXFontIcon;

import java.util.EnumSet;
import java.util.List;

/**
 * Extension of {@link MFXFabBase}. This variant is styled by the default themes, the default style classes are
 * overridden to: '.mfx-button.fab-base.fab'.
 * 

* Implements the {@link WithVariants} API, since these type of FABs have slightly different versions, the * variants are described by {@link FABVariants}. * * @see MFXFabSkin */ public class MFXFab extends MFXFabBase implements WithVariants { //================================================================================ // Properties //================================================================================ private final EnumSet variants = EnumSet.noneOf(FABVariants.class); //================================================================================ // Constructors //================================================================================ public MFXFab() { } public MFXFab(String text) { super(text); } public MFXFab(MFXFontIcon icon) { super(icon); } public MFXFab(String text, MFXFontIcon icon) { super(text, icon); } //================================================================================ // Variants //================================================================================ public MFXFab small() { setVariants(FABVariants.SMALL); return this; } public MFXFab large() { setVariants(FABVariants.LARGE); return this; } public MFXFab surface() { setVariants(FABVariants.SURFACE); return this; } public MFXFab secondary() { setVariants(FABVariants.SECONDARY); return this; } public MFXFab tertiary() { setVariants(FABVariants.TERTIARY); return this; } public MFXFab lowered() { setVariants(FABVariants.LOWERED); return this; } /** * Sets the FAB to be extended with fluent API. */ public MFXFab extended() { setExtended(true); return this; } //================================================================================ // Overridden Methods //================================================================================ @Override public List defaultStyleClasses() { return List.of("mfx-button", "fab-base", "fab"); } @Override public MFXFab addVariants(FABVariants... variants) { return WithVariants.addVariants(this, variants); } @Override public MFXFab setVariants(FABVariants... variants) { return WithVariants.setVariants(this, variants); } @Override public MFXFab removeVariants(FABVariants... variants) { return WithVariants.removeVariants(this, variants); } @Override public EnumSet getAppliedVariants() { return variants; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy