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-解安森 10 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 final Icon triangleDown;
private final Icon triangleRight;
private static final int ICON_FIX = -2;
public void setPressed(boolean 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);
int iconY = (this.getHeight() - triangleDown.getIconHeight()) / 2;
// 折叠面板需要icon显示左边缘对齐,fix一下
if (this.isShow) {
triangleDown.paintIcon(this, g2d, 0, iconY);
triangleDown.paintIcon(this, g2d, FineUIScale.scale(ICON_FIX), iconY);
} else {
triangleRight.paintIcon(this, g2d, 0, iconY);
triangleRight.paintIcon(this, g2d, FineUIScale.scale(ICON_FIX), iconY);
}
g2d.setFont(getFont());
@ -70,7 +72,7 @@ public class HeaderPane extends JPanel {
int ascent = metrics.getAscent();
int descent = metrics.getDescent();
float titleX = triangleDown.getIconWidth()
float titleX = triangleDown.getIconWidth() + FineUIScale.scale(ICON_FIX)
+ FineUIScale.scale(UIManager.getInt("ExpandablePane.HeaderPane.hGap"));
float titleY = (getHeight() - (ascent + descent)) / 2.0f + ascent;
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;
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.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory;
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser;
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.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
@ -46,15 +49,15 @@ import java.awt.event.MouseMotionListener;
import java.awt.event.WindowAdapter;
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.
*/
public abstract class UIControlPane extends JControlPane {
private UIToolbar topToolBar;
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() {
super();
@ -135,40 +138,26 @@ public abstract class UIControlPane extends JControlPane {
leftContentPane.add(toolBarPane, BorderLayout.NORTH);
// 顶部标签及add按钮
topToolBar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI() {
@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 = new UIToolbar();
topToolBar.setLayout(new BorderLayout());
ShortCut addItem = shortCutFactory.addItemShortCut().getShortCut();
addItem.intoJToolBar(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);
return leftPane;
}
protected JPanel getLeftTopPane(UIToolbar topToolBar) {
UILabel addItemLabel = FRWidgetFactory.createLineWrapLabel(getAddItemText());
topToolBar.setPreferredSize(
new Dimension(
isNewStyle() ? TOP_TOOLBAR_WIDTH : TOP_TOOLBAR_WIDTH_SHORT,
TOP_TOOLBAR_HEIGHT
));
JPanel toolBarPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
toolBarPane.add(topToolBar, BorderLayout.NORTH);
JPanel leftTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
leftTopPane.add(toolBarPane, BorderLayout.EAST);
leftTopPane.add(addItemLabel, BorderLayout.CENTER);
return leftTopPane;
return row(10,
cell(FRWidgetFactory.createLineWrapLabel(getAddItemText())),
cell(topToolBar).with(it -> {
it.setBorderPainted(true);
it.setBorder(new FineButtonBorder());
it.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE));
}).weight(1.0)
).getComponent();
}
/**
@ -179,7 +168,6 @@ public abstract class UIControlPane extends JControlPane {
}
protected ShortCut4JControlPane[] createShortcuts() {
// return AbstractShortCutFactory.getInstance(this).createNewShortCuts();
return shortCutFactory.createShortCuts();
}
@ -219,8 +207,7 @@ public abstract class UIControlPane extends JControlPane {
editPaneWrapper.add(editPane, BorderLayout.CENTER);
editPaneWrapper.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER, 1));
this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER);
setSize(WIDTH, HEIGHT);
// pack();
setSize(FineUIScale.scale(new Dimension(WIDTH, HEIGHT)));
this.setVisible(false);
initListener();
}
@ -386,6 +373,7 @@ public abstract class UIControlPane extends JControlPane {
contentPane.setBackground(originColor);
contentPane.setLayout(new BorderLayout());
titleLabel = new UILabel(title);
FineUIStyle.setStyle(titleLabel, FineUIStyle.LABEL_BOLD);
contentPane.add(titleLabel, BorderLayout.WEST);
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.light.ui.RectangleButtonUI;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.ui.FlatLineBorder;
@ -337,18 +338,6 @@ 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);
@ -356,7 +345,6 @@ 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);
}
@ -1264,6 +1252,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
contentPane = new JPanel();
contentPane.setLayout(new BorderLayout());
UILabel label = new UILabel(title);
FineUIStyle.setStyle(label, FineUIStyle.LABEL_BOLD);
contentPane.add(label, BorderLayout.CENTER);
popupButton = createPopupButton(buttonType);

Loading…
Cancel
Save