Fixed UnsupportedOperationException related to TabInfo annotation

This commit is contained in:
Risto Lahtela 2021-04-25 15:21:34 +03:00
parent bb78e41c84
commit d7db05e344

View File

@ -24,7 +24,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.TextStringBuilder; import org.apache.commons.text.TextStringBuilder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
@ -44,11 +44,19 @@ public class TabInformation {
this( this(
tabName, tabName,
icon, icon,
elementOrder == null ? new ArrayList<>() : Arrays.asList(elementOrder), createElementOrderList(elementOrder),
tabPriority tabPriority
); );
} }
private static List<ElementOrder> createElementOrderList(ElementOrder[] elementOrder) {
List<ElementOrder> list = new ArrayList<>();
if (elementOrder != null) {
Collections.addAll(list, elementOrder);
}
return list;
}
public TabInformation(String tabName, Icon icon, List<ElementOrder> elementOrder, int tabPriority) { public TabInformation(String tabName, Icon icon, List<ElementOrder> elementOrder, int tabPriority) {
this.tabName = tabName; this.tabName = tabName;
this.icon = icon; this.icon = icon;