mengao
7 years ago
36 changed files with 513 additions and 328 deletions
@ -0,0 +1,41 @@
|
||||
package com.fr.quickeditor.cellquick; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* 单元格元素面板的滚动条 |
||||
* |
||||
* @see com.fr.design.mainframe.AbstractAttrPane.BarLayout |
||||
*/ |
||||
public abstract class CellElementBarLayout implements LayoutManager { |
||||
|
||||
private JPanel leftContentPane; |
||||
|
||||
protected CellElementBarLayout(JPanel leftContentPane) { |
||||
this.leftContentPane = leftContentPane; |
||||
} |
||||
|
||||
@Override |
||||
public void addLayoutComponent(String name, Component comp) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void removeLayoutComponent(Component comp) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public Dimension preferredLayoutSize(Container parent) { |
||||
return leftContentPane.getPreferredSize(); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension minimumLayoutSize(Container parent) { |
||||
return leftContentPane.getMinimumSize(); |
||||
} |
||||
|
||||
@Override |
||||
public abstract void layoutContainer(Container parent); |
||||
} |
@ -0,0 +1,108 @@
|
||||
package com.fr.design.gui.frpane; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.form.ui.TextEditor; |
||||
import com.fr.form.ui.reg.NoneReg; |
||||
import com.fr.form.ui.reg.RegExp; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.DocumentEvent; |
||||
import javax.swing.event.DocumentListener; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Created by kerry on 2017/9/4. |
||||
*/ |
||||
public class RegFieldPane extends RegPane { |
||||
protected RegErrorMsgPane regErrorMsgPane; |
||||
|
||||
public RegFieldPane(){ |
||||
this(ALL_REG_TYPE); |
||||
} |
||||
|
||||
public RegFieldPane(RegExp[] types) { |
||||
super(types); |
||||
initComponents(); |
||||
} |
||||
|
||||
public void initComponents() { |
||||
regErrorMsgPane = new RegErrorMsgPane(); |
||||
final RegChangeListener regChangeListener = new RegChangeListener() { |
||||
|
||||
@Override |
||||
public void regChangeAction() { |
||||
RegExp regExp = (RegExp)getRegComboBox().getSelectedItem(); |
||||
if(regExp instanceof NoneReg){ |
||||
regErrorMsgPane.setVisible(false); |
||||
return; |
||||
} |
||||
regErrorMsgPane.setVisible(true); |
||||
} |
||||
}; |
||||
this.addRegChangeListener(regChangeListener); |
||||
this.add(regErrorMsgPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "RegFieldPane"; |
||||
} |
||||
|
||||
public void populate(TextEditor textEditor) { |
||||
populate(textEditor.getRegex()); |
||||
regErrorMsgPane.populate(textEditor); |
||||
} |
||||
|
||||
public void update(TextEditor textEditor) { |
||||
textEditor.setRegex(update()); |
||||
regErrorMsgPane.update(textEditor); |
||||
} |
||||
|
||||
private static class RegErrorMsgPane extends BasicPane { |
||||
private UITextField regErrorMsgField; |
||||
|
||||
public RegErrorMsgPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); |
||||
initRegErrorMsgField(); |
||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Error_Tip")), regErrorMsgField}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7); |
||||
this.add(panel); |
||||
} |
||||
|
||||
private void initRegErrorMsgField() { |
||||
regErrorMsgField = new UITextField(); |
||||
regErrorMsgField.getDocument().addDocumentListener(new DocumentListener() { |
||||
public void changedUpdate(DocumentEvent e) { |
||||
regErrorMsgField.setToolTipText(regErrorMsgField.getText()); |
||||
} |
||||
|
||||
public void insertUpdate(DocumentEvent e) { |
||||
regErrorMsgField.setToolTipText(regErrorMsgField.getText()); |
||||
} |
||||
|
||||
public void removeUpdate(DocumentEvent e) { |
||||
regErrorMsgField.setToolTipText(regErrorMsgField.getText()); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "RegErrorMsg"; |
||||
} |
||||
|
||||
public void populate(TextEditor textEditor) { |
||||
regErrorMsgField.setText(textEditor.getRegErrorMessage()); |
||||
} |
||||
|
||||
public void update(TextEditor textEditor) { |
||||
textEditor.setRegErrorMessage(regErrorMsgField.getText()); |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue