diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java index b541811f8f..1ca238934e 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java @@ -395,7 +395,7 @@ public class FineUIUtils { UILabel label = new UILabel(title); wrapBoldLabelWithUnderline(label); return column(LayoutConstants.VERTICAL_GAP, - cell(label), cell(component) + cell(label), cell(component).weight(1.0) ).getComponent(); } diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionManagerPane.java b/designer-base/src/main/java/com/fr/design/formula/FunctionManagerPane.java index 9ce8a75a68..559539d940 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionManagerPane.java @@ -1,5 +1,6 @@ package com.fr.design.formula; +import com.fine.theme.icon.LazyIcon; import com.fr.base.svg.IconUtils; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.tabledata.tabledatapane.ClassNameSelectPane; @@ -101,7 +102,7 @@ public class FunctionManagerPane extends BasicPane { @Override public NameableCreator[] createNameableCreators() { NameableCreator funcDef = new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function"), - IconUtils.readIcon("com/fr/design/images/server/global_param.svg"), + new LazyIcon("function_manage"), FunctionDef.class, FunctionContentPane.class); return new NameableCreator[]{funcDef}; diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/NameableSelfCreator.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/NameableSelfCreator.java index 4b06b74ca4..ccd7ecb45f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/NameableSelfCreator.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/NameableSelfCreator.java @@ -4,6 +4,8 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ilist.ListModelElement; import com.fr.stable.Nameable; +import javax.swing.Icon; + public abstract class NameableSelfCreator extends AbstractNameableCreator { @@ -15,6 +17,10 @@ public abstract class NameableSelfCreator extends AbstractNameableCreator { super(menuName, iconPath, clazz, updatePane); } + public NameableSelfCreator(String menuName, Icon icon, Class clazz, Class updatePane) { + super(menuName, icon, clazz, updatePane); + } + @Override public void saveUpdatedBean(ListModelElement wrapper, Object bean) { wrapper.wrapper = (Nameable)bean; diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/ObjectProperiesPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/ObjectProperiesPane.java index de904f5a45..49aae6316e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/ObjectProperiesPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/ObjectProperiesPane.java @@ -1,5 +1,8 @@ package com.fr.design.gui.frpane; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; import com.fr.base.BaseUtils; import com.fr.design.beans.BasicBeanPane; import com.fr.design.editor.ValueEditorPane; @@ -19,6 +22,8 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Iterator; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.cell; public class ObjectProperiesPane extends BasicBeanPane { private UIButton addButton; @@ -27,11 +32,13 @@ public class ObjectProperiesPane extends BasicBeanPane { public ObjectProperiesPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - + this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); JPanel buttonPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.addButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add") + " " +com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property")); + this.addButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add") + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property"), + new LazyIcon("add")); buttonPane.add(this.addButton, BorderLayout.WEST); - this.add(buttonPane, BorderLayout.NORTH); + buttonPane.setPreferredSize(new Dimension(0, 24)); + //this.add(buttonPane, BorderLayout.NORTH); this.addButton.addActionListener(new ActionListener() { @Override @@ -52,8 +59,13 @@ public class ObjectProperiesPane extends BasicBeanPane { selectedItemScrollPane.setViewportView(northPane); selectedItemScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); JPanel centerPane = new JPanel(new BorderLayout()); + centerPane.setBorder(new FineRoundBorder()); centerPane.add(selectedItemScrollPane); - this.add(centerPane, BorderLayout.CENTER); + //this.add(centerPane, BorderLayout.CENTER); + this.add(column(4, + cell(buttonPane).weight(92), + cell(centerPane).weight(465) + ).getComponent()); } @Override diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java index 57db2f06f5..fd1d7355f7 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -291,7 +291,6 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json index 7c2dc2fbf8..6a1eef0853 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json @@ -299,6 +299,7 @@ "text_field": "widget/text_field.svg", "widget_tree": "widget/tree.svg", "user_widget": "widget/user_widget.svg", - "advanced_editor": "param/advanced_editor.svg" + "advanced_editor": "param/advanced_editor.svg", + "function_manage": "function_manage.svg" } } diff --git a/designer-realize/src/main/java/com/fr/design/report/WriteShortCutsPane.java b/designer-realize/src/main/java/com/fr/design/report/WriteShortCutsPane.java index 827d784db3..b896fd4cbe 100644 --- a/designer-realize/src/main/java/com/fr/design/report/WriteShortCutsPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/WriteShortCutsPane.java @@ -18,15 +18,13 @@ import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.flex; public class WriteShortCutsPane extends JPanel{ private static final int V_GAP = 20; @@ -54,7 +52,7 @@ public class WriteShortCutsPane extends JPanel{ JPanel contentPane = new JPanel(new BorderLayout()); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); - contentPane.add(column( + contentPane.add(column(20, cell(FineUIUtils.wrapComponentWithTitle(getFeatureNamePane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Shortcut_Set"))), cell(FineUIUtils.wrapComponentWithTitle(getHintsPane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"))) ).getComponent()); @@ -64,26 +62,22 @@ public class WriteShortCutsPane extends JPanel{ private JPanel getFeatureNamePane(){ JPanel featureNamePane = new JPanel(new BorderLayout()); - - UILabel name = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Feature_Name"), SwingConstants.CENTER); + featureNamePane.setBorder(BorderFactory.createEmptyBorder(16, 0, 0, 0)); + UILabel name = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Feature_Name"), SwingConstants.RIGHT); UILabel nextCol = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Next_Column"), SwingConstants.CENTER); UILabel nextRow = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Next_Row"), SwingConstants.CENTER); - UILabel shortName = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Current_Keys"), SwingConstants.CENTER); + UILabel shortName = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Current_Keys"), SwingConstants.RIGHT); UIComponentUtils.setLineWrap(shortName, MAX_LABEL_WIDTH); nextColHK = new UILabel(nextColString, SwingConstants.CENTER); JPanel switchBtnPane = getSwitchBtnPane(); nextRowHK = new UILabel(nextRowString, SwingConstants.CENTER); - JPanel centerPane = new JPanel(new GridLayout(2, 4, 0, 0)); - centerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - centerPane.add(name); - centerPane.add(nextCol); - centerPane.add(new JPanel()); - centerPane.add(nextRow); - centerPane.add(shortName); - centerPane.add(nextColHK); - centerPane.add(switchBtnPane); - centerPane.add(nextRowHK); + JPanel centerPane = new JPanel(new BorderLayout()); + centerPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + centerPane.add(column(24, + row(10, cell(name).weight(0.13), cell(nextCol).weight(0.15), cell(new JPanel()).weight(0.12), cell(nextRow).weight(0.15), flex(0.45)), + row(10, cell(shortName).weight(0.13), cell(nextColHK).weight(0.15), cell(switchBtnPane).weight(0.12), cell(nextRowHK).weight(0.15), flex(0.45)) + ).getComponent()); featureNamePane.add(centerPane, BorderLayout.CENTER); @@ -105,23 +99,21 @@ public class WriteShortCutsPane extends JPanel{ private JPanel getHintsPane(){ JPanel hintsPane = new JPanel(new BorderLayout()); + hintsPane.setBorder(BorderFactory.createEmptyBorder(16, 0, 0, 0)); - UILabel systemDefault = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_System_Default"), SwingConstants.CENTER); + UILabel systemDefault = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_System_Default"), SwingConstants.RIGHT); UILabel preColText = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Previous_Column"), SwingConstants.CENTER); UILabel preRowText = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cursor_To_Previous_Row"), SwingConstants.CENTER); - preCol = new UILabel("Shift+" + nextColString, SwingConstants.CENTER); - preRow = new UILabel("Shift+" + nextRowString, SwingConstants.CENTER); + preCol = new UILabel("Shift+" + nextColString, SwingConstants.LEFT); + preRow = new UILabel("Shift+" + nextRowString, SwingConstants.LEFT); - JPanel centerPane = new JPanel(new GridLayout(2, 3, 0, V_GAP)); - centerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 100)); + JPanel centerPane = new JPanel(new BorderLayout()); + centerPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - centerPane.add(systemDefault); - centerPane.add(preColText); - centerPane.add(preCol); - - centerPane.add(new JPanel()); - centerPane.add(preRowText); - centerPane.add(preRow); + centerPane.add(column(24, + row(10, cell(systemDefault).weight(0.13), cell(preColText).weight(0.24), cell(preCol).weight(0.14), flex(0.64)), + row(10, cell(new JPanel()).weight(0.13), cell(preRowText).weight(0.24), cell(preRow).weight(0.14), flex(0.64)) + ).getComponent()); hintsPane.add(centerPane, BorderLayout.CENTER); diff --git a/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java b/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java index d99058d205..6dfc1a51d4 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java @@ -1,15 +1,12 @@ package com.fr.design.widget; -import com.formdev.flatlaf.util.ScaledEmptyBorder; -import com.fr.design.border.FineBorderFactory; +import com.fr.design.constants.UIConstants; import com.fr.design.data.DataCreatorUI; import com.fr.design.dialog.AttrScrollPane; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.frpane.FineTabbedPane; import com.fr.design.gui.ibutton.UIHeadGroup; -import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.widget.mobile.WidgetMobilePane; @@ -17,15 +14,12 @@ import com.fr.design.widget.ui.BasicWidgetPropertySettingPane; import com.fr.form.event.Listener; import com.fr.form.ui.Widget; +import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.CardLayout; import java.util.ArrayList; -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.fix; - /* * carl :单独弄出来 */ @@ -36,7 +30,9 @@ public class CellWidgetCardPane extends BasicPane { private WidgetMobilePane currentWidgetMobilePane; //属性配置切换面板 private ArrayList paneList; - private FineTabbedPane tabsPane; + private JPanel center; + private UIHeadGroup tabsHeaderIconPane; + private CardLayout tabbedPane; private BasicWidgetPropertySettingPane widgetPropertyPane; //通用属性容器 @@ -64,25 +60,29 @@ public class CellWidgetCardPane extends BasicPane { this.removeAll(); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")}; + tabbedPane = new CardLayout(); + center = new JPanel(tabbedPane); + this.add(center, BorderLayout.CENTER); // 属性 attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + BasicScrollPane basicScrollPane = new AttrScrollPane() { + @Override + protected JPanel createContentPane() { + return attriTabPane; + } + }; widgetPropertyPane = new BasicWidgetPropertySettingPane(); - UIExpandablePane basicPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"), 280, 24, widgetPropertyPane); + UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"), 280, 24, widgetPropertyPane); + attriTabPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); + attriTabPane.add(uiExpandablePane, BorderLayout.NORTH); attriCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); + attriTabPane.add(attriCardPane, BorderLayout.CENTER); attriCardLayout = (CardLayout) attriCardPane.getLayout(); - attriTabPane.add(column( - cell(basicPane), - fix(1).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())), - cell(attriCardPane) - ).getComponent() - ); - // 事件 eventTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + eventTabPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); eventPane = initWidgetEventPane(pane); eventTabPane.add(eventPane, BorderLayout.CENTER); @@ -91,25 +91,28 @@ public class CellWidgetCardPane extends BasicPane { mobileCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); mobileTabPane.add(mobileCardPane, BorderLayout.CENTER); mobileCardLayout = (CardLayout) mobileCardPane.getLayout(); - tabsPane = FineTabbedPane.builder() - .addTab(tabTitles[0], new UIScrollPane(attriTabPane)) - .addTab(tabTitles[1], eventTabPane) - .addTab(tabTitles[2], mobileTabPane) - .build(); - JPanel wrapperPane = new JPanel(new BorderLayout()); - wrapperPane.add(tabsPane, BorderLayout.CENTER); - wrapperPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 10)); - wrapperPane.setOpaque(false); - this.add(wrapperPane, BorderLayout.CENTER); + center.add(basicScrollPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute")); + center.add(eventTabPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event")); + center.add(mobileTabPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")); initPaneList(); + + final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")}; + tabsHeaderIconPane = new UIHeadGroup(tabTitles) { + @Override + public void tabChanged(int index) { + tabbedPane.show(center, tabTitles[index]); + } + }; + tabsHeaderIconPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIConstants.SHADOW_GREY)); + this.add(tabsHeaderIconPane, BorderLayout.NORTH); } private void initPaneList() { paneList = new ArrayList(); paneList.add(attriTabPane); - paneList.add(eventTabPane); + paneList.add(eventPane); paneList.add(mobileTabPane); } @@ -148,7 +151,7 @@ public class CellWidgetCardPane extends BasicPane { currentWidgetMobilePane = mobilePane; - //tabsHeaderIconPane.setSelectedIndex(0); + tabsHeaderIconPane.setSelectedIndex(0); } public Widget update() { diff --git a/designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java b/designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java index 38316cbd76..b941b02efa 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java @@ -15,11 +15,6 @@ import com.fr.form.ui.WidgetValue; import java.awt.*; -import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.row; -import static com.fine.swing.ui.layout.Layouts.flex; - public class ValueWidgetPane extends WidgetPane { private JPanel widgetValuePane; private WidgetValueEditor widgetValueEditor; @@ -32,24 +27,18 @@ public class ValueWidgetPane extends WidgetPane { public JPanel initNorthPane(){ JPanel northPane = super.initNorthPane(); - label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Value")); + label = new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Value")+ ":"); label.setVisible(false); - widgetValuePane = new JPanel(new BorderLayout()); - - JPanel centerPane = new JPanel(new BorderLayout()); - centerPane.setOpaque(false); - widgetValuePane.setOpaque(false); - centerPane.add(row( - cell(label).weight(68), - cell(widgetValuePane).weight(372)).getComponent() - ); - JPanel jPanel = new JPanel(); - jPanel.setBackground(Color.WHITE); - jPanel.setLayout(new BorderLayout()); - jPanel.add(column(10, true, - cell(northPane), - cell(centerPane) - ).getComponent()); + widgetValuePane = new JPanel(); + widgetValuePane.setLayout(FRGUIPaneFactory.createBorderLayout()); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, p, f}; + double[] rowSize = {p}; + Component[][] components = new Component[][]{ + new Component[]{northPane, label,widgetValuePane}, + }; + JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return jPanel; } diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java index 162ed117c2..3a50c38705 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java @@ -1,6 +1,5 @@ package com.fr.design.widget; -import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.WidgetDesignHandler; import com.fr.design.gui.core.WidgetOption; @@ -10,36 +9,27 @@ 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.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.CellWidgetPropertyPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.widget.btn.ButtonConstants; import com.fr.form.ui.Button; -import com.fr.form.ui.NameWidget; -import com.fr.form.ui.Widget; -import com.fr.form.ui.WidgetConfig; -import com.fr.form.ui.WidgetInfoConfig; +import com.fr.form.ui.*; import com.fr.general.ComparatorUtils; + import com.fr.stable.ArrayUtils; import com.fr.stable.AssistUtils; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JPanel; +import javax.swing.*; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; -import java.awt.Component; -import java.awt.Dimension; +import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.Vector; -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.row; -import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; -import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; - /** * CellEditorDef Pane. */ @@ -48,7 +38,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener private EditorTypeComboBox editorTypeComboBox; private CellWidgetCardPane cellEditorCardPane; private boolean shouldFireSelectedEvent = true; - private JComponent northPane; + private JPanel northPane; public WidgetPane() { this(null); @@ -68,32 +58,36 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener protected void initComponents(ElementCasePane pane) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); editorTypeComboBox = new EditorTypeComboBox(pane != null); + editorTypeComboBox.setPreferredSize(new Dimension(155, 30)); editorTypeComboBox.setMaximumRowCount(16); northPane = initNorthPane(); - northPane.setBorder(new ScaledEmptyBorder(10, 10, 0, 10)); + northPane.setBorder(BorderFactory.createEmptyBorder(12, 10, 10, 15)); + this.add(northPane, BorderLayout.NORTH); editorTypeComboBox.addItemListener(this); + cellEditorCardPane = initWidgetCardPane(pane); + this.add(cellEditorCardPane, BorderLayout.CENTER); this.addAttributeChangeListener(listener); - - this.add(column( - 10, - cell(northPane).weight(0.17), - cell(cellEditorCardPane).weight(0.83) - ).getComponent() - ); } public JPanel initNorthPane() { - - return column( - row( - cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Widget"))).weight(68), - cell(editorTypeComboBox).weight(372) - ) - ).getComponent(); + UILabel emptyLabel = new UILabel(); + emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, p, f}; + double[] rowSize = {p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Widget")), emptyLabel, editorTypeComboBox}, + }; + JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return jPanel; } protected CellWidgetCardPane initWidgetCardPane(ElementCasePane pane) { diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java index 8ba27909f2..5bd91d038d 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java @@ -1,20 +1,21 @@ package com.fr.design.widget.ui; -import com.formdev.flatlaf.util.ScaledEmptyBorder; -import com.fr.design.constants.LayoutConstants; -import com.fr.design.dialog.BasicPane; +import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.dialog.BasicPane; import com.fr.design.i18n.Toolkit; -import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.NoneWidget; import com.fr.form.ui.Widget; -import java.awt.BorderLayout; +import com.fr.design.utils.gui.GUICoreUtils; -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.row; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; public class BasicWidgetPropertySettingPane extends BasicPane { @@ -25,18 +26,27 @@ public class BasicWidgetPropertySettingPane extends BasicPane { public BasicWidgetPropertySettingPane() { this.setLayout(new BorderLayout()); - this.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); enableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Enabled"), true); + enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); visibleCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Form_Widget_Visible"), true); + visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); widgetNameComboBox = new ParameterTreeComboBox(); widgetNameComboBox.refreshTree(); + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Name")), widgetNameComboBox}, + new Component[]{enableCheckBox, null}, + new Component[]{visibleCheckBox, null}, + }; + double[] rowSize = {p, p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1}}; + JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1); + pane.setBorder(BorderFactory.createEmptyBorder(10,0,10,0)); + + this.add(pane, BorderLayout.CENTER); - this.add(row(LayoutConstants.HORIZONTAL_GAP, - cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Name"))).weight(0.2), - cell(widgetNameComboBox).weight(0.6), - cell(enableCheckBox).weight(0.1), - cell(visibleCheckBox).weight(0.1) - ).getComponent()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java index 454337d3f0..a5b05dbcc5 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java @@ -1,14 +1,19 @@ package com.fr.design.widget.ui; -import com.fine.theme.light.ui.FineRoundBorder; -import com.formdev.flatlaf.ui.FlatUIUtils; +import com.fr.base.FRContext; import com.fr.data.core.FormatField; -import com.fr.design.constants.LayoutConstants; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.border.UIRoundedBorder; +import com.fr.design.constants.UIConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.component.DateValuePane; import com.fr.design.widget.component.UIComboBoxNoArrow; import com.fr.design.widget.ui.designer.date.DateFormatCheckManager; @@ -17,30 +22,28 @@ import com.fr.form.ui.DateEditor; import com.fr.stable.ArrayUtils; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.plaf.BorderUIResource; +import javax.swing.*; +import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.text.SimpleDateFormat; import java.util.Date; - -import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.column; -import static com.fine.swing.ui.layout.Layouts.row; -import static com.fine.swing.ui.layout.Layouts.flex; -import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; -import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; +import java.util.Set; public class DateEditorDefinePane extends DirectWriteEditorDefinePane { - private UIButtonGroup returnTypeButtonGroup; + private UIButtonGroup returnTypeComboBox; private DateValuePane startDv; private DateValuePane endDv; private UIComboBox currentFormatComboBox; - private UILabel currentSampleLabel; - private UIButtonGroup formatButtonGroup; + private UILabel currentSamplelabel; + private UIButtonGroup fomatHeadGroup; + private static final int SAMPLE_LABEL_PADDING = 4; + public DateEditorDefinePane() { } @@ -52,22 +55,33 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date") , - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_String")}); + returnTypeComboBox = new UIButtonGroup<>(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date") , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_String")}); JPanel formatHead = createFormatHead(); - startDv = new DateValuePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_Start_Date")); - endDv = new DateValuePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_End_Date")); - UILabel returnTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")); - - return column(LayoutConstants.VERTICAL_GAP, - cell(formatHead), - cell(startDv), - cell(endDv), - cell(waterMarkDictPane), - row( - cell(returnTypeLabel).weight(LEFT_WEIGHT), cell(returnTypeButtonGroup).weight(1.4), flex(1.6) - ) - ).getComponent(); + startDv = new DateValuePane(); + endDv = new DateValuePane(); + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + UILabel formatLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Format")); + formatLabel.setVerticalAlignment(SwingConstants.TOP); + UILabel startDateLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_Start_Date")); + startDateLabel.setVerticalAlignment(SwingConstants.TOP); + UILabel endDateLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_FS_End_Date")); + endDateLabel.setVerticalAlignment(SwingConstants.TOP); + Component[][] components = new Component[][]{ + new Component[]{formatLabel, formatHead}, + new Component[]{startDateLabel, startDv}, + new Component[]{endDateLabel, endDv}, + new Component[]{waterMarkDictPane, null}, + new Component[]{extraPane, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")), returnTypeComboBox } + }; + double[] rowSize = {p, p, p, p, p, p, p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 3},{1, 1},{1, 1},{1, 1},{1, 1}, {1, 1}}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); + + + return panel; } @Override @@ -76,20 +90,20 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane refreshPreviewLabel()); - timeFormatComboBox.addActionListener(e -> refreshPreviewLabel()); + dateFormatComboBox.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + refreshPreviewLabel(); + } + }); + timeFormatComboBox.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + refreshPreviewLabel(); + } + }); final UILabel dateSampleLabel = createSamplePane(); final UILabel timeSampleLabel = createSamplePane(); + JPanel fomatHeadPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); final CardLayout cardLayout = new CardLayout(); final JPanel customPane = new JPanel(cardLayout); JPanel dateFormatPane = createFormatPane(dateFormatComboBox, dateSampleLabel); JPanel timeFormatPane = createFormatPane(timeFormatComboBox, timeSampleLabel); customPane.add(dateFormatPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date")); customPane.add(timeFormatPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")); - final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")}; - formatButtonGroup = new UIButtonGroup<>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")}); - formatButtonGroup.addChangeListener(e -> { - int newSelectedIndex = formatButtonGroup.getSelectedIndex(); - cardLayout.show(customPane, tabTitles[newSelectedIndex]); - if(newSelectedIndex == 0){ - currentFormatComboBox = dateFormatComboBox; - currentSampleLabel = dateSampleLabel; - }else{ - currentFormatComboBox = timeFormatComboBox; - currentSampleLabel = timeSampleLabel; + final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")}; + fomatHeadGroup = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Date"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_StyleFormat_Time")}); + fomatHeadGroup.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + int newSelectedIndex = fomatHeadGroup.getSelectedIndex(); + cardLayout.show(customPane, tabTitles[newSelectedIndex]); + if(newSelectedIndex == 0){ + currentFormatComboBox = dateFormatComboBox; + currentSamplelabel = dateSampleLabel; + }else{ + currentFormatComboBox = timeFormatComboBox; + currentSamplelabel = timeSampleLabel; + } + refreshPreviewLabel(); } - refreshPreviewLabel(); }); - return column(LayoutConstants.VERTICAL_GAP, - row( - cell(formatLabel).weight(LEFT_WEIGHT), cell(formatButtonGroup).weight(1.4), flex(1.6) - ), - row(flex(LEFT_WEIGHT), cell(customPane).weight(RIGHT_WEIGHT)) - ).getComponent(); + fomatHeadPane.add(fomatHeadGroup, BorderLayout.NORTH); + fomatHeadPane.add(customPane, BorderLayout.CENTER); + return fomatHeadPane; } + + private void refreshPreviewLabel() { String text = (String) currentFormatComboBox.getSelectedItem(); if (text != null && text.length() > 0) { @@ -153,15 +174,14 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane