plough
8 years ago
4 changed files with 7 additions and 4 deletions
@ -1 +1 @@
|
||||
package com.fr.design.widget.ui;
import com.fr.base.GraphHelper2;
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(GraphHelper2.locTextStringWidth("Form-Allow_CustomData") + 30, 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();
} |
||||
package com.fr.design.widget.ui;
import com.fr.base.GraphHelper;
import com.fr.base.GraphHelper2;
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(GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30, 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 +1 @@
|
||||
package com.fr.design.write.submit;
import com.fr.base.GraphHelper;
import com.fr.base.GraphHelper2;
import com.fr.data.AbstractClassJob;
import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.formula.JavaEditorPane;
import com.fr.design.gui.frpane.ObjectProperiesPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Author : Shockway
* Date: 13-7-29
* Time: 下午6:48
*/
public abstract class CustomJobPane extends BasicBeanPane {
protected UITextField classNameTextField;
protected ObjectProperiesPane objectProperiesPane;
public static final int DEFAULT_LENGTH = 30;
public CustomJobPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel reportletNamePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
classNameTextField = new UITextField(getLengthOfTextField());
reportletNamePane.add(classNameTextField);
UIButton browserButton = new UIButton(Inter.getLocText("Select"));
browserButton.setPreferredSize(new Dimension(
GraphHelper2.locTextStringWidth("Select") + 20,
classNameTextField.getPreferredSize().height));
UIButton editButton = new UIButton(Inter.getLocText("Edit"));
editButton.setPreferredSize(new Dimension(
GraphHelper2.locTextStringWidth("Edit") + 20,
classNameTextField.getPreferredSize().height));
reportletNamePane.add(browserButton);
reportletNamePane.add(editButton);
browserButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
final ClassNameSelectPane bPane = new ClassNameSelectPane();
bPane.setClassPath(classNameTextField.getText());
bPane.showWindow(
SwingUtilities.getWindowAncestor(getWindowAncestor()),
new DialogActionAdapter() {
public void doOk() {
classNameTextField.setText(bPane.getClassPath());
checkAddButtonEnable();
}
}).setVisible(true);
}
});
editButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final JavaEditorPane javaEditorPane = new JavaEditorPane(classNameTextField.getText(), JavaEditorPane.DEFAULT_SUBMIT_JOB);
final BasicDialog dlg = javaEditorPane.showMediumWindow(SwingUtilities.getWindowAncestor(CustomJobPane.this),
new DialogActionAdapter() {
public void doOk() {
classNameTextField.setText(javaEditorPane.getClassText());
checkAddButtonEnable();
}
});
javaEditorPane.addSaveActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dlg.doOK();
}
});
dlg.setVisible(true);
}
});
reportletNamePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("ClassName"), null));
this.add(reportletNamePane, BorderLayout.NORTH);
objectProperiesPane = new ObjectProperiesPane();
objectProperiesPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Property"), null));
this.add(objectProperiesPane, BorderLayout.CENTER);
UITextArea area = new UITextArea(2, 1);
area.setText(Inter.getLocText(new String[]{"Come_True", "Interface"}) + ":com.fr.data.SubmitJob");
JPanel dsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
dsPane.add(area);
dsPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Description"), null));
this.add(dsPane, BorderLayout.SOUTH);
checkAddButtonEnable();
}
public int getLengthOfTextField() {
return DEFAULT_LENGTH;
}
protected String title4PopupWindow() {
return "CustomJob";
}
protected Component getWindowAncestor() {
return this;
}
@Override
public void populateBean(Object ob) {
if (ob instanceof AbstractClassJob) {
AbstractClassJob cj = (AbstractClassJob) ob;
this.classNameTextField.setText(cj.getClassName());
this.objectProperiesPane.populateBean(cj.getPropertyMap());
checkAddButtonEnable();
}
}
/**
* 添加按钮可用
*/
public void checkAddButtonEnable() {
objectProperiesPane.enableAddButton(!StringUtils.isEmpty(classNameTextField.getText()));
}
/**
* 重置
*/
public void reset() {
this.classNameTextField.setText(null);
this.checkAddButtonEnable();
}
} |
||||
package com.fr.design.write.submit;
import com.fr.base.GraphHelper;
import com.fr.base.GraphHelper2;
import com.fr.data.AbstractClassJob;
import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.formula.JavaEditorPane;
import com.fr.design.gui.frpane.ObjectProperiesPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Author : Shockway
* Date: 13-7-29
* Time: 下午6:48
*/
public abstract class CustomJobPane extends BasicBeanPane {
protected UITextField classNameTextField;
protected ObjectProperiesPane objectProperiesPane;
public static final int DEFAULT_LENGTH = 30;
public CustomJobPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel reportletNamePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();
classNameTextField = new UITextField(getLengthOfTextField());
reportletNamePane.add(classNameTextField);
UIButton browserButton = new UIButton(Inter.getLocText("Select"));
browserButton.setPreferredSize(new Dimension(
GraphHelper.getLocTextWidth("Select") + 20,
classNameTextField.getPreferredSize().height));
UIButton editButton = new UIButton(Inter.getLocText("Edit"));
editButton.setPreferredSize(new Dimension(
GraphHelper.getLocTextWidth("Edit") + 20,
classNameTextField.getPreferredSize().height));
reportletNamePane.add(browserButton);
reportletNamePane.add(editButton);
browserButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
final ClassNameSelectPane bPane = new ClassNameSelectPane();
bPane.setClassPath(classNameTextField.getText());
bPane.showWindow(
SwingUtilities.getWindowAncestor(getWindowAncestor()),
new DialogActionAdapter() {
public void doOk() {
classNameTextField.setText(bPane.getClassPath());
checkAddButtonEnable();
}
}).setVisible(true);
}
});
editButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final JavaEditorPane javaEditorPane = new JavaEditorPane(classNameTextField.getText(), JavaEditorPane.DEFAULT_SUBMIT_JOB);
final BasicDialog dlg = javaEditorPane.showMediumWindow(SwingUtilities.getWindowAncestor(CustomJobPane.this),
new DialogActionAdapter() {
public void doOk() {
classNameTextField.setText(javaEditorPane.getClassText());
checkAddButtonEnable();
}
});
javaEditorPane.addSaveActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dlg.doOK();
}
});
dlg.setVisible(true);
}
});
reportletNamePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("ClassName"), null));
this.add(reportletNamePane, BorderLayout.NORTH);
objectProperiesPane = new ObjectProperiesPane();
objectProperiesPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Property"), null));
this.add(objectProperiesPane, BorderLayout.CENTER);
UITextArea area = new UITextArea(2, 1);
area.setText(Inter.getLocText(new String[]{"Come_True", "Interface"}) + ":com.fr.data.SubmitJob");
JPanel dsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
dsPane.add(area);
dsPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Description"), null));
this.add(dsPane, BorderLayout.SOUTH);
checkAddButtonEnable();
}
public int getLengthOfTextField() {
return DEFAULT_LENGTH;
}
protected String title4PopupWindow() {
return "CustomJob";
}
protected Component getWindowAncestor() {
return this;
}
@Override
public void populateBean(Object ob) {
if (ob instanceof AbstractClassJob) {
AbstractClassJob cj = (AbstractClassJob) ob;
this.classNameTextField.setText(cj.getClassName());
this.objectProperiesPane.populateBean(cj.getPropertyMap());
checkAddButtonEnable();
}
}
/**
* 添加按钮可用
*/
public void checkAddButtonEnable() {
objectProperiesPane.enableAddButton(!StringUtils.isEmpty(classNameTextField.getText()));
}
/**
* 重置
*/
public void reset() {
this.classNameTextField.setText(null);
this.checkAddButtonEnable();
}
} |
Loading…
Reference in new issue