1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-09-28 09:35:32 -07:00
Abacus/src/main/java/org/nwapw/abacus/fx/ToggleablePlugin.java

57 lines
1.5 KiB
Java
Raw Normal View History

package org.nwapw.abacus.fx;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
2017-08-04 12:52:02 -07:00
/**
* Class that represents an entry in the plugin check box list.
* The changes from this property are written to the config on application.
*/
public class ToggleablePlugin {
2017-08-04 12:52:02 -07:00
/**
* The property that determines whether the plugin will be enabled.
*/
private final BooleanProperty enabled;
2017-08-04 12:52:02 -07:00
/**
* The name of the class this entry toggles.
*/
private final String className;
2017-08-04 12:52:02 -07:00
/**
* Creates a new toggleable plugin with the given properties.
* @param enabled the enabled / disabled state at the beginning.
* @param className the name of the class this plugin toggles.
*/
public ToggleablePlugin(boolean enabled, String className){
this.enabled = new SimpleBooleanProperty();
this.enabled.setValue(enabled);
this.className = className;
}
2017-08-04 12:52:02 -07:00
/**
* Gets the enabled property of this plugin.
* @return the enabled property.
*/
public BooleanProperty enabledProperty() {
return enabled;
}
2017-08-04 12:52:02 -07:00
/**
* Checks if this plugin entry should be enabled.
* @return whether this plugin will be enabled.
*/
public boolean isEnabled() {
return enabled.get();
}
2017-08-04 12:52:02 -07:00
/**
* Gets the class name this plugin toggles.
* @return the class name that should be disabled.
*/
public String getClassName() {
return className;
}
}