diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineButtonBorder.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineButtonBorder.java index 16405a1552..26ef4ec2ba 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineButtonBorder.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineButtonBorder.java @@ -32,7 +32,7 @@ public class FineButtonBorder extends FlatButtonBorder { return; } g2.setPaint(borderPaint); - FineUIUtils.paintPartRoundButtonBorder(c, g2, x, y, width, height, borderWidth, (float) getArc(c)); + FineUIUtils.paintPartRoundButtonBorder(c, g2, x, y, width, height, borderWidth, getArc(c)); } else { super.paintBorder(c, g, x, y, width, height); } diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FinePopupMenuBorder.java b/designer-base/src/main/java/com/fine/theme/light/ui/FinePopupMenuBorder.java index 63bf5e88e0..c7b827862f 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FinePopupMenuBorder.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FinePopupMenuBorder.java @@ -14,6 +14,6 @@ public class FinePopupMenuBorder extends FlatPopupMenuBorder { @Override public int getArc() { - return FineUIUtils.getAndScaleInt("PopupMenu.arc", 5); + return FineUIUtils.getAndScaleInt("PopupMenu.arc", 8); } } diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FinePopupMenuUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FinePopupMenuUI.java index 58a37da791..e0cf691950 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FinePopupMenuUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FinePopupMenuUI.java @@ -19,7 +19,7 @@ import java.awt.geom.RoundRectangle2D; */ public class FinePopupMenuUI extends FlatPopupMenuUI { private int arc; - private final int DEFAULT_ARC = 10; + private final int DEFAULT_ARC = 8; /** * 创建UI diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineReportComponentBorder.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineReportComponentBorder.java index 6d381761ac..7ae570cb75 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineReportComponentBorder.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineReportComponentBorder.java @@ -18,7 +18,7 @@ public class FineReportComponentBorder extends FlatRoundBorder { @Override protected int getArc(Component c) { - return FineUIUtils.getAndScaleInt("Center.arc", 10); + return FineUIUtils.getAndScaleInt("Center.arc", 8); } @Override diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineReportComponentCompositeUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineReportComponentCompositeUI.java index 7886af3c33..8353f3e241 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineReportComponentCompositeUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineReportComponentCompositeUI.java @@ -33,7 +33,7 @@ public class FineReportComponentCompositeUI extends FlatPanelUI { @Override protected void installDefaults(JPanel p) { super.installDefaults(p); - this.arc = FineUIUtils.getAndScaleInt("Center.arc", 10); + this.arc = FineUIUtils.getAndScaleInt("Center.arc", 8); } diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineToggleButtonUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineToggleButtonUI.java index 49df9d63d1..8f14cd050c 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineToggleButtonUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineToggleButtonUI.java @@ -111,7 +111,7 @@ public class FineToggleButtonUI extends FlatToggleButtonUI { @Override public void paint(Graphics g, JComponent c) { if (isGroupButtonNotFit(c) || isTabButton(c)) { - ((AbstractButton)c).setMargin(FineUIUtils.getUIInsets("ToggleButton.compact.margin", "ToggleButton.margin")); + ((AbstractButton) c).setMargin(FineUIUtils.getUIInsets("ToggleButton.compact.margin", "ToggleButton.margin")); } super.paint(g, c); } @@ -134,7 +134,7 @@ public class FineToggleButtonUI extends FlatToggleButtonUI { // paint background Color background; - if(c.isEnabled() && selected) { + if (c.isEnabled() && selected) { background = tabSelectedBackground; } else { Color enabledColor = selected ? clientPropertyColor(c, TAB_BUTTON_SELECTED_BACKGROUND, tabSelectedBackground) : null; @@ -170,9 +170,7 @@ public class FineToggleButtonUI extends FlatToggleButtonUI { float focusWidth = FlatUIUtils.getBorderFocusWidth(c); FlatUIUtils.paintComponentBackground(g2, 0, 0, c.getWidth(), c.getHeight(), focusWidth, 0); } else { - float arc = FlatUIUtils.getBorderArc( c ) / 2; - Shape path2D = getGroupButtonPath2D(c, position, arc); - g2.fill(path2D); + g2.fill(getGroupButtonPath2D(c, position, FlatUIUtils.getBorderArc(c))); } } finally { g2.dispose(); @@ -209,7 +207,7 @@ public class FineToggleButtonUI extends FlatToggleButtonUI { @Override protected Color getForeground(JComponent c) { - if (isGroupButton(c) && ((AbstractButton)c).isSelected()) { + if (isGroupButton(c) && ((AbstractButton) c).isSelected()) { return groupSelectedForeground; } return super.getForeground(c); @@ -218,7 +216,7 @@ public class FineToggleButtonUI extends FlatToggleButtonUI { @Override protected Color getBackground(JComponent c) { if (isGroupButton(c)) { - return ((AbstractButton)c).isSelected() ? groupSelectedBackground : groupBackground; + return ((AbstractButton) c).isSelected() ? groupSelectedBackground : groupBackground; } return super.getBackground(c); } diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java index fdf9b4cbe2..6ccf630ed2 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java @@ -186,10 +186,10 @@ public class FineUIUtils { * @param background 背景色 * @param width 宽度 * @param height 高度 - * @param radius 圆角 + * @param arc 圆角 */ public static void paintWithComposite(Graphics g, Composite composite, Color background, - int width, int height, int radius) { + int width, int height, int arc) { Graphics2D g2d = (Graphics2D) g; FlatUIUtils.setRenderingHints(g2d); @@ -197,7 +197,7 @@ public class FineUIUtils { g2d.setComposite(composite); g2d.setColor(background); - g2d.fill(new RoundRectangle2D.Float(0, 0, width, height, radius, radius)); + g2d.fill(new RoundRectangle2D.Float(0, 0, width, height, arc, arc)); g2d.setComposite(oldComposite); } @@ -247,14 +247,14 @@ public class FineUIUtils { case LEFT: { path2D.append(createLeftRoundRectangle(x, y, width, height, arc), false); path2D.append(createLeftRoundRectangle(x + t, y + t, - width - (closedPath ? t2x : t), height - t2x, arc - t), false); + width - (closedPath ? t2x : t), height - t2x, arc - t2x), false); break; } case RIGHT: default: { path2D.append(createRightRoundRectangle(x, y, width, height, arc), false); path2D.append(createRightRoundRectangle(x + (closedPath ? t : 0), y + t, - width - (closedPath ? t2x : t), height - t2x, arc - t), false); + width - (closedPath ? t2x : t), height - t2x, arc - t2x), false); break; } } @@ -280,12 +280,18 @@ public class FineUIUtils { float t2x = t * 2; Path2D path2D = new Path2D.Float(Path2D.WIND_EVEN_ODD); path2D.append(createTopRoundRectangle(x, y, width, height, arc), false); - path2D.append(createTopRoundRectangle(x + t, y + t, width - t2x, height - t, arc - t), false); + path2D.append(createTopRoundRectangle(x + t, y + t, width - t2x, height - t, arc - t2x), false); g2.fill(path2D); } /** * 创建一个部分圆角的矩形路径 + *

+ * 注意: + * 在swing中,UI的样式的 arc 数值是直径,而 css 中 border-radius 为半径, + * 因此我们配置的 arc 全部为 border-radius 的2倍。但是使用 Path2D 绘制时, + * 绘制方式其实是使用半径来进行计算的,为了保持调用一致,对外 API 还是以 arc + * 的形式,因此方法内部需要对 arc 进行取半处理, * * @param x x坐标 * @param y y坐标 @@ -299,16 +305,20 @@ public class FineUIUtils { */ public static Path2D createPartRoundRectangle(double x, double y, double width, double height, double arcTopLeft, double arcTopRight, double arcBottomRight, double arcBottomLeft) { - Path2D path = new Path2D.Double(Path2D.WIND_EVEN_ODD, 7); - path.moveTo(x + arcTopLeft, y); - path.lineTo(x + width - arcTopRight, y); - path.quadTo(x + width, y, x + width, y + arcTopRight); - path.lineTo(x + width, y + height - arcBottomRight); - path.quadTo(x + width, y + height, x + width - arcBottomRight, y + height); - path.lineTo(x + arcBottomLeft, y + height); - path.quadTo(x, y + height, x, y + height - arcBottomLeft); - path.lineTo(x, y + arcTopLeft); - path.quadTo(x, y, x + arcTopLeft, y); + double radiusTopLeft = arcTopLeft / 2; + double radiusTopRight = arcTopRight / 2; + double radiusBottomLeft = arcBottomLeft / 2; + double radiusBottomRight = arcBottomRight / 2; + Path2D path = new Path2D.Double(Path2D.WIND_EVEN_ODD, 10); + path.moveTo(x + radiusTopLeft, y); + path.lineTo(x + width - radiusTopRight, y); + path.quadTo(x + width, y, x + width, y + radiusTopRight); + path.lineTo(x + width, y + height - radiusBottomRight); + path.quadTo(x + width, y + height, x + width - radiusBottomRight, y + height); + path.lineTo(x + radiusBottomLeft, y + height); + path.quadTo(x, y + height, x, y + height - radiusBottomLeft); + path.lineTo(x, y + radiusTopLeft); + path.quadTo(x, y, x + radiusTopLeft, y); path.closePath(); return path; } diff --git a/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java b/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java index bc2eca9fd1..62882fd028 100644 --- a/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java @@ -84,7 +84,7 @@ public abstract class ConditionAttributesPane extends BasicBeanPane { selectedItemPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - // 选中的添加Itempane + // 选中的添加ItemPane selectedItemScrollPane.setViewportView(selectedItemPane); selectedItemScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); @@ -93,7 +93,7 @@ public abstract class ConditionAttributesPane extends BasicBeanPane { this.add(FineUIUtils.wrapComponentWithTitle(column( 10, row(cell(addItemPane), flex()), - cell(selectedItemScrollPane).with(it -> it.setBorder(new FineRoundBorder())), + cell(selectedItemScrollPane).weight(1).with(it -> it.setBorder(new FineRoundBorder())), fix(10) ).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property")), BorderLayout.NORTH); } diff --git a/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java index 48c23bab51..cc98b6500c 100644 --- a/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/SingleConditionPane.java @@ -7,8 +7,6 @@ import java.awt.event.ActionListener; import com.fine.theme.icon.LazyIcon; import com.formdev.flatlaf.ui.FlatUIUtils; -import com.formdev.flatlaf.util.ScaledEmptyBorder; -import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.dialog.BasicPane; @@ -31,9 +29,8 @@ public abstract class SingleConditionPane extends BasicPane { cancel = new UIButton(new LazyIcon("remove")); cancel.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Action_Remove")); cancel.addActionListener(cancleListener); - cancel.setMargin(new Insets(0, 0, 0, 0)); - cancel.setBorder(new ScaledEmptyBorder(0, 0, 0, 10)); cancel.setBackground(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250, 255))); + cancel.setBorder(null); } addCancel(); } diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index db63112647..d15c65f241 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -3,7 +3,6 @@ */ package com.fr.design.file; -import com.fr.base.FRContext; import com.fr.design.ExtraDesignClassManager; import com.fr.design.cache.DesignCacheManager; import com.fr.design.dialog.FineJOptionPane; @@ -35,7 +34,6 @@ import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; -import com.fr.report.lock.LockInfoOperator; import java.util.UUID; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -112,7 +110,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { @Override public void mousePressed(MouseEvent evt) { - if (reportletsTree.getPathForLocation(evt.getX(), evt.getY()) != null && evt.getClickCount() == 2) { + if (evt.getClickCount() == 2) { DesignCacheManager.processByCacheTableData(() -> openFile()); } } diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java index 70f229d2a3..ad9151fdbc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java @@ -1,10 +1,7 @@ package com.fr.design.gui.ibutton; -import com.fr.design.utils.gui.GUICoreUtils; - import javax.swing.Icon; import javax.swing.JPanel; -import javax.swing.JPopupMenu; import java.awt.BorderLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -148,8 +145,4 @@ public class UICombinationButton extends JPanel { rightButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON); setStyle(rightButton, IN_TOOLBAR_RIGHT); } - - protected void showPopWindow(JPopupMenu menu) { - GUICoreUtils.showPopupMenu(menu, this, 0, getY() + getHeight() - 3); - } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java b/designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java index 35c40b8645..eb38df9a8b 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java @@ -59,7 +59,7 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane FOUR_HUNDRED) { value = FOUR_HUNDRED; } @@ -182,7 +181,7 @@ public class JFormSliderPane extends JPanel { return value; } - private void refreshShowValueFieldText(){ + private void refreshShowValueFieldText() { showValField.setValue(showValue); setAdjustButtonStatus(); } @@ -211,7 +210,7 @@ public class JFormSliderPane extends JPanel { slider.setValue(calSliderValue(showValue)); } - private void setAdjustButtonStatus(){ + private void setAdjustButtonStatus() { this.downButton.setEnabled(this.showValue > TEN); this.upButton.setEnabled(this.showValue < FOUR_HUNDRED); } @@ -230,8 +229,10 @@ public class JFormSliderPane extends JPanel { @Override public void paintComponent(Graphics g) { - int arc = FineUIUtils.getAndScaleInt("Center.arc", 10) / 2; - Path2D roundedPath = FineUIUtils.createPartRoundRectangle(0, 0, this.getWidth(), this.getHeight(), 0, 0, arc, 0); + int arc = FineUIUtils.getAndScaleInt("Center.arc", 8); + Path2D roundedPath = FineUIUtils.createPartRoundRectangle(0, 0, + this.getWidth(), this.getHeight(), + 0, 0, arc, 0); FlatUIUtils.setRenderingHints(g); Graphics2D g2 = (Graphics2D) g; g2.setColor(getBackground()); @@ -292,8 +293,12 @@ public class JFormSliderPane extends JPanel { showValFieldChange(value); } - - public void addValueChangeListener(ChangeListener changeListener){ + /** + * 添加值变化监听器 + * + * @param changeListener 变化监听器 + */ + public void addValueChangeListener(ChangeListener changeListener) { this.slider.addChangeListener(changeListener); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java index 3b0022e2b4..db92ab3eef 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/EditFileVersionDialog.java @@ -80,7 +80,7 @@ public class EditFileVersionDialog extends UIDialog { new Component[]{fontPane, scrollPane} }; double[] rowSizes = new double[]{25, 100}; - double[] columnSizes = new double[]{70, 200}; + double[] columnSizes = new double[]{70, 180}; JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSizes, columnSizes); diff --git a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java index 96dac6fd08..ee71b66b35 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java @@ -272,7 +272,7 @@ public class DBManipulationPane extends BasicBeanPane { JPanel conditionPane = this.createConditionPane(); JPanel btPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); - btPane.add(column(5, + btPane.add(column(4, cell(FineUIUtils.wrapComponentWithTitle(conditionPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Submit_Condition"))), row(cell(eventPane), cell(new UILabel())) ).getComponent()); @@ -320,6 +320,7 @@ public class DBManipulationPane extends BasicBeanPane { jp.setVisible(setJpVisible()); String submitCondition = Toolkit.i18nText("Fine-Design_Basic_Set_Submit_Condition"); UIButton addSubmitConditionButton = new UIButton(submitCondition); + addSubmitConditionButton.setPreferredSize(createControlBtnPanePreferredSize()); addSubmitConditionButton.setToolTipText(submitCondition); addSubmitConditionButton.addActionListener(new ActionListener() { @Override diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageConstants.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageConstants.java index 2dab229850..20d5f85ca6 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageConstants.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageConstants.java @@ -1,29 +1,17 @@ package com.fr.startup.ui; -import java.awt.Color; - /** * created by Harrison on 2022/07/07 **/ public class StartupPageConstants { /** - * 圆弧长度 + * 圆角直径 */ - public static final int ARC_DIAMETER = 10; + public static final int ARC_DIAMETER = 16; /** * 内容宽度 */ public static final int CONTENT_WIDTH = 850; - - /** - * 边框的颜色 - */ - public static final Color BORDER_COLOR = Color.WHITE; - - /** - * 透明的颜色 - */ - public static final Color TRANSPARENT_COLOR = new Color(0, 0, 0, 0); } diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java index 45c955b12b..3100c064ae 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java @@ -292,7 +292,8 @@ public class StartupPageWindow extends JFrame { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setColor(color); - g2d.fillRoundRect(0, 0, getWidth(), getHeight(), 2 * StartupPageConstants.ARC_DIAMETER, 2 * StartupPageConstants.ARC_DIAMETER); + g2d.fillRoundRect(0, 0, getWidth(), getHeight(), + StartupPageConstants.ARC_DIAMETER, StartupPageConstants.ARC_DIAMETER); } }; recentOpenPanel.setLayout(new BorderLayout()); diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index aafdbdf666..c58cfad65c 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -230,7 +230,7 @@ CombinationButton.arc = $Button.arc #---- CheckBox ---- -CheckBox.arc = 4 +CheckBox.arc = $Component.arc CheckBox.margin = 2,0,2,0 CheckBox.iconTextGap = 4 CheckBox.rollover = true @@ -330,7 +330,7 @@ Component.focusWidth = 0 Component.innerFocusWidth = 0.5 Component.innerOutlineWidth = 1 Component.borderWidth = 1 -Component.arc = 5 +Component.arc = 6 Component.minimumWidth = 64 # allowed values: chevron or triangle Component.arrowType = chevron @@ -580,7 +580,7 @@ PopupMenu.background=$background.normal PopupMenu.scrollArrowColor = @buttonArrowColor PopupMenu.borderColor=$border.divider PopupMenu.hoverScrollArrowBackground = darken(@background,5%) -PopupMenu.arc=10 +PopupMenu.arc=8 #---- PopupMenuSeparator ---- PopupMenuSeparator.height=5 @@ -887,7 +887,7 @@ TemplateTabPane.borderColor = $border.divider TemplateTabPane.closeHoverBackground = $hover.deep TemplateTabPane.tabInsets = 4,6,4,6 TemplateTabPane.borderWidth = 1 -TemplateTabPane.tabArc = 5 +TemplateTabPane.tabArc = 8 TemplateTabPane.separatorHeight = 14 TemplateTabPane.icon.hoverBackground = #B8BFCB @@ -1206,7 +1206,7 @@ Center.GridColumnRowEditedColor=#e9ecf1 Center.GridCornerFill=fade(#0A1C38, 47%) Center.SpaceColor = #FFF Center.border = 0, 10, 10, 10 -Center.arc=10 +Center.arc=8 #---- CellOtherSetPane ---- CellOtherSetPane.height=$Component.defaultHeight diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java index c8fdc1adce..ff86054a96 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java @@ -47,16 +47,15 @@ import java.util.List; import static com.fine.theme.utils.FineUIScale.scale; public class UIColorPickerPane extends BasicPane implements UIObserver { - private static final int MARGIN_TOP = scale(7); - private static final int MARGIN_LEFT = scale(5); + private static final int MARGIN_TOP = scale(10); private static final int COLORGROUP_MARGIN_LEFT = scale(15); - private static final int OFF_HEIGHT = scale(6); + private static final int OFF_HEIGHT = scale(10); private static final int COLOR_REC_HEIGHT = scale(40); private static final int COLOR_REC_WIDTH = scale(30); protected static final int TEXTFIELD_HEIGHT = scale(20); protected static final int TEXTFIELD_WIDTH = scale(130); protected static final int UPCONTROLPANE_WIDTH = scale(224); - private static final int LAYOUR_DET = scale(6); + private static final int LAYOUR_DET = scale(10); public static final double VALUE = 100; @@ -610,10 +609,14 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { @Override public void layoutContainer(Container parent) { - upControlPane.setBounds(getBoundX(), getBoundY(), UPCONTROLPANE_WIDTH, upControlPane.getPreferredSize().height + MARGIN_TOP); - stagePanel.setBounds(getBoundX(), upControlPane.getPreferredSize().height + scale(8) + getBoundY(), UPCONTROLPANE_WIDTH, stagePanel.getPreferredSize().height); - colorGroup.setBounds( getColorgroupMarginLeft (), 2 * getBoundY() + upControlPane.getPreferredSize().height + stagePanel.getPreferredSize().height + 2 * LAYOUR_DET, colorGroup.getPreferredSize().width, colorGroup.getPreferredSize().height + upControlPane.getPreferredSize().height); - textGroup.setBounds(colorGroup.getPreferredSize().width + getColorgroupMarginLeft (), upControlPane.getPreferredSize().height + stagePanel.getPreferredSize().height + 2 * LAYOUR_DET + getBoundY(), textGroup.getPreferredSize().width, textGroup.getPreferredSize().height); + upControlPane.setBounds(getBoundX(), getBoundY(), + getParent().getWidth(), upControlPane.getPreferredSize().height + LAYOUR_DET); + stagePanel.setBounds(getBoundX(), upControlPane.getPreferredSize().height + LAYOUR_DET + getBoundY(), + getParent().getWidth(), stagePanel.getPreferredSize().height); + colorGroup.setBounds( getColorgroupMarginLeft(), 2 * getBoundY() + upControlPane.getPreferredSize().height + stagePanel.getPreferredSize().height + 2 * LAYOUR_DET, + colorGroup.getPreferredSize().width, colorGroup.getPreferredSize().height + upControlPane.getPreferredSize().height); + textGroup.setBounds(colorGroup.getPreferredSize().width + getColorgroupMarginLeft(), upControlPane.getPreferredSize().height + stagePanel.getPreferredSize().height + 2 * LAYOUR_DET + getBoundY(), + textGroup.getPreferredSize().width, textGroup.getPreferredSize().height); } @Override @@ -640,9 +643,12 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { @Override public void layoutContainer(Container parent) { - upControlPane.setBounds(getBoundX(), getBoundY(), getBoundWidth(), upControlPane.getPreferredSize().height); - colorGroup.setBounds(COLORGROUP_MARGIN_LEFT, 2 * MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, colorGroup.getPreferredSize().width, colorGroup.getPreferredSize().height + upControlPane.getPreferredSize().height); - textGroup.setBounds(colorGroup.getPreferredSize().width + COLORGROUP_MARGIN_LEFT, MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, textGroup.getPreferredSize().width, textGroup.getPreferredSize().height); + upControlPane.setBounds(getBoundX(), getBoundY(), getParent().getWidth(), + upControlPane.getPreferredSize().height); + colorGroup.setBounds(COLORGROUP_MARGIN_LEFT, 2 * MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, + colorGroup.getPreferredSize().width, colorGroup.getPreferredSize().height + upControlPane.getPreferredSize().height); + textGroup.setBounds(colorGroup.getPreferredSize().width + COLORGROUP_MARGIN_LEFT, MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, + textGroup.getPreferredSize().width, textGroup.getPreferredSize().height); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnConditionPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnConditionPane.java index c4184f3b17..0a1fa3118a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnConditionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnConditionPane.java @@ -1,5 +1,6 @@ package com.fr.van.chart.column; +import com.fine.theme.utils.FineUIScale; import com.fr.chart.base.AttrAlpha; import com.fr.chart.base.AttrBackground; import com.fr.chart.base.AttrBorder; @@ -41,7 +42,7 @@ public class VanChartColumnConditionPane extends DataSeriesConditionPane{ protected void initComponents() { super.initComponents(); //添加全部条件属性后被遮挡 - liteConditionPane.setPreferredSize(new Dimension(300, 400)); + liteConditionPane.setPreferredSize(FineUIScale.scale(new Dimension(300, 400))); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/AbstractNormalMultiLineConditionPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/AbstractNormalMultiLineConditionPane.java index 3c2734bba8..f48f4ef061 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/AbstractNormalMultiLineConditionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/AbstractNormalMultiLineConditionPane.java @@ -45,15 +45,17 @@ public abstract class AbstractNormalMultiLineConditionPane extends ConditionAttr JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane(); pane.add(initContentPane()); - this.add(row(column(cell(nameLabel), flex()).weight(0.2), - row(cell(initContentPane()).weight(1), flex()).weight(0.8)).with(it -> it.setBorder(new ScaledEmptyBorder(5, 5, 5, 0))).getComponent()); - + this.add(row( + column(cell(nameLabel), flex()).weight(0.2), + cell(initContentPane()).weight(0.8) + ).with(it -> it.setBorder(new ScaledEmptyBorder(5, 5, 5, 5)) + ).getComponent(), BorderLayout.CENTER); } /** * 添加删除按钮 */ public void addCancel() { - this.add(column(fix(5), cell(cancel), flex()).getComponent(), BorderLayout.EAST); + this.add(column(cell(cancel), flex()).getComponent(), BorderLayout.EAST); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/RadarTableContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/RadarTableContentPane.java index fa77258537..07645e3251 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/RadarTableContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/RadarTableContentPane.java @@ -1,19 +1,16 @@ package com.fr.van.chart.designer.style.axis.radar; +import com.fine.theme.utils.FineLayoutBuilder; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.plugin.chart.radar.data.RadarYAxisTableDefinition; import javax.swing.JPanel; -import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Component; -import java.awt.Dimension; import java.util.List; public class RadarTableContentPane extends AbstractTableDataContentPane { @@ -29,13 +26,10 @@ public class RadarTableContentPane extends AbstractTableDataContentPane { private void initAllComponent() { categoryNameComboBox = new UIComboBox(); - categoryNameComboBox.setPreferredSize(new Dimension(100, 20)); minValueComboBox = new UIComboBox(); - minValueComboBox.setPreferredSize(new Dimension(100, 20)); maxValueComboBox = new UIComboBox(); - maxValueComboBox.setPreferredSize(new Dimension(100, 20)); addAutoItem(); @@ -47,18 +41,13 @@ public class RadarTableContentPane extends AbstractTableDataContentPane { } private JPanel getContentPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] row = {p, p, p}; - double[] col = {p, f}; - Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category") + ":", SwingConstants.RIGHT), categoryNameComboBox}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Min_Value") + ":", SwingConstants.RIGHT), minValueComboBox}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Max_Value") + ":", SwingConstants.RIGHT), maxValueComboBox} + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category")), categoryNameComboBox}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Min_Value")), minValueComboBox}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Max_Value")), maxValueComboBox} }; - return TableLayoutHelper.createTableLayoutPane(components, row, col); + return FineLayoutBuilder.commonLeftRightLayout(components); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java index 635d04fa40..694f2de372 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java @@ -6,6 +6,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartValueAxis; import com.fr.stable.CoreConstants; @@ -38,7 +39,7 @@ public class VanChartRadarYAxisPane extends VanChartValueAxisPane { new Component[]{createValueStylePane(), null}, }; - return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.2, 3}); + return FineLayoutBuilder.compatibleTableLayout(0, components, new double[]{1, 0}); } protected LineComboBox createLineComboBox() { @@ -57,7 +58,7 @@ public class VanChartRadarYAxisPane extends VanChartValueAxisPane { centerPane.add(commenPane, Toolkit.i18nText("Fine-Design_Chart_Axis_Unified_Count")); centerPane.add(tableDataPane, Toolkit.i18nText("Fine-Design_Chart_Respectively_Specified")); - JPanel contentPane = new JPanel(new BorderLayout()); + JPanel contentPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(0, 10)); contentPane.add(valueStyle, BorderLayout.NORTH); contentPane.add(centerPane, BorderLayout.CENTER); valueStyle.addActionListener(new ActionListener() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java index 304639ec5c..4ab7827d44 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java @@ -201,8 +201,9 @@ public class SheetNameTabPane extends JPanel implements MouseListener, MouseMoti } } }); - listener = new ComponentAdapter(){ - @Override public void componentResized(ComponentEvent e) { + listener = new ComponentAdapter() { + @Override + public void componentResized(ComponentEvent e) { for (int i = 0; i < lastOneIndex * NUM; i++) { moveLeft(); } @@ -277,7 +278,7 @@ public class SheetNameTabPane extends JPanel implements MouseListener, MouseMoti * @param oldIndex */ protected void doBeforeChange(int oldIndex) { - reportComposite.doBeforeChange(oldIndex); + reportComposite.doBeforeChange(oldIndex); } /** @@ -286,7 +287,7 @@ public class SheetNameTabPane extends JPanel implements MouseListener, MouseMoti * @param newIndex */ protected void doAfterChange(int newIndex) { - reportComposite.doAfterChange(newIndex); + reportComposite.doAfterChange(newIndex); } /** @@ -328,10 +329,11 @@ public class SheetNameTabPane extends JPanel implements MouseListener, MouseMoti /** * 抽出来方便OEM + * * @return */ - public Icon getAddWorkSheet(){ - return ADD_WORK_SHEET; + public Icon getAddWorkSheet() { + return ADD_WORK_SHEET; } /** @@ -368,8 +370,10 @@ public class SheetNameTabPane extends JPanel implements MouseListener, MouseMoti private void paintBackgroundAndLine(Graphics2D g2d, double textHeight, double maxWidth, int charWidth, int textAscent) { - int arc = FineUIUtils.getAndScaleInt("Center.arc", 10) / 2; - Path2D roundedPath = FineUIUtils.createPartRoundRectangle(0, 0, this.getWidth(), this.getHeight(), 0, 0, 0, arc); + int arc = FineUIUtils.getAndScaleInt("Center.arc", 8); + Path2D roundedPath = FineUIUtils.createPartRoundRectangle(0, 0, + this.getWidth(), this.getHeight(), + 0, 0, 0, arc); FlatUIUtils.setRenderingHints(g2d); g2d.setColor(getBackground()); g2d.fill(roundedPath); @@ -415,8 +419,8 @@ public class SheetNameTabPane extends JPanel implements MouseListener, MouseMoti paintAddButton(g2d); } - protected void paintAddButton(Graphics2D g2d){ - getAddWorkSheet().paintIcon(this, g2d, iconLocation, 3); + protected void paintAddButton(Graphics2D g2d) { + getAddWorkSheet().paintIcon(this, g2d, iconLocation, 3); ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation + getAddWorkSheet().getIconWidth() + iconSepDistance, 3); } @@ -559,41 +563,41 @@ public class SheetNameTabPane extends JPanel implements MouseListener, MouseMoti } if (SwingUtilities.isLeftMouseButton(evt)) { - processLeftMouseButton(evtX); + processLeftMouseButton(evtX); } if (isBlank) { return; } if (SwingUtilities.isRightMouseButton(evt) && !isAuthorityEditing) { - processRightMouseButton(evtX, evtY); + processRightMouseButton(evtX, evtY); } } - private void processRightMouseButton(int evtX, int evtY){ + private void processRightMouseButton(int evtX, int evtY) { MenuDef def = new MenuDef(); addInsertGridShortCut(def); - def.addShortCut(new PolyReportInsertAction(), SeparatorDef.DEFAULT, new RemoveSheetAction(), new RenameSheetAction(), - new CopySheetAction()); + def.addShortCut(new PolyReportInsertAction(), SeparatorDef.DEFAULT, new RemoveSheetAction(), new RenameSheetAction(), + new CopySheetAction()); JPopupMenu tabPop = def.createJMenu().getPopupMenu(); def.updateMenu(); GUICoreUtils.showPopupMenu(tabPop, this, evtX - 1, evtY - 1); } - private void processLeftMouseButton(int evtX){ + private void processLeftMouseButton(int evtX) { if (evtX > iconLocation && evtX < iconLocation + scale(GRID_TOSHEET_RIGHT)) { - firstInsertActionPerformed(); + firstInsertActionPerformed(); } else if (evtX > iconLocation + scale(POLY_TOSHEET_LEFT) && evtX < iconLocation + scale(POLY_TOSHEET_RIGHT)) { new PolyReportInsertAction().actionPerformed(null); } } - protected void addInsertGridShortCut(MenuDef def){ - def.addShortCut(new GridReportInsertAction()); + protected void addInsertGridShortCut(MenuDef def) { + def.addShortCut(new GridReportInsertAction()); } - protected void firstInsertActionPerformed(){ - new GridReportInsertAction().actionPerformed(null); + protected void firstInsertActionPerformed() { + new GridReportInsertAction().actionPerformed(null); } @@ -645,7 +649,7 @@ public class SheetNameTabPane extends JPanel implements MouseListener, MouseMoti * 右移动 * * @param moveRighttDistance 右侧移动距离 - * @param si 宽度坐标 + * @param si 宽度坐标 */ private void move2Right(int moveRighttDistance, int si) { int reportcount = reportComposite.getEditingWorkBook().getReportCount(); @@ -671,7 +675,7 @@ public class SheetNameTabPane extends JPanel implements MouseListener, MouseMoti * 左移动 * * @param moveLeftDistance 左侧距离 - * @param si 宽度坐标 + * @param si 宽度坐标 */ private void move2Left(int moveLeftDistance, int si) { if (selectedIndex > 0) { @@ -746,7 +750,7 @@ public class SheetNameTabPane extends JPanel implements MouseListener, MouseMoti scrollIndex++; } - JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); TemplateTheme theme = template.getTemplateTheme(); TemplateReport templateReport = newTemplateReport(); diff --git a/designer-realize/src/main/java/com/fr/grid/GridRowUI.java b/designer-realize/src/main/java/com/fr/grid/GridRowUI.java index d2b7391f84..5a7f0bf420 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridRowUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridRowUI.java @@ -24,6 +24,7 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.font.FontRenderContext; +import java.awt.font.TextLayout; import java.awt.geom.Rectangle2D; /** @@ -31,15 +32,15 @@ import java.awt.geom.Rectangle2D; * @since 2012-3-22下午5:54:21 */ public class GridRowUI extends ComponentUI { - private Color detailsBackground = UIManager.getColor("Center.GridColumnRowColor"); + private static final int OFFSET = 2; protected Color editedBackground = UIManager.getColor("Center.GridColumnRowEditedColor"); protected Color selectedBackground = UIManager.getColor("Center.GridColumnRowSelectedColor"); - private int resolution ; + private final int resolution; - GridRowUI(int resolution){ - if (resolution == 0){ - resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); + GridRowUI(int resolution) { + if (resolution == 0) { + resolution = DesignerUIModeConfig.getInstance().getScreenResolution(); } this.resolution = resolution; } @@ -49,12 +50,12 @@ public class GridRowUI extends ComponentUI { if (!(c instanceof GridRow)) { throw new IllegalArgumentException("The component c to paint must be a GridColumn!"); } - Graphics2D g2d = (Graphics2D) g; + Graphics2D g2d = (Graphics2D) g.create(); GridRow gridRow = (GridRow) c; ElementCasePane reportPane = gridRow.getElementCasePane(); // size Dimension size = gridRow.getSize(); - float time = (float)resolution/DesignerUIModeConfig.getInstance().getScreenResolution(); + float time = (float) resolution / DesignerUIModeConfig.getInstance().getScreenResolution(); g2d.setFont(gridRow.getFont().deriveFont(gridRow.getFont().getSize2D() * time)); ElementCase elementCase = reportPane.getEditingElementCase(); @@ -135,7 +136,7 @@ public class GridRowUI extends ComponentUI { paintText += "(F)"; } } - drawNormalContent(i, g2d, gridRow, paintText, tmpIncreaseHeight, isSelectedBounds, elementCase, size, tmpHeight1); + drawNormalContent(g2d, gridRow, paintText, tmpIncreaseHeight, isSelectedBounds, size, tmpHeight1); } } @@ -154,16 +155,19 @@ public class GridRowUI extends ComponentUI { } - private void drawNormalContent(int i, Graphics2D g2d, GridRow gridRow, String paintText, double tmpIncreaseHeight, boolean isSelectedBounds - , ElementCase elementCase, Dimension size, double tmpHeight1) { + private void drawNormalContent(Graphics2D g2d, GridRow gridRow, String paintText, + double increaseHeight, boolean isSelectedBounds, + Dimension size, double y) { // FontMetrics FontRenderContext fontRenderContext = g2d.getFontRenderContext(); - float time = (float)resolution/DesignerUIModeConfig.getInstance().getScreenResolution(); - float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent() * time; + float time = (float) resolution / DesignerUIModeConfig.getInstance().getScreenResolution(); + double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth() * time; - double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight() * time; + // 为了居中获取可视边界 + Rectangle2D bounds = new TextLayout(paintText, gridRow.getFont(), fontRenderContext).getBounds(); + double stringHeight = bounds.getHeight() * time; // 如果高度太小了就不画了 - if (stringHeight <= tmpIncreaseHeight + 2) { + if (stringHeight <= increaseHeight + OFFSET) { if (isSelectedBounds) { g2d.setColor(gridRow.getSelectedForeground()); } else { @@ -175,8 +179,10 @@ public class GridRowUI extends ComponentUI { } } - GraphHelper.drawString(g2d, paintText, (size.width - stringWidth) / 2, tmpHeight1 + (tmpIncreaseHeight - stringHeight) / 2 + GridHeader.SIZE_ADJUST / 2 + fmAscent - 2); + GraphHelper.drawString(g2d, paintText, + (size.width - stringWidth) / 2, + y + (increaseHeight - stringHeight) / 2.0 + stringHeight); } } -} \ No newline at end of file +}