|
|
@ -22,125 +22,107 @@ import java.awt.event.KeyAdapter; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
|
|
|
|
|
|
|
|
public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> { |
|
|
|
public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> { |
|
|
|
protected RegPane regPane; |
|
|
|
protected RegPane regPane; |
|
|
|
private WaterMarkDictPane waterMarkDictPane; |
|
|
|
private WaterMarkDictPane waterMarkDictPane; |
|
|
|
private UITextField regErrorMsgTextField; |
|
|
|
|
|
|
|
|
|
|
|
public TextFieldEditorDefinePane() { |
|
|
|
public TextFieldEditorDefinePane() { |
|
|
|
this.initComponents(); |
|
|
|
this.initComponents(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected JPanel setFirstContentPane() { |
|
|
|
protected JPanel setFirstContentPane() { |
|
|
|
JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); |
|
|
|
attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); |
|
|
|
JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
contenter.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); |
|
|
|
contenter.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); |
|
|
|
attrPane.add(contenter); |
|
|
|
attrPane.add(contenter); |
|
|
|
regPane = createRegPane(); |
|
|
|
JPanel regErrorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
|
|
|
final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() { |
|
|
|
regErrorMsgTextField = new UITextField(16); |
|
|
|
|
|
|
|
regErrorMsgPane.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),regErrorMsgTextField}, FlowLayout.LEFT,24)); |
|
|
|
@Override |
|
|
|
|
|
|
|
public void regChangeAction() { |
|
|
|
regErrorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { |
|
|
|
waterMarkDictPane.setWaterMark(""); |
|
|
|
|
|
|
|
regPane.removeRegChangeListener(this); |
|
|
|
public void changedUpdate(DocumentEvent e) { |
|
|
|
} |
|
|
|
regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); |
|
|
|
}; |
|
|
|
} |
|
|
|
final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() { |
|
|
|
|
|
|
|
public void phoneRegChangeAction(RegPane.PhoneRegEvent e) { |
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
if (StringUtils.isNotEmpty(e.getPhoneRegString()) |
|
|
|
regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); |
|
|
|
&& StringUtils.isEmpty(waterMarkDictPane.getWaterMark())) { |
|
|
|
} |
|
|
|
waterMarkDictPane.setWaterMark(Inter.getLocText("Example") + ":" + e.getPhoneRegString()); |
|
|
|
|
|
|
|
regPane.addRegChangeListener(rl); |
|
|
|
public void removeUpdate(DocumentEvent e) { |
|
|
|
} |
|
|
|
regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}); |
|
|
|
regPane.addPhoneRegListener(pl); |
|
|
|
regPane = createRegPane(); |
|
|
|
JPanel basicPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); |
|
|
|
final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() { |
|
|
|
JPanel validateContent = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
|
|
|
|
|
|
|
getAllowBlankCheckBox().setPreferredSize(new Dimension(444, 40)); |
|
|
|
@Override |
|
|
|
validateContent.add(GUICoreUtils.createFlowPane(getAllowBlankCheckBox(), FlowLayout.LEFT)); |
|
|
|
public void regChangeAction() { |
|
|
|
validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getErrorMsgTextField()}, FlowLayout.LEFT, 24)); |
|
|
|
waterMarkDictPane.setWaterMark(""); |
|
|
|
validateContent.add(GUICoreUtils.createFlowPane(regPane, FlowLayout.LEFT)); |
|
|
|
regPane.removeRegChangeListener(this); |
|
|
|
validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getRegErrorMsgTextField()}, FlowLayout.LEFT, 24)); |
|
|
|
} |
|
|
|
basicPane.add(validateContent); |
|
|
|
}; |
|
|
|
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); |
|
|
|
final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() { |
|
|
|
waterMarkDictPane = new WaterMarkDictPane(); |
|
|
|
public void phoneRegChangeAction(RegPane.PhoneRegEvent e) { |
|
|
|
waterMarkDictPane.addInputKeyListener(new KeyAdapter() { |
|
|
|
if (StringUtils.isNotEmpty(e.getPhoneRegString()) |
|
|
|
public void keyTyped(KeyEvent e) { |
|
|
|
&& StringUtils.isEmpty(waterMarkDictPane.getWaterMark())) { |
|
|
|
regPane.removePhoneRegListener(pl); |
|
|
|
waterMarkDictPane.setWaterMark(Inter.getLocText("Example") + ":" + e.getPhoneRegString()); |
|
|
|
regPane.removeRegChangeListener(rl); |
|
|
|
regPane.addRegChangeListener(rl); |
|
|
|
waterMarkDictPane.removeInputKeyListener(this); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
//监听填写规则下拉框的值的变化
|
|
|
|
regPane.addPhoneRegListener(pl); |
|
|
|
regPane.getRegComboBox().addActionListener(new ActionListener() { |
|
|
|
JPanel basicPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
JPanel validateContent = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
|
|
|
RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem(); |
|
|
|
getAllowBlankCheckBox().setPreferredSize(new Dimension(444,40)); |
|
|
|
if (!StringUtils.isNotEmpty(regExp.toRegText())) { |
|
|
|
validateContent.add(GUICoreUtils.createFlowPane(getAllowBlankCheckBox(), FlowLayout.LEFT)); |
|
|
|
getRegErrorMsgTextField().setEnabled(false); |
|
|
|
validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),getErrorMsgTextField()}, FlowLayout.LEFT,24)); |
|
|
|
} else { |
|
|
|
validateContent.add(GUICoreUtils.createFlowPane(regPane, FlowLayout.LEFT)); |
|
|
|
getRegErrorMsgTextField().setEnabled(true); |
|
|
|
validateContent.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"),regErrorMsgTextField}, FlowLayout.LEFT,24)); |
|
|
|
} |
|
|
|
basicPane.add(validateContent); |
|
|
|
|
|
|
|
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); |
|
|
|
} |
|
|
|
waterMarkDictPane = new WaterMarkDictPane(); |
|
|
|
}); |
|
|
|
waterMarkDictPane.addInputKeyListener(new KeyAdapter() { |
|
|
|
advancedPane.add(waterMarkDictPane); |
|
|
|
public void keyTyped(KeyEvent e) { |
|
|
|
contenter.add(advancedPane, BorderLayout.NORTH); |
|
|
|
regPane.removePhoneRegListener(pl); |
|
|
|
contenter.add(basicPane, BorderLayout.CENTER); |
|
|
|
regPane.removeRegChangeListener(rl); |
|
|
|
return attrPane; |
|
|
|
waterMarkDictPane.removeInputKeyListener(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
protected RegPane createRegPane() { |
|
|
|
//监听填写规则下拉框的值的变化
|
|
|
|
return new RegPane(); |
|
|
|
regPane.getRegComboBox().addActionListener(new ActionListener(){ |
|
|
|
} |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
RegExp regExp = (RegExp)regPane.getRegComboBox().getSelectedItem(); |
|
|
|
@Override |
|
|
|
if(regExp instanceof NoneReg){ |
|
|
|
protected String title4PopupWindow() { |
|
|
|
regErrorMsgTextField.setEnabled(false); |
|
|
|
return "text"; |
|
|
|
}else{ |
|
|
|
} |
|
|
|
regErrorMsgTextField.setEnabled(true); |
|
|
|
|
|
|
|
} |
|
|
|
@Override |
|
|
|
|
|
|
|
protected void populateSubFieldEditorBean(TextEditor e) { |
|
|
|
} |
|
|
|
this.regPane.populate(e.getRegex()); |
|
|
|
}); |
|
|
|
getRegErrorMsgTextField().setText(e.getRegErrorMessage()); |
|
|
|
advancedPane.add(waterMarkDictPane); |
|
|
|
waterMarkDictPane.populate(e); |
|
|
|
contenter.add(advancedPane, BorderLayout.NORTH); |
|
|
|
} |
|
|
|
contenter.add(basicPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
return attrPane; |
|
|
|
@Override |
|
|
|
} |
|
|
|
protected TextEditor updateSubFieldEditorBean() { |
|
|
|
|
|
|
|
TextEditor ob = newTextEditorInstance(); |
|
|
|
protected RegPane createRegPane() { |
|
|
|
ob.setRegErrorMessage(this.getRegErrorMsgTextField().getText()); |
|
|
|
return new RegPane(); |
|
|
|
ob.setRegex(this.regPane.update()); |
|
|
|
} |
|
|
|
waterMarkDictPane.update(ob); |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
return ob; |
|
|
|
protected String title4PopupWindow() { |
|
|
|
} |
|
|
|
return "text"; |
|
|
|
|
|
|
|
} |
|
|
|
protected TextEditor newTextEditorInstance() { |
|
|
|
|
|
|
|
return new TextEditor(); |
|
|
|
@Override |
|
|
|
} |
|
|
|
protected void populateSubFieldEditorBean(TextEditor e) { |
|
|
|
|
|
|
|
this.regPane.populate(e.getRegex()); |
|
|
|
@Override |
|
|
|
regErrorMsgTextField.setText(e.getRegErrorMessage()); |
|
|
|
public void addAllowBlankPane(UICheckBox allowBlankCheckBox, JPanel errorMsgPane) { |
|
|
|
waterMarkDictPane.populate(e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
} |
|
|
|
protected TextEditor updateSubFieldEditorBean() { |
|
|
|
|
|
|
|
TextEditor ob = newTextEditorInstance(); |
|
|
|
|
|
|
|
ob.setRegErrorMessage(this.regErrorMsgTextField.getText()); |
|
|
|
|
|
|
|
ob.setRegex(this.regPane.update()); |
|
|
|
|
|
|
|
waterMarkDictPane.update(ob); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ob; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected TextEditor newTextEditorInstance() { |
|
|
|
|
|
|
|
return new TextEditor(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void addAllowBlankPane(UICheckBox allowBlankCheckBox, JPanel errorMsgPane){} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|