Search in sources :

Example 16 with Status

use of org.eclipse.scout.rt.platform.status.Status in project scout.rt by eclipse.

the class FormFieldTest method testAddRemoveAddErrorStatus.

@Test
public void testAddRemoveAddErrorStatus() 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.removeErrorStatus(Status.class);
    assertNull(testField.getErrorStatus());
    IMultiStatus status2 = testField.getErrorStatus();
    testField.addErrorStatus(new Status("error"));
    assertTrue(testField.getErrorStatus().containsStatus(Status.class));
    IMultiStatus status3 = testField.getErrorStatus();
    assertNotEquals(status0, status1);
    assertNotEquals(status1, status2);
    assertNotEquals(status2, status3);
    // adding + removing + adding
    assertEquals(3, counter.getCount());
}
Also used : InvalidSequenceStatus(org.eclipse.scout.rt.client.ui.form.fields.sequencebox.InvalidSequenceStatus) Status(org.eclipse.scout.rt.platform.status.Status) IMultiStatus(org.eclipse.scout.rt.platform.status.IMultiStatus) MultiStatus(org.eclipse.scout.rt.platform.status.MultiStatus) IMultiStatus(org.eclipse.scout.rt.platform.status.IMultiStatus) Test(org.junit.Test)

Example 17 with Status

use of org.eclipse.scout.rt.platform.status.Status in project scout.rt by eclipse.

the class FormFieldTest method testRemoveErrorStatus.

@Test
public void testRemoveErrorStatus() 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.removeErrorStatus(Status.class);
    assertNull(testField.getErrorStatus());
    IMultiStatus status2 = testField.getErrorStatus();
    assertNotEquals(status0, status1);
    assertNotEquals(status1, status2);
    assertEquals(2, counter.getCount());
}
Also used : InvalidSequenceStatus(org.eclipse.scout.rt.client.ui.form.fields.sequencebox.InvalidSequenceStatus) Status(org.eclipse.scout.rt.platform.status.Status) IMultiStatus(org.eclipse.scout.rt.platform.status.IMultiStatus) MultiStatus(org.eclipse.scout.rt.platform.status.MultiStatus) IMultiStatus(org.eclipse.scout.rt.platform.status.IMultiStatus) Test(org.junit.Test)

Example 18 with Status

use of org.eclipse.scout.rt.platform.status.Status in project scout.rt by eclipse.

the class FormFieldTest method testSetSameErrorStatus.

@Test
public void testSetSameErrorStatus() throws Exception {
    SimpleTestFormField testField = new SimpleTestFormField();
    P_PropertyChangeEventCounter counter = new P_PropertyChangeEventCounter();
    testField.addPropertyChangeListener(IFormField.PROP_ERROR_STATUS, counter);
    final MultiStatus ms = new MultiStatus();
    ms.add(new Status("error"));
    testField.setErrorStatus(ms);
    assertEquals(ms, testField.getErrorStatus());
    assertNotSame(ms, testField.getErrorStatus());
    final MultiStatus ms2 = new MultiStatus();
    // new object, but same content
    ms2.add(new Status("error"));
    testField.setErrorStatus(ms2);
    assertEquals(ms2, testField.getErrorStatus());
    assertNotSame(ms2, testField.getErrorStatus());
    assertEquals(1, counter.getCount());
}
Also used : InvalidSequenceStatus(org.eclipse.scout.rt.client.ui.form.fields.sequencebox.InvalidSequenceStatus) Status(org.eclipse.scout.rt.platform.status.Status) IMultiStatus(org.eclipse.scout.rt.platform.status.IMultiStatus) MultiStatus(org.eclipse.scout.rt.platform.status.MultiStatus) IMultiStatus(org.eclipse.scout.rt.platform.status.IMultiStatus) MultiStatus(org.eclipse.scout.rt.platform.status.MultiStatus) Test(org.junit.Test)

Example 19 with Status

use of org.eclipse.scout.rt.platform.status.Status in project scout.rt by eclipse.

the class FormFieldTest method testClearErrorStatus.

@Test
public void testClearErrorStatus() throws Exception {
    SimpleTestFormField testField = new SimpleTestFormField();
    testField.addErrorStatus(new Status("error"));
    testField.clearErrorStatus();
    assertNull(testField.getErrorStatus());
}
Also used : InvalidSequenceStatus(org.eclipse.scout.rt.client.ui.form.fields.sequencebox.InvalidSequenceStatus) Status(org.eclipse.scout.rt.platform.status.Status) IMultiStatus(org.eclipse.scout.rt.platform.status.IMultiStatus) MultiStatus(org.eclipse.scout.rt.platform.status.MultiStatus) Test(org.junit.Test)

Example 20 with Status

use of org.eclipse.scout.rt.platform.status.Status in project scout.rt by eclipse.

the class AbstractFormTest method testValidForm_ErrorStatus.

/**
 * Tests that validating a valid form with an ok status should not result in any error.
 */
@Test
public void testValidForm_ErrorStatus() {
    String errorMessage = "";
    try {
        TestForm form = new TestForm();
        form.getMainBox().addErrorStatus(new Status("ErrorMessage"));
        form.validateForm();
    } catch (VetoException ve) {
        errorMessage = ve.getDisplayMessage();
    }
    final String expectedTextPart = "Main Box: ErrorMessage";
    assertTrue("expected errorMessage contains: '" + expectedTextPart + "', but was '" + errorMessage + "'", errorMessage.contains(expectedTextPart));
}
Also used : Status(org.eclipse.scout.rt.platform.status.Status) VetoException(org.eclipse.scout.rt.platform.exception.VetoException) Test(org.junit.Test)

Aggregations

Status (org.eclipse.scout.rt.platform.status.Status)23 Test (org.junit.Test)15 IStatus (org.eclipse.scout.rt.platform.status.IStatus)14 MultiStatus (org.eclipse.scout.rt.platform.status.MultiStatus)11 IMultiStatus (org.eclipse.scout.rt.platform.status.IMultiStatus)9 InvalidSequenceStatus (org.eclipse.scout.rt.client.ui.form.fields.sequencebox.InvalidSequenceStatus)8 ParsingFailedStatus (org.eclipse.scout.rt.client.ui.form.fields.ParsingFailedStatus)3 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)2 IProcessingStatus (org.eclipse.scout.rt.platform.exception.IProcessingStatus)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)1 ITableCustomizer (org.eclipse.scout.rt.client.ui.basic.table.customizer.ITableCustomizer)1 TableUserFilterManager (org.eclipse.scout.rt.client.ui.basic.table.userfilter.TableUserFilterManager)1 ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)1 ISearchForm (org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm)1 Order (org.eclipse.scout.rt.platform.Order)1 ConfigOperation (org.eclipse.scout.rt.platform.annotations.ConfigOperation)1 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)1 VetoException (org.eclipse.scout.rt.platform.exception.VetoException)1