diff --git a/designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java b/designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java new file mode 100644 index 0000000000..4cf88436c2 --- /dev/null +++ b/designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java @@ -0,0 +1,146 @@ +package com.fr.design.mainframe; + +import com.fr.base.FRContext; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.present.CellWriteAttrPane; +import com.fr.design.widget.WidgetPane; +import com.fr.form.ui.NoneWidget; +import com.fr.form.ui.Widget; +import com.fr.general.FRLogger; +import com.fr.general.Inter; +import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.Selection; +import com.fr.privilege.finegrain.WidgetPrivilegeControl; +import com.fr.report.cell.DefaultTemplateCellElement; +import com.fr.report.cell.TemplateCellElement; +import com.fr.report.elementcase.TemplateElementCase; + +import java.awt.*; + +/** + * Created by ibm on 2017/7/20. + */ +public class CellWidgetPropertyPane extends BasicPane { + + private static CellWidgetPropertyPane singleton; + + private TemplateCellElement cellElement; + private WidgetPane cellEditorDefPane; + + public static CellWidgetPropertyPane getInstance(){ + if (singleton == null) { + singleton = new CellWidgetPropertyPane(); + } + return singleton; + } + + public CellWidgetPropertyPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); +// this.addAttributeChangeListener(listener); +// cellEditorDefPane = new WidgetPane(elementCasePane); + } + + public void clear (){ + singleton = null; + } + + public WidgetPane getCellEditorDefPane() { + return cellEditorDefPane; + } + + public void setCellEditorDefPane(WidgetPane cellEditorDefPane) { + this.cellEditorDefPane = cellEditorDefPane; + } + + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer-Widget_Settings"); + } + + public void populate(TemplateCellElement cellElement) { + if (cellElement == null) {// 利用默认的CellElement. + cellElement = new DefaultTemplateCellElement(0, 0, null); + } + + Widget cellWidget = cellElement.getWidget(); + + if(cellWidget == null){ + return; + } + + // 这里进行克隆的原因是为了保留原始的Widget以便和新的Widget做比较来判断是否发生了改变 + if (cellWidget != null) { + try { + cellWidget = (Widget) cellWidget.clone(); + } catch (CloneNotSupportedException e) { + FRContext.getLogger().error(e.getMessage(), e); + } + } + cellEditorDefPane.populate(cellWidget); + + } + + + public void populate(ElementCasePane ePane) { + + + cellEditorDefPane = new WidgetPane(ePane); + this.add(cellEditorDefPane, BorderLayout.CENTER); + + CellSelection cs = (CellSelection) ePane.getSelection(); + final TemplateElementCase tplEC = ePane.getEditingElementCase(); + TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); + if (editCellElement == null) { + editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); + tplEC.addCellElement(editCellElement); + } + this.cellElement = editCellElement; + this.populate(editCellElement); + } + + public void update() { + if (cellElement == null) {// 利用默认的CellElement. + return; + } + + Widget cellWidget = this.cellEditorDefPane.update(); + // p:最后把这个cellEditorDef设置到CellGUIAttr. + if (cellWidget instanceof NoneWidget) { + cellElement.setWidget(null); + } else { + if (cellElement.getWidget() != null) { + cellWidget = upDateWidgetAuthority(cellElement, cellWidget); + } + cellElement.setWidget(cellWidget); + } + + } + + + private Widget upDateWidgetAuthority(TemplateCellElement cellElement, Widget newWidget) { + try { + Widget oldWidget = (Widget) cellElement.getWidget().clone(); + if (newWidget.getClass() == oldWidget.getClass()) { + newWidget.setWidgetPrivilegeControl((WidgetPrivilegeControl) oldWidget.getWidgetPrivilegeControl().clone()); + } + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } + return newWidget; + } + + @Override + /** + *检测是否有效 + */ + public void checkValid() throws Exception { + this.cellEditorDefPane.checkValid(); + } + + + +} \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java index 7cd32d6272..cf63c4448e 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -6,7 +6,6 @@ import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.menu.KeySetUtils; import com.fr.design.present.ConditionAttributesGroupPane; import com.fr.general.Inter; -import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.Selection; import com.fr.page.ReportSettingsProvider; @@ -22,25 +21,13 @@ import com.fr.design.actions.edit.merge.UnmergeCellAction; import com.fr.design.actions.utils.DeprecatedActionManager; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; -import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.fun.MenuHandler; -import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.mainframe.cell.QuickEditorRegion; -import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; -import com.fr.report.cell.DefaultTemplateCellElement; -import com.fr.report.cell.TemplateCellElement; -import com.fr.report.core.SheetUtils; -import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.worksheet.WorkSheet; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionListener; -import com.fr.general.Inter; -import com.fr.grid.selection.FloatSelection; -import com.fr.page.ReportSettingsProvider; -import com.fr.report.worksheet.WorkSheet; import com.fr.stable.ArrayUtils; import javax.swing.*; @@ -69,7 +56,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); return; } - + CellWidgetPropertyPane.getInstance().populate(ElementCasePaneDelegate.this); CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this); QuickEditorRegion.getInstance().populate(getCurrentEditor()); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); @@ -94,6 +81,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance()); EastRegionContainerPane.getInstance().replaceConditionAttrPane(conditionAttributesGroupPane); + EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(CellWidgetPropertyPane.getInstance()); } EastRegionContainerPane.getInstance().replaceHyperlinkPane(hyperlinkGroupPane); EastRegionContainerPane.getInstance().removeParameterPane(); diff --git a/designer/src/com/fr/design/parameter/ParameterDefinitePane.java b/designer/src/com/fr/design/parameter/ParameterDefinitePane.java index 394c6facc9..5464436d1f 100644 --- a/designer/src/com/fr/design/parameter/ParameterDefinitePane.java +++ b/designer/src/com/fr/design/parameter/ParameterDefinitePane.java @@ -250,6 +250,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus bridge.setPosition(reportParameterAttr.getAlign()); bridge.setDisplay(reportParameterAttr.isShowWindow()); bridge.setBackground(reportParameterAttr.getBackground()); + bridge.setUseParamsTemplate(reportParameterAttr.isUseParamsTemplate()); } } diff --git a/designer/src/com/fr/design/widget/CellWidgetCardPane.java b/designer/src/com/fr/design/widget/CellWidgetCardPane.java index d286cc1900..ec47be2045 100644 --- a/designer/src/com/fr/design/widget/CellWidgetCardPane.java +++ b/designer/src/com/fr/design/widget/CellWidgetCardPane.java @@ -2,8 +2,9 @@ package com.fr.design.widget; import com.fr.design.data.DataCreatorUI; import com.fr.design.dialog.BasicPane; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.TreeSettingPane; -import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.present.dict.DictionaryPane; @@ -15,6 +16,7 @@ import com.fr.general.Inter; import javax.swing.*; import java.awt.*; +import java.util.ArrayList; /* * carl :单独弄出来 @@ -23,7 +25,10 @@ public class CellWidgetCardPane extends BasicPane { //当前的编辑器属性定义面板 private DataModify currentEditorDefinePane; //属性配置切换面板 - private JTabbedPane tabbedPane; + private ArrayList paneList; + private JPanel center; + private UIHeadGroup tabsHeaderIconPane; + private CardLayout tabbedPane; private BasicWidgetPropertySettingPane widgetPropertyPane; //通用属性容器 @@ -43,54 +48,87 @@ public class CellWidgetCardPane extends BasicPane { private JPanel eventTabPane; private WidgetEventPane eventPane; + private ElementCasePane pane; + public CellWidgetCardPane(ElementCasePane pane) { - this.initComponents(pane); + this.pane = pane; +// this.initComponents(pane); + } + + public BasicWidgetPropertySettingPane initBasicWidgetPropertyPane(){ + return new BasicWidgetPropertySettingPane(); } + private void initComponents(ElementCasePane pane) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); - tabbedPane = new UITabbedPane(); - this.add(tabbedPane, BorderLayout.CENTER); + //k + tabbedPane = new CardLayout(); + center = new JPanel(tabbedPane); + this.add(center, BorderLayout.CENTER); + attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); eventTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + initPaneList(); eventPane = new WidgetEventPane(pane); eventTabPane.add(eventPane, BorderLayout.CENTER); - tabbedPane.add(Inter.getLocText("FR-Designer_Attribute"), attriTabPane); - tabbedPane.add(Inter.getLocText("FR-Designer_Form_Editing_Listeners"), eventTabPane); + //k + center.add(attriTabPane, Inter.getLocText("FR-Designer_Attribute")); + center.add(eventTabPane, Inter.getLocText("FR-Designer_Form_Editing_Listeners")); + final String [] tabTitles = new String[]{Inter.getLocText("FR-Designer_Attribute"), Inter.getLocText("FR-Designer_Form_Editing_Listeners")}; + + tabsHeaderIconPane = new UIHeadGroup(tabTitles) { + @Override + public void tabChanged(int index) { + tabbedPane.show(center, tabTitles[index]); + } + }; + tabsHeaderIconPane.setNeedLeftRightOutLine(false); + this.add(tabsHeaderIconPane, BorderLayout.NORTH); + //数据字典 dictTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); dictCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); dictTabPane.add(dictCardPane, BorderLayout.CENTER); dictCardLayout = new CardLayout(); dictCardPane.setLayout(dictCardLayout); + //构建树 treeTabPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); widgetPropertyPane = new BasicWidgetPropertySettingPane(); - JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - northPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 0, 8)); - JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Form_Basic_Properties")); - northPane.add(basic); - basic.add(widgetPropertyPane); - attriTabPane.add(northPane, BorderLayout.NORTH); + + UIExpandablePane uiExpandablePane = new UIExpandablePane("基本", 280, 20, widgetPropertyPane); + + attriTabPane.add(uiExpandablePane, BorderLayout.NORTH); + attriCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); attriTabPane.add(attriCardPane, BorderLayout.CENTER); attriCardLayout = (CardLayout) attriCardPane.getLayout(); this.setPreferredSize(new Dimension(600, 450)); } + private void initPaneList(){ + paneList = new ArrayList(); + paneList.add(attriTabPane); + paneList.add(eventPane); + } + @Override protected String title4PopupWindow() { return "Widget"; } public void populate(Widget cellWidget) { + initComponents(pane); +// super.populate(cellWidget); currentEditorDefinePane = null; if (cellWidget instanceof NoneWidget) { - this.tabbedPane.setEnabled(false); +// this.tabbedPane.setEnabled(false); } else { - this.tabbedPane.setEnabled(true); +// this.tabbedPane.setEnabled(true); } WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() { @@ -117,7 +155,7 @@ public class CellWidgetCardPane extends BasicPane { currentEditorDefinePane = definePane; eventPane.populate(cellWidget); widgetPropertyPane.populate(cellWidget); - tabbedPane.setSelectedIndex(0); + tabsHeaderIconPane.setSelectedIndex(0); } private void showDictPane(DataCreatorUI ui, String cardName) { @@ -142,6 +180,7 @@ public class CellWidgetCardPane extends BasicPane { return null; } widgetPropertyPane.update(widget); +// super.update(widget); Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners(); widget.clearListeners(); @@ -164,21 +203,26 @@ public class CellWidgetCardPane extends BasicPane { private void addDictAttriPane() { - tabbedPane.add(this.dictTabPane, 1); - tabbedPane.setTitleAt(1, Inter.getLocText("FR-Designer_DS_Dictionary")); + center.add(this.dictTabPane, Inter.getLocText("FR-Designer_DS_Dictionary")); + reInitHeaderPane(this.dictTabPane); } private void addTreeAttriPane() { - tabbedPane.add(this.treeTabPane, 1); - tabbedPane.setTitleAt(1, Inter.getLocText("FR-Designer_Create_Tree")); + center.add(this.dictTabPane, Inter.getLocText("FR-Designer_Create_Tree")); + reInitHeaderPane(this.treeTabPane); } private void removeDictAttriPane() { - tabbedPane.remove(this.dictTabPane); + center.remove(this.dictTabPane); } private void removeTreeAttriPane() { - tabbedPane.remove(this.treeTabPane); + center.remove(this.treeTabPane); + } + + private void reInitHeaderPane(JPanel jPanel){ + paneList.add(jPanel); +// tabsHeaderIconPane = new } } diff --git a/designer/src/com/fr/design/widget/WidgetDefinePaneFactory.java b/designer/src/com/fr/design/widget/WidgetDefinePaneFactory.java index 8d598d718a..93dd3dcb1e 100644 --- a/designer/src/com/fr/design/widget/WidgetDefinePaneFactory.java +++ b/designer/src/com/fr/design/widget/WidgetDefinePaneFactory.java @@ -4,8 +4,6 @@ import com.fr.base.FRContext; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.core.WidgetConstants; -import com.fr.design.gui.frpane.TreeSettingPane; -import com.fr.design.present.dict.DictionaryPane; import com.fr.design.widget.ui.*; import com.fr.form.ui.*; import com.fr.report.web.button.form.TreeNodeToggleButton; @@ -77,10 +75,10 @@ public class WidgetDefinePaneFactory { } public static class RN { - private DataModify definePane; + private DataModify definePane; private String cardName; - public RN(DataModify definePane, String cardName) { + public RN(DataModify definePane, String cardName) { this.definePane = definePane; this.cardName = cardName; } diff --git a/designer/src/com/fr/design/widget/WidgetPane.java b/designer/src/com/fr/design/widget/WidgetPane.java index 4b5ca44332..ff9140da92 100644 --- a/designer/src/com/fr/design/widget/WidgetPane.java +++ b/designer/src/com/fr/design/widget/WidgetPane.java @@ -1,14 +1,17 @@ package com.fr.design.widget; import com.fr.design.ExtraDesignClassManager; -import com.fr.design.dialog.BasicPane; import com.fr.design.fun.WidgetDesignHandler; import com.fr.design.gui.core.WidgetOption; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.CellWidgetPropertyPane; import com.fr.design.widget.btn.ButtonConstants; import com.fr.form.ui.Button; import com.fr.form.ui.*; @@ -25,11 +28,11 @@ import java.util.Vector; /** * CellEditorDef Pane. */ -public class WidgetPane extends BasicPane implements ItemListener { +public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener { private EditorTypeComboBox editorTypeComboBox; private CellWidgetCardPane cellEditorCardPane; - private boolean shouldFireSelectedEvent; + private boolean shouldFireSelectedEvent = true; protected JPanel northPane; public WidgetPane() { @@ -45,7 +48,7 @@ public class WidgetPane extends BasicPane implements ItemListener { protected void initComponents(ElementCasePane pane) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); northPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); this.add(northPane, BorderLayout.NORTH); @@ -58,8 +61,23 @@ public class WidgetPane extends BasicPane implements ItemListener { cellEditorCardPane = new CellWidgetCardPane(pane); this.add(cellEditorCardPane, BorderLayout.CENTER); + this.addAttributeChangeListener(listener); } + protected JPanel createContentPane(){ + return new JPanel(); + } + + + + AttributeChangeListener listener = new AttributeChangeListener() { + @Override + public void attributeChange() { + CellWidgetPropertyPane.getInstance().update(); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); + } + }; + /** * 状态改变 * @@ -84,13 +102,13 @@ public class WidgetPane extends BasicPane implements ItemListener { } @Override - protected String title4PopupWindow() { + public String title4PopupWindow() { return Inter.getLocText("FR-Designer_Widget"); } public void populate(Widget widget) { if (widget == null) { - widget = new TextEditor(); + return; } if (widget instanceof NameWidget) { @@ -106,11 +124,16 @@ public class WidgetPane extends BasicPane implements ItemListener { if (ArrayUtils.contains(ButtonConstants.CLASSES4BUTTON, clazz)) { clazz = Button.class; } + cellEditorCardPane.populate(widget); + shouldFireSelectedEvent = false; editorTypeComboBox.setSelectedItemByWidgetClass(clazz); shouldFireSelectedEvent = true; - cellEditorCardPane.populate(widget); + removeAttributeChangeListener(); + initAllListeners(); + this.addAttributeChangeListener(listener); + } public Widget update() { @@ -118,7 +141,7 @@ public class WidgetPane extends BasicPane implements ItemListener { } protected void populateWidgetConfig(Widget widget) { - cellEditorCardPane.populate(widget); + this.populate(widget); } @@ -244,4 +267,8 @@ public class WidgetPane extends BasicPane implements ItemListener { && ComparatorUtils.equals(((Item) o).name, name); } } + public String getIconPath(){ + return ""; + } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/ButtonDefinePane.java b/designer/src/com/fr/design/widget/ui/ButtonDefinePane.java index 5d5c8d2fad..b53e003e60 100644 --- a/designer/src/com/fr/design/widget/ui/ButtonDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/ButtonDefinePane.java @@ -1,14 +1,10 @@ package com.fr.design.widget.ui; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.gui.frpane.TreeSettingPane; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.present.dict.DictionaryPane; +import com.fr.design.widget.ui.btn.ButtonDetailPaneFactory; import com.fr.form.ui.Button; import com.fr.form.ui.FreeButton; -import com.fr.design.widget.DataModify; import com.fr.design.widget.btn.ButtonDetailPane; -import com.fr.design.widget.ui.btn.ButtonDetailPaneFactory; import javax.swing.*; import javax.swing.event.ChangeEvent; diff --git a/designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java b/designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java index 3032e7e5cb..abcc5f986c 100644 --- a/designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java @@ -1,17 +1,14 @@ package com.fr.design.widget.ui; -import com.fr.design.gui.frpane.TreeSettingPane; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; import javax.swing.*; -import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.present.dict.DictionaryPane; import com.fr.form.ui.CheckBox; import com.fr.general.Inter; -import com.fr.design.widget.DataModify; public class CheckBoxDefinePane extends AbstractDataModify { private UITextField text; @@ -25,12 +22,11 @@ public class CheckBoxDefinePane extends AbstractDataModify { this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); JPanel textPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); textPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Advanced")); - advancedPane.add(textPane); + UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, textPane); textPane.add(new UILabel(Inter.getLocText("Text") + ":")); text = new UITextField(8); textPane.add(text); - this.add(advancedPane); + this.add(uiExpandablePane); } @Override diff --git a/designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java b/designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java index e625c2490a..fa7a189c0e 100644 --- a/designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/CheckBoxGroupDefinePane.java @@ -41,8 +41,6 @@ public class CheckBoxGroupDefinePane extends FieldEditorDefinePane extends WritableRepeatEditorPane { private UICheckBox customDataCheckBox; private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30; private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; 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(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); 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(); } \ No newline at end of file +package com.fr.design.widget.ui; import com.fr.base.GraphHelper; 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 extends WritableRepeatEditorPane { private UICheckBox customDataCheckBox; private static final int CUSTOM_DATA_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("Form-Allow_CustomData") + 30; private static final int CUSTOM_DATA_CHECK_BOX_HEIGHT = 30; 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(CUSTOM_DATA_CHECK_BOX_WIDTH, CUSTOM_DATA_CHECK_BOX_HEIGHT)); JPanel otherContentPane = this.setForthContentPane(); if (otherContentPane != null) { contentPane.add(otherContentPane,BorderLayout.CENTER); } return contentPane; } public JPanel setValidatePane(){ JPanel otherContentPane = super.setValidatePane(); otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{customDataCheckBox}, FlowLayout.LEFT, 5)); return otherContentPane; } 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(); } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java index b85a18a52d..a006bc9ec8 100644 --- a/designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java @@ -3,12 +3,14 @@ package com.fr.design.widget.ui; import com.fr.base.FRContext; import com.fr.base.Formula; import com.fr.data.core.FormatField; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.DateEditor; import com.fr.general.DateUtils; @@ -19,8 +21,6 @@ import com.fr.stable.StringUtils; import com.fr.stable.UtilEvalError; import javax.swing.*; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -50,16 +50,10 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane e contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false); directWriteCheckBox.setPreferredSize(new Dimension(100, 30)); - getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 5)); - JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); + waterMarkDictPane = new WaterMarkDictPane(); - advancedPane.add(contentPane); contentPane.add(waterMarkDictPane); JPanel otherContentPane = this.setSecondContentPane(); if (otherContentPane != null) { contentPane.add(otherContentPane); } - return advancedPane; + return contentPane; + } + + + + public JPanel setValidatePane(){ + JPanel otherContentPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + otherContentPane.add(GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 5)); + return otherContentPane; } protected abstract JPanel setSecondContentPane(); diff --git a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java index bb3565c82c..22db6df8ce 100644 --- a/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/FieldEditorDefinePane.java @@ -7,6 +7,8 @@ import java.awt.event.ItemListener; import javax.swing.*; import com.fr.base.GraphHelper; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; import javax.swing.event.DocumentEvent; @@ -15,18 +17,18 @@ import javax.swing.event.DocumentListener; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.FieldEditor; import com.fr.general.Inter; public abstract class FieldEditorDefinePane extends AbstractDataModify { private static final int ALLOW_BLANK_CHECK_BOX_WIDTH = GraphHelper.getLocTextWidth("FR-Designer_Allow_Null") + 30; private static final int ALLOW_BLANK_CHECK_BOX_HEIGHT = 30; - private UICheckBox allowBlankCheckBox; + protected UICheckBox allowBlankCheckBox; // richer:错误信息,是所有控件共有的属性,所以放到这里来 - private UITextField errorMsgTextField; - private UITextField regErrorMsgTextField; - private JPanel validatePane; + protected UITextField errorMsgTextField; + protected JPanel validatePane; public FieldEditorDefinePane() { this.initComponents(); @@ -34,47 +36,19 @@ public abstract class FieldEditorDefinePane extends Abstr protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); - - initRegErrorMsgTextField(); - - //JPanel firstPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); - allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null")); - allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT)); - allowBlankCheckBox.addItemListener(new ItemListener() { - - @Override - public void itemStateChanged(ItemEvent e) { - errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); - } - }); - initErrorMsgPane(); + JPanel contentPane = this.setFirstContentPane(); + if (contentPane != null) { + UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, contentPane); + this.add(uiExpandablePane, BorderLayout.NORTH); + } + this.addValidatePane(); } - protected void initRegErrorMsgTextField() { - regErrorMsgTextField = new UITextField(16); - regErrorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { - public void changedUpdate(DocumentEvent e) { - regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); - } - - public void insertUpdate(DocumentEvent e) { - regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); - } - - public void removeUpdate(DocumentEvent e) { - regErrorMsgTextField.setToolTipText(regErrorMsgTextField.getText()); - } - }); - } protected void initErrorMsgPane() { // 错误信息 - JPanel errorMsgPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); - errorMsgPane.add(new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":")); - errorMsgTextField = new UITextField(16); - errorMsgPane.add(errorMsgTextField); + errorMsgTextField = new UITextField(10); // richer:主要为了方便查看比较长的错误信息 errorMsgTextField.getDocument().addDocumentListener(new DocumentListener() { @@ -91,20 +65,13 @@ public abstract class FieldEditorDefinePane extends Abstr errorMsgTextField.setToolTipText(errorMsgTextField.getText()); } }); - this.addAllowBlankPane(allowBlankCheckBox); - JPanel contentPane = this.setFirstContentPane(); - if (contentPane != null) { - //contentPane.add(firstPanel); - this.add(contentPane, BorderLayout.NORTH); - } else { - //this.add(firstPanel, BorderLayout.CENTER); - } + } @Override public void populateBean(T ob) { this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); - errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); +// errorMsgTextField.setEnabled(!allowBlankCheckBox.isSelected()); this.errorMsgTextField.setText(ob.getErrorMessage()); populateSubFieldEditorBean(ob); @@ -126,30 +93,72 @@ public abstract class FieldEditorDefinePane extends Abstr 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(400, 23)); - validatePane.add(secondPane); - } + protected void addValidatePane() { + validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + final UILabel uiLabel = new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"); + errorMsgTextField = new UITextField(10); + allowBlankCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Null")); + allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); + allowBlankCheckBox.setPreferredSize(new Dimension(ALLOW_BLANK_CHECK_BOX_WIDTH, ALLOW_BLANK_CHECK_BOX_HEIGHT)); + allowBlankCheckBox.addItemListener(new ItemListener() { - public JPanel getValidatePane() { - return validatePane; + @Override + public void itemStateChanged(ItemEvent e) { + boolean isSelected = allowBlankCheckBox.isSelected(); + uiLabel.setVisible(!isSelected); + errorMsgTextField.setVisible(!isSelected); + if(isSelected){ + uiLabel.setPreferredSize(new Dimension(0, 0)); + errorMsgTextField.setPreferredSize(new Dimension(0, 0)); + }else{ + uiLabel.setPreferredSize(new Dimension(66, 20)); + errorMsgTextField.setPreferredSize(new Dimension(150, 20)); + } + } + }); + + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{allowBlankCheckBox, null }, + new Component[]{uiLabel, errorMsgTextField}, + }; + double[] rowSize = {p, p}; + double[] columnSize = {p,f}; + int[][] rowCount = {{1, 1},{1, 1}}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 1); + validatePane.add(panel, BorderLayout.NORTH); + + JPanel contentPane = this.setValidatePane(); + if (contentPane != null) { + validatePane.add(contentPane, BorderLayout.CENTER); + } + + + UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Validate"), 280, 20, validatePane); + this.add(uiExpandablePane, BorderLayout.CENTER); + +// JPanel firstPane = GUICoreUtils.createFlowPane(new JComponent[]{allowBlankCheckBox}, FlowLayout.LEFT, 5); +// validatePane.add(firstPane); +// JPanel secondPane = new JPanel(FRGUIPaneFactory.createLabelFlowLayout()); +// secondPane.add(new UILabel("错误提示" + ":")); +// secondPane.add(errorMsgTextField); +// JPanel secondPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), errorMsgTextField}, FlowLayout.LEFT, 24); +// secondPane.setPreferredSize(new Dimension(400, 23)); +// validatePane.add(secondPane); } - public UITextField getRegErrorMsgTextField() { - return regErrorMsgTextField; + public JPanel setValidatePane(){ + return null; } + + } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java index 367b04ae9e..cf7797e813 100644 --- a/designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java @@ -5,23 +5,20 @@ import java.util.List; import javax.swing.BorderFactory; -import com.fr.design.gui.frpane.TreeSettingPane; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; import javax.swing.JPanel; -import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.present.dict.DictionaryPane; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.IframeEditor; import com.fr.general.Inter; import com.fr.stable.ParameterProvider; -import com.fr.design.widget.DataModify; public class IframeEditorDefinePane extends AbstractDataModify { private UITextField srcTextField; @@ -35,7 +32,7 @@ public class IframeEditorDefinePane extends AbstractDataModify { private void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); + this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); @@ -44,22 +41,23 @@ public class IframeEditorDefinePane extends AbstractDataModify { contentPane.add(attr); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] rowSize = { p, TableLayout.PREFERRED }; + double[] rowSize = { p, p, p, p }; double[] columnSize = { p, f }; java.awt.Component[][] coms = { + { horizontalCheck, null }, + { verticalCheck, null }, { new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField() }, { new UILabel(Inter.getLocText("Parameter") + ":"), parameterViewPane = new ReportletParameterViewPane() } }; - parameterViewPane.setPreferredSize(new Dimension(400, 256)); - JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - centerPane.add(GUICoreUtils.createFlowPane(new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField(16), FlowLayout.LEFT)); - centerPane.add(GUICoreUtils.createFlowPane( new UILabel(Inter.getLocText("Parameter") + ":"), parameterViewPane = new ReportletParameterViewPane(), FlowLayout.LEFT)); - parameterViewPane.setPreferredSize(new Dimension(540, 235)); - JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); - advancedPane.add(contentPane); - contentPane.add(centerPane); - this.add(advancedPane, BorderLayout.CENTER); + int[][] rowCount = {{1, 1},{1, 1},{1, 1}, {1, 1}}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5); + + + contentPane.add(panel); + + UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, contentPane); + this.add(uiExpandablePane, BorderLayout.NORTH); + } diff --git a/designer/src/com/fr/design/widget/ui/MultiFileEditorPane.java b/designer/src/com/fr/design/widget/ui/MultiFileEditorPane.java index 38da354307..533a854994 100644 --- a/designer/src/com/fr/design/widget/ui/MultiFileEditorPane.java +++ b/designer/src/com/fr/design/widget/ui/MultiFileEditorPane.java @@ -2,6 +2,7 @@ package com.fr.design.widget.ui; import java.awt.*; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ilable.UILabel; import javax.swing.*; @@ -11,7 +12,8 @@ import com.fr.design.gui.icombobox.DictionaryComboBox; import com.fr.design.gui.icombobox.DictionaryConstants; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.MultiFileEditor; import com.fr.general.Inter; @@ -38,27 +40,36 @@ public class MultiFileEditorPane extends FieldEditorDefinePane fileSizeField = new UINumberField(); fileSizeField.setPreferredSize(new Dimension(80, 18)); - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); singleFilePane.add(singleFileCheckBox); - getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{singleFilePane}, FlowLayout.LEFT,0)); JPanel allowTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); allowTypePane.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); allowTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); allowTypePane.add(new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":")); allowTypePane.add(acceptType); - getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{allowTypePane}, FlowLayout.LEFT,5)); JPanel fileSizePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); fileSizePane.add(new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":")); fileSizePane.add(fileSizeField); fileSizePane.add(new UILabel(" KB")); - getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{fileSizePane}, FlowLayout.LEFT,11)); - return centerPane; + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{singleFileCheckBox, null }, + new Component[]{new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":"), acceptType}, + new Component[]{new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":"), fileSizeField}, + }; + double[] rowSize = {p, p,p}; + double[] columnSize = {p,f}; + int[][] rowCount = {{1, 1},{1, 1},{1, 1}}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5); + + + return panel; } @Override diff --git a/designer/src/com/fr/design/widget/ui/NoneWidgetDefinePane.java b/designer/src/com/fr/design/widget/ui/NoneWidgetDefinePane.java index 9f7c4bb356..60eb9ee0b5 100644 --- a/designer/src/com/fr/design/widget/ui/NoneWidgetDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NoneWidgetDefinePane.java @@ -1,10 +1,6 @@ package com.fr.design.widget.ui; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.gui.frpane.TreeSettingPane; -import com.fr.design.present.dict.DictionaryPane; import com.fr.form.ui.NoneWidget; -import com.fr.design.widget.DataModify; /** * diff --git a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index 2bd2956cba..86a8bf50f1 100644 --- a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -19,9 +19,10 @@ import javax.swing.text.DefaultFormatter; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.NumberEditor; import com.fr.general.Inter; -import com.fr.design.utils.gui.GUICoreUtils; public class NumberEditorDefinePane extends FieldEditorDefinePane { /** @@ -141,7 +142,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane }; public NumberEditorDefinePane() { - this.initComponents(); + super(); } @@ -156,23 +157,21 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane content.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); content.setLayout(FRGUIPaneFactory.createBorderLayout()); // richer:数字的允许直接编辑没有意义 + waterMarkDictPane = new WaterMarkDictPane(); - JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); - content.add(northPane, BorderLayout.NORTH); - waterMarkDictPane = new WaterMarkDictPane(); - northPane.add(waterMarkDictPane); - content.add(northPane, BorderLayout.NORTH); + return waterMarkDictPane; + } + + + public JPanel setValidatePane() { + this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals")); this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); this.decimalLength.setColumns(4); - limitNumberPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"}) + ":"), this.decimalLength}, - FlowLayout.LEFT, 4); - getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowDecimalsCheckBox, limitNumberPane}, FlowLayout.LEFT, 4)); this.allowDecimalsCheckBox.addActionListener(actionListener1); this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative")); - getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{this.allowNegativeCheckBox}, FlowLayout.LEFT, 4)); this.allowNegativeCheckBox.addActionListener(actionListener2); this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false); @@ -180,7 +179,6 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); maxValueSpinner.setPreferredSize(new Dimension(120, 20)); setNotAllowsInvalid(this.maxValueSpinner); - getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMaxValueCheckBox, this.maxValueSpinner}, FlowLayout.LEFT, 4)); this.maxValueSpinner.setVisible(false); this.setMaxValueCheckBox.addActionListener(actionListener3); this.maxValueSpinner.addChangeListener(changeListener1); @@ -189,15 +187,29 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); minValueSpinner.setPreferredSize(new Dimension(120, 20)); setNotAllowsInvalid(this.minValueSpinner); - getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{this.setMinValueCheckBox, this.minValueSpinner}, FlowLayout.LEFT, 4)); this.minValueSpinner.setVisible(false); this.setMinValueCheckBox.addActionListener(actionListener4); this.minValueSpinner.addChangeListener(changeListener2); - getValidatePane().add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(Inter.getLocText(new String[]{"Error", "Tooltips"}) + ":"), getRegErrorMsgTextField()}, FlowLayout.LEFT, 24)); - return content; + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{allowDecimalsCheckBox, null }, + new Component[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"})), decimalLength }, + new Component[]{allowNegativeCheckBox, null}, + new Component[]{setMaxValueCheckBox, maxValueSpinner}, + new Component[]{setMinValueCheckBox, minValueSpinner}, + }; + double[] rowSize = {p, p, p, p, p}; + double[] columnSize = {p,f}; + int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 1); + return panel; + } + @Override protected void populateSubFieldEditorBean(NumberEditor e) { allowDecimalsCheckBox.setSelected(e.isAllowDecimals()); @@ -229,7 +241,6 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane minValueSpinner.setVisible(true); minValueSpinner.setValue(new Double(e.getMinValue())); } - this.getRegErrorMsgTextField().setText(e.getRegErrorMessage()); this.waterMarkDictPane.populate(e); } @@ -257,7 +268,6 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane this.waterMarkDictPane.update(ob); - ob.setRegErrorMessage(this.getRegErrorMsgTextField().getText()); return ob; } diff --git a/designer/src/com/fr/design/widget/ui/RadioDefinePane.java b/designer/src/com/fr/design/widget/ui/RadioDefinePane.java index 4cdcdb0345..b31c81557e 100644 --- a/designer/src/com/fr/design/widget/ui/RadioDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/RadioDefinePane.java @@ -1,12 +1,8 @@ package com.fr.design.widget.ui; import com.fr.base.FRContext; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.gui.frpane.TreeSettingPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.present.dict.DictionaryPane; -import com.fr.design.widget.DataModify; import com.fr.form.ui.Radio; import com.fr.general.FRFont; import com.fr.general.Inter; diff --git a/designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java b/designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java index d9c7ca8651..460065ba6e 100644 --- a/designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java @@ -1,16 +1,13 @@ package com.fr.design.widget.ui; -import java.awt.BorderLayout; import java.awt.FlowLayout; -import javax.swing.BorderFactory; import javax.swing.JPanel; import com.fr.design.data.DataCreatorUI; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.present.dict.DictionaryPane; import com.fr.form.ui.RadioGroup; -import com.fr.general.Inter; public class RadioGroupDefinePane extends FieldEditorDefinePane { private DictionaryPane dictPane; @@ -30,16 +27,12 @@ public class RadioGroupDefinePane extends FieldEditorDefinePane { @Override protected JPanel setFirstContentPane() { - JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - attrPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); buttonGroupDictPane = new ButtonGroupDictPane(); buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); - JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); centerPane.add(buttonGroupDictPane); - advancedPane.add(centerPane); - attrPane.add(advancedPane, BorderLayout.CENTER); - return attrPane; + return centerPane; } @Override diff --git a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java index c9128627cc..482f96c252 100644 --- a/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TextFieldEditorDefinePane.java @@ -1,16 +1,12 @@ package com.fr.design.widget.ui; import com.fr.design.gui.frpane.RegPane; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.TextEditor; import com.fr.form.ui.reg.RegExp; import com.fr.general.Inter; import com.fr.stable.StringUtils; import javax.swing.*; -import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -26,7 +22,6 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane @Override protected JPanel setFirstContentPane() { - JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); regPane = createRegPane(); final RegPane.RegChangeListener rl = new RegPane.RegChangeListener() { @@ -46,9 +41,6 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane } }; 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) { @@ -61,15 +53,19 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane regPane.getRegComboBox().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RegExp regExp = (RegExp) regPane.getRegComboBox().getSelectedItem(); - getRegErrorMsgTextField().setEnabled(regExp.errorMessageEditable()); } }); - advancedPane.add(waterMarkDictPane); - attrPane.add(advancedPane, BorderLayout.NORTH); - return attrPane; + + return waterMarkDictPane; + } + + public JPanel setValidatePane(){ + return regPane; } + + protected RegPane createRegPane() { return new RegPane(); } @@ -82,14 +78,12 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane @Override protected void populateSubFieldEditorBean(TextEditor e) { this.regPane.populate(e.getRegex()); - getRegErrorMsgTextField().setText(e.getRegErrorMessage()); waterMarkDictPane.populate(e); } @Override protected TextEditor updateSubFieldEditorBean() { TextEditor ob = newTextEditorInstance(); - ob.setRegErrorMessage(this.getRegErrorMsgTextField().getText()); ob.setRegex(this.regPane.update()); waterMarkDictPane.update(ob); diff --git a/designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java index 10210738f0..f68c45ccc1 100644 --- a/designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java @@ -50,9 +50,7 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { } protected JPanel setSecondContentPane() { - JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - advancedPane.add(contentPane); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); contentPane.add(contenter,BorderLayout.NORTH); @@ -62,7 +60,7 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { if (otherContentPane != null) { contentPane.add(otherContentPane,BorderLayout.CENTER); } - return advancedPane; + return contentPane; } protected JPanel setThirdContentPane() { diff --git a/designer/src/com/fr/design/widget/ui/UserEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/UserEditorDefinePane.java index 027cfd8dd8..d777df9745 100644 --- a/designer/src/com/fr/design/widget/ui/UserEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/UserEditorDefinePane.java @@ -1,12 +1,8 @@ package com.fr.design.widget.ui; import com.fr.base.FRContext; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.gui.frpane.TreeSettingPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.present.dict.DictionaryPane; -import com.fr.design.widget.DataModify; import com.fr.form.ui.NameWidget; import com.fr.general.FRFont; import com.fr.general.Inter; diff --git a/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java b/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java index bd73301e80..0fb1845fb6 100644 --- a/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java +++ b/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java @@ -3,7 +3,8 @@ package com.fr.design.widget.ui; import java.awt.event.KeyListener; import com.fr.design.gui.ilable.UILabel; -import javax.swing.JPanel; + +import javax.swing.*; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; @@ -16,8 +17,9 @@ public class WaterMarkDictPane extends JPanel{ public WaterMarkDictPane() { this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); + this.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); this.add(new UILabel(Inter.getLocText("WaterMark") + ":")); - waterMarkTextField = new UITextField(16); + waterMarkTextField = new UITextField(13); this.add(waterMarkTextField); } diff --git a/designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java b/designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java index 2e4a839a92..633572e0fc 100644 --- a/designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java +++ b/designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java @@ -20,9 +20,7 @@ public abstract class WriteUnableRepeatEditorPane exte protected void initComponents() { setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); + double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double rowSize[] = {p}; - double columnSize[] = {p, 184}; + double columnSize[] = {p, f}; Component[][] n_components = { - {new UILabel(Inter.getLocText(new String[]{"Form-Button", "Type"}) + ":"), createButtonTypeComboBox()} + {new UILabel(Inter.getLocText("FR-Designer_Button-Type") + ":"), createButtonTypeComboBox()}, }; - JPanel northPane = TableLayoutHelper.createTableLayoutPane(n_components, rowSize, columnSize); - JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); - advancedPane.add(northPane); - add(advancedPane, BorderLayout.CENTER); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 0, 8); + UIExpandablePane advancedPane = new UIExpandablePane("高级", 280, 20, panel); + this.add(advancedPane); + + + + +// setLayout(FRGUIPaneFactory.createBorderLayout()); +// double p = TableLayout.PREFERRED; +// double rowSize[] = {p}; +// double columnSize[] = {p, 184}; +// Component[][] n_components = { +// {new UILabel(Inter.getLocText(new String[]{"Form-Button", "Type"}) + ":"), createButtonTypeComboBox()} +// }; +// JPanel northPane = TableLayoutHelper.createTableLayoutPane(n_components, rowSize, columnSize); +// JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); +//// advancedPane.add(northPane); +// add(northPane); } @Override