Search in sources :

Example 16 with VetoException

use of org.eclipse.scout.rt.platform.exception.VetoException in project scout.rt by eclipse.

the class AbstractSmartField2 method handleMissingLookupRow.

protected VALUE handleMissingLookupRow(String text) {
    doSearch(text, false, true);
    IContentAssistFieldDataFetchResult<VALUE> fetchResult = getLookupRowFetcher().getResult();
    int numResults = 0;
    if (fetchResult != null && fetchResult.getLookupRows() != null) {
        numResults = fetchResult.getLookupRows().size();
        if (numResults == 1) {
            ILookupRow<VALUE> singleMatchLookupRow = CollectionUtility.firstElement(fetchResult.getLookupRows());
            setLookupRow(singleMatchLookupRow);
            return returnLookupRowAsValue(singleMatchLookupRow);
        }
    }
    boolean notUnique = numResults > 1;
    VetoException veto = new VetoException(TEXTS.get(notUnique ? "SmartFieldNotUnique" : "SmartFieldCannotComplete", text));
    veto.withCode(notUnique ? NOT_UNIQUE_ERROR_CODE : NO_RESULTS_ERROR_CODE);
    throw veto;
}
Also used : VetoException(org.eclipse.scout.rt.platform.exception.VetoException)

Aggregations

VetoException (org.eclipse.scout.rt.platform.exception.VetoException)16 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)6 PlatformException (org.eclipse.scout.rt.platform.exception.PlatformException)3 Test (org.junit.Test)3 IFormField (org.eclipse.scout.rt.client.ui.form.fields.IFormField)2 PlatformError (org.eclipse.scout.rt.platform.exception.PlatformError)2 IRunnable (org.eclipse.scout.rt.platform.util.concurrent.IRunnable)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 Semaphore (java.util.concurrent.Semaphore)1 IClientSession (org.eclipse.scout.rt.client.IClientSession)1 IDesktop (org.eclipse.scout.rt.client.ui.desktop.IDesktop)1 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)1 IPageWithNodes (org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes)1 IPageWithTable (org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable)1 IValidateContentDescriptor (org.eclipse.scout.rt.client.ui.form.fields.IValidateContentDescriptor)1 IMessageBox (org.eclipse.scout.rt.client.ui.messagebox.IMessageBox)1 IProcessingStatus (org.eclipse.scout.rt.platform.exception.IProcessingStatus)1 PlatformExceptionTranslator (org.eclipse.scout.rt.platform.exception.PlatformExceptionTranslator)1 ProcessingStatus (org.eclipse.scout.rt.platform.exception.ProcessingStatus)1