From a7b0f60248ba5b7f8401b7f90e470d10b849f06f Mon Sep 17 00:00:00 2001 From: author Date: Sat, 12 Oct 2019 15:27:56 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-22339=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E7=AE=A1=E7=90=86=E6=9D=83=E9=99=90=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=A4=9A=E4=B8=AA=E8=A7=92=E8=89=B2=EF=BC=8C?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=88=A0=E9=99=A4=E6=97=B6=E4=BC=9A=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E4=BD=86=E6=98=AF=E5=B9=B6=E6=9C=AA=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/remote/ui/AbstractManagerPane.java | 38 +++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/AbstractManagerPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/AbstractManagerPane.java index 10ab1ffd5c..c92a7a8513 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/AbstractManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/AbstractManagerPane.java @@ -67,6 +67,12 @@ public abstract class AbstractManagerPane extends BasicPane { */ private List addedMembers = new ArrayList<>(); + + /** + * 具有设计权限的角色/用户 + */ + private List authorityMembers = new ArrayList<>(); + /** * 决策平台用户列表model */ @@ -211,6 +217,9 @@ public abstract class AbstractManagerPane extends BasicPane { resetAddedMembers(); this.addedMembers.addAll(addedMembers); + resetAuthorityMembers(); + this.authorityMembers.addAll(addedMembers); + // 刷新右侧面板 addToAddedMemberList(); @@ -314,15 +323,15 @@ public abstract class AbstractManagerPane extends BasicPane { private void addToMemberList() { addingListModel.clear(); - for (RemoteDesignMember addingMember : addingMembers) { + for (RemoteDesignMember member : addingMembers) { // 如果包含在右侧列表中,那么左侧列表默认选中 - for (RemoteDesignMember addedMember : addedMembers){ - if (addingMember.equals(addedMember)){ - addingMember.setAuthority(addedMember.hasAuthority()); - addingMember.setSelected(true); - } + if (addedMembers.contains(member)) { + member.setSelected(true); + } + else { + member.setSelected(false); } - addingListModel.addElement(addingMember); + addingListModel.addElement(member); } addingList.revalidate(); addingList.repaint(); @@ -350,6 +359,10 @@ public abstract class AbstractManagerPane extends BasicPane { addedMembers.clear(); } + private void resetAuthorityMembers() { + authorityMembers.clear(); + } + protected abstract Collection getMembers(String userName, String keyWord); protected abstract Collection getMembers(String userName, String keyWord, int pageNum, int count); @@ -376,6 +389,7 @@ public abstract class AbstractManagerPane extends BasicPane { @Override protected void done() { + referAddingMemberList(); addToMemberList(); } }; @@ -403,12 +417,22 @@ public abstract class AbstractManagerPane extends BasicPane { @Override protected void done() { + referAddingMemberList(); addToMemberList(); } }; loadMoreWorker.execute(); } + // 检查左侧列表角色/用户是否有权限 + private void referAddingMemberList() { + for (RemoteDesignMember member : addingMembers) { + if (authorityMembers.contains(member)){ + member.setAuthority(true); + } + } + } + private void sync2AddedMembersFromAdding() { RemoteDesignMember[] members = new RemoteDesignMember[addingListModel.getSize()];