Delete displayError in UiNotification

Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
Melanie Retter
2016-08-01 13:40:40 +02:00
parent 26c376e22e
commit c0a3a44277
3 changed files with 9 additions and 22 deletions

View File

@@ -46,12 +46,12 @@ public class HawkbitUIErrorHandler extends DefaultErrorHandler {
}
}
private Throwable getRootExceptionFrom(final ErrorEvent event) {
private static Throwable getRootExceptionFrom(final ErrorEvent event) {
return getRootCauseOf(event.getThrowable());
}
private Throwable getRootCauseOf(final Throwable exception) {
private static Throwable getRootCauseOf(final Throwable exception) {
if (exception.getCause() != null) {
return getRootCauseOf(exception.getCause());
@@ -60,7 +60,7 @@ public class HawkbitUIErrorHandler extends DefaultErrorHandler {
return exception;
}
private Optional<Page> getPageOriginError(final ErrorEvent event) {
private static Optional<Page> getPageOriginError(final ErrorEvent event) {
final Component errorOrigin = findAbstractComponent(event);

View File

@@ -33,6 +33,7 @@ import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.tagdetails.AbstractTagToken.TagData;
import org.eclipse.hawkbit.ui.components.HawkbitErrorNotificationMessage;
import org.eclipse.hawkbit.ui.management.event.BulkUploadValidationMessageEvent;
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent.TargetComponentEvent;
@@ -40,12 +41,14 @@ import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.management.state.TargetBulkUpload;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.vaadin.spring.events.EventBus;
import com.vaadin.server.Page;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.CustomComponent;
@@ -445,7 +448,9 @@ public class BulkUploadHandler extends CustomComponent
@Override
public void uploadStarted(final StartedEvent event) {
if (!event.getFilename().endsWith(".csv")) {
uINotification.displayError(i18n.get("bulk.targets.upload"), null, true);
new HawkbitErrorNotificationMessage(SPUILabelDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE, null,
i18n.get("bulk.targets.upload"), true).show(Page.getCurrent());
LOG.error("Wrong file format for file {}", event.getFilename());
upload.interruptUpload();
} else {

View File

@@ -53,22 +53,4 @@ public class UINotification implements Serializable {
updatedMsg.toString(), true);
}
/**
* Display error type of notification message.
*
* @param message
* errorMessage
* @param caption
* caption of the errorMessage
* @param autoClose
* boolean, if errorMessage should be closed by clicking on the
* error (false) or by clicking anywhere (true)
*/
public void displayError(final String message, final String caption, final Boolean autoClose) {
final StringBuilder updatedMsg = new StringBuilder(FontAwesome.EXCLAMATION_TRIANGLE.getHtml());
updatedMsg.append(' ');
updatedMsg.append(message);
notificationMessage.showNotification(SPUILabelDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE, caption,
updatedMsg.toString(), autoClose);
}
}