forked from fanruan/design
88 changed files with 2282 additions and 847 deletions
@ -0,0 +1,130 @@ |
|||||||
|
package com.fr.design.report.mobile; |
||||||
|
|
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.border.UITitledBorder; |
||||||
|
import com.fr.design.gui.ibutton.UIRadioButton; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.report.mobile.ElementCaseMobileAttr; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kunsnat on 2016/8/3. |
||||||
|
*/ |
||||||
|
public class MobileUseHtmlGroupPane extends BasicBeanPane<ElementCaseMobileAttr> { |
||||||
|
|
||||||
|
private List<UIRadioButton> radioButtons = new ArrayList<UIRadioButton>(); |
||||||
|
|
||||||
|
public MobileUseHtmlGroupPane() { |
||||||
|
initComponents(); |
||||||
|
} |
||||||
|
|
||||||
|
private void initComponents() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
this.setBorder(UITitledBorder.createBorderWithTitle(this.title4PopupWindow())); |
||||||
|
|
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double[] rowSize = {p, p}; |
||||||
|
double[] columnSize = {p, p, p}; |
||||||
|
|
||||||
|
UIRadioButton useApp = new UIRadioButton(Inter.getLocText("FR-mobile_native_analysis")); |
||||||
|
useApp.setSelected(true); |
||||||
|
UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis")); |
||||||
|
|
||||||
|
addToButtonGroup(useApp, useHTML5); |
||||||
|
|
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_style")), useApp, useHTML5}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_annotation")), null, null} |
||||||
|
}; |
||||||
|
JPanel usePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
|
usePane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); |
||||||
|
|
||||||
|
this.add(usePane); |
||||||
|
} |
||||||
|
|
||||||
|
private void addToButtonGroup(UIRadioButton... radios) { |
||||||
|
ButtonGroup buttonGroup = new ButtonGroup(); |
||||||
|
for (UIRadioButton radio : radios) { |
||||||
|
radioButtons.add(radio); |
||||||
|
buttonGroup.add(radio); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 设置按钮状态 |
||||||
|
*/ |
||||||
|
public void setEnabled(boolean enabled) { |
||||||
|
for (UIRadioButton radioButton : radioButtons) { |
||||||
|
radioButton.setEnabled(enabled); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取当前选中的按钮index |
||||||
|
* |
||||||
|
* @return 按钮index |
||||||
|
*/ |
||||||
|
public int getSelectRadioIndex() { |
||||||
|
for (int i = 0, len = radioButtons.size(); i < len; i++) { |
||||||
|
if (radioButtons.get(i).isSelected()) { |
||||||
|
return i; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 选中指定index的按钮 |
||||||
|
*/ |
||||||
|
public void selectIndexButton(int index) { |
||||||
|
if (index < 0 || index > radioButtons.size() - 1) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
UIRadioButton button = radioButtons.get(index); |
||||||
|
button.setSelected(true); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 给所有的按钮加上监听 |
||||||
|
*/ |
||||||
|
public void addActionListener(ActionListener actionListener) { |
||||||
|
for (UIRadioButton radioButton : radioButtons) { |
||||||
|
radioButton.addActionListener(actionListener); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(ElementCaseMobileAttr mobileAttr) { |
||||||
|
if(mobileAttr != null) { |
||||||
|
selectIndexButton(mobileAttr.isUseHTML() ? 1 : 0); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public ElementCaseMobileAttr updateBean() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void updateBean(ElementCaseMobileAttr mobileAttr) { |
||||||
|
if(mobileAttr != null) { |
||||||
|
mobileAttr.setUseHTML(getSelectRadioIndex() == 1); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return Inter.getLocText("FR-mobile_report_analysis"); |
||||||
|
} |
||||||
|
} |
@ -1 +1 @@ |
|||||||
package com.fr.design.widget.ui;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.CustomWriteAbleRepeatEditor;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Author : Shockway
* Date: 13-9-18
* Time: 下午2:17
*/
public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRepeatEditor> extends WritableRepeatEditorPane<T> {
private UICheckBox customDataCheckBox;
public CustomWritableRepeatEditorPane() {
this.initComponents();
}
@Override
protected JPanel setThirdContentPane() {
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
contentPane.add(contenter, BorderLayout.NORTH);
this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false);
contenter.add(this.customDataCheckBox);
JPanel otherContentPane = this.setForthContentPane();
if (otherContentPane != null) {
contentPane.add(otherContentPane,BorderLayout.CENTER);
}
return contentPane;
}
protected abstract JPanel setForthContentPane();
protected void populateSubWritableRepeatEditorBean(T e) {
this.customDataCheckBox.setSelected(e.isCustomData());
populateSubCustomWritableRepeatEditorBean(e);
}
protected abstract void populateSubCustomWritableRepeatEditorBean(T e);
protected T updateSubWritableRepeatEditorBean() {
T e = updateSubCustomWritableRepeatEditorBean();
e.setCustomData(this.customDataCheckBox.isSelected());
return e;
}
protected abstract T updateSubCustomWritableRepeatEditorBean();
} |
package com.fr.design.widget.ui;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.CustomWriteAbleRepeatEditor;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Author : Shockway
* Date: 13-9-18
* Time: 下午2:17
*/
public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRepeatEditor> extends WritableRepeatEditorPane<T> {
private UICheckBox customDataCheckBox;
public CustomWritableRepeatEditorPane() {
this.initComponents();
}
@Override
protected JPanel setThirdContentPane() {
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.customDataCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_CustomData"), false);
this.customDataCheckBox.setPreferredSize(new Dimension(100, 30));
getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{this.customDataCheckBox}, FlowLayout.LEFT, 5));
JPanel otherContentPane = this.setForthContentPane();
if (otherContentPane != null) {
contentPane.add(otherContentPane,BorderLayout.CENTER);
}
return contentPane;
}
protected abstract JPanel setForthContentPane();
protected void populateSubWritableRepeatEditorBean(T e) {
this.customDataCheckBox.setSelected(e.isCustomData());
populateSubCustomWritableRepeatEditorBean(e);
}
protected abstract void populateSubCustomWritableRepeatEditorBean(T e);
protected T updateSubWritableRepeatEditorBean() {
T e = updateSubCustomWritableRepeatEditorBean();
e.setCustomData(this.customDataCheckBox.isSelected());
return e;
}
protected abstract T updateSubCustomWritableRepeatEditorBean();
} |
@ -1,112 +1,143 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
import java.awt.*; |
||||||
import java.awt.event.ItemEvent; |
import java.awt.event.ItemEvent; |
||||||
import java.awt.event.ItemListener; |
import java.awt.event.ItemListener; |
||||||
|
|
||||||
import javax.swing.BorderFactory; |
import javax.swing.*; |
||||||
|
|
||||||
import com.fr.design.gui.frpane.TreeSettingPane; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.event.DocumentEvent; |
import javax.swing.event.DocumentEvent; |
||||||
import javax.swing.event.DocumentListener; |
import javax.swing.event.DocumentListener; |
||||||
|
|
||||||
import com.fr.design.beans.BasicBeanPane; |
|
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import com.fr.design.gui.itextfield.UITextField; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.present.dict.DictionaryPane; |
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
import com.fr.form.ui.FieldEditor; |
import com.fr.form.ui.FieldEditor; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.design.widget.DataModify; |
|
||||||
|
|
||||||
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> { |
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> { |
||||||
private UICheckBox allowBlankCheckBox; |
private UICheckBox allowBlankCheckBox; |
||||||
// richer:错误信息,是所有控件共有的属性,所以放到这里来
|
// richer:错误信息,是所有控件共有的属性,所以放到这里来
|
||||||
private UITextField errorMsgTextField; |
private UITextField errorMsgTextField; |
||||||
|
private UITextField regErrorMsgTextField; |
||||||
public FieldEditorDefinePane() { |
private JPanel validatePane; |
||||||
this.initComponents(); |
|
||||||
} |
public FieldEditorDefinePane() { |
||||||
|
this.initComponents(); |
||||||
protected void initComponents() { |
} |
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
protected void initComponents() { |
||||||
this.add(northPane, BorderLayout.NORTH); |
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
JPanel firstPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); |
||||||
firstPanel.setBorder(BorderFactory.createEmptyBorder(0, -2, 0, 0)); |
regErrorMsgTextField = new UITextField(16); |
||||||
//JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane();
|
regErrorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { |
||||||
allowBlankCheckBox = new UICheckBox(Inter.getLocText("Allow_Blank")); |
public void changedUpdate(DocumentEvent e) { |
||||||
// 是否允许为空
|
regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); |
||||||
firstPanel.add(allowBlankCheckBox); |
} |
||||||
allowBlankCheckBox.addItemListener(new ItemListener() { |
|
||||||
|
public void insertUpdate(DocumentEvent e) { |
||||||
@Override |
regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); |
||||||
public void itemStateChanged(ItemEvent e) { |
} |
||||||
errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); |
|
||||||
} |
public void removeUpdate(DocumentEvent e) { |
||||||
}); |
regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); |
||||||
|
} |
||||||
// 错误信息
|
}); |
||||||
JPanel errorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
|
||||||
firstPanel.add(errorMsgPane); |
//JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane();
|
||||||
northPane.add(firstPanel); |
allowBlankCheckBox = new UICheckBox(Inter.getLocText("Allow_Blank")); |
||||||
errorMsgPane.add(new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":")); |
allowBlankCheckBox.setPreferredSize(new Dimension(75, 30)); |
||||||
errorMsgTextField = new UITextField(16); |
allowBlankCheckBox.addItemListener(new ItemListener() { |
||||||
errorMsgPane.add(errorMsgTextField); |
|
||||||
|
@Override |
||||||
// richer:主要为了方便查看比较长的错误信息
|
public void itemStateChanged(ItemEvent e) { |
||||||
errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { |
errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); |
||||||
|
} |
||||||
public void changedUpdate(DocumentEvent e) { |
}); |
||||||
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
|
||||||
} |
// 错误信息
|
||||||
|
JPanel errorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
||||||
public void insertUpdate(DocumentEvent e) { |
errorMsgPane.add(new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":")); |
||||||
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
errorMsgTextField = new UITextField(16); |
||||||
} |
errorMsgPane.add(errorMsgTextField); |
||||||
|
|
||||||
public void removeUpdate(DocumentEvent e) { |
// richer:主要为了方便查看比较长的错误信息
|
||||||
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { |
||||||
} |
|
||||||
}); |
public void changedUpdate(DocumentEvent e) { |
||||||
JPanel contentPane = this.setFirstContentPane(); |
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
||||||
if (contentPane != null) { |
} |
||||||
//contentPane.add(firstPanel);
|
|
||||||
this.add(contentPane, BorderLayout.CENTER); |
public void insertUpdate(DocumentEvent e) { |
||||||
} else { |
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
||||||
//this.add(firstPanel, BorderLayout.CENTER);
|
} |
||||||
} |
|
||||||
} |
public void removeUpdate(DocumentEvent e) { |
||||||
|
errorMsgTextField.setToolTipText(errorMsgTextField.getText()); |
||||||
@Override |
} |
||||||
public void populateBean(T ob) { |
}); |
||||||
this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); |
this.addAllowBlankPane(allowBlankCheckBox); |
||||||
errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); |
JPanel contentPane = this.setFirstContentPane(); |
||||||
this.errorMsgTextField.setText(ob.getErrorMessage()); |
if (contentPane != null) { |
||||||
|
//contentPane.add(firstPanel);
|
||||||
populateSubFieldEditorBean(ob); |
this.add(contentPane, BorderLayout.NORTH); |
||||||
} |
} else { |
||||||
|
//this.add(firstPanel, BorderLayout.CENTER);
|
||||||
protected abstract void populateSubFieldEditorBean(T ob); |
} |
||||||
|
} |
||||||
@Override |
|
||||||
public T updateBean() { |
@Override |
||||||
T e = updateSubFieldEditorBean(); |
public void populateBean(T ob) { |
||||||
|
this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); |
||||||
e.setAllowBlank(this.allowBlankCheckBox.isSelected()); |
errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); |
||||||
e.setErrorMessage(this.errorMsgTextField.getText()); |
this.errorMsgTextField.setText(ob.getErrorMessage()); |
||||||
|
|
||||||
return e; |
populateSubFieldEditorBean(ob); |
||||||
} |
} |
||||||
|
|
||||||
protected abstract T updateSubFieldEditorBean(); |
protected abstract void populateSubFieldEditorBean(T ob); |
||||||
|
|
||||||
protected abstract JPanel setFirstContentPane(); |
@Override |
||||||
|
public T updateBean() { |
||||||
@Override |
T e = updateSubFieldEditorBean(); |
||||||
public void checkValid() throws Exception { |
|
||||||
|
e.setAllowBlank(this.allowBlankCheckBox.isSelected()); |
||||||
} |
e.setErrorMessage(this.errorMsgTextField.getText()); |
||||||
|
|
||||||
|
return e; |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract T updateSubFieldEditorBean(); |
||||||
|
|
||||||
|
protected abstract JPanel setFirstContentPane(); |
||||||
|
|
||||||
|
@Override |
||||||
|
public void checkValid() throws Exception { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public void addAllowBlankPane(UICheckBox allowBlankCheckBox) { |
||||||
|
JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Validate")); |
||||||
|
validatePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
||||||
|
validatePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
|
northPane.add(validatePane); |
||||||
|
this.add(northPane, BorderLayout.CENTER); |
||||||
|
JPanel firstPane = GUICoreUtils.createFlowPane(new JComponent[]{allowBlankCheckBox}, FlowLayout.LEFT, 5); |
||||||
|
validatePane.add(firstPane); |
||||||
|
JPanel secondPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), errorMsgTextField}, FlowLayout.LEFT, 24); |
||||||
|
secondPane.setPreferredSize(new Dimension(310, 23)); |
||||||
|
validatePane.add(secondPane); |
||||||
|
} |
||||||
|
|
||||||
|
public JPanel getValidatePane() { |
||||||
|
return validatePane; |
||||||
|
} |
||||||
|
|
||||||
|
public UITextField getRegErrorMsgTextField() { |
||||||
|
return regErrorMsgTextField; |
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -1,91 +1,107 @@ |
|||||||
package com.fr.design.widget.ui; |
package com.fr.design.widget.ui; |
||||||
|
|
||||||
import com.fr.design.gui.frpane.RegPane; |
import com.fr.design.gui.frpane.RegPane; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
import com.fr.form.ui.TextEditor; |
import com.fr.form.ui.TextEditor; |
||||||
|
import com.fr.form.ui.reg.RegExp; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.stable.StringUtils; |
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
import java.awt.event.KeyAdapter; |
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; |
||||||
|
|
||||||
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, 0)); |
regPane = createRegPane(); |
||||||
JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() { |
||||||
contenter.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); |
|
||||||
attrPane.add(contenter, BorderLayout.NORTH); |
|
||||||
regPane = createRegPane(); |
|
||||||
final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() { |
|
||||||
|
|
||||||
@Override |
@Override |
||||||
public void regChangeAction() { |
public void regChangeAction() { |
||||||
waterMarkDictPane.setWaterMark(""); |
waterMarkDictPane.setWaterMark(""); |
||||||
regPane.removeRegChangeListener(this); |
regPane.removeRegChangeListener(this); |
||||||
} |
} |
||||||
}; |
}; |
||||||
final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() { |
final RegPane.PhoneRegListener pl = new RegPane.PhoneRegListener() { |
||||||
public void phoneRegChangeAction(RegPane.PhoneRegEvent e) { |
public void phoneRegChangeAction(RegPane.PhoneRegEvent e) { |
||||||
if (StringUtils.isNotEmpty(e.getPhoneRegString()) |
if (StringUtils.isNotEmpty(e.getPhoneRegString()) |
||||||
&& StringUtils.isEmpty(waterMarkDictPane.getWaterMark())) { |
&& StringUtils.isEmpty(waterMarkDictPane.getWaterMark())) { |
||||||
waterMarkDictPane.setWaterMark(Inter.getLocText("Example") + ":" + e.getPhoneRegString()); |
waterMarkDictPane.setWaterMark(Inter.getLocText("Example") + ":" + e.getPhoneRegString()); |
||||||
regPane.addRegChangeListener(rl); |
regPane.addRegChangeListener(rl); |
||||||
} |
} |
||||||
} |
} |
||||||
}; |
}; |
||||||
regPane.addPhoneRegListener(pl); |
regPane.addPhoneRegListener(pl); |
||||||
|
getValidatePane().add(GUICoreUtils.createFlowPane(regPane, FlowLayout.LEFT)); |
||||||
|
getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getRegErrorMsgTextField()}, FlowLayout.LEFT, 24)); |
||||||
|
JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); |
||||||
|
waterMarkDictPane = new WaterMarkDictPane(); |
||||||
|
waterMarkDictPane.addInputKeyListener(new KeyAdapter() { |
||||||
|
public void keyTyped(KeyEvent e) { |
||||||
|
regPane.removePhoneRegListener(pl); |
||||||
|
regPane.removeRegChangeListener(rl); |
||||||
|
waterMarkDictPane.removeInputKeyListener(this); |
||||||
|
} |
||||||
|
}); |
||||||
|
//监听填写规则下拉框的值的变化
|
||||||
|
regPane.getRegComboBox().addActionListener(new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem(); |
||||||
|
if (!StringUtils.isNotEmpty(regExp.toRegText())) { |
||||||
|
getRegErrorMsgTextField().setEnabled(false); |
||||||
|
} else { |
||||||
|
getRegErrorMsgTextField().setEnabled(true); |
||||||
|
} |
||||||
|
|
||||||
waterMarkDictPane = new WaterMarkDictPane(); |
} |
||||||
waterMarkDictPane.addInputKeyListener(new KeyAdapter() { |
}); |
||||||
public void keyTyped(KeyEvent e) { |
advancedPane.add(waterMarkDictPane); |
||||||
regPane.removePhoneRegListener(pl); |
attrPane.add(advancedPane, BorderLayout.NORTH); |
||||||
regPane.removeRegChangeListener(rl); |
return attrPane; |
||||||
waterMarkDictPane.removeInputKeyListener(this); |
} |
||||||
} |
|
||||||
}); |
|
||||||
contenter.add(regPane, BorderLayout.NORTH); |
|
||||||
contenter.add(waterMarkDictPane, BorderLayout.CENTER); |
|
||||||
return attrPane; |
|
||||||
} |
|
||||||
|
|
||||||
protected RegPane createRegPane() { |
protected RegPane createRegPane() { |
||||||
return new RegPane(); |
return new RegPane(); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected String title4PopupWindow() { |
protected String title4PopupWindow() { |
||||||
return "text"; |
return "text"; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void populateSubFieldEditorBean(TextEditor e) { |
protected void populateSubFieldEditorBean(TextEditor e) { |
||||||
this.regPane.populate(e.getRegex()); |
this.regPane.populate(e.getRegex()); |
||||||
waterMarkDictPane.populate(e); |
getRegErrorMsgTextField().setText(e.getRegErrorMessage()); |
||||||
} |
waterMarkDictPane.populate(e); |
||||||
|
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected TextEditor updateSubFieldEditorBean() { |
protected TextEditor updateSubFieldEditorBean() { |
||||||
TextEditor ob = newTextEditorInstance(); |
TextEditor ob = newTextEditorInstance(); |
||||||
|
ob.setRegErrorMessage(this.getRegErrorMsgTextField().getText()); |
||||||
|
ob.setRegex(this.regPane.update()); |
||||||
|
waterMarkDictPane.update(ob); |
||||||
|
|
||||||
ob.setRegex(this.regPane.update()); |
return ob; |
||||||
waterMarkDictPane.update(ob); |
} |
||||||
|
|
||||||
return ob; |
protected TextEditor newTextEditorInstance() { |
||||||
} |
return new TextEditor(); |
||||||
|
} |
||||||
protected TextEditor newTextEditorInstance() { |
|
||||||
return new TextEditor(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
@ -0,0 +1,61 @@ |
|||||||
|
|
||||||
|
apply plugin: 'java' |
||||||
|
tasks.withType(JavaCompile){ |
||||||
|
options.encoding = 'UTF-8' |
||||||
|
} |
||||||
|
version='8.0' |
||||||
|
|
||||||
|
jar{ |
||||||
|
baseName='fr-designer-core' |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
def srcDir="${System.getenv()['JENKINS_HOME']}/workspace/design" |
||||||
|
def libDir="${System.getenv()['JENKINS_HOME']}/workspace/lib" |
||||||
|
|
||||||
|
sourceSets{ |
||||||
|
main{ |
||||||
|
java{ |
||||||
|
srcDirs=["${srcDir}/designer_base/src"] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
dependencies{ |
||||||
|
compile fileTree(dir:'../../',include:'**/*.jar') |
||||||
|
compile fileTree(dir:libDir,include:'*.jar') |
||||||
|
compile fileTree(dir:"${libDir}/jetty",include:'*.jar') |
||||||
|
testCompile 'junit:junit:4.12' |
||||||
|
} |
||||||
|
|
||||||
|
task copyFile(type:Copy,dependsOn:compileJava){ |
||||||
|
copy{ |
||||||
|
from ("${srcDir}/designer_base/src"){ |
||||||
|
exclude '**/*.java' |
||||||
|
} |
||||||
|
into 'build/classes/main' |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//ѹËõÏîÄ¿ÖеÄjsÎļþ |
||||||
|
task compressJS{ |
||||||
|
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ |
||||||
|
classpath { |
||||||
|
fileset(dir:'../../lib',includes:'*.jar') |
||||||
|
} |
||||||
|
} |
||||||
|
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", , charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ |
||||||
|
fileset (dir:"${srcDir}/designer_base/src"){ |
||||||
|
include (name:'**/*.js') |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
jar.dependsOn compressJS |
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,48 @@ |
|||||||
|
package com.fr.design.beans.location; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.gui.ibutton.UIButton; |
||||||
|
import com.fr.design.icon.IconPathConstants; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by zhouping on 2016/7/24. |
||||||
|
*/ |
||||||
|
public class WidgetForbidWindow extends JWindow { |
||||||
|
|
||||||
|
private static final int WIDTH = 150; |
||||||
|
private static final int HEIGHT = 20; |
||||||
|
|
||||||
|
private UIButton promptButton = new UIButton(Inter.getLocText("FR-Designer_Forbid_Widgets_Intersects"), BaseUtils.readIcon(IconPathConstants.FORBID_ICON_PATH)); |
||||||
|
|
||||||
|
/** |
||||||
|
* 构造函数 |
||||||
|
*/ |
||||||
|
public WidgetForbidWindow() { |
||||||
|
this.add(promptButton); |
||||||
|
|
||||||
|
this.setSize(WIDTH, HEIGHT); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 在指定位置显示窗口, 默认将window的中心点放到指定位置上 |
||||||
|
* |
||||||
|
* @param x x坐标 |
||||||
|
* @param y y坐标 |
||||||
|
* |
||||||
|
*/ |
||||||
|
public void showWindow(int x, int y){ |
||||||
|
this.setLocation(x - WIDTH / 2, y - HEIGHT / 2); |
||||||
|
this.setVisible(true); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 隐藏当前窗口 |
||||||
|
* |
||||||
|
*/ |
||||||
|
public void hideWindow(){ |
||||||
|
this.setVisible(false); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,57 @@ |
|||||||
|
|
||||||
|
apply plugin: 'java' |
||||||
|
tasks.withType(JavaCompile){ |
||||||
|
options.encoding = 'UTF-8' |
||||||
|
} |
||||||
|
|
||||||
|
version='8.0' |
||||||
|
|
||||||
|
def srcDir="${System.getenv()['JENKINS_HOME']}/workspace/design" |
||||||
|
def libDir="${System.getenv()['JENKINS_HOME']}/workspace/lib" |
||||||
|
|
||||||
|
|
||||||
|
jar{ |
||||||
|
baseName='fr-designer-chart' |
||||||
|
} |
||||||
|
|
||||||
|
sourceSets{ |
||||||
|
main{ |
||||||
|
java{ |
||||||
|
srcDirs=["${srcDir}/designer_chart/src"] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
dependencies{ |
||||||
|
compile fileTree(dir:'../../',include:'**/*.jar') |
||||||
|
compile fileTree(dir:libDir,include:'*.jar') |
||||||
|
compile fileTree(dir:"${libDir}/jetty",include:'*.jar') |
||||||
|
testCompile 'junit:junit:4.12' |
||||||
|
} |
||||||
|
|
||||||
|
task copyFile(type:Copy,dependsOn:compileJava){ |
||||||
|
copy{ |
||||||
|
from ("${srcDir}/designer_chart/src"){ |
||||||
|
exclude '**/*.java' |
||||||
|
} |
||||||
|
into 'build/classes/main' |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
//ѹËõÏîÄ¿ÖеÄjsÎļþ |
||||||
|
task compressJS{ |
||||||
|
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ |
||||||
|
classpath { |
||||||
|
fileset(dir:'../../lib',includes:'*.jar') |
||||||
|
} |
||||||
|
} |
||||||
|
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", , charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ |
||||||
|
fileset (dir:"${srcDir}/designer_chart/src"){ |
||||||
|
include (name:'**/*.js') |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
jar.dependsOn compressJS |
||||||
|
|
@ -0,0 +1,65 @@ |
|||||||
|
|
||||||
|
apply plugin: 'java' |
||||||
|
tasks.withType(JavaCompile){ |
||||||
|
options.encoding = 'UTF-8' |
||||||
|
} |
||||||
|
|
||||||
|
version='8.0' |
||||||
|
|
||||||
|
def srcDir="${System.getenv()['JENKINS_HOME']}/workspace/design" |
||||||
|
def libDir="${System.getenv()['JENKINS_HOME']}/workspace/lib" |
||||||
|
|
||||||
|
|
||||||
|
jar{ |
||||||
|
baseName='fr-designer-report' |
||||||
|
} |
||||||
|
|
||||||
|
sourceSets{ |
||||||
|
main{ |
||||||
|
java{ |
||||||
|
srcDirs=["${srcDir}/designer/src", |
||||||
|
"${srcDir}/designer_form/src"] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
dependencies{ |
||||||
|
compile fileTree(dir:'../../',include:'**/*.jar') |
||||||
|
compile fileTree(dir:libDir,include:'*.jar') |
||||||
|
compile fileTree(dir:"${libDir}/jetty",include:'*.jar') |
||||||
|
testCompile 'junit:junit:4.12' |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
task copyFile(type:Copy,dependsOn:compileJava){ |
||||||
|
copy{ |
||||||
|
from ("${srcDir}/designer/src"){ |
||||||
|
exclude '**/*.java' |
||||||
|
} |
||||||
|
from ("${srcDir}/designer_form/src") |
||||||
|
into ('build/classes/main') |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//ѹËõÏîÄ¿ÖеÄjsÎļþ |
||||||
|
task compressJS{ |
||||||
|
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ |
||||||
|
classpath { |
||||||
|
fileset(dir:'../../lib',includes:'*.jar') |
||||||
|
} |
||||||
|
} |
||||||
|
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", , charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ |
||||||
|
fileset (dir:"${srcDir}/designer/src"){ |
||||||
|
include (name:'**/*.js') |
||||||
|
|
||||||
|
} |
||||||
|
fileset (dir:"${srcDir}/designer_form/src"){ |
||||||
|
include (name:'**/*.js') |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
jar.dependsOn compressJS |
||||||
|
|
@ -1,21 +0,0 @@ |
|||||||
package com.fr.design.designer.beans.adapters.layout; |
|
||||||
|
|
||||||
import com.fr.design.beans.GroupModel; |
|
||||||
import com.fr.design.designer.creator.XLayoutContainer; |
|
||||||
import com.fr.design.designer.creator.XWFitLayout; |
|
||||||
import com.fr.design.designer.properties.BodyMobileLayoutPropertiesGroupModel; |
|
||||||
|
|
||||||
public class FRBodyFitLayoutAdapter extends FRFitLayoutAdapter { |
|
||||||
|
|
||||||
public FRBodyFitLayoutAdapter(XLayoutContainer container) { |
|
||||||
super(container); |
|
||||||
} |
|
||||||
/** |
|
||||||
* 返回布局自身属性,方便一些特有设置在layout刷新时处理 |
|
||||||
*/ |
|
||||||
@Override |
|
||||||
public GroupModel getLayoutProperties() { |
|
||||||
XWFitLayout xfl = (XWFitLayout) container; |
|
||||||
return new BodyMobileLayoutPropertiesGroupModel(xfl); |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,26 @@ |
|||||||
|
package com.fr.design.designer.beans.painters; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XLayoutContainer; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by zhouping on 2016/7/11. |
||||||
|
*/ |
||||||
|
public class FRAbsoluteLayoutPainter extends AbstractPainter { |
||||||
|
public FRAbsoluteLayoutPainter(XLayoutContainer container) { |
||||||
|
super(container); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 组件渲染 |
||||||
|
* |
||||||
|
* @param g 画图类 |
||||||
|
* @param startX 开始位置x |
||||||
|
* @param startY 开始位置y |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public void paint(Graphics g, int startX, int startY) { |
||||||
|
super.paint(g, startX, startY); |
||||||
|
} |
||||||
|
} |
@ -1 +1 @@ |
|||||||
package com.fr.design.designer.creator;
import com.fr.form.ui.WriteAbleRepeatEditor;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import java.awt.*;
import java.beans.IntrospectionException;
/**
* Author : Shockway
* Date: 13-9-22
* Time: 上午10:40
*/
public abstract class XCustomWriteAbleRepeatEditor extends XWriteAbleRepeatEditor {
public XCustomWriteAbleRepeatEditor(WriteAbleRepeatEditor widget, Dimension initSize) {
super(widget, initSize);
}
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(),
new CRPropertyDescriptor[] { new CRPropertyDescriptor("customData",
this.data.getClass()).setI18NName(Inter.getLocText("Form-Allow_CustomData"))});
}
} |
package com.fr.design.designer.creator;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.form.ui.WriteAbleRepeatEditor;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import java.awt.*;
import java.beans.IntrospectionException;
/**
* Author : Shockway
* Date: 13-9-22
* Time: 上午10:40
*/
public abstract class XCustomWriteAbleRepeatEditor extends XWriteAbleRepeatEditor {
public XCustomWriteAbleRepeatEditor(WriteAbleRepeatEditor widget, Dimension initSize) {
super(widget, initSize);
}
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(),
new CRPropertyDescriptor[] { new CRPropertyDescriptor("customData",
this.data.getClass()).setI18NName(Inter.getLocText("Form-Allow_CustomData"))
.putKeyValue(XCreatorConstants.PROPERTY_VALIDATE, "FR-Designer_Validate")});
}
} |
@ -1,20 +0,0 @@ |
|||||||
package com.fr.design.designer.creator; |
|
||||||
|
|
||||||
import com.fr.design.designer.beans.LayoutAdapter; |
|
||||||
import com.fr.design.designer.beans.adapters.layout.FRBodyFitLayoutAdapter; |
|
||||||
import com.fr.form.ui.container.WFitLayout; |
|
||||||
import java.awt.Dimension; |
|
||||||
|
|
||||||
public class XWBodyFitLayout extends XWFitLayout { |
|
||||||
public XWBodyFitLayout() { |
|
||||||
this(new WFitLayout(), new Dimension()); |
|
||||||
} |
|
||||||
|
|
||||||
public XWBodyFitLayout(WFitLayout widget, Dimension initSize) { |
|
||||||
super(widget, initSize); |
|
||||||
} |
|
||||||
@Override |
|
||||||
public LayoutAdapter getLayoutAdapter() { |
|
||||||
return new FRBodyFitLayoutAdapter(this); |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,12 @@ |
|||||||
|
package com.fr.design.designer.properties; |
||||||
|
|
||||||
|
import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by zhouping on 2016/8/1. |
||||||
|
*/ |
||||||
|
public class AbsoluteStateRenderer extends EncoderCellRenderer { |
||||||
|
public AbsoluteStateRenderer() { |
||||||
|
super(new AbsoluteStateWrapper()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
package com.fr.design.designer.properties; |
||||||
|
|
||||||
|
import com.fr.design.designer.properties.items.FRAbsoluteConstraintsItems; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by zhouping on 2016/8/1. |
||||||
|
*/ |
||||||
|
public class AbsoluteStateWrapper extends ItemWrapper{ |
||||||
|
public AbsoluteStateWrapper() { |
||||||
|
super(new FRAbsoluteConstraintsItems()); |
||||||
|
} |
||||||
|
} |
@ -1,111 +0,0 @@ |
|||||||
package com.fr.design.designer.properties; |
|
||||||
|
|
||||||
import com.fr.design.beans.GroupModel; |
|
||||||
import com.fr.form.ui.container.WFitLayout; |
|
||||||
import com.fr.design.designer.creator.XWFitLayout; |
|
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
|
||||||
import com.fr.design.mainframe.widget.editors.BooleanEditor; |
|
||||||
import com.fr.design.mainframe.widget.editors.PropertyCellEditor; |
|
||||||
import com.fr.general.Inter; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
import javax.swing.table.TableCellEditor; |
|
||||||
import javax.swing.table.TableCellRenderer; |
|
||||||
import java.awt.*; |
|
||||||
|
|
||||||
public class BodyMobileLayoutPropertiesGroupModel implements GroupModel { |
|
||||||
private PropertyCellEditor reLayoutEditor; |
|
||||||
private CheckBoxCellRenderer reLayoutrenderer; |
|
||||||
private WFitLayout layout; |
|
||||||
private XWFitLayout xfl; |
|
||||||
|
|
||||||
public BodyMobileLayoutPropertiesGroupModel(XWFitLayout xfl) { |
|
||||||
this.xfl = xfl; |
|
||||||
this.layout = xfl.toData(); |
|
||||||
reLayoutrenderer = new CheckBoxCellRenderer(); |
|
||||||
reLayoutEditor = new PropertyCellEditor(new BooleanEditor()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String getGroupName() { |
|
||||||
return Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public int getRowCount() { |
|
||||||
return 1; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public TableCellRenderer getRenderer(int row) { |
|
||||||
return reLayoutrenderer; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public TableCellEditor getEditor(int row) { |
|
||||||
return reLayoutEditor; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public Object getValue(int row, int column) { |
|
||||||
if (column == 0) { |
|
||||||
return Inter.getLocText("FR-Designer-App_ReLayout"); |
|
||||||
}else { |
|
||||||
return layout.getAppRelayout(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean setValue(Object value, int row, int column) { |
|
||||||
int state = 0; |
|
||||||
boolean appRelayoutState = true; |
|
||||||
if(value instanceof Integer) { |
|
||||||
state = (Integer)value; |
|
||||||
}else if (value instanceof Boolean) { |
|
||||||
appRelayoutState = (boolean)value; |
|
||||||
} |
|
||||||
if (column == 0 || state < 0) { |
|
||||||
return false; |
|
||||||
} else { |
|
||||||
layout.setAppRelayout(appRelayoutState); |
|
||||||
return true; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 是否可编辑 |
|
||||||
* @param row 行 |
|
||||||
* @return 否 |
|
||||||
*/ |
|
||||||
@Override |
|
||||||
public boolean isEditable(int row) { |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
private class CheckBoxCellRenderer extends UICheckBox implements TableCellRenderer { |
|
||||||
|
|
||||||
|
|
||||||
public CheckBoxCellRenderer() { |
|
||||||
super(); |
|
||||||
setOpaque(true); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
|
||||||
if (value instanceof Boolean) { |
|
||||||
setSelected(((Boolean) value).booleanValue()); |
|
||||||
setEnabled(table.isCellEditable(row, column)); |
|
||||||
if (isSelected) { |
|
||||||
setBackground(table.getSelectionBackground()); |
|
||||||
setForeground(table.getSelectionForeground()); |
|
||||||
} else { |
|
||||||
setForeground(table.getForeground()); |
|
||||||
setBackground(table.getBackground()); |
|
||||||
} |
|
||||||
} else { |
|
||||||
return null; |
|
||||||
} |
|
||||||
return this; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,94 @@ |
|||||||
|
package com.fr.design.designer.properties; |
||||||
|
|
||||||
|
import com.fr.design.beans.GroupModel; |
||||||
|
import com.fr.design.designer.creator.XWAbsoluteLayout; |
||||||
|
import com.fr.design.mainframe.widget.editors.AbsoluteLayoutDirectionEditor; |
||||||
|
import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor; |
||||||
|
import com.fr.design.mainframe.widget.editors.PropertyCellEditor; |
||||||
|
import com.fr.form.ui.container.WAbsoluteLayout; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
import javax.swing.table.DefaultTableCellRenderer; |
||||||
|
import javax.swing.table.TableCellEditor; |
||||||
|
import javax.swing.table.TableCellRenderer; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by zhouping on 2016/8/1. |
||||||
|
*/ |
||||||
|
public class FRAbsoluteLayoutPropertiesGroupModel implements GroupModel { |
||||||
|
|
||||||
|
private PropertyCellEditor editor; |
||||||
|
private DefaultTableCellRenderer renderer; |
||||||
|
private AbsoluteLayoutDirectionEditor stateEditor; |
||||||
|
private AbsoluteStateRenderer stateRenderer; |
||||||
|
private WAbsoluteLayout layout; |
||||||
|
private XWAbsoluteLayout xwAbsoluteLayout; |
||||||
|
|
||||||
|
public FRAbsoluteLayoutPropertiesGroupModel(XWAbsoluteLayout xwAbsoluteLayout){ |
||||||
|
this.xwAbsoluteLayout = xwAbsoluteLayout; |
||||||
|
this.layout = xwAbsoluteLayout.toData(); |
||||||
|
renderer = new DefaultTableCellRenderer(); |
||||||
|
editor = new PropertyCellEditor(new IntegerPropertyEditor()); |
||||||
|
stateEditor = new AbsoluteLayoutDirectionEditor(); |
||||||
|
stateRenderer = new AbsoluteStateRenderer(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 布局管理器自己的属性 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public String getGroupName() { |
||||||
|
return Inter.getLocText("FR-Designer-Widget_Area_Scaling"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int getRowCount() { |
||||||
|
return 1; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public TableCellRenderer getRenderer(int row) { |
||||||
|
return stateRenderer; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public TableCellEditor getEditor(int row) { |
||||||
|
return stateEditor; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Object getValue(int row, int column) { |
||||||
|
if (column == 0) { |
||||||
|
return Inter.getLocText("FR-Designer-Widget_Scaling_Mode"); |
||||||
|
} else { |
||||||
|
return layout.getCompState(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean setValue(Object value, int row, int column) { |
||||||
|
int state = 0; |
||||||
|
if(value instanceof Integer) { |
||||||
|
state = (Integer)value; |
||||||
|
} |
||||||
|
if (column == 0 || state < 0) { |
||||||
|
return false; |
||||||
|
} else { |
||||||
|
if (row == 0) { |
||||||
|
layout.setCompState(state); |
||||||
|
return true; |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否可编辑 |
||||||
|
* @param row 行 |
||||||
|
* @return 否 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public boolean isEditable(int row) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
package com.fr.design.designer.properties.items; |
||||||
|
|
||||||
|
import com.fr.form.ui.container.WAbsoluteLayout; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by zhouping on 2016/8/1. |
||||||
|
*/ |
||||||
|
public class FRAbsoluteConstraintsItems implements ItemProvider{ |
||||||
|
|
||||||
|
public static final Item[] ITEMS = new Item[] { |
||||||
|
new Item(Inter.getLocText("FR-Designer_Widget_Scaling_Mode_Fit"), WAbsoluteLayout.STATE_FIT), |
||||||
|
new Item(Inter.getLocText("FR-Designer_Widget_Scaling_Mode_Fixed"), WAbsoluteLayout.STATE_FIXED) |
||||||
|
}; |
||||||
|
|
||||||
|
public Item[] getItems() { |
||||||
|
return ITEMS; |
||||||
|
} |
||||||
|
} |
@ -1 +1 @@ |
|||||||
package com.fr.design.gui.core;
import javax.swing.Icon;
import com.fr.base.BaseUtils;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WHorizontalBoxLayout;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.container.WVerticalBoxLayout;
import com.fr.general.Inter;
/**
* Author : Shockway
* Date: 13-6-17
* Time: 上午10:40
*/
public class FormWidgetOption extends WidgetOption {
/**
* 返回名字
* @return 名字
*/
@Override
public String optionName() {
return null;
}
/**
* 返回图标
* @return 图标
*/
@Override
public Icon optionIcon() {
return null;
}
/**
* 组件类
* @return 类
*/
@Override
public Class<? extends Widget> widgetClass() {
return null;
}
/**
* 返回组件
* @return 控件
*/
@Override
public Widget createWidget() {
return null;
}
/*
* 表单容器
*/
public static WidgetOption[] getFormContainerInstance() {
return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER,
CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER };
}
/**
* 表单工具栏上的布局
* @return 控件
*/
public static WidgetOption[] getFormLayoutInstance() {
return new WidgetOption[] {CARDLAYOUTCONTAINER};
}
public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_AbsoluteLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute.png"),
WAbsoluteLayout.class);
public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"),
WBorderLayout.class);
public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_CardLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"),
WCardLayout.class);
public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"),
WHorizontalBoxLayout.class);
public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"),
WVerticalBoxLayout.class);
public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"),
BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"),
WFitLayout.class);
public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"),
WParameterLayout.class);
public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"),
ElementCaseEditor.class);
} |
package com.fr.design.gui.core;
import javax.swing.Icon;
import com.fr.base.BaseUtils;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WHorizontalBoxLayout;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.container.WVerticalBoxLayout;
import com.fr.general.Inter;
/**
* Author : Shockway
* Date: 13-6-17
* Time: 上午10:40
*/
public class FormWidgetOption extends WidgetOption {
/**
* 返回名字
* @return 名字
*/
@Override
public String optionName() {
return null;
}
/**
* 返回图标
* @return 图标
*/
@Override
public Icon optionIcon() {
return null;
}
/**
* 组件类
* @return 类
*/
@Override
public Class<? extends Widget> widgetClass() {
return null;
}
/**
* 返回组件
* @return 控件
*/
@Override
public Widget createWidget() {
return null;
}
/*
* 表单容器
*/
public static WidgetOption[] getFormContainerInstance() {
return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER,
CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER };
}
/**
* 表单工具栏上的布局
* @return 控件
*/
public static WidgetOption[] getFormLayoutInstance() {
return new WidgetOption[] {CARDLAYOUTCONTAINER, ABSOLUTELAYOUTCONTAINER};
}
public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_AbsoluteLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute.png"),
WAbsoluteLayout.class);
public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"),
WBorderLayout.class);
public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_CardLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"),
WCardLayout.class);
public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"),
WHorizontalBoxLayout.class);
public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"),
WVerticalBoxLayout.class);
public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"),
BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"),
WFitLayout.class);
public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"),
WParameterLayout.class);
public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter
.getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"),
ElementCaseEditor.class);
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.fr.design.mainframe.widget.editors; |
||||||
|
|
||||||
|
import com.fr.design.designer.properties.EnumerationEditor; |
||||||
|
import com.fr.design.designer.properties.items.FRAbsoluteConstraintsItems; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by zhouping on 2016/8/1. |
||||||
|
*/ |
||||||
|
public class AbsoluteLayoutDirectionEditor extends EnumerationEditor { |
||||||
|
public AbsoluteLayoutDirectionEditor() { |
||||||
|
super(new FRAbsoluteConstraintsItems()); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue