Browse Source

REPORT-99485 适配主题,同步代码

newui
vito 1 year ago
parent
commit
7e1f6c1322
  1. 9
      build.gradle
  2. 12
      designer-base/build.base.gradle
  3. 11
      designer-base/src/main/java/com/fine/theme/light/icon/IconManager.java
  4. 93
      designer-base/src/main/java/com/fine/theme/light/ui/FineToggleButtonUI.java
  5. 24
      designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java
  6. 40
      designer-base/src/main/java/com/fine/theme/light/utils/FineUIUtils.java
  7. 22
      designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java
  8. 8
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java
  9. 3
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  10. 4
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  11. 2
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/TableDataSearchRemindPane.java
  12. 25
      designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java
  13. 47
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java
  14. 37
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  15. 4
      designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java
  16. 38
      designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java
  17. 25
      designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java
  18. 16
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  19. 30
      designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPane.java
  20. 39
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java
  21. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java
  22. 74
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java
  23. 52
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  24. 50
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonUI.java
  25. 23
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIHead.java
  26. 282
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java
  27. 31
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroupSingleSelectionModel.java
  28. 16
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java
  29. 13
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  30. 1
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  31. 12
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java
  32. 14
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIScrollPane.java
  33. 2
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  34. 73
      designer-base/src/main/java/com/fr/design/gui/imenu/UIHeadMenu.java
  35. 4
      designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java
  36. 119
      designer-base/src/main/java/com/fr/design/gui/imenu/UIMenu.java
  37. 8
      designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuBar.java
  38. 9
      designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuBarUI.java
  39. 10
      designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java
  40. 25
      designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuHighLight.java
  41. 9
      designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java
  42. 24
      designer-base/src/main/java/com/fr/design/gui/imenu/UIPopupMenu.java
  43. 14
      designer-base/src/main/java/com/fr/design/gui/imenu/UIScrollMenu.java
  44. 22
      designer-base/src/main/java/com/fr/design/gui/imenu/UIScrollPopUpMenu.java
  45. 6
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBar.java
  46. 1
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinnerUI.java
  47. 51
      designer-base/src/main/java/com/fr/design/gui/itable/UITable.java
  48. 2
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java
  49. 16
      designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java
  50. 7
      designer-base/src/main/java/com/fr/design/gui/itoolbar/UIToolbar.java
  51. 12
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  52. 17
      designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java
  53. 9
      designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java
  54. 2
      designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java
  55. 3
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  56. 97
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  57. 17
      designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java
  58. 19
      designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java
  59. 2
      designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java
  60. 17
      designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java
  61. 2
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java
  62. 2
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  63. 2
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java
  64. 3
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  65. 41
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/LookAndFeelAction.java
  66. 21
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  67. 14
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java
  68. 4
      designer-base/src/main/java/com/fr/design/mainframe/widget/editors/TextField.java
  69. 16
      designer-base/src/main/java/com/fr/design/menu/DottedSeparator.java
  70. 12
      designer-base/src/main/java/com/fr/design/menu/LineSeparator.java
  71. 18
      designer-base/src/main/java/com/fr/design/menu/NameSeparator.java
  72. 4
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java
  73. 3
      designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java
  74. 1
      designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java
  75. 12
      designer-base/src/main/java/com/fr/design/ui/util/UIUtil.java
  76. 4
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  77. 12
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  78. 29
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  79. 1077
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  80. 2
      designer-chart/build.chart.gradle
  81. 2
      designer-chart/build.gradle
  82. 1
      designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java
  83. 2
      designer-form/build.form.gradle
  84. 2
      designer-form/build.gradle
  85. 4
      designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java
  86. 16
      designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java
  87. 21
      designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java
  88. 7
      designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java
  89. 4
      designer-realize/build.gradle
  90. 22
      designer-realize/src/main/java/com/fr/design/cell/bar/DynamicScrollBar.java
  91. 19
      designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java
  92. 54
      designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java
  93. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java
  94. 7
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionWindow.java
  95. 1
      designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java
  96. 9
      designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideRegister.java
  97. 23
      designer-realize/src/main/java/com/fr/design/webattr/SettingToolBar.java
  98. 15
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java
  99. 4
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java
  100. 1
      designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java
  101. Some files were not shown because too many files have changed in this diff Show More

9
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.23M16.23jar还是需要留着
implementation 'com.fr.third:jxbrowser-mac:6.23'
implementation "com.fr.third:jxbrowser-mac-arm-v7:${jxBrowserVersion}"
}
} else if (OperatingSystem.current().isMacOsX()) {

12
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'
}
//

11
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 {
}

93
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类
* <p>
*
* @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);
}
}

24
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";
}
}

40
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);
}
}

22
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<Class<?>> actionClasses = new CopyOnWriteArraySet<>();
private static Set<Class<?>> floatActionClasses = new CopyOnWriteArraySet<>();
private static final Set<Class<? extends UpdateAction>> actionClasses = new CopyOnWriteArraySet<>();
private static final Set<Class<? extends UpdateAction>> 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<? extends UpdateAction>[] cls) {
if (cls != null) {
actionClasses.addAll(Arrays.asList(cls));
}
}
public static void referCellInsertActionClass(Class<?>[] cls) {
public static void referCellInsertActionClass(Class<? extends UpdateAction>[] cls) {
if (cls != null) {
actionClasses.clear();
actionClasses.addAll(Arrays.asList(cls));
@ -331,13 +331,13 @@ public class ActionFactory {
public static MenuKeySet[] createCellInsertActionName() {
List<MenuKeySet> actionNames = new ArrayList<>();
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
for (Class<?> clazz : actionClasses) {
for (Class<? extends UpdateAction> clazz : actionClasses) {
if (clazz == null) {
continue;
}
if (jTemplate.acceptToolbarItem(clazz)) {
try {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor();
Constructor<? extends UpdateAction> 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<? extends UpdateAction>[] cls) {
if (cls != null) {
floatActionClasses.addAll(Arrays.asList(cls));
}
}
public static void referFloatInsertActionClass(Class<?>[] cls) {
public static void referFloatInsertActionClass(Class<? extends UpdateAction>[] 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<UpdateAction> actions = new ArrayList<>();
for (Class<?> clazz : floatActionClasses) {
for (Class<? extends UpdateAction> clazz : floatActionClasses) {
if (clazz == null) {
continue;
}
try {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(cls);
Constructor<? extends UpdateAction> 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<Class, QuickEditor> editorMap, Map<Class, Class<? extends QuickEditor>> editorClassMap) {

8
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<TableDataSourceOP> {
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;
}
};

3
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);
}

4
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"));

2
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);

25
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);
}
});
}
}

47
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);
}
});
}
}

37
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()) {

4
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);

38
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

25
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(),
});
}

16
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() {

30
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<Integer, Void>() {
@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() {

39
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

2
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);

74
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);
}

52
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<T> 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);
}
}

50
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) {

23
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;
}
}

282
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<UIHead> uiHeads = new ArrayList<>();
protected List<UIToggleButton> 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<AbstractButton> 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<UIHead> heads) {
setModel(new UIHeadGroupSingleSelectionModel(heads));
intiContent();
}
public UIHeadGroup(List<UIHead> 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<UIHead> uiHeads) {
if (uiHeads != null) {
labelButtonList = new ArrayList<UIToggleButton>(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();
}
}
}

31
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<UIHead> dataList;
UIHeadGroupSingleSelectionModel(List<UIHead> dataList) {
this.dataList = dataList;
}
public UIHeadGroupSingleSelectionModel set(int index, UIHead head) {
dataList.add(index, head);
return this;
}
public List<UIHead> getDataList() {
return dataList;
}
}

16
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());
// }
/**

13
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);

1
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());

12
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;

14
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;
}

2
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);

73
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);
}

4
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);
}
// }
}
}

119
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是否隐藏

8
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());
// }
}

9
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());
}

10
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()) {

25
designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuHighLight.java

@ -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);
};
}

9
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) {

24
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);
}

14
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());
// }
/**

22
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);
}

6
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
/**
* 取得宽度

1
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.*;

51
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);
// }
/**
* 给组件登记一个观察者监听事件

2
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java

@ -51,7 +51,7 @@ public class UITableEditorPane<T> 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));

16
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);
}
/**

7
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);
}

12
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;
}
};

17
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);

9
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();

2
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);

3
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);

97
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);

17
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;

19
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();

2
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);
}

17
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);
}
}

2
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);
}

2
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"));

2
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);

3
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) {

41
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();
}
}

21
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');

14
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"));

4
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);
}
}

16
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);
}

12
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);
}

18
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);
}
}

4
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() {

3
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);
}
/**

1
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;

12
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> T waitUntil(Supplier<T> 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");
}
}

4
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);
}

12
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) {

29
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);
}

1077
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

File diff suppressed because it is too large Load Diff

2
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){

2
designer-chart/build.gradle

@ -1,3 +1,3 @@
dependencies {
compile project(':designer-base')
api project(':designer-base')
}

1
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);
}

2
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文件夹下参与打包

2
designer-form/build.gradle

@ -1,3 +1,3 @@
dependencies {
compile project(':designer-base')
api project(':designer-base')
}

4
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;
}

16
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);

21
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));

7
designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java

@ -251,9 +251,9 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
List<UIHead> uiHeads = new ArrayList<UIHead>(){
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);
}

4
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')
}

22
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) {

19
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;
}

54
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]);

4
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) {

7
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) {

1
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());

9
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() {

23
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);

15
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) {

4
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<ToolBar> {
this.validate();
this.repaint();
}
this.getFToolBar().setBackground(toolbar.getBackground());
// this.getFToolBar().setBackground(toolbar.getBackground());
this.getFToolBar().setDefault(toolbar.isDefault());
setPopulateFinished(true);
}

1
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);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save