From 7e1f6c1322043502c08a687473b50e8b45a147f4 Mon Sep 17 00:00:00 2001 From: vito Date: Fri, 3 Nov 2023 16:23:47 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-99485=20=E9=80=82=E9=85=8D=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 9 +- designer-base/build.base.gradle | 12 +- .../fine/theme/light/icon/IconManager.java | 11 + .../theme/light/ui/FineToggleButtonUI.java | 93 ++ .../fine/theme/light/ui/laf/FineLightLaf.java | 24 + .../fine/theme/light/utils/FineUIUtils.java | 40 + .../fr/design/actions/core/ActionFactory.java | 22 +- .../design/data/datapane/TableDataTree.java | 8 +- .../data/datapane/TableDataTreePane.java | 3 +- .../connect/ConnectionTableProcedurePane.java | 4 +- .../pane/TableDataSearchRemindPane.java | 2 +- .../exe/callback/ModifyStatusCallback.java | 25 +- .../exe/callback/UninstallPluginCallback.java | 47 +- .../fr/design/file/MultiTemplateTabPane.java | 37 +- .../com/fr/design/file/NewTemplatePane.java | 4 +- .../fr/design/foldablepane/HeaderPane.java | 38 +- .../java/com/fr/design/gui/UILookAndFeel.java | 25 +- .../design/gui/controlpane/UIControlPane.java | 16 +- .../design/gui/frpane/LoadingBasicPane.java | 30 +- .../fr/design/gui/frpane/UITabbedPane.java | 39 +- .../fr/design/gui/frpane/UITabbedPaneUI.java | 2 +- .../com/fr/design/gui/ibutton/UIButton.java | 74 +- .../fr/design/gui/ibutton/UIButtonGroup.java | 52 +- .../com/fr/design/gui/ibutton/UIButtonUI.java | 50 +- .../com/fr/design/gui/ibutton/UIHead.java | 23 +- .../fr/design/gui/ibutton/UIHeadGroup.java | 282 +++-- .../UIHeadGroupSingleSelectionModel.java | 31 + .../fr/design/gui/icombobox/UIComboBox.java | 16 +- .../icontainer/UIEastResizableContainer.java | 13 +- .../icontainer/UIModeControlContainer.java | 1 + .../gui/icontainer/UIResizableContainer.java | 12 +- .../design/gui/icontainer/UIScrollPane.java | 14 +- .../fr/design/gui/ilist/TableViewList.java | 2 +- .../com/fr/design/gui/imenu/UIHeadMenu.java | 73 +- .../fr/design/gui/imenu/UILockMenuItemUI.java | 4 +- .../java/com/fr/design/gui/imenu/UIMenu.java | 119 +- .../com/fr/design/gui/imenu/UIMenuBar.java | 8 +- .../com/fr/design/gui/imenu/UIMenuBarUI.java | 9 +- .../design/gui/imenu/UIMenuEastAttrItem.java | 10 +- .../fr/design/gui/imenu/UIMenuHighLight.java | 25 - .../com/fr/design/gui/imenu/UIMenuItem.java | 9 +- .../com/fr/design/gui/imenu/UIPopupMenu.java | 24 +- .../com/fr/design/gui/imenu/UIScrollMenu.java | 14 +- .../design/gui/imenu/UIScrollPopUpMenu.java | 22 +- .../fr/design/gui/iscrollbar/UIScrollBar.java | 6 +- .../fr/design/gui/ispinner/UISpinnerUI.java | 1 - .../com/fr/design/gui/itable/UITable.java | 51 +- .../itableeditorpane/UITableEditorPane.java | 2 +- .../fr/design/gui/itextfield/UITextField.java | 16 +- .../com/fr/design/gui/itoolbar/UIToolbar.java | 7 +- .../gui/itree/filetree/EnvFileTree.java | 12 +- .../refreshabletree/RefreshableJTree.java | 17 +- .../com/fr/design/i18n/DesignI18nImpl.java | 9 +- .../mainframe/CenterRegionContainerPane.java | 2 - .../DesignerFrameFileDealerPane.java | 3 - .../mainframe/EastRegionContainerPane.java | 97 +- .../fr/design/mainframe/ForbiddenPane.java | 17 +- .../fr/design/mainframe/JFormSliderPane.java | 19 +- .../mainframe/NorthRegionContainerPane.java | 2 - .../mainframe/WestRegionContainerPane.java | 17 +- .../mainframe/guide/base/GuideView.java | 2 +- .../loghandler/DesignerLogHandler.java | 2 +- .../mainframe/loghandler/LogHandlerBar.java | 2 +- .../mainframe/loghandler/LogMessageBar.java | 3 - .../mainframe/toolbar/LookAndFeelAction.java | 41 + .../mainframe/toolbar/ToolBarMenuDock.java | 21 +- .../design/mainframe/vcs/ui/VcsMovePanel.java | 14 +- .../mainframe/widget/editors/TextField.java | 4 +- .../com/fr/design/menu/DottedSeparator.java | 16 +- .../com/fr/design/menu/LineSeparator.java | 12 +- .../com/fr/design/menu/NameSeparator.java | 18 +- .../ui/NotificationCenterPane.java | 4 +- .../roleAuthority/ReportAndFSManagePane.java | 3 +- .../style/color/CustomChooserPanel.java | 1 - .../java/com/fr/design/ui/util/UIUtil.java | 12 +- .../java/com/fr/design/upm/UpmBridge.java | 4 +- .../java/com/fr/design/utils/DesignUtils.java | 12 +- .../start/server/FineEmbedServerMonitor.java | 29 +- .../light/ui/laf/FineLightLaf.properties | 1077 +++++++++++++++++ designer-chart/build.chart.gradle | 2 +- designer-chart/build.gradle | 2 +- .../design/mainframe/chart/ChartEditPane.java | 1 - designer-form/build.form.gradle | 2 +- designer-form/build.gradle | 2 +- .../treeview/ComponentTreeCellRenderer.java | 4 +- .../fr/design/mainframe/ComponentTree.java | 16 +- .../mainframe/FormHierarchyTreePane.java | 21 +- .../design/mainframe/WidgetPropertyPane.java | 7 +- designer-realize/build.gradle | 4 +- .../fr/design/cell/bar/DynamicScrollBar.java | 22 +- .../fr/design/mainframe/ReportFloatPane.java | 19 +- .../fr/design/mainframe/SheetNameTabPane.java | 54 +- .../alphafine/component/AlphaFinePane.java | 4 - .../alphafine/question/QuestionWindow.java | 7 +- .../mainframe/cell/CellElementEditPane.java | 1 - .../design/mainframe/guide/GuideRegister.java | 9 +- .../com/fr/design/webattr/SettingToolBar.java | 23 +- .../fr/design/webattr/ToolBarDragPane.java | 15 +- .../com/fr/design/webattr/ToolBarPane.java | 4 +- .../fr/design/widget/CellWidgetCardPane.java | 1 - .../src/main/java/com/fr/grid/GridCorner.java | 12 +- .../src/main/java/com/fr/grid/GridUI.java | 11 +- .../cellquick/CellDSColumnEditor.java | 1 - .../main/java/com/fr/start/MainDesigner.java | 48 +- .../fr/start/module/DesignerActivator.java | 38 +- settings.gradle | 2 +- 106 files changed, 2302 insertions(+), 963 deletions(-) create mode 100644 designer-base/src/main/java/com/fine/theme/light/icon/IconManager.java create mode 100644 designer-base/src/main/java/com/fine/theme/light/ui/FineToggleButtonUI.java create mode 100644 designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java create mode 100644 designer-base/src/main/java/com/fine/theme/light/utils/FineUIUtils.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroupSingleSelectionModel.java delete mode 100644 designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuHighLight.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/toolbar/LookAndFeelAction.java create mode 100644 designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties diff --git a/build.gradle b/build.gradle index 052b2e40cc..0ebf3e9cb6 100644 --- a/build.gradle +++ b/build.gradle @@ -73,8 +73,8 @@ allprojects { implementation 'org.swingexplorer:swexpl:2.0.1' implementation 'org.swingexplorer:swag:1.0' implementation 'net.java.dev.jna:jna:5.4.0' - implementation 'org.apache.tomcat:tomcat-catalina:8.5.72' - implementation 'org.apache.tomcat:tomcat-websocket:8.5.72' + implementation 'org.apache.tomcat:tomcat-catalina:8.5.93' + implementation 'org.apache.tomcat:tomcat-websocket:8.5.93' implementation 'io.socket:socket.io-client:0.7.0' implementation 'com.fr.third:fine-third:' + frVersion implementation 'com.fr.core:fine-core:' + frDevVersion @@ -87,6 +87,10 @@ allprojects { implementation 'com.fr.report:engine-chart:' + frDevVersion implementation 'com.fr.report:engine-i18n:' + frDevVersion implementation 'com.fr.design:design-i18n:' + frDevVersion + implementation 'com.formdev:flatlaf:3.2' + implementation 'com.formdev:flatlaf-extras:3.2.1' + implementation 'com.fanruan.vito:gui-inspector:1.0.1' + implementation 'com.fine.swing.ui:layout:1.0-SNAPSHOT' testImplementation 'org.easymock:easymock:3.5.1' testImplementation 'org.powermock:powermock-module-junit4:1.7.1' testImplementation 'org.powermock:powermock-api-easymock:1.7.1' @@ -98,6 +102,7 @@ allprojects { if (OperatingSystem.current().isMacOsX() && "aarch64".equals(System.getProperty("os.arch"))) { dependencies { // jxbrowser 6.23不支持M1,因此没有本地库,但是6.23jar还是需要留着,用来兼容 + implementation 'com.fr.third:jxbrowser-mac:6.23' implementation "com.fr.third:jxbrowser-mac-arm-v7:${jxBrowserVersion}" } } else if (OperatingSystem.current().isMacOsX()) { diff --git a/designer-base/build.base.gradle b/designer-base/build.base.gradle index 094d45d9a6..5ad2f5394b 100644 --- a/designer-base/build.base.gradle +++ b/designer-base/build.base.gradle @@ -59,12 +59,12 @@ def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) //声明外部依赖 dependencies{ - compile fileTree(dir:"../${baseDir}/lib-other",include:'**/*.jar') - compile fileTree(dir:"../${baseDir}/lib-core",include:'**/*.jar') - compile fileTree(dir:"../${baseDir}/lib-design",include:'**/*.jar') - compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar") - compile group: 'io.socket', name: 'socket.io-client', version: '0.7.0' - testCompile 'junit:junit:4.12' + api fileTree(dir:"../${baseDir}/lib-other",include:'**/*.jar') + api fileTree(dir:"../${baseDir}/lib-core",include:'**/*.jar') + api fileTree(dir:"../${baseDir}/lib-design",include:'**/*.jar') + api fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar") + api group: 'io.socket', name: 'socket.io-client', version: '0.7.0' + testImplementation 'junit:junit:4.12' } //输出依赖报 diff --git a/designer-base/src/main/java/com/fine/theme/light/icon/IconManager.java b/designer-base/src/main/java/com/fine/theme/light/icon/IconManager.java new file mode 100644 index 0000000000..bc4bbeade8 --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/light/icon/IconManager.java @@ -0,0 +1,11 @@ +package com.fine.theme.light.icon; + +/** + * 图标管理器 + * + * @author vito + * @since 11.0 + * Created on 2023/9/12 + */ +public class IconManager { +} diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineToggleButtonUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineToggleButtonUI.java new file mode 100644 index 0000000000..71e4b83b5f --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineToggleButtonUI.java @@ -0,0 +1,93 @@ +package com.fine.theme.light.ui; + + +import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable; +import com.formdev.flatlaf.ui.FlatToggleButtonUI; +import com.formdev.flatlaf.ui.FlatUIUtils; +import org.jetbrains.annotations.Nullable; + +import javax.swing.AbstractButton; +import javax.swing.JComponent; +import javax.swing.JToggleButton; +import javax.swing.UIManager; +import javax.swing.plaf.ComponentUI; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; + +import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE; +import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE_TAB; +import static com.formdev.flatlaf.FlatClientProperties.TAB_BUTTON_SELECTED_BACKGROUND; +import static com.formdev.flatlaf.FlatClientProperties.clientPropertyColor; + +/** + * 提供 {@link javax.swing.JToggleButton} 的UI类 + *

+ * + * @author vito + * @uiDefault ToggleButton.tab.arc int + * @since 11.0 + * Created on 2023/11/3 + */ +public class FineToggleButtonUI extends FlatToggleButtonUI { + + @Styleable(dot = true) + protected int tabArc; + + public static ComponentUI createUI(JComponent c) { + return FlatUIUtils.canUseSharedUI(c) + ? FlatUIUtils.createSharedUI(FlatToggleButtonUI.class, () -> new FineToggleButtonUI(true)) + : new FineToggleButtonUI(false); + } + + protected FineToggleButtonUI(boolean shared) { + super(shared); + } + + @Override + protected void installDefaults(AbstractButton b) { + super.installDefaults(b); + tabArc = UIManager.getInt("ToggleButton.tab.arc"); + } + + + @Nullable + static String getButtonTypeStr(AbstractButton c) { + Object value = c.getClientProperty(BUTTON_TYPE); + if (value instanceof String) + return (String) value; + return null; + } + + static boolean isTabButton(Component c) { + return c instanceof JToggleButton && BUTTON_TYPE_TAB.equals(getButtonTypeStr((JToggleButton) c)); + } + + @Override + protected void paintBackground(Graphics g, JComponent c) { + if (isTabButton(c)) { + int height = c.getHeight(); + int width = c.getWidth(); + boolean selected = ((AbstractButton) c).isSelected(); + Color enabledColor = selected ? clientPropertyColor(c, TAB_BUTTON_SELECTED_BACKGROUND, tabSelectedBackground) : null; + + // use component background if explicitly set + if (enabledColor == null) { + Color bg = c.getBackground(); + if (isCustomBackground(bg)) + enabledColor = bg; + } + + // paint background + Color background = buttonStateColor(c, enabledColor, + null, tabFocusBackground, tabHoverBackground, null); + if (background != null) { + g.setColor(background); + g.fillRoundRect(0, 0, width, height, tabArc, tabArc); + } + } else + super.paintBackground(g, c); + } + +} + diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java new file mode 100644 index 0000000000..7b3bbcce1b --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java @@ -0,0 +1,24 @@ +package com.fine.theme.light.ui.laf; + +import com.formdev.flatlaf.FlatLightLaf; + +/** + * FineReport designer new look and feel + * + * @author vito + * @since 11.0 + * Created on 2023/9/12 + */ +public class FineLightLaf extends FlatLightLaf { + public static boolean setup() { + return setup( new FineLightLaf() ); + } + + @Override + public String getName() { + return "FineLightLaf"; + } + + + +} diff --git a/designer-base/src/main/java/com/fine/theme/light/utils/FineUIUtils.java b/designer-base/src/main/java/com/fine/theme/light/utils/FineUIUtils.java new file mode 100644 index 0000000000..693600770e --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/light/utils/FineUIUtils.java @@ -0,0 +1,40 @@ +package com.fine.theme.light.utils; + +import javax.swing.UIManager; +import java.awt.Color; + +/** + * UI绘制的一些常用方法 + * + * @author vito + * @since 11.0 + * Created on 2023/11/3 + */ +public class FineUIUtils { + + + /** + * 通过key获取UI的颜色,如果没有则使用后备key获取 + * + * @param key 颜色key + * @param defaultKey 颜色后备key + * @return 颜色 + */ + + public static Color getUIColor(String key, String defaultKey) { + Color color = UIManager.getColor(key); + return (color != null) ? color : UIManager.getColor(defaultKey); + } + + /** + * 获取key指定的int值,如果没有则使用后备key获取 + * + * @param key int所在的key + * @param defaultKey 后备key + * @return 长度 + */ + public static int getUIInt(String key, String defaultKey) { + Object value = UIManager.get(key); + return (value instanceof Integer) ? (Integer) value : UIManager.getInt(defaultKey); + } +} diff --git a/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java b/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java index 3a8137f9d0..84fcd68696 100644 --- a/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java +++ b/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java @@ -30,8 +30,8 @@ import java.util.concurrent.CopyOnWriteArraySet; * @version 2017年11月17日14点39分 */ public class ActionFactory { - private static Set> actionClasses = new CopyOnWriteArraySet<>(); - private static Set> floatActionClasses = new CopyOnWriteArraySet<>(); + private static final Set> actionClasses = new CopyOnWriteArraySet<>(); + private static final Set> floatActionClasses = new CopyOnWriteArraySet<>(); private static Class chartCollectionClass = null; /** @@ -287,13 +287,13 @@ public class ActionFactory { * * @param cls 类型数组 */ - public static void registerCellInsertActionClass(Class[] cls) { + public static void registerCellInsertActionClass(Class[] cls) { if (cls != null) { actionClasses.addAll(Arrays.asList(cls)); } } - public static void referCellInsertActionClass(Class[] cls) { + public static void referCellInsertActionClass(Class[] cls) { if (cls != null) { actionClasses.clear(); actionClasses.addAll(Arrays.asList(cls)); @@ -331,13 +331,13 @@ public class ActionFactory { public static MenuKeySet[] createCellInsertActionName() { List actionNames = new ArrayList<>(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - for (Class clazz : actionClasses) { + for (Class clazz : actionClasses) { if (clazz == null) { continue; } if (jTemplate.acceptToolbarItem(clazz)) { try { - Constructor c = (Constructor) clazz.getConstructor(); + Constructor c = clazz.getConstructor(); actionNames.add(c.newInstance().getMenuKeySet()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); @@ -352,13 +352,13 @@ public class ActionFactory { * * @param cls 插入类型数组 */ - public static void registerFloatInsertActionClass(Class[] cls) { + public static void registerFloatInsertActionClass(Class[] cls) { if (cls != null) { floatActionClasses.addAll(Arrays.asList(cls)); } } - public static void referFloatInsertActionClass(Class[] cls) { + public static void referFloatInsertActionClass(Class[] cls) { if (cls != null) { floatActionClasses.clear(); floatActionClasses.addAll(Arrays.asList(cls)); @@ -374,18 +374,18 @@ public class ActionFactory { */ public static UpdateAction[] createFloatInsertAction(Class cls, Object obj) { List actions = new ArrayList<>(); - for (Class clazz : floatActionClasses) { + for (Class clazz : floatActionClasses) { if (clazz == null) { continue; } try { - Constructor c = (Constructor) clazz.getConstructor(cls); + Constructor c = clazz.getConstructor(cls); actions.add(c.newInstance(obj)); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - return actions.toArray(new UpdateAction[actions.size()]); + return actions.toArray(new UpdateAction[0]); } private static QuickEditor createEditor(Class clazz, Map editorMap, Map> editorClassMap) { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java index ed08cffddf..c19b4b2740 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java @@ -2,7 +2,6 @@ package com.fr.design.data.datapane; import com.fr.base.svg.IconUtils; import com.fr.data.MultiResultTableData; -import com.fr.design.constants.UIConstants; import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; @@ -17,7 +16,6 @@ import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; -import java.awt.Color; import java.awt.Component; import java.util.ArrayList; import java.util.HashMap; @@ -79,9 +77,9 @@ public class TableDataTree extends UserObjectRefreshJTree { this.setText(PENDING.toString()); } this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); - this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND); - this.setTextSelectionColor(Color.WHITE); - this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); +// this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND); +// this.setTextSelectionColor(Color.WHITE); +// this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); return this; } }; diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 149fa87dc2..83078a2f19 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -76,6 +76,7 @@ import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; import javax.swing.ToolTipManager; +import javax.swing.border.EmptyBorder; import javax.swing.tree.TreePath; import java.awt.BorderLayout; import java.awt.Color; @@ -275,6 +276,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { treePane.add(northPane, BorderLayout.NORTH); treePane.add(remindPane, BorderLayout.CENTER); + treePane.setBorder(new EmptyBorder(10, 10,10,10)); return treePane; } @@ -813,7 +815,6 @@ public class TableDataTreePane extends BasicTableDataTreePane { return false; } }; - buttonGroup.setNeedLeftRightOutLine(false); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java index 79e75a0b83..41556dae83 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java @@ -7,7 +7,6 @@ import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.Connection; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; -import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane; import com.fr.design.data.tabledata.tabledatapane.loading.SwitchableTableDataPane; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; @@ -27,7 +26,6 @@ import javax.swing.ToolTipManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -164,7 +162,7 @@ public class ConnectionTableProcedurePane extends BasicPane { JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel searchPane = new JPanel(new BorderLayout(10, 0)); searchPane.setBorder(BorderFactory.createLineBorder(UIConstants.TOOLBAR_BORDER_COLOR)); - searchPane.setBackground(Color.WHITE); +// searchPane.setBackground(Color.WHITE); searchField = new UITextField(); searchField.setBorderPainted(false); searchField.setPlaceholder(Toolkit.i18nText("Fine-Design_Basic_Table_Search")); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/TableDataSearchRemindPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/TableDataSearchRemindPane.java index dad2d4d4c6..bab21699cb 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/TableDataSearchRemindPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/TableDataSearchRemindPane.java @@ -106,7 +106,7 @@ public class TableDataSearchRemindPane extends JPanel implements TreeSearchStatu emptyPicLabel.setHorizontalAlignment(SwingConstants.CENTER); emptyPicLabel.setPreferredSize(new Dimension(240, 100)); UILabel textLabel = new UILabel(Toolkit.i18nText("Fine-Design_Tree_Search_Not_Match"), SwingConstants.CENTER); - textLabel.setForeground(Color.gray); +// textLabel.setForeground(Color.gray); textLabel.setHorizontalAlignment(SwingConstants.CENTER); textLabel.setPreferredSize(new Dimension(240, 20)); notFoundPane.add(emptyPicLabel); diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java index 434be685db..c9c8190a98 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java @@ -7,6 +7,7 @@ import com.fr.design.extra.PluginOperateUtils; import com.fr.design.i18n.Toolkit; import com.fr.design.plugin.DesignerPluginContext; +import com.fr.design.ui.util.UIUtil; import com.fr.log.FineLoggerFactory; import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskResult; @@ -32,17 +33,19 @@ public class ModifyStatusCallback implements PluginTaskCallback { @Override public void done(PluginTaskResult result) { - String pluginInfo = PluginOperateUtils.getSuccessInfo(result); - if (result.isSuccess()) { - jsCallback.execute("success"); - String modifyMessage = isActive ? - pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") : - pluginInfo + Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate"); - FineLoggerFactory.getLogger().info(modifyMessage); - FineJOptionPane.showMessageDialog(DesignerPluginContext.getPluginDialog(), modifyMessage); - } else { - FineJOptionPane.showMessageDialog(DesignerPluginContext.getPluginDialog(), pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); - } + UIUtil.invokeLaterIfNeeded(() -> { + String pluginInfo = PluginOperateUtils.getSuccessInfo(result); + if (result.isSuccess()) { + jsCallback.execute("success"); + String modifyMessage = isActive ? + pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") : + pluginInfo + Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate"); + FineLoggerFactory.getLogger().info(modifyMessage); + FineJOptionPane.showMessageDialog(DesignerPluginContext.getPluginDialog(), modifyMessage); + } else { + FineJOptionPane.showMessageDialog(DesignerPluginContext.getPluginDialog(), pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); + } + }); } } diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java index 6fba685d75..5baeeaeff4 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java @@ -5,6 +5,7 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.PluginOperateUtils; import com.fr.design.i18n.Toolkit; +import com.fr.design.ui.util.UIUtil; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginMarker; import com.fr.plugin.error.PluginErrorCode; @@ -17,34 +18,36 @@ import com.fr.plugin.manage.control.PluginTaskResult; public class UninstallPluginCallback extends AbstractPluginTaskCallback { private JSCallback jsCallback; - public UninstallPluginCallback(PluginMarker pluginMarker, JSCallback jsCallback){ + public UninstallPluginCallback(PluginMarker pluginMarker, JSCallback jsCallback) { this.jsCallback = jsCallback; this.pluginMarker = pluginMarker; } @Override public void done(PluginTaskResult result) { - String pluginInfo = PluginOperateUtils.getSuccessInfo(result); - if (result.isSuccess()) { - jsCallback.execute("success"); - String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success"); - FineLoggerFactory.getLogger().info(successInfo); - FineJOptionPane.showMessageDialog(null, successInfo); - }else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) { - int rv = FineJOptionPane.showConfirmDialog( - null, - Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Dependence"), - Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - FineJOptionPane.OK_CANCEL_OPTION, - FineJOptionPane.INFORMATION_MESSAGE - ); - if (rv == FineJOptionPane.OK_OPTION) { - PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback)); + UIUtil.invokeLaterIfNeeded(() -> { + String pluginInfo = PluginOperateUtils.getSuccessInfo(result); + if (result.isSuccess()) { + jsCallback.execute("success"); + String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success"); + FineLoggerFactory.getLogger().info(successInfo); + FineJOptionPane.showMessageDialog(null, successInfo); + } else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) { + int rv = FineJOptionPane.showConfirmDialog( + null, + Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Dependence"), + Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + FineJOptionPane.OK_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE + ); + if (rv == FineJOptionPane.OK_OPTION) { + PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback)); + } + } else { + jsCallback.execute("failed"); + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Failed")); + FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE); } - } else { - jsCallback.execute("failed"); - FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Failed")); - FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE); - } + }); } } diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index 8f2783a3ca..670e3ca15f 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -62,7 +62,6 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; -import java.awt.geom.Arc2D; import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Path2D; @@ -76,6 +75,7 @@ import static javax.swing.JOptionPane.OK_CANCEL_OPTION; import static javax.swing.JOptionPane.OK_OPTION; import static javax.swing.JOptionPane.WARNING_MESSAGE; +// todo: 自己绘制组件 /** * 改个名字,一个拼写 n 个错误 * @@ -146,6 +146,9 @@ public class MultiTemplateTabPane extends JComponent { // 模板时,模板B会自动关闭 private JTemplate temTemplate = null; +// private final Color selectedColor = UIManager.getColor("TabbedPane.hoverColor"); +// private Color hoverColor = UIManager.getColor("TabbedPane.inactiveUnderlineColor"); + public static MultiTemplateTabPane getInstance() { if (THIS == null) { @@ -163,7 +166,7 @@ public class MultiTemplateTabPane extends JComponent { this.addMouseListener(new MultiTemplateTabMouseListener()); this.addMouseMotionListener(new MultiTemplateTabMouseMotionListener()); this.setBorder(null); - this.setForeground(new Color(58, 56, 58)); +// this.setForeground(new Color(58, 56, 58)); this.setFont(DesignUtils.getDefaultGUIFont().applySize(12)); openedTemplate = HistoryTemplateListCache.getInstance().getHistoryList(); selectedIndex = openedTemplate.size() - 1; @@ -527,11 +530,11 @@ public class MultiTemplateTabPane extends JComponent { final int index = i; final JTemplate tem = openedTemplate.get(i); templates[i] = new UIMenuItem(tempalteShowName(tem), tem.getIcon()); - templates[i].setUI(new UIListDownItemUI()); +// templates[i].setUI(new UIListDownItemUI()); setListDownItemPreferredSize(templates[i]); if (i == selectedIndex) { //画选中的高亮 - templates[i].setBackground(UIConstants.SHADOW_CENTER); +// templates[i].setBackground(UIConstants.SHADOW_CENTER); } templates[i].addActionListener(new ActionListener() { @Override @@ -676,7 +679,7 @@ public class MultiTemplateTabPane extends JComponent { private void paintDefaultBackground(Graphics2D g2d) { //画默认背景 - g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, (float) (getHeight() - 1.0D), UIConstants.TEMPLATE_TAB_PANE_BACKGROUND)); + g2d.setPaint(new GradientPaint(1, 1, getBackground(), 1, (float) (getHeight() - 1.0D), getBackground())); g2d.fillRect(0, 0, getWidth(), getHeight()); } @@ -856,7 +859,7 @@ public class MultiTemplateTabPane extends JComponent { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {1, getHeight() + 1, getHeight() + 1, 1, 1}; RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(templateStartX, 1, this.getWidth(), this.getHeight(), 7, 7); - g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, (float) (getHeight() - 1.0D), UIConstants.SELECT_TAB)); + g2d.setPaint(new GradientPaint(1, 1, getBackground(), (float) (getWidth() -1.0d), 1, getBackground())); //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 double specialLocation1 = 2.5; double specialLocation2 = 4.330127; @@ -874,14 +877,14 @@ public class MultiTemplateTabPane extends JComponent { generalPath.closePath(); g2d.fill(generalPath); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setPaint(new Color(200, 201, 205)); - g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); - g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1])); - g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); - g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); - g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); +// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); +// g2d.setPaint(Color.red); +// g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); +// g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1])); +// g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); +// g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); +// g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); +// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); int sheetIconY = (getHeight() - sheeticon.getIconHeight()) / 2; sheeticon.paintIcon(this, g2d, (int) templateStartX + GAP, sheetIconY); // 画字符 @@ -911,9 +914,9 @@ public class MultiTemplateTabPane extends JComponent { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; if (selfIndex == mouseOveredIndex) { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, (float) (getHeight() - 1.0D), UIConstants.HOVER_BLUE)); + g2d.setPaint(new GradientPaint(1, 1, getBackground(), 1, (float) (getHeight() - 1.0D), getBackground())); } else { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, (float) (getHeight() - 1.0D), UIConstants.SHADOW_GREY)); + g2d.setPaint(new GradientPaint(1, 1, getBackground(), 1, (float) (getHeight() - 1.0D), getBackground())); } @@ -1177,7 +1180,7 @@ public class MultiTemplateTabPane extends JComponent { Color oldColor = g.getColor(); int menuWidth = menuItem.getWidth(); int menuHeight = menuItem.getHeight(); - g.setColor(UIConstants.NORMAL_BACKGROUND); + g.setColor(getBackground()); g.fillRect(0, 0, menuWidth, menuHeight); boolean itemIsSelected = menuItem instanceof JMenu && model.isSelected(); if (menuItem.isOpaque()) { diff --git a/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java b/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java index 81f82e78c6..256ddccd27 100644 --- a/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java @@ -13,6 +13,7 @@ import java.awt.event.MouseMotionListener; import java.awt.geom.Line2D; import java.awt.geom.Rectangle2D; +// todo: 自己绘制组件 /** * Author : daisy * Date: 13-8-27 @@ -33,7 +34,6 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene this.addMouseListener(this); this.addMouseMotionListener(this); this.setBorder(null); - this.setForeground(new Color(99, 99, 99)); } public Dimension getPreferredSize() { @@ -46,7 +46,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene public void paintComponent(Graphics g) { super.paintComponent(g); g2d = (Graphics2D) g; - g2d.setColor(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND); + g2d.setColor(getBackground()); g2d.fill(new Rectangle2D.Double(0, 0, getWidth(),getHeight())); int sheetIconY = (getHeight() - newWorkBookIconMode.getIconHeight()) / 2; newWorkBookIconMode.paintIcon(this, g2d, ICON_START_X, sheetIconY); diff --git a/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java b/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java index 31cc290324..07e0172373 100644 --- a/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java +++ b/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java @@ -2,12 +2,15 @@ package com.fr.design.foldablepane; import com.fr.base.GraphHelper; import com.fr.design.constants.UIConstants; -import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxUtilities; -import javax.swing.*; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.util.Map; +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; /** * Created by MoMeak on 2017/7/5. @@ -55,26 +58,12 @@ public class HeaderPane extends JPanel { @Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g.create(); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - BufferedImage panelImage = createPanelImage(); - g2d.drawImage(panelImage, null, 0, 0); - GraphHelper.drawString(g2d, this.title, TITLE_X, headHeight - fontSize / 2 - 1); - } - - private BufferedImage createPanelImage() { - BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB); - Graphics2D g2d = panelImage.createGraphics(); - - g2d.setColor(isPressed ? UIConstants.POPUP_TITLE_BACKGROUND : UIConstants.COMPONENT_BACKGROUND_COLOR); +// g2d.setColor(isPressed ? UIConstants.POPUP_TITLE_BACKGROUND : UIConstants.COMPONENT_BACKGROUND_COLOR); headWidth = this.getWidth(); + g2d.setColor(getBackground()); g2d.fillRect(0, 0, headWidth, headHeight); - g2d.setFont(new Font("SimSun", 0, fontSize)); - g2d.setPaint(bgColor); - Map desktopHints = RSyntaxUtilities.getDesktopAntiAliasHints(); - if (desktopHints != null) { - g2d.setRenderingHints(desktopHints); - } +// g2d.setFont(new Font("SimSun", 0, fontSize)); + g2d.setPaint(getForeground()); int leftWdith = headWidth - LEFT_X; if (this.isShow) { image = UIConstants.DRAG_DOWN_SELECTED_SMALL; @@ -83,7 +72,8 @@ public class HeaderPane extends JPanel { image = UIConstants.DRAG_LEFT_NORMAL_SMALL; g2d.drawImage(image, leftWdith, LEFT_Y, null); } - return panelImage; + + GraphHelper.drawString(g2d, this.title, TITLE_X, headHeight - fontSize / 2 - 1); } @Override diff --git a/designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java b/designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java index c33f3e0fc2..89c73ee226 100644 --- a/designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java +++ b/designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java @@ -7,27 +7,30 @@ import com.fr.design.gui.borders.UITableHeaderBorder; import com.fr.design.gui.borders.UITableHeaderRolloverBorder; import com.fr.design.gui.borders.UITextFieldBorder; import com.fr.design.gui.frpane.UIBasicOptionPaneUI; -import com.fr.design.gui.ibutton.UIBasicButtonUI; +import com.fr.design.gui.frpane.UITabbedPaneUI; import com.fr.design.gui.ibutton.UIButtonBorder; +import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIRadioButtonMenuItemUI; import com.fr.design.gui.ibutton.UIRadioButtonUI; import com.fr.design.gui.icheckbox.UICheckBoxUI; -import com.fr.design.gui.icombobox.UIBasicComboBoxUI; +import com.fr.design.gui.icombobox.UIComboBoxUI; import com.fr.design.gui.icontainer.UIScrollPaneBorder; import com.fr.design.gui.icontainer.UIScrollPaneUI; import com.fr.design.gui.icontainer.UITableScrollPaneBorder; -import com.fr.design.gui.imenu.UIBasicMenuItemUI; import com.fr.design.gui.imenu.UIBasicMenuUI; +import com.fr.design.gui.imenu.UIMenuBarUI; +import com.fr.design.gui.imenu.UIMenuItemUI; import com.fr.design.gui.imenu.UIPopupMenuBorder; import com.fr.design.gui.imenu.UIPopupMenuSeparatorUI; import com.fr.design.gui.iprogressbar.UIProgressBarBorder; import com.fr.design.gui.iprogressbar.UIProgressBarUI; -import com.fr.design.gui.iscrollbar.UIBasicScrollBarUI; +import com.fr.design.gui.iscrollbar.UIScrollBarUI; import com.fr.design.gui.ispinner.UISpinnerUI; import com.fr.design.gui.isplitpanedivider.UISplitPaneUI; import com.fr.design.gui.itable.UIBasicTableUI; import com.fr.design.gui.itoolbar.UIToolBarBorder; import com.fr.design.gui.itoolbar.UIToolBarSeparatorUI; +import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itooltip.UIToolTipBorder; import com.fr.design.gui.itree.UITreeUI; import com.fr.design.i18n.Toolkit; @@ -89,16 +92,20 @@ public class UILookAndFeel extends MetalLookAndFeel { "RadioButtonUI", UIRadioButtonUI.class.getName(), "CheckBoxUI", UICheckBoxUI.class.getName(), "ToolBarSeparatorUI", UIToolBarSeparatorUI.class.getName(), - "ScrollBarUI", UIBasicScrollBarUI.class.getName(), - "ComboBoxUI", UIBasicComboBoxUI.class.getName(), - "ButtonUI", UIBasicButtonUI.class.getName(), - "ToggleButtonUI", UIBasicButtonUI.class.getName(), + "ScrollBarUI", UIScrollBarUI.class.getName(), + "ComboBoxUI", UIComboBoxUI.class.getName(), + "ButtonUI", UIButtonUI.class.getName(), + "ToggleButtonUI", UIButtonUI.class.getName(), "TableUI", UIBasicTableUI.class.getName(), "ProgressBarUI", UIProgressBarUI.class.getName(), "MenuUI", UIBasicMenuUI.class.getName(), - "MenuItemUI", UIBasicMenuItemUI.class.getName(), + "MenuItemUI", UIMenuItemUI.class.getName(), "RadioButtonMenuItemUI", UIRadioButtonMenuItemUI.class.getName(), "OptionPaneUI", UIBasicOptionPaneUI.class.getName(), + "ToolBarUI", UIToolBarUI.class.getName(), + "MenuBarUI", UIMenuBarUI.class.getName(), +// "PopupMenuUI", PopupMenuUI.class.getName(), + "TabbedPaneUI", UITabbedPaneUI.class.getName(), }); } 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 12f904922d..c4fb03cfbe 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 @@ -111,14 +111,14 @@ public abstract class UIControlPane extends JControlPane { @Override protected void initToolBar() { super.initToolBar(); - toolBar.setUI(new UIToolBarUI() { - @Override - public void paint(Graphics g, JComponent c) { - Graphics2D g2 = (Graphics2D) g; - g2.setColor(Color.WHITE); - g2.fillRect(0, 0, c.getWidth(), c.getHeight()); - } - }); +// toolBar.setUI(new UIToolBarUI() { +// @Override +// public void paint(Graphics g, JComponent c) { +// Graphics2D g2 = (Graphics2D) g; +// g2.setColor(Color.WHITE); +// g2.fillRect(0, 0, c.getWidth(), c.getHeight()); +// } +// }); } protected JPanel getLeftPane() { diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPane.java index a7776e26be..24e1c79698 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPane.java @@ -11,7 +11,6 @@ import com.fr.design.utils.gui.LayoutUtils; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.SwingConstants; -import javax.swing.SwingWorker; import java.awt.BorderLayout; import java.awt.CardLayout; @@ -25,37 +24,25 @@ public abstract class LoadingBasicPane extends BasicPane { private CardLayout card; private JPanel container; private JProgressBar progressBar; + public LoadingBasicPane() { initCards(); initPane(); } - protected void initPane(){ - new SwingWorker() { - - @Override - protected Integer doInBackground() throws Exception { - initComponents(container); - return 0; - } - - @Override - protected void done() { - complete(); - LayoutUtils.layoutRootContainer(LoadingBasicPane.this); - card.show(LoadingBasicPane.this, "CONTAINER"); - } - - }.execute(); + protected void initPane() { + initComponents(container); + complete(); + LayoutUtils.layoutRootContainer(LoadingBasicPane.this); + card.show(LoadingBasicPane.this, "CONTAINER"); } - private void initCards() { card = new CardLayout(); setLayout(card); JPanel loadingDisPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - UILabel loadingPane = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_And_Waiting") , SwingConstants.CENTER); + UILabel loadingPane = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_And_Waiting"), SwingConstants.CENTER); loadingDisPane.add(loadingPane, BorderLayout.CENTER); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); @@ -69,7 +56,7 @@ public abstract class LoadingBasicPane extends BasicPane { } - protected void renameConnection(String oldName,String newName){ + protected void renameConnection(String oldName, String newName) { } @@ -79,6 +66,7 @@ public abstract class LoadingBasicPane extends BasicPane { /** * 为了alphafine搜索使用,预加载面板控件,获取全部控件的信息 + * * @return */ public JPanel getAllComponents() { diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java index 27cff9c5e3..1211c76372 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java @@ -3,10 +3,11 @@ package com.fr.design.gui.frpane; import com.fr.design.dialog.FineJOptionPane; import com.fr.general.ComparatorUtils; - -import javax.swing.*; -import javax.swing.plaf.TabbedPaneUI; -import java.awt.*; +import javax.swing.JOptionPane; +import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; +import java.awt.Color; +import java.awt.Component; /** * Created by IntelliJ IDEA. @@ -105,21 +106,21 @@ public class UITabbedPane extends JTabbedPane{ repaint(); } - @Override - /** - * 获取UI对象 - */ - public TabbedPaneUI getUI(){ - return new UITabbedPaneUI(); - } - - @Override - /** - * 更新UI - */ - public void updateUI() { - setUI(getUI()); - } +// @Override +// /** +// * 获取UI对象 +// */ +// public TabbedPaneUI getUI(){ +// return new UITabbedPaneUI(); +// } +// +// @Override +// /** +// * 更新UI +// */ +// public void updateUI() { +// setUI(getUI()); +// } /** * 删除tab,不能直接复写removeTabAt diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java index d31107c2ce..edbcd25c88 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java @@ -313,7 +313,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI { h -= (y - insets.top); } drawUIContentBorder(g, x, y, w, h); - if (((UITabbedPane) tabPane).isClosable()) { + if (tabPane instanceof UITabbedPane && ((UITabbedPane) tabPane).isClosable()) { drawUITabAddBtn(g, tabPlacement, x, y, w, h); } super.paint(g, c); diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java index e5f2c03ff8..f42266dc1f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java @@ -1,8 +1,9 @@ package com.fr.design.gui.ibutton; +import com.fanruan.gui.UiInspector; +import com.fine.theme.light.ui.laf.FineLightLaf; import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; -import com.fr.base.GraphHelper; import com.fr.base.svg.IconUtils; import com.fr.design.constants.UIConstants; import com.fr.design.event.UIObserver; @@ -18,7 +19,8 @@ import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.ToolTipManager; -import javax.swing.plaf.ButtonUI; +import javax.swing.UIManager; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; @@ -174,29 +176,17 @@ public class UIButton extends JButton implements UIObserver, UITextComponent { ToolTipManager.sharedInstance().setInitialDelay(TOOLTIP_INIT_DELAY); } - @Override - public ButtonUI getUI() { - return new UIButtonUI(); - } - - /** - * 更新界面 - */ - public void updateUI() { - setUI(getUI()); - } - public CellBorderStyle getBorderStyle() { return this.border; } - @Override - public Insets getInsets() { - if (getIcon() != null) { - return new Insets(0, 3, 0, 3); - } - return new Insets(0, 10, 0, 10); - } +// @Override +// public Insets getInsets() { +// if (getIcon() != null) { +// return new Insets(0, 3, 0, 3); +// } +// return new Insets(0, 10, 0, 10); +// } //@Override public Dimension getPreferredSize() { @@ -217,7 +207,6 @@ public class UIButton extends JButton implements UIObserver, UITextComponent { borderColor = c; } - @Override protected void paintBorder(Graphics g) { @@ -243,25 +232,6 @@ public class UIButton extends JButton implements UIObserver, UITextComponent { @Override public void paintComponent(Graphics g) { super.paintComponent(g); - Dimension size = this.getSize(); - Graphics2D g2d = (Graphics2D) g; - Stroke oldStroke = g2d.getStroke(); - if (border != null) { - g2d.setColor(border.getTopColor()); - GraphHelper.drawLine(g2d, 3, 4, size.getWidth() - 4, 4, border.getTopStyle()); - g2d.setColor(border.getLeftColor()); - GraphHelper.drawLine(g2d, 3, 4, 3, size.getHeight() - 4, border.getLeftStyle()); - g2d.setColor(border.getBottomColor()); - GraphHelper.drawLine(g2d, 3, size.getHeight() - 4, size.getWidth() - 4, size.getHeight() - 4, border.getBottomStyle()); - g2d.setColor(border.getRightColor()); - GraphHelper.drawLine(g2d, size.getWidth() - 4, 4, size.getWidth() - 4, size.getHeight() - 4, border.getRightStyle()); - } else { - GraphHelper.drawLine(g2d, 2, 4, size.getWidth() - 4, 4, Constants.LINE_NONE); - GraphHelper.drawLine(g2d, 2, 4, 2, size.getHeight() - 4, Constants.LINE_NONE); - GraphHelper.drawLine(g2d, 2, size.getHeight() - 4, size.getWidth() - 4, size.getHeight() - 4, Constants.LINE_NONE); - GraphHelper.drawLine(g2d, size.getWidth() - 4, 4, size.getWidth() - 4, size.getHeight() - 4, Constants.LINE_NONE); - } - g2d.setStroke(oldStroke); } @@ -371,20 +341,32 @@ public class UIButton extends JButton implements UIObserver, UITextComponent { * @param args 入口参数 */ public static void main(String... args) { + try { + UIManager.setLookAndFeel( new FineLightLaf() ); + } catch( Exception ex ) { + System.err.println( "Failed to initialize LaF" ); + } JFrame jf = new JFrame("test"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel content = (JPanel) jf.getContentPane(); - content.setLayout(null); +// content.setLayout(new BorderLayout()); UIButton bb = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); - bb.setEnabled(false); - bb.setBorderType(OTHER_BORDER); + bb.setEnabled(true); // bb.setBounds(20, 20,content.getSize().width, bb.getPreferredSize().height); - bb.setPreferredSize(new Dimension(100, 30)); +// bb.setPreferredSize(new Dimension(100, 30)); bb.setBounds(0, 0, bb.getPreferredSize().width, bb.getPreferredSize().height); - content.add(bb); + bb.setMargin(new Insets(10,10,10,10)); + UIButton cc = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); + cc.setEnabled(true); +// cc.setPreferredSize(new Dimension(100, 30)); + cc.setBounds(0, 0, cc.getPreferredSize().width, cc.getPreferredSize().height); + cc.setMargin(new Insets(20,20,20,20)); + content.add(bb, BorderLayout.SOUTH); + content.add(cc,BorderLayout.NORTH); GUICoreUtils.centerWindow(jf); jf.setSize(400, 400); + new UiInspector(); jf.setVisible(true); } diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java index bd2e8b2afb..822aee00da 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java @@ -8,15 +8,21 @@ import com.fr.design.event.UIObserverListener; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import sun.swing.SwingUtilities2; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JPanel; import javax.swing.border.Border; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import javax.swing.plaf.basic.BasicHTML; -import javax.swing.text.View; -import java.awt.*; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.LayoutManager; +import java.awt.RenderingHints; +import java.awt.Shape; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -195,24 +201,24 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver, UIOb } }; - labelButton.setUI(new UIButtonUI() { - protected void paintText(Graphics g, AbstractButton b, String text, Rectangle textRec) { - View v = (View) b.getClientProperty(BasicHTML.propertyKey); - if (v != null) { - v.paint(g, textRec); - return; - } - FontMetrics fm = SwingUtilities2.getFontMetrics(b, g); - int mnemonicIndex = b.getDisplayedMnemonicIndex(); - if (isPressed(b)) { - g.setColor(Color.white); - } else { - g.setColor(b.isEnabled() ? Color.black : UIConstants.LINE_COLOR); - } - - SwingUtilities2.drawStringUnderlineCharAt(b, g, text, mnemonicIndex, textRec.x + getTextShiftOffset(), textRec.y + fm.getAscent() + getTextShiftOffset()); - } - }); +// labelButton.setUI(new UIButtonUI() { +// protected void paintText(Graphics g, AbstractButton b, String text, Rectangle textRec) { +// View v = (View) b.getClientProperty(BasicHTML.propertyKey); +// if (v != null) { +// v.paint(g, textRec); +// return; +// } +// FontMetrics fm = SwingUtilities2.getFontMetrics(b, g); +// int mnemonicIndex = b.getDisplayedMnemonicIndex(); +// if (isPressed(b)) { +// g.setColor(Color.white); +// } else { +// g.setColor(b.isEnabled() ? Color.black : UIConstants.LINE_COLOR); +// } +// +// SwingUtilities2.drawStringUnderlineCharAt(b, g, text, mnemonicIndex, textRec.x + getTextShiftOffset(), textRec.y + fm.getAscent() + getTextShiftOffset()); +// } +// }); initButton(labelButton); } } diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonUI.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonUI.java index 851ac8b513..3516acdd6d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonUI.java @@ -1,16 +1,32 @@ package com.fr.design.gui.ibutton; +import com.fr.base.CellBorderStyle; +import com.fr.base.GraphHelper; import com.fr.design.constants.UIConstants; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.utils.gui.GUIPaintUtils; +import com.fr.stable.Constants; import com.fr.stable.StringUtils; import sun.swing.SwingUtilities2; -import javax.swing.*; +import javax.swing.AbstractButton; +import javax.swing.ButtonModel; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.SwingUtilities; import javax.swing.plaf.basic.BasicButtonUI; import javax.swing.plaf.basic.BasicHTML; import javax.swing.text.View; -import java.awt.*; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.Stroke; + public class UIButtonUI extends BasicButtonUI { @@ -36,6 +52,26 @@ public class UIButtonUI extends BasicButtonUI { ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); paintContent(g, b, text); + + Dimension size = b.getSize(); + Stroke oldStroke = g2d.getStroke(); + CellBorderStyle border = b.getBorderStyle(); + if (border != null) { + g2d.setColor(border.getTopColor()); + GraphHelper.drawLine(g2d, 3, 4, size.getWidth() - 4, 4, border.getTopStyle()); + g2d.setColor(border.getLeftColor()); + GraphHelper.drawLine(g2d, 3, 4, 3, size.getHeight() - 4, border.getLeftStyle()); + g2d.setColor(border.getBottomColor()); + GraphHelper.drawLine(g2d, 3, size.getHeight() - 4, size.getWidth() - 4, size.getHeight() - 4, border.getBottomStyle()); + g2d.setColor(border.getRightColor()); + GraphHelper.drawLine(g2d, size.getWidth() - 4, 4, size.getWidth() - 4, size.getHeight() - 4, border.getRightStyle()); + } else { + GraphHelper.drawLine(g2d, 2, 4, size.getWidth() - 4, 4, Constants.LINE_NONE); + GraphHelper.drawLine(g2d, 2, 4, 2, size.getHeight() - 4, Constants.LINE_NONE); + GraphHelper.drawLine(g2d, 2, size.getHeight() - 4, size.getWidth() - 4, size.getHeight() - 4, Constants.LINE_NONE); + GraphHelper.drawLine(g2d, size.getWidth() - 4, 4, size.getWidth() - 4, size.getHeight() - 4, Constants.LINE_NONE); + } + g2d.setStroke(oldStroke); } protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { @@ -46,6 +82,16 @@ public class UIButtonUI extends BasicButtonUI { } else if (b.isNormalPainted()) { GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); } + + if (isPressed(b) && b.isPressedPainted()) { + Color pressColor = b.isPressedPainted() ? UIConstants.TAB_BUTTON_PRESS_SELECTED : UIConstants.TAB_BUTTON_PRESS; + GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), pressColor); + } else if (isRollOver(b)) { + Color hoverColor = b.isPressedPainted() ? UIConstants.TAB_BUTTON_HOVER_SELECTED : UIConstants.TAB_BUTTON_HOVER; + GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), hoverColor); + } else if (b.isNormalPainted()) { + GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); + } } protected boolean isRollOver(AbstractButton b) { diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHead.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHead.java index 0a41aae172..e1f91b15a7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHead.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHead.java @@ -8,36 +8,32 @@ public class UIHead { private String text = StringUtils.EMPTY; private Icon icon = null; private boolean enable = true; - private int index = 0; - public UIHead(String text, int index) { + public UIHead(String text) { this.text = text; - this.index = index; } - public UIHead(String text, int index, boolean enable) { - this(text, index); + public UIHead(String text, boolean enable) { + this(text); this.enable = enable; } - public UIHead(Icon icon, int index) { + public UIHead(Icon icon) { this.icon = icon; - this.index = index; } public UIHead(Icon icon, int index, boolean enable) { - this(icon, index); + this(icon); this.enable = enable; } - public UIHead(String text, Icon icon, int index) { + public UIHead(String text, Icon icon) { this.text = text; this.icon = icon; - this.index = index; } - public UIHead(String text, Icon icon, int index, boolean enable) { - this(text, icon, index); + public UIHead(String text, Icon icon, boolean enable) { + this(text, icon); this.enable = enable; } @@ -57,7 +53,4 @@ public class UIHead { return enable; } - public int getIndex() { - return index; - } } diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java index 0cfe7c3903..8d92c8e5f2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java @@ -1,155 +1,201 @@ package com.fr.design.gui.ibutton; -import com.fr.base.BaseUtils; -import com.fr.design.constants.UIConstants; -import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.design.utils.gui.UIComponentUtils; - +import com.fine.swing.ui.layout.Layouts; +import com.fine.swing.ui.layout.Row; +import com.fine.theme.light.utils.FineUIUtils; +import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fr.third.guava.collect.Streams; + +import javax.swing.AbstractButton; +import javax.swing.ButtonGroup; import javax.swing.Icon; -import javax.swing.JFrame; -import javax.swing.JPanel; +import javax.swing.JComponent; +import javax.swing.JToggleButton; +import javax.swing.event.ChangeListener; +import javax.swing.plaf.ComponentUI; import java.awt.Color; import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; +import java.awt.Graphics; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; -// fanglei:不是原作者,只是优化如下问题:代码冗余,无法拓展(例如我想加个enable属性没法加),甚至还有数组越界的问题。 -public class UIHeadGroup extends JPanel { - private static final int MIN_HEIGHT = 25; - private List uiHeads = new ArrayList<>(); - protected List labelButtonList; - private boolean isNeedLeftRightOutLine = true; - protected int selectedIndex = -1; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE; +import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE_TAB; + +/** + * 面板头部 tab 按钮组 + * + * @author vito + * @since 11.0 + * Created on 2023/10/31 + */ +public class UIHeadGroup extends Row { - protected void tabChanged(int newSelectedIndex) { - // do nothing - } + + private UIHeadGroupSingleSelectionModel model; + + private List btns; + + private final ButtonGroup buttonGroup = new ButtonGroup(); public UIHeadGroup(String[] textArray) { - for (int i = 0; i < textArray.length; i++) { - uiHeads.add(new UIHead(textArray[i], i)); - } - initUIHeadGroup(uiHeads); + setModel(new UIHeadGroupSingleSelectionModel( + Arrays.stream(textArray).map(UIHead::new).collect(Collectors.toList()))); + intiContent(); } public UIHeadGroup(Icon[] iconArray) { - for (int i = 0; i < iconArray.length; i++) { - uiHeads.add(new UIHead(iconArray[i], i)); - } - initUIHeadGroup(uiHeads); + setModel(new UIHeadGroupSingleSelectionModel( + Arrays.stream(iconArray).map(UIHead::new).collect(Collectors.toList()))); + intiContent(); } - public UIHeadGroup(Icon[] iconArray, String[] textArray) { - int length = Math.min(textArray.length, iconArray.length); - for (int i = 0; i < length; i++) { - uiHeads.add(new UIHead(textArray[i], iconArray[i], i)); - } - initUIHeadGroup(uiHeads); + public UIHeadGroup(List heads) { + setModel(new UIHeadGroupSingleSelectionModel(heads)); + intiContent(); } - public UIHeadGroup(List uiHeads) { - initUIHeadGroup(uiHeads); + private void intiContent() { + setSpacing(4); + setOpaque(false); + add(buttonGroup()); + setUI(new UIHeadGroupUI()); + setSelectedIndex(0); + setBorder(new ScaledEmptyBorder(2, 2, 2, 2)); } - public void initUIHeadGroup(List uiHeads) { - if (uiHeads != null) { - labelButtonList = new ArrayList(uiHeads.size()); - this.setLayout(new GridLayout(0, uiHeads.size(), 1, 0)); - - for (UIHead head : uiHeads) { - if (head.isOnlyText()) { - this.setBackground(UIConstants.TREE_BACKGROUND); - } else { - this.setBackground(UIConstants.NORMAL_BACKGROUND); - } - initButton(createUIToggleButton(head)); - } - setSelectedIndex(0); - } + private Layouts.Cell[] buttonGroup() { + btns = new ArrayList<>(getModel().getDataList().size()); + return Streams.mapWithIndex(getModel().getDataList().stream(), + (h, index) -> cell(new JToggleButton(h.getText(), h.getIcon())) + .weight(1.0) + .with(b -> { + btns.add(b); + buttonGroup.add(b); + b.setEnabled(h.isEnable()); + b.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TAB); + b.addActionListener(e -> setSelectedIndex((int) index)); + }) + + ).toArray(Layouts.Cell[]::new); } - @Override - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - if (dim.height < MIN_HEIGHT) { - dim.height = MIN_HEIGHT; + /** + * tabChanged 时调用 + * + * @param newSelectedIndex + * @see #addChangeListener(ChangeListener) + * @deprecated 这种方式会导致使用的时候都要创建一个匿名类, 使用监听代替{@link #addChangeListener(ChangeListener)} + */ + @Deprecated + protected void tabChanged(int newSelectedIndex) { + // do nothing + } + + private static class UIHeadGroupUI extends ComponentUI { + + @Styleable(dot = true) + protected Color background; + + @Styleable(dot = true) + protected int arc; + + @SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"}) + public static ComponentUI createUI(JComponent c) { + return new UIHeadGroupUI(); + } + + @Override + public void installUI(JComponent c) { + super.installUI(c); + background = FineUIUtils.getUIColor("HeadGroup.background", "desktop"); + arc = FineUIUtils.getUIInt("HeadGroup.arc", "Component.arc"); + } + + @Override + public void uninstallUI(JComponent c) { + super.uninstallUI(c); + } + + @Override + public Dimension getMinimumSize(JComponent component) { + return new Dimension(0, 0); + } + + @Override + public Dimension getMaximumSize(JComponent component) { + return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); + } + + @Override + public void update(Graphics g, JComponent c) { + paintBackground(g, c); + paint(g, c); + } + + protected void paintBackground(Graphics g, JComponent c) { + FlatUIUtils.setRenderingHints(g); + g.setColor(background); + g.fillRoundRect(0, 0, c.getWidth(), c.getHeight(), arc, arc); } - return dim; } - private void initButton(UIToggleButton labelButton) { - labelButton.setRoundBorder(false); - labelButton.setBorderPainted(false); - labelButton.setPressedPainted(false); - UIComponentUtils.setLineWrap(labelButton); - labelButtonList.add(labelButton); - this.add(labelButton); + private UIHeadGroupSingleSelectionModel getModel() { + return model; } - public void setSelectedIndex(int newSelectedIndex) { - selectedIndex = newSelectedIndex; - for (int i = 0; i < labelButtonList.size(); i++) { - UIToggleButton button = labelButtonList.get(i); - if (i == selectedIndex) { - button.setNormalPainted(false); - button.setBackground(new Color(240, 240, 243)); - button.setOpaque(true); - button.setSelected(true); - } else { - button.setOpaque(false); - button.setNormalPainted(true); - button.setSelected(false); - } - } + public void setModel(UIHeadGroupSingleSelectionModel model) { + this.model = model; + } - tabChanged(newSelectedIndex); + /** + * 添加一个监听,在tab切换时触发 + * + * @param l 监听 + */ + public void addChangeListener(ChangeListener l) { + getModel().addChangeListener(l); } - public void setNeedLeftRightOutLine(boolean isNeedLeftRightOutLine) { - this.isNeedLeftRightOutLine = isNeedLeftRightOutLine; + /** + * 移除一个监听 + * + * @param l 监听 + */ + public void removeChangeListener(ChangeListener l) { + getModel().removeChangeListener(l); } - public int getSelectedIndex() { - return selectedIndex; + /** + * 设置索引用于选中某个tab + * + * @param index 面板索引 + */ + public void setSelectedIndex(int index) { + if (!checkRange(index)) { + return; + } + buttonGroup.setSelected(btns.get(index).getModel(), true); + getModel().setSelectedIndex(index); + tabChanged(index); } - public UIToggleButton createUIToggleButton(final UIHead head) { - UIToggleButton uiToggleButton = new UIToggleButton(head.getText(), head.getIcon()) { - @Override - protected MouseListener getMouseListener() { - return new MouseAdapter() { - @Override - public void mousePressed(MouseEvent e) { - if (head.isEnable()) { - setSelectedIndex(head.getIndex()); - UIHeadGroup.this.repaint(); - } - } - }; - } - }; - - uiToggleButton.setEnabled(head.isEnable()); - return uiToggleButton; + /** + * 获取选中tab的索引 + * + * @return 选中tab的索引 + */ + public int getSelectedIndex() { + return getModel().getSelectedIndex(); } - public static void main(String... args) { - JFrame jf = new JFrame("test"); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - JPanel content = (JPanel) jf.getContentPane(); - content.setLayout(null); - Icon[] a1 = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; - UIHeadGroup bb = new UIHeadGroup(a1); - bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height); - bb.setSelectedIndex(0); - content.add(bb); - GUICoreUtils.centerWindow(jf); - jf.setSize(400, 400); - jf.setVisible(true); + private boolean checkRange(int newSelectedIndex) { + return newSelectedIndex > -1 && newSelectedIndex < btns.size(); } -} \ No newline at end of file + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroupSingleSelectionModel.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroupSingleSelectionModel.java new file mode 100644 index 0000000000..aacb6ec1fa --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroupSingleSelectionModel.java @@ -0,0 +1,31 @@ +package com.fr.design.gui.ibutton; + +import javax.swing.DefaultSingleSelectionModel; +import java.util.List; + +/** + * 头部按钮组单选模型 + * + * @author vito + * @since 11.0 + * Created on 2023/11/2 + */ +public class UIHeadGroupSingleSelectionModel extends DefaultSingleSelectionModel { + + private final List dataList; + + UIHeadGroupSingleSelectionModel(List dataList) { + this.dataList = dataList; + } + + public UIHeadGroupSingleSelectionModel set(int index, UIHead head) { + dataList.add(index, head); + return this; + } + + + public List getDataList() { + return dataList; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java index e6130ca3da..e7f6578dc9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java @@ -67,7 +67,7 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser private void init() { setOpaque(false); - setUI(getUIComboBoxUI()); +// setUI(getUIComboBoxUI()); setRenderer(new UIComboBoxRenderer()); setEditor(new UIComboBoxEditor()); initListener(); @@ -161,13 +161,13 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser } - /** - * - */ - @Override - public void updateUI() { - setUI(getUIComboBoxUI()); - } +// /** +// * +// */ +// @Override +// public void updateUI() { +// setUI(getUIComboBoxUI()); +// } /** 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 cec4b840a7..6c35310fa4 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 @@ -12,7 +12,6 @@ import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Cursor; @@ -36,7 +35,7 @@ public class UIEastResizableContainer extends JPanel { private int containerWidth = 240; private int preferredWidth = 240; private int topToolPaneHeight = 25; - private int leftPaneWidth = 40; + private int leftPaneWidth = 42; private JComponent leftPane; private JComponent rightPane; @@ -78,12 +77,12 @@ public class UIEastResizableContainer extends JPanel { } public UIEastResizableContainer(JComponent leftPane, JComponent rightPane) { - setBackground(UIConstants.PROPERTY_PANE_BACKGROUND); +// setBackground(UIConstants.PROPERTY_PANE_BACKGROUND); this.leftPane = leftPane; this.rightPane = rightPane; this.topToolPane = new TopToolPane(); - topToolPane.setBackground(UIConstants.PROPERTY_PANE_BACKGROUND); +// topToolPane.setBackground(UIConstants.PROPERTY_PANE_BACKGROUND); setLayout(containerLayout); add(topToolPane); @@ -98,9 +97,9 @@ public class UIEastResizableContainer extends JPanel { content.setLayout(new BorderLayout()); JPanel leftPane = new JPanel(); - leftPane.setBackground(Color.yellow); +// leftPane.setBackground(Color.yellow); JPanel rightPane = new JPanel(); - rightPane.setBackground(Color.green); +// rightPane.setBackground(Color.green); UIButton b1, b2; b1 = new UIButton("b1"); @@ -114,7 +113,7 @@ public class UIEastResizableContainer extends JPanel { UIEastResizableContainer bb = new UIEastResizableContainer(leftPane, rightPane); JPanel cc = new JPanel(); - cc.setBackground(Color.WHITE); +// cc.setBackground(Color.WHITE); content.add(bb, BorderLayout.EAST); content.add(cc, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java index 627baf6b92..e09f877d3c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java @@ -67,6 +67,7 @@ public class UIModeControlContainer extends JLayeredPane { add(upPane); add(horizontToolPane); } +// setLayout(new VerticalFlowLayout(CENTER, 10, 10)); add(downPane); add(coverPane = new CoverPane()); add(hidePane = new HidePane()); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java index a7682107ec..535ba582ab 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -10,6 +10,7 @@ import com.fr.stable.Constants; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; +import javax.swing.UIManager; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -89,7 +90,6 @@ public class UIResizableContainer extends JPanel { } public UIResizableContainer(JComponent upPane, JComponent downPane, int direction) { - setBackground(UIConstants.NORMAL_BACKGROUND); this.upPane = upPane; this.direction = direction; @@ -106,7 +106,6 @@ public class UIResizableContainer extends JPanel { } public UIResizableContainer(JComponent upPane, int direction) { - setBackground(UIConstants.NORMAL_BACKGROUND); this.upPane = upPane; this.direction = direction; @@ -420,7 +419,8 @@ public class UIResizableContainer extends JPanel { Image upButton = (upModel == UIConstants.MODEL_NORMAL ? UIConstants.DRAG_UP_NORMAL : UIConstants.DRAG_UP_PRESS); Image downButton = (downModel == UIConstants.MODEL_NORMAL ? UIConstants.DRAG_DOWN_NORMAL : UIConstants.DRAG_DOWN_PRESS); - g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, getWidth(), getHeight(), null); + g.setColor(UIManager.getColor("SplitPane.background")); + g.fillRect(0, 0, getWidth(), getHeight()); SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, UIConstants.DRAG_LINE, (getWidth() - toolPaneHeight) / 2, 3, null)); SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, upButton, ARROW_MARGIN, 0, null)); SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, downButton, (getWidth() - toolPaneHeight - ARROW_MARGIN), 0, null)); @@ -505,8 +505,10 @@ public class UIResizableContainer extends JPanel { @Override public void paint(Graphics g) { Image button; + g.setColor(UIManager.getColor("SplitPane.background")); + g.fillRect(0, 0, toolPaneHeight, getHeight()); if (direction == Constants.RIGHT) { - g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, toolPaneHeight, getHeight(), null); +// g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, toolPaneHeight, getHeight(), null); if (containerWidth == toolPaneHeight) { if (model == UIConstants.MODEL_NORMAL) { button = UIConstants.DRAG_RIGHT_NORMAL; @@ -522,7 +524,7 @@ public class UIResizableContainer extends JPanel { } SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, -6, ARROW_MARGIN_VERTICAL, VerticalToolPane.this)); } else { - g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, toolPaneHeight, getHeight(), null); +// g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, toolPaneHeight, getHeight(), null); if (containerWidth == toolPaneHeight) { if (model == UIConstants.MODEL_NORMAL) { button = UIConstants.DRAG_LEFT_NORMAL; diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIScrollPane.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIScrollPane.java index 55ba64b0e9..7bb13af2d6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIScrollPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIScrollPane.java @@ -1,12 +1,10 @@ package com.fr.design.gui.icontainer; -import com.fr.design.constants.UIConstants; import com.fr.design.gui.iscrollbar.UIScrollBar; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; -import java.awt.Color; import java.awt.Component; /** @@ -27,10 +25,10 @@ public class UIScrollPane extends JScrollPane { this.setHorizontalScrollBar(createHorizontalScrollBar()); this.getVerticalScrollBar().setUnitIncrement(INCREAMENT); this.getVerticalScrollBar().setBlockIncrement(INCREAMENT); - this.getHorizontalScrollBar().setOpaque(true); - this.getHorizontalScrollBar().setBackground(Color.WHITE); - this.getVerticalScrollBar().setOpaque(true); - this.getVerticalScrollBar().setBackground(Color.WHITE); +// this.getHorizontalScrollBar().setOpaque(true); +// this.getHorizontalScrollBar().setBackground(Color.WHITE); +// this.getVerticalScrollBar().setOpaque(true); +// this.getVerticalScrollBar().setBackground(Color.WHITE); } @Override @@ -39,7 +37,7 @@ public class UIScrollPane extends JScrollPane { */ public UIScrollBar createHorizontalScrollBar() { UIScrollBar sbr = new UIScrollBar(JScrollBar.HORIZONTAL); - sbr.setBackground(UIConstants.NORMAL_BACKGROUND); +// sbr.setBackground(UIConstants.NORMAL_BACKGROUND); return sbr; } @@ -49,7 +47,7 @@ public class UIScrollPane extends JScrollPane { */ public UIScrollBar createVerticalScrollBar() { UIScrollBar sbr = new UIScrollBar(JScrollBar.VERTICAL); - sbr.setBackground(UIConstants.NORMAL_BACKGROUND); +// sbr.setBackground(UIConstants.NORMAL_BACKGROUND); return sbr; } diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java index ba29288fc8..8862493242 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java @@ -53,7 +53,7 @@ public class TableViewList extends UIList { public TableViewList() { super(); - this.setBackground(UIConstants.NORMAL_BACKGROUND); +// this.setBackground(UIConstants.NORMAL_BACKGROUND); this.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); this.setCellRenderer(new TableListCellRenderer()); new TableProcessorTreeDragSource(this, DnDConstants.ACTION_COPY); diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIHeadMenu.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIHeadMenu.java index e196f90a5f..60058264af 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIHeadMenu.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIHeadMenu.java @@ -1,20 +1,12 @@ package com.fr.design.gui.imenu; -import com.fr.design.constants.UIConstants; -import com.fr.design.utils.gui.GUIPaintUtils; - import javax.swing.Action; import javax.swing.JButton; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.MenuElement; -import javax.swing.border.Border; +import javax.swing.border.EmptyBorder; import java.awt.Component; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Insets; -import java.awt.RenderingHints; -import java.awt.Shape; /** * @author null @@ -25,54 +17,43 @@ public class UIHeadMenu extends UIMenu { public UIHeadMenu(String name) { super(name); + setBorder(new EmptyBorder(5,14,5,14)); } @Override public JPopupMenu getPopupMenu() { ensurePopupMenuCreated(); - popupMenu.setBackground(UIConstants.NORMAL_BACKGROUND); - popupMenu.setBorder(new Border() { - - @Override - public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { - Graphics2D g2d = (Graphics2D) g; - int rec = (int) REC; - GUIPaintUtils.paintShapeBorder(g2d, x, y, width, height, rec); - if (!(UIHeadMenu.this.getParent() instanceof JPopupMenu)) { - g.setColor(UIConstants.NORMAL_BACKGROUND); - g.drawLine(1, 0, UIHeadMenu.this.getWidth() - 2, 0); - } - } - - @Override - public boolean isBorderOpaque() { - return false; - } - - @Override - public Insets getBorderInsets(Component c) { - return new Insets(5, 2, 10, 10); - } - }); +// popupMenu.setBackground(UIConstants.NORMAL_BACKGROUND); +// popupMenu.setBorder(new Border() { +// +// @Override +// public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { +// Graphics2D g2d = (Graphics2D) g; +// int rec = (int) REC; +// GUIPaintUtils.paintShapeBorder(g2d, x, y, width, height, rec); +// if (!(UIHeadMenu.this.getParent() instanceof JPopupMenu)) { +// g.setColor(UIConstants.NORMAL_BACKGROUND); +// g.drawLine(1, 0, UIHeadMenu.this.getWidth() - 2, 0); +// } +// } +// +// @Override +// public boolean isBorderOpaque() { +// return false; +// } +// +// @Override +// public Insets getBorderInsets(Component c) { +// return new Insets(5, 2, 10, 10); +// } +// }); return popupMenu; } @Override protected void ensurePopupMenuCreated() { if (popupMenu == null) { - this.popupMenu = new JPopupMenu() { - @Override - protected void paintComponent(Graphics g) { - Graphics2D g2d = (Graphics2D) g; - float width = getWidth(); - float height = getHeight(); - - Shape shape = GUIPaintUtils.paintShape(g2d, width, height, REC); - g2d.setClip(shape); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - super.paintComponent(g2d); - } - }; + this.popupMenu = new JPopupMenu(); popupMenu.setInvoker(this); popupListener = createWinListener(popupMenu); } diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java index c0f70795bb..7601b70ad1 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java @@ -18,11 +18,11 @@ public class UILockMenuItemUI extends UIMenuItemUI{ super.paintText(g, menuItem, textRect, text); // 除了绘制text之外,还需要画一下锁定图标 UILockMenuItem lockMenuItem = (UILockMenuItem) menuItem; - if (EditLockUtils.isLocked(lockMenuItem.getLockItem())) { +// if (EditLockUtils.isLocked(lockMenuItem.getLockItem())) { int width = menuItem.getWidth(); int height = menuItem.getHeight(); g.drawImage(EditLockUtils.LOCKED_IMAGE, (int) Math.round(width * 0.9), (int) Math.round(height * 0.1), 16, 16, null); - } +// } } } diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenu.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenu.java index 98f60619b9..ec78046709 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenu.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenu.java @@ -1,106 +1,95 @@ package com.fr.design.gui.imenu; -import com.fr.design.constants.UIConstants; -import com.fr.stable.StringUtils; - import javax.swing.Action; import javax.swing.JButton; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.MenuElement; -import javax.swing.border.Border; import java.awt.Component; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Insets; -import java.awt.RenderingHints; -import java.awt.Shape; -import java.awt.geom.RoundRectangle2D; /** * @author null */ public class UIMenu extends JMenu { - private static final float REC = 8f; private JPopupMenu popupMenu; public UIMenu(String name) { super(name); setName(name); setRolloverEnabled(true); - setBackground(UIConstants.NORMAL_BACKGROUND); +// setBackground(UIConstants.NORMAL_BACKGROUND); } - @Override - public String getText() { - if (this.getParent() instanceof JPopupMenu) { - return StringUtils.BLANK + super.getText(); - } - return " " + super.getText(); - } +// @Override +// public String getText() { +// if (this.getParent() instanceof JPopupMenu) { +// return super.getText(); +// } +// return super.getText(); +// } @Override public JPopupMenu getPopupMenu() { ensurePopupMenuCreated(); popupMenu.setOpaque(false); - popupMenu.setBorder(new Border() { - - @Override - public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { - Graphics2D g2d = (Graphics2D) g; - int rec = (int) REC; - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); - g2d.setColor(UIConstants.UIPOPUPMENU_LINE_COLOR); - g2d.drawRoundRect(x, y, width - 1, height - 1, rec, rec); - if (!(UIMenu.this.getParent() instanceof JPopupMenu)) { - g.setColor(UIConstants.NORMAL_BACKGROUND); - g.drawLine(1, 0, UIMenu.this.getWidth() - 2, 0); - } - } - - @Override - public boolean isBorderOpaque() { - return false; - } - - @Override - public Insets getBorderInsets(Component c) { - return new Insets(5, 2, 10, 10); - } - }); +// popupMenu.setBorder(new Border() { +// +// @Override +// public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { +// Graphics2D g2d = (Graphics2D) g; +// int rec = (int) REC; +// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); +// g2d.setColor(UIConstants.UIPOPUPMENU_LINE_COLOR); +// g2d.drawRoundRect(x, y, width - 1, height - 1, rec, rec); +// if (!(UIMenu.this.getParent() instanceof JPopupMenu)) { +// g.setColor(UIConstants.NORMAL_BACKGROUND); +// g.drawLine(1, 0, UIMenu.this.getWidth() - 2, 0); +// } +// } +// +// @Override +// public boolean isBorderOpaque() { +// return false; +// } +// +// @Override +// public Insets getBorderInsets(Component c) { +// return new Insets(5, 2, 10, 10); +// } +// }); return popupMenu; } protected void ensurePopupMenuCreated() { if (popupMenu == null) { - this.popupMenu = new JPopupMenu() { - @Override - protected void paintComponent(Graphics g) { - Graphics2D g2d = (Graphics2D) g; - int rec = (int) REC; - Shape shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), REC, REC); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setColor(UIConstants.NORMAL_BACKGROUND); - g2d.fillRoundRect(0, 0, getWidth(), getHeight(), rec, rec); - g2d.setClip(shape); - super.paintComponent(g2d); - } - - }; + this.popupMenu = new JPopupMenu(); +// @Override +// protected void paintComponent(Graphics g) { +// Graphics2D g2d = (Graphics2D) g; +// int rec = (int) REC; +// Shape shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), REC, REC); +// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); +// g2d.setColor(UIConstants.NORMAL_BACKGROUND); +// g2d.fillRoundRect(0, 0, getWidth(), getHeight(), rec, rec); +// g2d.setClip(shape); +// super.paintComponent(g2d); +// } +// +// }; popupMenu.setInvoker(this); popupListener = createWinListener(popupMenu); } } - /** - * 画界面 - */ - @Override - public void updateUI() { - setUI(new UIMenuUI()); - } +// /** +// * 画界面 +// */ +// @Override +// public void updateUI() { +// setUI(new UIMenuUI()); +// } /** * 判断popupmeu是否隐藏 diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuBar.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuBar.java index 6f7a68c83c..37248a2490 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuBar.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuBar.java @@ -12,7 +12,7 @@ import javax.swing.border.EmptyBorder; */ public class UIMenuBar extends JMenuBar { - private static final int LEFT_GAP = 5; + private static final int LEFT_GAP = 10; public UIMenuBar() { super(); @@ -23,7 +23,7 @@ public class UIMenuBar extends JMenuBar { /** * 更新UI */ - public void updateUI() { - setUI(new UIMenuBarUI()); - } +// public void updateUI() { +// setUI(new UIMenuBarUI()); +// } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuBarUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuBarUI.java index a93b1d23db..a0f073ce2b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuBarUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuBarUI.java @@ -1,9 +1,6 @@ package com.fr.design.gui.imenu; -import com.fr.design.constants.UIConstants; - import javax.swing.plaf.basic.BasicMenuBarUI; -import java.awt.*; /** * Created by IntelliJ IDEA. @@ -23,10 +20,8 @@ public class UIMenuBarUI extends BasicMenuBarUI { if (!c.isOpaque()) { return; } - Color oldColor = g.getColor(); - g.setColor(UIConstants.UI_MENU_BACKGOURND); - g.fillRect(0, 0, c.getWidth(), c.getHeight()); - g.setColor(oldColor); +// g.setColor(UIManager.getColor("Menu.background")); +// g.fillRect(0, 0, c.getWidth(), c.getHeight()); } diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java index 0df132caf4..78f0ae06fa 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java @@ -26,14 +26,14 @@ public class UIMenuEastAttrItem extends JMenuItem { public UIMenuEastAttrItem(String string, Icon pageSmallIcon) { super(string, pageSmallIcon); - setBackground(UIConstants.NORMAL_BACKGROUND); - setUI(new UIMenuItemEastAttrUI()); +// setBackground(UIConstants.NORMAL_BACKGROUND); +// setUI(new UIMenuItemEastAttrUI()); } public UIMenuEastAttrItem(String string, int key) { super(string, key); - setBackground(UIConstants.NORMAL_BACKGROUND); - setUI(new UIMenuItemEastAttrUI()); +// setBackground(UIConstants.NORMAL_BACKGROUND); +// setUI(new UIMenuItemEastAttrUI()); } public UIMenuEastAttrItem(Action action) { @@ -57,7 +57,7 @@ public class UIMenuEastAttrItem extends JMenuItem { Color oldColor = g.getColor(); int menuWidth = menuItem.getWidth(); int menuHeight = menuItem.getHeight(); - g.setColor(UIConstants.NORMAL_BACKGROUND); +// g.setColor(UIConstants.NORMAL_BACKGROUND); g.fillRect(0, 0, menuWidth, menuHeight); if (menuItem.isOpaque()) { diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuHighLight.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuHighLight.java deleted file mode 100644 index 6fb127e5ca..0000000000 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuHighLight.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.design.gui.imenu; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; - -import javax.swing.JPanel; - -import com.fr.design.constants.UIConstants; - -public class UIMenuHighLight extends JPanel{ - - @Override - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - dim.height = 0; - return dim; - } - public void paint(Graphics g) { - g.setColor(UIConstants.LINE_COLOR); - g.drawLine(0, 0, getWidth(), 0); - g.setColor(Color.WHITE); - g.drawLine(0, 1, getWidth(), 1); - }; -} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java index 3230dbda21..d5bd493bde 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java @@ -1,6 +1,5 @@ package com.fr.design.gui.imenu; -import com.fr.design.constants.UIConstants; import com.fr.stable.StringUtils; import javax.swing.Action; @@ -19,14 +18,14 @@ public class UIMenuItem extends JMenuItem{ public UIMenuItem(String string, Icon pageSmallIcon) { super(string, pageSmallIcon); - setBackground(UIConstants.NORMAL_BACKGROUND); - setUI(new UIMenuItemUI()); +// setBackground(UIConstants.NORMAL_BACKGROUND); +// setUI(new UIMenuItemUI()); } public UIMenuItem(String string, int key) { super(string, key); - setBackground(UIConstants.NORMAL_BACKGROUND); - setUI(new UIMenuItemUI()); +// setBackground(UIConstants.NORMAL_BACKGROUND); +// setUI(new UIMenuItemUI()); } public UIMenuItem(Action action) { diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIPopupMenu.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIPopupMenu.java index 3aeaa186be..e2a2546b25 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIPopupMenu.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIPopupMenu.java @@ -1,12 +1,12 @@ package com.fr.design.gui.imenu; -import java.awt.*; -import java.awt.geom.RoundRectangle2D; - -import javax.swing.*; - import com.fr.design.constants.UIConstants; +import javax.swing.JPopupMenu; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; + public class UIPopupMenu extends JPopupMenu{ private static final float DEFAULT_REC = 8f; private boolean onlyText = false; @@ -15,23 +15,23 @@ public class UIPopupMenu extends JPopupMenu{ public static UIPopupMenu EMPTY = new UIPopupMenu(); public UIPopupMenu() { super(); - setBackground(UIConstants.NORMAL_BACKGROUND); +// setBackground(UIConstants.NORMAL_BACKGROUND); } @Override protected void paintComponent(Graphics g) { - Graphics2D g2d = (Graphics2D) g; - Shape shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), rec, rec); - g2d.setClip(shape); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - super.paintComponent(g2d); +// Graphics2D g2d = (Graphics2D) g; +// Shape shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), rec, rec); +// g2d.setClip(shape); +// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + super.paintComponent(g); } @Override protected void paintBorder(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setColor(UIConstants.UIPOPUPMENU_LINE_COLOR); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); +// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, (int) rec, (int) rec); } diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIScrollMenu.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIScrollMenu.java index 1d176c384c..dff9d24a81 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIScrollMenu.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIScrollMenu.java @@ -68,13 +68,13 @@ public class UIScrollMenu extends UIMenu { //// All of these methods are necessary because ensurePopupMenuCreated() is private in JMenu ////////////////////////////// - /** - * 画界面 - */ - @Override - public void updateUI() { - setUI(new UIMenuUI()); - } +// /** +// * 画界面 +// */ +// @Override +// public void updateUI() { +// setUI(new UIMenuUI()); +// } /** diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIScrollPopUpMenu.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIScrollPopUpMenu.java index c2713fc26a..4bedf626dd 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIScrollPopUpMenu.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIScrollPopUpMenu.java @@ -1,10 +1,14 @@ package com.fr.design.gui.imenu; -import com.fr.design.constants.UIConstants; import com.fr.design.gui.iscrollbar.UIScrollBar; -import java.awt.*; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.LayoutManager; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.event.MouseWheelEvent; @@ -41,13 +45,13 @@ public class UIScrollPopUpMenu extends UIPopupMenu { public void paintChildren(Graphics g) { - Graphics2D g2d = (Graphics2D) g; - int rec = (int) REC; - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setColor(UIConstants.NORMAL_BACKGROUND); - g2d.fillRoundRect(1, 1, getWidth() - 2, getHeight() - 2, rec, rec); - Insets insets = getInsets(); - g.clipRect(insets.left, insets.top, getWidth(), getHeight() - insets.top - insets.bottom); +// Graphics2D g2d = (Graphics2D) g; +// int rec = (int) REC; +// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); +// g2d.setColor(UIConstants.NORMAL_BACKGROUND); +// g2d.fillRoundRect(1, 1, getWidth() - 2, getHeight() - 2, rec, rec); +// Insets insets = getInsets(); +// g.clipRect(insets.left, insets.top, getWidth(), getHeight() - insets.top - insets.bottom); super.paintChildren(g); } diff --git a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBar.java b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBar.java index 5cdd9cacd3..d7ec3db936 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBar.java +++ b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBar.java @@ -22,7 +22,6 @@ public class UIScrollBar extends JScrollBar { public UIScrollBar(int orientation) { super(orientation); - setUI(new UIScrollBarUI()); } @Override @@ -32,6 +31,11 @@ public class UIScrollBar extends JScrollBar { : new Dimension(super.getPreferredSize().width, 10); } + @Override + public void setBackground(Color bg) { + super.setBackground(bg); + } + @Override /** * 取得宽度 diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinnerUI.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinnerUI.java index d6d91e991d..d1abbf39b6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinnerUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinnerUI.java @@ -6,7 +6,6 @@ package com.fr.design.gui.ispinner; import com.fr.design.constants.UIConstants; -import com.fr.design.gui.ibutton.SpecialUIButton; import com.fr.design.gui.ibutton.UIButton; import javax.swing.*; 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 e5dcd7fd14..2ddb20a7d3 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,12 +1,11 @@ package com.fr.design.gui.itable; -import java.awt.*; -import java.awt.event.AWTEventListener; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.awt.event.MouseEvent; -import java.util.ArrayList; -import java.util.List; +import com.fr.design.constants.UIConstants; +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 com.fr.design.utils.gui.GUICoreUtils; import javax.swing.BorderFactory; import javax.swing.JComponent; @@ -17,16 +16,20 @@ import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.plaf.TableUI; -import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; - -import com.fr.design.constants.UIConstants; -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 com.fr.design.utils.gui.GUICoreUtils; +import java.awt.AWTEvent; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; +import java.awt.event.AWTEventListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; public class UITable extends JTable implements UIObserver { @@ -218,7 +221,7 @@ public class UITable extends JTable implements UIObserver { setBackground(UIConstants.NORMAL_BACKGROUND); setDefaultEditor(UITable.class, editor); setDefaultRenderer(UITable.class, new UITableRender()); - setUI(getUI()); +// setUI(getUI()); TableColumn deleteTableColumn = new TableColumn(getTableDataModel().getColumnCount()); deleteTableColumn.setCellEditor(null); @@ -286,21 +289,21 @@ public class UITable extends JTable implements UIObserver { return new UITableUI(); } - @Override +// @Override /** * */ - public TableCellEditor getDefaultEditor(Class columnClass) { - return super.getDefaultEditor(UITable.class); - } +// public TableCellEditor getDefaultEditor(Class columnClass) { +// return super.getDefaultEditor(UITable.class); +// } - @Override +// @Override /** * */ - public TableCellRenderer getDefaultRenderer(Class columnClass) { - return super.getDefaultRenderer(UITable.class); - } +// public TableCellRenderer getDefaultRenderer(Class columnClass) { +// return super.getDefaultRenderer(UITable.class); +// } /** * 给组件登记一个观察者监听事件 diff --git a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java index aca38b28d2..f385874b51 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java @@ -51,7 +51,7 @@ public class UITableEditorPane extends BasicPane { UILabel l = new UILabel(leftLabelName); editTable = tableModel.createTable(); - editTable.getTableHeader().setBackground(UIConstants.DEFAULT_BG_RULER); +// editTable.getTableHeader().setBackground(UIConstants.DEFAULT_BG_RULER); UIScrollPane scrollPane = new UIScrollPane(editTable); scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC)); diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java index 10edf9fe00..5be57fb018 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java @@ -144,10 +144,10 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs return preferredSize; } - @Override - public UITextFieldUI getUI() { - return (UITextFieldUI) ui; - } +// @Override +// public UITextFieldUI getUI() { +// return (UITextFieldUI) ui; +// } /** * 设置变化的背景颜色 @@ -159,9 +159,9 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs /** * 更新UI */ - public void updateUI() { - this.setUI(new UITextFieldUI(this)); - } +// public void updateUI() { +// this.setUI(new UITextFieldUI(this)); +// } @Override protected void paintComponent(final Graphics pG) { @@ -183,7 +183,7 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs if (!isBorderPainted) { return; } - getUI().paintBorder((Graphics2D) g, getWidth(), getHeight(), isRoundBorder, rectDirection); +// getUI().paintBorder((Graphics2D) g, getWidth(), getHeight(), isRoundBorder, rectDirection); } /** diff --git a/designer-base/src/main/java/com/fr/design/gui/itoolbar/UIToolbar.java b/designer-base/src/main/java/com/fr/design/gui/itoolbar/UIToolbar.java index 709fdece73..7b30e45d96 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itoolbar/UIToolbar.java +++ b/designer-base/src/main/java/com/fr/design/gui/itoolbar/UIToolbar.java @@ -1,14 +1,11 @@ package com.fr.design.gui.itoolbar; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.mainframe.JTemplate; - +import javax.swing.JToolBar; import java.awt.Component; import java.awt.FlowLayout; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import javax.swing.JToolBar; public class UIToolbar extends JToolBar { @@ -21,7 +18,7 @@ public class UIToolbar extends JToolBar { setFloatable(false); setRollover(true); setLayout(new FlowLayout(align, 4, 0)); - setUI(uiToolBarUI); +// setUI(uiToolBarUI); setBorderPainted(false); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index d61b58cf1c..de1411c408 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -1,7 +1,6 @@ package com.fr.design.gui.itree.filetree; import com.fr.base.FRContext; -import com.fr.design.constants.UIConstants; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.RefreshableJTree; import com.fr.design.i18n.Toolkit; @@ -13,17 +12,16 @@ import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; -import java.util.HashMap; -import java.util.Map; import javax.swing.BorderFactory; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; -import java.awt.Color; import java.awt.Component; import java.io.File; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; /* * 文件结构树. @@ -87,9 +85,9 @@ public class EnvFileTree extends RefreshableJTree { this.setText(PENDING.toString()); } this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); - this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND); - this.setTextSelectionColor(Color.WHITE); - this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); +// this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND); +// this.setTextSelectionColor(Color.WHITE); +// this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); return this; } }; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java index 338038c36b..113b2e4b45 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java @@ -1,6 +1,5 @@ package com.fr.design.gui.itree.refreshabletree; -import com.fr.design.constants.UIConstants; import com.fr.design.gui.itooltip.UIToolTip; import com.fr.design.gui.itree.checkboxtree.CheckBoxTree; import com.fr.design.i18n.Toolkit; @@ -55,7 +54,7 @@ public abstract class RefreshableJTree extends CheckBoxTree { ExpandMutableTreeNode root = (ExpandMutableTreeNode) model.getRoot(); root.setExpanded(true); this.setRootVisible(false); - this.setBackground(UIConstants.TREE_BACKGROUND); +// this.setBackground(UIConstants.TREE_BACKGROUND); this.addTreeExpansionListener(expansion); this.addTreeWillExpandListener(willExpand); } @@ -106,21 +105,23 @@ public abstract class RefreshableJTree extends CheckBoxTree { @Override protected Long doInBackground() throws Exception { long startTime = System.currentTimeMillis(); + + return System.currentTimeMillis() - startTime; + } + + @Override + protected void done() { ExpandMutableTreeNode[] nodes = RefreshableJTree.this.loadChildTreeNodes(treeNode); for (int i = 0; i < nodes.length; i++) { treeNode.add(nodes[i]); } - DefaultTreeModel treeModel = (DefaultTreeModel) RefreshableJTree.this.getModel(); + // 主要耗时是用在了treeUI的渲染上了,所以把这个放到工作线程里面 if (treeNode.getChildCount() >= 1 && ((ExpandMutableTreeNode) treeNode.getFirstChild()).getUserObject() == PENDING) { treeNode.remove(0); } + DefaultTreeModel treeModel = (DefaultTreeModel) RefreshableJTree.this.getModel(); treeModel.nodeStructureChanged(treeNode); - return System.currentTimeMillis() - startTime; - } - - @Override - protected void done() { RefreshableJTree.this.updateUI(); // 恢复Tree的可用性 RefreshableJTree.this.setEnabled(true); diff --git a/designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java b/designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java index 7d57708642..3bd65fd7ae 100644 --- a/designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java +++ b/designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java @@ -1,6 +1,5 @@ package com.fr.design.i18n; -import com.fr.design.DesignerEnvManager; import com.fr.general.GeneralContext; import com.fr.general.log.MessageFormatter; import com.fr.locale.DesignI18nProvider; @@ -15,10 +14,10 @@ import java.util.Locale; public class DesignI18nImpl implements DesignI18nProvider { - static { - // GeneralContext上下文 存储本次启动的语言环境 直接使用DesignerEnvManager 会在设置语言环境后 不重启 立即生效 存在问题 - GeneralContext.setLocale(DesignerEnvManager.getEnvManager().getLanguage()); - } +// static { +// // GeneralContext上下文 存储本次启动的语言环境 直接使用DesignerEnvManager 会在设置语言环境后 不重启 立即生效 存在问题 +// GeneralContext.setLocale(DesignerEnvManager.getEnvManager().getLanguage()); +// } private static DesignI18nImpl instance = new DesignI18nImpl(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java index 3cceff5a75..41bb38e291 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java @@ -7,7 +7,6 @@ import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.MultiTemplateTabPane; import com.fr.design.file.NewTemplatePane; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; @@ -92,7 +91,6 @@ public class CenterRegionContainerPane extends JPanel { eastPane.add(eastCenterPane, BorderLayout.CENTER); toolbarPane.add(eastPane, BorderLayout.NORTH); - toolbarPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); this.setLayout(new BorderLayout()); this.add(centerTemplateCardPane = new DesktopCardPane(), BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 16c8ef46ca..2db9d50e74 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -16,7 +16,6 @@ import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager; import com.fr.design.data.tabledata.ResponseDataSourceChange; -import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.FileOperations; import com.fr.design.file.FileToolbarStateChangeListener; @@ -26,7 +25,6 @@ import com.fr.design.file.MultiTemplateTabPane; import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.i18n.Toolkit; @@ -174,7 +172,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt parent.add(createUpToolBarPane(), BorderLayout.CENTER); parent.setBorder(BorderFactory.createEmptyBorder(3, 0, 4, 0)); tooBarPane.add(parent, BorderLayout.CENTER); - tooBarPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); searchToolbarPane = new TemplateTreeSearchToolbarPane(toolBar); searchToolbarPane.add(createUpToolBarPane(), BorderLayout.EAST); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 1357b48354..9898d606ff 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe; +import com.formdev.flatlaf.FlatDarkLaf; +import com.formdev.flatlaf.ui.FlatLineBorder; import com.fr.base.FRContext; import com.fr.base.svg.IconUtils; import com.fr.base.vcs.DesignerMode; @@ -9,7 +11,6 @@ import com.fr.design.constants.UIConstants; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; @@ -21,7 +22,6 @@ import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.SvgDrawUtils; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; @@ -41,6 +41,8 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; import javax.swing.border.EmptyBorder; import java.awt.BorderLayout; import java.awt.CardLayout; @@ -49,9 +51,9 @@ import java.awt.Container; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Graphics; -import java.awt.Graphics2D; import java.awt.GraphicsEnvironment; import java.awt.Image; +import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; import java.awt.Toolkit; @@ -76,9 +78,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private FixedPopupPane currentPopupPane; private UIButton currentButton; private static final int CONTAINER_WIDTH = containerWidth(); - private static final int TAB_WIDTH = 38; - private static final int TAB_BUTTON_WIDTH = 32; - private static final int TAB_BUTTON_HEIGHT = 28; + private static final int TAB_WIDTH = 42; + private static final int TAB_BUTTON_WIDTH = 40; + private static final int TAB_BUTTON_HEIGHT = 34; private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH; private static final int POPUP_TOOLPANE_HEIGHT = 27; private static final int ARROW_RANGE_START = CONTENT_WIDTH - 30; @@ -92,6 +94,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public static final String KEY_CONDITION_ATTR = "conditionAttr"; public static final String KEY_HYPERLINK = "hyperlink"; public static final String KEY_WIDGET_LIB = "widgetLib"; + public static final String KEY_AI_CHAT = "AIChat"; public static final String KEY_AUTHORITY_EDITION = "authorityEdition"; public static final String KEY_CONFIGURED_ROLES = "editedRoles"; public static final String DEFAULT_PANE = "defaultPane"; @@ -166,7 +169,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { switchMode(PropertyMode.REPORT); setContainerWidth(CONTAINER_WIDTH); - initPluginPane(); +// initPluginPane(); listenPlugin(); } @@ -332,6 +335,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer { "configuredroles", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION_DISABLED}, new PropertyMode[]{PropertyMode.AUTHORITY_EDITION}); + PropertyItem aiChat = new PropertyItem( + KEY_AI_CHAT, + "设计器助手", + "widgetlib", + new PropertyMode[]{PropertyMode.REPORT}, + new PropertyMode[]{PropertyMode.REPORT}, + null, + null, + e -> { + + }); + propertyItemMap.put(KEY_CELL_ELEMENT, cellElement); propertyItemMap.put(KEY_CELL_ATTR, cellAttr); propertyItemMap.put(KEY_FLOAT_ELEMENT, floatElement); @@ -339,6 +354,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap.put(KEY_CONDITION_ATTR, conditionAttr); propertyItemMap.put(KEY_HYPERLINK, hyperlink); propertyItemMap.put(KEY_WIDGET_LIB, widgetLib); + propertyItemMap.put(KEY_AI_CHAT, aiChat); propertyItemMap.put(KEY_AUTHORITY_EDITION, authorityEdition); propertyItemMap.put(KEY_CONFIGURED_ROLES, configuredRoles); } @@ -383,7 +399,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void initRightPane() { rightPane = new JPanel(); propertyCard = new CardLayout(); - rightPane.setBackground(Color.green); rightPane.setLayout(propertyCard); for (PropertyItem item : propertyItemMap.values()) { if (item.isPoppedOut() || !item.isVisible()) { @@ -401,15 +416,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer { // 左侧按钮面板 private void initLeftPane() { leftPane = new JPanel(); - leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 4, 4)); + leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 1, 4)); for (PropertyItem item : propertyItemMap.values()) { if (item.isPoppedOut() || !item.isVisible()) { continue; } leftPane.add(item.getButton()); } + leftPane.setBorder(new FlatLineBorder(new Insets(0,0,0,0), UIManager.getColor("East.border"))); - leftPane.setBackground(UIConstants.PROPERTY_PANE_BACKGROUND); replaceLeftPane(leftPane); } @@ -557,6 +572,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane); } + public void replaceAIChatPane(JComponent pane) { + propertyItemMap.get(KEY_AI_CHAT).replaceContentPane(pane); + } + + public JComponent getAIChatPane() { + return propertyItemMap.get(KEY_AI_CHAT).getContentPane(); + } + + public void replaceKeyPane(final String key, final JComponent pane) { //需要放到 ui 线程中处理 @@ -580,13 +604,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } public static void main(String[] args) { + try { + UIManager.setLookAndFeel( new FlatDarkLaf() ); + } catch (UnsupportedLookAndFeelException e) { + throw new RuntimeException(e); + } JFrame jf = new JFrame("test"); // jf = new JFrame("test"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel cc = new JPanel(); - cc.setBackground(Color.WHITE); +// cc.setBackground(Color.WHITE); // JPanel leftPane = new JPanel(); // leftPane.setBackground(Color.yellow); // JPanel rightPane = new JPanel(); @@ -861,7 +890,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void initPropertyPanel() { propertyPanel = new JPanel(); - propertyPanel.setBackground(Color.pink); contentPane = generateContentPane(); popupToolPane = new PopupToolPane(this, PopupToolPane.DOWN_BUTTON); headerPane = new JPanel(); @@ -947,7 +975,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) { iconSuffix = ICON_SUFFIX_NORMAL; button.setIcon(IconUtils.readIcon(getBtnIconUrl())); - button.setBackground(originBtnBackground); +// button.setBackground(originBtnBackground); button.setOpaque(false); } } @@ -956,7 +984,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { resetPropertyIcons(); iconSuffix = ICON_SUFFIX_SELECTED; button.setIcon(IconUtils.readIcon(getBtnIconUrl())); - button.setBackground(selectedBtnBackground); +// button.setBackground(selectedBtnBackground); button.setOpaque(true); selectedItem = this; } @@ -970,28 +998,23 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public Dimension getPreferredSize() { return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT); } - - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); - } }; button.setDisabledIcon(IconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED)); button.set4LargeToolbarButton(); - button.setUI(new UIButtonUI() { - @Override - protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { - if (isPressed(b) && b.isPressedPainted()) { - Color pressColor = isTabButtonSelected() ? UIConstants.TAB_BUTTON_PRESS_SELECTED : UIConstants.TAB_BUTTON_PRESS; - GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), pressColor); - } else if (isRollOver(b)) { - Color hoverColor = isTabButtonSelected() ? UIConstants.TAB_BUTTON_HOVER_SELECTED : UIConstants.TAB_BUTTON_HOVER; - GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), hoverColor); - } else if (b.isNormalPainted()) { - GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); - } - } - }); +// button.setUI(new UIButtonUI() { +// @Override +// protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { +// if (isPressed(b) && b.isPressedPainted()) { +// Color pressColor = isTabButtonSelected() ? UIConstants.TAB_BUTTON_PRESS_SELECTED : UIConstants.TAB_BUTTON_PRESS; +// GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), pressColor); +// } else if (isRollOver(b)) { +// Color hoverColor = isTabButtonSelected() ? UIConstants.TAB_BUTTON_HOVER_SELECTED : UIConstants.TAB_BUTTON_HOVER; +// GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), hoverColor); +// } else if (b.isNormalPainted()) { +// GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); +// } +// } +// }); originBtnBackground = button.getBackground(); button.addActionListener(new ActionListener() { @Override @@ -1182,7 +1205,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void mouseExited(MouseEvent e) { setCursor(Cursor.getDefaultCursor()); if (mouseDownCompCoords == null) { - contentPane.setBackground(originColor); +// contentPane.setBackground(originColor); } repaint(); } @@ -1198,7 +1221,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void mouseReleased(MouseEvent e) { mouseDownCompCoords = null; if (!getBounds().contains(e.getPoint())) { - contentPane.setBackground(originColor); +// contentPane.setBackground(originColor); } } @@ -1217,7 +1240,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } else if (isMovable) { setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); - contentPane.setBackground(UIConstants.POPUP_TITLE_BACKGROUND); +// contentPane.setBackground(UIConstants.POPUP_TITLE_BACKGROUND); } else { setCursor(Cursor.getDefaultCursor()); } @@ -1263,7 +1286,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { originColor = UIConstants.UI_TOOLBAR_COLOR; contentPane = new JPanel(); - contentPane.setBackground(originColor); +// contentPane.setBackground(originColor); contentPane.setLayout(new BorderLayout()); UILabel label = new UILabel(title); contentPane.add(label, BorderLayout.WEST); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java b/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java index 9c33534c7b..482986241b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java @@ -8,8 +8,15 @@ import com.fr.design.mainframe.guide.base.GuideView; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; -import com.fr.workspace.WorkContext; import com.fr.report.lock.LockInfoOperator; +import com.fr.workspace.WorkContext; + +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingWorker; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -22,12 +29,6 @@ import java.awt.LayoutManager; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.SwingWorker; /** * @author hades @@ -38,7 +39,7 @@ public class ForbiddenPane extends JPanel { private static final ImageIcon LOCK_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/lock_template.png")); private static final Color TIP_COLOR = new Color(108, 174, 235); - private static final Color BUTTON_COLOR = new Color(63, 155, 249); + private static final Color BUTTON_COLOR = new Color(249, 63, 63); private static final int Y_GAP = 10; private static final int X_GAP = 10; private static final int ARC = 4; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java b/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java index adea8d7e4d..71702a0d5e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.formdev.flatlaf.FlatDarculaLaf; import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -10,6 +11,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; +import javax.swing.UIManager; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.plaf.basic.BasicSliderUI; @@ -74,7 +76,7 @@ public class JFormSliderPane extends JPanel { UILabel uiLabel = new UILabel(SUFFIX); uiLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); panel.add(uiLabel); - panel.setBackground(BACK_COLOR); +// panel.setBackground(BACK_COLOR); this.add(panel, BorderLayout.NORTH); } @@ -89,7 +91,7 @@ public class JFormSliderPane extends JPanel { } }; slider.setValue(HALF_HUNDRED); - slider.setUI(new JSliderPaneUI(slider)); +// slider.setUI(new JSliderPaneUI(slider)); slider.addChangeListener(listener); slider.setPreferredSize(new Dimension(220, 20)); //去掉虚线框 @@ -104,7 +106,7 @@ public class JFormSliderPane extends JPanel { return new Point(event.getX(), event.getY() - TOOLTIP_Y); } }; - downButton.setOpaque(false); +// downButton.setOpaque(false); downButton.setBorderPainted(false); downButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Down")); upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png")) { @@ -112,8 +114,8 @@ public class JFormSliderPane extends JPanel { return new Point(event.getX(), event.getY() - TOOLTIP_Y); } }; - upButton.setOpaque(false); - upButton.setBorderPainted(false); +// upButton.setOpaque(false); +// upButton.setBorderPainted(false); upButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Up")); downButton.setActionCommand("less"); upButton.setActionCommand("more"); @@ -316,7 +318,7 @@ public class JFormSliderPane extends JPanel { Graphics2D g2 = (Graphics2D) g; cy = (trackBounds.height / 2); cw = trackBounds.width; - g2.setPaint(BACK_COLOR); +// g2.setPaint(BACK_COLOR); g2.fillRect(0, -cy, cw + 10, cy * 4); g.setColor(new Color(216, 216, 216)); g.drawLine(0, cy, cw + 3, cy); @@ -334,6 +336,11 @@ public class JFormSliderPane extends JPanel { } public static void main(String[] args) { + try { + UIManager.setLookAndFeel( new FlatDarculaLaf() ); + } catch( Exception ex ) { + System.err.println( "Failed to initialize LaF" ); + } JFrame jf = new JFrame("test"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel content = (JPanel) jf.getContentPane(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java index d850e8e814..a48be8b034 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java @@ -4,7 +4,6 @@ import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.TitlePlaceProcessor; -import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; @@ -66,7 +65,6 @@ public class NorthRegionContainerPane extends JPanel { ToolBarMenuDock ad = DesignerContext.getDesignerFrame().getToolBarMenuDock(); this.setLayout(new BorderLayout()); - this.add(new UIMenuHighLight(), BorderLayout.SOUTH); this.add(initNorthEastPane(ad), BorderLayout.EAST); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java index 004fbd55a3..e1f5ff3ad1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java @@ -2,9 +2,9 @@ package com.fr.design.mainframe; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; -import com.fr.design.constants.UIConstants; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.gui.icontainer.UIResizableContainer; +import com.fr.design.ui.util.UIUtil; import com.fr.general.GeneralContext; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; @@ -39,12 +39,13 @@ public class WestRegionContainerPane extends UIResizableContainer { @Override public void on(PluginEvent event) { - - if (getDownPane() != null) { - replaceDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); - } else { - setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); - } + UIUtil.invokeLaterIfNeeded(()-> { + if (getDownPane() != null) { + replaceDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); + } else { + setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); + } + }); } }, new PluginFilter() { @@ -56,6 +57,6 @@ public class WestRegionContainerPane extends UIResizableContainer { }); setContainerWidth(165); - setBackground(UIConstants.TREE_BACKGROUND); +// setBackground(UIConstants.TREE_BACKGROUND); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java index 6a9a60615f..97ef1a1a55 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java @@ -23,7 +23,7 @@ public class GuideView extends JDialog { private float modalOpacity; private Window window; - public static GuideView getInstance(Guide guide) { + public static synchronized GuideView getInstance(Guide guide) { if (guideView == null) { guideView = new GuideView(DesignerContext.getDesignerFrame(), guide); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index b36ca47294..55616e8695 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -206,7 +206,7 @@ public class DesignerLogHandler { this.setPreferredSize(new Dimension(super.getPreferredSize().width, 150)); jTextArea.setEditable(false); - jTextArea.setBackground(Color.WHITE); +// jTextArea.setBackground(Color.WHITE); popup = new JPopupMenu(); selectAll = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select_All")); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java index eb9ba74c2e..a0035aae49 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java @@ -44,7 +44,7 @@ public class LogHandlerBar extends JPanel implements ItemSelectable { public LogHandlerBar(String text) { this.setLayout(new FlowLayout(FlowLayout.RIGHT, FLOW_LAYOUT_HGAP, FLOW_LAYOUT_VGAP)); - this.setUI(new LogHandlerBarUI()); +// this.setUI(new LogHandlerBarUI()); this.text = text; clear = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/clear.png")); clear.setMargin(null); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index fded318188..0d1a64a761 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -1,10 +1,8 @@ package com.fr.design.mainframe.loghandler; -import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.stable.StringUtils; - import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -42,7 +40,6 @@ public class LogMessageBar extends JPanel { messageLabel = new UILabel(); setLayout(new BorderLayout()); add(messageLabel, BorderLayout.CENTER); - setBackground(UIConstants.LOG_MESSAGE_BAR_BACKGROUND); addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/LookAndFeelAction.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/LookAndFeelAction.java new file mode 100644 index 0000000000..f12a9cac4e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/LookAndFeelAction.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved. + */ + +package com.fr.design.mainframe.toolbar; + + +import com.formdev.flatlaf.FlatLaf; +import com.formdev.flatlaf.extras.FlatAnimatedLafChange; +import com.fr.design.actions.UpdateAction; + +import javax.swing.LookAndFeel; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import java.awt.event.ActionEvent; + +public class LookAndFeelAction extends UpdateAction { + + private final LookAndFeel lookAndFeel; + + public LookAndFeelAction(String name, LookAndFeel lookAndFeel) { + this.setName(name); + this.lookAndFeel = lookAndFeel; + } + + @Override + public void actionPerformed(ActionEvent e) { + applyLookAndFeel(lookAndFeel); + } + + private void applyLookAndFeel(LookAndFeel lookAndFeel){ + FlatAnimatedLafChange.showSnapshot(); + try { + UIManager.setLookAndFeel( lookAndFeel ); + } catch (UnsupportedLookAndFeelException e) { + throw new RuntimeException(e); + } + FlatLaf.updateUI(); + FlatAnimatedLafChange.hideSnapshotWithAnimation(); + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 3372e2ad13..5a60d60825 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -3,6 +3,9 @@ */ package com.fr.design.mainframe.toolbar; +import com.fine.theme.light.ui.laf.FineLightLaf; +import com.formdev.flatlaf.FlatDarculaLaf; +import com.formdev.flatlaf.FlatLightLaf; import com.fr.base.FRContext; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; @@ -48,6 +51,7 @@ import com.fr.design.fun.MenuHandler; import com.fr.design.fun.OemProcessor; import com.fr.design.fun.PluginManagerProvider; import com.fr.design.fun.TableDataPaneProcessor; +import com.fr.design.gui.UILookAndFeel; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIMenu; @@ -62,7 +66,6 @@ import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; -import com.fr.design.module.DesignModuleFactory; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.update.actions.SoftwareUpdateAction; @@ -296,6 +299,7 @@ public abstract class ToolBarMenuDock { } }, SupportLocaleImpl.COMMUNITY); + menuList.add(createLookAndFeel()); // 添加全部UpdateAction到actionmanager中 addAllUpdateActionsToList(menuList); @@ -481,7 +485,7 @@ public abstract class ToolBarMenuDock { return new UILabel(); } - public Component createNotificationCenterPane(){ + public Component createNotificationCenterPane() { return new UILabel(); } @@ -672,6 +676,19 @@ public abstract class ToolBarMenuDock { return menuDef; } + public MenuDef createLookAndFeel() { + MenuDef menuDef = new MenuDef("外观", 'H'); + menuDef.addShortCut( + new LookAndFeelAction("FR11", new UILookAndFeel()), + new LookAndFeelAction("fine new ui", new FineLightLaf()), + new LookAndFeelAction("flat dark", new FlatDarculaLaf()), + new LookAndFeelAction("flat light", new FlatLightLaf()) + ); + insertMenu(menuDef, "laf"); + return menuDef; + } + + public MenuDef createCommunityMenuDef() { MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"), 'C'); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java index 28cb3f2447..cccc08bc72 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java @@ -10,7 +10,6 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.iprogressbar.ModernUIProgressBarUI; -import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.i18n.LocaleLinkProvider; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; @@ -21,7 +20,6 @@ import com.fr.design.mainframe.vcs.VcsExceptionUtils; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.DesignUtils; -import com.fr.design.utils.ThemeUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.general.FRFont; import com.fr.log.FineLoggerFactory; @@ -36,7 +34,10 @@ import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Cursor; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -44,7 +45,6 @@ import java.awt.event.MouseEvent; import java.util.List; import java.util.concurrent.ExecutionException; -import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION; import static javax.swing.JOptionPane.YES_OPTION; @@ -61,7 +61,7 @@ public class VcsMovePanel extends BasicPane { .applySize(14) .applyStyle(FRFont.BOLD); - private static final Color BACK_GROUND_COLOR = new Color(202,232,255); +// private static final Color BACK_GROUND_COLOR = new Color(202,232,255); //提示字体的颜色,直接模仿其他面板的写法 private static final Color TIP_COLOR = new Color(51, 51, 52, (int)Math.round(0.5 * 255)); @@ -261,12 +261,12 @@ public class VcsMovePanel extends BasicPane { private void initVcsLabel(JPanel parent) { parent.removeAll(); if (!VcsHelper.getInstance().isLegacyMode()) { - parent.setBackground(ThemeUtils.BACK_COLOR); +// parent.setBackground(ThemeUtils.BACK_COLOR); centerButton = new UIButton(Toolkit.i18nText("Fine-Design_Vcs_Center")); parent.add(centerButton); initVcsCenterListener(); } else { - parent.setBackground(BACK_GROUND_COLOR); +// parent.setBackground(BACK_GROUND_COLOR); vcsUpdateExistLabel = new UILabel(IconUtils.readIcon("/com/fr/design/vcs/vcs_move_icon.svg")); vcsUpdateExistLabel.setText(Toolkit.i18nText("Fine-Design_Vcs_Can_Update")); vcsUpdateFireLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Update")); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/editors/TextField.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/editors/TextField.java index f6b0b5cef2..0374427f38 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/editors/TextField.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/editors/TextField.java @@ -1,7 +1,5 @@ package com.fr.design.mainframe.widget.editors; -import java.awt.Color; - import com.fr.design.gui.itextfield.UITextField; /** @@ -22,6 +20,6 @@ public class TextField extends UITextField implements ITextComponent { @Override public void setEditable(boolean b) { super.setEditable(b); - setBackground(Color.WHITE); +// setBackground(Color.WHITE); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/menu/DottedSeparator.java b/designer-base/src/main/java/com/fr/design/menu/DottedSeparator.java index 1f5f032770..7d1ec7b261 100644 --- a/designer-base/src/main/java/com/fr/design/menu/DottedSeparator.java +++ b/designer-base/src/main/java/com/fr/design/menu/DottedSeparator.java @@ -1,17 +1,15 @@ package com.fr.design.menu; +import com.fr.design.actions.UpdateAction; +import com.fr.design.gui.imenu.UIMenuItem; + import java.awt.BasicStroke; -import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Stroke; import java.awt.event.ActionEvent; -import com.fr.design.constants.UIConstants; -import com.fr.design.actions.UpdateAction; -import com.fr.design.gui.imenu.UIMenuItem; - /** * 虚线的Separator。 * @author zhou @@ -19,7 +17,7 @@ import com.fr.design.gui.imenu.UIMenuItem; */ public class DottedSeparator extends UpdateAction { - private static Color color = new Color(153, 153, 153); +// private static Color color = new Color(153, 153, 153); public DottedSeparator() { @@ -53,13 +51,13 @@ public class DottedSeparator extends UpdateAction { int w = this.getWidth(); int h = this.getHeight(); Graphics2D g2d = (Graphics2D)g; - g2d.setColor(UIConstants.NORMAL_BACKGROUND); + g2d.setColor(getBackground()); g2d.fillRect(0, 0, w, h); - g2d.setColor(color); + g2d.setColor(getForeground()); Stroke bs = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 2f, new float[] { 3, 1 }, 0); g2d.setStroke(bs); g2d.drawLine(30, h / 2+1, w-4, h / 2+1); - this.setForeground(color); + this.setForeground(getForeground()); super.paint(g); } diff --git a/designer-base/src/main/java/com/fr/design/menu/LineSeparator.java b/designer-base/src/main/java/com/fr/design/menu/LineSeparator.java index 45e45fc0d5..1419d31d88 100644 --- a/designer-base/src/main/java/com/fr/design/menu/LineSeparator.java +++ b/designer-base/src/main/java/com/fr/design/menu/LineSeparator.java @@ -1,10 +1,12 @@ package com.fr.design.menu; -import com.fr.design.constants.UIConstants; import com.fr.design.actions.UpdateAction; import com.fr.design.gui.imenu.UIMenuItem; -import java.awt.*; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.event.ActionEvent; /** @@ -53,11 +55,11 @@ public class LineSeparator extends UpdateAction{ int w = this.getWidth(); int h = this.getHeight(); Graphics2D g2d = (Graphics2D)g; - g2d.setColor(UIConstants.NORMAL_BACKGROUND); + g2d.setColor(getBackground()); g2d.fillRect(0, 0, w, h); - g2d.setColor(color); + g2d.setColor(getForeground()); g2d.drawLine(4, h / 2+1, w-4, h / 2+1); - this.setForeground(color); +// this.setForeground(color); super.paint(g); } diff --git a/designer-base/src/main/java/com/fr/design/menu/NameSeparator.java b/designer-base/src/main/java/com/fr/design/menu/NameSeparator.java index 89d291e543..b22184eb8f 100644 --- a/designer-base/src/main/java/com/fr/design/menu/NameSeparator.java +++ b/designer-base/src/main/java/com/fr/design/menu/NameSeparator.java @@ -1,5 +1,10 @@ package com.fr.design.menu; +import com.fr.base.GraphHelper; +import com.fr.design.actions.UpdateAction; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.imenu.UIMenuItem; + import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FontMetrics; @@ -7,13 +12,6 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; -import com.fr.design.constants.UIConstants; -import com.fr.design.gui.ilable.UILabel; - -import com.fr.base.GraphHelper; -import com.fr.design.actions.UpdateAction; -import com.fr.design.gui.imenu.UIMenuItem; - /** * * @author zhou @@ -56,9 +54,8 @@ public class NameSeparator extends UpdateAction { int w = this.getWidth(); int h = this.getHeight(); Graphics2D g2d = (Graphics2D)g; - g2d.setColor(UIConstants.NORMAL_BACKGROUND); + g2d.setColor(getBackground()); g2d.fillRect(0, 0, w, h); - this.setForeground(UIConstants.FONT_COLOR); super.paint(g); } @@ -81,7 +78,7 @@ public class NameSeparator extends UpdateAction { int w = this.getWidth(); int h = this.getHeight(); Graphics2D g2d = (Graphics2D)g; - g2d.setColor(UIConstants.FONT_COLOR); + g2d.setColor(getForeground()); FontMetrics fm = GraphHelper.getFontMetrics(this.getFont()); int strwidth = 0; String str = this.getText(); @@ -89,7 +86,6 @@ public class NameSeparator extends UpdateAction { strwidth = strwidth + fm.charWidth(str.charAt(i)); } g2d.drawLine(strwidth + 4, h / 2+2, w, h / 2+2); - this.setForeground(UIConstants.FONT_COLOR); super.paint(g); } } diff --git a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java index 8e5c3ff404..b8d41ebe56 100644 --- a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java +++ b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java @@ -1,13 +1,12 @@ package com.fr.design.notification.ui; import com.fr.base.svg.IconUtils; -import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.notification.NotificationCenter; -import com.fr.general.IOUtils; + import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.MouseAdapter; @@ -33,7 +32,6 @@ public class NotificationCenterPane extends BasicPane { notificationCenterDialog.showDialog(); } }); - this.setBackground(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND); } public static NotificationCenterPane getNotificationCenterPane() { diff --git a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java index f393b1a09c..ce8a9012a9 100644 --- a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java +++ b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java @@ -184,7 +184,7 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo Icon[] iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/demo.png")}; String[] textArray = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FS_Name")}; - buttonGroup = new UIHeadGroup(iconArray, textArray) { + buttonGroup = new UIHeadGroup(textArray) { public void tabChanged(int index) { roleTree.setEditable(false); if (op != null) { @@ -198,7 +198,6 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo } }; buttonGroup.setBorder(BorderFactory.createMatteBorder(1, LEFT_GAP, 0, 0, UIConstants.LINE_COLOR)); - buttonGroup.setNeedLeftRightOutLine(false); } /** diff --git a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java index 49a3a91254..95f2d7f36e 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java +++ b/designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java @@ -22,7 +22,6 @@ import javax.swing.event.DocumentListener; import javax.swing.text.BadLocationException; import javax.swing.text.Document; -import com.fr.design.gui.ibutton.SpecialUIButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.islider.UISlider; diff --git a/designer-base/src/main/java/com/fr/design/ui/util/UIUtil.java b/designer-base/src/main/java/com/fr/design/ui/util/UIUtil.java index 86093a6d82..c03550da2a 100644 --- a/designer-base/src/main/java/com/fr/design/ui/util/UIUtil.java +++ b/designer-base/src/main/java/com/fr/design/ui/util/UIUtil.java @@ -6,6 +6,8 @@ import com.fr.third.guava.base.Supplier; import org.jetbrains.annotations.NotNull; import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import java.awt.Color; import java.util.concurrent.TimeUnit; /** @@ -55,18 +57,18 @@ public class UIUtil { } } } - + /** * 有些时候,交互上需要有一些等待的效果, * 如果没有等待到, 会让交互失去作用。 * * @param supplier 结果 - * @param timeout 超时 + * @param timeout 超时 * @param timeUnit 单位 * @return 结果 */ public static T waitUntil(Supplier supplier, long timeout, TimeUnit timeUnit) { - + Stopwatch st = Stopwatch.createStarted(); T result = supplier.get(); long elapsed = st.elapsed(timeUnit); @@ -81,4 +83,8 @@ public class UIUtil { } return result; } + + public static Color getPanelBackageColor() { + return UIManager.getColor("Panel.background"); + } } diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java index 8f44ae197e..980ac2c8a8 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java @@ -23,6 +23,7 @@ import com.fr.design.locale.impl.BbsRegisterMark; import com.fr.design.locale.impl.BbsResetMark; import com.fr.design.locale.impl.BbsSpaceMark; import com.fr.design.login.utils.DesignerLoginUtils; +import com.fr.design.ui.util.UIUtil; import com.fr.design.upm.event.DownloadEvent; import com.fr.design.upm.exec.UpmBrowserExecutor; import com.fr.design.upm.task.UpmTaskWorker; @@ -40,7 +41,6 @@ import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.JSArray; import com.teamdev.jxbrowser.chromium.JSFunction; import com.teamdev.jxbrowser.chromium.JSObject; -import com.teamdev.jxbrowser.chromium.JSValue; import javax.swing.JFileChooser; import javax.swing.SwingUtilities; @@ -146,7 +146,7 @@ public class UpmBridge { @JSBridge public void closeWindow() { - UpmFinder.closeWindow(); + UIUtil.invokeLaterIfNeeded(UpmFinder::closeWindow); } diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index bfba512a20..2da9646639 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -1,5 +1,7 @@ package com.fr.design.utils; +import com.fine.theme.light.ui.laf.FineLightLaf; +import com.formdev.flatlaf.extras.FlatUIDefaultsInspector; import com.fr.base.FeedBackInfo; import com.fr.base.ServerConfig; import com.fr.base.Utils; @@ -10,7 +12,6 @@ import com.fr.design.deeplink.DeepLinkCore; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.DefaultValueAdjustProvider; import com.fr.design.fun.DesignerEnvProcessor; -import com.fr.design.gui.UILookAndFeel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.ui.util.UIUtil; @@ -27,7 +28,6 @@ import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.bridge.ObjectHolder; import com.fr.stable.os.OperatingSystem; -import com.fr.stable.plugin.ExtraDesignClassManagerProvider; import com.fr.start.ServerStarter; import com.fr.start.common.DesignerStartupContext; import com.fr.start.common.DesignerStartupUtil; @@ -306,12 +306,7 @@ public class DesignUtils { * p:初始化look and feel, 把一切放到这个里面.可以让多个地方调用. */ public static void initLookAndFeel() { - // p:隐藏对话框的系统标题风格,用look and feel定义的标题风格. - try { - UIManager.setLookAndFeel(UILookAndFeel.class.getName()); - } catch (Exception e) { - FineLoggerFactory.getLogger().error("Substance Raven Graphite failed to initialize"); - } + FineLightLaf.setup(); //获取当前系统语言下设计器用的默认字体 FRFont guiFRFont = getDefaultGUIFont(); //指定UIManager中字体 @@ -323,6 +318,7 @@ public class DesignUtils { UIManager.put(key, isTextField(key) ? getNamedFont("Dialog") : guiFRFont); } } + FlatUIDefaultsInspector.install( "ctrl shift alt Y" ); } private static boolean isTextField(String key) { diff --git a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java index f8f7a13ea2..c20aaa153d 100644 --- a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java +++ b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java @@ -5,12 +5,12 @@ import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.SupportLocaleImpl; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.ui.util.UIUtil; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; import com.fr.event.Null; import com.fr.general.FRFont; -import com.fr.general.locale.LocaleAction; import com.fr.general.locale.LocaleCenter; import javax.swing.plaf.ColorUIResource; @@ -47,7 +47,7 @@ public class FineEmbedServerMonitor { @Override public void on(Event event, Null aNull) { getInstance().reset(); - progressDialog.dispose(); + UIUtil.invokeLaterIfNeeded(() -> progressDialog.dispose()); } }); } @@ -87,29 +87,24 @@ public class FineEmbedServerMonitor { public void monitor() { final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1, new NamedThreadFactory("FineEmbedServerMonitor")); - scheduler.scheduleAtFixedRate(new Runnable() { - @Override - public void run() { - if (isComplete()) { - scheduler.shutdown(); - progressDialog.dispose(); - return; - } + scheduler.scheduleAtFixedRate(() -> { + if (isComplete()) { + scheduler.shutdown(); + UIUtil.invokeLaterIfNeeded(() -> progressDialog.dispose()); + return; + } + UIUtil.invokeLaterIfNeeded(() -> { if (!progressDialog.isVisible()) { progressDialog = new ProgressDialog(DesignerContext.getDesignerFrame()); progressDialog.setVisible(true); //如果为韩文则改变字体 - LocaleCenter.buildAction(new LocaleAction() { - @Override - public void execute() { - font = FRFont.getInstance().applySize(FONT_SIZE).applyForeground(new ColorUIResource(FONT_RGB)).applyName(FONT_NAME); - } - }, SupportLocaleImpl.SUPPORT_KOREA); + LocaleCenter.buildAction(() -> font = FRFont.getInstance().applySize(FONT_SIZE).applyForeground(new ColorUIResource(FONT_RGB)).applyName(FONT_NAME), SupportLocaleImpl.SUPPORT_KOREA); String text = Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server"); progressDialog.updateLoadingText(text, font); } progressDialog.setProgressValue(getProgress()); - } + }); + }, 0, STEP_HEARTBEAT, TimeUnit.MILLISECONDS); } 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 new file mode 100644 index 0000000000..02700bd9f4 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -0,0 +1,1077 @@ +# +# Copyright 2019 FormDev Software GmbH +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# This file is loaded for all light themes (that extend class FlatLightLaf). +# +# Documentation: +# - https://www.formdev.com/flatlaf/properties-files/ +# - https://www.formdev.com/flatlaf/how-to-customize/ +# +# NOTE: Avoid copying the whole content of this file to own properties files. +# This will make upgrading to newer FlatLaf versions complex and error-prone. +# Instead, copy and modify only those properties that you need to alter. +# + +# Colors and style mostly based on IntelliJ theme from IntelliJ IDEA Community Edition, +# which is licensed under the Apache 2.0 license. Copyright 2000-2019 JetBrains s.r.o. +# See: https://github.com/JetBrains/intellij-community/ + +#---- UI delegates ---- + +ButtonUI = com.formdev.flatlaf.ui.FlatButtonUI +CheckBoxUI = com.formdev.flatlaf.ui.FlatCheckBoxUI +CheckBoxMenuItemUI = com.formdev.flatlaf.ui.FlatCheckBoxMenuItemUI +ColorChooserUI = com.formdev.flatlaf.ui.FlatColorChooserUI +ComboBoxUI = com.formdev.flatlaf.ui.FlatComboBoxUI +DesktopIconUI = com.formdev.flatlaf.ui.FlatDesktopIconUI +DesktopPaneUI = com.formdev.flatlaf.ui.FlatDesktopPaneUI +EditorPaneUI = com.formdev.flatlaf.ui.FlatEditorPaneUI +FileChooserUI = com.formdev.flatlaf.ui.FlatFileChooserUI +FormattedTextFieldUI = com.formdev.flatlaf.ui.FlatFormattedTextFieldUI +InternalFrameUI = com.formdev.flatlaf.ui.FlatInternalFrameUI +LabelUI = com.formdev.flatlaf.ui.FlatLabelUI +ListUI = com.formdev.flatlaf.ui.FlatListUI +MenuUI = com.formdev.flatlaf.ui.FlatMenuUI +MenuBarUI = com.formdev.flatlaf.ui.FlatMenuBarUI +MenuItemUI = com.formdev.flatlaf.ui.FlatMenuItemUI +OptionPaneUI = com.formdev.flatlaf.ui.FlatOptionPaneUI +PanelUI = com.formdev.flatlaf.ui.FlatPanelUI +PasswordFieldUI = com.formdev.flatlaf.ui.FlatPasswordFieldUI +PopupMenuUI = com.formdev.flatlaf.ui.FlatPopupMenuUI +PopupMenuSeparatorUI = com.formdev.flatlaf.ui.FlatPopupMenuSeparatorUI +ProgressBarUI = com.formdev.flatlaf.ui.FlatProgressBarUI +RadioButtonUI = com.formdev.flatlaf.ui.FlatRadioButtonUI +RadioButtonMenuItemUI = com.formdev.flatlaf.ui.FlatRadioButtonMenuItemUI +RootPaneUI = com.formdev.flatlaf.ui.FlatRootPaneUI +ScrollBarUI = com.formdev.flatlaf.ui.FlatScrollBarUI +ScrollPaneUI = com.formdev.flatlaf.ui.FlatScrollPaneUI +SeparatorUI = com.formdev.flatlaf.ui.FlatSeparatorUI +SliderUI = com.formdev.flatlaf.ui.FlatSliderUI +SpinnerUI = com.formdev.flatlaf.ui.FlatSpinnerUI +SplitPaneUI = com.formdev.flatlaf.ui.FlatSplitPaneUI +TabbedPaneUI = com.formdev.flatlaf.ui.FlatTabbedPaneUI +TableUI = com.formdev.flatlaf.ui.FlatTableUI +TableHeaderUI = com.formdev.flatlaf.ui.FlatTableHeaderUI +TextAreaUI = com.formdev.flatlaf.ui.FlatTextAreaUI +TextFieldUI = com.formdev.flatlaf.ui.FlatTextFieldUI +TextPaneUI = com.formdev.flatlaf.ui.FlatTextPaneUI +ToggleButtonUI = com.fine.theme.light.ui.FineToggleButtonUI +ToolBarUI = com.formdev.flatlaf.ui.FlatToolBarUI +ToolBarSeparatorUI = com.formdev.flatlaf.ui.FlatToolBarSeparatorUI +ToolTipUI = com.formdev.flatlaf.ui.FlatToolTipUI +TreeUI = com.formdev.flatlaf.ui.FlatTreeUI +ViewportUI = com.formdev.flatlaf.ui.FlatViewportUI + + +#---- variables ---- + +# general background and foreground (text color) +@background = #F6F8FA +@foreground = #0B1B39 +@disabledBackground = @background +@disabledForeground = tint(@foreground,55%) + +# component background +@buttonBackground = lighten(@background,5%) +@componentBackground = @background +@menuBackground = @background + +# selection +@selectionBackground = @accentSelectionBackground +@selectionForeground = contrast(@selectionBackground, @foreground, #fff) +@selectionInactiveBackground = shade(@background,13%) +@selectionInactiveForeground = @foreground + +# menu +@menuSelectionBackground = @selectionBackground +@menuHoverBackground = darken(@menuBackground,10%,derived) +@menuCheckBackground = lighten(@menuSelectionBackground,40%,derived noAutoInverse) +@menuAcceleratorForeground = lighten(@foreground,30%) +@menuAcceleratorSelectionForeground = @selectionForeground + +# misc +@cellFocusColor = darken(@selectionBackground,20%) +@icon = shade(@background,27%) + +# accent colors (blueish) +# set @accentColor to use single accent color or +# modify @accentBaseColor to use variations of accent base color +@accentColor = systemColor(accent,null) +@accentBaseColor = #2675BF +@accentBase2Color = lighten(saturate(@accentBaseColor,10%),6%) +# accent color variations +@accentCheckmarkColor = if(@accentColor, @accentColor, tint(@accentBase2Color,20%)) +@accentFocusColor = if(@accentColor, @accentColor, lighten(@accentBaseColor,31%)) +@accentLinkColor = if(@accentColor, @accentColor, darken(@accentBaseColor,3%)) +@accentSelectionBackground = if(@accentColor, @accentColor, @accentBaseColor) +@accentSliderColor = if(@accentColor, @accentColor, @accentBase2Color) +@accentUnderlineColor = if(@accentColor, @accentColor, tint(@accentBaseColor,10%)) +@accentButtonDefaultBorderColor = if(@accentColor, @accentColor, tint(@accentBase2Color,20%)) + +# for buttons within components (e.g. combobox or spinner) +@buttonArrowColor = tint(@foreground,40%) +@buttonDisabledArrowColor = lighten(@buttonArrowColor,25%) +@buttonHoverArrowColor = lighten(@buttonArrowColor,20%,derived noAutoInverse) +@buttonPressedArrowColor = lighten(@buttonArrowColor,30%,derived noAutoInverse) + +# Drop (use lazy colors for IntelliJ platform themes, which usually do not specify these colors) +@dropCellBackground = lighten(List.selectionBackground,10%,lazy) +@dropCellForeground = lazy(List.selectionForeground) +@dropLineColor = lighten(List.selectionBackground,20%,lazy) +@dropLineShortColor = darken(List.selectionBackground,20%,lazy) + + +#---- system colors ---- + +activeCaption = #99b4d1 +inactiveCaption = #bfcddb +controlHighlight = lighten($controlShadow,12%) +controlLtHighlight = lighten($controlShadow,25%) +controlDkShadow = darken($controlShadow,15%) + + +#---- Button ---- + +Button.border = com.formdev.flatlaf.ui.FlatButtonBorder +Button.arc = 6 +Button.minimumWidth = 72 +Button.margin = 2,14,2,14 +Button.iconTextGap = 4 +Button.rollover = true +Button.defaultButtonFollowsFocus = false +Button.borderWidth = 1 + +Button.background = @buttonBackground +Button.focusedBackground = changeLightness($Component.focusColor,95%) +Button.hoverBackground = darken($Button.background,3%,derived) +Button.pressedBackground = darken($Button.background,10%,derived) +Button.selectedBackground = darken($Button.background,20%,derived) +Button.selectedForeground = $Button.foreground +Button.disabledSelectedBackground = darken($Button.background,13%,derived) + +Button.borderColor = $Component.borderColor +Button.disabledBorderColor = $Component.disabledBorderColor +Button.focusedBorderColor = $Component.focusedBorderColor +Button.hoverBorderColor = $Button.focusedBorderColor + +Button.innerFocusWidth = 0 + +Button.default.background = $Button.background +Button.default.foreground = $Button.foreground +Button.default.focusedBackground = $Button.focusedBackground +Button.default.hoverBackground = darken($Button.default.background,3%,derived) +Button.default.pressedBackground = darken($Button.default.background,10%,derived) +Button.default.borderColor = @accentButtonDefaultBorderColor +Button.default.hoverBorderColor = $Button.hoverBorderColor +Button.default.focusedBorderColor = $Button.focusedBorderColor +Button.default.focusColor = $Component.focusColor +Button.default.borderWidth = 2 + +Button.toolbar.hoverBackground = darken($Button.background,12%,derived) +Button.toolbar.pressedBackground = darken($Button.background,15%,derived) +Button.toolbar.selectedBackground = $Button.selectedBackground +Button.toolbar.margin = 3,3,3,3 +Button.toolbar.spacingInsets = 1,2,1,2 + +#---- CheckBox ---- + +CheckBox.border = com.formdev.flatlaf.ui.FlatMarginBorder +CheckBox.icon = com.formdev.flatlaf.icons.FlatCheckBoxIcon +CheckBox.arc = 4 +CheckBox.margin = 2,2,2,2 +CheckBox.iconTextGap = 4 +CheckBox.rollover = true + +CheckBox.icon.focusWidth = 1 + +# enabled +CheckBox.icon.borderColor = shade($Component.borderColor,10%) +CheckBox.icon.background = @buttonBackground +CheckBox.icon.selectedBorderColor = $CheckBox.icon.checkmarkColor +CheckBox.icon.selectedBackground = $CheckBox.icon.background +CheckBox.icon.checkmarkColor = @accentCheckmarkColor + +# disabled +CheckBox.icon.disabledBorderColor = tint($CheckBox.icon.borderColor,20%) +CheckBox.icon.disabledBackground = @disabledBackground +CheckBox.icon.disabledCheckmarkColor = lighten(changeSaturation($CheckBox.icon.checkmarkColor,0%),5%) + +# focused +CheckBox.icon.focusedBorderColor = shade($Component.focusedBorderColor,10%) +CheckBox.icon.focusedBackground = changeLightness($Component.focusColor,95%) + +# hover +CheckBox.icon.hoverBorderColor = $CheckBox.icon.focusedBorderColor +CheckBox.icon.hoverBackground = darken($CheckBox.icon.background,3%,derived) + +# pressed +CheckBox.icon.pressedBorderColor = $CheckBox.icon.focusedBorderColor +CheckBox.icon.pressedBackground = darken($CheckBox.icon.background,10%,derived) + + +# used if CheckBox.icon.style or RadioButton.icon.style = filled +# enabled +CheckBox.icon[filled].selectedBorderColor = shade($CheckBox.icon[filled].selectedBackground,5%) +CheckBox.icon[filled].selectedBackground = @accentCheckmarkColor +CheckBox.icon[filled].checkmarkColor = @buttonBackground +# focused +CheckBox.icon[filled].focusedSelectedBorderColor = tint($CheckBox.icon[filled].selectedBackground,50%) +CheckBox.icon[filled].focusedSelectedBackground = $CheckBox.icon[filled].selectedBackground +CheckBox.icon[filled].focusedCheckmarkColor = $CheckBox.icon.focusedBackground +# hover +CheckBox.icon[filled].hoverSelectedBackground = darken($CheckBox.icon[filled].selectedBackground,5%,derived) +# pressed +CheckBox.icon[filled].pressedSelectedBackground = darken($CheckBox.icon[filled].selectedBackground,10%,derived) + + +#---- CheckBoxMenuItem ---- + +CheckBoxMenuItem.icon.checkmarkColor = @accentCheckmarkColor +CheckBoxMenuItem.icon.disabledCheckmarkColor = @buttonDisabledArrowColor +CheckBoxMenuItem.border = com.formdev.flatlaf.ui.FlatMenuItemBorder +CheckBoxMenuItem.checkIcon = com.formdev.flatlaf.icons.FlatCheckBoxMenuItemIcon +CheckBoxMenuItem.arrowIcon = com.formdev.flatlaf.icons.FlatMenuItemArrowIcon +CheckBoxMenuItem.margin = @menuItemMargin +CheckBoxMenuItem.opaque = false +CheckBoxMenuItem.borderPainted = true +CheckBoxMenuItem.background = @menuBackground + +#---- ColorChooser ---- + +ColorChooser.swatchesSwatchSize = {scaledDimension}16,16 +ColorChooser.swatchesRecentSwatchSize = {scaledDimension}16,16 +ColorChooser.swatchesDefaultRecentColor = $control + + +#---- ComboBox ---- + +ComboBox.border = com.formdev.flatlaf.ui.FlatRoundBorder +ComboBox.padding = @componentMargin +ComboBox.minimumWidth = 72 +ComboBox.editorColumns = 0 +ComboBox.maximumRowCount = 15 +[mac]ComboBox.showPopupOnNavigation = true +# allowed values: auto, button or none +ComboBox.buttonStyle = auto +ComboBox.background = @componentBackground +ComboBox.buttonBackground = $ComboBox.background +ComboBox.buttonEditableBackground = darken($ComboBox.background,2%) +ComboBox.buttonSeparatorColor = $Component.borderColor +ComboBox.buttonDisabledSeparatorColor = $Component.disabledBorderColor +ComboBox.buttonArrowColor = @buttonArrowColor +ComboBox.buttonDisabledArrowColor = @buttonDisabledArrowColor +ComboBox.buttonHoverArrowColor = @buttonHoverArrowColor +ComboBox.buttonPressedArrowColor = @buttonPressedArrowColor + +ComboBox.popupInsets = 0,0,0,0 +ComboBox.selectionInsets = 0,0,0,0 +ComboBox.selectionArc = 0 +ComboBox.borderCornerRadius = $Popup.borderCornerRadius + + +#---- Component ---- + +Component.focusWidth = 0 +Component.innerFocusWidth = 0.5 +Component.innerOutlineWidth = 1 +Component.borderWidth = 1 +Component.arc = 5 +Component.minimumWidth = 64 +# allowed values: chevron or triangle +Component.arrowType = chevron +Component.hideMnemonics = true + +Component.borderColor = shade(@background,20%) +Component.disabledBorderColor = tint($Component.borderColor,20%) +Component.focusedBorderColor = shade($Component.focusColor,10%) +Component.focusColor = @accentFocusColor +Component.linkColor = @accentLinkColor +Component.accentColor = if(@accentColor, @accentColor, @accentBaseColor) +Component.grayFilter = 25,-25,100 + +Component.error.borderColor = lighten(desaturate($Component.error.focusedBorderColor,20%),25%) +Component.error.focusedBorderColor = #e53e4d +Component.warning.borderColor = lighten(saturate($Component.warning.focusedBorderColor,25%),20%) +Component.warning.focusedBorderColor = #e2a53a +Component.custom.borderColor = lighten(desaturate(#f00,20%,derived noAutoInverse),25%,derived noAutoInverse) + + +#---- Desktop ---- + +Desktop.background = #E6EBF0 + +#---- DesktopIcon ---- + +DesktopIcon.background = darken($Desktop.background,10%,derived) +DesktopIcon.border = 4,4,4,4 +DesktopIcon.iconSize = 64,64 +DesktopIcon.closeSize = 20,20 +DesktopIcon.closeIcon = com.formdev.flatlaf.icons.FlatInternalFrameCloseIcon + +#---- EditorPane ---- + +EditorPane.border = com.formdev.flatlaf.ui.FlatMarginBorder +EditorPane.margin = @componentMargin +EditorPane.background = @componentBackground + + +#---- FileChooser ---- + +FileChooser.newFolderIcon = com.formdev.flatlaf.icons.FlatFileChooserNewFolderIcon +FileChooser.upFolderIcon = com.formdev.flatlaf.icons.FlatFileChooserUpFolderIcon +FileChooser.homeFolderIcon = com.formdev.flatlaf.icons.FlatFileChooserHomeFolderIcon +FileChooser.detailsViewIcon = com.formdev.flatlaf.icons.FlatFileChooserDetailsViewIcon +FileChooser.listViewIcon = com.formdev.flatlaf.icons.FlatFileChooserListViewIcon +FileChooser.usesSingleFilePane = true +[win]FileChooser.useSystemExtensionHiding = true + + +#---- FileView ---- + +FileView.directoryIcon = com.formdev.flatlaf.icons.FlatFileViewDirectoryIcon +FileView.fileIcon = com.formdev.flatlaf.icons.FlatFileViewFileIcon +FileView.computerIcon = com.formdev.flatlaf.icons.FlatFileViewComputerIcon +FileView.hardDriveIcon = com.formdev.flatlaf.icons.FlatFileViewHardDriveIcon +FileView.floppyDriveIcon = com.formdev.flatlaf.icons.FlatFileViewFloppyDriveIcon +FileView.fullRowSelection = true + + +#---- FormattedTextField ---- + +FormattedTextField.border = com.formdev.flatlaf.ui.FlatTextBorder +FormattedTextField.margin = @componentMargin +FormattedTextField.background = @componentBackground +FormattedTextField.placeholderForeground = @disabledForeground +FormattedTextField.iconTextGap = 4 + +#---- HelpButton ---- + +HelpButton.questionMarkColor = @accentCheckmarkColor +HelpButton.disabledQuestionMarkColor = shade(@background,30%) + +HelpButton.icon = com.formdev.flatlaf.icons.FlatHelpButtonIcon +HelpButton.borderColor = $Button.borderColor +HelpButton.disabledBorderColor = $Button.disabledBorderColor +HelpButton.focusedBorderColor = $Button.focusedBorderColor +HelpButton.hoverBorderColor = $?Button.hoverBorderColor +HelpButton.background = $Button.background +HelpButton.disabledBackground = $Button.disabledBackground +HelpButton.focusedBackground = $?Button.focusedBackground +HelpButton.hoverBackground = $?Button.hoverBackground +HelpButton.pressedBackground = $?Button.pressedBackground + +HelpButton.borderWidth = $?Button.borderWidth +HelpButton.innerFocusWidth = $?Button.innerFocusWidth + + +#---- InternalFrame ---- + +InternalFrame.border = com.formdev.flatlaf.ui.FlatInternalFrameUI$FlatInternalFrameBorder +InternalFrame.borderLineWidth = 1 +InternalFrame.borderMargins = 6,6,6,6 +InternalFrame.buttonSize = 24,24 +InternalFrame.closeIcon = com.formdev.flatlaf.icons.FlatInternalFrameCloseIcon +InternalFrame.iconifyIcon = com.formdev.flatlaf.icons.FlatInternalFrameIconifyIcon +InternalFrame.maximizeIcon = com.formdev.flatlaf.icons.FlatInternalFrameMaximizeIcon +InternalFrame.minimizeIcon = com.formdev.flatlaf.icons.FlatInternalFrameRestoreIcon +InternalFrame.windowBindings = null + +# drop shadow +InternalFrame.dropShadowPainted = true +InternalFrame.activeDropShadowColor = null +InternalFrame.activeDropShadowInsets = 5,5,6,6 +InternalFrame.inactiveDropShadowColor = null +InternalFrame.inactiveDropShadowInsets = 3,3,4,4 + +InternalFrame.activeTitleBackground = #fff +InternalFrame.activeTitleForeground = @foreground +InternalFrame.inactiveTitleBackground = darken($InternalFrame.activeTitleBackground,2%) +InternalFrame.inactiveTitleForeground = @disabledForeground + +InternalFrame.activeBorderColor = shade(@background,40%) +InternalFrame.inactiveBorderColor = shade(@background,20%) + +InternalFrame.buttonHoverBackground = darken($InternalFrame.activeTitleBackground,10%,derived) +InternalFrame.buttonPressedBackground = darken($InternalFrame.activeTitleBackground,20%,derived) +InternalFrame.closeHoverBackground = lazy(Actions.Red) +InternalFrame.closePressedBackground = darken(Actions.Red,10%,lazy) +InternalFrame.closeHoverForeground = #fff +InternalFrame.closePressedForeground = #fff + +InternalFrame.activeDropShadowOpacity = 0.25 +InternalFrame.inactiveDropShadowOpacity = 0.5 + +#---- InternalFrameTitlePane ---- + +InternalFrameTitlePane.border = 0,8,0,0 + +#---- List ---- + +List.border = 0,0,0,0 +List.cellMargins = 1,6,1,6 +List.selectionInsets = 0,0,0,0 +List.selectionArc = 0 +List.cellFocusColor = @cellFocusColor +List.cellNoFocusBorder = com.formdev.flatlaf.ui.FlatListCellBorder$Default +List.focusCellHighlightBorder = com.formdev.flatlaf.ui.FlatListCellBorder$Focused +List.focusSelectedCellHighlightBorder = com.formdev.flatlaf.ui.FlatListCellBorder$Selected +List.background = @componentBackground +List.selectionInactiveBackground = @selectionInactiveBackground +List.selectionInactiveForeground = @selectionInactiveForeground +List.dropCellBackground = @dropCellBackground +List.dropCellForeground = @dropCellForeground +List.dropLineColor = @dropLineColor +List.showCellFocusIndicator = false + +#---- Menu ---- + +Menu.icon.arrowColor = @buttonArrowColor +Menu.icon.disabledArrowColor = @buttonDisabledArrowColor + +Menu.border = com.formdev.flatlaf.ui.FlatMenuItemBorder +Menu.arrowIcon = com.formdev.flatlaf.icons.FlatMenuArrowIcon +Menu.checkIcon = null +Menu.margin = @menuItemMargin +Menu.submenuPopupOffsetX = {scaledInteger}-4 +Menu.submenuPopupOffsetY = {scaledInteger}-4 +Menu.opaque = false +Menu.borderPainted = true +Menu.background = @menuBackground + + +#---- MenuBar ---- + +MenuBar.borderColor = $Separator.foreground +MenuBar.border = com.formdev.flatlaf.ui.FlatMenuBarBorder +MenuBar.background = @menuBackground +MenuBar.hoverBackground = @menuHoverBackground +MenuBar.itemMargins = 3,8,3,8 +MenuBar.selectionInsets = $MenuItem.selectionInsets +MenuBar.selectionEmbeddedInsets = $MenuItem.selectionInsets +MenuBar.selectionArc = $MenuItem.selectionArc + +#---- MenuItem ---- + +MenuItem.border = com.formdev.flatlaf.ui.FlatMenuItemBorder +MenuItem.arrowIcon = com.formdev.flatlaf.icons.FlatMenuItemArrowIcon +MenuItem.checkIcon = null +MenuItem.margin = @menuItemMargin +MenuItem.opaque = false +MenuItem.borderPainted = true +MenuItem.verticallyAlignText = true +MenuItem.background = @menuBackground +MenuItem.checkBackground = @menuCheckBackground +MenuItem.checkMargins = 2,2,2,2 +MenuItem.minimumWidth = 72 +MenuItem.minimumIconSize = 16,16 +MenuItem.iconTextGap = 6 +MenuItem.textAcceleratorGap = 24 +MenuItem.textNoAcceleratorGap = 6 +MenuItem.acceleratorArrowGap = 2 +MenuItem.acceleratorDelimiter = "+" +[mac]MenuItem.acceleratorDelimiter = "" +MenuItem.selectionInsets = 0,0,0,0 +MenuItem.selectionArc = 0 + +# for MenuItem.selectionType = underline +MenuItem.underlineSelectionBackground = @menuHoverBackground +MenuItem.underlineSelectionCheckBackground = @menuCheckBackground +MenuItem.underlineSelectionColor = @accentUnderlineColor +MenuItem.underlineSelectionHeight = 3 + +#---- OptionPane ---- + +OptionPane.border = 12,12,12,12 +OptionPane.messageAreaBorder = 0,0,0,0 +OptionPane.buttonAreaBorder = 12,0,0,0 +OptionPane.messageForeground = null + +OptionPane.showIcon = false +OptionPane.maxCharactersPerLine = 80 +OptionPane.iconMessageGap = 16 +OptionPane.messagePadding = 3 +OptionPane.buttonPadding = 8 +OptionPane.buttonMinimumWidth = {scaledInteger}72 +OptionPane.sameSizeButtons = true +OptionPane.setButtonMargin = false +OptionPane.buttonOrientation = 4 +[mac]OptionPane.isYesLast = true + +OptionPane.errorIcon = com.formdev.flatlaf.icons.FlatOptionPaneErrorIcon +OptionPane.informationIcon = com.formdev.flatlaf.icons.FlatOptionPaneInformationIcon +OptionPane.questionIcon = com.formdev.flatlaf.icons.FlatOptionPaneQuestionIcon +OptionPane.warningIcon = com.formdev.flatlaf.icons.FlatOptionPaneWarningIcon + +#---- PasswordField ---- + +PasswordField.capsLockIconColor = #00000064 +PasswordField.revealIconColor = tint(@foreground,40%) +PasswordField.border = com.formdev.flatlaf.ui.FlatTextBorder +PasswordField.margin = @componentMargin +PasswordField.background = @componentBackground +PasswordField.placeholderForeground = @disabledForeground +PasswordField.iconTextGap = 4 +PasswordField.echoChar = \u2022 +PasswordField.showCapsLock = true +PasswordField.showRevealButton = false +PasswordField.capsLockIcon = com.formdev.flatlaf.icons.FlatCapsLockIcon +PasswordField.revealIcon = com.formdev.flatlaf.icons.FlatRevealIcon + + +#---- Popup ---- + +Popup.borderCornerRadius = 4 +Popup.dropShadowPainted = true +Popup.dropShadowInsets = -4,-4,4,4 +Popup.dropShadowColor = #000 +Popup.dropShadowOpacity = 0.15 + + +#---- PopupMenu ---- + +PopupMenu.border = com.formdev.flatlaf.ui.FlatPopupMenuBorder +PopupMenu.borderInsets = 4,1,4,1 +PopupMenu.borderCornerRadius = $Popup.borderCornerRadius +PopupMenu.background = @menuBackground +PopupMenu.scrollArrowColor = @buttonArrowColor +PopupMenu.borderColor = shade(@background,28%) +PopupMenu.hoverScrollArrowBackground = darken(@background,5%) + +#---- PopupMenuSeparator ---- + +PopupMenuSeparator.height = 9 +PopupMenuSeparator.stripeWidth = 1 +PopupMenuSeparator.stripeIndent = 4 + + +#---- ProgressBar ---- + +ProgressBar.border = com.formdev.flatlaf.ui.FlatEmptyBorder +ProgressBar.arc = 4 +ProgressBar.horizontalSize = 146,4 +ProgressBar.verticalSize = 4,146 +ProgressBar.cycleTime = 4000 +ProgressBar.repaintInterval = 15 +ProgressBar.font = -2 +ProgressBar.background = darken(@background,13%) +ProgressBar.foreground = @accentSliderColor +ProgressBar.selectionBackground = @foreground +ProgressBar.selectionForeground = contrast($ProgressBar.foreground, @foreground, @componentBackground) + + +#---- RadioButton ---- + +RadioButton.border = com.formdev.flatlaf.ui.FlatMarginBorder +RadioButton.icon = com.formdev.flatlaf.icons.FlatRadioButtonIcon +RadioButton.icon.centerDiameter = 8 +RadioButton.icon[filled].centerDiameter = 5 +RadioButton.margin = 2,2,2,2 +RadioButton.iconTextGap = 4 +RadioButton.rollover = true + + +#---- RadioButtonMenuItem ---- + +RadioButtonMenuItem.border = com.formdev.flatlaf.ui.FlatMenuItemBorder +RadioButtonMenuItem.checkIcon = com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon +RadioButtonMenuItem.arrowIcon = com.formdev.flatlaf.icons.FlatMenuItemArrowIcon +RadioButtonMenuItem.margin = @menuItemMargin +RadioButtonMenuItem.opaque = false +RadioButtonMenuItem.borderPainted = true +RadioButtonMenuItem.background = @menuBackground + + +#---- RootPane ---- + +RootPane.border = com.formdev.flatlaf.ui.FlatRootPaneUI$FlatWindowBorder +RootPane.borderDragThickness = 5 +RootPane.cornerDragWidth = 16 +RootPane.honorFrameMinimumSizeOnResize = false +RootPane.honorDialogMinimumSizeOnResize = true +RootPane.activeBorderColor = darken(@background,50%,derived) +RootPane.inactiveBorderColor = darken(@background,30%,derived) + + +#---- ScrollBar ---- + +ScrollBar.width = 10 +ScrollBar.minimumButtonSize = 12,12 +ScrollBar.minimumThumbSize = 10,10 +ScrollBar.maximumThumbSize = 100000,100000 +ScrollBar.trackInsets = 0,0,0,0 +ScrollBar.thumbInsets = 0,0,0,0 +ScrollBar.trackArc = 0 +ScrollBar.thumbArc = 0 +ScrollBar.hoverThumbWithTrack = false +ScrollBar.pressedThumbWithTrack = false +ScrollBar.showButtons = false +ScrollBar.squareButtons = false +ScrollBar.buttonArrowColor = @buttonArrowColor +ScrollBar.buttonDisabledArrowColor = @buttonDisabledArrowColor +ScrollBar.allowsAbsolutePositioning = true + +[mac]ScrollBar.minimumThumbSize = 18,18 +[mac]ScrollBar.thumbInsets = 2,2,2,2 +[mac]ScrollBar.thumbArc = 999 +[mac]ScrollBar.hoverThumbWithTrack = true + +[linux]ScrollBar.minimumThumbSize = 18,18 +[linux]ScrollBar.thumbInsets = 2,2,2,2 +[linux]ScrollBar.thumbArc = 999 + +ScrollBar.track = lighten(@background,1%,derived noAutoInverse) +ScrollBar.thumb = darken($ScrollBar.track,10%,derived noAutoInverse) +ScrollBar.hoverTrackColor = darken($ScrollBar.track,3%,derived noAutoInverse) +ScrollBar.hoverThumbColor = darken($ScrollBar.thumb,10%,derived noAutoInverse) +ScrollBar.pressedThumbColor = darken($ScrollBar.thumb,20%,derived noAutoInverse) +ScrollBar.hoverButtonBackground = darken(@background,5%,derived noAutoInverse) +ScrollBar.pressedButtonBackground = darken(@background,10%,derived noAutoInverse) + + +#---- ScrollPane ---- + +ScrollPane.border = com.formdev.flatlaf.ui.FlatBorder +ScrollPane.background = $ScrollBar.track +ScrollPane.fillUpperCorner = true +ScrollPane.smoothScrolling = true + + +#---- SearchField ---- + +SearchField.searchIconColor = fade(Actions.GreyInline,90%,lazy) +SearchField.searchIconHoverColor = fade(Actions.GreyInline,70%,lazy) +SearchField.searchIconPressedColor = fade(Actions.GreyInline,50%,lazy) + +SearchField.clearIconColor = fade(Actions.GreyInline,50%,lazy) +SearchField.clearIconHoverColor = $SearchField.clearIconColor +SearchField.clearIconPressedColor = fade(Actions.GreyInline,80%,lazy) + + +#---- Separator ---- + +Separator.height = 3 +Separator.stripeWidth = 1 +Separator.stripeIndent = 1 +Separator.foreground = shade(@background,15%) + + +#---- Slider ---- + +Slider.focusInsets = 0,0,0,0 +Slider.trackWidth = 2 +Slider.thumbSize = 12,12 +Slider.focusWidth = 4 +Slider.trackValueColor = @accentSliderColor +Slider.trackColor = darken(@background,18%) +Slider.thumbColor = $Slider.trackValueColor +Slider.tickColor = @disabledForeground +Slider.focusedColor = fade(changeLightness($Component.focusColor,75%,derived),50%,derived) +Slider.hoverThumbColor = darken($Slider.thumbColor,5%,derived) +Slider.pressedThumbColor = darken($Slider.thumbColor,8%,derived) +Slider.disabledTrackColor = darken(@background,13%) +Slider.disabledThumbColor = $Slider.disabledTrackColor + + +#---- Spinner ---- + +Spinner.border = com.formdev.flatlaf.ui.FlatRoundBorder +Spinner.background = @componentBackground +Spinner.buttonBackground = darken($Spinner.background,2%) +Spinner.buttonSeparatorColor = $Component.borderColor +Spinner.buttonDisabledSeparatorColor = $Component.disabledBorderColor +Spinner.buttonArrowColor = @buttonArrowColor +Spinner.buttonDisabledArrowColor = @buttonDisabledArrowColor +Spinner.buttonHoverArrowColor = @buttonHoverArrowColor +Spinner.buttonPressedArrowColor = @buttonPressedArrowColor +Spinner.padding = @componentMargin +Spinner.editorBorderPainted = false +# allowed values: button or none +Spinner.buttonStyle = button + + +#---- SplitPane ---- + +SplitPane.dividerSize = 5 +SplitPane.continuousLayout = true +SplitPane.border = null +SplitPane.centerOneTouchButtons = true +SplitPane.oneTouchButtonSize = {scaledInteger}6 +SplitPane.oneTouchButtonOffset = {scaledInteger}2 + +SplitPaneDivider.border = null +SplitPaneDivider.oneTouchArrowColor = @buttonArrowColor +SplitPaneDivider.oneTouchHoverArrowColor = @buttonHoverArrowColor +SplitPaneDivider.oneTouchPressedArrowColor = @buttonPressedArrowColor +# allowed values: grip or plain +SplitPaneDivider.style = grip +SplitPaneDivider.gripColor = @icon +SplitPaneDivider.gripDotCount = 3 +SplitPaneDivider.gripDotSize = 3 +SplitPaneDivider.gripGap = 2 +SplitPaneDivider.draggingColor = $Component.borderColor + + +#---- TabbedPane ---- + +TabbedPane.tabHeight = 32 +TabbedPane.tabSelectionHeight = 3 +TabbedPane.cardTabSelectionHeight = 3 +TabbedPane.tabArc = 0 +TabbedPane.tabSelectionArc = 0 +TabbedPane.cardTabArc = 12 +TabbedPane.selectedInsets = 0,0,0,0 +TabbedPane.tabSelectionInsets = 0,0,0,0 +TabbedPane.contentSeparatorHeight = 1 +TabbedPane.showTabSeparators = false +TabbedPane.tabSeparatorsFullHeight = false +TabbedPane.hasFullBorder = false +TabbedPane.tabInsets = 4,12,4,12 +TabbedPane.tabAreaInsets = 0,0,0,0 +TabbedPane.selectedTabPadInsets = 0,0,0,0 +TabbedPane.tabRunOverlay = 0 +TabbedPane.tabsOverlapBorder = false +TabbedPane.disabledForeground = @disabledForeground +TabbedPane.shadow = @background +TabbedPane.contentBorderInsets = null +# allowed values: moreTabsButton or arrowButtons +TabbedPane.hiddenTabsNavigation = moreTabsButton +# allowed values: leading, trailing, center or fill +TabbedPane.tabAreaAlignment = leading +# allowed values: leading, trailing or center +TabbedPane.tabAlignment = center +# allowed values: preferred, equal or compact +TabbedPane.tabWidthMode = preferred + +# allowed values: underlined or card +TabbedPane.tabType = underlined + +# allowed values: chevron or triangle +TabbedPane.arrowType = chevron +TabbedPane.buttonInsets = 2,1,2,1 +TabbedPane.buttonArc = $Button.arc + +# allowed values: wrap or scroll +#TabbedPane.tabLayoutPolicy = scroll +# allowed values: never or asNeeded +TabbedPane.tabsPopupPolicy = asNeeded +# allowed values: never, asNeeded or asNeededSingle +TabbedPane.scrollButtonsPolicy = asNeededSingle +# allowed values: both or trailing +TabbedPane.scrollButtonsPlacement = both + +TabbedPane.closeIcon = com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon +TabbedPane.closeSize = 16,16 +TabbedPane.closeArc = 4 +TabbedPane.closeCrossPlainSize = 7.5 +TabbedPane.closeCrossFilledSize = $TabbedPane.closeCrossPlainSize +TabbedPane.closeCrossLineWidth = 1 + +TabbedPane.underlineColor = @accentUnderlineColor +TabbedPane.inactiveUnderlineColor = mix(@accentUnderlineColor,$TabbedPane.background,50%) +TabbedPane.disabledUnderlineColor = darken(@background,28%) +TabbedPane.hoverColor = darken($TabbedPane.background,7%,derived) +TabbedPane.focusColor = mix(@selectionBackground,$TabbedPane.background,10%) +TabbedPane.contentAreaColor = $Component.borderColor + +TabbedPane.buttonHoverBackground = darken($TabbedPane.background,7%,derived) +TabbedPane.buttonPressedBackground = darken($TabbedPane.background,10%,derived) + +TabbedPane.closeBackground = null +TabbedPane.closeForeground = @disabledForeground +TabbedPane.closeHoverBackground = darken($TabbedPane.background,20%,derived) +TabbedPane.closeHoverForeground = @foreground +TabbedPane.closePressedBackground = darken($TabbedPane.background,25%,derived) +TabbedPane.closePressedForeground = $TabbedPane.closeHoverForeground + + +#---- Table ---- + +Table.rowHeight = 20 +Table.showHorizontalLines = false +Table.showVerticalLines = false +Table.showTrailingVerticalLine = false +Table.consistentHomeEndKeyBehavior = true +Table.intercellSpacing = 0,0 +Table.scrollPaneBorder = com.formdev.flatlaf.ui.FlatBorder +Table.ascendingSortIcon = com.formdev.flatlaf.icons.FlatAscendingSortIcon +Table.descendingSortIcon = com.formdev.flatlaf.icons.FlatDescendingSortIcon +Table.sortIconColor = @icon +Table.cellMargins = 2,3,2,3 +Table.cellFocusColor = @cellFocusColor +Table.cellNoFocusBorder = com.formdev.flatlaf.ui.FlatTableCellBorder$Default +Table.focusCellHighlightBorder = com.formdev.flatlaf.ui.FlatTableCellBorder$Focused +Table.focusSelectedCellHighlightBorder = com.formdev.flatlaf.ui.FlatTableCellBorder$Selected +Table.focusCellBackground = $Table.background +Table.focusCellForeground = $Table.foreground +Table.background = @componentBackground +Table.selectionInactiveBackground = @selectionInactiveBackground +Table.selectionInactiveForeground = @selectionInactiveForeground +Table.dropCellBackground = @dropCellBackground +Table.dropCellForeground = @dropCellForeground +Table.dropLineColor = @dropLineColor +Table.dropLineShortColor = @dropLineShortColor +Table.gridColor = darken($Table.background,8%) + + +#---- TableHeader ---- + +TableHeader.height = 25 +TableHeader.cellBorder = com.formdev.flatlaf.ui.FlatTableHeaderBorder +TableHeader.cellMargins = 2,3,2,3 +TableHeader.focusCellBackground = $TableHeader.background +TableHeader.background = @componentBackground +TableHeader.showTrailingVerticalLine = false +TableHeader.hoverBackground = darken($TableHeader.background,5%,derived) +TableHeader.pressedBackground = darken($TableHeader.background,10%,derived) +TableHeader.separatorColor = darken($TableHeader.background,10%) +TableHeader.bottomSeparatorColor = $TableHeader.separatorColor + + +#---- TextArea ---- + +TextArea.border = com.formdev.flatlaf.ui.FlatMarginBorder +TextArea.margin = @componentMargin +TextArea.background = @componentBackground + + +#---- TextComponent ---- + +# allowed values: never, once or always +TextComponent.selectAllOnFocusPolicy = once +TextComponent.selectAllOnMouseClick = false +TextComponent.arc = 0 + + +#---- TextField ---- + +TextField.border = com.formdev.flatlaf.ui.FlatTextBorder +TextField.margin = @componentMargin +TextField.background = @componentBackground +TextField.placeholderForeground = @disabledForeground +TextField.iconTextGap = 4 + + +#---- TextPane ---- + +TextPane.border = com.formdev.flatlaf.ui.FlatMarginBorder +TextPane.margin = @componentMargin +TextPane.background = @componentBackground + + +#---- TitledBorder ---- + +TitledBorder.titleColor = @foreground +TitledBorder.border = 1,1,1,1,$Separator.foreground + +#---- TitlePane ---- + +TitlePane.useWindowDecorations = true +TitlePane.menuBarEmbedded = true +TitlePane.unifiedBackground = true +TitlePane.showIcon = true +TitlePane.showIconInDialogs = true +TitlePane.noIconLeftGap = 8 +TitlePane.iconSize = 16,16 +TitlePane.iconMargins = 3,8,3,8 +TitlePane.titleMargins = 3,0,3,0 +TitlePane.titleMinimumWidth = 60 +TitlePane.buttonSize = 44,30 +TitlePane.buttonMinimumWidth = 30 +TitlePane.buttonMaximizedHeight = 22 +TitlePane.buttonSymbolHeight = 10 +TitlePane.centerTitle = false +TitlePane.centerTitleIfMenuBarEmbedded = true +TitlePane.showIconBesideTitle = false +TitlePane.menuBarTitleGap = 40 +TitlePane.menuBarTitleMinimumGap = 12 +TitlePane.menuBarResizeHeight = 4 +TitlePane.closeIcon = com.formdev.flatlaf.icons.FlatWindowCloseIcon +TitlePane.iconifyIcon = com.formdev.flatlaf.icons.FlatWindowIconifyIcon +TitlePane.maximizeIcon = com.formdev.flatlaf.icons.FlatWindowMaximizeIcon +TitlePane.restoreIcon = com.formdev.flatlaf.icons.FlatWindowRestoreIcon + +TitlePane.background = $MenuBar.background +TitlePane.inactiveBackground = $TitlePane.background +TitlePane.foreground = @foreground +TitlePane.inactiveForeground = @disabledForeground + +TitlePane.closeHoverBackground = #c42b1c +TitlePane.closePressedBackground = fade($TitlePane.closeHoverBackground,90%) +TitlePane.closeHoverForeground = #fff +TitlePane.closePressedForeground = #fff + +# window style "small" +TitlePane.small.font = -1 +TitlePane.small.showIcon = false +TitlePane.small.buttonSize = 30,20 +TitlePane.small.buttonSymbolHeight = 8 +TitlePane.small.closeIcon = com.formdev.flatlaf.icons.FlatWindowCloseIcon, small +TitlePane.small.iconifyIcon = com.formdev.flatlaf.icons.FlatWindowIconifyIcon, small +TitlePane.small.maximizeIcon = com.formdev.flatlaf.icons.FlatWindowMaximizeIcon, small +TitlePane.small.restoreIcon = com.formdev.flatlaf.icons.FlatWindowRestoreIcon, small + +TitlePane.embeddedForeground = lighten($TitlePane.foreground,35%) +TitlePane.buttonHoverBackground = darken($TitlePane.background,10%,derived) +TitlePane.buttonPressedBackground = darken($TitlePane.background,8%,derived) + + +#---- ToggleButton ---- + +ToggleButton.border = $Button.border +ToggleButton.margin = $Button.margin +ToggleButton.iconTextGap = $Button.iconTextGap +ToggleButton.rollover = $Button.rollover + +ToggleButton.background = $Button.background +ToggleButton.pressedBackground = $Button.pressedBackground +ToggleButton.selectedForeground = $ToggleButton.foreground + +ToggleButton.toolbar.hoverBackground = $Button.toolbar.hoverBackground +ToggleButton.toolbar.pressedBackground = $Button.toolbar.pressedBackground + +# button type "tab" +ToggleButton.tab.underlineHeight = 0 +ToggleButton.tab.underlineColor = $TabbedPane.underlineColor +ToggleButton.tab.disabledUnderlineColor = $TabbedPane.disabledUnderlineColor +ToggleButton.tab.selectedBackground = #FFFFFF +ToggleButton.tab.selectedForeground = $?TabbedPane.selectedForeground +ToggleButton.tab.hoverBackground = $TabbedPane.hoverColor +ToggleButton.tab.focusBackground = #FFFFFF +ToggleButton.tab.arc = $Component.arc + +ToggleButton.selectedBackground = darken($ToggleButton.background,20%,derived) +ToggleButton.disabledSelectedBackground = darken($ToggleButton.background,13%,derived) + +ToggleButton.toolbar.selectedBackground = $ToggleButton.selectedBackground + +#---- HeadGroup ---- +HeadGroup.background= #E9ECF1 +HeadGroup.arc= $Component.arc + +#---- ToolBar ---- + +ToolBar.border = com.formdev.flatlaf.ui.FlatToolBarBorder +ToolBar.borderMargins = 2,2,2,2 +ToolBar.isRollover = true +ToolBar.focusableButtons = false +ToolBar.arrowKeysOnlyNavigation = true +ToolBar.hoverButtonGroupArc = 8 +ToolBar.floatable = false +ToolBar.gripColor = @icon +ToolBar.dockingBackground = darken($ToolBar.background,5%) +ToolBar.dockingForeground = $Component.borderColor +ToolBar.floatingBackground = $ToolBar.background +ToolBar.floatingForeground = $Component.borderColor + +ToolBar.separatorSize = null +ToolBar.separatorWidth = 7 +ToolBar.separatorColor = $Separator.foreground + +# not used in FlatLaf; intended for custom components in toolbar +# https://github.com/JFormDesigner/FlatLaf/issues/56#issuecomment-586297814 +ToolBar.spacingBorder = $Button.toolbar.spacingInsets + +ToolBar.hoverButtonGroupBackground = darken($ToolBar.background,3%,derived) + + +#---- ToolTipManager ---- + +ToolTipManager.enableToolTipMode = activeApplication + + +#---- ToolTip ---- + +ToolTip.borderCornerRadius = $Popup.borderCornerRadius +ToolTip.border = 4,6,4,6,shade(@background,40%) +ToolTip.background = lighten(@background,3%) + + +#---- Tree ---- + +Tree.border = 1,1,1,1 +Tree.editorBorder = 1,1,1,1,@cellFocusColor +Tree.background = @componentBackground +Tree.selectionInactiveBackground = @selectionInactiveBackground +Tree.selectionInactiveForeground = @selectionInactiveForeground +Tree.textBackground = $Tree.background +Tree.textForeground = $Tree.foreground +Tree.selectionBorderColor = @cellFocusColor +Tree.dropCellBackground = @dropCellBackground +Tree.dropCellForeground = @dropCellForeground +Tree.dropLineColor = @dropLineColor +Tree.rendererFillBackground = false +Tree.rendererMargins = 1,2,1,2 +Tree.selectionInsets = 0,0,0,0 +Tree.selectionArc = 0 +Tree.wideSelection = true +Tree.repaintWholeRow = true +Tree.paintLines = false +Tree.showCellFocusIndicator = false +Tree.showDefaultIcons = false +Tree.leftChildIndent = 7 +Tree.rightChildIndent = 11 +Tree.rowHeight = 0 + +Tree.expandedIcon = com.formdev.flatlaf.icons.FlatTreeExpandedIcon +Tree.collapsedIcon = com.formdev.flatlaf.icons.FlatTreeCollapsedIcon +Tree.leafIcon = com.formdev.flatlaf.icons.FlatTreeLeafIcon +Tree.closedIcon = com.formdev.flatlaf.icons.FlatTreeClosedIcon +Tree.openIcon = com.formdev.flatlaf.icons.FlatTreeOpenIcon + +Tree.icon.expandedColor = @icon +Tree.icon.collapsedColor = @icon +Tree.icon.leafColor = @icon +Tree.icon.closedColor = @icon +Tree.icon.openColor = @icon +Tree.hash = darken($Tree.background,10%) + +#---- East ---- +East.border = #E9EDF2 + +#---- Styles ------------------------------------------------------------------ + +#---- inTextField ---- +# for leading/trailing components in text fields + +[style]ToggleButton.inTextField = $[style]Button.inTextField + +[style]ToolBar.inTextField = \ + floatable: false; \ + opaque: false; \ + borderMargins: 0,0,0,0 + +[style]ToolBarSeparator.inTextField = \ + separatorWidth: 3 + +[style]Button.inTextField = \ + focusable: false; \ + toolbar.margin: 1,1,1,1; \ + toolbar.spacingInsets: 1,1,1,1; \ + toolbar.hoverBackground: darken($TextField.background,4%); \ + toolbar.pressedBackground: darken($TextField.background,8%); \ + toolbar.selectedBackground: darken($TextField.background,12%) + +#---- clearButton ---- +# for clear/cancel button in text fields + +[style]Button.clearButton = \ + icon: com.formdev.flatlaf.icons.FlatClearIcon; \ + focusable: false; \ + toolbar.margin: 1,1,1,1; \ + toolbar.spacingInsets: 1,1,1,1; \ + toolbar.hoverBackground: null; \ + toolbar.pressedBackground: null \ No newline at end of file diff --git a/designer-chart/build.chart.gradle b/designer-chart/build.chart.gradle index 806b92aaba..943404fc84 100644 --- a/designer-chart/build.chart.gradle +++ b/designer-chart/build.chart.gradle @@ -63,7 +63,7 @@ dependencies{ compile fileTree(dir:"../${baseDir}/lib-core",include:'**/*.jar') compile fileTree(dir:"../${baseDir}/lib-design",include:'**/*.jar') compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar") - testCompile 'junit:junit:4.12' + testImplementation 'junit:junit:4.12' } //复制非.java文件到classes文件夹下参与打包 task copyFile(type:Copy,dependsOn:compileJava){ diff --git a/designer-chart/build.gradle b/designer-chart/build.gradle index e59f9ef2f8..3d646c1b93 100644 --- a/designer-chart/build.gradle +++ b/designer-chart/build.gradle @@ -1,3 +1,3 @@ dependencies { - compile project(':designer-base') + api project(':designer-base') } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index 6064ef89d0..0589ad8321 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -102,7 +102,6 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare } } }; - tabsHeaderIconPane.setNeedLeftRightOutLine(false); this.add(tabsHeaderIconPane, BorderLayout.NORTH); this.add(center, BorderLayout.CENTER); } diff --git a/designer-form/build.form.gradle b/designer-form/build.form.gradle index 42b16b0208..ec55d54d49 100644 --- a/designer-form/build.form.gradle +++ b/designer-form/build.form.gradle @@ -66,7 +66,7 @@ dependencies{ compile fileTree(dir:"../${baseDir}/lib-core",include:"**/*.jar") compile fileTree(dir:"../${baseDir}/lib-design",include:'**/*.jar') compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar") - testCompile 'junit:junit:4.12' + testImplementation 'junit:junit:4.12' } //复制非.java文件到classes文件夹下参与打包 diff --git a/designer-form/build.gradle b/designer-form/build.gradle index e59f9ef2f8..3d646c1b93 100644 --- a/designer-form/build.gradle +++ b/designer-form/build.gradle @@ -1,3 +1,3 @@ dependencies { - compile project(':designer-base') + api project(':designer-base') } diff --git a/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java b/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java index 5aad58379c..0e344e083f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java +++ b/designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java @@ -1,7 +1,5 @@ package com.fr.design.designer.treeview; -import com.fr.base.BaseUtils; -import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.log.FineLoggerFactory; @@ -38,7 +36,7 @@ public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer { this.treeCellRender = ((XCreator) value).getComponentTreeCellRender(); } this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); - this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND); + this.setBackgroundNonSelectionColor(getBackground()); return this; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java index 0c86493485..4cd6072225 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java @@ -14,9 +14,7 @@ import com.fr.design.gui.itree.UITreeUI; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.StringUtils; -import java.awt.Rectangle; -import java.util.Stack; -import java.util.function.Consumer; + import javax.swing.BorderFactory; import javax.swing.DropMode; import javax.swing.JPanel; @@ -27,12 +25,12 @@ import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Point; +import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; @@ -42,6 +40,8 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Stack; +import java.util.function.Consumer; public class ComponentTree extends JTree { @@ -56,7 +56,7 @@ public class ComponentTree extends JTree { public ComponentTree(FormDesigner designer) { this.designer = designer; - this.setBackground(UIConstants.TREE_BACKGROUND); +// this.setBackground(UIConstants.TREE_BACKGROUND); setRootVisible(true); setCellRenderer(new ComponentTreeCellRenderer()); getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); @@ -66,7 +66,7 @@ public class ComponentTree extends JTree { this.refreshTreeRoot(); initListeners(); setEditable(true); - setUI(uiTreeUI); +// setUI(uiTreeUI); setBorder(BorderFactory.createEmptyBorder(PADDING_TOP, PADDING_LEFT, 0, 0)); } @@ -162,7 +162,7 @@ public class ComponentTree extends JTree { */ public void refreshUI() { updateUI(); - setUI(uiTreeUI); +// setUI(uiTreeUI); } @@ -525,7 +525,7 @@ public class ComponentTree extends JTree { PopupPreviewPane() { contentPane = new JPanel(); - contentPane.setBackground(Color.white); +// contentPane.setBackground(Color.white); this.setLayout(new BorderLayout()); this.add(contentPane, BorderLayout.CENTER); this.setOpaque(false); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java index fdb8881c70..17f07cdee6 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -10,7 +10,6 @@ import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.icontainer.UIScrollPane; -import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.menu.ShortCut; @@ -20,14 +19,10 @@ import com.fr.design.parameter.HierarchyTreePane; import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.Icon; -import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; import java.util.ArrayList; @@ -179,14 +174,14 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree private JPanel getToolBarPane() { UIToolbar toolBar = ToolBarDef.createJToolBar(); - toolBar.setUI(new UIToolBarUI() { - @Override - public void paint(Graphics g, JComponent c) { - Graphics2D g2 = (Graphics2D) g; - g2.setColor(new Color(245, 245, 247)); - g2.fillRect(0, 0, c.getWidth(), c.getHeight()); - } - }); +// toolBar.setUI(new UIToolBarUI() { +// @Override +// public void paint(Graphics g, JComponent c) { +// Graphics2D g2 = (Graphics2D) g; +// g2.setColor(new Color(245, 245, 247)); +// g2.fillRect(0, 0, c.getWidth(), c.getHeight()); +// } +// }); for (int i = 0; i < shorts.length; i++) { if (i == SHORTS_SEPARATOR_POS) { toolBar.addSeparator(new Dimension(2, 16)); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index e61e8a600e..8abb9d81cf 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -251,9 +251,9 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper List uiHeads = new ArrayList(){ private static final long serialVersionUID = -2456634893793575347L; { - add(new UIHead(tabTitles[0], 0)); - add(new UIHead(tabTitles[1], 1, !designer.isMultiSelection())); - add(new UIHead(tabTitles[2], 2, !designer.isMultiSelection())); + add(new UIHead(tabTitles[0])); + add(new UIHead(tabTitles[1], !designer.isMultiSelection())); + add(new UIHead(tabTitles[2], !designer.isMultiSelection())); } }; @@ -282,7 +282,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper tabbedPane.show(center, tabTitles[index]); } }; - tabsHeaderIconPane.setNeedLeftRightOutLine(true); tabsHeaderIconPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIConstants.SHADOW_GREY)); this.add(tabsHeaderIconPane, BorderLayout.NORTH); } diff --git a/designer-realize/build.gradle b/designer-realize/build.gradle index ffb6823e88..d926d5cfe3 100644 --- a/designer-realize/build.gradle +++ b/designer-realize/build.gradle @@ -1,4 +1,4 @@ dependencies { - compile project(':designer-form') - compile project(':designer-chart') + api project(':designer-form') + api project(':designer-chart') } diff --git a/designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollBar.java b/designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollBar.java index 0a61436564..3476b08740 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollBar.java +++ b/designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollBar.java @@ -3,19 +3,19 @@ */ package com.fr.design.cell.bar; -import java.awt.Adjustable; -import java.awt.Dimension; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; - -import javax.accessibility.AccessibleContext; -import javax.swing.*; - import com.fr.base.DynamicUnitList; import com.fr.design.mainframe.ElementCasePane; import com.fr.grid.GridUtils; import com.fr.report.ReportHelper; +import javax.accessibility.AccessibleContext; +import javax.swing.BoundedRangeModel; +import javax.swing.JScrollBar; +import java.awt.Adjustable; +import java.awt.Dimension; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; + /** * ScrollBar change its max value dynamically. */ @@ -99,9 +99,9 @@ public class DynamicScrollBar extends JScrollBar { } - public void updateUI() { - setUI(new DynamicScrollBarUI()); - } +// public void updateUI() { +// setUI(new DynamicScrollBarUI()); +// } @Override public void setValue(int value) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java index 2e034076fc..73f8aabba2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java @@ -12,9 +12,12 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; - -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; /** * 悬浮元素 @@ -92,11 +95,11 @@ public class ReportFloatPane extends JPanel { private UIButton createButtonUI() { UIButton createdButton = insertFloatMenu.createUIButton(); // 此按钮单独抽出,不应使用工具栏外观 - if (!createdButton.isOpaque()) { - createdButton.setOpaque(true); - createdButton.setNormalPainted(true); - createdButton.setBorderPaintedOnlyWhenPressed(false); - } +// if (!createdButton.isOpaque()) { +// createdButton.setOpaque(true); +// createdButton.setNormalPainted(true); +// createdButton.setBorderPaintedOnlyWhenPressed(false); +// } return createdButton; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java index 661c1f7bf1..c971264b9b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java @@ -13,13 +13,11 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.RemoveListener; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.main.impl.WorkBook; @@ -167,18 +165,18 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); } }; - leftButton.setUI(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), UIConstants.PROPERTY_PANE_BACKGROUND); - } else if (isRollOver(b)) { - GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.PROPERTY_PANE_BACKGROUND); - } else if (b.isNormalPainted()) { - GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); - } - } - }); +// leftButton.setUI(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), UIConstants.PROPERTY_PANE_BACKGROUND); +// } else if (isRollOver(b)) { +// GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.PROPERTY_PANE_BACKGROUND); +// } else if (b.isNormalPainted()) { +// GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); +// } +// } +// }); leftButton.set4ToolbarButton(); leftButton.setDisabledIcon(DISABLED_LEFT_ICON); rightButton = new UIButton(RIGHT_ICON) { @@ -187,18 +185,18 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); } }; - rightButton.setUI(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), UIConstants.PROPERTY_PANE_BACKGROUND); - } else if (isRollOver(b)) { - GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.PROPERTY_PANE_BACKGROUND); - } else if (b.isNormalPainted()) { - GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); - } - } - }); +// rightButton.setUI(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), UIConstants.PROPERTY_PANE_BACKGROUND); +// } else if (isRollOver(b)) { +// GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.PROPERTY_PANE_BACKGROUND); +// } else if (b.isNormalPainted()) { +// GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); +// } +// } +// }); rightButton.set4ToolbarButton(); rightButton.setDisabledIcon(DISABLED_RIGHT_ICON); buttonPane = new JPanel(new BorderLayout(3, 0)); @@ -452,7 +450,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse if (isNeedPaintAuthority) { g2d.setPaint(new GradientPaint(1, 1, UIConstants.AUTHORITY_SHEET_LIGHT, 1, getHeight() - 1, UIConstants.AUTHORITY_SHEET_DARK)); } else { - g2d.setPaint(new GradientPaint(1, 1, Color.WHITE, 1, getHeight() - 1, Color.WHITE)); + g2d.setPaint(new GradientPaint(1, 1, getBackground(), 1, getHeight() - 1, getBackground())); } GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); generalPath.moveTo((float) x[0], (float) y[0]); @@ -488,7 +486,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse if (isNeedPaintAuthority) { g2d.setPaint(UIConstants.AUTHORITY_SHEET_UNSELECTED); } else{ - g2d.setPaint(tabBackground); + g2d.setPaint(getBackground()); } GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); generalPath.moveTo((float) x[0], (float) y[0]); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java index 55580d304e..54f5bf381b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java @@ -3,12 +3,9 @@ package com.fr.design.mainframe.alphafine.component; import com.fr.base.svg.IconUtils; import com.fr.design.actions.help.alphafine.AlphaFineContext; import com.fr.design.actions.help.alphafine.AlphaFineListener; -import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.alphafine.AlphaFineHelper; -import com.fr.general.IOUtils; - import java.awt.AWTEvent; import java.awt.BorderLayout; @@ -36,7 +33,6 @@ public class AlphaFinePane extends BasicPane { refreshButton.set4ToolbarButton(); refreshButton.setRolloverEnabled(false); this.add(refreshButton); - this.setBackground(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND); refreshButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java index e5d9edfec2..9fa3d293fe 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java @@ -4,14 +4,14 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.alphafine.AlphaFineHelper; -import java.awt.Color; + +import javax.swing.JWindow; import java.awt.Dimension; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import javax.swing.JWindow; /** * @author hades @@ -25,7 +25,8 @@ public class QuestionWindow extends JWindow { private int pressX; private int pressY; private QuestionWindow() { - this.setBackground(new Color(0, 0, 0, 0)); +// this.setBackground(new Color(0, 0, 0, 0)); + this.setOpacity(0); questionPane.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java index 4205ea152c..34c4ea8e18 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java @@ -76,7 +76,6 @@ public class CellElementEditPane extends BasicPane { } } }; - tabsHeaderIconPane.setNeedLeftRightOutLine(false); downTitle = new JPanel(); downTitle.setLayout(new BorderLayout()); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideRegister.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideRegister.java index 537051153e..705e9b031f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideRegister.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideRegister.java @@ -3,7 +3,6 @@ package com.fr.design.mainframe.guide; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.guide.base.GuideGroup; import com.fr.design.mainframe.guide.base.GuideManager; -import com.fr.design.mainframe.guide.collect.GuideCollector; import com.fr.design.mainframe.guide.creator.layout.ChangeLayoutComponentGuide; import com.fr.design.mainframe.guide.creator.layout.UseLayoutAndComponentGuide; import com.fr.design.mainframe.guide.creator.theme.DownloadComponentPackageGuide; @@ -11,10 +10,10 @@ import com.fr.design.mainframe.guide.creator.theme.ThemeToggleGuide; public class GuideRegister { public static void register() { - GuideCollector.getInstance().loadFromFile(); - GuideManager.getInstance().clearAll(); - registerGroup(); - registerGuide(); +// GuideCollector.getInstance().loadFromFile(); +// GuideManager.getInstance().clearAll(); +// registerGroup(); +// registerGuide(); } private static void registerGroup() { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/SettingToolBar.java b/designer-realize/src/main/java/com/fr/design/webattr/SettingToolBar.java index 24f5bd190d..5a97f75eff 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/SettingToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/SettingToolBar.java @@ -1,22 +1,19 @@ package com.fr.design.webattr; -import java.awt.Color; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; +import com.fr.base.BaseUtils; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.Icon; -import com.fr.design.gui.ilable.UILabel; import javax.swing.JPanel; - -import com.fr.base.BaseUtils; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; - -import com.fr.design.utils.gui.GUICoreUtils; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; public class SettingToolBar extends JPanel { private Icon setIcon = BaseUtils.readIcon("com/fr/design/images/toolbarbtn/toolbarbtnsetting.png"); @@ -27,7 +24,7 @@ public class SettingToolBar extends JPanel { public SettingToolBar(String name,ToolBarPane toolBarPane) { super(); - this.setBackground(Color.lightGray); +// this.setBackground(Color.lightGray); this.add(new UILabel(name)); this.toolBarPane = toolBarPane; setButton = GUICoreUtils.createTransparentButton(setIcon, setIcon, setIcon); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java index a8cd06a9b3..868475b524 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java @@ -27,7 +27,6 @@ import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumnModel; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.event.ActionEvent; @@ -88,7 +87,7 @@ public class ToolBarDragPane extends WidgetToolBarPane { northToolBar = new ToolBarPane(); northToolBar.setPreferredSize(new Dimension(ImageObserver.WIDTH, 26)); - northToolBar.setBackground(Color.lightGray); +// northToolBar.setBackground(Color.lightGray); UIButton topButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/arrow/arrow_up.png")); topButton.setBorder(null); @@ -142,29 +141,29 @@ public class ToolBarDragPane extends WidgetToolBarPane { initLayoutTable(); JPanel center = FRGUIPaneFactory.createBorderLayout_S_Pane(); - center.setBackground(Color.WHITE); +// center.setBackground(Color.WHITE); center.add(topButton, BorderLayout.NORTH); JPanel small = FRGUIPaneFactory.createBorderLayout_S_Pane(); - small.setBackground(Color.WHITE); +// small.setBackground(Color.WHITE); small.add(new UILabel(StringUtils.BLANK), BorderLayout.NORTH); small.add(layoutTable, BorderLayout.CENTER); center.add(small, BorderLayout.CENTER); center.add(downButton, BorderLayout.SOUTH); southToolBar = new ToolBarPane(); southToolBar.setPreferredSize(new Dimension(ImageObserver.WIDTH, 26)); - southToolBar.setBackground(Color.lightGray); +// southToolBar.setBackground(Color.lightGray); JPanel movePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel northContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); SettingToolBar top = new SettingToolBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ToolBar_Top"), northToolBar); northContentPane.add(top, BorderLayout.EAST); northContentPane.add(northToolBar, BorderLayout.CENTER); - northContentPane.setBackground(Color.lightGray); +// northContentPane.setBackground(Color.lightGray); JPanel southContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); SettingToolBar bottom = new SettingToolBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ToolBar_Bottom"), southToolBar); southContentPane.add(bottom, BorderLayout.EAST); southContentPane.add(southToolBar, BorderLayout.CENTER); - southContentPane.setBackground(Color.lightGray); +// southContentPane.setBackground(Color.lightGray); movePane.add(northContentPane, BorderLayout.NORTH); movePane.add(center, BorderLayout.CENTER); @@ -180,7 +179,7 @@ public class ToolBarDragPane extends WidgetToolBarPane { layoutTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); layoutTable.setColumnSelectionAllowed(false); layoutTable.setRowSelectionAllowed(false); - layoutTable.setBackground(Color.WHITE); +// layoutTable.setBackground(Color.WHITE); layoutTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1 && !(SwingUtilities.isRightMouseButton(e)) && isEnabled) { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java index c5acde0a63..eaeb652486 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java @@ -8,11 +8,9 @@ import com.fr.design.gui.core.WidgetOption; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.ui.ToolBar; import com.fr.form.ui.Widget; - import com.fr.report.web.annotation.OldPrintMethod; import javax.swing.BorderFactory; -import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.TransferHandler; import java.awt.Component; @@ -156,7 +154,7 @@ public class ToolBarPane extends BasicBeanPane { this.validate(); this.repaint(); } - this.getFToolBar().setBackground(toolbar.getBackground()); +// this.getFToolBar().setBackground(toolbar.getBackground()); this.getFToolBar().setDefault(toolbar.isDefault()); setPopulateFinished(true); } 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 8928e5fb6f..6dfc1a51d4 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java @@ -105,7 +105,6 @@ public class CellWidgetCardPane extends BasicPane { tabbedPane.show(center, tabTitles[index]); } }; - tabsHeaderIconPane.setNeedLeftRightOutLine(true); tabsHeaderIconPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIConstants.SHADOW_GREY)); this.add(tabsHeaderIconPane, BorderLayout.NORTH); } diff --git a/designer-realize/src/main/java/com/fr/grid/GridCorner.java b/designer-realize/src/main/java/com/fr/grid/GridCorner.java index 2bbe3d9df0..700fd802dc 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridCorner.java +++ b/designer-realize/src/main/java/com/fr/grid/GridCorner.java @@ -41,13 +41,13 @@ public class GridCorner extends BaseGridComponent { Dimension size = this.getSize(); Rectangle2D rect2D = new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()); //paint background. - if (this.getBackground() != null) { - g2d.setPaint(this.getBackground()); +// if (this.getBackground() != null) { +// g2d.setPaint(this.getBackground()); +// GraphHelper.fill(g2d, rect2D); +// } else { + g2d.setPaint(reportPane.getGrid().getBackground()); GraphHelper.fill(g2d, rect2D); - } else { - g2d.setPaint(reportPane.getBackground()); - GraphHelper.fill(g2d, rect2D); - } +// } paintArc(g2d, size, time); diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index 60fb2c30ad..e0e59e4c4f 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -6,7 +6,6 @@ import com.fr.base.GraphHelper; import com.fr.base.Margin; import com.fr.base.PaperSize; import com.fr.base.Utils; -import com.fr.base.background.ColorBackground; import com.fr.base.background.ImageFileBackground; import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.base.vcs.DesignerMode; @@ -47,11 +46,11 @@ import com.fr.report.stable.ReportConstants; import com.fr.report.stable.ReportSettings; import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.WorkSheet; +import com.fr.script.CalculatorUtils; import com.fr.stable.AssistUtils; import com.fr.stable.ColumnRow; import com.fr.stable.Constants; import com.fr.stable.GraphDrawHelper; -import com.fr.script.CalculatorUtils; import com.fr.stable.unit.FU; import com.fr.stable.unit.UNIT; import com.fr.third.antlr.ANTLRException; @@ -83,6 +82,7 @@ import java.util.List; import java.util.Objects; public class GridUI extends ComponentUI { + private static final String uiClassID = "GridUI"; public static int INVALID_INTEGER = Integer.MIN_VALUE;// 作为不合法的数值. protected Dimension gridSize; @@ -101,8 +101,6 @@ public class GridUI extends ComponentUI { protected List paintCellElementRectangleList = new ArrayList(); protected List paginateLineList = new ArrayList(); // 分页线 protected HashMultimap mergeCellElementTable = HashMultimap.create(); - // 为了画白色的背景. - protected static Background WHITE_Backgorund = ColorBackground.getInstance(Color.WHITE); // CellElementPainter protected CellElementPainter painter = new CellElementPainter(); // Left @@ -122,6 +120,11 @@ public class GridUI extends ComponentUI { private boolean isAuthority = false; + public String getUIClassID() { + return uiClassID; + } + + public GridUI(int resolution) { super(); this.resolution = resolution; diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index f93cbfc3d6..9fcdecbe18 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -168,7 +168,6 @@ public class CellDSColumnEditor extends CellQuickEditor { paneList.get(index).populate(); } }; - tabsHeaderIconPane.setNeedLeftRightOutLine(false); } /** diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 98a4d4c76e..f02b061343 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -1,6 +1,7 @@ package com.fr.start; +import com.fanruan.gui.UiInspector; import com.fr.base.function.UITerminator; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; @@ -47,6 +48,7 @@ import com.fr.design.module.DesignModuleFactory; import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.design.notification.ui.NotificationCenterPane; import com.fr.design.share.SharableManager; +import com.fr.design.ui.util.EdtInvocationManager; import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignerPort; @@ -86,7 +88,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; @@ -117,21 +118,21 @@ public class MainDesigner extends BaseDesigner { * @param args 参数 */ public static void main(String[] args) { - + DesignerStartupContext.getRecorder().start(); - + DesignerEnvManager.getEnvManager(); - + startPreload0(); - + DesignerLifecycleMonitorContext.getMonitor().beforeStart(); //启动运行时 FineRuntime.start(); //等 FineRuntime 启动后启动 DeepLinkManager.getInstance().start(args); - + startPreload1(); - + DesignerSubListener.getInstance().start(); EventDispatcher.listen(LifecycleErrorEvent.SELF, new Listener() { @Override @@ -140,7 +141,7 @@ public class MainDesigner extends BaseDesigner { } }); Module designerRoot = ModuleContext.parseRoot("designer-startup.xml"); - + FineLoggerFactory.getLogger().debug("Designer prepared.Time used {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS)); //传递启动参数 designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args)); @@ -157,24 +158,24 @@ public class MainDesigner extends BaseDesigner { FineLoggerFactory.getLogger().info("Designer started.Time used {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS)); SwitchForSwingChecker.initThreadMonitoring(); + new UiInspector(); + EdtInvocationManager.installEDTCheckers(); } - + /** * 在 {@link FineRuntime#start()} 运行后 */ private static void startPreload1() { - - CompletableFuture initLookAndFeel = CompletableFuture.runAsync(DesignUtils::initLookAndFeel); - PreLoadService.getInstance().addUIFuture(initLookAndFeel); - + + DesignUtils.initLookAndFeel(); showSplash(); } - + /** * 在 {@link FineRuntime#start()} 运行前 */ private static void startPreload0() { - + PreLoadService.getInstance().addRunnable(() -> { if (DesignUtils.isPortOccupied()) { UITerminator action = new UITerminator() { @@ -189,9 +190,9 @@ public class MainDesigner extends BaseDesigner { } }); } - + private static void showSplash() { - + // 快快显示启动画面 // vito: 这里必须用 wait, 不然会导致莫名其妙的问题 UIUtil.invokeAndWaitIfNeeded(new Runnable() { @@ -202,7 +203,7 @@ public class MainDesigner extends BaseDesigner { } }); } - + /** * 创建新建文件的快捷方式数组。 * @@ -217,6 +218,7 @@ public class MainDesigner extends BaseDesigner { MenuDef newOtherFileMenuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_New_Other_Template")); newOtherFileMenuDef.setIconPath("/com/fr/design/images/buttonicon/new_other"); try { + // todo:菜单 if (DesignModuleFactory.getNewFormAction() != null) { newOtherFileMenuDef.addShortCut((ShortCut) DesignModuleFactory.getNewFormAction().newInstance()); } @@ -250,7 +252,7 @@ public class MainDesigner extends BaseDesigner { menuDef.addShortCut( new WidgetManagerAction() ); - menuDef.addShortCut(new ChartPreStyleAction(), new ChartEmptyDataStyleAction(),new ChartMapEditorAction()); + menuDef.addShortCut(new ChartPreStyleAction(), new ChartEmptyDataStyleAction(), new ChartMapEditorAction()); } insertMenu(menuDef, MenuHandler.SERVER); @@ -501,7 +503,7 @@ public class MainDesigner extends BaseDesigner { return GuideEntryPane.getGuideEntryPane(); } - public Component createNotificationCenterPane(){ + public Component createNotificationCenterPane() { return NotificationCenterPane.getNotificationCenterPane(); } @@ -603,9 +605,9 @@ public class MainDesigner extends BaseDesigner { DesignerInteractionHistory historyCollector = DesignerInteractionHistory.getInstance(); historyCollector.saveXMLFile(); } - + private static SplashStrategy createSplash() { - + OemProcessor oemProcessor = OemHandler.findOem(); if (oemProcessor != null) { SplashStrategy splashStrategy = null; @@ -618,7 +620,7 @@ public class MainDesigner extends BaseDesigner { return splashStrategy; } } - + return new SplashCommon(); } } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 16a923df37..bbf5e3ee08 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -18,6 +18,7 @@ import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoa import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.NewFormAction; +import com.fr.design.actions.UpdateAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.BiasCellAction; import com.fr.design.actions.insert.cell.ChartCellAction; @@ -130,7 +131,6 @@ import com.fr.report.cell.cellattr.core.SubReport; import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.CellImagePainter; -import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; import com.fr.stable.os.support.OSBasedAction; @@ -299,38 +299,36 @@ public class DesignerActivator extends Activator implements Prepare { }); } - private static Class[] actionsForInsertCellElement() { + private static Class[] actionsForInsertCellElement() { List> classes = new ArrayList<>(); + classes.add(DSColumnCellAction.class); + classes.add(GeneralCellAction.class); + classes.add(RichTextCellAction.class); + classes.add(FormulaCellAction.class); + classes.add(ChartCellAction.class); + classes.add(ImageCellAction.class); + classes.add(BiasCellAction.class); + classes.add(SubReportCellAction.class); Set providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); for (ElementUIProvider provider : providers) { classes.add(provider.actionForInsertCellElement()); } - return ArrayUtils.addAll(new Class[]{ - DSColumnCellAction.class, - GeneralCellAction.class, - RichTextCellAction.class, - FormulaCellAction.class, - ChartCellAction.class, - ImageCellAction.class, - BiasCellAction.class, - SubReportCellAction.class - }, classes.toArray(new Class[classes.size()])); + return classes.toArray(new Class[0]); } - private static Class[] actionsForInsertFloatElement() { - List> classes = new ArrayList<>(); + private static Class[] actionsForInsertFloatElement() { + List> classes = new ArrayList<>(); + classes.add(TextBoxFloatAction.class); + classes.add(FormulaFloatAction.class); + classes.add(ChartFloatAction.class); + classes.add(ImageFloatAction.class); Set providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); for (ElementUIProvider provider : providers) { classes.add(provider.actionForInsertFloatElement()); } - return ArrayUtils.addAll(new Class[]{ - TextBoxFloatAction.class, - FormulaFloatAction.class, - ChartFloatAction.class, - ImageFloatAction.class - }, classes.toArray(new Class[classes.size()])); + return classes.toArray(new Class[0]); } private static NameableCreator[] hyperlinkTypes() { diff --git a/settings.gradle b/settings.gradle index 077d17597b..0bb22b5646 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,7 @@ pluginManagement { repositories { maven { - url 'http://mvn.finedevelop.com/repository/maven-public/' + url 'https://mvn.fanruan.com/repository/maven-public/' } gradlePluginPortal() }