Browse Source
* commit '27fa4a838e893610098d0a050249da188e0ac478': REPORT-6700 国际化 无任务,代码规范 无任务,代码规范 REPORT-6700 部分规范 ui调整 REPORT-8449 交互问题bug修复 REPORT-6700 适配master
superman
7 years ago
16 changed files with 350 additions and 232 deletions
@ -1,72 +0,0 @@ |
|||||||
package com.fr.design.remote; |
|
||||||
|
|
||||||
import com.fr.general.Inter; |
|
||||||
|
|
||||||
public class RemoteMember { |
|
||||||
|
|
||||||
public static final RemoteMember DEFAULT_MEMBER = |
|
||||||
new RemoteMember(Inter.getLocText("FR-Designer_Remote_Design_Loading")); |
|
||||||
|
|
||||||
|
|
||||||
private String username; |
|
||||||
private String realName; |
|
||||||
private String userId; |
|
||||||
|
|
||||||
private boolean selected; |
|
||||||
|
|
||||||
public RemoteMember() { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public RemoteMember(String username) { |
|
||||||
this.username = username; |
|
||||||
} |
|
||||||
|
|
||||||
public RemoteMember username(String username) { |
|
||||||
this.username = username; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public RemoteMember realName(String realName) { |
|
||||||
this.realName = realName; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public RemoteMember userId(String userId) { |
|
||||||
this.userId = userId; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public String getRealName() { |
|
||||||
return realName; |
|
||||||
} |
|
||||||
|
|
||||||
public void setRealName(String realName) { |
|
||||||
this.realName = realName; |
|
||||||
} |
|
||||||
|
|
||||||
public String getUserId() { |
|
||||||
return userId; |
|
||||||
} |
|
||||||
|
|
||||||
public void setUserId(String userId) { |
|
||||||
this.userId = userId; |
|
||||||
} |
|
||||||
|
|
||||||
public String getUsername() { |
|
||||||
return username; |
|
||||||
} |
|
||||||
|
|
||||||
public void setUsername(String username) { |
|
||||||
this.username = username; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public boolean isSelected() { |
|
||||||
return selected; |
|
||||||
} |
|
||||||
|
|
||||||
public void setSelected(boolean selected) { |
|
||||||
this.selected = selected; |
|
||||||
} |
|
||||||
} |
|
@ -1,47 +0,0 @@ |
|||||||
package com.fr.design.remote; |
|
||||||
|
|
||||||
import com.fr.base.FRContext; |
|
||||||
import com.fr.decision.webservice.bean.user.UserAdditionBean; |
|
||||||
import com.fr.decision.webservice.v10.user.UserService; |
|
||||||
|
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.Collection; |
|
||||||
import java.util.List; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
public class Utils { |
|
||||||
|
|
||||||
|
|
||||||
private Utils() { |
|
||||||
} |
|
||||||
|
|
||||||
public static Collection<? extends RemoteMember> getRemoteMember(String keyword) { |
|
||||||
|
|
||||||
List<UserAdditionBean> userBeans = new ArrayList<>(); |
|
||||||
try { |
|
||||||
Map<String, Object> result = |
|
||||||
UserService.getInstance().getAllUsers( |
|
||||||
FRContext.getCurrentEnv().getUser(), |
|
||||||
1, |
|
||||||
10, |
|
||||||
keyword, |
|
||||||
"", |
|
||||||
true); |
|
||||||
userBeans = (List<UserAdditionBean>) result.get("items"); |
|
||||||
} catch (Exception e) { |
|
||||||
FRContext.getLogger().error(e.getMessage()); |
|
||||||
} |
|
||||||
|
|
||||||
List<RemoteMember> res = new ArrayList<>(); |
|
||||||
|
|
||||||
for (UserAdditionBean userBean : userBeans) { |
|
||||||
res.add( |
|
||||||
new RemoteMember() |
|
||||||
.username(userBean.getUsername()) |
|
||||||
.realName(userBean.getRealName()) |
|
||||||
.userId(userBean.getId()) |
|
||||||
); |
|
||||||
} |
|
||||||
return res; |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,59 @@ |
|||||||
|
package com.fr.design.remote.button; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
|
import javax.swing.JButton; |
||||||
|
import javax.swing.JFrame; |
||||||
|
import javax.swing.JPanel; |
||||||
|
import javax.swing.WindowConstants; |
||||||
|
import java.awt.Color; |
||||||
|
import java.awt.GradientPaint; |
||||||
|
import java.awt.Graphics; |
||||||
|
import java.awt.Graphics2D; |
||||||
|
import java.awt.Point; |
||||||
|
|
||||||
|
public final class IconButton extends JButton { |
||||||
|
public IconButton() { |
||||||
|
super(StringUtils.EMPTY); |
||||||
|
setContentAreaFilled(false); |
||||||
|
setFocusPainted(false); |
||||||
|
setIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Remove_x.png")); |
||||||
|
setBorder(null); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void paintBorder(Graphics g) { |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void paintComponent(Graphics g) { |
||||||
|
final Graphics2D g2 = (Graphics2D) g.create(); |
||||||
|
g2.setPaint( |
||||||
|
new GradientPaint( |
||||||
|
new Point(0, 0), |
||||||
|
new Color(0xF5F5F7), |
||||||
|
new Point(0, getPreferredSize().height), |
||||||
|
new Color(0xF5F5F7) |
||||||
|
) |
||||||
|
); |
||||||
|
g2.fillRect(0, 0, getPreferredSize().width, getPreferredSize().height); |
||||||
|
g2.dispose(); |
||||||
|
|
||||||
|
super.paintComponent(g); |
||||||
|
} |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
JFrame jf = new JFrame("test"); |
||||||
|
jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); |
||||||
|
JPanel content = (JPanel) jf.getContentPane(); |
||||||
|
content.setLayout(null); |
||||||
|
IconButton a = new IconButton(); |
||||||
|
a.setBounds(0, 0, a.getPreferredSize().width, a.getPreferredSize().height); |
||||||
|
content.add(a); |
||||||
|
GUICoreUtils.centerWindow(jf); |
||||||
|
jf.setSize(400, 400); |
||||||
|
jf.setVisible(true); |
||||||
|
} |
||||||
|
} |
@ -1,45 +1,44 @@ |
|||||||
package com.fr.design.remote.ui.list; |
package com.fr.design.remote.ui.list; |
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.design.gui.ibutton.UIButton; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.design.remote.RemoteMember; |
import com.fr.design.remote.button.IconButton; |
||||||
|
import com.fr.env.RemoteDesignMember; |
||||||
|
|
||||||
import javax.swing.BorderFactory; |
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 java.awt.Component; |
import java.awt.Component; |
||||||
|
import java.awt.Dimension; |
||||||
import java.awt.FlowLayout; |
import java.awt.FlowLayout; |
||||||
|
|
||||||
public class AddedMemberListCellRender extends JPanel implements ListCellRenderer<RemoteMember> { |
public class AddedMemberListCellRender extends JPanel implements ListCellRenderer<RemoteDesignMember> { |
||||||
|
|
||||||
|
|
||||||
private UILabel label; |
private UILabel label; |
||||||
|
|
||||||
private UIButton uiButton; |
|
||||||
|
|
||||||
public AddedMemberListCellRender() { |
public AddedMemberListCellRender() { |
||||||
this.setBorder(BorderFactory.createEmptyBorder()); |
this.setBorder(BorderFactory.createEmptyBorder()); |
||||||
this.setLayout(new FlowLayout(FlowLayout.LEFT)); |
this.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||||
|
|
||||||
label = new UILabel(); |
label = new UILabel(); |
||||||
label.setIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Member_normal@1x.png")); |
label.setIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Member_normal@1x.png")); |
||||||
|
label.setPreferredSize(new Dimension(270, 20)); |
||||||
uiButton = new UIButton(); |
this.setPreferredSize(new Dimension(this.getPreferredSize().width, 25)); |
||||||
uiButton.setIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Remove_x.png")); |
|
||||||
|
|
||||||
this.add(label); |
this.add(label); |
||||||
this.add(uiButton); |
this.add(new IconButton()); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public Component getListCellRendererComponent(JList<? extends RemoteMember> list, RemoteMember member, int index, boolean isSelected, boolean cellHasFocus) { |
public Component getListCellRendererComponent(JList<? extends RemoteDesignMember> list, RemoteDesignMember member, int index, boolean isSelected, boolean cellHasFocus) { |
||||||
this.setLabelText(member.getUsername()); |
this.setLabelText(member.getRealName() + "(" + member.getUsername() + ")"); |
||||||
return this; |
return this; |
||||||
} |
} |
||||||
|
|
||||||
private void setLabelText(String name) { |
private void setLabelText(String name) { |
||||||
label.setText(name); |
label.setText(name); |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
Loading…
Reference in new issue