public interface EnabledEx
This interface represents a component that understands how to properly implement enabled within the Vision component system. This means that the true Swing enabled property will not be exposed as a bean property. Instead, a property named componentEnabled will be present. The true Swing enabled property will be derived as a boolean AND between componentEnabled and the expression: !Boolean.TRUE.equals(getClientProperty(EnabledEx.DISABLED_BY_PERMISSIONS))
The functions in this interface are typically implemented as follows:
private boolean componentEnabled = true; public boolean isComponentEnabled() { return componentEnabled; } public void setComponentEnabled(boolean componentEnabled) { this.componentEnabled = componentEnabled; evaluateEnabled(); } public void evaluateEnabled() { setEnabled(isComponentEnabled() && !Boolean.TRUE.equals(getClientProperty(EnabledEx.DISABLED_BY_PERMISSIONS))); }
If your component is complex and has interior components, you may want to implement evaluateEnabled to disable them instead or as well.
If your bean info extends from CommonBeanInfo, you don't need to add your componentEnabled property, it will be added for you.
Classes implementing this interface MUST extend from JComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DISABLED_BY_PERMISSIONS |
Modifier and Type | Method and Description |
---|---|
void |
evaluateEnabled() |
boolean |
isComponentEnabled() |
void |
setComponentEnabled(boolean enabled) |
static final java.lang.String DISABLED_BY_PERMISSIONS