Search in sources :

Example 1 with Status

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

the class JsonStatusTest method testToJson.

@Test
public void testToJson() {
    assertEquals(null, JsonStatus.toJson(null));
    Status status = new Status("foo", IStatus.INFO);
    JSONObject json = (JSONObject) JsonStatus.toJson(status);
    assertEquals("foo", json.getString("message"));
    assertEquals(IStatus.INFO, json.getInt("severity"));
}
Also used : IStatus(org.eclipse.scout.rt.platform.status.IStatus) Status(org.eclipse.scout.rt.platform.status.Status) JSONObject(org.json.JSONObject) Test(org.junit.Test)

Example 2 with Status

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

the class CellTest method testClearErrorStatus.

/**
 * When creating a cell. The errorstatus should not be set.
 * {@link Cell#setErrorStatus(org.eclipse.scout.rt.platform.status.IStatus)}
 */
@Test
public void testClearErrorStatus() {
    Cell c = new Cell();
    c.addErrorStatus(new Status("error", IStatus.ERROR));
    c.clearErrorStatus();
    assertNull(c.getErrorStatus());
}
Also used : IStatus(org.eclipse.scout.rt.platform.status.IStatus) Status(org.eclipse.scout.rt.platform.status.Status) MultiStatus(org.eclipse.scout.rt.platform.status.MultiStatus) ParsingFailedStatus(org.eclipse.scout.rt.client.ui.form.fields.ParsingFailedStatus) Test(org.junit.Test)

Example 3 with Status

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

the class AbstractProposalChooser method updateStatus.

protected void updateStatus(IContentAssistFieldDataFetchResult<LOOKUP_KEY> result) {
    if (result != null && result.getException() instanceof FutureCancelledError) {
        return;
    }
    List<? extends ILookupRow<LOOKUP_KEY>> rows = null;
    Throwable exception = null;
    String searchText = null;
    if (result != null) {
        rows = result.getLookupRows();
        exception = result.getException();
        searchText = result.getSearchParam().getSearchQuery();
    }
    if (rows == null) {
        rows = CollectionUtility.emptyArrayList();
    }
    String statusText = null;
    int severity = IStatus.INFO;
    if (exception != null) {
        if (exception instanceof ProcessingException) {
            statusText = ((ProcessingException) exception).getStatus().getMessage();
        } else {
            statusText = exception.getMessage();
        }
        severity = IStatus.ERROR;
    } else if (rows.isEmpty()) {
        if (getContentAssistField().getWildcard().equals(searchText)) {
            statusText = TEXTS.get("SmartFieldNoDataFound");
        } else {
            statusText = TEXTS.get("SmartFieldCannotComplete", (searchText == null) ? ("") : (searchText));
        }
        severity = IStatus.WARNING;
    } else if (rows.size() > m_contentAssistField.getBrowseMaxRowCount()) {
        statusText = TEXTS.get("SmartFieldMoreThanXRows", "" + m_contentAssistField.getBrowseMaxRowCount());
        severity = IStatus.INFO;
    }
    if (statusText != null) {
        setStatus(new Status(statusText, severity));
    } else {
        setStatus(null);
    }
}
Also used : IStatus(org.eclipse.scout.rt.platform.status.IStatus) Status(org.eclipse.scout.rt.platform.status.Status) FutureCancelledError(org.eclipse.scout.rt.platform.util.concurrent.FutureCancelledError) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException)

Example 4 with Status

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

the class JsonStatus method toScoutObject.

public static IStatus toScoutObject(JSONObject jsonStatus) {
    if (jsonStatus == null) {
        return null;
    }
    String message = jsonStatus.optString("message");
    int severity = jsonStatus.getInt("severity");
    String iconId = jsonStatus.optString("iconId");
    Integer code = jsonStatus.optInt("code");
    Status status = new Status(message, severity);
    if (iconId != null) {
        status.withIconId(iconId);
    }
    if (code != null) {
        status.withCode(code);
    }
    return status;
}
Also used : IStatus(org.eclipse.scout.rt.platform.status.IStatus) Status(org.eclipse.scout.rt.platform.status.Status) IMultiStatus(org.eclipse.scout.rt.platform.status.IMultiStatus)

Example 5 with Status

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

the class BookmarkUtility method bmLoadNodePage.

private static IPage<?> bmLoadNodePage(IPageWithNodes nodePage, NodePageState nodePageState, AbstractPageState childState, boolean resetViewAndWarnOnFail) {
    IPage<?> childPage = null;
    if (childState != null) {
        nodePage.ensureChildrenLoaded();
        IPage<?> p = BookmarkUtility.resolvePage(nodePage.getChildPages(), childState.getPageClassName(), childState.getBookmarkIdentifier());
        if (p != null) {
            ITable table = nodePage.getTable();
            // reset table column filter if requested
            if (resetViewAndWarnOnFail && !p.isFilterAccepted() && table.getUserFilterManager() != null) {
                table.getUserFilterManager().reset();
            }
            // check table column filter
            if (p.isFilterAccepted()) {
                childPage = p;
            }
        }
        // set appropriate warning if child page is not available or filtered out
        if (childPage == null && resetViewAndWarnOnFail) {
            nodePage.setTableStatus(new Status(TEXTS.get("BookmarkResolutionCanceled"), IStatus.ERROR));
        }
    }
    return childPage;
}
Also used : IStatus(org.eclipse.scout.rt.platform.status.IStatus) Status(org.eclipse.scout.rt.platform.status.Status) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable)

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