* commit '2bc8c47fe585eed57cf0d8bbd428290e97e8a08e': REPORT-37915 报表分栏弹窗显示未适配国际化 1. 为每种语言都适配了报表分栏弹窗中的示例图片 2. 修改对应国际化文件中代表此示例图片的文件名 CHART-15451 国际化 CHART-15451 增加无匹配的提示 REPORT-35386 多个tab进行撤销,会撤销两个tab CHART-15451 日期判断需要是一种格式 REPORT-38272 && REPORT-38287 && REPORT-37922【frm设计界面支持缩放】参数面板控件如果进行较大的缩放幅度,会遮挡部分 REPORT-37262 远程设计账号密码安全增强 1. 做的是这个迭代任务中的子任务,功能为:密码输入时可显示长度,再次打开时隐藏密码长度,统一显示为8位的加密字符,点击密码输入框做输入或编辑密码动作时,先清空密码,再输入内容,保存后生效 2. 写了一个UIPasswordField的子类,相比UIPasswordField增加了上述功能 3. 将目标场景中的密码框替换为新的UIPasswordFieldWithFixedLength 4. 修改一些导包问题bugfix/10.0
@ -0,0 +1,106 @@
|
||||
package com.fr.design.gui.ipasswordfield; |
||||
|
||||
import com.fr.stable.StringUtils; |
||||
import org.jetbrains.annotations.NotNull; |
||||
|
||||
import javax.swing.text.Document; |
||||
import java.awt.event.KeyAdapter; |
||||
import java.awt.event.KeyEvent; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
/** |
||||
* @author Yvan |
||||
* @version 10.0 |
||||
* Created by Yvan on 2020-08-11 |
||||
* 有固定长度的"*"回显的密码框,避免泄露密码长度 |
||||
*/ |
||||
public class UIPasswordFieldWithFixedLength extends UIPassWordField { |
||||
/** |
||||
* 展示密码,为固定8位长度的特殊字符"*"组成 |
||||
*/ |
||||
private static final String DISPLAY_PASSWORD = "********"; |
||||
|
||||
/** |
||||
* 实际密码 |
||||
*/ |
||||
private String realPassword; |
||||
|
||||
/** |
||||
* 用于判断是否清空密码 |
||||
*/ |
||||
private boolean clearPassword; |
||||
|
||||
public UIPasswordFieldWithFixedLength() { |
||||
this(null, null, 0); |
||||
} |
||||
|
||||
public UIPasswordFieldWithFixedLength(String text) { |
||||
this(null, text, 0); |
||||
} |
||||
|
||||
public UIPasswordFieldWithFixedLength(int columns) { |
||||
this(null, null, columns); |
||||
} |
||||
|
||||
public UIPasswordFieldWithFixedLength(String text, int columns) { |
||||
this(null, text, columns); |
||||
} |
||||
|
||||
public UIPasswordFieldWithFixedLength(Document doc, String txt, int columns) { |
||||
super(doc, txt, columns); |
||||
initRealPassword(txt); |
||||
} |
||||
|
||||
/** |
||||
* 为realPassword赋初值并添加一个鼠标单击事件 |
||||
*/ |
||||
public void initRealPassword(String text) { |
||||
this.realPassword = text == null ? StringUtils.EMPTY : text; |
||||
this.clearPassword = true; |
||||
addShowFixedLengthPasswordListener(); |
||||
} |
||||
|
||||
/** |
||||
* 当鼠标点击密码框,第一次做出键入动作时,清空显示密码与实际密码,用户需要重新输入密码 |
||||
*/ |
||||
private void addShowFixedLengthPasswordListener() { |
||||
this.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
UIPasswordFieldWithFixedLength.this.clearPassword = true; |
||||
} |
||||
}); |
||||
this.addKeyListener(new KeyAdapter() { |
||||
@Override |
||||
public void keyPressed(KeyEvent e) { |
||||
if (clearPassword) { |
||||
UIPasswordFieldWithFixedLength.this.setText(StringUtils.EMPTY); |
||||
UIPasswordFieldWithFixedLength.this.clearPassword = false; |
||||
UIPasswordFieldWithFixedLength.this.updateUI(); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
public void setText(@NotNull String t) { |
||||
this.realPassword = t; |
||||
// 看到代码中有些场景是将密码置为空字符串的,所以在这里加个判断
|
||||
if (StringUtils.isEmpty(t)) { |
||||
super.setText(t); |
||||
} else { |
||||
super.setText(DISPLAY_PASSWORD); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public char[] getPassword() { |
||||
//如果用户刚清空密码框,并输入了新密码,则返回输入内容,否则返回realPassword
|
||||
String text = new String(super.getPassword()); |
||||
if (!StringUtils.isEmpty(text) && StringUtils.isEmpty(realPassword)) { |
||||
return text.toCharArray(); |
||||
} |
||||
return realPassword.toCharArray(); |
||||
} |
||||
} |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 2.7 KiB |