use of org.eclipse.scout.rt.platform.status.IMultiStatus in project scout.rt by eclipse.
the class FormFieldTest method testRemoveWithRemainingErrorStatus.
@Test
public void testRemoveWithRemainingErrorStatus() throws Exception {
SimpleTestFormField testField = new SimpleTestFormField();
P_PropertyChangeEventCounter counter = new P_PropertyChangeEventCounter();
testField.addPropertyChangeListener(IFormField.PROP_ERROR_STATUS, counter);
IMultiStatus status0 = testField.getErrorStatus();
testField.addErrorStatus(new InvalidSequenceStatus("error"));
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertFalse(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status1 = testField.getErrorStatus();
testField.addErrorStatus(new ParsingFailedStatus("error", "input"));
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertTrue(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status2 = testField.getErrorStatus();
testField.removeErrorStatus(ParsingFailedStatus.class);
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertFalse(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status3 = testField.getErrorStatus();
assertNotEquals(status0, status1);
assertNotEquals(status1, status2);
assertNotEquals(status2, status3);
// add + add + remove
assertEquals(3, counter.getCount());
}
use of org.eclipse.scout.rt.platform.status.IMultiStatus in project scout.rt by eclipse.
the class FormFieldTest method testAddDifferentErrorStatus.
@Test
public void testAddDifferentErrorStatus() throws Exception {
SimpleTestFormField testField = new SimpleTestFormField();
P_PropertyChangeEventCounter counter = new P_PropertyChangeEventCounter();
testField.addPropertyChangeListener(IFormField.PROP_ERROR_STATUS, counter);
IMultiStatus status0 = testField.getErrorStatus();
testField.addErrorStatus(new Status("error"));
assertTrue(testField.getErrorStatus().containsStatus(Status.class));
IMultiStatus status1 = testField.getErrorStatus();
testField.addErrorStatus(new Status("another message"));
assertTrue(testField.getErrorStatus().containsStatus(Status.class));
IMultiStatus status2 = testField.getErrorStatus();
assertNotEquals(status0, status1);
assertNotEquals(status1, status2);
assertEquals(2, counter.getCount());
}
use of org.eclipse.scout.rt.platform.status.IMultiStatus in project scout.rt by eclipse.
the class FormFieldTest method testAddMultipleRemoveOneAddErrorStatus.
@Test
public void testAddMultipleRemoveOneAddErrorStatus() throws Exception {
SimpleTestFormField testField = new SimpleTestFormField();
P_PropertyChangeEventCounter counter = new P_PropertyChangeEventCounter();
testField.addPropertyChangeListener(IFormField.PROP_ERROR_STATUS, counter);
IMultiStatus status0 = testField.getErrorStatus();
testField.addErrorStatus(new InvalidSequenceStatus("error"));
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertFalse(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status1 = testField.getErrorStatus();
testField.addErrorStatus(new ParsingFailedStatus("error", "input"));
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertTrue(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status2 = testField.getErrorStatus();
testField.removeErrorStatus(ParsingFailedStatus.class);
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertFalse(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status3 = testField.getErrorStatus();
testField.addErrorStatus(new ParsingFailedStatus("error", "input"));
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertTrue(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status4 = testField.getErrorStatus();
assertNotEquals(status0, status1);
assertNotEquals(status1, status2);
assertNotEquals(status2, status3);
assertNotEquals(status3, status4);
// add + add + remove + add
assertEquals(4, counter.getCount());
}
use of org.eclipse.scout.rt.platform.status.IMultiStatus in project scout.rt by eclipse.
the class AbstractColumn method cellValueToEditor.
/**
* Map the values of a cell to the editing form field. The default implementation assumes a value field.
*
* @param row
* the row that is currently edited
* @param editorField
* the field to edit the value
* @throws ProcessingException
* if the field is not a value field
*/
@SuppressWarnings("unchecked")
protected void cellValueToEditor(ITableRow row, IFormField editorField) {
final ICell cell = row.getCell(this);
IMultiStatus status = cell.getErrorStatus();
if (status == null || status.isOK()) {
cellValueToEditField((VALUE) cell.getValue(), editorField);
} else {
cellTextToEditField(cell.getText(), editorField);
}
}
use of org.eclipse.scout.rt.platform.status.IMultiStatus in project scout.rt by eclipse.
the class Cell method removeErrorStatus.
/**
* Remove IStatus of a specific type
*/
public void removeErrorStatus(Class<? extends IStatus> statusClazz) {
final IMultiStatus ms = getErrorStatusInternal();
if (ms != null) {
ms.removeAll(statusClazz);
if (ms.getChildren().isEmpty()) {
clearErrorStatus();
}
notifyObserver(ERROR_STATUS_BIT);
}
}
Aggregations