Browse Source

使用GraphHelper,修改临时代码

master
plough 8 years ago
parent
commit
01aa1c3956
  1. 4
      designer/src/com/fr/design/report/ReportColumnsPane.java
  2. 2
      designer/src/com/fr/design/widget/ui/CustomWritableRepeatEditorPane.java
  3. 3
      designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java
  4. 2
      designer_base/src/com/fr/design/write/submit/CustomJobPane.java

4
designer/src/com/fr/design/report/ReportColumnsPane.java

@ -20,6 +20,7 @@ import javax.swing.SwingConstants;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
import com.fr.base.GraphHelper2;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.border.UITitledBorder;
@ -114,7 +115,8 @@ public class ReportColumnsPane extends BasicPane{
FRFont uiLableFont = FRFont.getInstance(FONT_NAME, Font.PLAIN, FONT_SIZE);
uiLabel.setFont(uiLableFont);
uiLabel.setHorizontalAlignment(SwingConstants.CENTER);
int uiLabelWidth = GraphHelper2.locTextStringWidth("FR-Designer_ReportColumns-Columns", uiLableFont);
int uiLabelWidth = GraphHelper.getLocTextWidth("FR-Designer_ReportColumns-Columns", uiLableFont);
uiLabel.setPreferredSize(new Dimension(uiLabelWidth, 20));
north.add(uiLabel,BorderLayout.WEST);
JPanel buttonGroupPane = new JPanel(new FlowLayout(FlowLayout.CENTER, 23,11));

2
designer/src/com/fr/design/widget/ui/CustomWritableRepeatEditorPane.java

@ -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(); }

3
designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java

@ -6,6 +6,7 @@ import java.awt.event.ItemListener;
import javax.swing.*;
import com.fr.base.GraphHelper;
import com.fr.base.GraphHelper2;
import com.fr.design.gui.ilable.UILabel;
@ -50,7 +51,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
//JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane();
allowBlankCheckBox = new UICheckBox(Inter.getLocText("Allow_Blank"));
allowBlankCheckBox.setPreferredSize(new Dimension(GraphHelper2.locTextStringWidth("Allow_Blank") + 30, 30));
allowBlankCheckBox.setPreferredSize(new Dimension(GraphHelper.getLocTextWidth("Allow_Blank") + 30, 30));
allowBlankCheckBox.addItemListener(new ItemListener() {
@Override

2
designer_base/src/com/fr/design/write/submit/CustomJobPane.java

@ -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…
Cancel
Save