Browse Source

Merge branch 'release/11.0' of https://code.fineres.com/scm/~henry.wang/design into release/11.0

bugfix/11.0
Henry.Wang 3 years ago
parent
commit
49bcb38373
  1. 12
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java
  2. 21
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java
  3. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java
  4. 6
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java
  5. 9
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java
  6. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java
  7. 57
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java
  8. 33
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  9. 33
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java

12
designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java

@ -21,6 +21,8 @@ public class UITabbedPane extends JTabbedPane{
private String classPath; //panel对象的类名
private String tabName; //Tab名称
private int tabSize = 0;
private Color tabBorderColor;
public UITabbedPane() {
super();
}
@ -93,6 +95,16 @@ public class UITabbedPane extends JTabbedPane{
public int getTabSize(){
return tabSize;
}
public Color getTabBorderColor() {
return tabBorderColor;
}
public void setTabBorderColor(Color tabBorderColor) {
this.tabBorderColor = tabBorderColor;
repaint();
}
@Override
/**
* 获取UI对象

21
designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java

@ -31,9 +31,20 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
private int addX = -1;
private int addY = -1;
private int rollover = -1;
private Color tabBorderColor = new Color(143, 160, 183);
private final Color DEFAULT_TAB_BORDER_COLOR = new Color(143, 160, 183);
private Color[] tabSelectedColor = {UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE};
public Color getTabBorderColor() {
Color color = null;
if (tabPane instanceof UITabbedPane) {
color = ((UITabbedPane) tabPane).getTabBorderColor();
}
if (color == null) {
color = DEFAULT_TAB_BORDER_COLOR;
}
return color;
}
/**
* 创建UI对象
*
@ -252,9 +263,9 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
private void drawUITabBorder(Graphics g, int tabPlacement, int x, int y, int w, int h,
boolean isSelected, boolean isEnabled, boolean isRollover) {
if (!isEnabled) {
drawUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement);
drawUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement);
} else if (isSelected || isRollover) {
drawSelectedUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement);
drawSelectedUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement);
if (isRollover && canClose()) {
closeX = x + w - closeIcon.getIconWidth() - 3;
closeY = 0;
@ -269,7 +280,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
closeIcon.paintIcon(tabPane, g, closeX, closeY);
}
} else {
drawUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement);
drawUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement);
}
}
@ -322,7 +333,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
}
private void drawUIContentBorder(Graphics g, int x, int y, int w, int h) {
g.setColor(tabBorderColor);
g.setColor(getTabBorderColor());
g.drawRect(x, y, w - 3, h - 3);
// Shadow
g.setColor(new Color(204, 204, 204));

4
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java

@ -52,7 +52,7 @@ import static com.fr.design.i18n.Toolkit.i18nText;
* Created by Starryi on 2021/8/13
*/
public class TemplateThemeGridControlPane<T extends TemplateTheme> extends BasicPane {
public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 10;
public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 20;
public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37;
private final RemoveThemeAction removeAction;
private final UIButton setTheme4NewTemplateButton;
@ -92,7 +92,7 @@ public class TemplateThemeGridControlPane<T extends TemplateTheme> extends Basic
private void initializePane() {
setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10));
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
add(createActionsContainer(), BorderLayout.NORTH);

6
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java

@ -34,7 +34,6 @@ import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
@ -286,18 +285,15 @@ public class TemplateThemeGridPagesPane extends JPanel {
}
public static class TemplateThemeManagingPane extends TemplateThemeGridPagePane {
public static final int CONTENT_WIDTH = TemplateThemeGridControlPane.CONTENT_WIDTH + 4;
public static final int CONTENT_HEIGHT = TemplateThemeGridControlPane.CONTENT_HEIGHT + 10;
private final UITabbedPane tabbedPane;
private final TemplateThemeGridControlPane<FormTheme> formThemesManagerPane;
private final TemplateThemeGridControlPane<ReportTheme> reportThemesManagerPane;
public TemplateThemeManagingPane() {
setLayout(FRGUIPaneFactory.createBorderLayout());
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
tabbedPane = new UITabbedPane();
tabbedPane.setTabBorderColor(new Color(0xE0E0E1));
add(tabbedPane, BorderLayout.CENTER);
formThemesManagerPane = TemplateThemeGridControlPane.createFormThemesManagerPane();

9
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java

@ -8,6 +8,8 @@ import com.fr.design.event.ChangeEvent;
import com.fr.design.event.ChangeListener;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
@ -68,7 +70,12 @@ public class TemplateThemeGridPane<T extends TemplateTheme> extends BasicPane {
contentListPane.setLayout(new GridLayout(0, BLOCK_COUNT_ROW_LINE, BLOCK_GAP, BLOCK_GAP));
fillContentListPane();
UIScrollPane scrollPane = new UIScrollPane(contentListPane);
JPanel wrapper1 = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapper1.add(contentListPane, BorderLayout.NORTH);
JPanel wrapper2 = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapper2.add(wrapper1, BorderLayout.WEST);
UIScrollPane scrollPane = new UIScrollPane(wrapper2);
scrollPane.setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

4
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java

@ -1,7 +1,5 @@
package com.fr.design.mainframe.theme.dialog;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
@ -16,7 +14,7 @@ import javax.swing.JPanel;
* Created by Starryi on 2021/8/13
*/
public class TemplateThemeGridPagesDialog extends TemplateThemeDialog implements TemplateThemeGridPagesPane.PageChangeListener {
public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 40;
public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 48;
public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37;
protected TemplateThemeGridPagesPane overallPane;

57
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java

@ -90,6 +90,37 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
}
@Override
protected void paintBorder(Graphics g) {
super.paintBorder(g);
paintSeparator((Graphics2D) g);
}
private void paintSeparator(Graphics2D g2d) {
Border border = getBorder();
if (border instanceof LineBorder && titlePane != null) {
Border containerBorder = container.getBorder();
Insets insets = containerBorder.getBorderInsets(container);
int y = titlePane.getHeight() + insets.top;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color lineColor = ((LineBorder) border).getLineColor();
int thickness = ((LineBorder) border).getThickness();
g2d.setColor(lineColor);
g2d.setStroke(new BasicStroke(thickness * 2));
g2d.drawLine(0, y, getWidth(), y);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
@ -144,7 +175,6 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
data.setInsetImagePadding(titlePacker.getInsetImagePadding());
data.setInsetRelativeTextLeft(titlePacker.isInsetRelativeTextLeft());
data.setInsetRelativeTextRight(titlePacker.isInsetRelativeTextRight());
this.setBorder(new BottomLineBorder(componentStyle.getStyle().getColor(), componentStyle.getStyle().getBorder()));
}
public Label getData(){
@ -172,31 +202,6 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
}
public static class BottomLineBorder extends LineBorder {
private BottomLineBorder(Color color, int thickness) {
super(color, thickness);
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D) g;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(getLineColor());
g2d.setStroke(new BasicStroke(getThickness() * 2));
g2d.drawLine(0, height, width, height);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
private static class Utils {
private static void paintBackground(Graphics2D g2d, Background background, Shape shape, float opacity) {

33
designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -273,12 +273,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
parentCreator.setBorder(border); // 容器绘制完整边框
bodyCreator.setBorder(BorderFactory.createEmptyBorder()); // body不绘制边框
titleCreator.setBorder(BorderFactory.createEmptyBorder()); // title绘制底部边框
if (border instanceof LineBorder) {
Color color = ((LineBorder) border).getLineColor();
int thickness = ((LineBorder) border).getThickness();
titleCreator.setBorder(new BottomLineBorder(color, thickness));
}
titleCreator.setBorder(BorderFactory.createEmptyBorder()); // title不绘制边框
if (bodyCreator instanceof XBorderStyleWidgetCreator) {
XBorderStyleWidgetCreator styledBodyXCreator = (XBorderStyleWidgetCreator) bodyCreator;
@ -407,32 +402,6 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
}
// 适用于标题栏的底部边框
public static class BottomLineBorder extends LineBorder {
private BottomLineBorder(Color color, int thickness) {
super(color, thickness);
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D)g;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(getLineColor());
g2d.setStroke(new BasicStroke(getThickness() * 2));
g2d.drawLine(0, height, width, height);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
public static class NoBackgroundPaneUI extends BasicPanelUI {
@Override
public void update(Graphics g, JComponent c) {

33
designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java

@ -15,6 +15,8 @@ import com.fr.form.ui.container.WTitleLayout;
import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ContainerEvent;
import java.awt.geom.Rectangle2D;
@ -187,6 +189,37 @@ public class XWTitleLayout extends DedicateLayoutContainer {
}
@Override
protected void paintBorder(Graphics g) {
super.paintBorder(g);
paintSeparator((Graphics2D) g);
}
private void paintSeparator(Graphics2D g2d) {
Border border = getBorder();
XCreator titleCreator = getTitleCreator();
if (border instanceof LineBorder && titleCreator != null) {
int height = titleCreator.getHeight();
Insets paddingInsets = getInsets();
int y = height + paddingInsets.top;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color lineColor = ((LineBorder) border).getLineColor();
int thickness = ((LineBorder) border).getThickness();
g2d.setColor(lineColor);
g2d.setStroke(new BasicStroke(thickness * 2));
g2d.drawLine(0, y, getWidth(), y);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
@Override
public void paintBackground(Graphics2D g2d) {
if (getComponentCount() > 1) {

Loading…
Cancel
Save