@ -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 |
@ -0,0 +1,69 @@
|
||||
package com.fr.design.chartx.data; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JComponent; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.SwingConstants; |
||||
import java.awt.Component; |
||||
import java.util.Arrays; |
||||
|
||||
/** |
||||
* @author shine |
||||
* @version 10.0 |
||||
* Created by shine on 2020/7/22 |
||||
*/ |
||||
public class DataLayoutHelper { |
||||
|
||||
public static int WIDTH = 150; |
||||
public static int LABEL_HEIGHT = 20; |
||||
public static int LABEL_WIDTH = 65; |
||||
|
||||
public static int LEFT_GAP = 15; |
||||
public static int RIGHT_GAP = 10; |
||||
|
||||
public static void setWIDTH(int WIDTH) { |
||||
DataLayoutHelper.WIDTH = WIDTH; |
||||
} |
||||
|
||||
public static void setLabelHeight(int labelHeight) { |
||||
LABEL_HEIGHT = labelHeight; |
||||
} |
||||
|
||||
public static void setLabelWidth(int labelWidth) { |
||||
LABEL_WIDTH = labelWidth; |
||||
} |
||||
|
||||
public static void setLeftGap(int leftGap) { |
||||
LEFT_GAP = leftGap; |
||||
} |
||||
|
||||
public static void setRightGap(int rightGap) { |
||||
RIGHT_GAP = rightGap; |
||||
} |
||||
|
||||
public static JPanel createDataLayoutPane(Component[][] components) { |
||||
int len = components.length; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] columnSize = {DataLayoutHelper.LABEL_WIDTH, DataLayoutHelper.WIDTH}; |
||||
double[] rowSize = new double[len]; |
||||
Arrays.fill(rowSize, p); |
||||
|
||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||
} |
||||
|
||||
public static JPanel createDataLayoutPane(String label, Component component) { |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(label, SwingConstants.LEFT), component} |
||||
}; |
||||
|
||||
return createDataLayoutPane(components); |
||||
} |
||||
|
||||
public static void addNormalBorder(JComponent component) { |
||||
component.setBorder(BorderFactory.createEmptyBorder(0, DataLayoutHelper.LEFT_GAP, 0, DataLayoutHelper.RIGHT_GAP)); |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.van.chart.map.line; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.chart.base.AttrTooltip; |
||||
import com.fr.van.chart.designer.style.VanChartStylePane; |
||||
|
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-08-20 |
||||
*/ |
||||
public class VanChartLineMapPlotTooltipNoCheckPane extends VanChartLineMapPlotTooltipPane { |
||||
|
||||
public VanChartLineMapPlotTooltipNoCheckPane(Plot plot, VanChartStylePane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
protected void addComponents(Plot plot) { |
||||
isTooltipShow = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Use_Tooltip")); |
||||
tooltipPane = createTooltipPane(plot); |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
this.add(tooltipPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public void populate(AttrTooltip attr) { |
||||
super.populate(attr); |
||||
isTooltipShow.setSelected(true); |
||||
tooltipPane.setEnabled(isTooltipShow.isSelected()); |
||||
} |
||||
} |
@ -0,0 +1,203 @@
|
||||
package com.fr.design.widget.ui.designer.mobile.component; |
||||
|
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.designer.beans.events.DesignerEvent; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.ibutton.ModeButtonGroup; |
||||
import com.fr.design.gui.ibutton.UIRadioButton; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.WidgetPropertyPane; |
||||
import com.fr.design.style.color.NewColorSelectBox; |
||||
import com.fr.general.cardtag.mobile.MobileTemplateStyle; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.JComponent; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Color; |
||||
import java.awt.Component; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
public class MobileTabCommonSettingPane extends BasicPane { |
||||
|
||||
private UICheckBox showTabTitleCheck; |
||||
private UICheckBox tabSlideCheck; |
||||
private UICheckBox showTabDotIndicatorCheck; |
||||
private ModeButtonGroup<Integer> buttonGroup; |
||||
private NewColorSelectBox initDotColorBox; |
||||
private NewColorSelectBox selectDotColorBox; |
||||
|
||||
public MobileTabCommonSettingPane() { |
||||
initComponent(); |
||||
} |
||||
|
||||
private void initComponent() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
this.showTabTitleCheck = new UICheckBox( |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Show_Title"), true) { |
||||
@Override |
||||
protected void initListener() { |
||||
this.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
attributeChange(); |
||||
} |
||||
}); |
||||
} |
||||
}; |
||||
this.tabSlideCheck = new UICheckBox( |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Slide"), true) { |
||||
@Override |
||||
protected void initListener() { |
||||
this.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
attributeChange(); |
||||
} |
||||
}); |
||||
} |
||||
}; |
||||
this.showTabDotIndicatorCheck = new UICheckBox( |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Show_Indicator"), true) { |
||||
@Override |
||||
protected void initListener() { |
||||
this.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
attributeChange(); |
||||
} |
||||
}); |
||||
} |
||||
}; |
||||
|
||||
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Show_Indicator_type")); |
||||
JPanel dotIndicatorShowTypePane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
||||
addIndicatorShowTypeButton(dotIndicatorShowTypePane); |
||||
|
||||
UILabel initColorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Init_Fill")); |
||||
UILabel selectColor = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Fill")); |
||||
initDotColorBox = new NewColorSelectBox(0){ |
||||
@Override |
||||
protected void iniListener() { |
||||
} |
||||
|
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
super.mouseClicked(e); |
||||
this.attributeChange(); |
||||
} |
||||
}; |
||||
selectDotColorBox = new NewColorSelectBox(0){ |
||||
@Override |
||||
protected void iniListener() { |
||||
} |
||||
|
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
super.mouseClicked(e); |
||||
this.attributeChange(); |
||||
} |
||||
}; |
||||
JPanel initDotColorPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initColorLabel, initDotColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
JPanel selectDotColorPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectColor, selectDotColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
|
||||
double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; |
||||
double[] columnSize = {TableLayout.FILL}; |
||||
int[][] rowCount = {{1}, {1}, {1}}; |
||||
double[] verticalGaps = {10, 10, 10}; |
||||
double[] dotSettingColumnSize = {TableLayout.PREFERRED, TableLayout.FILL}; |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{this.showTabTitleCheck}, |
||||
new Component[]{this.tabSlideCheck}, |
||||
new Component[]{this.showTabDotIndicatorCheck} |
||||
}; |
||||
|
||||
JPanel tabBaseConfigPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, |
||||
IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); |
||||
tabBaseConfigPane.setBorder(BorderFactory.createEmptyBorder(0, 0, IntervalConstants.INTERVAL_L1, 0)); |
||||
|
||||
JPanel dotIndicatorSettingPanel = TableLayoutHelper.createDiffVGapTableLayoutPane(new JComponent[][]{ |
||||
{label, dotIndicatorShowTypePane}, |
||||
{initColorLabel, initDotColorPane}, |
||||
{selectColor, selectDotColorPane}}, rowSize, dotSettingColumnSize, 0, verticalGaps); |
||||
dotIndicatorSettingPanel.setBorder( |
||||
BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1, 0) |
||||
); |
||||
|
||||
final JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
jPanel.add(tabBaseConfigPane, BorderLayout.NORTH); |
||||
jPanel.add(dotIndicatorSettingPanel, BorderLayout.CENTER); |
||||
|
||||
this.add(jPanel, BorderLayout.CENTER); |
||||
|
||||
showTabDotIndicatorCheck.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
dotIndicatorSettingPanel.setVisible(showTabDotIndicatorCheck.isSelected()); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public void populate(MobileTemplateStyle mobileTemplateStyle) { |
||||
this.showTabTitleCheck.setSelected(mobileTemplateStyle.isShowTabTitle()); |
||||
this.showTabDotIndicatorCheck.setSelected(mobileTemplateStyle.isShowDotIndicator()); |
||||
this.tabSlideCheck.setSelected(mobileTemplateStyle.canSlide()); |
||||
Color initDotColor = mobileTemplateStyle.getIndicatorInitialColor(); |
||||
Color selectDotColor = mobileTemplateStyle.getIndicatorSelectColor(); |
||||
int dotIndicatorShowType = mobileTemplateStyle.getDotIndicatorShowType(); |
||||
this.populateColorBox(initDotColorBox, initDotColor, MobileTemplateStyle.DEFAULT_INITIAL_DOT_COLOR); |
||||
this.populateColorBox(selectDotColorBox, selectDotColor, MobileTemplateStyle.DEFAULT_SELECT_DOT_COLOR); |
||||
if (dotIndicatorShowType != buttonGroup.getCurrentSelected()) { |
||||
this.buttonGroup.setSelectButton(dotIndicatorShowType); |
||||
} |
||||
} |
||||
|
||||
public void update(MobileTemplateStyle mobileTemplateStyle) { |
||||
mobileTemplateStyle.setShowTabTitle(showTabTitleCheck.isSelected()); |
||||
mobileTemplateStyle.setShowDotIndicator(showTabDotIndicatorCheck.isSelected()); |
||||
mobileTemplateStyle.setCanSlide(tabSlideCheck.isSelected()); |
||||
mobileTemplateStyle.setIndicatorInitialColor(initDotColorBox.getSelectObject()); |
||||
mobileTemplateStyle.setIndicatorSelectColor(selectDotColorBox.getSelectObject()); |
||||
mobileTemplateStyle.setDotIndicatorShowType(buttonGroup.getCurrentSelected()); |
||||
WidgetPropertyPane.getInstance().getEditingFormDesigner().getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "MobileTabCommonSettingPane"; |
||||
} |
||||
|
||||
private void addIndicatorShowTypeButton(JPanel dotIndicatorShowTypePane) { |
||||
UIRadioButton holderPlaceButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Tab_Holder_Place")); |
||||
holderPlaceButton.setSelected(true); |
||||
UIRadioButton floatButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Float")); |
||||
dotIndicatorShowTypePane.add(holderPlaceButton); |
||||
dotIndicatorShowTypePane.add(floatButton); |
||||
dotIndicatorShowTypePane.setBorder( |
||||
BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L1, 0, 0) |
||||
); |
||||
buttonGroup = new ModeButtonGroup<>(); |
||||
buttonGroup.put(MobileTemplateStyle.TYPE_PLACEHOLDER_DOT_INDICATOR, holderPlaceButton); |
||||
buttonGroup.put(MobileTemplateStyle.TYPE_FLOAT_DOT_INDICATOR, floatButton); |
||||
} |
||||
|
||||
private void populateColorBox(NewColorSelectBox colorBox, Color color, Color defaultColor) { |
||||
if (color == null) { |
||||
color = defaultColor; |
||||
} |
||||
if (color != colorBox.getSelectObject()) { |
||||
colorBox.setSelectObject(color); |
||||
} |
||||
} |
||||
} |