Browse Source

REPORT-10263 远程设计权限验收问题3,4,11

research/10.0
yaoh.wu 6 years ago
parent
commit
c670b04605
  1. 20
      designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java
  2. 13
      designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberListCellRender.java

20
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.AddingMemberList;
import com.fr.design.remote.ui.list.AddingMemberListCellRender; import com.fr.design.remote.ui.list.AddingMemberListCellRender;
import com.fr.design.remote.ui.list.MemberListSelectedChangeListener; import com.fr.design.remote.ui.list.MemberListSelectedChangeListener;
import com.fr.locale.InterProviderFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.ImmutableList; import com.fr.third.guava.collect.ImmutableList;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -95,12 +94,15 @@ public class UserManagerPane extends BasicPane {
* 输入框绑定事件 * 输入框绑定事件
*/ */
private KeyAdapter keyFieldKeyListener = new KeyAdapter() { private KeyAdapter keyFieldKeyListener = new KeyAdapter() {
@Override @Override
public void keyReleased(KeyEvent e) { public void keyPressed(KeyEvent e) {
// 判断按下的键是否是回车键 // 判断按下的键是否是回车键
// 对话框回车键绑定的是对话框的确定按钮,因此按确定没有办法搜索 // 对话框回车键绑定的是对话框的确定按钮
if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (e.getKeyCode() == KeyEvent.VK_ENTER) {
searchAddingMembers(keyWord); searchAddingMembers(keyWord);
// has been processed
e.consume();
} }
} }
}; };
@ -351,8 +353,14 @@ public class UserManagerPane extends BasicPane {
addingMembers.clear(); addingMembers.clear();
String username = WorkContext.getConnector().currentUser(); String username = WorkContext.getConnector().currentUser();
synchronized (addingMembers) { synchronized (addingMembers) {
addingMembers.addAll(WorkContext.getCurrent().get(DecisionOperator.class).getMembers(username, keyword)); Collection<RemoteDesignMember> more = WorkContext.getCurrent().get(DecisionOperator.class).getMembers(username, keyword);
pageNum = 1; pageNum = 1;
if (!more.isEmpty()) {
addingMembers.addAll(more);
if (more.size() >= DEFAULT_NUM_EACH_PAGE) {
addingMembers.add(RemoteDesignMember.DEFAULT_MEMBER);
}
}
} }
return addingMembers; return addingMembers;
} }
@ -372,12 +380,14 @@ public class UserManagerPane extends BasicPane {
protected List<RemoteDesignMember> doInBackground() { protected List<RemoteDesignMember> doInBackground() {
String username = WorkContext.getConnector().currentUser(); String username = WorkContext.getConnector().currentUser();
synchronized (addingMembers) { synchronized (addingMembers) {
addingMembers.remove(RemoteDesignMember.DEFAULT_MEMBER);
Collection<RemoteDesignMember> more = Collection<RemoteDesignMember> more =
WorkContext.getCurrent().get(DecisionOperator.class).getMembers(username, keyword, pageNum + 1, count); WorkContext.getCurrent().get(DecisionOperator.class).getMembers(username, keyword, pageNum + 1, count);
if (!more.isEmpty()) { if (!more.isEmpty()) {
pageNum += 1; pageNum += 1;
}
addingMembers.addAll(more); addingMembers.addAll(more);
addingMembers.add(RemoteDesignMember.DEFAULT_MEMBER);
}
} }
return addingMembers; return addingMembers;
} }

13
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.JList;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import javax.swing.SwingConstants;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
@ -43,10 +44,12 @@ public class AddingMemberListCellRender extends JPanel implements ListCellRender
if (member.equals(RemoteDesignMember.DEFAULT_MEMBER)) { if (member.equals(RemoteDesignMember.DEFAULT_MEMBER)) {
this.setLabelText(member.getUsername()); this.setLabelText(member.getUsername());
check.setVisible(false); check.setVisible(false);
fixLoadingDisplay();
} else { } else {
this.setLabelText(member.getRealName() + "(" + member.getUsername() + ")"); this.setLabelText(member.getRealName() + "(" + member.getUsername() + ")");
check.setVisible(true); check.setVisible(true);
check.setSelected(member.isSelected()); check.setSelected(member.isSelected());
recoveryCommonDisplay();
} }
return this; return this;
} }
@ -54,4 +57,14 @@ public class AddingMemberListCellRender extends JPanel implements ListCellRender
private void setLabelText(String name) { private void setLabelText(String name) {
label.setText(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);
}
} }

Loading…
Cancel
Save