From b2f2ed3704f2f4f534089b93cef03fdc96c7e13f Mon Sep 17 00:00:00 2001 From: MoMeak Date: Wed, 16 Aug 2017 16:58:57 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E7=BC=A9=E6=94=BE=E6=97=B6=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E7=BC=A9=E6=94=BE=E8=A1=8C=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/ReportFloatPane.java | 2 +- designer/src/com/fr/grid/GridColumn.java | 4 ++-- designer/src/com/fr/grid/GridColumnUI.java | 15 +++++++++------ designer/src/com/fr/grid/GridCorner.java | 13 +++++++------ designer/src/com/fr/grid/GridRow.java | 4 ++-- designer/src/com/fr/grid/GridRowUI.java | 11 +++++++---- 6 files changed, 28 insertions(+), 21 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/ReportFloatPane.java b/designer/src/com/fr/design/mainframe/ReportFloatPane.java index 3a2756a130..9f579f4f96 100644 --- a/designer/src/com/fr/design/mainframe/ReportFloatPane.java +++ b/designer/src/com/fr/design/mainframe/ReportFloatPane.java @@ -49,7 +49,7 @@ public class ReportFloatPane extends JPanel { JPanel toolBarPane = new JPanel(new BorderLayout()); toolBarPane.add(topToolBar, BorderLayout.CENTER); - toolBarPane.setBorder(BorderFactory.createLineBorder(UIConstants.TITLED_BORDER_COLOR)); + toolBarPane.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER)); toolBarPane.setPreferredSize(new Dimension(155,20)); UILabel emptyLabel = new UILabel(); emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); diff --git a/designer/src/com/fr/grid/GridColumn.java b/designer/src/com/fr/grid/GridColumn.java index 165a5727a9..b6644df91d 100644 --- a/designer/src/com/fr/grid/GridColumn.java +++ b/designer/src/com/fr/grid/GridColumn.java @@ -68,11 +68,11 @@ public class GridColumn extends GridHeader { @Override public Dimension getPreferredSize() { ElementCasePane reportPane = this.getElementCasePane(); - + float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); if (!reportPane.isColumnHeaderVisible()) { return new Dimension(0, 0); } - return new Dimension(super.getPreferredSize().width, GraphHelper.getFontMetrics(this.getFont()).getHeight() + SIZE_ADJUST); + return new Dimension(super.getPreferredSize().width, (int) (GraphHelper.getFontMetrics(this.getFont()).getHeight() * time + SIZE_ADJUST)); } } \ No newline at end of file diff --git a/designer/src/com/fr/grid/GridColumnUI.java b/designer/src/com/fr/grid/GridColumnUI.java index 227de31941..9712821682 100644 --- a/designer/src/com/fr/grid/GridColumnUI.java +++ b/designer/src/com/fr/grid/GridColumnUI.java @@ -48,6 +48,9 @@ public class GridColumnUI extends ComponentUI { Grid gird = reportPane.getGrid(); // size Dimension size = gridColumn.getSize(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); + g2d.setFont(gridColumn.getFont().deriveFont(gridColumn.getFont().getSize2D() * time)); + ElementCase elementCase = reportPane.getEditingElementCase(); DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(elementCase); int horizontalValue = gird.getHorizontalValue(); @@ -77,7 +80,7 @@ public class GridColumnUI extends ComponentUI { g2d.setPaint(gridColumn.getSeparatorLineColor()); GraphHelper.drawLine(g2d, 0, 0, 0, size.getHeight()); double tmpWidth2 = 0; - drawColumn(horizontalBeginValue, horizontalEndValue, columnWidthList, tmpWidth2, reportPane, g2d, gridColumn); + drawColumn(horizontalBeginValue, horizontalEndValue, columnWidthList, tmpWidth2, reportPane, g2d, gridColumn, size); // 画上边的边框线. g2d.setColor(gridColumn.getSeparatorLineColor()); GraphHelper.drawLine(g2d, 0, 0, tmpWidth2, 0); @@ -85,14 +88,13 @@ public class GridColumnUI extends ComponentUI { private void drawColumn(int horizontalBeginValue, int horizontalEndValue, DynamicUnitList columnWidthList, double tmpWidth2, - ElementCasePane reportPane, Graphics2D g2d, GridColumn gridColumn) { + ElementCasePane reportPane, Graphics2D g2d, GridColumn gridColumn, Dimension size) { // draw column. boolean isSelectedBounds; double tmpWidth1 = 0; double tmpIncreaseWidth = 0; ElementCase elementCase = reportPane.getEditingElementCase(); - Dimension size = gridColumn.getSize(); // FontMetrics FontRenderContext fontRenderContext = g2d.getFontRenderContext(); LineMetrics fm = gridColumn.getFont().getLineMetrics("", fontRenderContext); @@ -158,8 +160,9 @@ public class GridColumnUI extends ComponentUI { columnContent += "(FR)"; } } + float time = (float)resolution/ScreenResolution.getScreenResolution(); - double stringWidth = gridColumn.getFont().getStringBounds(columnContent, fontRenderContext).getWidth(); + double stringWidth = gridColumn.getFont().getStringBounds(columnContent, fontRenderContext).getWidth() * time; // if (stringWidth > tmpIncreaseWidth) { // paintMoreContent(i, g2d, tmpWidth1, size, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent); // } else { @@ -203,8 +206,8 @@ public class GridColumnUI extends ComponentUI { g2d.setPaint(UIManager.getColor("controlShadow")); } } - - GraphHelper.drawString(g2d, columnContent, tmpWidth1 + (tmpIncreaseWidth - stringWidth) / 2, fmAscent + GridHeader.SIZE_ADJUST / 2 + 1); + GraphHelper.drawString(g2d, columnContent, tmpWidth1 + (tmpIncreaseWidth - stringWidth) / 2, + (gridColumn.getSize().height/2 + g2d.getFont().getSize2D()/2)); } diff --git a/designer/src/com/fr/grid/GridCorner.java b/designer/src/com/fr/grid/GridCorner.java index a3f79b9331..91891fd44d 100644 --- a/designer/src/com/fr/grid/GridCorner.java +++ b/designer/src/com/fr/grid/GridCorner.java @@ -12,6 +12,7 @@ import java.awt.geom.Rectangle2D; import javax.swing.event.MouseInputListener; import com.fr.base.GraphHelper; +import com.fr.base.ScreenResolution; import com.fr.design.mainframe.ElementCasePane; /** @@ -37,7 +38,7 @@ public class GridCorner extends BaseGridComponent { Graphics2D g2d = (Graphics2D) g; ElementCasePane reportPane = this.getElementCasePane(); - + float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); //size Dimension size = this.getSize(); Rectangle2D rect2D = new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()); @@ -50,7 +51,7 @@ public class GridCorner extends BaseGridComponent { GraphHelper.fill(g2d, rect2D); } - paintArc(g2d, size); + paintArc(g2d, size, time); //画左边的边框线. g2d.setColor(reportPane.getGridColumn().getSeparatorLineColor()); @@ -85,15 +86,15 @@ public class GridCorner extends BaseGridComponent { } - private void paintArc(Graphics2D g2d, Dimension size) { + private void paintArc(Graphics2D g2d, Dimension size, float time) { g2d.setColor(Color.gray); - int width = size.width - 16; + int width = (int) (size.width - (16 * time)); int avgWidth = width / 3; - int height = size.height - 8; + int height = (int) (size.height - (8 * time)); int avgHeight = height / 3; for (int i = 0; i < 3; i ++) { for (int j = 0; j < 3; j ++) { - GraphHelper.fillArc(g2d, 8 + i * avgWidth, 4 + j * avgHeight, 3, 3, 0, 360); + GraphHelper.fillArc(g2d, (8 * time) + (i * avgWidth), (4 * time) + (j * avgHeight), 3, 3, 0, 360); } } } diff --git a/designer/src/com/fr/grid/GridRow.java b/designer/src/com/fr/grid/GridRow.java index c80d08a4ec..70679b91bc 100644 --- a/designer/src/com/fr/grid/GridRow.java +++ b/designer/src/com/fr/grid/GridRow.java @@ -65,13 +65,13 @@ public class GridRow extends GridHeader { @Override public Dimension getPreferredSize() { ElementCasePane reportPane = this.getElementCasePane(); - + float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); if (!(reportPane.isRowHeaderVisible())) { return new Dimension(0, 0); } int maxCharNumber = this.caculateMaxCharNumber(reportPane); - return new Dimension(maxCharNumber * GraphHelper.getFontMetrics(this.getFont()).charWidth('M'), super.getPreferredSize().height); + return new Dimension((int) (maxCharNumber * GraphHelper.getFontMetrics(this.getFont()).charWidth('M') * time), super.getPreferredSize().height); } /** diff --git a/designer/src/com/fr/grid/GridRowUI.java b/designer/src/com/fr/grid/GridRowUI.java index 4c0694a21a..016cfe6378 100644 --- a/designer/src/com/fr/grid/GridRowUI.java +++ b/designer/src/com/fr/grid/GridRowUI.java @@ -46,6 +46,9 @@ public class GridRowUI extends ComponentUI { ElementCasePane reportPane = gridRow.getElementCasePane(); // size Dimension size = gridRow.getSize(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); + g2d.setFont(gridRow.getFont().deriveFont(gridRow.getFont().getSize2D() * time)); + ElementCase elementCase = reportPane.getEditingElementCase(); DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(elementCase); int verticalValue = reportPane.getGrid().getVerticalValue(); @@ -152,10 +155,10 @@ public class GridRowUI extends ComponentUI { , ElementCase elementCase, Dimension size, double tmpHeight1) { // FontMetrics FontRenderContext fontRenderContext = g2d.getFontRenderContext(); - - float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent(); - double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth(); - double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight(); + float time = (float)resolution/ScreenResolution.getScreenResolution(); + float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent() * time; + double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth() * time; + double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight() * time; if (isSelectedBounds) { g2d.setColor(gridRow.getSelectedForeground()); } else {