org.openjump.core.ui.enablecheck
Class BooleanPropertyEnableCheck

java.lang.Object
  extended by org.openjump.core.ui.enablecheck.BooleanPropertyEnableCheck
All Implemented Interfaces:
EnableCheck

public class BooleanPropertyEnableCheck
extends java.lang.Object
implements EnableCheck


Constructor Summary
BooleanPropertyEnableCheck(java.lang.Object object, java.lang.String checkMethodName)
           
BooleanPropertyEnableCheck(java.lang.Object object, java.lang.String checkMethodName, boolean expectedValue)
           
BooleanPropertyEnableCheck(java.lang.Object object, java.lang.String checkMethodName, boolean expectedValue, java.lang.String disabledMessage)
           
 
Method Summary
 java.lang.String check(javax.swing.JComponent component)
          Returns a non-null value if the check failed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanPropertyEnableCheck

public BooleanPropertyEnableCheck(java.lang.Object object,
                                  java.lang.String checkMethodName)
Parameters:
object - The object to invoke the method on.
checkMethodName - The name of the check method which returns a boolean value.

BooleanPropertyEnableCheck

public BooleanPropertyEnableCheck(java.lang.Object object,
                                  java.lang.String checkMethodName,
                                  boolean expectedValue)
Parameters:
object - The object to invoke the method on.
checkMethodName - The name of the check method which returns a boolean value.
expectedValue - The expected value to be returned for the check to be enabled.

BooleanPropertyEnableCheck

public BooleanPropertyEnableCheck(java.lang.Object object,
                                  java.lang.String checkMethodName,
                                  boolean expectedValue,
                                  java.lang.String disabledMessage)
Parameters:
object - The object to invoke the method on.
checkMethodName - The name of the check method which returns a boolean value.
expectedValue - The expected value to be returned for the check to be enabled.
disabledMessage -
Method Detail

check

public java.lang.String check(javax.swing.JComponent component)
Description copied from interface: EnableCheck
Returns a non-null value if the check failed. Sometimes the return value is used (for example, it is displayed as a tooltip for menu-items); sometimes it is not (for example, toolbar buttons don't do anything with the return value). An advanced use of an EnableCheck is simply to change some property of a menu item (such as the text), as it is called when menu items are displayed.

Specified by:
check in interface EnableCheck
Returns:
an error message if the check failed, or null if the check passed