diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/RectangleButtonUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/RectangleButtonUI.java index c8523f455f..d904832c71 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/RectangleButtonUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/RectangleButtonUI.java @@ -1,10 +1,14 @@ package com.fine.theme.light.ui; +import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.ui.FlatButtonUI; import com.formdev.flatlaf.ui.FlatUIUtils; +import javax.swing.AbstractButton; import javax.swing.JComponent; -import java.awt.*; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; /** * 矩形按钮UI,忽略圆角属性 @@ -20,6 +24,13 @@ public class RectangleButtonUI extends FlatButtonUI { super(shared); } + + @Override + protected void installDefaults(AbstractButton b) { + super.installDefaults(b); + selectedBackground = FineUIUtils.getUIColor( "East.TabSelectedColor", "fill.deep"); + } + @Override protected void paintBackground(Graphics g, JComponent c) { Color background = getBackground(c); @@ -36,4 +47,18 @@ public class RectangleButtonUI extends FlatButtonUI { g2.dispose(); } } + + @Override + protected Color getBackground(JComponent c) { + if( ((AbstractButton)c).isSelected() ) { + return selectedBackground; + } + return buttonStateColor( c, + getBackgroundBase( c, false ), + disabledBackground, + isCustomBackground( c.getBackground() ) ? null : focusedBackground, + hoverBackground, + pressedBackground ); + } + } diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java b/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java index 57fd6a63a0..80cc69c932 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java @@ -5,6 +5,14 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.stable.Constants; import javax.swing.Icon; +import javax.swing.JButton; +import javax.swing.JPanel; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.flex; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIStyle.STYLE_PRIMARY; +import static com.fine.theme.utils.FineUIStyle.setStyle; /** * 设计器典型组件组合工厂 @@ -41,4 +49,17 @@ public class FineComponentsFactory { return new UIButtonGroup<>(alignmentIconArray, alignment); } + /** + * 创建确认&取消按钮组,间距为8,右对齐 + * + * @param confirmButton 确认按钮 + * @param cancelButton 取消按钮 + * @return 确认&取消按钮组面板 + */ + public static JPanel createConfirmCancelButtonPane(JButton confirmButton, JButton cancelButton) { + setStyle(confirmButton, STYLE_PRIMARY); + return row(8, + flex(), cell(confirmButton), cell(cancelButton)).getComponent(); + } + } diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java b/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java index 8bf7b3f0e7..b9144f31ef 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineLayoutBuilder.java @@ -157,6 +157,22 @@ public class FineLayoutBuilder { return row; } + /** + * 创建水平布局面板 + * + * @param spacing 间距 + * @param elements 面板元素 + * @return 面板 + */ + public static Row createHorizontalLayout(int spacing, Component... elements) { + Row row = new Row(); + row.setSpacing(spacing); + for (Component element : elements) { + Layouts.populate(row, cell(element)); + } + return row; + } + /** * 组件包装于BorderLayout中 diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIConstants.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIConstants.java index a668474f82..8ab37f7951 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIConstants.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIConstants.java @@ -1,5 +1,7 @@ package com.fine.theme.utils; +import java.awt.Dimension; + /** * 主题UI常量 * @@ -12,4 +14,12 @@ public class FineUIConstants { public static final int SCALE_FONT_SIZE_12 = FineUIScale.scale(12); public static final int SCALE_FONT_SIZE_13 = FineUIScale.scale(13); + + /** + * 对话框常量 + */ + public static class Dialog { + public static final Dimension POP_DIALOG_MEDIUM = FineUIScale.scale(new Dimension(360, 400)); + + } } 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 4d957a72cc..925c0a438d 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 @@ -42,6 +42,7 @@ public interface FineUIStyle { String TRANSPARENT_TEXT_FIELD = "transparentTextField"; String TRANSPARENT_BACKGROUND = "transparentBackground"; String PURE_LIST = "pureList"; + String NO_BORDER_LIST = "noBorderList"; String PURE_TREE = "pureTree"; String PASTEL_BUTTON = "pastelButton"; String BREADCRUMB_BUTTON = "breadcrumbButton"; diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index ae2c70c53e..9d0c8dc3b8 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -1,5 +1,6 @@ package com.fr.design.actions.file; +import com.fine.swing.ui.layout.Row; import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIStyle; @@ -478,17 +479,20 @@ public class PreferencePane extends BasicPane { //gc面板 gcControlPane = createGcControlPane(); + boolean supportV2 = VcsHelper.getInstance().checkV2FunctionSupport(); + boolean legacyMode = VcsHelper.getInstance().isLegacyMode(); + Component savePane = FineUIUtils.wrapComponentWithTitle(column(10, cell(vcsEnableCheckBox), - cell(saveIntervalPane).with(it -> it.setVisible(VcsHelper.getInstance().checkV2FunctionSupport())) + cell(saveIntervalPane).with(it -> it.setVisible(supportV2)) ).getComponent(), i18nText("Fine-Design_Vcs_Save_Setting")); Component vcsPane = FineUIUtils.wrapComponentWithTitle(column(10, cell(remindVcsLabel), cell(intervalPanel), - cell(saveCommitCheckBox).with(it -> it.setVisible(VcsHelper.getInstance().isLegacyMode())), - cell(autoCleanPane), - cell(gcControlPane).with(it -> it.setVisible(VcsHelper.getInstance().isLegacyMode())) + cell(saveCommitCheckBox).with(it -> it.setVisible(legacyMode)), + cell(autoCleanPane).with(it -> it.setVisible(supportV2)), + cell(gcControlPane).with(it -> it.setVisible(legacyMode)) ).getComponent(), i18nText("Fine-Design_Vcs_Clean_Setting")); JPanel containPane = column(SETTING_V_GAP, cell(savePane), @@ -522,12 +526,15 @@ public class PreferencePane extends BasicPane { }; private JPanel createAutoCleanPane() { - JPanel autoCleanPane = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); + Row autoCleanPane = new Row(); + autoCleanPane.setSpacing(2); useVcsAutoCleanScheduleCheckBox = new UICheckBox(); autoCleanIntervalComboBox = new UIComboBox(INTERVAL); autoCleanIntervalComboBox.setSelectedIndex(DEFAULT_INDEX); autoCleanRetainIntervalComboBox = new UIComboBox(INTERVAL); autoCleanRetainIntervalComboBox.setSelectedIndex(DEFAULT_INDEX); + autoCleanIntervalComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); + autoCleanRetainIntervalComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX); autoCleanPane.add(useVcsAutoCleanScheduleCheckBox); autoCleanPane.add(new UILabel(i18nText("Fine-Design_Vcs_Auto_Clean_Every"))); autoCleanPane.add(autoCleanIntervalComboBox); diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 0328bbc868..5e4eca0ca4 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -314,6 +314,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { // text initFormulaTextArea(); UIScrollPane formulaTextAreaScrollPane = new UIScrollPane(formulaTextArea); + formulaTextArea.setBorder(null); formulaTextAreaScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); // buttonPane diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java index e501401217..3433210a8c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java @@ -9,22 +9,15 @@ import com.fr.stable.Constants; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingUtilities; -import javax.swing.border.Border; import java.awt.AWTEvent; -import java.awt.BasicStroke; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Component; import java.awt.Dialog; import java.awt.Frame; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Insets; import java.awt.Point; import java.awt.Polygon; import java.awt.Rectangle; import java.awt.Shape; -import java.awt.Stroke; import java.awt.Toolkit; import java.awt.Window; import java.awt.event.AWTEventListener; @@ -326,27 +319,7 @@ public abstract class UIBubbleFloatPane extends BasicBeanPane { final JPanel contentPane = (JPanel) this.getContentPane(); this.setLayout(null); contentPane.add(UIBubbleFloatPane.this); - contentPane.setBorder(new Border() { - @Override - public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { - Graphics2D g2d = (Graphics2D) g; - Stroke oldStroke = g2d.getStroke(); - g2d.setStroke(new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND)); - g2d.setColor(new Color(51, 51, 51)); - g2d.drawPolygon((Polygon) getShape4Board()); - g2d.setStroke(oldStroke); - } - - @Override - public Insets getBorderInsets(Component c) { - return null; - } - - @Override - public boolean isBorderOpaque() { - return false; - } - }); + contentPane.setBorder(null); } /** diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/UINameEdList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/UINameEdList.java index 131adbed7a..d1ec33486d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/UINameEdList.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilist/UINameEdList.java @@ -1,11 +1,14 @@ package com.fr.design.gui.ilist; +import com.fine.theme.utils.FineUIStyle; import com.fr.general.NameObject; import com.fr.stable.Nameable; import javax.swing.ListModel; import java.awt.Point; +import static com.fine.theme.utils.FineUIStyle.setStyle; + /** * Created by plough on 2017/7/23. */ @@ -14,6 +17,7 @@ public class UINameEdList extends JNameEdList { protected UINameEdList(ListModel dataModel) { super(dataModel); + setStyle(this, FineUIStyle.NO_BORDER_LIST); } public Object getType(int index) { diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java index 9cdc3b0ef5..728a52336a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java @@ -39,6 +39,7 @@ import javax.swing.text.Document; import javax.swing.text.Element; import javax.swing.text.Highlighter; +import com.fr.design.border.FineBorderFactory; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.focusabletip.FocusableTip; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.Fold; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.folding.FoldManager; @@ -318,6 +319,7 @@ private boolean fractionalFontMetricsEnabled; * Constructor. */ public RSyntaxTextArea() { + initBorder(); } @@ -328,6 +330,7 @@ private boolean fractionalFontMetricsEnabled; */ public RSyntaxTextArea(RSyntaxDocument doc) { super(doc); + initBorder(); } /** @@ -337,6 +340,7 @@ private boolean fractionalFontMetricsEnabled; */ public RSyntaxTextArea(String text) { super(text); + initBorder(); } @@ -350,6 +354,7 @@ private boolean fractionalFontMetricsEnabled; */ public RSyntaxTextArea(int rows, int cols) { super(rows, cols); + initBorder(); } @@ -364,6 +369,7 @@ private boolean fractionalFontMetricsEnabled; */ public RSyntaxTextArea(String text, int rows, int cols) { super(text, rows, cols); + initBorder(); } @@ -379,6 +385,7 @@ private boolean fractionalFontMetricsEnabled; */ public RSyntaxTextArea(RSyntaxDocument doc, String text,int rows,int cols) { super(doc, text, rows, cols); + initBorder(); } @@ -390,6 +397,7 @@ private boolean fractionalFontMetricsEnabled; */ public RSyntaxTextArea(int textMode) { super(textMode); + initBorder(); } @@ -435,6 +443,11 @@ private boolean fractionalFontMetricsEnabled; } + protected void initBorder() { + setBorder(FineBorderFactory.createWrappedRoundBorder()); + } + + /** * Adds the parser to "validate" the source code in this text area. This diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 6d33c5946b..09ea0d2052 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -974,6 +974,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void resetButtonIcon() { button.setBackground(new Color(0, 0, 0, 0)); + button.setSelected(false); if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) { iconSuffix = ICON_SUFFIX_NORMAL; button.setIcon(new LazyIcon(getBtnIconId(), ICON_WIDTH)); @@ -994,8 +995,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { iconSuffix = ICON_SUFFIX_SELECTED_DEPRECATED; button.setIcon(IconUtils.readIcon(getBtnIconUrl())); } - button.setBackground(selectedBtnBackground); button.setOpaque(true); + button.setSelected(true); selectedItem = this; } diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index 600a182732..5725a2a889 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -1,11 +1,11 @@ package com.fr.design.web; import com.fine.theme.light.ui.FineRoundBorder; +import com.fine.theme.utils.FineUIScale; import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; import com.fr.base.Icon; import com.fr.base.IconManager; -import com.fr.design.border.FineBorderFactory; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; @@ -16,14 +16,10 @@ import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.iscrollbar.UIScrollBar; -import com.fr.design.gui.itextarea.DescriptionTextArea; 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.DesignerContext; import com.fr.design.utils.ImageUtils; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.ComparatorUtils; @@ -35,15 +31,12 @@ import com.fr.transaction.WorkerFacade; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Window; -import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JComponent; @@ -63,8 +56,9 @@ import java.awt.event.FocusListener; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; -import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.fix; import static com.fine.swing.ui.layout.Layouts.row; /** @@ -116,7 +110,7 @@ public class CustomIconPane extends BasicPane { cell(desLabel).weight(0.1) ).getComponent()); - JPanel eastPane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); + JPanel eastPane = new JPanel(new BorderLayout()); JPanel buttonPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); // 增加、删除、编辑按钮 @@ -124,7 +118,7 @@ public class CustomIconPane extends BasicPane { initRemoveButton(buttonPane); initEditButton(buttonPane); - eastPane.add(buttonPane); + eastPane.add(buttonPane, BorderLayout.NORTH); this.add(column(10, cell(iconLabel), row(10, cell(centerPane).weight(0.9), cell(eastPane).weight(0.1)).weight(1.0) @@ -425,19 +419,11 @@ public class CustomIconPane extends BasicPane { private void init() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] columnSize = {p, p}; UIButton browseButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_SelectIcon")); - browseButton.setPreferredSize(new Dimension(80, 25)); browseButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Click_this_button")); nameTextField = new UITextField(20); - browseButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - onBrowseButtonClicked(SwingUtilities.getWindowAncestor(EditIconDialog.this)); - } - }); + browseButton.addActionListener(e -> onBrowseButtonClicked(SwingUtilities.getWindowAncestor(EditIconDialog.this))); // 焦点丢失时看看名称是否已经存在 nameTextField.addFocusListener(new FocusListener() { @@ -458,16 +444,22 @@ public class CustomIconPane extends BasicPane { } }); - JPanel imagePane = new JPanel(); - imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0)); showImageLabel = new UILabel(); - showImageLabel.setPreferredSize(new Dimension(50, 50)); - imagePane.add(showImageLabel); - imagePane.add(browseButton); - Component[][] components = {{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":"), nameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":"), imagePane}}; - - JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - this.add(centerPane, BorderLayout.CENTER); + showImageLabel.setPreferredSize(FineUIScale.scale(new Dimension(50, 50))); + + JPanel centerPane = column(10, + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":")).weight(1.2), + cell(nameTextField).weight(3) + ), + row( + cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":")).weight(1.2), + row( + cell(showImageLabel), column(fix(13), cell(browseButton), fix(13)).weight(1) + ).weight(3) + ) + ).getComponent(); + this.add(centerPane, BorderLayout.WEST); } private void onBrowseButtonClicked(Window parent) { diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index ccca737b31..d12a025f54 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -1,8 +1,11 @@ package com.fr.file; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineComponentsFactory; +import com.fine.theme.utils.FineLayoutBuilder; import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; @@ -28,8 +31,6 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; @@ -86,7 +87,6 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.Insets; import java.awt.Window; import java.awt.event.ActionEvent; @@ -112,6 +112,7 @@ 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.fine.theme.utils.FineUIScale.scale; import static javax.swing.JOptionPane.DEFAULT_OPTION; import static javax.swing.JOptionPane.WARNING_MESSAGE; @@ -1788,10 +1789,6 @@ public class FILEChooserPane extends BasicPane { UILabel newNameLabel = new UILabel(Toolkit.i18nText( "Fine-Design_Basic_Enter_New_Folder_Name") ); - newNameLabel.setHorizontalAlignment(SwingConstants.RIGHT); - newNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); - newNameLabel.setPreferredSize(new Dimension(118, 15)); - // 文件名输入框 nameField = new UITextField(); nameField.getDocument().addDocumentListener(new DocumentListener() { @@ -1809,12 +1806,9 @@ public class FILEChooserPane extends BasicPane { } }); nameField.selectAll(); - nameField.setPreferredSize(new Dimension(180, 20)); - - JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5)); - topPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15)); - topPanel.add(newNameLabel); - topPanel.add(nameField); + JPanel topPanel = FineLayoutBuilder.createHorizontalLayout(10, new double[]{1,1}, + newNameLabel, nameField + ); // 增加enter以及esc快捷键的支持 nameField.addKeyListener(new KeyAdapter() { @@ -1831,54 +1825,32 @@ public class FILEChooserPane extends BasicPane { }); // 重名提示 warnLabel = new UILabel(); - warnLabel.setPreferredSize(new Dimension(300, 30)); - warnLabel.setHorizontalAlignment(SwingConstants.LEFT); - warnLabel.setForeground(Color.RED); + FineUIStyle.setStyle(warnLabel, FineUIStyle.LABEL_WARNING_TIP); warnLabel.setVisible(false); JPanel midPanel = new JPanel(new BorderLayout()); - midPanel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); midPanel.add(warnLabel, BorderLayout.WEST); // 确认按钮 confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Confirm")); - confirmButton.setPreferredSize(new Dimension(60, 25)); - confirmButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - confirmClose(); - } - }); + confirmButton.addActionListener(e -> confirmClose()); // 取消按钮 UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); - cancelButton.setPreferredSize(new Dimension(60, 25)); - cancelButton.addActionListener(new ActionListener() { + cancelButton.addActionListener(e -> dispose()); - public void actionPerformed(ActionEvent e) { - dispose(); - } - }); - JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - bottomPanel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); - bottomPanel.add(confirmButton); - bottomPanel.add(cancelButton); - - this.add( - TableLayoutHelper.createTableLayoutPane( - new Component[][]{ - new Component[]{topPanel}, - new Component[]{midPanel}, - new Component[]{bottomPanel} - }, - new double[]{TableLayout.FILL, TableLayout.FILL, TableLayout.FILL}, - new double[]{TableLayout.FILL} - ), - BorderLayout.CENTER); - - - this.setSize(340, 180); + JPanel bottomPanel = FineComponentsFactory.createConfirmCancelButtonPane(confirmButton, cancelButton); + + JPanel panel = new JPanel(new BorderLayout(0, scale(10))); + panel.add(topPanel, BorderLayout.NORTH); + panel.add(midPanel, BorderLayout.CENTER); + panel.add(bottomPanel, BorderLayout.SOUTH); + panel.setBorder(new ScaledEmptyBorder(20, 10, 20, 10)); + this.add(panel, BorderLayout.CENTER); + + this.setSize(scale(new Dimension(360, 180))); this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Mkdir")); this.setResizable(false); this.setAlwaysOnTop(true); 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 e86a1bc900..eab36f69ae 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 @@ -427,7 +427,7 @@ HelpButton.innerFocusWidth = $?Button.innerFocusWidth #---- List ---- -List.border = 0,0,0,0 +List.border = 4,0,4,0 List.cellMargins = 1,12,1,12 List.selectionInsets = 0,4,0,4 List.selectionArc = 2 @@ -1167,7 +1167,7 @@ HeaderPane.height=$Component.defaultHeight #---- East ---- East.border = $defaultBorderColor -East.TabSelectedColor = #B3CFF9 +East.TabSelectedColor = @selectionBackground #---- South ---- South.SheetTabRadius = 6 @@ -1195,6 +1195,7 @@ Center.ZoneBorderColor = #E6E9EF Center.GridColumnRowColor=#e8e8e9 Center.GridColumnRowSelectedColor=fade(@BrandColor, 12%) Center.GridColumnRowEditedColor=#e9ecf1 +Center.GridCornerFill=fade(#0A1C38, 47%) Center.SpaceColor = #FFF Center.border = 0, 10, 10, 10 Center.arc=10 @@ -1363,6 +1364,9 @@ chart.selectedBorderColor = #2576EF [style]List.pureList = \ background: $fill.normal +[style]List.noBorderList = \ + border: 0,0,0,0 + [style]Tree.pureTree = \ background: $fill.normal diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index 5d91eea462..58c027fc42 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -4,6 +4,8 @@ package com.fr.design.mainframe.chart.gui; * Created by hufan on 2016/10/20. */ +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; import com.fr.base.Utils; import com.fr.chart.base.AttrChangeConfig; @@ -20,22 +22,16 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -44,20 +40,16 @@ import java.awt.event.MouseListener; import java.util.ArrayList; import java.util.List; +import static com.fine.theme.utils.FineUIScale.scale; import static com.fr.design.i18n.Toolkit.i18nText; /** * 图表切换设置面板 */ public class ChangeConfigPane extends BasicBeanPane { - private static final int WIDTH = 100; - private static final int EDIT_AREA_WIDTH = 180; - private static final int LABEL_WIDTH = 20; + private static final int WIDTH = scale(100); private static final int MIN_TIME = 0; private static final int MAX_TIME = Integer.MAX_VALUE; - private static final int CONSTANT_TEN = 10; - private static final int CONSTANT_THIRTY = 30; - private static final int CONSTANT_ZERO = 0; private static final int COL_COUNT = 4; private JPanel contentPane; //配置方式按钮 @@ -84,7 +76,7 @@ public class ChangeConfigPane extends BasicBeanPane { public ChangeConfigPane() { init(); this.setLayout(new BorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 15, 10, 15)); + this.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); this.add(createScrollPane(), BorderLayout.CENTER); } @@ -101,20 +93,15 @@ public class ChangeConfigPane extends BasicBeanPane { initButtonGroup(); configPane = createConfigPane(); contentPane = createContentPane(); - contentPane.setBorder(BorderFactory.createEmptyBorder(CONSTANT_TEN, CONSTANT_THIRTY, CONSTANT_TEN, CONSTANT_THIRTY)); } private JPanel createContentPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ new Component[]{new UILabel(i18nText("Fine-Design_Chart_Change_Style")), configStyleButton}, new Component[]{configPane, null}, new Component[]{createButtonContentPane(), null} }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); } private JPanel createConfigPane() { @@ -136,39 +123,29 @@ public class ChangeConfigPane extends BasicBeanPane { panel.add(buttonConfigPane, "button"); panel.add(carouselConfigPane, "carousel"); - panel.setBorder(BorderFactory.createEmptyBorder(CONSTANT_ZERO, CONSTANT_TEN, CONSTANT_ZERO, CONSTANT_ZERO)); - return panel; } private JPanel createCarouseConfigPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f, p}; - double[] rowSize = {p, p, p}; timeInterval = new UISpinner(MIN_TIME, MAX_TIME, 1, 0); colorSelectBox4carousel = new ColorSelectBoxWithOutTransparent(WIDTH); switchStyleGroup = new UIButtonGroup(new String[]{i18nText("Fine-Design_Chart_Show"), i18nText("Fine-Design_Report_Hide")}); + JPanel timeIntervalPane = FineLayoutBuilder.createHorizontalLayout(5, timeInterval, new UILabel(i18nText("Fine-Design_Chart_Time_Second"))); Component[][] components = new Component[][]{ - new Component[]{new UILabel(i18nText("Fine-Design_Chart_Arrow_Style")), switchStyleGroup, null}, - new Component[]{new UILabel(i18nText("Fine-Design_Chart_Time_Interval")), timeInterval, new UILabel(i18nText("Fine-Design_Chart_Time_Second"))}, - new Component[]{new UILabel(i18nText("Fine-Design_Basic_Background")), colorSelectBox4carousel, null} + new Component[]{new UILabel(i18nText("Fine-Design_Chart_Arrow_Style")), switchStyleGroup}, + new Component[]{new UILabel(i18nText("Fine-Design_Chart_Time_Interval")), timeIntervalPane}, + new Component[]{new UILabel(i18nText("Fine-Design_Basic_Background")), colorSelectBox4carousel} }; - return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); } private JPanel createTitleStylePane() { final UILabel text = new UILabel(i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); styleAttrPane = new ChartTextAttrPane() { protected JPanel getContentPane(JPanel buttonPane) { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f, EDIT_AREA_WIDTH}; - double[] rowSize = {p, p}; - - return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, getComponents(buttonPane), new double[]{1.2, 3}); } protected Component[][] getComponents(JPanel buttonPane) { @@ -184,54 +161,44 @@ public class ChangeConfigPane extends BasicBeanPane { private JPanel createButtonBackgroundColorPane() { colorSelectBox4button = new ColorSelectBoxWithOutTransparent(WIDTH); - return TableLayout4VanChartHelper.createGapTableLayoutPane(i18nText("Fine-Design_Basic_Background"), colorSelectBox4button, EDIT_AREA_WIDTH); + return FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, + new UILabel(i18nText("Fine-Design_Basic_Background")), + colorSelectBox4button); } private JPanel createButtonContentPane() { - JPanel buttonContentPane = new JPanel(new BorderLayout()); + JPanel buttonContentPane = new JPanel(new BorderLayout(0, scale(10))); chartTypesPane = new JPanel(); - chartTypesPane.setLayout(new BoxLayout(chartTypesPane, BoxLayout.Y_AXIS)); - chartTypesPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + chartTypesPane.setLayout(new BorderLayout()); switchTitlePane.setLayout(new CardLayout()); - JPanel titleEditPane = TableLayout4VanChartHelper.createGapTableLayoutPane( - i18nText("Fine-Design_Chart_Switch_Title_Label"), - switchTitlePane, - EDIT_AREA_WIDTH + JPanel titleEditPane = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1.2, 3}, + new UILabel(i18nText("Fine-Design_Chart_Switch_Title_Label")), + switchTitlePane ); - titleEditPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); buttonContentPane.add(chartTypesPane, BorderLayout.NORTH); buttonContentPane.add(titleEditPane, BorderLayout.CENTER); - UIExpandablePane expandablePane = new UIExpandablePane(i18nText("Fine-Design_Chart_Button_And_Rotation_Content"), buttonContentPane) { - protected void setcontentPanelontentPanelBorder() { - - } - }; - expandablePane.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0)); - return expandablePane; + return new UIExpandablePane(i18nText("Fine-Design_Chart_Button_And_Rotation_Content"), buttonContentPane); } private void populateButtonContentPane(ChartCollection collection) { int count = collection.getChartCount(); int select = collection.getSelectedIndex(); - JPanel pane = null; + chartTypesPane.removeAll(); + ArrayList buttons = new ArrayList<>(); for (int i = 0; i < count; i++) { - if (i % COL_COUNT == 0) { - pane = new JPanel(new FlowLayout(FlowLayout.LEFT)); - chartTypesPane.add(pane); - } - ChangeChartButton button = new ChangeChartButton(i, collection); changeChartButtons.add(button); button.setSelected(i == select); - pane.add(button); + buttons.add(button); populateSwitchTitlePane(i, collection); } + chartTypesPane.add(FineLayoutBuilder.createCommonTableLayout(COL_COUNT, 10, 10, buttons)); showSwitchTitleCard(collection.getChartName(select)); chartTypesPane.revalidate(); @@ -258,22 +225,17 @@ public class ChangeConfigPane extends BasicBeanPane { } private JPanel createButtonConfigPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ new Component[]{createTitleStylePane(), null}, new Component[]{createButtonBackgroundColorPane(), null}, }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); } private void initButtonGroup() { configStyleButton = new UIButtonGroup(new String[]{i18nText("Fine-Design_Chart_Button_Style"), i18nText("Fine-Design_Chart_Carousel_Style")}); - configStyleButton.setPreferredSize(new Dimension(WIDTH * 2, (int) configStyleButton.getPreferredSize().getHeight())); configStyleButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -359,8 +321,6 @@ public class ChangeConfigPane extends BasicBeanPane { } private class ChangeChartButton extends UIToggleButton { - private static final int BUTTON_WIDTH = 52; - private static final int BUTTON_HEIGHT = 20; private ChartCollection collection; private int buttonIndex; @@ -384,9 +344,6 @@ public class ChangeConfigPane extends BasicBeanPane { }; } - public Dimension getPreferredSize() { - return new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT); - } } private void resetChangeChartButtons() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 5261223840..57ad71a50d 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.chart.gui; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIConstants; import com.fine.theme.utils.FineUIStyle; import com.fr.base.BaseUtils; import com.fr.chart.base.AttrChangeConfig; @@ -64,11 +65,7 @@ import static com.fine.swing.ui.layout.Layouts.row; */ public class ChartTypeButtonPane extends BasicBeanPane implements UIObserver { private static final long serialVersionUID = -8130803225718028933L; - private static final int B_W = 52; - private static final int B_H = 20; private static final int COL_COUNT = 4; - private static final int P_W = 300; - private static final int P_H = 400; private static Set> supportChangeConfigChartClassSet = new HashSet>(); @@ -228,7 +225,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } }); - dialog.setSize(P_W, P_H); + dialog.setSize(FineUIConstants.Dialog.POP_DIALOG_MEDIUM); dialog.setVisible(true); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java index 4dcf5193ec..5a1850f709 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java @@ -228,7 +228,7 @@ public class ChartDataFilterPane extends ThirdTabPane { preDataNumPane = column(10, row(cell(label).weight(1.2), cell(preDataNum).weight(3)), cell(combineOther) - ).getComponent(); + ).with(it -> it.setBorder(new ScaledEmptyBorder(0, 10, 0, 0))).getComponent(); preDataNumPane.setVisible(false); notShowNull = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_Not_Show_Cate")); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/AutoRefreshPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/AutoRefreshPane.java index f5b1004d58..818030cfba 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/AutoRefreshPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/AutoRefreshPane.java @@ -2,6 +2,7 @@ package com.fr.van.chart.designer.other; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIConstants; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; @@ -26,6 +27,7 @@ import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + /** * Created by hufan on 2016/12/30. */ @@ -130,6 +132,7 @@ public class AutoRefreshPane extends BasicBeanPane { } }); + dialog.setPreferredSize(FineUIConstants.Dialog.POP_DIALOG_MEDIUM); dialog.pack(); dialog.setModal(true); dialog.setVisible(true); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java index c22cf2318a..1664b21ecf 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java @@ -3,6 +3,7 @@ package com.fr.van.chart.designer.style.axis.component; import com.fine.swing.ui.layout.Column; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIScale; import com.fr.base.BaseUtils; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButton; @@ -214,7 +215,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane { } private class ChartAxisButton extends UIToggleButton { - private static final double DEL_WIDTH = 10; + private final double DEL_WIDTH = FineUIScale.scale(10); private static final long serialVersionUID = -3701452534814584608L; private BufferedImage closeIcon = BaseUtils.readImageWithCache("com/fr/design/images/toolbarbtn/chartChangeClose.png"); private boolean isMoveOn = false; @@ -231,7 +232,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane { } public Dimension getPreferredSize() { - return new Dimension(B_W, B_H); + return FineUIScale.scale(new Dimension(B_W, B_H)); } private void paintDeleteButton(Graphics g2d) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartMapLayerAndDataTabPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartMapLayerAndDataTabPane.java index 6f7e59ebcd..74f97f53a5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartMapLayerAndDataTabPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartMapLayerAndDataTabPane.java @@ -1,5 +1,6 @@ package com.fr.van.chart.drillmap.designer.data; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.MultiTabPane; @@ -35,6 +36,7 @@ public class VanChartMapLayerAndDataTabPane extends MultiTabPane { }; this.setLayout(new BorderLayout()); + this.setBorder(new ScaledEmptyBorder(10, 0, 0, 0)); this.add(dataDefinitionType, BorderLayout.CENTER); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java index 7497559916..2f6f6a905a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java @@ -1,7 +1,9 @@ package com.fr.van.chart.drillmap.designer.data.comp; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; @@ -52,7 +54,6 @@ public class DrillMapLayerPane extends BasicScrollPane { @Override protected void layoutContentPane() { leftcontentPane = createContentPane(); - leftcontentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); this.add(leftcontentPane); } @@ -67,26 +68,13 @@ public class DrillMapLayerPane extends BasicScrollPane { JPanel mapDataTreePanel = new JPanel(new BorderLayout()); mapDataTreePanel.add(mapDataTree); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{createTitlePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_Tree"), mapDataTreePanel)}, - new Component[]{createTitlePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_Detail"), createLayerDetailPane())} + new Component[]{new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_Tree"), mapDataTreePanel, true)}, + new Component[]{new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_Detail"), createLayerDetailPane())} }; - JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - JPanel panel = new JPanel(new BorderLayout()); - panel.add(contentPane, BorderLayout.CENTER); - return panel; - } - - private JPanel createTitlePane (String title, JPanel panel) { - JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); - panel.setBorder(BorderFactory.createEmptyBorder(10,5,0,0)); - jPanel.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); - return jPanel; + JPanel contentPane = FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1}); + return FineLayoutBuilder.asBorderLayoutWrapped(contentPane); } private JPanel createLayerDetailPane() { @@ -111,7 +99,7 @@ public class DrillMapLayerPane extends BasicScrollPane { detailComps[i + 1] = new Component[]{label, level, type}; } - return TableLayoutHelper.createGapTableLayoutPane(detailComps, rowSize, columnSize, 10, 6); + return TableLayoutHelper.createGapTableLayoutPane(detailComps, rowSize, columnSize, 5, 6); } /** diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java index 034c621d57..e0c1622ac0 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java @@ -1,13 +1,12 @@ package com.fr.van.chart.drillmap.designer.data.comp; -import com.fr.design.constants.UIConstants; +import com.fr.design.border.FineBorderFactory; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; import com.fr.stable.StringUtils; -import javax.swing.BorderFactory; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; @@ -17,6 +16,9 @@ import javax.swing.tree.TreePath; import java.awt.Component; import java.util.Enumeration; +import static com.fine.theme.utils.FineUIStyle.PURE_TREE; +import static com.fine.theme.utils.FineUIStyle.setStyle; + /** * Created by Mitisky on 16/5/3. */ @@ -30,8 +32,9 @@ public class MapDataTree extends JTree { this.setRootVisible(false); this.setShowsRootHandles(true); this.setInvokesStopCellEditing(true); - this.setBackground(UIConstants.NORMAL_BACKGROUND); this.setCellRenderer(treeCellRenderer); + setBorder(FineBorderFactory.createWrappedRoundBorder()); + setStyle(this, PURE_TREE); } private DefaultTreeModel model = new DefaultTreeModel(null); @@ -114,10 +117,6 @@ public class MapDataTree extends JTree { DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value; String name = getPresentName(treeNode); this.setText(name); - this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); - this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND); - this.setForeground(UIConstants.FONT_COLOR); - this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); return this; } }; diff --git a/designer-realize/src/main/java/com/fr/grid/GridCorner.java b/designer-realize/src/main/java/com/fr/grid/GridCorner.java index 8776a11b6c..f62b923ab3 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridCorner.java +++ b/designer-realize/src/main/java/com/fr/grid/GridCorner.java @@ -3,6 +3,7 @@ */ package com.fr.grid; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.GraphHelper; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerUIModeConfig; @@ -70,14 +71,14 @@ public class GridCorner extends BaseGridComponent { private void paintArc(Graphics2D g2d, Dimension size, float time) { - g2d.setColor(UIConstants.LINE_COLOR); + g2d.setColor(FlatUIUtils.getUIColor("Center.GridCornerFill", UIConstants.LINE_COLOR)); float height = 2 * time; float width = 2 * time; float hgap = 4 * time; float vgap = 3 * time; int x = (int) ((size.width - (hgap * 2 + width * 3)) / 2); - int y = (int) (size.height - (vgap * 2 + height * 3)); + int y = (int) (size.height - (vgap * 3 + height * 3)); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { GraphHelper.fillRect(g2d, x + (i * hgap), y + (j * vgap), width, height); diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellImageQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellImageQuickEditor.java index 7afc66bc62..ee87e18d23 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellImageQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellImageQuickEditor.java @@ -1,13 +1,12 @@ package com.fr.quickeditor.cellquick; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.base.Style; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.ImageCellAction; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.report.SelectImagePane; @@ -17,11 +16,6 @@ import com.fr.quickeditor.CellQuickEditor; import com.fr.report.cell.cellattr.CellImage; import javax.swing.JComponent; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; /** * 单元格元素图片编辑器 @@ -37,20 +31,10 @@ public class CellImageQuickEditor extends CellQuickEditor { @Override public JComponent createCenterBody() { - JPanel content = new JPanel(new BorderLayout()); UIButton editButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit")); - editButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - showEditingDialog(); - } - }); + editButton.addActionListener(e -> showEditingDialog()); editButton.setOpaque(false); - content.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{EMPTY_LABEL, editButton}}, - new double[]{TableLayout.PREFERRED}, - new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP), BorderLayout.CENTER); - return content; + return FineLayoutBuilder.asBorderLayoutWrapped(editButton); } private void showEditingDialog() { diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java index efddda0adf..8418b5fa71 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java @@ -1,19 +1,14 @@ package com.fr.quickeditor.cellquick; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.RichTextCellAction; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.quickeditor.CellQuickEditor; -import javax.swing.Icon; import javax.swing.JComponent; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; /** * 单元格元素富文本编辑器 @@ -30,14 +25,9 @@ public class CellRichTextEditor extends CellQuickEditor { @Override public JComponent createCenterBody() { - JPanel content = new JPanel(new BorderLayout()); richTextButton = new UIButton(); richTextButton.setOpaque(false); - content.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ - new Component[]{EMPTY_LABEL, richTextButton}}, - new double[]{TableLayout.PREFERRED}, - new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP), BorderLayout.CENTER); - return content; + return FineLayoutBuilder.asBorderLayoutWrapped(richTextButton); } @Override