use of com.vaadin.ui.AbstractComponent in project cuba by cuba-platform.
the class AppLog method log.
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public void log(ErrorEvent event) {
Throwable t = event.getThrowable();
if (t instanceof SilentException)
return;
if (t instanceof Validator.InvalidValueException)
return;
if (t instanceof SocketException || ExceptionUtils.getRootCause(t) instanceof SocketException) {
// Most likely client browser closed socket
LogItem item = new LogItem(LogLevel.WARNING, "SocketException in CommunicationManager. Most likely client (browser) closed socket.", null);
log(item);
return;
}
// Support Tomcat 8 ClientAbortException
if (StringUtils.contains(ExceptionUtils.getMessage(t), "ClientAbortException")) {
// Most likely client browser closed socket
LogItem item = new LogItem(LogLevel.WARNING, "ClientAbortException on write response to client. Most likely client (browser) closed socket.", null);
log(item);
return;
}
Throwable rootCause = ExceptionUtils.getRootCause(t);
if (rootCause == null)
rootCause = t;
Logging annotation = rootCause.getClass().getAnnotation(Logging.class);
Logging.Type loggingType = annotation == null ? Logging.Type.FULL : annotation.value();
if (loggingType == Logging.Type.NONE)
return;
// Finds the original source of the error/exception
AbstractComponent component = DefaultErrorHandler.findAbstractComponent(event);
StringBuilder msg = new StringBuilder();
msg.append("Exception");
if (component != null)
msg.append(" in ").append(component.getClass().getName());
msg.append(": ");
if (loggingType == Logging.Type.BRIEF) {
error(msg + rootCause.toString());
} else {
LogItem item = new LogItem(LogLevel.ERROR, msg.toString(), t);
log(item);
}
}
use of com.vaadin.ui.AbstractComponent in project cuba by cuba-platform.
the class MenuBuilder method assignShortcut.
protected void assignShortcut(Window webWindow, AppMenu.MenuItem menuItem, MenuItem item) {
KeyCombination itemShortcut = item.getShortcut();
if (itemShortcut != null) {
ShortcutListener shortcut = new MenuShortcutAction(menuItem, "shortcut_" + item.getId(), item.getShortcut());
AbstractComponent windowImpl = webWindow.unwrap(AbstractComponent.class);
windowImpl.addShortcutListener(shortcut);
appMenu.setMenuItemShortcutCaption(menuItem, itemShortcut.format());
}
}
use of com.vaadin.ui.AbstractComponent in project cuba by cuba-platform.
the class SideMenuBuilder method assignShortcut.
protected void assignShortcut(Window webWindow, SideMenu.MenuItem menuItem, MenuItem item) {
KeyCombination itemShortcut = item.getShortcut();
if (itemShortcut != null) {
ShortcutListener shortcut = new SideMenuShortcutListener(menuItem, item);
AbstractComponent windowImpl = webWindow.unwrap(AbstractComponent.class);
windowImpl.addShortcutListener(shortcut);
if (Strings.isNullOrEmpty(menuItem.getBadgeText())) {
menuItem.setDescription(itemShortcut.format());
}
}
}
use of com.vaadin.ui.AbstractComponent in project linkki by linkki-framework.
the class LabelComponentWrapper method setValidationMessages.
@Override
public void setValidationMessages(MessageList messagesForProperty) {
if (component instanceof AbstractComponent) {
AbstractComponent field = (AbstractComponent) component;
field.setComponentError(getErrorHandler(messagesForProperty));
}
}
Aggregations