gpt4 book ai didi

com.haulmont.cuba.gui.WindowManager.showNotification()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 01:07:05 29 4
gpt4 key购买 nike

本文整理了Java中com.haulmont.cuba.gui.WindowManager.showNotification()方法的一些代码示例,展示了WindowManager.showNotification()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WindowManager.showNotification()方法的具体详情如下:
包路径:com.haulmont.cuba.gui.WindowManager
类名称:WindowManager
方法名:showNotification

WindowManager.showNotification介绍

[英]Show notification with Frame.NotificationType#HUMANIZED.
Supports line breaks ( \n).
[中]用框架显示通知。NotificationType#人性化。
支持换行符(\n)。

代码示例

代码示例来源:origin: com.haulmont.addon.admintools/cuba-at-gui

@Override
  protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) {
    windowManager.showNotification(message, Frame.NotificationType.ERROR);
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) {
  String msg = messages.getMessage(getClass(), "accessDenied.message");
  windowManager.showNotification(msg, Frame.NotificationType.ERROR);
}

代码示例来源:origin: com.haulmont.fts/fts-web

@Override
  protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) {
    String msg = messages.getMessage(LuceneIndexNotFoundExceptionHandler.class, "indexNotFound.msg");
    windowManager.showNotification(msg, Frame.NotificationType.ERROR);
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

protected void doHandle(WindowManager windowManager) {
    String msg = messages.formatMessage(getClass(), "mssqlDateOutOfRangeException.message");
    windowManager.showNotification(msg, Frame.NotificationType.WARNING);
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) {
  String msg = messages.getMessage(getClass(), "noSuchScreen.message");
  windowManager.showNotification(msg,
      throwable != null ? throwable.getMessage() : null, Frame.NotificationType.ERROR);
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

/**
 * Show notification with {@link Frame.NotificationType#HUMANIZED}. <br>
 * Supports line breaks ({@code \n}).
 *
 * @param caption notification text
 *
 * @deprecated Use {@link Notifications} bean instead.
 */
@Deprecated
default void showNotification(String caption) {
  getWindowManager().showNotification(caption);
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
  protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) {
    String msg = messages.formatMessage(getClass(), "entityAccessException.message");
    windowManager.showNotification(msg, Frame.NotificationType.WARNING);
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
  protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) {
    String msg = "It usually occurs when the attribute is not included into a view";
    String defaultMsg = "\n\nSee the log to find out what attribute caused the exception";

    if (throwable != null) {
      Matcher matcher = PATTERN.matcher(ExceptionUtils.getStackTrace(throwable));
      if (matcher.find()) {
        msg += "\n\nEntity: " + matcher.group(1) + "\nAttribute: " + matcher.group(2);
      } else {
        msg += defaultMsg;
      }
    } else {
      msg += defaultMsg;
    }

    windowManager.showNotification("Unfetched attribute access error", msg, Frame.NotificationType.ERROR);
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

/**
 * Show notification. <br>
 * Supports line breaks ({@code \n}) for non HTML type.
 *
 * @param caption notification text
 * @param type    defines how to display the notification.
 *                Don't forget to escape data from the database in case of {@code *_HTML} types!
 *
 * @deprecated Use {@link Notifications} bean instead.
 */
@Deprecated
default void showNotification(String caption, Frame.NotificationType type) {
  getWindowManager().showNotification(caption, type);
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

/**
 * Show notification with caption and description. <br>
 * Supports line breaks ({@code \n}) for non HTML type.
 *
 * @param caption     notification text
 * @param description notification description
 * @param type        defines how to display the notification.
 *                    Don't forget to escape data from the database in case of {@code *_HTML} types!
 *
 * @deprecated Use {@link Notifications} bean instead.
 */
@Deprecated
default void showNotification(String caption, String description, Frame.NotificationType type) {
  getWindowManager().showNotification(caption, description, type);
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
  protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) {
    Messages messages = AppBeans.get(Messages.NAME);
    String msg = messages.getMessage(getClass(), "numericFieldOverflow.message");
    windowManager.showNotification(msg, Frame.NotificationType.ERROR);
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
  protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager wm) {
    if (throwable == null) {
      return;
    }

    Set<ConstraintViolation<?>> violations = ((ConstraintViolationException) throwable).getConstraintViolations();

    log.error("Service has thrown validation exception. Violations: {}", violations, throwable);

    String msg = messages.formatMessage(ServiceCallValidationExceptionHandler.class, "serviceCallValidationViolation.message");
    wm.showNotification(msg, NotificationType.ERROR);
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

protected void showParseExceptionNotification(String message) {
  WindowManager wm = AppBeans.get(WindowManagerProvider.class).get();
  wm.showNotification(message, Frame.NotificationType.TRAY);
}

代码示例来源:origin: com.haulmont.cuba/cuba-web

protected void showNotification(App app, Throwable exception) {
    Throwable rootCause = ExceptionUtils.getRootCause(exception);
    if (rootCause == null) {
      rootCause = exception;
    }
    WindowManager windowManager = app.getWindowManager();
    if (windowManager != null) {
      windowManager.showNotification(
          messages.getMainMessage("exceptionDialog.caption", app.getLocale()),
          rootCause.getClass().getSimpleName() + (rootCause.getMessage() != null ? "\n" + rootCause.getMessage() : ""),
          Frame.NotificationType.ERROR
      );
    }
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) {
  Pattern pattern = Pattern.compile("Class> (.+)");
  Matcher matcher = pattern.matcher(message);
  String entityClassName = "";
  if (matcher.find()) {
    entityClassName = matcher.group(1);
  }
  String msg;
  if (entityClassName.contains(".")) {
    String entityName = entityClassName.substring(entityClassName.lastIndexOf(".") + 1);
    String packageName = entityClassName.substring(0, entityClassName.lastIndexOf("."));
    String localizedEntityName = messages.getMessage(packageName, entityName);
    msg = messages.formatMessage(messages.getMainMessagePack(),
        "optimisticException.message", "\"" + localizedEntityName + "\"");
  } else {
    msg = messages.getMessage(messages.getMainMessagePack(), "optimisticExceptionUnknownObject.message");
  }
  windowManager.showNotification(msg, Frame.NotificationType.ERROR);
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

@Override
  protected void doHandle(String className, String message, @Nullable Throwable throwable, WindowManager windowManager) {
    String msg = null;
    if (throwable != null) {
      FileStorageException storageException = (FileStorageException) throwable;
      String fileName = storageException.getFileName();
      if (storageException.getType().equals(FileStorageException.Type.FILE_NOT_FOUND))
        msg = messages.formatMessage(getClass(), "fileNotFound.message", fileName);
      else if (storageException.getType().equals(FileStorageException.Type.STORAGE_INACCESSIBLE))
        msg = messages.getMessage(getClass(), "fileStorageInaccessible.message");
    }
    if (msg == null) {
      msg = messages.getMessage(getClass(), "fileStorageException.message");
    }
    windowManager.showNotification(msg, Frame.NotificationType.ERROR);
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

protected void doHandle(String message, WindowManager windowManager) {
  String caption = null;
  String notificationMessage = null;
  MetaClass deletedEntityMetaClass = recognizeDeletedEntityMetaClass(message);
  if (deletedEntityMetaClass != null) {
    String customCaptionKey = String.format("deletePolicy.caption.%s", deletedEntityMetaClass.getName());
    String customCaption = messages.getMainMessage(customCaptionKey);
    if (!customCaptionKey.equals(customCaption)) {
      caption = customCaption;
    }
    String customMessageKey = String.format("deletePolicy.references.message.%s", deletedEntityMetaClass.getName());
    String customMessage = messages.getMainMessage(customMessageKey);
    if (!customMessageKey.equals(customMessage)) {
      notificationMessage = customMessage;
    }
  }
  if (StringUtils.isEmpty(caption)) {
    caption = messages.getMainMessage("deletePolicy.caption");
  }
  if (StringUtils.isEmpty(notificationMessage)) {
    MetaClass metaClass = recognizeRelatedEntityMetaClass(message);
    if (metaClass != null) {
      String localizedEntityName = messages.getTools().getEntityCaption(metaClass);
      String referencesMessage = messages.getMainMessage("deletePolicy.references.message");
      notificationMessage = String.format(referencesMessage, localizedEntityName);
    }
  }
  windowManager.showNotification(caption, notificationMessage, Frame.NotificationType.ERROR);
}

代码示例来源:origin: com.haulmont.reports/reports-gui

wm.showNotification(
    messages.getMessage(ReportGuiManager.class, "report.notFoundReports"),
    Frame.NotificationType.HUMANIZED);

代码示例来源:origin: com.haulmont.cuba/cuba-gui

_setValue(UUID.fromString(strValue), valueProperty);
} catch (IllegalArgumentException ie) {
  AppBeans.get(WindowManagerProvider.class).get().showNotification(messages1.getMainMessage("filter.param.uuid.Err"), Frame.NotificationType.TRAY);

代码示例来源:origin: com.haulmont.cuba/cuba-web

@Override
  public void handleAction(com.vaadin.event.Action action, Object sender, Object target) {
    if (initialized) {
      if (saveSettingsAction == action) {
        Screen screen = getFrameOwner();
        UiControllerUtils.saveSettings(screen);
      } else if (restoreToDefaultsAction == action) {
        Screen screen = getFrameOwner();
        UiControllerUtils.deleteSettings(screen);
      } else if (analyzeAction == action) {
        LayoutAnalyzer analyzer = new LayoutAnalyzer();
        List<LayoutTip> tipsList = analyzer.analyze(WebDialogWindow.this);
        if (tipsList.isEmpty()) {
          getWindowManager().showNotification("No layout problems found", Frame.NotificationType.HUMANIZED);
        } else {
          WindowConfig windowConfig = beanLocator.get(WindowConfig.NAME);
          WindowInfo windowInfo = windowConfig.getWindowInfo("layoutAnalyzer");
          getWindowManager().openWindow(windowInfo, WindowManager.OpenType.DIALOG, ParamsMap.of("tipsList", tipsList));
        }
      }
    }
  }
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com