csheets.ext.assertion.ui
Class AssertionController

java.lang.Object
  extended by csheets.ext.assertion.ui.AssertionController

public class AssertionController
extends Object

A controller for updating the user-specified assertion of a cell.

Author:
Einar Pehrson

Constructor Summary
AssertionController(UIController uiController)
          Creates a new assertion controller.
 
Method Summary
static Color getAssertionResultColor(Assertion.Result result)
          Assigns a color to the given assertion result.
 boolean setAssertion(AssertableCell cell, String assertionString)
          Attempts to create a new assertion from the given string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssertionController

public AssertionController(UIController uiController)
Creates a new assertion controller.

Parameters:
uiController - the user interface controller
Method Detail

setAssertion

public boolean setAssertion(AssertableCell cell,
                            String assertionString)
Attempts to create a new assertion from the given string. If successful, adds the assertion to the given cell. Otherwise, displays an error message. If the input string is empty or null, the assertion is set to null.

Parameters:
cell - the cell for which the assertion should be set
assertionString - the assertion, as entered by the user
Returns:
true if the cell's assertion was changed

getAssertionResultColor

public static Color getAssertionResultColor(Assertion.Result result)
Assigns a color to the given assertion result.

Parameters:
result - the assertion result for which a color is wanted
Returns:
the appropriate color to use in the interface