Search in sources :

Example 6 with MultiStatus

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

the class Cell method addErrorStatuses.

/**
 * Adds an error status
 */
public void addErrorStatuses(List<IStatus> newStatus) {
    final MultiStatus status = ensureMultiStatus(getErrorStatusInternal());
    status.addAll(newStatus);
    setErrorStatusInternal(status);
    notifyObserver(ERROR_STATUS_BIT);
}
Also used : IMultiStatus(org.eclipse.scout.rt.platform.status.IMultiStatus) MultiStatus(org.eclipse.scout.rt.platform.status.MultiStatus)

Example 7 with MultiStatus

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

the class FormFieldTest method testGetErrorStatus.

@Test
public void testGetErrorStatus() throws Exception {
    SimpleTestFormField testField = new SimpleTestFormField();
    final MultiStatus ms = new MultiStatus();
    ms.add(new Status("error"));
    testField.setErrorStatus(ms);
    assertEquals(ms, testField.getErrorStatus());
    assertNotSame(ms, testField.getErrorStatus());
    // get always returns a new object
    assertNotSame(testField.getErrorStatus(), 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) IMultiStatus(org.eclipse.scout.rt.platform.status.IMultiStatus) MultiStatus(org.eclipse.scout.rt.platform.status.MultiStatus) Test(org.junit.Test)

Example 8 with MultiStatus

use of org.eclipse.scout.rt.platform.status.MultiStatus 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 9 with MultiStatus

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

the class CellTest method testAddRemoveMultistatus.

/**
 * {@link Cell#setErrorStatus(org.eclipse.scout.rt.platform.status.IStatus)}
 */
@Test
public void testAddRemoveMultistatus() {
    Cell c = new Cell();
    ParsingFailedStatus errorStatus = new ParsingFailedStatus("failed", "rawString");
    MultiStatus ms = new MultiStatus();
    ms.add(errorStatus);
    c.addErrorStatuses(ms.getChildren());
    c.removeErrorStatus(ParsingFailedStatus.class);
    assertNull(c.getErrorStatus());
}
Also used : MultiStatus(org.eclipse.scout.rt.platform.status.MultiStatus) ParsingFailedStatus(org.eclipse.scout.rt.client.ui.form.fields.ParsingFailedStatus) Test(org.junit.Test)

Aggregations

MultiStatus (org.eclipse.scout.rt.platform.status.MultiStatus)9 IMultiStatus (org.eclipse.scout.rt.platform.status.IMultiStatus)8 Test (org.junit.Test)4 InvalidSequenceStatus (org.eclipse.scout.rt.client.ui.form.fields.sequencebox.InvalidSequenceStatus)3 Status (org.eclipse.scout.rt.platform.status.Status)3 ParsingFailedStatus (org.eclipse.scout.rt.client.ui.form.fields.ParsingFailedStatus)1