Fix some code smells

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-08-16 13:20:07 +02:00
parent aa5e4d0601
commit e65849b922
3 changed files with 23 additions and 6 deletions

View File

@@ -518,7 +518,6 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
* Set style of target table.
*
*/
@SuppressWarnings("serial")
private void styleTargetTable() {
setCellStyleGenerator((source, itemId, propertyId) -> null);
}
@@ -559,7 +558,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
final String targTagName = HawkbitCommonUtil.removePrefix(event.getTransferable().getSourceComponent().getId(),
SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
if (targetList.isEmpty()) {
final String actionDidNotWork = i18n.get("message.action.did.not.work", new Object[] {});
final String actionDidNotWork = i18n.get("message.action.did.not.work");
notification.displayValidationError(actionDidNotWork);
return;
}

View File

@@ -66,6 +66,25 @@ public class I18N implements Serializable {
* @see #getLocale()
*/
public String get(final String code, final Object... args) {
return getMessage(code, args);
}
/**
* Tries to resolve the message.
*
* @param code
* the code to lookup up.
*
* @return the resolved message, or the message code if the lookup fails.
*
* @see MessageSource#getMessage(String, Object[], Locale)
* @see #getLocale()
*/
public String get(final String code) {
return getMessage(code, null);
}
private String getMessage(final String code, final Object[] args) {
try {
return source.getMessage(code, args, getLocale());
} catch (final NoSuchMessageException ex) {