
eu.agrosense.api.style.StyleManager Maven / Gradle / Ivy
/**
* Copyright (C) 2008-2013 LimeTri. All rights reserved.
*
* AgroSense 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.
*
* There are special exceptions to the terms and conditions of the GPLv3 as it is applied to
* this software, see the FLOSS License Exception
* .
*
* AgroSense 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 AgroSense. If not, see .
*/
package eu.agrosense.api.style;
import javafx.scene.Scene;
import org.openide.util.Lookup;
/**
* The style manager can be used to style components.
*
*
* To receive an implementation use:
* Lookup.getDefault().lookup(StyleManager.class) or
* StyleManager.Locator.locate();
*
*
*
*
* @author Timon Veenstra
*/
public interface StyleManager {
/**
*
* @param scene
*/
public void applyFormStyle(Scene scene);
public static class Default {
public static void applyFormStyle(Scene scene) {
Locator.locate().applyFormStyle(scene);
}
}
public static class Locator {
/**
* locate a style manager based on its simple class name returns null
* when not found
*
* @param name
* @return
*/
public static StyleManager locate(String name) {
StyleManager found = null;
for (StyleManager styleManager : Lookup.getDefault().lookupAll(StyleManager.class)) {
if (name.equalsIgnoreCase(styleManager.getClass().getSimpleName())) {
found = styleManager;
break;
}
}
return found;
}
public static StyleManager locate() {
return Lookup.getDefault().lookup(StyleManager.class);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy