diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java index 8c9b68cc1..77079e8fd 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java @@ -152,6 +152,11 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("h_left", "com/fine/theme/icon/cellstyle/h_left.svg"), new SvgIconSource("h_center", "com/fine/theme/icon/cellstyle/h_center.svg"), new SvgIconSource("h_right", "com/fine/theme/icon/cellstyle/h_right.svg"), + new SvgIconSource("h_justify", "com/fine/theme/icon/cellstyle/h_justify.svg"), + new SvgIconSource("h_normal", "com/fine/theme/icon/cellstyle/h_normal.svg"), + new SvgIconSource("v_top", "com/fine/theme/icon/cellstyle/v_top.svg"), + new SvgIconSource("v_center", "com/fine/theme/icon/cellstyle/v_center.svg"), + new SvgIconSource("v_bottom", "com/fine/theme/icon/cellstyle/v_bottom.svg"), new SvgIconSource("noboder", "com/fine/theme/icon/noboder.svg", true), new SvgIconSource("merge", "com/fine/theme/icon/merge/merge.svg", true), new SvgIconSource("unmerge", "com/fine/theme/icon/merge/unmerge.svg", true), @@ -174,6 +179,8 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("move_up", "com/fine/theme/icon/toolbar/move_up.svg", true), new SvgIconSource("move_left", "com/fine/theme/icon/toolbar/move_left.svg", true), new SvgIconSource("move_right", "com/fine/theme/icon/toolbar/move_right.svg", true), + new SvgIconSource("to_top", "com/fine/theme/icon/toolbar/to_top.svg", true), + new SvgIconSource("to_bottom", "com/fine/theme/icon/toolbar/to_bottom.svg", true), new SvgIconSource("tool_edit", "com/fine/theme/icon/toolbar/edit.svg", true), new SvgIconSource("tool_edit_white", "com/fine/theme/icon/toolbar/edit_white.svg", true), new SvgIconSource("tool_more", "com/fine/theme/icon/toolbar/more.svg", true), @@ -188,6 +195,8 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("param_hide_pressed", "com/fine/theme/icon/param/hide_pressed.svg", true, 24), new SvgIconSource("param_view", "com/fine/theme/icon/param/view.svg", true, 18), new SvgIconSource("param", "com/fine/theme/icon/param/param.svg", true), + new SvgIconSource("locked", "com/fine/theme/icon/lock/locked.svg", true, 16), + new SvgIconSource("unlocked", "com/fine/theme/icon/lock/unlocked.svg", true, 16), // 北区菜单栏 //文件 @@ -304,6 +313,7 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("move", "com/fine/theme/icon/filetree/move.svg", true), new SvgIconSource("monochrome_copy", "com/fine/theme/icon/filetree/monochrome_copy.svg", true), new SvgIconSource("monochrome_paste", "com/fine/theme/icon/filetree/monochrome_paste.svg", true), + new SvgIconSource("monochrome_cut", "com/fine/theme/icon/filetree/monochrome_cut.svg", true), // 控件 new SvgIconSource("button", "com/fine/theme/icon/widget/button.svg", true), diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java index 873c0e4ed..8fd013916 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java @@ -29,6 +29,8 @@ public interface FineUIStyle { String BUTTON_TAB_ACTION = "tabAction"; String LABEL_BOLD = "boldLabel"; String LABEL_TIP = "tipLabel"; + String PLAIN_BUTTON = "plainButton"; + String TOGGLE_GROUP = "inToggleGroup"; String MENU_TOOL_BAR = "menuToolBar"; String MENU_ITEM_TOOL_BAR = "menuItemToolBar"; diff --git a/designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java b/designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java index fbb602db3..3b31822b6 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java @@ -1,6 +1,5 @@ package com.fr.design.dialog; -import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.iscrollbar.UIScrollBar; @@ -178,7 +177,7 @@ public abstract class BasicScrollPane extends BasicBeanPane{ int width = parent.getWidth(); int height = parent.getHeight(); if (leftcontentPane.getPreferredSize().height > maxheight && scrollBar.isVisible()) { - leftcontentPane.setBounds(0, -beginY, width - scrollBar.getWidth() + getOverWidth() - DET_WIDTH_OVER_HEIGHT, height + beginY); + leftcontentPane.setBounds(0, -beginY, width - scrollBar.getWidth(), height + beginY); scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height); } else { int hideBarWidth = hideBarWidth() ? scrollBar.getWidth() : 0; @@ -211,7 +210,6 @@ public abstract class BasicScrollPane extends BasicBeanPane{ this.setLayout(new BarLayout()); this.add(scrollBar); leftcontentPane = pane; - leftcontentPane.setBorder(new ScaledEmptyBorder(0, 6, 0, 6)); this.add(leftcontentPane); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java index 2f73936c7..594a21ac5 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java @@ -148,6 +148,8 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S toolbarDef.addShortCut(sj.getShortCut()); } toolBar = ToolBarDef.createJToolBar(); + toolBar.setBorder(FineBorderFactory.createUnderlineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.GRAY))); + toolBar.setBorderPainted(true); toolbarDef.updateToolBar(toolBar); } @@ -163,8 +165,6 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S } initToolBar(); - toolBar.setBorder(FineBorderFactory.createUnderlineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.GRAY))); - toolBar.setBorderPainted(true); leftPane.add(toolBar, BorderLayout.NORTH); return leftPane; } diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index 2ed774966..16ebf0ff6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -4,6 +4,7 @@ import com.fine.theme.light.ui.FineButtonBorder; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory; @@ -33,10 +34,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.Frame; -import java.awt.Graphics; -import java.awt.Graphics2D; import java.awt.GraphicsEnvironment; import java.awt.Point; import java.awt.Rectangle; @@ -83,7 +81,7 @@ public abstract class UIControlPane extends JControlPane { if (isNewStyle()) { createPopupEditDialog(cardPane); this.add(getLeftPane(), BorderLayout.CENTER); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 15, 10)); + this.setBorder(new ScaledEmptyBorder(10, 10, 15, 10)); } else { // 增加边框 JPanel leftPaneWrapper = new JPanel(new BorderLayout()); @@ -143,7 +141,7 @@ public abstract class UIControlPane extends JControlPane { ShortCut addItem = shortCutFactory.addItemShortCut().getShortCut(); addItem.intoJToolBar(topToolBar); JPanel leftTopPane = getLeftTopPane(topToolBar); - leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + leftTopPane.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); leftPane.add(leftTopPane, BorderLayout.NORTH); return leftPane; diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java index 581c101ed..a9c03a6ee 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java @@ -10,10 +10,8 @@ import com.fr.form.event.Listener; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; -import javax.swing.BorderFactory; import javax.swing.DefaultListModel; import javax.swing.JPanel; -import javax.swing.UIManager; import javax.swing.ListSelectionModel; import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; @@ -77,7 +75,6 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon nameableList = createJNameList(); nameableList.setName(LIST_NAME); UIScrollPane scrollPane = new UIScrollPane(nameableList); - scrollPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIManager.getColor("defaultBorderColor"))); leftPane.add(scrollPane, BorderLayout.CENTER); leftPane.setBorder(new FineRoundBorder()); diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java index 8a1e5020e..cb4ff46cd 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java @@ -1,5 +1,7 @@ package com.fr.design.gui.controlpane; +import com.fine.theme.light.ui.FineRoundBorder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.beans.BasicBeanPane; import com.fr.design.constants.UIConstants; import com.fr.design.gui.icontainer.UIScrollPane; @@ -19,7 +21,6 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.DefaultListModel; import javax.swing.JPanel; import javax.swing.ListModel; @@ -80,6 +81,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li @Override protected void initLeftPane(JPanel leftPane) { leftPane.add(new UIScrollPane(contentPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 0)), BorderLayout.CENTER); + leftPane.setBorder(new FineRoundBorder()); } @@ -539,13 +541,11 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li super.paint(g); } }; - label.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); + label.setBorder(new ScaledEmptyBorder(0, 8, 0, 0)); label.setOpaque(true); label.setBackground(Color.WHITE); label.setForeground(UIManager.getColor("List.wrapper.text.fontColor")); label.setFont(label.getFont().deriveFont(11F)); - //预留 10px 的纵向滚动条的宽度 - label.setPreferredSize(new Dimension(214, 26)); this.nameEdList = nameEdList; this.add(label, BorderLayout.NORTH); this.add(this.nameEdList, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java index 29c8c0602..79c96067f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UISimpleListControlPane.java @@ -1,6 +1,6 @@ package com.fr.design.gui.controlpane; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; @@ -230,8 +230,7 @@ public class UISimpleListControlPane extends BasicPane { public MoveUpItemAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Up")); this.setMnemonic('U'); - this.setSmallIcon(BaseUtils - .readIcon("/com/fr/design/images/control/up.png")); + this.setSmallIcon(new LazyIcon("move_up")); } @Override @@ -263,8 +262,7 @@ public class UISimpleListControlPane extends BasicPane { public MoveDownItemAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Down")); this.setMnemonic('D'); - this.setSmallIcon(BaseUtils - .readIcon("/com/fr/design/images/control/down.png")); + this.setSmallIcon(new LazyIcon("move_down")); } @Override @@ -294,8 +292,7 @@ public class UISimpleListControlPane extends BasicPane { public SortItemAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Sort")); this.setMnemonic('S'); - this.setSmallIcon(BaseUtils - .readIcon("/com/fr/design/images/control/sortAsc.png")); + this.setSmallIcon(new LazyIcon("sort_desc")); } @Override @@ -423,7 +420,7 @@ public class UISimpleListControlPane extends BasicPane { private void initComponents() { label = new UILabel(); - label.setBorder(BorderFactory.createEmptyBorder(3, 10, 3, 0)); +// label.setBorder(BorderFactory.createEmptyBorder(3, 10, 3, 0)); initialLabelForeground = label.getForeground(); this.setLayout(new BorderLayout()); this.add(label, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java b/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java index 4a9c4cee3..4cbbe0159 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java @@ -5,6 +5,7 @@ package com.fr.design.gui.style; */ import com.fine.swing.ui.layout.Layouts; +import com.fine.theme.icon.LazyIcon; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.base.Style; @@ -91,18 +92,18 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO initTextRotationComboBox(); // todo: 换新图标及反白问题 - Icon[][] hAlignmentIconArray = {{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png")}, - {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png")}, - {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")}, - {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal_white.png")}, - {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment_white.png")}}; + Icon[][] hAlignmentIconArray = {{new LazyIcon("h_left"), new LazyIcon("h_left").white()}, + {new LazyIcon("h_center"), new LazyIcon("h_center").white()}, + {new LazyIcon("h_right"), new LazyIcon("h_right").white()}, + {new LazyIcon("h_justify"), new LazyIcon("h_justify").white()}, + {new LazyIcon("h_normal"), new LazyIcon("h_normal").white()}}; Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL}; hAlignmentPane = new UIButtonGroup<>(hAlignmentIconArray, hAlignment); hAlignmentPane.setAllToolTips(new String[]{Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Left"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Right"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Distributed"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_DEFAULT")}); - Icon[][] vAlignmentIconArray = {{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal_white.png")}, - {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal_white.png")}, - {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal_white.png")}}; + Icon[][] vAlignmentIconArray = {{new LazyIcon("v_top"), new LazyIcon("v_top").white()}, + {new LazyIcon("v_center"), new LazyIcon("v_center").white()}, + {new LazyIcon("v_bottom"), new LazyIcon("v_bottom").white()}}; Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM}; vAlignmentPane = new UIButtonGroup<>(vAlignmentIconArray, vAlignment); vAlignmentPane.setAllToolTips(new String[]{Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Top"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Bottom")}); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java index 23cc188ed..30987eb29 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java @@ -1,29 +1,31 @@ package com.fr.design.mainframe.widget; -import com.fr.design.designer.IntervalConstants; +import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; 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 javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +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; + /** * Created by plough on 2017/8/7. */ public class BasicPropertyPane extends BasicPane { protected UITextField widgetName; + protected JPanel corePane; public BasicPropertyPane(){ initContentPane(); @@ -31,7 +33,9 @@ public class BasicPropertyPane extends BasicPane { protected void initContentPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + corePane = column(LayoutConstants.VERTICAL_GAP).getComponent(); + this.add(corePane, BorderLayout.CENTER); + widgetName = new UITextField() { protected void initListener() { if (shouldResponseChangeListener()) { @@ -58,17 +62,10 @@ public class BasicPropertyPane extends BasicPane { } }; widgetName.setGlobalName(Toolkit.i18nText("Fine-Design_Report_Basic")); - 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(obtainBasicName()), widgetName}, - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - this.add(panel, BorderLayout.NORTH); + + corePane.add(row( + cell(new UILabel(obtainBasicName())).weight(LEFT_WEIGHT), cell(widgetName).weight(RIGHT_WEIGHT) + ).getComponent()); } public String obtainBasicName(){ diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/editors/StringEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/editors/StringEditor.java index da7bbc619..2ba3bb7a1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/editors/StringEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/editors/StringEditor.java @@ -25,7 +25,6 @@ public class StringEditor extends AbstractPropertyEditor { panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); textField = new UITextField(); panel.add(textField, BorderLayout.CENTER); - textField.setBorder(null); textField.getDocument().addDocumentListener(new DocumentListener() { @Override diff --git a/designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java b/designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java index b35818c61..5f6674344 100644 --- a/designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java +++ b/designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java @@ -2,17 +2,11 @@ package com.fr.design.menu; import com.fr.design.actions.UpdateAction; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.mainframe.JTemplate; import org.jetbrains.annotations.Nullable; -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Graphics; -import java.awt.Graphics2D; +import java.awt.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -30,16 +24,7 @@ public class ToolBarDef { * 一个static的方法生成一个JToolBar */ public static UIToolbar createJToolBar(final Color background) { - UIToolbar toolbar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI() { - @Override - public void paint(Graphics g, JComponent c) { - Graphics2D g2 = (Graphics2D) g; - g2.setColor(background); - g2.fillRect(0, 0, c.getWidth(), c.getHeight()); - } - }); - toolbar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0)); - return toolbar; + return new UIToolbar(); } diff --git a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java index 2b2dcc532..a7013353b 100644 --- a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java @@ -1,21 +1,25 @@ package com.fr.design.widget; -import com.fr.design.designer.IntervalConstants; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; 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 javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingConstants; -import java.awt.BorderLayout; import java.awt.Component; +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.VERTICAL_GAP; +import static com.fr.design.constants.LayoutConstants.HORIZONTAL_GAP; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + /** * Created by plough on 2017/8/7. */ @@ -44,23 +48,15 @@ public class WidgetBoundsPaneFactory { } } - private static final int RIGHT_PANE_WIDTH = 145; - public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height, JComponent ratioLocked, NameAttribute nameAttribute) { - JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getSizeName()), - ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)}, - new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, - }; - double[] rowSize = {p, p}; - double[] columnSize = {f, RIGHT_PANE_WIDTH}; - int[][] rowCount = ratioLocked != null ? new int[][]{{1, 1}, {1, 1, 1}} : new int[][]{{1, 1}, {1, 1}}; - final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - boundsPane.add(panel); + final JPanel boundsPane = column(VERTICAL_GAP, + row( + cell(FRWidgetFactory.createLineWrapLabel(nameAttribute.getSizeName())).weight(LEFT_WEIGHT), + cell(ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)).weight(RIGHT_WEIGHT) + ), + cell(createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), + new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, 10, 0))).getComponent(); return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); } @@ -69,33 +65,24 @@ public class WidgetBoundsPaneFactory { } public static JPanel createRightPane(Component com1, Component com2) { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] columnSize = {f, f}; - int[][] rowCount = {{1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{com1, com2} - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L1); + return row(HORIZONTAL_GAP, + cell(com1).weight(0.5), cell(com2).weight(0.5) + ).getComponent(); } public static JPanel createRightPane(Component com1, Component com2, Component com3) { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] columnSize = {f, 24, f}; - int[][] rowCount = {{1, 1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{com1, com2, com3} - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 0, IntervalConstants.INTERVAL_L1); + if (com2 != null) { + return row( + cell(com1).weight(1), cell(com2).weight(0.3), cell(com3).weight(1) + ).getComponent(); + } + return row( + cell(com1).weight(1), flex(0.3), cell(com3).weight(1) + ).getComponent(); + } public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height, JComponent ratioLocked, NameAttribute nameAttribute) { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - UILabel positionLabel = FRWidgetFactory.createLineWrapLabel(nameAttribute.getPositionName()); UILabel xLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER); UILabel yLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER); @@ -104,24 +91,24 @@ public class WidgetBoundsPaneFactory { UILabel widthLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER); UILabel heightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER); - Component[][] northComponents = new Component[][]{ - new Component[]{positionLabel, ratioLocked != null ? createRightPane(x, null, y) : createRightPane(x, y)}, - new Component[]{null, ratioLocked != null ? createRightPane(xLabel, null, yLabel) : createRightPane(xLabel, yLabel)}, - }; - Component[][] centerComponents = new Component[][]{ - new Component[]{sizeLabel, ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)}, - new Component[]{null, ratioLocked != null ? createRightPane(widthLabel, null, heightLabel) : createRightPane(widthLabel, heightLabel)}, - }; - double[] rowSize = {p, p}; - double[] columnSize = {f, RIGHT_PANE_WIDTH}; - int[][] rowCount = ratioLocked != null ? new int[][]{{1, 1, 1}, {1, 1, 1}} : new int[][]{{1, 1}, {1, 1}}; - final JPanel northPanel = TableLayoutHelper.createGapTableLayoutPane(northComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); - final JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(centerComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); - JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - northPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - boundsPane.add(northPanel, BorderLayout.NORTH); - boundsPane.add(centerPanel, BorderLayout.CENTER); + JPanel boundsPane = column(VERTICAL_GAP, + row( + cell(positionLabel).weight(LEFT_WEIGHT), + cell(ratioLocked != null ? createRightPane(x, null, y) : createRightPane(x, y)).weight(RIGHT_WEIGHT) + ), + row( + flex(LEFT_WEIGHT), + cell(ratioLocked != null ? createRightPane(xLabel, null, yLabel) : createRightPane(xLabel, yLabel)).weight(RIGHT_WEIGHT) + ), + row( + cell(sizeLabel).weight(LEFT_WEIGHT), + cell(ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)).weight(RIGHT_WEIGHT) + ), + row( + flex(LEFT_WEIGHT), + cell(ratioLocked != null ? createRightPane(widthLabel, null, heightLabel) : createRightPane(widthLabel, heightLabel)).weight(RIGHT_WEIGHT) + ) + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, 10, 0))).getComponent(); return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 230, 24, boundsPane); } @@ -135,18 +122,11 @@ public class WidgetBoundsPaneFactory { public static UIExpandablePane createCardTagBoundPane(UISpinner width) { - JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), width}, - }; - double[] rowSize = {p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}}; - final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L6); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - boundsPane.add(panel); + final JPanel boundsPane = column(VERTICAL_GAP, + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size"))).weight(LEFT_WEIGHT), + cell(width).weight(RIGHT_WEIGHT) + ).getComponent(); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); } } diff --git a/designer-base/src/main/java/com/fr/design/widget/component/BackgroundCompPane.java b/designer-base/src/main/java/com/fr/design/widget/component/BackgroundCompPane.java index 99e642425..98e4844ad 100644 --- a/designer-base/src/main/java/com/fr/design/widget/component/BackgroundCompPane.java +++ b/designer-base/src/main/java/com/fr/design/widget/component/BackgroundCompPane.java @@ -1,20 +1,22 @@ package com.fr.design.widget.component; -import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleImgBackgroundEditor; import com.fr.form.ui.Widget; -import javax.swing.BorderFactory; import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; + +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.flex; +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; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; /** * Created by ibm on 2017/8/6. @@ -35,25 +37,30 @@ public abstract class BackgroundCompPane extends BasicPane { UILabel headLabel = createUILable(); initBackgroundEditor(); String [] titles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")}; - - double f = TableLayout.FILL; - final double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1},{1, 1},{1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Initial")), initialBackgroundEditor}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Over")), overBackgroundEditor}, - new Component[]{getClickLabel(), clickBackgroundEditor}, - }; - panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); backgroundHead = new UIButtonGroup(titles); - JPanel headPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{headLabel, backgroundHead}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1); - - this.add(headPane, BorderLayout.NORTH); - this.add(panel, BorderLayout.CENTER); + panel = column(VERTICAL_GAP, + row( + flex(LEFT_WEIGHT), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Initial"))).weight(RIGHT_WEIGHT / 2), + cell(initialBackgroundEditor).weight(RIGHT_WEIGHT / 2) + ), + row( + flex(LEFT_WEIGHT), + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Over"))).weight(RIGHT_WEIGHT / 2), + cell(overBackgroundEditor).weight(RIGHT_WEIGHT / 2) + ), + row( + flex(LEFT_WEIGHT), + cell(getClickLabel()).weight(RIGHT_WEIGHT / 2), + cell(clickBackgroundEditor).weight(RIGHT_WEIGHT / 2) + ) + ).getComponent(); + this.add(column(VERTICAL_GAP, + row( + cell(headLabel).weight(LEFT_WEIGHT), + cell(backgroundHead).weight(RIGHT_WEIGHT) + ) + ).getComponent()); } diff --git a/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/h_justify.svg b/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/h_justify.svg new file mode 100644 index 000000000..77c336cb8 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/h_justify.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/h_normal.svg b/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/h_normal.svg new file mode 100644 index 000000000..bb67ef75c --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/h_normal.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/v_bottom.svg b/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/v_bottom.svg new file mode 100644 index 000000000..159c2cbac --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/v_bottom.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/v_center.svg b/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/v_center.svg new file mode 100644 index 000000000..4dfa2a6d4 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/v_center.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/v_top.svg b/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/v_top.svg new file mode 100644 index 000000000..a4c2f871e --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/cellstyle/v_top.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/monochrome_cut.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/monochrome_cut.svg new file mode 100644 index 000000000..15796db6b --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/monochrome_cut.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/monochrome_cut_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/monochrome_cut_disable.svg new file mode 100644 index 000000000..58fc5b4e7 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/monochrome_cut_disable.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/lock/locked.svg b/designer-base/src/main/resources/com/fine/theme/icon/lock/locked.svg new file mode 100644 index 000000000..1a1e90b76 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/lock/locked.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/lock/locked_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/lock/locked_disable.svg new file mode 100644 index 000000000..70fdd16de --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/lock/locked_disable.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/lock/unlocked.svg b/designer-base/src/main/resources/com/fine/theme/icon/lock/unlocked.svg new file mode 100644 index 000000000..1117d1fa7 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/lock/unlocked.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/lock/unlocked_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/lock/unlocked_disable.svg new file mode 100644 index 000000000..d2f7e4065 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/lock/unlocked_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/to_bottom.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/to_bottom.svg new file mode 100644 index 000000000..e469901e0 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/to_bottom.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/to_bottom_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/to_bottom_disable.svg new file mode 100644 index 000000000..6c6fd6e02 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/to_bottom_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/to_top.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/to_top.svg new file mode 100644 index 000000000..2fd47003f --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/to_top.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/toolbar/to_top_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/to_top_disable.svg new file mode 100644 index 000000000..7233c0934 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/toolbar/to_top_disable.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index 45378742e..d7669df0f 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -1304,4 +1304,11 @@ CellOtherSetPane.height=$Component.defaultHeight font: bold $defaultFont [style]Label.tipLabel = \ - foreground: $Label.tipColor \ No newline at end of file + foreground: $Label.tipColor + +[style]Button.plainButton = \ + border: null; \ + background: null; \ + hoverBackground : null; \ + selectedBackground : null; \ + pressedBackground : null \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java index 3d58ca1aa..5de663ebb 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java @@ -1,5 +1,6 @@ package com.fr.design.designer.beans.actions; +import com.fine.theme.icon.LazyIcon; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.beans.actions.behavior.CopyableEnable; import com.fr.design.mainframe.FormDesigner; @@ -15,7 +16,7 @@ public class CopyAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Copy")); this.setMnemonic('C'); - this.setSmallIcon("/com/fr/design/standard/copy/copy"); + this.setSmallIcon(new LazyIcon("monochrome_copy")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)); setUpdateBehavior(new CopyableEnable()); this.setEnabled(!DesignModeContext.isBanCopyAndCut()); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java index 0a6338935..4b859e85b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java @@ -1,6 +1,7 @@ package com.fr.design.designer.beans.actions; +import com.fine.theme.icon.LazyIcon; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.beans.actions.behavior.CutableEnable; import com.fr.design.mainframe.FormDesigner; @@ -16,7 +17,7 @@ public class CutAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut")); this.setMnemonic('T'); - this.setSmallIcon("/com/fr/design/standard/cut/cut"); + this.setSmallIcon(new LazyIcon("monochrome_cut")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); this.setUpdateBehavior(new CutableEnable()); this.setEnabled(!DesignModeContext.isBanCopyAndCut()); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java index 75a744251..67d62af57 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java @@ -5,8 +5,10 @@ package com.fr.design.designer.beans.actions; import java.awt.event.KeyEvent; -import javax.swing.*; +import javax.swing.JComponent; +import javax.swing.KeyStroke; +import com.fine.theme.icon.LazyIcon; import com.fr.design.designer.beans.actions.behavior.DeletableEnable; import com.fr.design.mainframe.FormDesigner; @@ -22,7 +24,7 @@ public class FormDeleteAction extends FormWidgetEditAction { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")); this.setMnemonic('D'); // Richie:删除菜单图标 - this.setSmallIcon("/com/fr/design/images/m_report/delete"); + this.setSmallIcon(new LazyIcon("remove")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)); this.setUpdateBehavior(new DeletableEnable()); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveDownAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveDownAction.java index 4663d3759..c2d36f5b6 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveDownAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveDownAction.java @@ -1,6 +1,6 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.design.designer.beans.actions.behavior.MovableDownEnable; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; @@ -8,7 +8,6 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; - import javax.swing.*; import java.awt.event.KeyEvent; @@ -25,7 +24,7 @@ public class MoveDownAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Move_Down")); this.setMnemonic('B'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/down.png")); + this.setSmallIcon(new LazyIcon("move_down")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER)); this.setUpdateBehavior(new MovableDownEnable()); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveToBottomAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveToBottomAction.java index a5f76ee83..153a898bd 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveToBottomAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveToBottomAction.java @@ -1,6 +1,6 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.design.designer.beans.actions.behavior.MovableDownEnable; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; @@ -8,7 +8,6 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; - import javax.swing.*; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; @@ -26,7 +25,7 @@ public class MoveToBottomAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Move_To_Bottom")); this.setMnemonic('K'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_bottom.png")); + this.setSmallIcon(new LazyIcon("to_bottom")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER + InputEvent.SHIFT_MASK)); this.setUpdateBehavior(new MovableDownEnable()); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveToTopAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveToTopAction.java index 05d42322c..d3c71f83b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveToTopAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveToTopAction.java @@ -1,6 +1,6 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.design.designer.beans.actions.behavior.MovableUpEnable; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; @@ -8,8 +8,7 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; - -import javax.swing.*; +import javax.swing.KeyStroke; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; @@ -26,7 +25,7 @@ public class MoveToTopAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Move_To_Top")); this.setMnemonic('T'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_top.png")); + this.setSmallIcon(new LazyIcon("to_top")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER + InputEvent.SHIFT_MASK)); this.setUpdateBehavior(new MovableUpEnable()); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveUpAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveUpAction.java index 81eae97f0..4760e4c76 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveUpAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/MoveUpAction.java @@ -1,6 +1,6 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.design.designer.beans.actions.behavior.MovableUpEnable; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; @@ -8,7 +8,6 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; - import javax.swing.*; import java.awt.event.KeyEvent; @@ -25,7 +24,7 @@ public class MoveUpAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Move_Up")); this.setMnemonic('F'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/up.png")); + this.setSmallIcon(new LazyIcon("move_up")); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER)); this.setUpdateBehavior(new MovableUpEnable()); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java index e45d89155..6c257a889 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java @@ -1,5 +1,6 @@ package com.fr.design.designer.beans.actions; +import com.fine.theme.icon.LazyIcon; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.beans.actions.behavior.PasteEnable; import com.fr.design.mainframe.FormDesigner; @@ -15,7 +16,7 @@ public class PasteAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Edit_Paste")); this.setMnemonic('P'); - this.setSmallIcon("/com/fr/design/standard/paste/paste"); + this.setSmallIcon(new LazyIcon("monochrome_paste")); this.setUpdateBehavior(new PasteEnable()); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)); } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/PropertyGroupPane.java b/designer-form/src/main/java/com/fr/design/designer/creator/PropertyGroupPane.java index bb3c3a42f..e64479b8e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/PropertyGroupPane.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/PropertyGroupPane.java @@ -1,17 +1,21 @@ package com.fr.design.designer.creator; -import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.FormDesigner; import com.fr.form.ui.Widget; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; +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; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; + /** * Created by kerry on 2017/9/7. */ @@ -50,15 +54,23 @@ public class PropertyGroupPane extends BasicPane { this.setLayout(FRGUIPaneFactory.createBorderLayout()); int count = crPropertyDescriptors.length; crPropertyDescriptorPanes = new CRPropertyDescriptorPane[count]; - Component[][] components = new Component[count][]; + JPanel column = column(VERTICAL_GAP).getComponent(); for (int i = 0; i < count; i++) { crPropertyDescriptorPanes[i] = new CRPropertyDescriptorPane(crPropertyDescriptors[i], xCreator, designer); - components[i] = crPropertyDescriptorPanes[i].createTableLayoutComponent(); + Component[] component = crPropertyDescriptorPanes[i].createTableLayoutComponent(); + if(component[1] != null) { + column.add(row( + cell(component[0]).weight(LEFT_WEIGHT), cell(component[1]).weight(RIGHT_WEIGHT) + ).getComponent()); + } else { + column.add(component[0]); + } + } + if (count == 0) { + this.setVisible(false); + } else { + this.add(column, BorderLayout.CENTER); } - - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); - panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); - this.add(panel, BorderLayout.CENTER); } public void populate(Widget widget) { @@ -67,6 +79,8 @@ public class PropertyGroupPane extends BasicPane { } } + + @Override protected String title4PopupWindow() { return "PropertyGroupPane"; diff --git a/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java b/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java index 0e344e083..c990e547f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java +++ b/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java @@ -1,10 +1,10 @@ package com.fr.design.designer.treeview; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.log.FineLoggerFactory; -import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; @@ -35,7 +35,7 @@ public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer { } this.treeCellRender = ((XCreator) value).getComponentTreeCellRender(); } - this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); + this.setBorder(new ScaledEmptyBorder(2, 0, 2, 0)); this.setBackgroundNonSelectionColor(getBackground()); return this; } diff --git a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java index 2a67f61ae..d52a0b892 100644 --- a/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/gui/controlpane/EventPropertyPane.java @@ -1,5 +1,6 @@ package com.fr.design.gui.controlpane; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.properties.EventPropertyTable; import com.fr.design.i18n.Toolkit; @@ -22,6 +23,7 @@ public class EventPropertyPane extends UIListGroupControlPane { public EventPropertyPane(FormDesigner designer) { super(); this.designer = designer; + setBorder(new ScaledEmptyBorder(10, 0, 10, 0)); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java index 4cd607222..8399fa235 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java @@ -10,7 +10,6 @@ import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.treeview.ComponentTreeCellRenderer; import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.gui.itree.UITreeUI; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.StringUtils; @@ -47,7 +46,6 @@ public class ComponentTree extends JTree { private FormDesigner designer; private ComponentTreeModel model; - private UITreeUI uiTreeUI = new UITreeUI(); private PopupPreviewPane previewPane; private static final Map> treePathCache = new HashMap<>(); @@ -56,7 +54,6 @@ public class ComponentTree extends JTree { public ComponentTree(FormDesigner designer) { this.designer = designer; -// this.setBackground(UIConstants.TREE_BACKGROUND); setRootVisible(true); setCellRenderer(new ComponentTreeCellRenderer()); getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); @@ -66,7 +63,6 @@ public class ComponentTree extends JTree { this.refreshTreeRoot(); initListeners(); setEditable(true); -// setUI(uiTreeUI); setBorder(BorderFactory.createEmptyBorder(PADDING_TOP, PADDING_LEFT, 0, 0)); } @@ -162,7 +158,6 @@ public class ComponentTree extends JTree { */ public void refreshUI() { updateUI(); -// setUI(uiTreeUI); } @@ -525,7 +520,6 @@ public class ComponentTree extends JTree { PopupPreviewPane() { contentPane = new JPanel(); -// contentPane.setBackground(Color.white); this.setLayout(new BorderLayout()); this.add(contentPane, BorderLayout.CENTER); this.setOpaque(false); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java index 17f07cdee..44723b6d3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -1,8 +1,8 @@ package com.fr.design.mainframe; +import com.fine.theme.utils.FineUIScale; import com.fr.base.BaseUtils; import com.fr.design.actions.UndoableAction; -import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XWAbsoluteBodyLayout; @@ -17,7 +17,6 @@ import com.fr.design.menu.ToolBarDef; import com.fr.design.parameter.HierarchyTreePane; import javax.swing.Action; -import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.SwingUtilities; @@ -35,7 +34,6 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree private static final int PARA = 0; private static final int BODY = 1; private static final int SHORTS_SEPARATOR_POS = 4; - private static final int TOOLBAR_PADDING_RIGHT = 10; private ShortCut4JControlPane[] shorts; private ComponentTree componentTree; @@ -160,42 +158,26 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree private JPanel getWidgetPane() { shorts = createShortcuts(); - JPanel widgetPane = new JPanel(); widgetPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + UIToolbar toolbar = getToolBar(); + widgetPane.add(toolbar, BorderLayout.NORTH); - widgetPane.add(getToolBarPane(), BorderLayout.CENTER); UIScrollPane scrollPane = new UIScrollPane(componentTree); - scrollPane.setBorder(BorderFactory.createEmptyBorder()); - scrollPane.setPreferredSize(new Dimension(210, 170)); - widgetPane.add(scrollPane, BorderLayout.SOUTH); + scrollPane.setPreferredSize(FineUIScale.scale(new Dimension(210, 170))); + widgetPane.add(scrollPane, BorderLayout.CENTER); return widgetPane; } - private JPanel getToolBarPane() { + private UIToolbar getToolBar() { UIToolbar toolBar = ToolBarDef.createJToolBar(); -// toolBar.setUI(new UIToolBarUI() { -// @Override -// public void paint(Graphics g, JComponent c) { -// Graphics2D g2 = (Graphics2D) g; -// g2.setColor(new Color(245, 245, 247)); -// g2.fillRect(0, 0, c.getWidth(), c.getHeight()); -// } -// }); for (int i = 0; i < shorts.length; i++) { if (i == SHORTS_SEPARATOR_POS) { - toolBar.addSeparator(new Dimension(2, 16)); + toolBar.addSeparator(FineUIScale.scale(new Dimension(2, 16))); } shorts[i].getShortCut().intoJToolBar(toolBar); } - - JPanel toolBarPane = new JPanel(new BorderLayout()); - toolBarPane.add(toolBar, BorderLayout.CENTER); - toolBarPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.BARNOMAL)); - JPanel toolBarPaneWrapper = new JPanel(new BorderLayout()); - toolBarPaneWrapper.add(toolBarPane, BorderLayout.CENTER); - toolBarPaneWrapper.setBorder(BorderFactory.createEmptyBorder(1, 0, 2, TOOLBAR_PADDING_RIGHT)); - return toolBarPaneWrapper; + return toolBar; } /** diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index 8abb9d81c..aa6f5f664 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -1,8 +1,8 @@ package com.fr.design.mainframe; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; -import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XComponent; @@ -29,7 +29,6 @@ import com.fr.design.mainframe.widget.ui.FormWidgetCardPaneFactory; import com.fr.design.widget.ui.designer.mobile.MobileWidgetDefinePane; import com.fr.stable.ArrayUtils; -import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -46,8 +45,6 @@ import java.util.Set; */ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane { - private static final int PADDING = 10; - private static final int PADDING_M = 12; private FormWidgetCardPane formWidgetCardPane; // 控件的属性表 private EventPropertyPane eventTable; // 控件的事件表 private List widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab @@ -217,7 +214,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) { MobileWidgetDefinePane extraPane = (MobileWidgetDefinePane) widgetAttrProvider.createWidgetAttrPane(); if (extraPane != null) { - extraPane.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, PADDING, PADDING_M)); mobileExtraPropertyPanes.add(extraPane); wsp.add(extraPane); } @@ -282,8 +278,8 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper tabbedPane.show(center, tabTitles[index]); } }; - tabsHeaderIconPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIConstants.SHADOW_GREY)); this.add(tabsHeaderIconPane, BorderLayout.NORTH); + this.setBorder(new ScaledEmptyBorder(10, 10, 0, 10)); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java index 5b359c9ac..05dd7923e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java @@ -1,14 +1,9 @@ package com.fr.design.mainframe.widget.ui; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.ui.Widget; -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import java.awt.BorderLayout; - /** * Created by kerry on 2017/9/30. */ @@ -20,18 +15,14 @@ public class BasicSetVisiblePropertyPane extends FormBasicPropertyPane { } protected void initComponent() { - JPanel pane2 = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); - pane2.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); UICheckBox otherOtherConfig = createOtherConfig(); if(otherOtherConfig != null){ - pane2.add(otherOtherConfig); + corePane.add(otherOtherConfig); } visibleCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Visible"), true); visibleCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")); - visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - pane2.add(visibleCheckBox); - this.add(pane2, BorderLayout.CENTER); + corePane.add(visibleCheckBox); } public UICheckBox createOtherConfig(){ diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java index 27d55ac28..f9646e270 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java @@ -1,13 +1,9 @@ package com.fr.design.mainframe.widget.ui; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.form.ui.Widget; -import javax.swing.BorderFactory; -import java.awt.Component; - /** * Created by ibm on 2017/7/26. */ @@ -21,8 +17,6 @@ public class FormBasicWidgetPropertyPane extends BasicSetVisiblePropertyPane { public UICheckBox createOtherConfig() { enableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Enabled"), true); enableCheckBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_Basic")); - - enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); return enableCheckBox; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java index 98c539f27..ec9adab24 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java @@ -1,6 +1,8 @@ package com.fr.design.mainframe.widget.ui; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.base.mode.DesignModeContext; +import com.fr.design.border.FineBorderFactory; import com.fr.design.data.DataCreatorUI; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; @@ -8,7 +10,6 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteBodyLayout; import com.fr.design.designer.creator.XWAbsoluteLayout; -import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.file.HistoryTemplateListCache; @@ -32,19 +33,21 @@ import com.fr.form.main.WidgetUtil; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WScaleLayout; -import com.fr.form.ui.container.WSortLayout; import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.widget.CRBoundsWidget; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JPanel; import java.awt.BorderLayout; +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; + public class FormSingleWidgetCardPane extends FormWidgetCardPane { private AttributeChangeListener listener; @@ -114,18 +117,14 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); content.add(attriCardPane, BorderLayout.CENTER); - content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); final boolean isExtraWidget = FormWidgetDefinePaneFactoryBase.isExtraXWidget(innerCreator.toData()); - this.listener = new AttributeChangeListener() { - @Override - public void attributeChange() { - if (!isExtraWidget) { - updateCreator(); - } - updateWidgetBound(); - firePropertyEdit(); + this.listener = () -> { + if (!isExtraWidget) { + updateCreator(); } + updateWidgetBound(); + firePropertyEdit(); }; freshPropertyMode(innerCreator); @@ -139,14 +138,19 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { } widgetPropertyPane = WidgetBasicPropertyPaneFactory.createBasicPropertyPane(innerCreator); - + widgetPropertyPane.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"), 280, 20, widgetPropertyPane); - - content.add(uiExpandablePane, BorderLayout.NORTH); + content.add(column( + cell(uiExpandablePane), + fix(1).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())) + ).getComponent(), BorderLayout.NORTH); widgetBoundPane = createWidgetBoundPane(xCreator); if (widgetBoundPane != null) { - attriCardPane.add(widgetBoundPane, BorderLayout.NORTH); + attriCardPane.add(column( + cell(widgetBoundPane), + fix(1).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())) + ).getComponent(), BorderLayout.NORTH); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index c2d145983..6519e859d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -6,7 +6,6 @@ import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.FormDesigner; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -49,8 +48,6 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { private void initLayout() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - // 跟上方tab标题“属性”那一栏间距10 - this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); } protected JPanel createContentPaneInScrollPane() { diff --git a/designer-form/src/main/java/com/fr/design/parameter/ParameterPropertyPane.java b/designer-form/src/main/java/com/fr/design/parameter/ParameterPropertyPane.java index ddab3a305..16c0e91d6 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/ParameterPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/parameter/ParameterPropertyPane.java @@ -1,6 +1,7 @@ package com.fr.design.parameter; import com.fr.base.Parameter; +import com.fr.design.border.FineBorderFactory; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XWParameterLayout; @@ -31,10 +32,7 @@ public class ParameterPropertyPane extends JPanel{ private static ParameterPropertyPane THIS; private boolean isEditing = false; - private static final int HIDE_HEIGHT = 40; - private static final int PADDING_SMALL = 5; private static final int PADDING_MIDDLE = 10; - private static final int PADDING_LARGE = 15; private static final int ADD_PARA_PANE_MAX_HEIGHT = 95; public static final ParameterPropertyPane getInstance() { @@ -81,15 +79,13 @@ public class ParameterPropertyPane extends JPanel{ } }; JPanel scrollPaneWrapperInner = new JPanel(new BorderLayout()); - scrollPaneWrapperInner.setBorder(BorderFactory.createEmptyBorder(PADDING_MIDDLE, PADDING_MIDDLE, PADDING_MIDDLE, PADDING_SMALL)); scrollPaneWrapperInner.add(basicScrollPane, BorderLayout.CENTER); addParaPane = new JPanel(new BorderLayout()); addParaPane.add(scrollPaneWrapperInner, BorderLayout.CENTER); - addParaPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.SPLIT_LINE)); initParameterListener(); - this.setLayout(new BorderLayout(0, 6)); - this.setBorder(BorderFactory.createEmptyBorder(0, 0, PADDING_MIDDLE, 0)); + this.setLayout(new BorderLayout()); + this.setBorder(FineBorderFactory.createDefaultUnderlineBorder()); this.add(addParaPane, BorderLayout.NORTH); } @@ -138,7 +134,7 @@ public class ParameterPropertyPane extends JPanel{ } } } - + private void setEditor(FormDesigner editor) { if (formHierarchyTreePaneWrapper == null) { formHierarchyTreePaneWrapper = new JPanel(new BorderLayout()); diff --git a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java index 57082e37f..679284edd 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java @@ -1,10 +1,11 @@ package com.fr.design.parameter; -import com.fr.base.BaseUtils; +import com.fine.swing.ui.layout.Column; +import com.fine.theme.icon.LazyIcon; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.border.FineBorderFactory; import com.fr.design.data.DataCreatorUI; -import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.PropertyGroupPane; import com.fr.design.designer.creator.XCreator; @@ -21,18 +22,16 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; 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.DesignerUIModeConfig; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.widget.accessibles.AccessibleBackgroundEditor; -import com.fr.design.widgettheme.processor.WidgetThemeParaCreatorPaneAdder; import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.design.widget.ui.designer.component.UIBoundSpinner; +import com.fr.design.widgettheme.processor.WidgetThemeParaCreatorPaneAdder; import com.fr.form.ui.container.WParameterLayout; import com.fr.general.Background; import com.fr.general.GeneralContext; @@ -40,7 +39,6 @@ import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.report.stable.FormConstants; -import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JCheckBox; import javax.swing.JPanel; @@ -51,6 +49,14 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; +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; +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; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; + /** * Created by ibm on 2017/8/2. */ @@ -69,6 +75,7 @@ public class RootDesignDefinePane extends AbstractDataModify { private PropertyGroupPane extraPropertyGroupPane; protected final List> extraPaneList = new ArrayList<>(); private JPanel backgroundPane; + private JPanel corePane; public RootDesignDefinePane(XCreator xCreator) { super(xCreator); @@ -80,6 +87,8 @@ public class RootDesignDefinePane extends AbstractDataModify { public void initComponent() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); + corePane = new Column(); + this.add(corePane, BorderLayout.CENTER); if (newForm) { paraHeight = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0); } else { @@ -87,10 +96,11 @@ public class RootDesignDefinePane extends AbstractDataModify { } JPanel advancePane = createAdvancePane(); UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane); - this.add(advanceExpandablePane, BorderLayout.NORTH); + corePane.add(advanceExpandablePane); JPanel layoutPane = createBoundsPane(); UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Size"), 280, 20, layoutPane); - this.add(layoutExpandablePane, BorderLayout.CENTER); + corePane.add(fix(10).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())).getComponent()); + corePane.add(layoutExpandablePane); this.addExtraUIExpandablePaneFromPlugin(); } @@ -104,23 +114,21 @@ public class RootDesignDefinePane extends AbstractDataModify { panel.add(uiExpandablePane); } } - this.add(panel, BorderLayout.SOUTH); + corePane.add(panel); } public JPanel createBoundsPane() { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}}; - Component[] component = newForm ? new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Design_Height")), paraHeight} : - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Desin_Width")), designerWidth}; - Component[][] components = new Component[][]{component}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - jPanel.add(panel); - return jPanel; + if (newForm) { + return row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_Design_Height"))).weight(LEFT_WEIGHT), + cell(paraHeight).weight(RIGHT_WEIGHT) + ).getComponent(); + } else { + return row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Desin_Width"))).weight(LEFT_WEIGHT), + cell(designerWidth).weight(RIGHT_WEIGHT) + ).getComponent(); + } } public JPanel createAdvancePane() { @@ -139,14 +147,12 @@ public class RootDesignDefinePane extends AbstractDataModify { * @date: 2020/11/05 15:36 */ private JPanel getTemplateAdvancePane() { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); labelNameTextField = new UITextField(); displayReport = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Display_Nothing_Before_Query")); UIComponentUtils.setLineWrap(displayReport); useParamsTemplate = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Use_Params_Template")); fireAfterEditor = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Trigger_Editing_End_Event")); fireAfterEditor.setEnabled(false); - fireAfterEditor.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); useParamsTemplate.addChangeListener(e -> { boolean isSelected = ((UICheckBox) e.getSource()).isSelected(); fireAfterEditor.setEnabled(isSelected); @@ -154,37 +160,37 @@ public class RootDesignDefinePane extends AbstractDataModify { fireAfterEditor.setSelected(false); } }); - Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),}; + Icon[][] hAlignmentIconArray = {{new LazyIcon("h_left"), new LazyIcon("h_left").white()}, + {new LazyIcon("h_center"), new LazyIcon("h_center").white()}, + {new LazyIcon("h_right"), new LazyIcon("h_right").white()}}; Integer[] hAlignment = new Integer[]{FormConstants.LEFTPOSITION, FormConstants.CENTERPOSITION, FormConstants.RIGHTPOSITION}; - hAlignmentPane = new UIButtonGroup(hAlignmentIconArray, hAlignment); + + hAlignmentPane = new UIButtonGroup<>(hAlignmentIconArray, hAlignment); hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left") , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")}); backgroundPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.initExtraPane(); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), backgroundPane}, - new Component[]{displayReport, null}, - new Component[]{useParamsTemplate, null}, - new Component[]{fireAfterEditor, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Display_Position")), hAlignmentPane} - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); - panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - CRPropertyDescriptor[] extraTableEditor = new CRPropertyDescriptor[0]; - extraTableEditor = root.getExtraTableEditor(); + CRPropertyDescriptor[] extraTableEditor = root.getExtraTableEditor(); extraPropertyGroupPane = new PropertyGroupPane(extraTableEditor, root); - jPanel.add(panel, BorderLayout.NORTH); - jPanel.add(extraPropertyGroupPane, BorderLayout.CENTER); - return jPanel; + return column(VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name"))).weight(LEFT_WEIGHT), + cell(labelNameTextField).weight(RIGHT_WEIGHT) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background"))).weight(LEFT_WEIGHT), + cell(backgroundPane).weight(RIGHT_WEIGHT) + ), + cell(displayReport), + cell(useParamsTemplate), + cell(fireAfterEditor), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Display_Position"))).weight(LEFT_WEIGHT), + cell(hAlignmentPane).weight(RIGHT_WEIGHT) + ), + cell(extraPropertyGroupPane) + ).getComponent(); } private void initExtraPane() { @@ -244,14 +250,12 @@ public class RootDesignDefinePane extends AbstractDataModify { * @date: 2020/11/05 15:36 */ private JPanel getNewFormAdvancePane() { - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); labelNameTextField = new UITextField(); displayReport = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Display_Nothing_Before_Query")); UIComponentUtils.setLineWrap(displayReport); useParamsTemplate = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Use_Params_Template")); fireAfterEditor = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Trigger_Editing_End_Event")); fireAfterEditor.setEnabled(false); - fireAfterEditor.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); useParamsTemplate.addChangeListener(e -> { boolean isSelected = ((UICheckBox) e.getSource()).isSelected(); fireAfterEditor.setEnabled(isSelected); @@ -261,24 +265,20 @@ public class RootDesignDefinePane extends AbstractDataModify { }); backgroundPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.initExtraPane(); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), backgroundPane}, - new Component[]{displayReport, null}, - new Component[]{useParamsTemplate, null}, - new Component[]{fireAfterEditor, null}, - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); - panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); - - jPanel.add(panel, BorderLayout.NORTH); - return jPanel; + return column(VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name"))).weight(LEFT_WEIGHT), + cell(labelNameTextField).weight(RIGHT_WEIGHT) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background"))).weight(LEFT_WEIGHT), + cell(backgroundPane).weight(RIGHT_WEIGHT) + ), + cell(displayReport), + cell(useParamsTemplate), + cell(fireAfterEditor) + ).getComponent(); } @Override diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java index 0863260b3..52695abd7 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java @@ -3,15 +3,12 @@ package com.fr.design.widget.ui.designer; import com.finebi.cbb.utils.CollectionUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.WidgetAdvancedPaneProvider; 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.accessibles.AccessibleIconEditor; import com.fr.design.widgettheme.processor.WidgetThemeParaCreatorPaneAdder; import com.fr.design.widget.btn.ButtonConstants; @@ -20,9 +17,7 @@ import com.fr.general.GeneralContext; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.StableUtils; -import org.jetbrains.annotations.NotNull; -import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.Component; @@ -30,6 +25,13 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; +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; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; + public abstract class ButtonDefinePane extends AbstractDataModify { private UITextField hotkeysTextField; private UITextField buttonNameTextField; @@ -80,55 +82,39 @@ public abstract class ButtonDefinePane extends AbstractDataMod } private void refreshAdvancedPane(boolean containsExtraPane) { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; Component[] backgroundCompPane = createBackgroundComp(); Component[] frFont = createFontPane(); - double[] rowSize; - double[] columnSize; - int[][] rowCount; - Component[][] n_components; + hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); + extraPane = column(VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name"))).weight(LEFT_WEIGHT), + cell(buttonNameTextField).weight(RIGHT_WEIGHT) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name"))).weight(LEFT_WEIGHT), + cell(labelNameTextField).weight(RIGHT_WEIGHT) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"))).weight(LEFT_WEIGHT), + cell(iconPane).weight(RIGHT_WEIGHT) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys"))).weight(LEFT_WEIGHT), + cell(hotkeysTextField).weight(RIGHT_WEIGHT) + ) + ).getComponent(); if (containsExtraPane) { JPanel panel = FRGUIPaneFactory.createYBoxEmptyBorderPane(); for (BasicBeanPane pane : extraPaneList) { panel.add(pane); } - rowSize = new double[]{p, p, p, p, p}; - columnSize = new double[]{p, f}; - rowCount = new int[][]{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - n_components = getExtraAdvancedComponents(panel); + extraPane.add(panel); } else { - rowSize = new double[]{p, p, p, p, p, p, p, p}; - columnSize = new double[]{p, f}; - rowCount = new int[][]{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - n_components = getAdvancedComponents(backgroundCompPane, frFont); + extraPane.add(column(VERTICAL_GAP, + cell(backgroundCompPane[0]), + cell(frFont[0]) + ).getComponent(), 2); } - hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); - extraPane = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - extraPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - } - - @NotNull - private Component[][] getAdvancedComponents(Component[] backgroundCompPane, Component[] frFont) { - return new Component[][]{ - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - backgroundCompPane, - frFont, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")), iconPane}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField} - }; - } - - @NotNull - private Component[][] getExtraAdvancedComponents(JPanel panel) { - return new Component[][]{ - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")), iconPane}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField}, - {panel, null} - }; } protected void initPluginListener() { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java index bc69bbd1a..733317eb1 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java @@ -1,20 +1,22 @@ package com.fr.design.widget.ui.designer; -import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; 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.design.widget.FRWidgetFactory; import com.fr.form.ui.ButtonGroup; -import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SpinnerNumberModel; -import java.awt.Component; + +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; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; public class ButtonGroupDictPane extends JPanel { @@ -32,23 +34,16 @@ public class ButtonGroupDictPane extends JPanel { public void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); adaptiveCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Adaptive"), true); - adaptiveCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); UILabel dictLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary")); this.columnLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Group_Display_Columns") + ":", dictLabel.getPreferredSize().width); columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}}; - Component[][] components = { - new Component[] {adaptiveCheckbox, null}, - new Component[] {columnLabel, columnSpinner}, - }; - JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - this.add(jPanel); + this.add(column(VERTICAL_GAP, + cell(adaptiveCheckbox), + row( + cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT) + ) + ).getComponent()); } public void populate(ButtonGroup buttonGroup) { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java index d73582df7..9390c7573 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java @@ -3,7 +3,6 @@ package com.fr.design.widget.ui.designer; import com.finebi.cbb.utils.CollectionUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.WidgetAdvancedPaneProvider; @@ -11,7 +10,6 @@ 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.widgettheme.processor.WidgetThemeParaCreatorPaneAdder; import com.fr.design.gui.frpane.FontSizeComboPane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; @@ -20,14 +18,18 @@ import com.fr.general.GeneralContext; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; -import javax.swing.BorderFactory; import javax.swing.JPanel; -import javax.swing.SwingConstants; -import java.awt.Component; import java.util.ArrayList; import java.util.List; import java.util.Set; +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; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; + public class CheckBoxDefinePane extends AbstractDataModify { private UITextField text; private FontSizeComboPane fontSizePane; @@ -41,31 +43,28 @@ public class CheckBoxDefinePane extends AbstractDataModify { public CheckBoxDefinePane(XCreator xCreator) { super(xCreator); - iniComoponents(); + initComponents(); } - private void iniComoponents() { + private void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); text = new UITextField(); fontSizePane = new FontSizeComboPane(); labelNameTextField = new UITextField(); - UILabel widgetValueLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value")); - widgetValueLabel.setVerticalAlignment(SwingConstants.TOP); formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); initExtraPane(); - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text")), text }, - new Component[]{widgetValueLabel, formWidgetValuePane }, - new Component[]{extraPane, null}, - }; - double[] rowSize = {P, P, P, P, P, P}; - double[] columnSize = {P, F}; - int[][] rowCount = {{1, 1},{1, 1}, {1, 3},{1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); - JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - boundsPane.add(panel); + JPanel boundsPane = column(VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name"))).weight(LEFT_WEIGHT), + cell(labelNameTextField).weight(RIGHT_WEIGHT) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"))).weight(LEFT_WEIGHT), + cell(text).weight(RIGHT_WEIGHT) + ), + cell(formWidgetValuePane), + cell(extraPane) + ).getComponent(); UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, boundsPane); this.add(uiExpandablePane); @@ -94,13 +93,10 @@ public class CheckBoxDefinePane extends AbstractDataModify { extraPane.add(pane); } } else { - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane} - }; - double[] rowSize = {P}; - double[] columnSize = {P, F}; - int[][] rowCount = {{1, 1}}; - extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + extraPane = row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"))).weight(LEFT_WEIGHT), + cell(fontSizePane).weight(RIGHT_WEIGHT) + ).getComponent(); } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java index 579001b55..97df720aa 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java @@ -1,19 +1,19 @@ package com.fr.design.widget.ui.designer; import com.fr.design.data.DataCreatorUI; -import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.present.dict.DictionaryPane; import com.fr.design.widget.component.ReturnTypePane; import com.fr.design.widget.ui.designer.btn.ButtonGroupDefinePane; import com.fr.form.ui.CheckBoxGroup; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane { private DictionaryPane dictPane; @@ -39,19 +39,11 @@ public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane { private UICheckBox removeRepeatCheckBox; @@ -21,7 +19,6 @@ public class ComboBoxDefinePane extends DictEditorDefinePane { public UICheckBox createRepeatCheckBox(){ removeRepeatCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_No_Repeat")); - removeRepeatCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); return removeRepeatCheckBox; } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java index 86a00b990..bac9a7076 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java @@ -1,19 +1,20 @@ package com.fr.design.widget.ui.designer; import com.fr.design.data.DataCreatorUI; -import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.component.ReturnTypePane; import com.fr.form.ui.ComboCheckBox; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.Component; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; public class ComboCheckBoxDefinePane extends DictEditorDefinePane { private UICheckBox supportTagCheckBox; @@ -27,7 +28,6 @@ public class ComboCheckBoxDefinePane extends DictEditorDefinePane public UICheckBox createRepeatCheckBox(){ removeRepeatCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_No_Repeat")); - removeRepeatCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); return removeRepeatCheckBox; } @@ -39,20 +39,11 @@ public class ComboCheckBoxDefinePane extends DictEditorDefinePane public JPanel createOtherPane(){ supportTagCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Support_Tag"), true); - supportTagCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); returnTypePane = new ReturnTypePane(); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{supportTagCheckBox, null }, - new Component[]{returnTypePane, null}, - }; - double[] rowSize = {p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1},{1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); - return panel; + return column(VERTICAL_GAP, + cell(supportTagCheckBox),cell(returnTypePane) + ).getComponent(); } protected void populateSubDictionaryEditorBean(ComboCheckBox ob){ diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java index 415a392f4..c57d05da1 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java @@ -2,12 +2,10 @@ package com.fr.design.widget.ui.designer; import com.fr.design.designer.creator.XCreator; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.CustomWriteAbleRepeatEditor; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; /** * Author : Shockway @@ -25,9 +23,8 @@ public abstract class CustomWritableRepeatEditorPane { private UIButtonGroup returnTypeComboBox; private DateValuePane startDv; @@ -65,37 +69,34 @@ 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")}); JPanel formatHead = createFormatHead(); - startDv = new DateValuePane(); - endDv = new DateValuePane(); + 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")); initExtraPane(); - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{widgetValueLabel, formWidgetValuePane}, - new Component[]{formatLabel, formatHead}, - new Component[]{startDateLabel, startDv}, - new Component[]{endDateLabel, endDv}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), waterMarkDictPane}, - 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, P, P}; - double[] columnSize = {P, F}; - int[][] rowCount = {{1, 1}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); - JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - boundsPane.add(panel); - return boundsPane; + return column(VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name"))).weight(LEFT_WEIGHT), + cell(labelNameTextField).weight(RIGHT_WEIGHT) + ), + cell(formWidgetValuePane), + row( + cell(formatLabel).weight(LEFT_WEIGHT), + cell(formatHead).weight(RIGHT_WEIGHT) + ), + cell(startDv), + cell(endDv), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark"))).weight(LEFT_WEIGHT), + cell(waterMarkDictPane).weight(RIGHT_WEIGHT) + ), + cell(extraPane), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type"))).weight(LEFT_WEIGHT), + cell(returnTypeComboBox).weight(RIGHT_WEIGHT) + ) + ).getComponent(); } protected void refreshExtraAdvancedPane() { @@ -116,13 +117,10 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane extends FieldEditorDefinePane { public UICheckBox directWriteCheckBox; @@ -36,33 +36,36 @@ public abstract class DirectWriteEditorDefinePane e @Override protected JPanel setFirstContentPane() { - JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - UILabel widgetValueLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value")); - widgetValueLabel.setVerticalAlignment(SwingConstants.TOP); + JPanel advancePane = column(VERTICAL_GAP).getComponent(); formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); - Component[] removeRepeatPane = new Component[]{createRepeatCheckBox(), null}; + UICheckBox repeatCheckBox = createRepeatCheckBox(); Component[] dicPane = createDictPane(); Component[] waterMarkComponent = createWaterMarkPane(); initExtraPane(); - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{widgetValueLabel, formWidgetValuePane }, - dicPane, - removeRepeatPane, - waterMarkComponent, - new Component[]{extraPane, null} - }; - double[] rowSize = {P, P, P, P, P, P, P, P}; - double[] columnSize = {P, F}; - int[][] rowCount = {{1, 1},{1, 3},{1, 1},{1, 1},{1,1},{1,1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); -// panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - advancePane.add(panel, BorderLayout.NORTH); + JPanel panel = column(VERTICAL_GAP, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name"))).weight(LEFT_WEIGHT), + cell(labelNameTextField).weight(RIGHT_WEIGHT) + ), + cell(formWidgetValuePane), + row( + cell(dicPane[0]).weight(LEFT_WEIGHT), + cell(dicPane[1]).weight(RIGHT_WEIGHT) + ), + cell(repeatCheckBox) + ).getComponent(); + if (waterMarkComponent[0] != null && waterMarkComponent[1] != null) { + panel.add(row( + cell(waterMarkComponent[0]).weight(LEFT_WEIGHT), + cell(waterMarkComponent[1]).weight(RIGHT_WEIGHT) + ).getComponent()); + } + panel.add(extraPane); + advancePane.add(panel); JPanel otherPane = createOtherPane(); if(otherPane != null){ - advancePane.add(otherPane, BorderLayout.CENTER); + advancePane.add(otherPane); } - return advancePane; } @@ -84,18 +87,17 @@ public abstract class DirectWriteEditorDefinePane e extraPane.add(pane); } } else { - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane} - }; - double[] rowSize = {P}; - double[] columnSize = {P, F}; - int[][] rowCount = {{1, 1}}; - extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + extraPane = row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"))).weight(LEFT_WEIGHT), + cell(fontSizePane).weight(RIGHT_WEIGHT) + ).getComponent(); } } public UICheckBox createRepeatCheckBox(){ - return null; + UICheckBox emptyCheckBox = new UICheckBox(); + emptyCheckBox.setVisible(false); + return emptyCheckBox; } public Component[] createWaterMarkPane() { @@ -112,11 +114,8 @@ public abstract class DirectWriteEditorDefinePane e public JPanel setValidatePane(){ directWriteCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Edit"), false); - directWriteCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - JPanel otherContentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - otherContentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - JPanel jPanel = GUICoreUtils.createFlowPane(new JComponent[]{directWriteCheckBox}, FlowLayout.LEFT, 0); - otherContentPane.add(jPanel); + JPanel otherContentPane = column(LayoutConstants.VERTICAL_GAP).getComponent(); + otherContentPane.add(directWriteCheckBox); return otherContentPane; } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java index 81499facc..09fd42ee5 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java @@ -1,11 +1,10 @@ package com.fr.design.widget.ui.designer; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.ErrorMsgTextFieldAdapter; import com.fr.design.beans.UITextFieldAdapter; -import com.fr.design.constants.LayoutConstants; -import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; @@ -14,28 +13,30 @@ import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.fun.WidgetAdvancedPaneProvider; +import com.fr.design.gui.frpane.FontSizeComboPane; import com.fr.design.gui.icheckbox.UICheckBox; 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.gui.frpane.FontSizeComboPane; import com.fr.form.ui.FieldEditor; import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; +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; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; + public abstract class FieldEditorDefinePane extends AbstractDataModify { protected UICheckBox allowBlankCheckBox; // richer:错误信息,是所有控件共有的属性,所以放到这里来 @@ -45,6 +46,7 @@ public abstract class FieldEditorDefinePane extends Abstr protected UITextField labelNameTextField; protected final List> extraPaneList = new ArrayList<>(); protected JPanel extraPane; + protected JPanel corePane; protected static double F = TableLayout.FILL; protected static double P = TableLayout.PREFERRED; @@ -56,17 +58,17 @@ public abstract class FieldEditorDefinePane extends Abstr protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); + corePane = column().getComponent(); + this.add(corePane, BorderLayout.CENTER); + labelNameTextField = new UITextField(); allowBlankCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Null")); - allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fontSizePane = new FontSizeComboPane(); JPanel contentPane = this.setFirstContentPane(); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.add(contentPane, BorderLayout.CENTER); - contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); if (contentPane != null) { - UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, jPanel); - this.add(uiExpandablePane, BorderLayout.NORTH); + contentPane.setBorder(new ScaledEmptyBorder(0, 0, 10, 0)); + UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, contentPane); + corePane.add(uiExpandablePane); } this.addValidatePane(); } @@ -74,6 +76,10 @@ public abstract class FieldEditorDefinePane extends Abstr protected void initExtraPane() { initPluginListener(); refreshExtraAdvancedPane(); + if (extraPane == null) { + extraPane = new JPanel(); + extraPane.setVisible(false); + } } protected void refreshExtraAdvancedPane() { @@ -136,32 +142,25 @@ public abstract class FieldEditorDefinePane extends Abstr protected void addValidatePane() { initErrorMsgPane(); - validatePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + validatePane = column(VERTICAL_GAP).getComponent(); final UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")); - JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - final JPanel errorTipPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{uiLabel, errorMsgTextField.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); - errorTipPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0)); - borderPane.add(errorTipPane, BorderLayout.CENTER); - allowBlankCheckBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - boolean isSelected = allowBlankCheckBox.isSelected(); - errorTipPane.setVisible(!isSelected); - } + final JPanel errorTipPane = row( + cell(uiLabel).weight(LEFT_WEIGHT), cell(errorMsgTextField.getErrorMsgTextField()).weight(RIGHT_WEIGHT) + ).getComponent(); + allowBlankCheckBox.addItemListener(e -> { + boolean selected = allowBlankCheckBox.isSelected(); + errorTipPane.setVisible(!selected); }); - Component[][] components = new Component[][]{ - new Component[]{allowBlankCheckBox}, - new Component[]{borderPane}, - }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L6, 0); - panel.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); - validatePane.add(panel, BorderLayout.NORTH); + validatePane.add(column(VERTICAL_GAP, + cell(allowBlankCheckBox), + cell(errorTipPane) + ).getComponent()); + JPanel contentPane = this.setValidatePane(); if (contentPane != null) { - validatePane.add(contentPane, BorderLayout.CENTER); + validatePane.add(contentPane); } - UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Validate"), 280, 20, validatePane); this.add(uiExpandablePane, BorderLayout.CENTER); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FreeButtonDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FreeButtonDefinePane.java index 16a31b85e..fd2778732 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FreeButtonDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FreeButtonDefinePane.java @@ -3,14 +3,21 @@ package com.fr.design.widget.ui.designer; import com.fr.design.designer.creator.XCreator; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.style.FRFontPane; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.widget.component.ButtonBackgroundPane; import com.fr.form.ui.FreeButton; import com.fr.general.FRFont; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.Component; + +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.VERTICAL_GAP; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; /** * Created by ibm on 2017/8/6. @@ -19,6 +26,7 @@ public class FreeButtonDefinePane extends ButtonDefinePane { private ButtonBackgroundPane backgroundCompPane; private FRFontPane frFontPane; private UILabel fontLabel; + private JPanel fontPanel; public FreeButtonDefinePane(XCreator xcreator) { super(xcreator); @@ -30,14 +38,15 @@ public class FreeButtonDefinePane extends ButtonDefinePane { } public Component[] createFontPane() { - JPanel fontLabelPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); fontLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font")); - fontLabelPanel.add(fontLabel, BorderLayout.CENTER); - fontLabel.setVerticalAlignment(SwingConstants.TOP); frFontPane = new FRFontPane(); - JPanel fontPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - fontPanel.add(frFontPane, BorderLayout.CENTER); - return new Component[]{fontLabelPanel, fontPanel}; + fontPanel = row( + column(VERTICAL_GAP, + cell(fontLabel).weight(1), flex(1), flex(1) + ).weight(LEFT_WEIGHT), + cell(frFontPane).weight(RIGHT_WEIGHT) + ).getComponent(); + return new Component[]{fontPanel, null}; } public void populateSubButtonPane(FreeButton e) { @@ -45,8 +54,7 @@ public class FreeButtonDefinePane extends ButtonDefinePane { return; } backgroundCompPane.populate(e); - frFontPane.setVisible(e.isCustomStyle()); - fontLabel.setVisible(e.isCustomStyle()); + fontPanel.setVisible(e.isCustomStyle()); if (e.isCustomStyle()) { FRFont frFont = e.getFont(); if (frFont != null) { @@ -59,8 +67,7 @@ public class FreeButtonDefinePane extends ButtonDefinePane { FreeButton freeButton = (FreeButton) creator.toData(); if (!containsExtraPane) { backgroundCompPane.update(freeButton); - frFontPane.setVisible(freeButton.isCustomStyle()); - fontLabel.setVisible(freeButton.isCustomStyle()); + fontPanel.setVisible(freeButton.isCustomStyle()); if (freeButton.isCustomStyle()) { FRFont frFont = freeButton.getFont() == null ? FRFont.getInstance() : freeButton.getFont(); freeButton.setFont(frFontPane.update(frFont)); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java index 1776e2eb1..031b21466 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java @@ -1,11 +1,10 @@ package com.fr.design.widget.ui.designer; +import com.fine.theme.icon.LazyIcon; import com.finebi.cbb.utils.CollectionUtils; -import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.constants.LayoutConstants; -import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.WidgetAdvancedPaneProvider; @@ -14,27 +13,29 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.style.FRFontPane; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.widgettheme.processor.WidgetThemeParaCreatorPaneAdder; import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; +import com.fr.design.widgettheme.processor.WidgetThemeParaCreatorPaneAdder; import com.fr.form.ui.Label; import com.fr.general.GeneralContext; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.Constants; -import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; -import javax.swing.SwingConstants; import java.awt.BorderLayout; -import java.awt.Component; import java.util.ArrayList; import java.util.List; import java.util.Set; +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; +import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP; + /** * 标签控件pane @@ -44,7 +45,6 @@ import java.util.Set; * Created on 2023/11/13 */ public class LabelDefinePane extends AbstractDataModify