Browse Source

Pull request #13514: REPORT-111995 【UI翻新】优化东区显示效果

Merge in DESIGN/design from ~LEVY.XIE/design:newui to newui

* commit 'e76877cb0ffee3400221fb023ed5c2f03985d47e':
  REPORT-111995 【UI翻新】优化东区显示效果
  REPORT-111995 【UI翻新】优化东区显示效果
newui
Levy.Xie-解安森 6 months ago
parent
commit
797ff11150
  1. 8
      designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java
  2. 50
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  3. 15
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

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

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.formdev.flatlaf.ui.FlatLineBorder; import com.formdev.flatlaf.ui.FlatLineBorder;
@ -337,18 +338,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);
@ -356,7 +345,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);
} }
@ -1264,6 +1252,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);

Loading…
Cancel
Save