From c670b046054f3ab2afd513ea0b9f42f192f0423b Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Fri, 3 Aug 2018 12:21:26 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-10263=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E6=9D=83=E9=99=90=E9=AA=8C=E6=94=B6=E9=97=AE=E9=A2=98?= =?UTF-8?q?3,4,11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/remote/ui/UserManagerPane.java | 20 ++++++++++++++----- .../ui/list/AddingMemberListCellRender.java | 13 ++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java index b201abc559..d78e0b0609 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java @@ -14,7 +14,6 @@ import com.fr.design.remote.ui.list.AddedMemberListCellRender; import com.fr.design.remote.ui.list.AddingMemberList; import com.fr.design.remote.ui.list.AddingMemberListCellRender; import com.fr.design.remote.ui.list.MemberListSelectedChangeListener; -import com.fr.locale.InterProviderFactory; import com.fr.stable.StringUtils; import com.fr.third.guava.collect.ImmutableList; import com.fr.workspace.WorkContext; @@ -95,12 +94,15 @@ public class UserManagerPane extends BasicPane { * 输入框绑定事件 */ private KeyAdapter keyFieldKeyListener = new KeyAdapter() { + @Override - public void keyReleased(KeyEvent e) { + public void keyPressed(KeyEvent e) { // 判断按下的键是否是回车键 - // 对话框回车键绑定的是对话框的确定按钮,因此按确定没有办法搜索 + // 对话框回车键绑定的是对话框的确定按钮 if (e.getKeyCode() == KeyEvent.VK_ENTER) { searchAddingMembers(keyWord); + // has been processed + e.consume(); } } }; @@ -351,8 +353,14 @@ public class UserManagerPane extends BasicPane { addingMembers.clear(); String username = WorkContext.getConnector().currentUser(); synchronized (addingMembers) { - addingMembers.addAll(WorkContext.getCurrent().get(DecisionOperator.class).getMembers(username, keyword)); + Collection more = WorkContext.getCurrent().get(DecisionOperator.class).getMembers(username, keyword); pageNum = 1; + if (!more.isEmpty()) { + addingMembers.addAll(more); + if (more.size() >= DEFAULT_NUM_EACH_PAGE) { + addingMembers.add(RemoteDesignMember.DEFAULT_MEMBER); + } + } } return addingMembers; } @@ -372,12 +380,14 @@ public class UserManagerPane extends BasicPane { protected List doInBackground() { String username = WorkContext.getConnector().currentUser(); synchronized (addingMembers) { + addingMembers.remove(RemoteDesignMember.DEFAULT_MEMBER); Collection more = WorkContext.getCurrent().get(DecisionOperator.class).getMembers(username, keyword, pageNum + 1, count); if (!more.isEmpty()) { pageNum += 1; + addingMembers.addAll(more); + addingMembers.add(RemoteDesignMember.DEFAULT_MEMBER); } - addingMembers.addAll(more); } return addingMembers; } diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberListCellRender.java b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberListCellRender.java index cccdf7d3f0..b2ca3f812e 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberListCellRender.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberListCellRender.java @@ -9,6 +9,7 @@ import javax.swing.BorderFactory; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.ListCellRenderer; +import javax.swing.SwingConstants; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; @@ -43,10 +44,12 @@ public class AddingMemberListCellRender extends JPanel implements ListCellRender if (member.equals(RemoteDesignMember.DEFAULT_MEMBER)) { this.setLabelText(member.getUsername()); check.setVisible(false); + fixLoadingDisplay(); } else { this.setLabelText(member.getRealName() + "(" + member.getUsername() + ")"); check.setVisible(true); check.setSelected(member.isSelected()); + recoveryCommonDisplay(); } return this; } @@ -54,4 +57,14 @@ public class AddingMemberListCellRender extends JPanel implements ListCellRender private void setLabelText(String name) { label.setText(name); } + + private void fixLoadingDisplay() { + label.setIcon(null); + label.setHorizontalAlignment(SwingConstants.CENTER); + } + + private void recoveryCommonDisplay() { + label.setIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Member_normal@1x.png")); + label.setHorizontalAlignment(SwingConstants.LEFT); + } }