diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java index 7404ed6995..d8692c443d 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java @@ -253,23 +253,17 @@ public class AuthorityListControlPane extends BasicPane { * @param authorities authority */ public void setAuthority(List authorities) { - - if (authorities == null || authorities.isEmpty()) { - return; - } - DefaultListModel model = (DefaultListModel) authorityList.getModel(); model.clear(); - - for (DesignAuthority authority : authorities) { - model.addElement(authority); + if (authorities != null && !authorities.isEmpty()) { + model.clear(); + for (DesignAuthority authority : authorities) { + model.addElement(authority); + } + int size = model.getSize() - 1; + authorityList.setSelectedIndex(size); + authorityList.ensureIndexIsVisible(size); } - - int size = model.getSize() - 1; - - authorityList.setSelectedIndex(size); - authorityList.ensureIndexIsVisible(size); - authorityList.revalidate(); authorityList.repaint(); }