diff --git a/designer-base/src/main/java/com/fine/theme/icon/IconManager.java b/designer-base/src/main/java/com/fine/theme/icon/IconManager.java index ae60070880..aa2ef8b173 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/IconManager.java +++ b/designer-base/src/main/java/com/fine/theme/icon/IconManager.java @@ -144,6 +144,21 @@ public class IconManager { || FileExtension.JPG.matchExtension(path); } + /** + * 判断是否存在指定id的icon,非io读取行为,而是从已注册的sourceMap中遍历判断 + * + * @param id id + * @return 是否存在 + */ + public static boolean existIcon(String id) { + for (IconSet set : ICON_SETS) { + if (set.getIds().contains(id)) { + return true; + } + } + return false; + } + /** * 清理所有缓存 */ diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FinePanelUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FinePanelUI.java new file mode 100644 index 0000000000..e06fefd43c --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FinePanelUI.java @@ -0,0 +1,54 @@ +package com.fine.theme.light.ui; + +import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatPanelUI; +import org.jetbrains.annotations.Nullable; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.plaf.ComponentUI; + +import static com.fine.theme.utils.FineClientProperties.PANEL_TYPE; +import static com.fine.theme.utils.FineClientProperties.ROUNDED_PANEL; + +/** + * Panel 面板UI + * + * @author Levy.Xie + * @since 11.0 + * Created on 2024/08/02 + */ +public class FinePanelUI extends FlatPanelUI { + + /** + * @param shared + * @since 2 + */ + protected FinePanelUI(boolean shared) { + super(shared); + } + + /** + * 创建UI + */ + public static ComponentUI createUI(JComponent c) { + return new FinePanelUI(false); + } + + @Override + protected void installDefaults(JPanel p) { + super.installDefaults(p); + if (ROUNDED_PANEL.equals(getPanelTypeStr(p))) { + this.arc = FineUIUtils.getUIInt("Panel.arc", "Component.arc"); + } + } + + @Nullable + static String getPanelTypeStr(JPanel p) { + Object value = p.getClientProperty(PANEL_TYPE); + if (value instanceof String) { + return (String) value; + } + return null; + } +} diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java b/designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java index acbbcb1577..038e53a8cf 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java @@ -24,6 +24,10 @@ public interface FineClientProperties extends FlatClientProperties { String BUTTON_GROUP_POSITION = "group_position"; + //--------------------------- Panel ---------------------------- + String PANEL_TYPE = "panelType"; + String ROUNDED_PANEL = "roundedPanel"; + int GROUP_BUTTON_POSITION_INNER = 0; int GROUP_BUTTON_POSITION_LEFT = 1; int GROUP_BUTTON_POSITION_RIGHT = 2; 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 new file mode 100644 index 0000000000..a668474f82 --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIConstants.java @@ -0,0 +1,15 @@ +package com.fine.theme.utils; + +/** + * 主题UI常量 + * + * @author Levy.Xie + * @since 11.0 + * Created on 2024/08/05 + */ +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); +} 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 d7cee71f4b..1aa828c578 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 @@ -33,13 +33,16 @@ public interface FineUIStyle { String PLAIN_BUTTON = "plainButton"; String TOGGLE_GROUP = "inToggleGroup"; String COMPACT_BUTTON = "compactButton"; - String ROUND_BORDER_PANEL = "roundBorder"; - String MENU_TOOL_BAR = "menuToolBar"; String MENU_ITEM_TOOL_BAR = "menuItemToolBar"; String POPUP_MENU_TOOL_BAR = "popupMenuToolBar"; String POPUP_MENU_DROPDOWN = "dropdownPopupMenu"; String TRANSPARENT_TEXT_FIELD = "transparentTextField"; + String PURE_LIST = "pureList"; + String PURE_TREE = "pureTree"; + String PASTEL_BUTTON = "pastelButton"; + + String ENV_DECTETOR_BUTTON = "envDetectorButton"; /** 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 bfbc5c2347..82042e978c 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 @@ -114,6 +114,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.fix; import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_12; import static com.fr.design.i18n.Toolkit.i18nText; /** @@ -810,7 +811,7 @@ public class PreferencePane extends BasicPane { i++; } UIDictionaryComboBox languageComboBox = new UIDictionaryComboBox<>(keys, values); - languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, 12));//为了在中文系统中显示韩文 + languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, SCALE_FONT_SIZE_12));//为了在中文系统中显示韩文 return languageComboBox; } diff --git a/designer-base/src/main/java/com/fr/design/actions/help/AboutDialog.java b/designer-base/src/main/java/com/fr/design/actions/help/AboutDialog.java index 4d55af0306..3955ed4802 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/AboutDialog.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/AboutDialog.java @@ -51,6 +51,7 @@ public class AboutDialog extends JDialog implements ActionListener { tabbedPane = FineTabbedPane.builder() .addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About"), aboutPanel) .addTab(com.fr.design.i18n.Toolkit.i18nText("FIne-Design_Basic_System"), sysPane) + .withHeadRatio(0.3f) .build(); buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); diff --git a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java index a57b86f205..9e3ab4feb5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java @@ -60,7 +60,7 @@ public class AboutPane extends JPanel { JPanel contentPane = column().getComponent(); centerPane.add(contentPane, BorderLayout.NORTH); - contentPane.add(new BoxCenterAligmentPane(getBuildTitle())); + contentPane.add(new BoxCenterAligmentPane(getBuildTitle(), FineUIStyle.LABEL_BOLD)); BoxCenterAlignmentCopyablePane buildCopyPane = new BoxCenterAlignmentCopyablePane( StringUtils.EMPTY, getVersionBuildNO(), @@ -73,7 +73,8 @@ public class AboutPane extends JPanel { BoxCenterAligmentPane boxCenterAlignmentPane = new BoxCenterAligmentPane(getCopyRight()); contentPane.add(boxCenterAlignmentPane); - boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About_All_Rights_Reserved")); + boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About_All_Rights_Reserved"), + FineUIStyle.LABEL_BOLD); contentPane.add(boxCenterAlignmentPane); contentPane.add(new BoxCenterAlignmentCopyablePane( @@ -276,6 +277,11 @@ public class AboutPane extends JPanel { private UILabel textLabel; + public BoxCenterAligmentPane(String text, String style) { + this(text); + FineUIStyle.setStyle(textLabel, style); + } + public BoxCenterAligmentPane(String text) { this(new UILabel(text)); } diff --git a/designer-base/src/main/java/com/fr/design/border/FineBorderFactory.java b/designer-base/src/main/java/com/fr/design/border/FineBorderFactory.java index 7867055844..ea6d12c7ba 100644 --- a/designer-base/src/main/java/com/fr/design/border/FineBorderFactory.java +++ b/designer-base/src/main/java/com/fr/design/border/FineBorderFactory.java @@ -1,6 +1,8 @@ package com.fr.design.border; import com.fine.theme.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import javax.swing.BorderFactory; import javax.swing.border.Border; @@ -53,4 +55,17 @@ public class FineBorderFactory { return createToplineBorder(FineUIUtils.getUIColor("Label.borderColor", "defaultBorderColor")); } + /** + * 创建包装的圆角边框,无论内部组件是否圆角,可确保外部为圆角边框 + * + * @return 边框 + */ + public static Border createWrappedRoundBorder() { + return BorderFactory.createCompoundBorder( + new UIRoundedBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.GRAY), 1, + FlatUIUtils.getUIInt("Component.arc", 5)), + new ScaledEmptyBorder(1, 1, 1, 1) + ); + } + } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/ServerTableDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/ServerTableDataWrapper.java index df20f0d07a..fb02f1a3f8 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/ServerTableDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/ServerTableDataWrapper.java @@ -26,7 +26,7 @@ public final class ServerTableDataWrapper extends AbstractTableDataWrapper { public Icon getIcon() { if (tabledata instanceof DBTableData) { if (StringUtils.isBlank(((DBTableData) tabledata).getQuery())) { - return new WarningIcon(SVGLoader.load("/com/fr/design/standard/server_database.svg")); + return new LazyIcon("server_database_warning"); } else { return new LazyIcon("server_database"); 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 3b31822b6d..5c80e2b167 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 @@ -40,17 +40,6 @@ public abstract class BasicScrollPane extends BasicBeanPane{ scrollBar = new UIScrollBar(JScrollBar.VERTICAL) { private static final long serialVersionUID = 155777947121777223L; - @Override - public int getVisibleAmount() { - int preferheight = leftcontentPane.getPreferredSize().height; - if(preferheight <= 0) { - return 0; - } - int e = MAXVALUE * (getHeight() - 1) / preferheight; - setVisibleAmount(e); - return e; - } - @Override public int getMaximum() { return MAXVALUE; 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 2c25ee61e0..0328bbc868 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 @@ -2,12 +2,10 @@ package com.fr.design.formula; import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.LazyIcon; -import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIStyle; -import com.formdev.flatlaf.ui.FlatButtonBorder; -import com.formdev.flatlaf.ui.FlatRoundBorder; import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; import com.fr.base.BaseUtils; import com.fr.base.Parameter; @@ -17,9 +15,9 @@ import com.fr.base.Utils; import com.fr.base.io.IOFile; import com.fr.data.TableDataSource; import com.fr.design.actions.UpdateAction; -import com.fr.design.border.UIRoundedBorder; +import com.fr.design.border.FineBorderFactory; import com.fr.design.constants.LayoutConstants; -import com.fr.design.constants.UIConstants; +import com.fr.design.data.datapane.management.search.pane.FineSearchPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; @@ -75,7 +73,6 @@ import com.fr.stable.script.Tiny; import com.fr.stable.script.TinyHunter; import java.awt.Window; -import javax.swing.SwingConstants; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.Icon; @@ -87,6 +84,7 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTree; +import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @@ -130,7 +128,6 @@ import java.util.Set; import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.cell; -import static com.fine.swing.ui.layout.Layouts.flex; /** * 公式编辑面板 @@ -148,6 +145,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; private RSyntaxTextArea formulaTextArea; private UITextField keyWordTextField = new UITextField(18); + private FineSearchPane searchPane = new FineSearchPane(); private int currentPosition = 0; private int beginPosition = 0; private int insertPosition = 0; @@ -238,7 +236,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } private void initKeyWordTextFieldKeyListener() { - keyWordTextField.addKeyListener(new KeyListener() { + searchPane.addClearActionListener(e -> searchPane.setText(StringUtils.EMPTY)); + searchPane.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { //do nothing @@ -252,12 +251,16 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { - String toFind = keyWordTextField.getText(); + String toFind = searchPane.getText(); search(toFind, false); + popTips(); + searchPane.requestFocusInWindow(); if (tipsList.getSelectedValue() != null) { fixFunctionNameList(tipsList.getSelectedValue().toString()); } e.consume(); + + } } }); @@ -265,28 +268,17 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private JPanel initTipsPane() { // tipsPane - UIButton searchButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Search")); + searchPane.setPlaceholder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Tree_Search_Press_Enter_For_Search")); UILabel formulaLabel = new UILabel( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Input_Formula_In_The_Text_Area_Below") + ":", SwingConstants.LEFT); JPanel containerSPane = row( - cell(formulaLabel), - flex(), - cell(keyWordTextField), - cell(searchButton) + cell(formulaLabel).weight(4), + cell(searchPane).weight(1) ).getComponent(); initKeyWordTextFieldKeyListener(); tipsList = new JList(listModel); tipsList.addMouseListener(new DoubleClick()); - searchButton.addActionListener(e -> { - String toFind = keyWordTextField.getText(); - search(toFind, false); - popTips(); - formulaTextArea.requestFocusInWindow(); - if (tipsList.getSelectedValue() != null) { - fixFunctionNameList(tipsList.getSelectedValue().toString()); - } - }); return containerSPane; } @@ -322,7 +314,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { // text initFormulaTextArea(); UIScrollPane formulaTextAreaScrollPane = new UIScrollPane(formulaTextArea); - formulaTextAreaScrollPane.setBorder(new FlatRoundBorder()); + formulaTextAreaScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); // buttonPane JPanel buttonPane = row(8).getComponent(); @@ -653,9 +645,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { popupMenu = new JPopupMenu(); JScrollPane tipsScrollPane = new JScrollPane(tipsList); popupMenu.add(tipsScrollPane); - tipsScrollPane.setPreferredSize(new Dimension(FineUIScale.scale(240), FineUIScale.scale(146))); - tipsScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); - popupMenu.show(keyWordTextField, 0, 23); + popupMenu.setBorder(FineBorderFactory.createWrappedRoundBorder()); + tipsScrollPane.setPreferredSize(FineUIScale.scale(new Dimension(172, 120))); + popupMenu.show(searchPane, 0, 28); } protected void search(String keyWord, boolean findDescription) { @@ -750,10 +742,9 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } public BasicDialog showLargeWindow(Window window, DialogActionListener l) { - int width = 900; - int height = 640; - BasicDialog basicDialog = super.showWindowWithCustomSize(window, l, FineUIScale.scale(new Dimension(width, height))); - basicDialog.setMinimumSize(FineUIScale.scale(new Dimension(width, height))); + Dimension dimension = new Dimension(900, 640); + BasicDialog basicDialog = super.showWindowWithCustomSize(window, l, dimension); + basicDialog.setMinimumSize(dimension); basicDialog.setResizable(true); return basicDialog; } @@ -1079,7 +1070,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private JPanel initFunctionTypeList() { functionTypeList = new QuickList(functionTypeListModel); UIScrollPane functionTypeScrollPane = new UIScrollPane(functionTypeList); - functionTypeScrollPane.setBorder(new FineRoundBorder()); + functionTypeScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); functionTypeList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); initTypeListCellRenderer(); initGroupTypeModel(); @@ -1194,7 +1185,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private JPanel initFunctionNameList() { functionNameList = new JList(new DefaultListModel()); UIScrollPane functionNameScrollPane = new UIScrollPane(functionNameList); - functionNameScrollPane.setBorder(new FlatButtonBorder()); + functionNameScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); functionNameList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); initFunctionNameListCellRenderer(); initFunctionNameListSelectionListener(); @@ -1207,6 +1198,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { descriptionTextArea = new UITextArea(); descriptionTextArea.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); descriptionTextArea.setLineWrap(true); + descriptionTextArea.setBorder(new ScaledEmptyBorder(4, 4, 4, 4)); descriptionTextArea.setWrapStyleWord(true); descriptionTextArea.setEditable(false); descriptionTextArea.addMouseListener(new MouseAdapter() { @@ -1275,7 +1267,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { // variable variablesTree = new JTree(); UIScrollPane variablesTreePane = new UIScrollPane(variablesTree); - variablesTreePane.setBorder(new FlatRoundBorder()); + variablesTreePane.setBorder(FineBorderFactory.createWrappedRoundBorder()); variablesTree.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); variablesTree.setRootVisible(false); variablesTree.setShowsRootHandles(true); @@ -1285,7 +1277,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { initDescriptionTextArea(); UIScrollPane desScrollPane = new UIScrollPane(descriptionTextArea); - desScrollPane.setBorder(null); + desScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); initVariablesTreeSelectionListener(); return Layouts.row(LayoutConstants.HORIZONTAL_GAP, cell(this.createNamePane( diff --git a/designer-base/src/main/java/com/fr/design/formula/TinyFormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/TinyFormulaPane.java index 087a24fc48..77eaadd89a 100644 --- a/designer-base/src/main/java/com/fr/design/formula/TinyFormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/TinyFormulaPane.java @@ -20,12 +20,12 @@ import static com.fine.swing.ui.layout.Layouts.flex; import static com.fine.swing.ui.layout.Layouts.row; /** - * + * * @author zhou * @since 2012-6-1下午3:50:37 */ public class TinyFormulaPane extends BasicBeanPane implements UIObserver{ - + private static final long serialVersionUID = 1L; protected UITextField formulaTextField; protected UIButton formulaTextFieldButton; @@ -77,18 +77,22 @@ public class TinyFormulaPane extends BasicBeanPane implements UIObserver cell(formulaTextField).weight(2.4), flex(0.1), cell(formulaTextFieldButton).weight(0.5) ).getComponent()) ; } - + /** * 公式窗口点击确定后的事件接口 */ public void okEvent() { - + } - + public UITextField getUITextField() { return formulaTextField; } + public UIButton getFormulaTextFieldButton() { + return formulaTextFieldButton; + } + @Override public void populateBean(String ob) { this.formulaTextField.setText(ob); diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java index f7024d9743..5b6bc8cdea 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java @@ -1,7 +1,6 @@ package com.fr.design.gui.controlpane; import com.fine.theme.icon.LazyIcon; -import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.utils.FineUIScale; import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; @@ -94,7 +93,7 @@ public abstract class JListControlPane extends JControlPane implements ListContr nameableList.setName(LIST_NAME); nameableList.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE)); leftPane.add(new UIScrollPane(nameableList), BorderLayout.CENTER); - leftPane.setBorder(new FineRoundBorder()); + leftPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); nameableList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); nameableList.addMouseListener(listMouseListener); nameableList.addListSelectionListener(new ListSelectionListener() { 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 0a97cb1c11..21729be7e6 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 @@ -1,10 +1,10 @@ package com.fr.design.gui.controlpane; -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.border.FineBorderFactory; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory; @@ -86,13 +86,11 @@ public abstract class UIControlPane extends JControlPane { // 增加边框 JPanel leftPaneWrapper = new JPanel(new BorderLayout()); leftPaneWrapper.add(getLeftPane(), BorderLayout.CENTER); - leftPaneWrapper.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); JPanel rightPaneWrapper = new JPanel(new BorderLayout()); rightPaneWrapper.add(cardPane, BorderLayout.CENTER); - rightPaneWrapper.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); + rightPaneWrapper.setBorder(new ScaledEmptyBorder(0, 10, 0, 0)); // SplitPane JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, leftPaneWrapper, rightPaneWrapper); - mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor())); mainSplitPane.setOneTouchExpandable(true); this.add(mainSplitPane, BorderLayout.CENTER); mainSplitPane.setDividerLocation(getLeftPreferredSize()); @@ -152,7 +150,7 @@ public abstract class UIControlPane extends JControlPane { cell(FRWidgetFactory.createLineWrapLabel(getAddItemText())), cell(topToolBar).with(it -> { it.setBorderPainted(true); - it.setBorder(new FineButtonBorder()); + it.setBorder(FineBorderFactory.createWrappedRoundBorder()); it.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); }).weight(1.0) ).getComponent(); 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 8f39d041dd..e1cab0a75d 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 @@ -1,7 +1,7 @@ package com.fr.design.gui.controlpane; -import com.formdev.flatlaf.ui.FlatRoundBorder; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.border.FineBorderFactory; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilist.JNameEdList; import com.fr.design.gui.ilist.ListModelElement; @@ -76,7 +76,7 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon nameableList.setName(LIST_NAME); UIScrollPane scrollPane = new UIScrollPane(nameableList); leftPane.add(scrollPane, BorderLayout.CENTER); - leftPane.setBorder(new FlatRoundBorder()); + leftPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); nameableList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); nameableList.addMouseListener(getHelper().getListMouseListener(nameableList, this)); diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java index fb21021179..4532dfdeb4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java @@ -1,5 +1,7 @@ package com.fr.design.gui.date; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; import com.fr.base.background.GradientBackground; import com.fr.design.carton.MonthlyCartonFile; @@ -25,6 +27,7 @@ import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.UIManager; +import javax.swing.border.LineBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; @@ -52,6 +55,8 @@ import java.util.Date; import java.util.HashSet; import java.util.Set; +import static com.fine.theme.utils.FineUIScale.scale; + public class UICalendarPanel extends JPanel { private static final Font FONT_UI = DesignUtils.getDefaultGUIFont().applySize(12); private static final Font FONT_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"), Font.PLAIN, 12); @@ -125,15 +130,15 @@ public class UICalendarPanel extends JPanel { dayBttListener = createDayBttListener(); //renderer this - setPreferredSize(new Dimension(218, 179)); - setBackground(new Color(0xFFFFFF)); - setBorder(BorderFactory.createLineBorder(new Color(0x959595))); + setPreferredSize(scale(new Dimension(218, 179))); + setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); + setBorder(new LineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.BLACK))); setLayout(FRGUIPaneFactory.createBorderLayout()); add(BorderLayout.NORTH, createNorthPane()); add(BorderLayout.CENTER, createCenterPane()); if (isTimerPicker) { - setPreferredSize(new Dimension(218, 209)); + setPreferredSize(scale(new Dimension(218, 209))); add(BorderLayout.SOUTH, createSouthPane()); updateHMS(); } @@ -162,7 +167,7 @@ public class UICalendarPanel extends JPanel { BaseUtils.readIcon("/com/fr/design/images/calender/month_reduce_hover.png"), BaseUtils.readIcon("/com/fr/design/images/calender/month_reduce_click.png") }); - monthMinus.setPreferredSize(new Dimension(20, 20)); + monthMinus.setPreferredSize(scale(new Dimension(20, 20))); pNorth.add(monthMinus); monthLabel = new UILabel("", UILabel.CENTER); monthLabel.setBackground(new Color(0xFFFFFF)); @@ -177,7 +182,7 @@ public class UICalendarPanel extends JPanel { BaseUtils.readIcon("/com/fr/design/images/calender/month_add_hover.png"), BaseUtils.readIcon("/com/fr/design/images/calender/month_add_click.png") }); - monthPlus.setPreferredSize(new Dimension(20, 20)); + monthPlus.setPreferredSize(scale(new Dimension(20, 20))); monthPlus.setHorizontalAlignment(SwingConstants.RIGHT); pNorth.add(monthPlus); pNorth.add(Box.createHorizontalStrut(11)); @@ -195,7 +200,7 @@ public class UICalendarPanel extends JPanel { private JPanel createCenterPane() { //星期日 星期一 星期二 星期三 星期四 星期五 星期六 JPanel pWeeks = new JPanel(new GridLayout(1, 7, 1, 0)); - pWeeks.setPreferredSize(new Dimension(216, 22)); + pWeeks.setPreferredSize(scale(new Dimension(216, 22))); pWeeks.setBackground(new Color(0xFFFFFF)); pWeeks.setOpaque(true); String[] strWeeks = new String[]{StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sun"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Mon"), @@ -214,7 +219,7 @@ public class UICalendarPanel extends JPanel { //中间放日期的面板 days = new DayPane(); days.setOpaque(true); - days.setPreferredSize(new Dimension(216, 115)); + days.setPreferredSize(scale(new Dimension(216, 115))); JPanel pCenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); pCenter.setOpaque(true); pCenter.add(pWeeks, BorderLayout.NORTH); @@ -222,7 +227,7 @@ public class UICalendarPanel extends JPanel { //显示今天的日期,直接单击图标跳到今天 GradientPane pToday = new GradientPane(new GradientBackground(new Color(0x097BDA), new Color(0x40A3EE), GradientBackground.TOP2BOTTOM), false); - pToday.setPreferredSize(new Dimension(216, 18)); + pToday.setPreferredSize(scale(new Dimension(216, 18))); pToday.setLayout(new BorderLayout()); lbToday = new UIDayLabel(new Date(), false); lbToday.setForeground(new Color(0x000000)); @@ -236,23 +241,23 @@ public class UICalendarPanel extends JPanel { private JPanel createSouthPane() { JPanel sPane = new JPanel(); - sPane.setPreferredSize(new Dimension(216, 30)); + sPane.setPreferredSize(scale(new Dimension(216, 30))); sPane.setBackground(Color.WHITE); sPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 6)); UILabel timeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Time") + ":"); - timeLabel.setBorder(BorderFactory.createEmptyBorder(0, 9, 0, 5)); + timeLabel.setBorder(new ScaledEmptyBorder(0, 9, 0, 5)); timeLabel.setFont(FONT_UI); sPane.add(timeLabel); hms = new HMSPane(); sPane.add(hms); UILabel gap = new UILabel(); - gap.setPreferredSize(new Dimension(26, 1)); + gap.setPreferredSize(scale(new Dimension(26, 1))); sPane.add(gap); UIButton okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")) { public Dimension getPreferredSize() { - return new Dimension(32, 18); + return scale(new Dimension(32, 18)); } public Insets getInsets() { @@ -722,7 +727,7 @@ public class UICalendarPanel extends JPanel { private CalendarNumberField selectedNumberField; public HMSPane() { - this.setPreferredSize(new Dimension(101, 18)); + this.setPreferredSize(scale(new Dimension(101, 18))); this.setLayout(new BorderLayout(0, 0)); this.setBackground(null); @@ -775,7 +780,7 @@ public class UICalendarPanel extends JPanel { }; nextButton.setRoundBorder(true, Constants.LEFT); JPanel arrowPane = new JPanel(); - arrowPane.setPreferredSize(new Dimension(11, 18)); + arrowPane.setPreferredSize(scale(new Dimension(11, 18))); arrowPane.setLayout(new GridLayout(2, 1)); arrowPane.add(preButton); arrowPane.add(nextButton); diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java b/designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java index 1da26c302c..cbbc8ceeea 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java @@ -1,5 +1,8 @@ package com.fr.design.gui.date; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIStyle; +import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxUI; import com.fr.design.layout.FRGUIPaneFactory; @@ -105,7 +108,7 @@ public class UIDatePicker extends UIComboBox implements Serializable { textField.setDocument(dateDocument); //设置Model为单值Model this.setModel(model); - updateUI(); + setUI(getUIComboBoxUI()); } public UIDatePicker(int formatStyle, Date initialDatetime) throws UnsupportedOperationException { @@ -290,6 +293,20 @@ public class UIDatePicker extends UIComboBox implements Serializable { @Override protected ComboBoxUI getUIComboBoxUI() { return new UIComboBoxUI() { + + @Override + protected UIButton createArrowButton() { + arrowButton = new UIButton(new LazyIcon("down_arrow")) { + public boolean shouldResponseChangeListener() { + return false; + } + }; + arrowButton.addMouseListener(this); + comboBox.addMouseListener(this); + FineUIStyle.setStyle(arrowButton, FineUIStyle.PLAIN_BUTTON); + return (UIButton) arrowButton; + } + @Override protected ComboPopup createPopup() { return new DatePopup(comboBox); diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationPane.java index dde2337196..68f1663ae4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationPane.java @@ -1,26 +1,27 @@ package com.fr.design.gui.frpane; import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Container; +import java.awt.Color; import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.GridLayout; -import java.awt.LayoutManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; +import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; +import javax.swing.border.LineBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.table.TableCellEditor; +import com.fine.swing.ui.layout.Column; +import com.fine.swing.ui.layout.Layouts; +import com.fine.swing.ui.layout.Row; import com.fine.theme.icon.LazyIcon; -import com.fr.design.constants.UIConstants; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; @@ -32,12 +33,15 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.utils.gui.GUICoreUtils; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.theme.utils.FineUIScale.scale; + /** * @author jerry */ public class UICorrelationPane extends JPanel implements UIObserver { - private static int size = 20; protected UIButton addButton; protected UITable tablePane; protected int columnCount; @@ -45,7 +49,7 @@ public class UICorrelationPane extends JPanel implements UIObserver { private HeaderPane header; /** - * @param 标题栏的名字,length代表列数 + * @param names 标题栏的名字,length代表列数 */ public UICorrelationPane(String... names) { columnCount = names.length; @@ -74,12 +78,13 @@ public class UICorrelationPane extends JPanel implements UIObserver { addButton.setVisible(false); } - protected boolean isDeletable(){ + protected boolean isDeletable() { return true; } /** * 添加按钮 等 是否可用 + * * @param use 是否可用 */ public void checkBoxUse(boolean use) { @@ -116,7 +121,8 @@ public class UICorrelationPane extends JPanel implements UIObserver { /** - *添加一行 + * 添加一行 + * * @param line 行 */ public void addLine(Object[] line) { @@ -125,6 +131,7 @@ public class UICorrelationPane extends JPanel implements UIObserver { /** * 删除某行内容 + * * @param rowIndex 行号 */ public void removeLine(int rowIndex) { @@ -145,16 +152,20 @@ public class UICorrelationPane extends JPanel implements UIObserver { } protected void initLayout() { - this.setLayout(new Layout()); - this.add(addButton); - if (header != null) { - this.add(header); - } - this.add(tablePane); + this.setLayout(new BorderLayout(0, scale(4))); + Column tableContent = column( + cell(header), cell(tablePane).with(it -> + it.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 1, + FlatUIUtils.getUIColor("defaultBorderColor", Color.BLACK) + ))) + ).getComponent(); + this.add(tableContent, BorderLayout.CENTER); + this.add(addButton, BorderLayout.SOUTH); } protected void initComponents() { tablePane = initUITable(); + tablePane.setShowVerticalLines(false); initAddButton(); } @@ -183,6 +194,7 @@ public class UICorrelationPane extends JPanel implements UIObserver { /** * 停止面板编辑 + * * @param e 事件 */ public void stopPaneEditing(ChangeEvent e) { @@ -191,6 +203,7 @@ public class UICorrelationPane extends JPanel implements UIObserver { /** * 创建table编辑器 + * * @return 编辑器 */ public UITableEditor createUITableEditor() { @@ -217,8 +230,6 @@ public class UICorrelationPane extends JPanel implements UIObserver { return false; } }; - addButton.setBorderType(UIButton.OTHER_BORDER); - addButton.setOtherBorder(UIConstants.BS, UIConstants.LINE_COLOR); addButton.addActionListener(getAddButtonListener()); } @@ -233,112 +244,42 @@ public class UICorrelationPane extends JPanel implements UIObserver { } /** - * 给组件登记一个观察者监听事件 - * - * @param listener 观察者监听事件 - */ + * 给组件登记一个观察者监听事件 + * + * @param listener 观察者监听事件 + */ public void registerChangeListener(UIObserverListener listener) { uiObserverListener = listener; } /** - * 组件是否需要响应添加的观察者事件 - * - * @return 如果需要响应观察者事件则返回true,否则返回false - */ + * 组件是否需要响应添加的观察者事件 + * + * @return 如果需要响应观察者事件则返回true,否则返回false + */ public boolean shouldResponseChangeListener() { return true; } - public class Layout implements LayoutManager { - - /** - * 增加组件 - * @param name 组件名 - * @param comp 组件 - */ - public void addLayoutComponent(String name, Component comp) { - - } - - /** - *移除组件 - * @param comp 组件 - */ - public void removeLayoutComponent(Component comp) { - - } - - /** - *最佳大小 - * @param parent 父容器 - * @return 大小 - */ - public Dimension preferredLayoutSize(Container parent) { - int h = addButton.getPreferredSize().height + tablePane.getPreferredSize().height; - if (header != null) { - h = header.getPreferredSize().height; - } - return new Dimension(parent.getWidth(), h + 2); - } - - /** - * 最小布局大小 - * @param parent 父容器 - * @return 大小 - */ - public Dimension minimumLayoutSize(Container parent) { - return preferredLayoutSize(parent); - } - - /** - * 布局容器 - * @param parent 父容器 - */ - public void layoutContainer(Container parent) { - int width = parent.getWidth(); - int y = 0; - if (header != null) { - header.setBounds(0, y, width - (isDeletable() ?size:0), header.getPreferredSize().height); - y = y + header.getPreferredSize().height; - } - tablePane.setBounds(0, y, width+(isDeletable() ?0:size), tablePane.getPreferredSize().height); - y += tablePane.getPreferredSize().height + 2; - addButton.setBounds(0, y, width, addButton.getPreferredSize().height); - } - } - - private class HeaderPane extends JPanel { + private static class HeaderPane extends Row { public HeaderPane(String[] names) { UILabel[] labels = new UILabel[names.length]; - this.setLayout(new GridLayout(0, names.length)); for (int i = 0; i < names.length; i++) { - labels[i] = new UILabel(names[i], UILabel.CENTER) { - @Override - public void paint(Graphics g) { - super.paint(g); - int width = getWidth(); - int height = getHeight(); - Graphics2D g2d = (Graphics2D) g; - g2d.setColor(UIConstants.LINE_COLOR); - g2d.drawLine(4, height - 1, width - 4, height - 1); - } - - }; - this.add(labels[i]); + labels[i] = new UILabel(names[i], UILabel.LEFT); + Layouts.populate(this, cell(labels[i]).weight(1)); } - } - - @Override - public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width - (isDeletable() ?size:0), size); + setBorder(BorderFactory.createCompoundBorder( + new LineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.BLACK)), + new ScaledEmptyBorder(6, 6, 6, 6) + )); } } /** * 增加监听 + * * @param l 监听 */ public void addChangeListener(ChangeListener l) { @@ -347,6 +288,7 @@ public class UICorrelationPane extends JPanel implements UIObserver { /** * 移除监听 + * * @param l 监听 */ public void removeChangeListener(ChangeListener l) { @@ -368,7 +310,7 @@ public class UICorrelationPane extends JPanel implements UIObserver { public Dimension getPreferredSize() { Dimension dim = new Dimension(); dim.width = super.getPreferredSize().width; - dim.height = addButton.getPreferredSize().height + tablePane.getPreferredSize().height + 2; + dim.height = addButton.getPreferredSize().height + tablePane.getPreferredSize().height + scale(6); if (header != null) { dim.height += header.getPreferredSize().height; } @@ -382,6 +324,7 @@ public class UICorrelationPane extends JPanel implements UIObserver { /** * 主函数 + * * @param args 参数 */ public static void main(String... args) { diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java index 994b7b4253..d85793d5c4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java @@ -272,6 +272,8 @@ public class UIEastResizableContainer extends JPanel { private class TopToolPane extends JPanel { private int model = UIConstants.MODEL_NORMAL; + private int buttonSize = FineUIScale.scale(12); + public TopToolPane() { super(); @@ -328,7 +330,7 @@ public class UIEastResizableContainer extends JPanel { } else { button = new LazyIcon("drag_right"); } - button.paintIcon(this, g, 12, 12); + button.paintIcon(this, g, buttonSize, buttonSize); } } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/itable/UITable.java b/designer-base/src/main/java/com/fr/design/gui/itable/UITable.java index f66d483261..17ec504d0e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itable/UITable.java +++ b/designer-base/src/main/java/com/fr/design/gui/itable/UITable.java @@ -1,13 +1,12 @@ package com.fr.design.gui.itable; -import com.fr.design.constants.UIConstants; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import org.jetbrains.annotations.NotNull; -import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JTable; import javax.swing.event.CellEditorListener; @@ -27,12 +26,14 @@ import java.awt.event.FocusEvent; import java.awt.event.MouseEvent; import java.util.List; +import static com.fine.theme.utils.FineUIScale.scale; + public class UITable extends JTable implements UIObserver { private static final int OFF_LEFT = 10; private static final int STEP = 2; - private static final int DEFAULT_ROW_HEIGHT = 20; + private static final int DEFAULT_ROW_HEIGHT = 24; private UIObserverListener uiObserverListener; UITableEditor editor; private boolean shouldResponseAwt; @@ -101,7 +102,7 @@ public class UITable extends JTable implements UIObserver { if (event instanceof MouseEvent) { MouseEvent mv = (MouseEvent) event; if (mv.getClickCount() > 0) { - Point point = new Point((int) (mv.getLocationOnScreen().getX()) - 2 * OFF_LEFT, (int) mv.getLocationOnScreen().getY()); + Point point = new Point((int) (mv.getLocationOnScreen().getX()) - 2 * scale(OFF_LEFT), (int) mv.getLocationOnScreen().getY()); // 判断鼠标点击是否在边界内 if (!bounds.contains(point) && shouldResponseAwt) { if (!isEditingStopped) { @@ -219,8 +220,6 @@ public class UITable extends JTable implements UIObserver { } }); - - setBackground(UIConstants.NORMAL_BACKGROUND); setDefaultEditor(UITable.class, editor); setDefaultRenderer(UITable.class, new UITableRender()); setUI(getUI()); @@ -228,7 +227,7 @@ public class UITable extends JTable implements UIObserver { TableColumn deleteTableColumn = new TableColumn(getTableDataModel().getColumnCount()); deleteTableColumn.setCellEditor(null); deleteTableColumn.setCellRenderer(null); - deleteTableColumn.setMaxWidth(20); + deleteTableColumn.setMaxWidth(scale(24)); getColumnModel().addColumn(deleteTableColumn); } @@ -253,7 +252,7 @@ public class UITable extends JTable implements UIObserver { } protected int getRowHeight4Table() { - return DEFAULT_ROW_HEIGHT; + return scale(DEFAULT_ROW_HEIGHT); } @@ -335,7 +334,7 @@ public class UITable extends JTable implements UIObserver { Object value, boolean isSelected, boolean hasFocus, int row, int column) { JComponent comp = getRenderCompoment(value, row, column); - comp.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + comp.setBorder(new ScaledEmptyBorder(6, 6, 6, 6)); return comp; } } diff --git a/designer-base/src/main/java/com/fr/design/gui/itable/UITableUI.java b/designer-base/src/main/java/com/fr/design/gui/itable/UITableUI.java index 93ce206299..9dd7edddf6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itable/UITableUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/itable/UITableUI.java @@ -6,9 +6,9 @@ import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.Stroke; import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; import javax.swing.CellRendererPane; +import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JTable; @@ -17,7 +17,8 @@ import javax.swing.plaf.basic.BasicTableUI; import javax.swing.table.TableCellEditor; import javax.swing.table.TableModel; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.mainframe.DesignerContext; @@ -25,8 +26,10 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.stable.Constants; import com.fr.design.utils.gui.GUIPaintUtils; +import static com.fine.theme.utils.FineUIScale.scale; + public class UITableUI extends BasicTableUI { - private static BufferedImage closeIcon = BaseUtils.readImageWithCache("com/fr/design/images/toolbarbtn/close.png"); + private static final Icon CLOSE_ICON = new LazyIcon("remove"); protected boolean isReleased = true; protected int rollOverRowIndex = -1; protected int dragStartRowIndex = -1; @@ -35,7 +38,7 @@ public class UITableUI extends BasicTableUI { private int startColumn; private int startRow; private boolean draggingRow = false; - private static final int WIDTH_GAP = 20; + private static final int WIDTH_GAP = 24; private int startDragPoint; private int dyOffset; @@ -48,7 +51,7 @@ public class UITableUI extends BasicTableUI { public UITableUI(JComponent table) { super(); this.table = (JTable) table; - this.table.setRowHeight(20); + this.table.setRowHeight(scale(WIDTH_GAP)); } @Override @@ -95,13 +98,14 @@ public class UITableUI extends BasicTableUI { if(!isDeletable()){ return; } - g2d.drawImage(closeIcon, table.getWidth() - 20, rollOverRowIndex * table.getRowHeight() + 1, closeIcon.getWidth(), closeIcon.getHeight(), table); + CLOSE_ICON.paintIcon(table, g2d, table.getWidth() - scale(WIDTH_GAP), rollOverRowIndex * table.getRowHeight() + 1); } private void paintRolloverBackground(Graphics2D g2d) { if (rollOverRowIndex != -1) { - g2d.setColor(UIConstants.FLESH_BLUE); - GUIPaintUtils.fillPaint(g2d, 1, rollOverRowIndex * table.getRowHeight(), table.getWidth() - 2, table.getRowHeight(), true, Constants.NULL, UIConstants.FLESH_BLUE, UIConstants.LARGEARC); + Color selectionColor = FlatUIUtils.getUIColor("List.selectionBackground", UIConstants.FLESH_BLUE); + g2d.setColor(selectionColor); + GUIPaintUtils.fillPaint(g2d, 1, rollOverRowIndex * table.getRowHeight(), table.getWidth() - 2, table.getRowHeight(), true, Constants.NULL, selectionColor, 0); } } @@ -124,7 +128,7 @@ public class UITableUI extends BasicTableUI { @Override public void mousePressed(MouseEvent e) { super.mousePressed(e); - if (e.getX() >= table.getWidth() - WIDTH_GAP) { + if (e.getX() >= table.getWidth() - scale(WIDTH_GAP)) { if (table.isEditing()) { table.getCellEditor(startRow, startColumn).stopCellEditing(); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ClassFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ClassFileTree.java index 96523cdc9f..e16798170b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ClassFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ClassFileTree.java @@ -2,6 +2,8 @@ package com.fr.design.gui.itree.filetree; import java.io.File; +import com.fine.theme.utils.FineUIStyle; +import com.fr.design.border.FineBorderFactory; import com.fr.file.filetree.FileNode; import com.fr.file.filetree.IOFileNodeFilter; import com.fr.stable.project.ProjectConstants; @@ -12,6 +14,8 @@ import com.fr.stable.project.ProjectConstants; public class ClassFileTree extends EnvFileTree { public ClassFileTree() { super(ProjectConstants.CLASSES_NAME, null, new IOFileNodeFilter(new String[]{"class"})); + FineUIStyle.setStyle(this, FineUIStyle.PURE_TREE); + setBorder(FineBorderFactory.createWrappedRoundBorder()); } /* diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java index 985a9527fa..db3f50c327 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java @@ -8,6 +8,8 @@ */ package com.fr.design.gui.syntax.ui.rtextarea; +import com.fine.theme.utils.FineUIScale; + import java.awt.AWTEvent; import java.awt.Color; import java.awt.Font; @@ -31,6 +33,9 @@ import javax.swing.text.BadLocationException; import javax.swing.text.Caret; import javax.swing.text.StyleContext; +import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_12; +import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_13; + /** * This is the base class for RTextArea; basically it's just an @@ -428,19 +433,19 @@ int currentCaretY; // Used to know when to rehighlight current line. if (isOSX()) { // Snow Leopard (1.6) uses Menlo as default monospaced font, // pre-Snow Leopard used Monaco. - font = sc.getFont("Menlo", Font.PLAIN, 12); + font = sc.getFont("Menlo", Font.PLAIN, SCALE_FONT_SIZE_12); if (!"Menlo".equals(font.getFamily())) { - font = sc.getFont("Monaco", Font.PLAIN, 12); + font = sc.getFont("Monaco", Font.PLAIN, SCALE_FONT_SIZE_12); if (!"Monaco".equals(font.getFamily())) { // Shouldn't happen - font = sc.getFont("Monospaced", Font.PLAIN, 13); + font = sc.getFont("Monospaced", Font.PLAIN, SCALE_FONT_SIZE_13); } } } else { // Consolas added in Vista, used by VS2010+. - font = sc.getFont("Consolas", Font.PLAIN, 13); + font = sc.getFont("Consolas", Font.PLAIN, SCALE_FONT_SIZE_13); if (!"Consolas".equals(font.getFamily())) { - font = sc.getFont("Monospaced", Font.PLAIN, 13); + font = sc.getFont("Monospaced", Font.PLAIN, SCALE_FONT_SIZE_13); } } diff --git a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java index be216a46fa..f32fbe9d23 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java @@ -1,5 +1,6 @@ package com.fr.design.javascript; +import com.fine.theme.utils.FineUIScale; import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.dialog.BasicDialog; @@ -80,9 +81,8 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane { } protected void initLayout() { - this.setLayout(new BorderLayout(0, 6)); + this.setLayout(new BorderLayout(0, FineUIScale.scale(10))); JPanel northPane = new JPanel(new BorderLayout()); - northPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 0, 10)); this.add(northPane, BorderLayout.NORTH); northPane.add(jcb, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java index 53de406afe..ba4b98f874 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java @@ -9,6 +9,8 @@ import javax.swing.plaf.basic.BasicTextAreaUI; import java.awt.Color; import java.awt.Font; +import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_12; + /** * @author Starryi * @version 1.0 @@ -20,7 +22,7 @@ public class LabelUtils { } public static UILabel createLabel(String title, Color color) { - return createLabel(title, color, 12); + return createLabel(title, color, SCALE_FONT_SIZE_12); } public static UILabel createLabel(String title, Color color, int size) { UILabel uiLabel = new UILabel(title); @@ -34,7 +36,7 @@ public class LabelUtils { JTextArea tipLabel = new JTextArea(); tipLabel.setUI(new BasicTextAreaUI()); tipLabel.setForeground(color); - Font newFont = FRFont.getInstance(tipLabel.getFont().getFontName(), Font.PLAIN, 12); + Font newFont = FRFont.getInstance(tipLabel.getFont().getFontName(), Font.PLAIN, SCALE_FONT_SIZE_12); tipLabel.setFont(newFont); tipLabel.setBorder(BorderFactory.createEmptyBorder()); tipLabel.setEditable(false); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java index b97de53991..b95b35b7de 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java @@ -1,13 +1,12 @@ package com.fr.design.mainframe.vcs.ui; -import com.fr.base.svg.IconUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; -import com.fr.design.lock.LockInfoUtils; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.vcs.VcsOperatorWorker; @@ -17,10 +16,7 @@ import com.fr.design.mainframe.vcs.common.VcsCloseTemplateHelper; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.report.entity.VcsEntity; -import com.fr.report.lock.LockInfoOperator; -import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; @@ -50,9 +46,9 @@ public class VcsCenterPane extends VcsNewPane { private UILabel open; private UILabel delete; - private static final Icon MANAGER_ICON = IconUtils.readIcon("/com/fr/design/standard/vcslist/vcs_center_manager"); - private static final Icon DELETE_ICON = IconUtils.readIcon("/com/fr/design/standard/vcslist/vcs_operator_delete"); - private static final Icon OPEN_ICON = IconUtils.readIcon("/com/fr/design/standard/vcslist/vcs_center_open"); + private static final Icon MANAGER_ICON = new LazyIcon("vcs_list"); + private static final Icon DELETE_ICON = new LazyIcon("remove"); + private static final Icon OPEN_ICON = new LazyIcon("openTemplate"); private static final Class[] CLASSES = new Class[]{ Boolean.class, UILabel.class, diff --git a/designer-base/src/main/java/com/fr/design/present/FormulaPresentPane.java b/designer-base/src/main/java/com/fr/design/present/FormulaPresentPane.java index 3e70ff8d25..4c270851e3 100644 --- a/designer-base/src/main/java/com/fr/design/present/FormulaPresentPane.java +++ b/designer-base/src/main/java/com/fr/design/present/FormulaPresentPane.java @@ -18,7 +18,7 @@ public class FormulaPresentPane extends FurtherBasicBeanPane { protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); tinyFormulaPane = new TinyFormulaPane(); - this.add(tinyFormulaPane, BorderLayout.CENTER); + this.add(tinyFormulaPane, BorderLayout.NORTH); } @Override diff --git a/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java b/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java index fbd4e7f0a1..c8d4df5a54 100644 --- a/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java +++ b/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java @@ -146,27 +146,8 @@ public class EnvDetectorDialog extends JDialog { JPanel headerPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); headerPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 12, 0)); - this.detectButton = new UIToggleButton(buttonStatus.getDesc()) { - @Override - public ButtonUI getUI() { - - return new UIButtonUI() { - @Override - protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { - if (isPressed(b) && b.isPressedPainted()) { - GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), - DesignerColor.Button.Primary.PRESSED); - } else if (isRollOver(b)) { - GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), - DesignerColor.Button.Primary.HOVER); - } else if (b.isNormalPainted()) { - GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), - DesignerColor.Button.Primary.NORMAL); - } - } - }; - } - }; + this.detectButton = new UIButton(buttonStatus.getDesc()); + FineUIStyle.setStyle(detectButton, FineUIStyle.ENV_DECTETOR_BUTTON); detectButton.setToolTipText(buttonStatus.getDesc()); detectButton.addActionListener(event -> { if (buttonStatus.isNotExecuting()) { @@ -175,9 +156,6 @@ public class EnvDetectorDialog extends JDialog { stopDetecting(detectButton); } }); - detectButton.setForeground(FineUIUtils.getUIColor("background.normal", "background.normal")); - detectButton.setBackground(FineUIUtils.getUIColor("EnvDetectorButton.background", "EnvDetectorButton.background")); - headerPanel.add(detectButton, BorderLayout.WEST); UILabel openUtilBoxLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Carton_Feedback_ToolBox")); 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 f794a0a8e7..5830f16d9a 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -1,11 +1,15 @@ package com.fr.file; +import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; +import com.fr.design.border.FineBorderFactory; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.UIDialog; @@ -78,7 +82,6 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.filechooser.FileSystemView; import javax.swing.plaf.basic.BasicArrowButton; -import javax.swing.plaf.basic.BasicButtonUI; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -105,6 +108,10 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +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 javax.swing.JOptionPane.DEFAULT_OPTION; import static javax.swing.JOptionPane.WARNING_MESSAGE; @@ -304,12 +311,10 @@ public class FILEChooserPane extends BasicPane { locationPane.add(mkdirButton, BorderLayout.EAST); JPanel centerLeftPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - // centerLeftPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); // Richie:placesList includes C,D,E,F and DeskTop etc. placesList = new JList(); + FineUIStyle.setStyle(placesList, FineUIStyle.PURE_LIST); centerLeftPanel.add(placesList, BorderLayout.CENTER); - centerLeftPanel.setBorder(BorderFactory.createLineBorder(Color.GRAY)); - centerLeftPanel.setPreferredSize(new Dimension(120, 1)); placesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); placesList.setCellRenderer(new DefaultListCellRenderer() { @@ -359,12 +364,10 @@ public class FILEChooserPane extends BasicPane { } }); - // centerRightPane - JPanel centerRightPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - JPanel subFilePanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); // 以后rightPanel要用JTable subFileList = new JList(new DefaultListModel<>()); + FineUIStyle.setStyle(subFileList, FineUIStyle.PURE_LIST); /* * JList的CellRenderer */ @@ -456,27 +459,45 @@ public class FILEChooserPane extends BasicPane { }); scrollPane = new JScrollPane(subFileList); subFilePanel.add(scrollPane, BorderLayout.CENTER); - centerRightPane.add(subFilePanel, BorderLayout.CENTER); + subFilePanel.setBorder(FineBorderFactory.createWrappedRoundBorder()); // 用createTableLayoutPane布局下fileNamePane - UIButton cancelButton; - Component[][] coms = new Component[][]{ - new Component[]{GUICoreUtils.createBorderPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Utils_File_Name") + ":"), BorderLayout.WEST), - fileNameTextField = new UIAutoCompletionField(), okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Utils_Design_File_Open")) - }, - new Component[]{GUICoreUtils.createBorderPane(new UILabel(Toolkit.i18nText("Fine-Design_Report_Utils_File_Type") + ":"), BorderLayout.WEST), - postfixComboBox = new UIComboBox(), cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Utils_Design_Action_Cancel")) - }}; - - JPanel fileNamePane = TableLayoutHelper.createGapTableLayoutPane(coms, new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, - TableLayout.PREFERRED}, new double[]{TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED}, 24, 4); - centerRightPane.add(fileNamePane, BorderLayout.SOUTH); - - Component[][] outComponents = new Component[][]{ - new Component[]{GUICoreUtils.createBorderPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_App_File_Lookup_range") + ":"), BorderLayout.WEST), locationPane}, - new Component[]{centerLeftPanel, centerRightPane}}; - JPanel contentPane = TableLayoutHelper.createTableLayoutPane(outComponents, new double[]{TableLayout.PREFERRED, TableLayout.FILL}, - new double[]{TableLayout.PREFERRED, TableLayout.FILL}); + fileNameTextField = new UIAutoCompletionField(); + postfixComboBox = new UIComboBox(); + okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Utils_Design_File_Open")); + UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Utils_Design_Action_Cancel")); + + JPanel fileNamePane = column(10, + row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Utils_File_Name"))).weight(1), + cell(fileNameTextField).weight(5) + ), + row( + cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Utils_File_Type"))).weight(1), + cell(postfixComboBox).weight(5) + ) + ).getComponent(); + JPanel centerRightPane = column(10, + cell(subFilePanel).weight(1), + cell(fileNamePane) + ).getComponent(); + JPanel contentPane = column(10, + row(10, + column(10, + cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_App_File_Lookup_range"))) + .with(it -> FineUIStyle.setStyle(it, FineUIStyle.LABEL_BOLD)), + cell(centerLeftPanel).with(it -> it.setBorder(FineBorderFactory.createWrappedRoundBorder())).weight(1) + ).weight(1), + column(10, + cell(locationPane), + cell(centerRightPane).weight(1) + ).weight(3) + ).weight(1), + row(10, + flex(), cell(cancelButton), cell(okButton).with(it -> FineUIStyle.setStyle(it, FineUIStyle.STYLE_PRIMARY)) + ) + ).getComponent(); + this.add(contentPane, BorderLayout.CENTER); okButton.addActionListener(new ActionListener() { @Override @@ -1262,7 +1283,7 @@ public class FILEChooserPane extends BasicPane { @Override public Icon getIcon() { - return BaseUtils.readIcon("/com/fr/base/images/oem/logo.png"); + return new LazyIcon("logo"); } } } @@ -1382,7 +1403,7 @@ public class FILEChooserPane extends BasicPane { @Override public Icon getIcon() { if (ComparatorUtils.equals(getTotalName(), ProjectConstants.REPORTLETS_NAME)) { - return BaseUtils.readIcon("/com/fr/base/images/oem/logo.png"); + return new LazyIcon("logo"); } else { return FileTreeIcon.getIcon(new File(this.getPath()), false); } @@ -1479,7 +1500,7 @@ public class FILEChooserPane extends BasicPane { dirPath = dirPath + SEPARATOR_STRING; } if (ComparatorUtils.equals(actionPath, dirPath)) { - this.buttonList.get(i).setForeground(Color.BLUE); + this.buttonList.get(i).setForeground(FlatUIUtils.getUIColor("brand.normal", Color.BLUE)); } } } @@ -1681,42 +1702,30 @@ public class FILEChooserPane extends BasicPane { private UIButton createBlankButton(SetDirectoryAction setDirectoryAction) { - final Color brighter = this.getBackground().brighter(); - final Color darker = this.getBackground().darker(); - final UIButton blankButton = new UIButton(setDirectoryAction); blankButton.setMargin(new Insets(0, 0, 0, 0)); - blankButton.setUI(new BasicButtonUI()); blankButton.setHorizontalTextPosition(SwingConstants.CENTER); blankButton.setBorderPainted(false); blankButton.setBorder(BorderFactory.createRaisedBevelBorder()); - blankButton.setBackground(darker); + blankButton.setBackground(null); blankButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { - blankButton.setBackground(brighter); - blankButton.setBorderPainted(true); blankButton.repaint(); } @Override public void mouseExited(MouseEvent e) { - blankButton.setBackground(darker); - blankButton.setBorderPainted(false); blankButton.repaint(); } @Override public void mousePressed(MouseEvent e) { - blankButton.setBackground(brighter); - blankButton.setBorderPainted(false); blankButton.repaint(); } @Override public void mouseReleased(MouseEvent e) { - blankButton.setBackground(darker); - blankButton.setBorderPainted(true); blankButton.repaint(); } @@ -1730,7 +1739,7 @@ public class FILEChooserPane extends BasicPane { */ private UIButton initMkdirButton() { UIButton folderButton = new UIButton(); - folderButton.setIcon(BaseUtils.readIcon("com/fr/design/images/icon_NewFolderIcon_normal.png")); + folderButton.setIcon(new LazyIcon("new_folder")); folderButton.setUI(new UIButtonUI()); folderButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Utils_New_Folder")); folderButton.addActionListener(new ActionListener() { diff --git a/designer-base/src/main/java/com/fr/file/FileFILE.java b/designer-base/src/main/java/com/fr/file/FileFILE.java index fca6835bff..85713f92a1 100644 --- a/designer-base/src/main/java/com/fr/file/FileFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileFILE.java @@ -73,9 +73,8 @@ public class FileFILE implements FILE { if (file == null) { return FileTreeIcon.BLANK_IMAGE_ICON; } - FileSystemView view = FileSystemView.getFileSystemView(); try { - return view.getSystemIcon(file); + return FileTreeIcon.getIcon(file); } catch (Exception e) { /* * alex:在显示Mac里面某个目录的时候,居然会抛 diff --git a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java index d0fd628969..23c2b362be 100644 --- a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java @@ -1,8 +1,7 @@ package com.fr.file; -import com.fr.base.BaseUtils; +import com.fine.theme.icon.LazyIcon; import com.fr.base.FRContext; -import com.fr.base.svg.IconUtils; import com.fr.design.file.TemplateResourceManager; import com.fr.io.FineEncryptUtils; import com.fr.base.io.XMLEncryptUtils; @@ -169,7 +168,7 @@ public class FileNodeFILE implements FILE { } if (ComparatorUtils.equals(node.getEnvPath(), ProjectConstants.REPORTLETS_NAME)) { - return IconUtils.readIcon("/com/fr/base/images/oem/logo.svg"); + return new LazyIcon("logo"); } else { if (!hasFullAuth) { diff --git a/designer-base/src/main/resources/com/fine/theme/icon/dataset/server_database_warning.svg b/designer-base/src/main/resources/com/fine/theme/icon/dataset/server_database_warning.svg new file mode 100644 index 0000000000..a87767c3cc --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/dataset/server_database_warning.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/apply_components.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/apply_components.svg new file mode 100644 index 0000000000..8bea108a5a --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/apply_components.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/apply_components_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/apply_components_disable.svg new file mode 100644 index 0000000000..49cc4a0b8a --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/apply_components_disable.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget.svg index 8bea108a5a..a0abe26237 100644 --- a/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget.svg @@ -1,13 +1,8 @@ - - - - - - - - - - - + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget_disable.svg index 49cc4a0b8a..c41228a524 100644 --- a/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget_disable.svg @@ -1,13 +1,8 @@ - - - - - - - - - - - + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json index 7bc179770b..5353466cbf 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json @@ -49,6 +49,7 @@ "batch_esd_off": "dataset/batch_esd_off.svg", "edit": "dataset/edit.svg", "server_database": "dataset/server_database.svg", + "server_database_warning": "dataset/server_database_warning.svg", "field": "dataset/field.svg", "folder": "filetree/folder.svg", "folder_open": "filetree/folder_open.svg", @@ -310,6 +311,7 @@ "password_field": "widget/password_field.svg", "picture": "widget/picture.svg", "widget_preview": "widget/preview.svg", + "apply_components": "widget/apply_components.svg", "prewidget": "widget/prewidget.svg", "tab": "widget/tab.svg", "text_area": "widget/text_area.svg", diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties index 5c95ed3cac..4bd77031c2 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties @@ -18,7 +18,7 @@ MenuBarUI=com.formdev.flatlaf.ui.FlatMenuBarUI MenuItemUI=com.fine.theme.light.ui.FineMenuItemUI TemplateListMenuItemUI=com.fine.theme.light.ui.FineTemplateListMenuItemUI OptionPaneUI=com.formdev.flatlaf.ui.FlatOptionPaneUI -PanelUI=com.formdev.flatlaf.ui.FlatPanelUI +PanelUI=com.fine.theme.light.ui.FinePanelUI PasswordFieldUI=com.formdev.flatlaf.ui.FlatPasswordFieldUI PopupMenuUI=com.fine.theme.light.ui.FinePopupMenuUI PopupMenuSeparatorUI=com.fine.theme.light.ui.FinePopupMenuSeparatorUI 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 0e144ee7bf..f3f36698da 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 @@ -124,7 +124,7 @@ controlDkShadow = darken($controlShadow,15%) DarkenedFontColor = #091E40 defaultBorderColor = #DADEE7 defaultHighlightBorderColor = #2576EF -defaultBorderFocusShadow = #2576ef19 +defaultBorderFocusShadow = $defaultBorderColor defaultBorderFocusWidth = 0 brand.normal=#2576EF color.brand4=#84B1F6 @@ -223,7 +223,6 @@ CombinationButton.background = $Button.background CombinationButton.borderColor = $Component.borderColor CombinationButton.arc = $Button.arc -EnvDetecorButton.background = #FF419BF9 #---- CheckBox ---- CheckBox.arc = 4 @@ -671,6 +670,9 @@ ScrollBar.largeBar.showButtons = true ScrollBar.largeBar.thumbInsets = 0,4,0,4 ScrollBar.largeBar.buttonBackground = $ScrollBar.track +#---- Panel ---- +Panel.arc = 5 + #---- ScrollPane ---- ScrollPane.border = null @@ -898,7 +900,7 @@ Table.focusCellHighlightBorder = com.formdev.flatlaf.ui.FlatTableCellBorder$Focu Table.focusSelectedCellHighlightBorder = com.formdev.flatlaf.ui.FlatTableCellBorder$Selected Table.focusCellBackground = $Table.background Table.focusCellForeground = $Table.foreground -Table.background = @componentBackground +Table.background = $fill.normal Table.selectionInactiveBackground = @selectionInactiveBackground Table.selectionInactiveForeground = @selectionInactiveForeground Table.dropCellBackground = @dropCellBackground @@ -1053,7 +1055,7 @@ ToggleButton.group.selectedBackground = #2576EF ToggleButton.group.selectedForeground = #FFF #---- HeadGroup ---- -HeadGroup.background= #E9ECF1 +HeadGroup.background= #E6E9EF HeadGroup.arc= $Component.arc #---- HeadMenu ---- HeadMenu.borderMargins=5,9,5,10 @@ -1261,9 +1263,6 @@ CellOtherSetPane.height=$Component.defaultHeight [style]Panel.lightGrey=\ background: $Center.OuterShadowColor -[style]Panel.roundBorder=\ - arc: 5 - [style]Panel.menuBar=\ background: $MenuBar.background @@ -1322,5 +1321,19 @@ CellOtherSetPane.height=$Component.defaultHeight selectedBackground : null; \ pressedBackground : null +[style]Button.pastelButton = \ + border: null; \ + background: #2576ef1e + [style]ToggleButton.compactButton = \ - margin: 2,0,2,0 \ No newline at end of file + margin: 2,0,2,0 + +[style]List.pureList = \ + background: $fill.normal + +[style]Tree.pureTree = \ + background: $fill.normal + +[style]Button.envDetectorButton = \ + foreground: #FFF; \ + background: #2576EF \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java b/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java index 3ae8f0b848..2b51b3b9e4 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java @@ -1,5 +1,6 @@ package com.fr.design.chart; +import com.fine.theme.utils.FineUIScale; import com.fr.base.ScreenResolution; import com.fr.base.chart.BaseChartPainter; import com.fr.base.chart.chartdata.CallbackEvent; @@ -13,18 +14,18 @@ import com.fr.stable.xml.XMLable; import com.fr.stable.xml.XMLableReader; import javax.swing.Icon; +import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.Paint; /** * 图表的缩略图Icon, 在选择图表类型界面 用到. */ public class ChartIcon implements Icon, XMLable { - private static final int WIDTH = 400; - private static final int HEIGHT = 225; + private static final int WIDTH = FineUIScale.scale(215); + private static final int HEIGHT = FineUIScale.scale(100); private ChartCollection chartCollection; @@ -78,26 +79,23 @@ public class ChartIcon implements Icon, XMLable { public void paintIcon(Component c, Graphics g, int x, int y) { BaseChartPainter chartPainter = getChartPainter(); + Graphics2D g2d = (Graphics2D) g.create(); - //插入图表的宽度是固定的,resolution直接获取屏幕分辨率,resolution现在只会影响到老图表 - int resolution = ScreenResolution.getScreenResolution(); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0f)); - Graphics2D g2d = (Graphics2D) g; - Paint oldPaint = g2d.getPaint(); - g.translate(x, y); - g2d.setPaint(Color.white); + g2d.setColor(new Color(0, 0, 0, 0)); g2d.fillRect(0, 0, getIconWidth(), getIconHeight()); - chartPainter.paint(g2d, getIconWidth(), getIconHeight(), resolution, null, callbackEvent); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f)); - g.translate(-x, -y); - g2d.setPaint(oldPaint); + chartPainter.paint(g2d, getIconWidth(), getIconHeight(), ScreenResolution.getScreenResolution(), null, callbackEvent); + + g2d.dispose(); } protected BaseChartPainter getChartPainter() { - BaseChartPainter painter = chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(), + return chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(), WebChartIDInfo.createEmptyDesignerInfo(), getIconWidth(), getIconHeight()); - return painter; } diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index b6879dc102..1cfdde0a19 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -4,8 +4,9 @@ package com.fr.design.chart; */ import com.fine.swing.ui.layout.Column; +import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIUtils; -import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.chart.chartattr.ChartCollection; @@ -13,21 +14,25 @@ import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.base.mode.DesignModeContext; +import com.fr.design.border.FineBorderFactory; +import com.fr.design.border.UIRoundedBorder; +import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.info.ChartInfoCollector; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.van.chart.config.DefaultStyleHelper4Van; +import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; +import javax.swing.JLayer; import javax.swing.JList; +import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JSplitPane; import javax.swing.ListCellRenderer; +import javax.swing.SwingConstants; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.Color; @@ -35,6 +40,10 @@ import java.awt.Component; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +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 ChartTypePane extends ChartCommonWizardPane implements CallbackEvent { private static final long serialVersionUID = -1175602484968520546L; @@ -60,9 +69,9 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven defaultListModel.insertElementAt(ChartTypeInterfaceManager.getInstance().getName(chartIDs[i]), i); } mainTypeList.addListSelectionListener(listSelectionListener); + FineUIStyle.setStyle(mainTypeList, FineUIStyle.PURE_LIST); - JScrollPane typeScrollPane = new JScrollPane(mainTypeList); - typeScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + JLayer typeScrollPane = FineUIUtils.createCollapsibleScrollBarLayer(mainTypeList); iconViewList = new JList(); @@ -71,15 +80,16 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven iconViewList.setVisibleRowCount(0); iconViewList.setLayoutOrientation(JList.HORIZONTAL_WRAP); iconViewList.setCellRenderer(iconCellRenderer); + iconViewList.setLayoutOrientation(JList.HORIZONTAL_WRAP); JScrollPane subListPane = new JScrollPane(iconViewList); //iconPane.add mainTypeList.setSelectedIndex(0); - JSplitPane spane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, typeScrollPane, subListPane); - spane.setDividerLocation(150); + JPanel leftPanel = FineLayoutBuilder.asBorderLayoutWrapped(typeScrollPane); + leftPanel.setBorder(FineBorderFactory.createWrappedRoundBorder()); - Column center = (Column) FineUIUtils.wrapComponentWithTitle(spane, Toolkit.i18nText("Fine-Design_Chart_M_Popup_Chart_Type")); + JPanel center = FineLayoutBuilder.createHorizontalLayout(0, new double[]{1, 2.5}, leftPanel, subListPane); center.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); this.add(center); @@ -90,17 +100,23 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven private static final long serialVersionUID = 956888843609479566L; public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - this.setText(""); if (value instanceof ChartIcon) { - this.setIcon((ChartIcon) value); - setHorizontalAlignment(UILabel.CENTER); ChartIcon chartIcon = (ChartIcon) value; - if (isSelected) { - // 深蓝色. - this.setBackground(FlatUIUtils.getUIColor("Tree.selectionBackground", new Color(57, 107, 181))); - } - this.setBorder(GUICoreUtils.createTitledBorder(getChartName(chartIcon))); + UILabel centerImg = new UILabel(chartIcon); + UILabel text = new UILabel(getChartName(chartIcon), SwingConstants.CENTER); + + Column component = column( + fix(5), + cell(centerImg), cell(text), + fix(5) + ).getComponent(); + Color borderColor = isSelected ? FineUIUtils.getUIColor("defaultHighlightBorderColor", "Component.focusedBorderColor") + : FineUIUtils.getUIColor("defaultBorderColor", "Component.borderColor"); + UIRoundedBorder roundedBorder = new UIRoundedBorder(borderColor, 1, 5); + component.setBorder(BorderFactory.createCompoundBorder( + new ScaledEmptyBorder(0, 10, 10, 0), roundedBorder)); + component.setBackground(Color.WHITE); + return component; } return this; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java index 2e1f486ccf..fcd013e058 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.chart.gui.data.report; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseFormula; import com.fr.base.Utils; import com.fr.chart.chartattr.ChartCollection; @@ -170,6 +172,10 @@ public abstract class AbstractReportDataContentPane extends BasicBeanPane { private Parameter[] parameterList; - private ArrayList parameterSelectedLabellist = new ArrayList(); - private MouseListener paraMouseListner; - private UIButton addAll; - private UILabel label; - private int breakid; - - private static final int GAP_H = 4; - private static final int GAP_V = 6; - private static final int GAP_BV = 4; - private static final int BUTTON_HEIGHT = 20; - private static final int WIDTH = 225; - private static final int L_H = 18; - private static final int LABEL_PADDING_LEFT = 4; + private final ArrayList parameterSelectedLabelList = new ArrayList<>(); + private MouseListener paraMouseListener; + private final UIButton addAll; + private final UILabel label; public ParameterToolBarPane() { - this.setLayout(new FlowParameterPaneLayout()); - - label = new UILabel() { - private static final long serialVersionUID = 1L; + this.setLayout(new BorderLayout()); - @Override - public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, 18); - } - }; - label.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Following_parameters_are_not_generated") + ":"); + label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Following_parameters_are_not_generated") + ":"); label.setHorizontalAlignment(SwingConstants.LEFT); - label.setBorder(BorderFactory.createEmptyBorder(0, LABEL_PADDING_LEFT, 0, 0)); - this.add(label); - addAll = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Add_all")); - this.add(addAll); + + initLayout(); } + private void initLayout() { + Column buttonTable = FineLayoutBuilder.createCommonTableLayout(4, 5, 10, parameterSelectedLabelList); + this.add(column(6, + cell(label), + cell(buttonTable).weight(1), + cell(addAll) + ).weight(1).with(it -> it.setBorder(BorderFactory.createCompoundBorder( + FineBorderFactory.createDefaultUnderlineBorder(), new ScaledEmptyBorder(0, 10, 10, 10) + ))).getComponent()); + } + public boolean hasSelectedLabelItem() { - return !parameterSelectedLabellist.isEmpty(); + return !parameterSelectedLabelList.isEmpty(); } @Override @@ -67,7 +64,7 @@ public class ParameterToolBarPane extends BasicBeanPane { } public Parameter getTargetParameter(UIButton button) { - int index = parameterSelectedLabellist.indexOf(button); + int index = parameterSelectedLabelList.indexOf(button); if (index < 0 || index > parameterList.length - 1) { return null; } @@ -76,11 +73,9 @@ public class ParameterToolBarPane extends BasicBeanPane { @Override public void populateBean(Parameter[] parameterArray) { - parameterSelectedLabellist.clear(); + parameterSelectedLabelList.clear(); this.removeAll(); - this.add(label); - if (parameterArray.length == 0) { this.setVisible(false); this.repaint(); @@ -90,18 +85,17 @@ public class ParameterToolBarPane extends BasicBeanPane { } parameterList = parameterArray; - for (int i = 0; i < parameterList.length; i++) { - UIButton parameterSelectedLabel = new UIButton(parameterList[i].getName()); - parameterSelectedLabellist.add(parameterSelectedLabel); - this.add(parameterSelectedLabel); + for (Parameter parameter : parameterList) { + UIButton parameterSelectedLabel = new UIButton(parameter.getName()); + parameterSelectedLabelList.add(parameterSelectedLabel); + FineUIStyle.setStyle(parameterSelectedLabel, FineUIStyle.PASTEL_BUTTON); } - for(UIButton parameterSelectedLabel : parameterSelectedLabellist) { - parameterSelectedLabel.addMouseListener(paraMouseListner); + for(UIButton parameterSelectedLabel : parameterSelectedLabelList) { + parameterSelectedLabel.addMouseListener(paraMouseListener); } - this.add(addAll); - this.doLayout(); + initLayout(); this.repaint(); } @@ -111,63 +105,11 @@ public class ParameterToolBarPane extends BasicBeanPane { } public void setParaMouseListener(MouseListener l) { - this.paraMouseListner = l; + this.paraMouseListener = l; } public void addActionListener(ActionListener l) { addAll.addActionListener(l); } - // ParameterToolBarPane 的布局 - private class FlowParameterPaneLayout implements LayoutManager { - - public FlowParameterPaneLayout() { - // do nothing - } - - public void addLayoutComponent(String name, Component comp) { - // do nothing - } - - public void removeLayoutComponent(Component comp) { - // do nothing - } - - public Dimension preferredLayoutSize(Container parent) { - int w = parent.getWidth(); - - layoutContainer(parent); - - int h= (parameterSelectedLabellist.isEmpty() ? 0 : breakid * (BUTTON_HEIGHT + GAP_V) + GAP_BV + L_H + GAP_H + addAll.getPreferredSize().height); - return new Dimension(w, h); - } - - public Dimension minimumLayoutSize(Container parent) { - return new Dimension(0, 0); - } - - public void layoutContainer(Container parent) { - int width = parent.getWidth() == 0 ? WIDTH : parent.getWidth(); - int x = 0; - int y = L_H + GAP_H; - - label.setBounds(0, 0, width, L_H); - - breakid = 1; - for (UIButton tab : parameterSelectedLabellist) { - Dimension dim = tab.getPreferredSize(); - if (x + dim.width > width) { - breakid++; - x = 0; - y += (dim.height + GAP_V); - } - - tab.setBounds(x, y, dim.width, dim.height); - - x += (dim.width + GAP_H); - } - addAll.setBounds(0, y + GAP_V + BUTTON_HEIGHT, width, addAll.getPreferredSize().height); - - } - } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java index d551285f32..42ad051004 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java @@ -16,13 +16,11 @@ import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; import javax.swing.KeyStroke; -import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class WidgetManagerAction extends UpdateAction { - public static final Dimension WINDOW_CUSTOM_SIZE = new Dimension(720, 600); public WidgetManagerAction() { this.setMenuKeySet(WIDGET_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); @@ -70,7 +68,7 @@ public class WidgetManagerAction extends UpdateAction { } })); } - }, WINDOW_CUSTOM_SIZE); + }, BasicDialog.LARGE); widgetConfigDialog.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java index 5fe59ee85f..ae5268a711 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java @@ -24,6 +24,7 @@ import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.SelectCount; import javax.swing.JPanel; +import javax.swing.ScrollPaneConstants; import javax.swing.SwingUtilities; import java.awt.BorderLayout; import java.awt.CardLayout; @@ -61,7 +62,8 @@ public class DSColumnAdvancedPane extends BasicPane { private void initScrollPane() { this.setLayout(new BorderLayout()); - UIScrollPane scrollPane = new UIScrollPane(contentPane); + UIScrollPane scrollPane = new UIScrollPane(contentPane, + ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); this.add(scrollPane); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java index f0ff751f17..527e3cdfc6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java @@ -81,7 +81,7 @@ public class CellWidgetPropertyPane extends BasicPane { public void reInit(ElementCasePane ePane) { this.ePane = ePane; - cellEditorDefPane = new WidgetPane(ePane); + cellEditorDefPane = new WidgetPane(ePane, true); this.removeAll(); this.add(cellEditorDefPane, BorderLayout.CENTER); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java index cf9617f2fc..bd45ff1121 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe.cell.settingpane.desensitization; import com.fine.swing.ui.layout.Layouts; -import com.fine.theme.light.ui.FineRoundBorder; +import com.fr.design.border.FineBorderFactory; import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -92,7 +92,7 @@ public class CellDesensitizationGroupsPane extends JPanel { this.add(pane, BorderLayout.CENTER); } }; - tableEditorPane.setBorder(new FineRoundBorder()); + tableEditorPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); return tableEditorPane; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/CellDesensitizationTableModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/CellDesensitizationTableModel.java index dcc1232396..cf06005a2a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/CellDesensitizationTableModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/CellDesensitizationTableModel.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.cell.settingpane.desensitization.model; +import com.fine.theme.utils.FineUIScale; import com.fr.design.gui.itableeditorpane.UITableEditAction; import com.fr.design.gui.itableeditorpane.UITableModelAdapter; import com.fr.design.i18n.Toolkit; @@ -18,7 +19,7 @@ import java.awt.event.ActionEvent; * Created by Leo.Qin on 2023/1/4 */ public class CellDesensitizationTableModel extends UITableModelAdapter { - private final int ROW_HEIGHT = 60; + private final int ROW_HEIGHT = FineUIScale.scale(72); /** * 属性面板 */ diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellEditor.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellEditor.java index 3d581f4e43..2b31e2a8d7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellEditor.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellEditor.java @@ -3,12 +3,9 @@ package com.fr.design.mainframe.cell.settingpane.desensitization.model; import com.fr.report.cell.desensitization.CellDesensitizationBean; import javax.swing.AbstractCellEditor; -import javax.swing.JPanel; import javax.swing.JTable; import javax.swing.SwingWorker; -import javax.swing.border.LineBorder; import javax.swing.table.TableCellEditor; -import java.awt.Color; import java.awt.Component; import java.util.Map; @@ -33,10 +30,7 @@ public class DesensitizationCellEditor extends AbstractCellEditor implements Tab editPane.populate((CellDesensitizationBean) value, row); - JPanel editPanel = editPane.getEditPanel(); - editPanel.setBorder(new LineBorder(Color.LIGHT_GRAY)); - - return editPanel; + return editPane.getEditPanel(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java index 818a26205d..4395abd8de 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java @@ -1,36 +1,31 @@ package com.fr.design.mainframe.cell.settingpane.desensitization.model; -import com.fr.base.operator.org.OrganizationOperator; +import com.fine.theme.utils.FineLayoutBuilder; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.data.desensitize.rule.DesensitizationRuleManager; import com.fr.data.desensitize.rule.base.DesensitizationRule; import com.fr.data.desensitize.rule.base.DesensitizationRuleSource; import com.fr.data.desensitize.rule.base.DesensitizationRuleStatus; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.border.FineBorderFactory; import com.fr.design.data.datapane.preview.desensitization.view.rule.DesensitizationRulePane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.event.UIObserverListener; -import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombocheckbox.UIComboCheckBox; 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 com.fr.design.layout.VerticalFlowLayout; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.JTemplateActionListener; import com.fr.report.cell.desensitization.CellDesensitizationBean; import com.fr.stable.StringUtils; import com.fr.third.org.apache.commons.collections4.map.HashedMap; -import com.fr.workspace.WorkContext; +import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -43,7 +38,12 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; -import java.util.concurrent.ExecutionException; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.theme.utils.FineUIStyle.PLAIN_BUTTON; +import static com.fine.theme.utils.FineUIStyle.TRANSPARENT_TEXT_FIELD; +import static com.fine.theme.utils.FineUIStyle.setStyle; /** * 单元格脱敏规则设置面板 @@ -78,19 +78,18 @@ public class DesensitizationCellPane extends BasicBeanPane { } private void initComponent() { - editPanel = new JPanel(); - editPanel.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true)); label = new UILabel(); label.setEnabled(false); - editPanel.add(label); ruleButton = new UIButton(APOSTROPHE); + setStyle(ruleButton, PLAIN_BUTTON); ruleTextField = new UITextField(); ruleTextField.setEnabled(true); ruleTextField.setEditable(false); ruleTextField.setPlaceholder(Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Place_Holder")); + setStyle(ruleTextField, TRANSPARENT_TEXT_FIELD); roleMap = new HashedMap<>(); rolesComboBox = new RuleUIComboCheckBox(); @@ -100,9 +99,26 @@ public class DesensitizationCellPane extends BasicBeanPane { emptyTextField = new UITextField(); emptyTextField.setEnabled(false); - emptyTextField.setOpaque(false); + setStyle(emptyTextField, TRANSPARENT_TEXT_FIELD); + + Color borderColor = FlatUIUtils.getUIColor("defaultBorderColor", Color.GRAY); + setInsideBorder(borderColor); + + editPanel = FineLayoutBuilder.asBorderLayoutWrapped( + column( + cell(label).with(it -> it.setBorder( + BorderFactory.createMatteBorder(1, 0, 1, 0, borderColor))).weight(1), + cell(initTableCellPanel()) .weight(2) + ).getComponent() + ); + - editPanel.add(initTableCellPanel()); + } + + private void setInsideBorder(Color borderColor) { + ruleButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, borderColor)); + emptyTextField.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, borderColor)); + ruleTextField.setBorder(FineBorderFactory.createDefaultUnderlineBorder()); } @@ -110,17 +126,11 @@ public class DesensitizationCellPane extends BasicBeanPane { * 初始化单元格中的panel */ private JPanel initTableCellPanel() { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - - double[] rowSize = new double[]{f, f}; - double[] columnSize = new double[]{p, f}; - Component[][] components = new Component[][]{ new Component[]{ruleButton, ruleTextField}, new Component[]{emptyTextField, rolesComboBox} }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); + return FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1, 4}); } private void addListener() { @@ -280,8 +290,12 @@ public class DesensitizationCellPane extends BasicBeanPane { protected void setLayoutAndAddComponents() { // 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白 this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.add(getEditor(), BorderLayout.CENTER); - this.add(getArrowButton(), BorderLayout.EAST); + UITextField editor = getEditor(); + UIButton arrowButton = getArrowButton(); + setStyle(editor, TRANSPARENT_TEXT_FIELD); + setStyle(arrowButton, PLAIN_BUTTON); + this.add(editor, BorderLayout.CENTER); + this.add(arrowButton, BorderLayout.EAST); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellRender.java index fe04fa5b51..dc6317db35 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellRender.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellRender.java @@ -1,8 +1,10 @@ package com.fr.design.mainframe.cell.settingpane.desensitization.model; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.report.cell.desensitization.CellDesensitizationBean; import javax.swing.BorderFactory; +import javax.swing.JPanel; import javax.swing.JTable; import javax.swing.border.LineBorder; import javax.swing.table.DefaultTableCellRenderer; @@ -41,8 +43,9 @@ public class DesensitizationCellRender extends DefaultTableCellRenderer { } else { editPane.getEditPanel().setBorder(BorderFactory.createEmptyBorder()); } - - return editPane.getEditPanel(); + JPanel editPanel = editPane.getEditPanel(); + editPanel.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); + return editPanel; } diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java index 1b3ffd640c..99aa57a4a6 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortUIExpandablePane.java @@ -5,6 +5,7 @@ import com.fine.theme.icon.LazyIcon; import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.utils.FineUIScale; import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.border.FineBorderFactory; import com.fr.design.constants.LayoutConstants; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -40,7 +41,7 @@ public class SortUIExpandablePane extends JPanel { this.sortGroupPane = sortGroupPane; this.contentPane = contentPane; initComponents(); - wrapPane.setBorder(new FineRoundBorder()); + wrapPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); wrapPane.setBackground(Color.WHITE); } diff --git a/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java b/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java index 71dbd52603..e23b7e08c6 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java @@ -1,12 +1,13 @@ package com.fr.design.widget; -import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fine.swing.ui.layout.BaseLayoutContainer; import com.fr.design.border.FineBorderFactory; import com.fr.design.data.DataCreatorUI; import com.fr.design.dialog.AttrScrollPane; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.frpane.FineTabbedPane; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; @@ -18,6 +19,7 @@ import com.fr.form.ui.Widget; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.CardLayout; +import java.awt.Component; import java.util.ArrayList; import static com.fine.swing.ui.layout.Layouts.cell; @@ -34,9 +36,7 @@ public class CellWidgetCardPane extends BasicPane { private WidgetMobilePane currentWidgetMobilePane; //属性配置切换面板 private ArrayList paneList; - private JPanel center; - private UIHeadGroup tabsHeaderIconPane; - private CardLayout tabbedPane; + private BaseLayoutContainer tabsHeaderIconPane; private BasicWidgetPropertySettingPane widgetPropertyPane; //通用属性容器 @@ -64,23 +64,29 @@ public class CellWidgetCardPane extends BasicPane { this.removeAll(); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - tabbedPane = new CardLayout(); - center = new JPanel(tabbedPane); final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")}; - tabsHeaderIconPane = new UIHeadGroup(tabTitles) { - @Override - public void tabChanged(int index) { - tabbedPane.show(center, tabTitles[index]); - } - }; - JPanel wrapperPane = new JPanel(new BorderLayout()); - wrapperPane.add(tabsHeaderIconPane, BorderLayout.NORTH); - wrapperPane.add(center, BorderLayout.CENTER); - wrapperPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 10)); - this.add(wrapperPane, BorderLayout.CENTER); + Component component = initTabPane(); + + initTabHead(tabTitles, component); + + this.add(tabsHeaderIconPane, BorderLayout.CENTER); + + initPaneList(); + + } + + private void initTabHead(String[] tabTitles, Component component) { + tabsHeaderIconPane = FineTabbedPane.builder() + .addTab(tabTitles[0], component) + .addTab(tabTitles[1], eventTabPane) + .addTab(tabTitles[2], mobileTabPane) + .withHeadRatio(1.0f) + .build(); + } + protected Component initTabPane() { // 属性 attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); BasicScrollPane basicScrollPane = new AttrScrollPane() { @@ -95,9 +101,9 @@ public class CellWidgetCardPane extends BasicPane { attriCardLayout = (CardLayout) attriCardPane.getLayout(); attriTabPane.add(column( - cell(basicPane), - fix(1).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())), - cell(attriCardPane) + cell(basicPane), + fix(1).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())), + cell(attriCardPane) ).getComponent() ); @@ -112,14 +118,10 @@ public class CellWidgetCardPane extends BasicPane { mobileTabPane.add(mobileCardPane, BorderLayout.CENTER); mobileCardLayout = (CardLayout) mobileCardPane.getLayout(); - center.add(basicScrollPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute")); - center.add(eventTabPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event")); - center.add(mobileTabPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")); - initPaneList(); - + return basicScrollPane; } - private void initPaneList() { + protected void initPaneList() { paneList = new ArrayList(); paneList.add(attriTabPane); paneList.add(eventPane); @@ -137,7 +139,10 @@ public class CellWidgetCardPane extends BasicPane { public void populate(Widget cellWidget) { initComponents(pane); + populateWidget(cellWidget); + } + protected void populateWidget(Widget cellWidget) { WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() { @Override public void did(DataCreatorUI ui, String cardName) { @@ -160,8 +165,9 @@ public class CellWidgetCardPane extends BasicPane { mobileCardLayout.show(mobileCardPane, mobilePane.getClass().toString()); currentWidgetMobilePane = mobilePane; - - tabsHeaderIconPane.setSelectedIndex(0); + if (tabsHeaderIconPane instanceof UIHeadGroup) { + ((UIHeadGroup) tabsHeaderIconPane).setSelectedIndex(0); + } } public Widget update() { @@ -195,4 +201,12 @@ public class CellWidgetCardPane extends BasicPane { eventPane.checkValid(); } + protected JPanel getEventTabPane() { + return this.eventTabPane; + } + + protected JPanel getMobileTabPane() { + return this.mobileTabPane; + } + } diff --git a/designer-realize/src/main/java/com/fr/design/widget/EastCellWidgetCardPane.java b/designer-realize/src/main/java/com/fr/design/widget/EastCellWidgetCardPane.java new file mode 100644 index 0000000000..0ed6faa17c --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/widget/EastCellWidgetCardPane.java @@ -0,0 +1,67 @@ +package com.fr.design.widget; + +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.design.gui.ibutton.UIHeadGroup; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.form.ui.Widget; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; + +/** + * 东区控件面板子类 + * @author Renekton + * @since 2024/8/6. + * Created on 2024/8/6. + */ +public class EastCellWidgetCardPane extends CellWidgetCardPane { + + private CardLayout tabbedPane; + + private JPanel center; + + private UIHeadGroup tabsHeaderIconPane; + + public EastCellWidgetCardPane(ElementCasePane pane) { + super(pane); + } + + private void initComponents() { + + this.removeAll(); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + tabbedPane = new CardLayout(); + center = new JPanel(tabbedPane); + + final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")}; + tabsHeaderIconPane = new UIHeadGroup(tabTitles) { + @Override + public void tabChanged(int index) { + tabbedPane.show(center, tabTitles[index]); + } + }; + JPanel wrapperPane = new JPanel(new BorderLayout()); + wrapperPane.add(tabsHeaderIconPane, BorderLayout.NORTH); + wrapperPane.add(center, BorderLayout.CENTER); + wrapperPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 10)); + this.add(wrapperPane, BorderLayout.CENTER); + Component component = initTabPane(); + center.add(component, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute")); + center.add(getEventTabPane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event")); + center.add(getMobileTabPane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")); + initPaneList(); + } + + /** + * 东区面板 + */ + public void populate(Widget cellWidget) { + initComponents(); + super.populateWidget(cellWidget); + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java b/designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java index b941b02efa..cfdbf9e21f 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java @@ -4,16 +4,17 @@ import javax.swing.*; 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.ElementCasePane; import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.form.ui.DataControl; import com.fr.form.ui.Widget; import com.fr.form.ui.WidgetValue; - -import java.awt.*; +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; public class ValueWidgetPane extends WidgetPane { private JPanel widgetValuePane; @@ -27,18 +28,20 @@ public class ValueWidgetPane extends WidgetPane { public JPanel initNorthPane(){ JPanel northPane = super.initNorthPane(); - label = new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Value")+ ":"); + label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Value")); label.setVisible(false); widgetValuePane = new JPanel(); widgetValuePane.setLayout(FRGUIPaneFactory.createBorderLayout()); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, p, f}; - double[] rowSize = {p}; - Component[][] components = new Component[][]{ - new Component[]{northPane, label,widgetValuePane}, - }; - JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel jPanel = new JPanel(FRGUIPaneFactory.createBorderLayout()); + jPanel.add(column(10, + cell(northPane), + column( + row( + cell(label).weight(LEFT_WEIGHT), + cell(widgetValuePane).weight(RIGHT_WEIGHT) + ) + ) + ).getComponent()); return jPanel; } diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java index 80ba33ef26..1887a4007c 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java @@ -50,6 +50,8 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener private boolean shouldFireSelectedEvent = true; private JComponent northPane; + private boolean eastRegion = false; + public WidgetPane() { this(null); } @@ -61,6 +63,11 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener this.initComponents(pane); } + public WidgetPane(ElementCasePane pane, boolean eastRegion) { + this.eastRegion = eastRegion; + this.initComponents(pane); + } + public boolean isShouldFireSelectedEvent(){ return shouldFireSelectedEvent; @@ -97,7 +104,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener } protected CellWidgetCardPane initWidgetCardPane(ElementCasePane pane) { - return new CellWidgetCardPane(pane); + return eastRegion ? new EastCellWidgetCardPane(pane) : new CellWidgetCardPane(pane); } protected JPanel createContentPane() { diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java index d1ecaeca5c..c5e0abec75 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java @@ -1,16 +1,14 @@ package com.fr.design.widget.ui; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.FRContext; import com.fr.data.core.FormatField; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; -import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.component.DateValuePane; import com.fr.design.widget.component.UIComboBoxNoArrow; import com.fr.design.widget.ui.designer.date.DateFormatCheckManager; @@ -31,6 +29,12 @@ import java.awt.event.ActionListener; import java.text.SimpleDateFormat; import java.util.Date; +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.cell; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + public class DateEditorDefinePane extends DirectWriteEditorDefinePane { private UIButtonGroup returnTypeComboBox; @@ -57,27 +61,22 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane