Browse Source

Merge remote-tracking branch 'origin/newui' into newui

newui
Leo.Qin 10 months ago
parent
commit
597b227215
  1. 52
      designer-base/src/main/java/com/fine/theme/light/ui/FineTemplateListMenuItemUI.java
  2. 244
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java
  3. 12
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  4. 147
      designer-base/src/main/java/com/fr/design/file/TemplateListMenuItem.java
  5. 8
      designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java
  6. 50
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  7. 19
      designer-base/src/main/java/com/fr/design/gui/imenu/UIScrollPopUpMenu.java
  8. 15
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  9. 14
      designer-base/src/main/resources/com/fine/theme/icon/font/shadow.svg
  10. 1
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties

52
designer-base/src/main/java/com/fine/theme/light/ui/FineTemplateListMenuItemUI.java

@ -0,0 +1,52 @@
package com.fine.theme.light.ui;
import com.formdev.flatlaf.ui.FlatUIUtils;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.PanelUI;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.geom.RoundRectangle2D;
/**
* 模版列表菜单ui
*
* @author vito
* @since 11.0
* Created on 2024/1/11
*/
public class FineTemplateListMenuItemUI extends PanelUI {
/**
* 创建UI
*
* @param c 组件
* @return ComponentUI
*/
public static ComponentUI createUI(JComponent c) {
return new FineTemplateListMenuItemUI();
}
@Override
public void update(Graphics g, JComponent c) {
Color color = g.getColor();
g.setColor(c.getBackground());
Insets insets = c.getInsets();
Object[] old = FlatUIUtils.setRenderingHints(g);
((Graphics2D) g).fill(new RoundRectangle2D.Float(
insets.left, insets.top,
(float) c.getWidth() - insets.left - insets.right,
(float) c.getHeight() - insets.top - insets.bottom,
3, 3));
g.setColor(color);
FlatUIUtils.resetRenderingHints(g, old);
super.paint(g, c);
}
@Override
public void uninstallUI(JComponent c) {
super.uninstallUI(c);
}
}

244
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java

@ -1,42 +1,27 @@
package com.fr.design.file; package com.fr.design.file;
import com.fr.base.svg.IconUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIScrollPopUpMenu; import com.fr.design.gui.imenu.UIScrollPopUpMenu;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.TemplateUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.CollectionUtils; import com.fr.stable.collections.CollectionUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 右侧下拉菜单的工厂类 * 右侧下拉菜单的工厂类
*
* @author Carlson * @author Carlson
* @since 11.0 * @since 11.0
* created on 2023-04-14 * created on 2023-04-14
**/ **/
public class MultiTemplateTabMenuFactory { public class MultiTemplateTabMenuFactory {
private static final Icon CLOSE = IconUtils.readIcon("/com/fr/design/standard/close/close");
private static final Icon MOUSE_OVER_CLOSE = IconUtils.readIcon("/com/fr/design/standard/close/close_mouseover.svg");
private static final Icon MOUSE_PRESS_CLOSE = IconUtils.readIcon("/com/fr/design/standard/close/close_press.svg");
private static final int ITEM_SIZE = 25; private static final int ITEM_SIZE = 25;
@ -50,6 +35,7 @@ public class MultiTemplateTabMenuFactory {
/** /**
* 返回右侧下拉菜单的工厂类 * 返回右侧下拉菜单的工厂类
*
* @return * @return
*/ */
public static MultiTemplateTabMenuFactory getInstance() { public static MultiTemplateTabMenuFactory getInstance() {
@ -61,29 +47,12 @@ public class MultiTemplateTabMenuFactory {
*/ */
public UIScrollPopUpMenu createMenu() { public UIScrollPopUpMenu createMenu() {
menu = new UIScrollPopUpMenu(); menu = new UIScrollPopUpMenu();
menu.setBorder(BorderFactory.createEmptyBorder(-3, 3, 3, 0));
menu.add(initCloseOther()); menu.add(initCloseOther());
menu.add(createEmptyRow());
menu.addSeparator();
menu.add(createEmptyRow());
menu.add(createCategory(Toolkit.i18nText("Fine-Design_Basic_Tab_Current_Category_Templates")));
Component[] items = createCurrentCategory();
for (Component item : items) {
menu.add(item);
}
items = createOtherCategory();
if (items.length > 0) {
menu.addSeparator(); menu.addSeparator();
menu.add(createEmptyRow()); Component[] items = createCurrentTabs();
menu.add(createCategory(Toolkit.i18nText("Fine-Design_Basic_Tab_Other_Category_Templates")));
for (Component item : items) { for (Component item : items) {
menu.add(item); menu.add(item);
} }
}
Dimension dimension = menu.getPreferredSize();
dimension.width += ITEM_SIZE;
menu.setPreferredSize(dimension);
return menu; return menu;
} }
@ -91,18 +60,10 @@ public class MultiTemplateTabMenuFactory {
* 关闭其它按钮 * 关闭其它按钮
*/ */
private UIMenuItem initCloseOther() { private UIMenuItem initCloseOther() {
UIMenuItem closeOther = new UIMenuItem(Toolkit.i18nText("Fine-Design_Basic_Tab_Close_Other_Templates_Of_Current_Category")); UIMenuItem closeOther = new UIMenuItem(Toolkit.i18nText("Fine-Design_Close_Other_templates"));
closeOther.setHorizontalAlignment(SwingConstants.CENTER); closeOther.setHorizontalAlignment(SwingConstants.CENTER);
Dimension dimension = closeOther.getPreferredSize();
dimension.height = ITEM_SIZE;
closeOther.setPreferredSize(dimension);
String currentOperator = getCurrentTabOperatorType(); String currentOperator = getCurrentTabOperatorType();
closeOther.addActionListener(new ActionListener() { closeOther.addActionListener(e -> MultiTemplateTabPane.getInstance().closeOtherByOperatorType(currentOperator));
@Override
public void actionPerformed(ActionEvent e) {
MultiTemplateTabPane.getInstance().closeOtherByOperatorType(currentOperator);
}
});
if (MultiTemplateTabPane.getInstance().getOpenedJTemplatesByOperator(currentOperator).size() <= 1) { if (MultiTemplateTabPane.getInstance().getOpenedJTemplatesByOperator(currentOperator).size() <= 1) {
closeOther.setEnabled(false); closeOther.setEnabled(false);
} }
@ -124,26 +85,11 @@ public class MultiTemplateTabMenuFactory {
}; };
} }
/**
* 模板分类item
*/
private UIButton createCategory(String categoryName) {
UIButton button = new UIButton(categoryName);
button.setBorderPainted(false);
button.setExtraPainted(false);
button.setPreferredSize(new Dimension(menu.getWidth(), ITEM_SIZE));
button.setOpaque(true);
button.setBackground(UIConstants.NORMAL_BACKGROUND);
button.setHorizontalAlignment(SwingConstants.LEFT);
button.setForeground(UIConstants.FLESH_BLUE);
return button;
}
/** /**
* 创建 当前分类模板 item数组 * 创建 当前分类模板 item数组
*/ */
private Component[] createCurrentCategory() { private Component[] createCurrentTabs() {
return createListDownItem(MultiTemplateTabPane.getInstance().getOpenedJTemplatesByOperator(getCurrentTabOperatorType())); return createListDownItem(MultiTemplateTabPane.getInstance().getOpenedJTemplates());
} }
private String getCurrentTabOperatorType() { private String getCurrentTabOperatorType() {
@ -151,20 +97,6 @@ public class MultiTemplateTabMenuFactory {
return jTemplate.getTemplateTabOperatorType(); return jTemplate.getTemplateTabOperatorType();
} }
/**
* 创建 其它分类模板 item数组
*/
private Component[] createOtherCategory() {
String currentOperator = getCurrentTabOperatorType();
List<JTemplate<?, ?>> openedTemplates = new ArrayList<>();
Map<String, List<JTemplate<?, ?>>> map = MultiTemplateTabPane.getInstance().getOpenedJTemplatesByCategory();
for (Map.Entry<String, List<JTemplate<?, ?>>> entry : map.entrySet()) {
if (!StringUtils.equals(currentOperator, entry.getKey())) {
openedTemplates.addAll(entry.getValue());
}
}
return createListDownItem(openedTemplates);
}
/** /**
* 根据template列表创建多个item * 根据template列表创建多个item
@ -184,166 +116,8 @@ public class MultiTemplateTabMenuFactory {
* 根据template对象创建item * 根据template对象创建item
*/ */
private Component createListDownMenuItem(JTemplate<?, ?> template) { private Component createListDownMenuItem(JTemplate<?, ?> template) {
JPanel jPanel = new JPanel(); return new TemplateListMenuItem(menu, template);
jPanel.setPreferredSize(new Dimension(menu.getWidth(), ITEM_SIZE));
jPanel.setLayout(new BorderLayout());
MenuItemButtonGroup menuItemButtonGroup = new MenuItemButtonGroup(template);
if (template == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()) {
menuItemButtonGroup.templateButton.setForeground(UIConstants.FLESH_BLUE);
}
jPanel.add(menuItemButtonGroup.iconButton, BorderLayout.WEST);
jPanel.add(menuItemButtonGroup.templateButton, BorderLayout.CENTER);
jPanel.add(menuItemButtonGroup.closeButton, BorderLayout.EAST);
return jPanel;
}
/**
* menu的item由模板图标模板名模板关闭按钮组成
*/
private class MenuItemButtonGroup {
private final UIButton iconButton;
private final UIButton templateButton;
private final UIButton closeButton;
public MenuItemButtonGroup(JTemplate<?, ?> template) {
iconButton = createIconButton(template);
templateButton = createTemplateButton(template);
closeButton = createCloseButton();
initListener(template);
}
/**
* item[0] 模板图标按钮初始化
*/
private UIButton createIconButton(JTemplate<?, ?> template) {
UIButton button = new UIButton(template.getIcon(), template.getIcon(), template.getIcon());
button.setPreferredSize(new Dimension(ITEM_SIZE, ITEM_SIZE));
button.setOpaque(true);
button.setBackground(UIConstants.NORMAL_BACKGROUND);
return button;
}
/**
* item[1] 切换模板按钮初始化
*/
private UIButton createTemplateButton(JTemplate<?, ?> template) {
UIButton button = new UIButton(TemplateUtils.createLockeTemplatedName(template, template.getTemplateName()));
button.setBorderPainted(false);
button.setExtraPainted(false);
button.setPreferredSize(new Dimension(menu.getWidth() - ITEM_SIZE * 2, ITEM_SIZE));
button.setOpaque(true);
button.setBackground(UIConstants.NORMAL_BACKGROUND);
button.setHorizontalAlignment(SwingConstants.LEFT);
return button;
}
/**
* item[2] 关闭模板图标按钮初始化
*/
private UIButton createCloseButton() {
UIButton button = new UIButton(CLOSE, MOUSE_OVER_CLOSE, MOUSE_PRESS_CLOSE);
button.setPreferredSize(new Dimension(ITEM_SIZE, ITEM_SIZE));
button.setOpaque(true);
button.setBackground(UIConstants.NORMAL_BACKGROUND);
button.setVisible(false);
return button;
}
private void initListener(JTemplate<?, ?> template) {
initIconButtonListener();
initTemplateButtonListener(template);
initCloseButtonListener(template);
} }
/**
* item[0] 模板图标按钮鼠标事件
*/
private void initIconButtonListener() {
iconButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
fireMouseEnteredEvent();
}
@Override
public void mouseExited(MouseEvent e) {
fireMouseExitedEvent();
}
});
}
/**
* item[1] 切换模板按钮鼠标事件
*/
private void initTemplateButtonListener(JTemplate<?, ?> template) {
templateButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
menu.setVisible(false);
MultiTemplateTabPane.getInstance().switchJTemplate(template);
}
@Override
public void mouseEntered(MouseEvent e) {
fireMouseEnteredEvent();
}
@Override
public void mouseExited(MouseEvent e) {
fireMouseExitedEvent();
}
});
}
/**
* item[2] 关闭模板按钮鼠标事件
*/
private void initCloseButtonListener(JTemplate<?, ?> template) {
closeButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
menu.setVisible(false);
MultiTemplateTabPane.getInstance().setIsCloseCurrent(template == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate());
MultiTemplateTabPane.getInstance().closeFormat(template);
MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(template);
}
@Override
public void mouseEntered(MouseEvent e) {
fireMouseEnteredEvent();
}
@Override
public void mouseExited(MouseEvent e) {
fireMouseExitedEvent();
}
});
}
/**
* mouse移入item范围
*/
private void fireMouseEnteredEvent() {
iconButton.setBackground(UIConstants.HOVER_BLUE);
templateButton.setBackground(UIConstants.HOVER_BLUE);
closeButton.setBackground(UIConstants.HOVER_BLUE);
closeButton.setVisible(true);
}
/**
* mouse移出item范围
*/
private void fireMouseExitedEvent() {
iconButton.setBackground(UIConstants.NORMAL_BACKGROUND);
templateButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.setVisible(false);
}
}
} }

12
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

@ -48,6 +48,7 @@ import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter; import java.awt.event.MouseMotionAdapter;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -782,7 +783,7 @@ public class MultiTemplateTabPane extends Row {
private boolean isOverListDown(int evtX) { private boolean isOverListDown(int evtX) {
int maxWidth = getWidth() - scale(TRAILING_WIDTH) - scale(LEADING_WIDTH); int maxWidth = getWidth() - scale(LEADING_WIDTH);
return evtX >= (maxWidth + SMALLGAP) && evtX <= (getWidth() - SMALLGAP); return evtX >= (maxWidth + SMALLGAP) && evtX <= (getWidth() - SMALLGAP);
} }
@ -992,6 +993,15 @@ public class MultiTemplateTabPane extends Row {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* 获取所有模板
*
* @return 所有模板列表不可修改
*/
public List<JTemplate<?, ?>> getOpenedJTemplates() {
return Collections.unmodifiableList(openedTemplate);
}
/** /**
* 根据tab操作类型进行分类 * 根据tab操作类型进行分类
* *

147
designer-base/src/main/java/com/fr/design/file/TemplateListMenuItem.java

@ -0,0 +1,147 @@
package com.fr.design.file;
import com.fine.swing.ui.layout.Row;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.TemplateUtils;
import javax.swing.JPopupMenu;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import static com.fine.swing.ui.layout.Layouts.cell;
/**
* menu的item由模板图标模板名模板关闭按钮组成
*
* @author vito
* @since 9.0
* Created on 2015.1
*/
public class TemplateListMenuItem extends Row {
private static final String UI_CLASS_ID = "TemplateListMenuItemUI";
private static final int WIDTH = 200;
private final UIButton templateButton;
private final UIButton closeButton;
private final JPopupMenu menu;
public TemplateListMenuItem(JPopupMenu menu, JTemplate<?, ?> template) {
this.menu = menu;
templateButton = createTemplateButton(template);
closeButton = createCloseButton();
add(
cell(templateButton).weight(1),
cell(closeButton)
);
setBorder(new ScaledEmptyBorder(0, 4, 0, 4));
setPreferredSize(new Dimension(FineUIScale.scale(WIDTH), templateButton.getPreferredSize().height));
initListener(template);
}
@Override
public String getUIClassID() {
return UI_CLASS_ID;
}
/**
* item[1] 切换模板按钮初始化
*/
private UIButton createTemplateButton(JTemplate<?, ?> template) {
UIButton button = new UIButton(
TemplateUtils.createLockeTemplatedName(template, template.getTemplateName()), template.getIcon());
button.setContentAreaFilled(false);
button.setHorizontalAlignment(SwingConstants.LEFT);
return button;
}
/**
* item[2] 关闭模板图标按钮初始化
*/
private UIButton createCloseButton() {
UIButton button = new UIButton(
new LazyIcon("clear"),
new LazyIcon("clear_hover"),
new LazyIcon("clear_hover"));
button.setContentAreaFilled(false);
button.setVisible(false);
return button;
}
private void initListener(JTemplate<?, ?> template) {
initTemplateButtonListener(template);
initCloseButtonListener(template);
}
/**
* item[1] 切换模板按钮鼠标事件
*/
private void initTemplateButtonListener(JTemplate<?, ?> template) {
templateButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
menu.setVisible(false);
MultiTemplateTabPane.getInstance().switchJTemplate(template);
}
@Override
public void mouseEntered(MouseEvent e) {
fireMouseEnteredEvent();
}
@Override
public void mouseExited(MouseEvent e) {
fireMouseExitedEvent();
}
});
}
/**
* item[2] 关闭模板按钮鼠标事件
*/
private void initCloseButtonListener(JTemplate<?, ?> template) {
closeButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
menu.setVisible(false);
MultiTemplateTabPane.getInstance().setIsCloseCurrent(template == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate());
MultiTemplateTabPane.getInstance().closeFormat(template);
MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(template);
}
@Override
public void mouseEntered(MouseEvent e) {
fireMouseEnteredEvent();
}
@Override
public void mouseExited(MouseEvent e) {
fireMouseExitedEvent();
}
});
}
/**
* mouse移入item范围
*/
private void fireMouseEnteredEvent() {
TemplateListMenuItem.this.setBackground(UIManager.getColor("MenuItem.selectionBackground"));
closeButton.setVisible(true);
}
/**
* mouse移出item范围
*/
private void fireMouseExitedEvent() {
TemplateListMenuItem.this.setBackground(TemplateListMenuItem.this.getParent().getBackground());
closeButton.setVisible(false);
}
}

8
designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java

@ -27,6 +27,7 @@ public class HeaderPane extends JPanel {
private int fontSize; private int fontSize;
private final Icon triangleDown; private final Icon triangleDown;
private final Icon triangleRight; private final Icon triangleRight;
private static final int ICON_FIX = -2;
public void setPressed(boolean pressed) { public void setPressed(boolean pressed) {
this.isPressed = pressed; this.isPressed = pressed;
@ -56,10 +57,11 @@ public class HeaderPane extends JPanel {
g2d.fillRect(0, insets.top / 2, this.getWidth(), this.getHeight() - (insets.top + insets.bottom) / 2); g2d.fillRect(0, insets.top / 2, this.getWidth(), this.getHeight() - (insets.top + insets.bottom) / 2);
int iconY = (this.getHeight() - triangleDown.getIconHeight()) / 2; int iconY = (this.getHeight() - triangleDown.getIconHeight()) / 2;
// 折叠面板需要icon显示左边缘对齐,fix一下
if (this.isShow) { if (this.isShow) {
triangleDown.paintIcon(this, g2d, 0, iconY); triangleDown.paintIcon(this, g2d, FineUIScale.scale(ICON_FIX), iconY);
} else { } else {
triangleRight.paintIcon(this, g2d, 0, iconY); triangleRight.paintIcon(this, g2d, FineUIScale.scale(ICON_FIX), iconY);
} }
g2d.setFont(getFont()); g2d.setFont(getFont());
@ -70,7 +72,7 @@ public class HeaderPane extends JPanel {
int ascent = metrics.getAscent(); int ascent = metrics.getAscent();
int descent = metrics.getDescent(); int descent = metrics.getDescent();
float titleX = triangleDown.getIconWidth() float titleX = triangleDown.getIconWidth() + FineUIScale.scale(ICON_FIX)
+ FineUIScale.scale(UIManager.getInt("ExpandablePane.HeaderPane.hGap")); + FineUIScale.scale(UIManager.getInt("ExpandablePane.HeaderPane.hGap"));
float titleY = (getHeight() - (ascent + descent)) / 2.0f + ascent; float titleY = (getHeight() - (ascent + descent)) / 2.0f + ascent;
FlatUIUtils.setRenderingHints(g2d); FlatUIUtils.setRenderingHints(g2d);

50
designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java

@ -1,11 +1,14 @@
package com.fr.design.gui.controlpane; package com.fr.design.gui.controlpane;
import com.fine.theme.light.ui.FineButtonBorder;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory; import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory;
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -46,15 +49,15 @@ import java.awt.event.MouseMotionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
/** /**
* Created by plough on 2017/7/21. * Created by plough on 2017/7/21.
*/ */
public abstract class UIControlPane extends JControlPane { public abstract class UIControlPane extends JControlPane {
private UIToolbar topToolBar; private UIToolbar topToolBar;
protected Window popupEditDialog; protected Window popupEditDialog;
private static final int TOP_TOOLBAR_HEIGHT = 20;
private static final int TOP_TOOLBAR_WIDTH = 156; // 可能因为用了tablelayout,要比其他地方多一个像素,看起来才正常
private static final int TOP_TOOLBAR_WIDTH_SHORT = 76;
UIControlPane() { UIControlPane() {
super(); super();
@ -135,40 +138,26 @@ public abstract class UIControlPane extends JControlPane {
leftContentPane.add(toolBarPane, BorderLayout.NORTH); leftContentPane.add(toolBarPane, BorderLayout.NORTH);
// 顶部标签及add按钮 // 顶部标签及add按钮
topToolBar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI() { topToolBar = new UIToolbar();
@Override
public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g;
g2.setColor(UIConstants.SELECT_TAB);
g2.fillRect(0, 0, c.getWidth(), c.getHeight());
}
});
topToolBar.setBorder(null);
topToolBar.setLayout(new BorderLayout()); topToolBar.setLayout(new BorderLayout());
ShortCut addItem = shortCutFactory.addItemShortCut().getShortCut(); ShortCut addItem = shortCutFactory.addItemShortCut().getShortCut();
addItem.intoJToolBar(topToolBar); addItem.intoJToolBar(topToolBar);
JPanel leftTopPane = getLeftTopPane(topToolBar); JPanel leftTopPane = getLeftTopPane(topToolBar);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0)); leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
leftPane.add(leftTopPane, BorderLayout.NORTH); leftPane.add(leftTopPane, BorderLayout.NORTH);
return leftPane; return leftPane;
} }
protected JPanel getLeftTopPane(UIToolbar topToolBar) { protected JPanel getLeftTopPane(UIToolbar topToolBar) {
UILabel addItemLabel = FRWidgetFactory.createLineWrapLabel(getAddItemText()); return row(10,
cell(FRWidgetFactory.createLineWrapLabel(getAddItemText())),
topToolBar.setPreferredSize( cell(topToolBar).with(it -> {
new Dimension( it.setBorderPainted(true);
isNewStyle() ? TOP_TOOLBAR_WIDTH : TOP_TOOLBAR_WIDTH_SHORT, it.setBorder(new FineButtonBorder());
TOP_TOOLBAR_HEIGHT it.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE));
)); }).weight(1.0)
JPanel toolBarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); ).getComponent();
toolBarPane.add(topToolBar, BorderLayout.NORTH);
JPanel leftTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
leftTopPane.add(toolBarPane, BorderLayout.EAST);
leftTopPane.add(addItemLabel, BorderLayout.CENTER);
return leftTopPane;
} }
/** /**
@ -179,7 +168,6 @@ public abstract class UIControlPane extends JControlPane {
} }
protected ShortCut4JControlPane[] createShortcuts() { protected ShortCut4JControlPane[] createShortcuts() {
// return AbstractShortCutFactory.getInstance(this).createNewShortCuts();
return shortCutFactory.createShortCuts(); return shortCutFactory.createShortCuts();
} }
@ -219,8 +207,7 @@ public abstract class UIControlPane extends JControlPane {
editPaneWrapper.add(editPane, BorderLayout.CENTER); editPaneWrapper.add(editPane, BorderLayout.CENTER);
editPaneWrapper.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER, 1)); editPaneWrapper.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER, 1));
this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER); this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER);
setSize(WIDTH, HEIGHT); setSize(FineUIScale.scale(new Dimension(WIDTH, HEIGHT)));
// pack();
this.setVisible(false); this.setVisible(false);
initListener(); initListener();
} }
@ -386,6 +373,7 @@ public abstract class UIControlPane extends JControlPane {
contentPane.setBackground(originColor); contentPane.setBackground(originColor);
contentPane.setLayout(new BorderLayout()); contentPane.setLayout(new BorderLayout());
titleLabel = new UILabel(title); titleLabel = new UILabel(title);
FineUIStyle.setStyle(titleLabel, FineUIStyle.LABEL_BOLD);
contentPane.add(titleLabel, BorderLayout.WEST); contentPane.add(titleLabel, BorderLayout.WEST);
contentPane.setBorder(new EmptyBorder(5, 14, 6, 0)); contentPane.setBorder(new EmptyBorder(5, 14, 6, 0));

19
designer-base/src/main/java/com/fr/design/gui/imenu/UIScrollPopUpMenu.java

@ -6,13 +6,11 @@ import com.fr.design.gui.iscrollbar.UIScrollBar;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Insets; import java.awt.Insets;
import java.awt.LayoutManager; import java.awt.LayoutManager;
import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener; import java.awt.event.AdjustmentListener;
import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
/** /**
* Author : daisy * Author : daisy
@ -21,7 +19,6 @@ import java.awt.event.MouseWheelListener;
*/ */
public class UIScrollPopUpMenu extends UIPopupMenu { public class UIScrollPopUpMenu extends UIPopupMenu {
private static final int MAX_SHOW_NUM = 27; private static final int MAX_SHOW_NUM = 27;
private static final float REC = 8f;
private UIScrollBar scrollBar; private UIScrollBar scrollBar;
@ -30,8 +27,7 @@ public class UIScrollPopUpMenu extends UIPopupMenu {
setOpaque(false); setOpaque(false);
setLayout(new ScrollPopupMenuLayout()); setLayout(new ScrollPopupMenuLayout());
super.add(getScrollBar()); super.add(getScrollBar());
addMouseWheelListener(new MouseWheelListener() { addMouseWheelListener(e -> {
public void mouseWheelMoved(MouseWheelEvent e) {
UIScrollBar scrollBar = getScrollBar(); UIScrollBar scrollBar = getScrollBar();
int amount = (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) int amount = (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL)
? e.getUnitsToScroll() * scrollBar.getUnitIncrement() ? e.getUnitsToScroll() * scrollBar.getUnitIncrement()
@ -39,22 +35,9 @@ public class UIScrollPopUpMenu extends UIPopupMenu {
scrollBar.setValue(scrollBar.getValue() + amount); scrollBar.setValue(scrollBar.getValue() + amount);
e.consume(); e.consume();
}
}); });
} }
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);
super.paintChildren(g);
}
/** /**
* 展现 popupmenu * 展现 popupmenu
* @param invoker 组件 * @param invoker 组件

15
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.RectangleButtonUI; import com.fine.theme.light.ui.RectangleButtonUI;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.FlatDarkLaf;
import com.fr.base.FRContext; import com.fr.base.FRContext;
@ -336,18 +337,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
"configuredroles", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION_DISABLED}, "configuredroles", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION_DISABLED},
new PropertyMode[]{PropertyMode.AUTHORITY_EDITION}); 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_ELEMENT, cellElement);
propertyItemMap.put(KEY_CELL_ATTR, cellAttr); propertyItemMap.put(KEY_CELL_ATTR, cellAttr);
propertyItemMap.put(KEY_FLOAT_ELEMENT, floatElement); propertyItemMap.put(KEY_FLOAT_ELEMENT, floatElement);
@ -355,7 +344,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyItemMap.put(KEY_CONDITION_ATTR, conditionAttr); propertyItemMap.put(KEY_CONDITION_ATTR, conditionAttr);
propertyItemMap.put(KEY_HYPERLINK, hyperlink); propertyItemMap.put(KEY_HYPERLINK, hyperlink);
propertyItemMap.put(KEY_WIDGET_LIB, widgetLib); propertyItemMap.put(KEY_WIDGET_LIB, widgetLib);
propertyItemMap.put(KEY_AI_CHAT, aiChat);
propertyItemMap.put(KEY_AUTHORITY_EDITION, authorityEdition); propertyItemMap.put(KEY_AUTHORITY_EDITION, authorityEdition);
propertyItemMap.put(KEY_CONFIGURED_ROLES, configuredRoles); propertyItemMap.put(KEY_CONFIGURED_ROLES, configuredRoles);
} }
@ -1263,6 +1251,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
contentPane = new JPanel(); contentPane = new JPanel();
contentPane.setLayout(new BorderLayout()); contentPane.setLayout(new BorderLayout());
UILabel label = new UILabel(title); UILabel label = new UILabel(title);
FineUIStyle.setStyle(label, FineUIStyle.LABEL_BOLD);
contentPane.add(label, BorderLayout.CENTER); contentPane.add(label, BorderLayout.CENTER);
popupButton = createPopupButton(buttonType); popupButton = createPopupButton(buttonType);

14
designer-base/src/main/resources/com/fine/theme/icon/font/shadow.svg

@ -1,17 +1,5 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_d_5856_25936)"> <g>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.5 17.0102C15.5 17.0102 17.5 17.0102 16.5 17.0102C11 17.0102 6.5 14.5102 6.5 9.51019C6.5 5.36806 10.7533 2.01019 16 2.01019C20.5558 2.01019 24.3627 4.54197 25.2862 7.92058C25.4435 8.4959 24.9677 9.01019 24.3713 9.01019C23.8563 9.01019 23.434 8.61981 23.2633 8.13399C22.4302 5.76241 19.4941 4.01019 16 4.01019C11.8579 4.01019 8.5 6.47263 8.5 9.51019C8.50981 13.5102 13.5 15.0102 16.5 15.0102C23.4792 15.0102 25.5 18.5 25.5 22.5C25.5 26.5 21.2259 30 15.9792 30C11.4235 30 7.61674 27.4683 6.69307 24.0899C6.53578 23.5145 7.01157 23.0002 7.60801 23.0002C8.12293 23.0002 8.54528 23.3906 8.71597 23.8764C9.5492 26.2479 12.4852 28 15.9792 28C20.1214 28 23.4792 25.5376 23.4792 22.5C23.4792 19.4624 21.5 17.0102 16.5 17.0102Z" fill="#0A1C38" fill-opacity="0.9" shape-rendering="crispEdges"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M16.5 17.0102C15.5 17.0102 17.5 17.0102 16.5 17.0102C11 17.0102 6.5 14.5102 6.5 9.51019C6.5 5.36806 10.7533 2.01019 16 2.01019C20.5558 2.01019 24.3627 4.54197 25.2862 7.92058C25.4435 8.4959 24.9677 9.01019 24.3713 9.01019C23.8563 9.01019 23.434 8.61981 23.2633 8.13399C22.4302 5.76241 19.4941 4.01019 16 4.01019C11.8579 4.01019 8.5 6.47263 8.5 9.51019C8.50981 13.5102 13.5 15.0102 16.5 15.0102C23.4792 15.0102 25.5 18.5 25.5 22.5C25.5 26.5 21.2259 30 15.9792 30C11.4235 30 7.61674 27.4683 6.69307 24.0899C6.53578 23.5145 7.01157 23.0002 7.60801 23.0002C8.12293 23.0002 8.54528 23.3906 8.71597 23.8764C9.5492 26.2479 12.4852 28 15.9792 28C20.1214 28 23.4792 25.5376 23.4792 22.5C23.4792 19.4624 21.5 17.0102 16.5 17.0102Z" fill="#0A1C38" fill-opacity="0.9" shape-rendering="crispEdges"/>
</g> </g>
<defs>
<filter id="filter0_d_5856_25936" x="5.5" y="2.01019" width="21" height="29.9898" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="0.5"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_5856_25936"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_5856_25936" result="shape"/>
</filter>
</defs>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 948 B

1
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties

@ -16,6 +16,7 @@ ListUI=com.formdev.flatlaf.ui.FlatListUI
MenuUI=com.formdev.flatlaf.ui.FlatMenuUI MenuUI=com.formdev.flatlaf.ui.FlatMenuUI
MenuBarUI=com.formdev.flatlaf.ui.FlatMenuBarUI MenuBarUI=com.formdev.flatlaf.ui.FlatMenuBarUI
MenuItemUI=com.fine.theme.light.ui.FineMenuItemUI MenuItemUI=com.fine.theme.light.ui.FineMenuItemUI
TemplateListMenuItemUI=com.fine.theme.light.ui.FineTemplateListMenuItemUI
OptionPaneUI=com.formdev.flatlaf.ui.FlatOptionPaneUI OptionPaneUI=com.formdev.flatlaf.ui.FlatOptionPaneUI
PanelUI=com.formdev.flatlaf.ui.FlatPanelUI PanelUI=com.formdev.flatlaf.ui.FlatPanelUI
PasswordFieldUI=com.formdev.flatlaf.ui.FlatPasswordFieldUI PasswordFieldUI=com.formdev.flatlaf.ui.FlatPasswordFieldUI

Loading…
Cancel
Save