diff --git a/designer/src/com/fr/poly/PolyBlockProperTable.java b/designer/src/com/fr/poly/PolyBlockProperTable.java index 9b352f56e..647427c64 100644 --- a/designer/src/com/fr/poly/PolyBlockProperTable.java +++ b/designer/src/com/fr/poly/PolyBlockProperTable.java @@ -1,17 +1,66 @@ package com.fr.poly; -import java.util.ArrayList; - -import javax.swing.table.TableModel; - -import com.fr.design.gui.itable.AbstractPropertyTable; -import com.fr.design.gui.itable.PropertyGroup; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.mainframe.widget.BasicPropertyPane; +import com.fr.design.widget.WidgetBoundsPaneFactory; +import com.fr.general.Inter; import com.fr.poly.group.PolyBoundsGroup; -import com.fr.poly.group.PolyNameGroup; import com.fr.report.poly.TemplateBlock; -public class PolyBlockProperTable extends AbstractPropertyTable { +import javax.swing.*; +import java.awt.*; + +public class PolyBlockProperTable extends JPanel { private PolyDesigner designer; + private UISpinner x; + private UISpinner y; + private UISpinner width; + private UISpinner height; + private BasicPropertyPane blockPropertyPane; + private boolean isPopulating = false; + + private static final int MAX_SPINNER_VALUE = 10000; + + public PolyBlockProperTable() { + initPropertyPane(); + initListener(this); + } + + private void initPropertyPane() { + this.setLayout(new BorderLayout()); + + blockPropertyPane = new BasicPropertyPane(); + UIExpandablePane basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 280, 24, blockPropertyPane); + this.add(basicPane, BorderLayout.NORTH); + + x = new UISpinner(0, MAX_SPINNER_VALUE, 1); + y = new UISpinner(0, MAX_SPINNER_VALUE, 1); + width = new UISpinner(0, MAX_SPINNER_VALUE, 1); + height = new UISpinner(0, MAX_SPINNER_VALUE, 1); + UIExpandablePane boundsPane = WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height); + this.add(boundsPane, BorderLayout.CENTER); + } + + private void initListener(Container parentComponent) { + for (int i = 0; i < parentComponent.getComponentCount(); i++) { + Component tmpComp = parentComponent.getComponent(i); + + if (tmpComp instanceof Container) { + initListener((Container) tmpComp); + } + if (tmpComp instanceof UIObserver) { + ((UIObserver) tmpComp).registerChangeListener(new UIObserverListener() { + @Override + public void doChange() { + update(); + } + }); + } + } + } /** * 初始化属性表 @@ -20,16 +69,16 @@ public class PolyBlockProperTable extends AbstractPropertyTable { * */ public void initPropertyGroups(Object source) { - groups = new ArrayList(); if (source instanceof TemplateBlock) { TemplateBlock block = (TemplateBlock) source; - PolyNameGroup namegroup = new PolyNameGroup(block); - groups.add(new PropertyGroup(namegroup)); - PolyBoundsGroup boundsgroup = new PolyBoundsGroup(block, designer.getTarget()); - groups.add(new PropertyGroup(boundsgroup)); + blockPropertyPane.getWidgetNameField().setText(block.getBlockName()); + final PolyBoundsGroup boundsgroup = new PolyBoundsGroup(block, designer.getTarget()); + + x.setValue((int)boundsgroup.getValue(0, 1)); + y.setValue((int)boundsgroup.getValue(1, 1)); + width.setValue((int)boundsgroup.getValue(2, 1)); + height.setValue((int)boundsgroup.getValue(3, 1)); } - TableModel model = new BeanTableModel(); - setModel(model); this.repaint(); } @@ -42,8 +91,23 @@ public class PolyBlockProperTable extends AbstractPropertyTable { } public void populate(PolyDesigner designer) { + isPopulating = true; this.designer = designer; initPropertyGroups(this.designer.getEditingTarget()); + isPopulating = false; } + public void update() { + TemplateBlock block = this.designer.getEditingTarget(); + if (isPopulating || block == null) { + return; + } + block.setBlockName(blockPropertyPane.getWidgetNameField().getText()); + PolyBoundsGroup boundsgroup = new PolyBoundsGroup(block, designer.getTarget()); + boundsgroup.setValue(x.getValue(), 0, 1); + boundsgroup.setValue(y.getValue(), 1, 1); + boundsgroup.setValue(width.getValue(), 2, 1); + boundsgroup.setValue(height.getValue(), 3, 1); + firePropertyEdit(); + } } \ No newline at end of file diff --git a/designer/src/com/fr/poly/creator/ECBlockEditor.java b/designer/src/com/fr/poly/creator/ECBlockEditor.java index eff054dfb..84911ccf5 100644 --- a/designer/src/com/fr/poly/creator/ECBlockEditor.java +++ b/designer/src/com/fr/poly/creator/ECBlockEditor.java @@ -143,6 +143,7 @@ public class ECBlockEditor extends BlockEditor { } QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor()); CellElementPropertyPane.getInstance().populate(editComponent); + CellWidgetPropertyPane.getInstance().populate(editComponent); Selection Selection = ((JWorkBook) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())).getEditingElementCasePane().getSelection(); if (Selection instanceof FloatSelection) { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT); @@ -155,6 +156,7 @@ public class ECBlockEditor extends BlockEditor { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT); EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance()); + EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(CellWidgetPropertyPane.getInstance()); } EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); diff --git a/designer_base/src/com/fr/design/constants/UIConstants.java b/designer_base/src/com/fr/design/constants/UIConstants.java index 3945e756f..46a883ab1 100644 --- a/designer_base/src/com/fr/design/constants/UIConstants.java +++ b/designer_base/src/com/fr/design/constants/UIConstants.java @@ -86,7 +86,8 @@ public interface UIConstants { public static final Color AUTHORITY_SHEET_DARK = new Color(86, 120, 143); public static final Color AUTHORITY_SHEET_LIGHT = new Color(156, 204, 238); public static final Color AUTHORITY_SHEET_UNSELECTED = new Color(146, 192, 225); - public static final Color ATTRIBUTE_PRESS = new Color(0xD8F2FD); + public static final Color ATTRIBUTE_PRESS = new Color(0x419BF9); + public static final Color NORMAL_BLUE = new Color(0x419BF9); public static final Color ATTRIBUTE_NORMAL = new Color(0xDADADD); public static final Color ATTRIBUTE_HOVER = new Color(0xC9C9CD); public static final Color CHECKBOX_HOVER_SELECTED = new Color(0x3394f0); diff --git a/designer_base/src/com/fr/design/data/datapane/TableDataTree.java b/designer_base/src/com/fr/design/data/datapane/TableDataTree.java index bb8553d30..8082d8c1e 100644 --- a/designer_base/src/com/fr/design/data/datapane/TableDataTree.java +++ b/designer_base/src/com/fr/design/data/datapane/TableDataTree.java @@ -74,7 +74,7 @@ public class TableDataTree extends UserObjectRefreshJTree { dim.height += 2; this.setSize(dim); this.setPreferredSize(dim); - this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND); + this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND); this.setForeground(UIConstants.FONT_COLOR); this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); return this; diff --git a/designer_base/src/com/fr/design/gui/frpane/UITabbedPaneUI.java b/designer_base/src/com/fr/design/gui/frpane/UITabbedPaneUI.java index c1b843355..342fc6e46 100644 --- a/designer_base/src/com/fr/design/gui/frpane/UITabbedPaneUI.java +++ b/designer_base/src/com/fr/design/gui/frpane/UITabbedPaneUI.java @@ -30,7 +30,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI { private int addY = -1; private int rollover = -1; private Color tabBorderColor = new Color(143, 160, 183); - private Color[] tabSelectedColor = {new Color(255, 199, 59), new Color(187, 142, 33), new Color(214, 191, 137)}; + private Color[] tabSelectedColor = {UIConstants.NORMAL_BLUE, new Color(187, 142, 33), new Color(214, 191, 137)}; /** * 创建UI对象 diff --git a/designer_base/src/com/fr/design/gui/ibutton/UIRadioButton.java b/designer_base/src/com/fr/design/gui/ibutton/UIRadioButton.java index 40a0b8e8a..8c93e76f4 100644 --- a/designer_base/src/com/fr/design/gui/ibutton/UIRadioButton.java +++ b/designer_base/src/com/fr/design/gui/ibutton/UIRadioButton.java @@ -43,6 +43,4 @@ public class UIRadioButton extends JRadioButton { public UIRadioButton(String text, Icon icon, boolean selected) { super(text, icon, selected); } - - } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index d6f90cadb..3e146ad18 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2116,3 +2116,5 @@ FR-Designer_Widget_Error_Tip=error tip FR-Designer_Widget_Return_Leaf=return leaf FR-Designer_Widget_Return_Path=return path FR-Designer_Widget_Display_Position=Display Position +FR-Designer_Widget_Name=Widget Name +FR-Designer_Coords_And_Size=Coords & Size diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 0d44c3036..1009ae9c5 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -2111,4 +2111,6 @@ FR-Designer_Widget_No_Repeat=no repeat FR-Designer_Widget_Error_Tip=error tip FR-Designer_Widget_Return_Leaf=return leaf FR-Designer_Widget_Return_Path=return path -FR-Designer_Widget_Display_Position=Display Position \ No newline at end of file +FR-Designer_Widget_Display_Position=Display Position +FR-Designer_Widget_Name=Widget Name +FR-Designer_Coords_And_Size=Coords & Size \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index f456a229b..2d51d39b0 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -2115,3 +2115,5 @@ FR-Designer_Widget_Error_Tip= FR-Designer_Widget_Return_Leaf= FR-Designer_Widget_Return_Path= FR-Designer_Widget_Display_Position= +FR-Designer_Widget_Name= +FR-Designer_Coords_And_Size= diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index 444d54824..25c8d5561 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties @@ -2115,3 +2115,5 @@ FR-Designer_Widget_Error_Tip= FR-Designer_Widget_Return_Leaf= FR-Designer_Widget_Return_Path= FR-Designer_Widget_Display_Position= +FR-Designer_Widget_Name= +FR-Designer_Coords_And_Size= diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 0ec66bd02..7e6e315fa 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -2123,3 +2123,5 @@ FR-Designer_Widget_Error_Tip=\u9519\u8BEF\u63D0\u793A FR-Designer_Widget_Return_Leaf=\u7ED3\u679C\u8FD4\u56DE\u53F6\u5B50\u8282\u70B9 FR-Designer_Widget_Return_Path=\u7ED3\u679C\u8FD4\u56DE\u5B8C\u6574\u5C42\u6B21\u8DEF\u5F84 FR-Designer_Widget_Display_Position=\u663E\u793A\u4F4D\u7F6E +FR-Designer_Widget_Name=\u63A7\u4EF6\u540D\u79F0 +FR-Designer_Coords_And_Size=\u5750\u6807\u00B7\u5C3A\u5BF8 diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 23af4dafa..b659521c3 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -2114,4 +2114,6 @@ FR-Designer_Widget_No_Repeat= FR-Designer_Widget_Error_Tip= FR-Designer_Widget_Return_Leaf= FR-Designer_Widget_Return_Path= -FR-Designer_Widget_Display_Position= \ No newline at end of file +FR-Designer_Widget_Display_Position= +FR-Designer_Widget_Name= +FR-Designer_Coords_And_Size= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java b/designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java new file mode 100644 index 000000000..1c5c9009c --- /dev/null +++ b/designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java @@ -0,0 +1,50 @@ +package com.fr.design.mainframe.widget; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by plough on 2017/8/7. + */ +public class BasicPropertyPane extends BasicPane { + protected UITextField widgetName; + + public BasicPropertyPane(){ + initContentPane(); + } + + protected void initContentPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + widgetName = new UITextField(); + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Name")), widgetName}, + }; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); + panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15)); + this.add(panel, BorderLayout.NORTH); + } + + public UITextField getWidgetNameField() { + return widgetName; + } + + + @Override + public String title4PopupWindow() { + return "basicProperty"; + } +} diff --git a/designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java b/designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java new file mode 100644 index 000000000..4c5cc5907 --- /dev/null +++ b/designer_base/src/com/fr/design/widget/WidgetBoundsPaneFactory.java @@ -0,0 +1,52 @@ +package com.fr.design.widget; + +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by plough on 2017/8/7. + */ +public class WidgetBoundsPaneFactory { + + public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height}, + new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)}, + }; + double[] rowSize = {p, p}; + double[] columnSize = {p, f, f}; + int[][] rowCount = {{1, 1, 1}, {1, 1, 1}}; + final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5); + panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15)); + + return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 280, 24, panel); + } + + public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) { + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Position")), x, y}, + new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_X_Coordinate"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Y_Coordinate"), SwingConstants.CENTER)}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height}, + new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)}, + }; + double[] rowSize = {p, p, p, p}; + double[] columnSize = {p, f, f}; + int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; + final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5); + panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15)); + + return new UIExpandablePane(Inter.getLocText("FR-Designer_Coords_And_Size"), 230, 24, panel); + } +} diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index 342892384..7979e7ae3 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -11,6 +11,7 @@ import javax.swing.plaf.basic.*; import javax.swing.plaf.metal.*; import javax.swing.tree.*; +import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.*; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; @@ -221,7 +222,7 @@ class TreePopup extends JPopupMenu implements ComboPopup{ JTree tree = this.comboBox.getTree(); if(tree != null){ scrollPane = new UIScrollPane(tree); - scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); + scrollPane.setBorder(null); add(scrollPane, BorderLayout.CENTER); } } @@ -230,6 +231,8 @@ class TreePopup extends JPopupMenu implements ComboPopup{ updatePopup(); show(comboBox, 0, comboBox.getHeight()); comboBox.getTree().requestFocus(); + comboBox.getTree().setBackground(UIConstants.TREE_BACKGROUND); + comboBox.getTree().setOpaque(true); } public void hide(){ diff --git a/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java b/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java index 22cbd0eb9..42d398416 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java +++ b/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicPropertyPane.java @@ -1,49 +1,12 @@ package com.fr.design.mainframe.widget.ui; -import com.fr.design.dialog.BasicPane; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.BasicPropertyPane; import com.fr.form.ui.Widget; -import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.*; /** * Created by ibm on 2017/8/4. */ -public class FormBasicPropertyPane extends BasicPane { - private UITextField widgetName; - - public FormBasicPropertyPane(){ - initContentPane(); - } - - protected void initContentPane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - widgetName = new UITextField(); - - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("Form-Widget_Name") + ":"), widgetName}, - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 20, 7); - panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - this.add(panel, BorderLayout.NORTH); - } - - - @Override - public String title4PopupWindow() { - return "basicProperty"; - } +public class FormBasicPropertyPane extends BasicPropertyPane { public void populate(Widget widget) { widgetName.setText(widget.getWidgetName()); diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java index 975e224d2..7cf0493de 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java @@ -3,15 +3,10 @@ package com.fr.design.widget.ui.designer.component; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteLayout; -import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.widget.WidgetBoundsPaneFactory; import com.fr.form.ui.container.WAbsoluteLayout; -import com.fr.general.Inter; -import javax.swing.*; import java.awt.*; /** @@ -26,32 +21,14 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { super(source); XLayoutContainer xLayoutContainer = getParent(source); this.parent = (XWAbsoluteLayout) xLayoutContainer; - } public void initBoundPane() { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; x = new UISpinner(0, 1200, 1); y = new UISpinner(0, 1200, 1); - width = new UISpinner(0, 1200, 1); height = new UISpinner(0, 1200, 1); - - Component[][] components = new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("FR-Designer_Widget_Position")), x, y}, - new Component[]{null, new UILabel(Inter.getLocText("FR-Designer_X_Coordinate"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer_Y_Coordinate"), SwingConstants.CENTER)}, - new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height}, - new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)}, - }; - double[] rowSize = {p, p, p, p}; - double[] columnSize = {p, f, f}; - int[][] rowCount = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}}; - final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5); - panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - - UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("Form-Component_Bounds"), 280, 20, panel); - this.add(uiExpandablePane); + this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height)); } diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index 83d3f4ac7..da5334cc2 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -2,15 +2,10 @@ package com.fr.design.widget.ui.designer.component; import com.fr.design.designer.creator.*; import com.fr.design.dialog.BasicPane; -import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; 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.design.widget.WidgetBoundsPaneFactory; -import javax.swing.*; import java.awt.*; /** @@ -36,25 +31,10 @@ public class WidgetBoundPane extends BasicPane { return container; } - public void initBoundPane() { - - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; width = new UISpinner(0, 1200, 1); height = new UISpinner(0, 1200, 1); - Component[][] components = new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("FR-Designer-Widget_Size")), width, height}, - new Component[]{null, new UILabel(Inter.getLocText("FR-Designer-Tree_Width"), SwingConstants.CENTER), new UILabel(Inter.getLocText("FR-Designer-Tree_Height"), SwingConstants.CENTER)}, - }; - double[] rowSize = {p, p}; - double[] columnSize = {p, f, f}; - int[][] rowCount = {{1, 1, 1}, {1, 1, 1}}; - final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 8, 5); - panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - - UIExpandablePane uiExpandablePane = new UIExpandablePane("尺寸", 280, 20, panel); - this.add(uiExpandablePane); + this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height)); }