Browse Source

Merge pull request #1082 in BA/design from ~MOMEAK/design9.0:release/9.0 to release/9.0

* commit 'd2d49259510c47a0c8615475903db769ba55d7d7':
  REPORT-2897 9.0设计器修改 缩放时同时缩放行列
master
superman 7 years ago
parent
commit
594eff59c7
  1. 2
      designer/src/com/fr/design/mainframe/ReportFloatPane.java
  2. 4
      designer/src/com/fr/grid/GridColumn.java
  3. 15
      designer/src/com/fr/grid/GridColumnUI.java
  4. 13
      designer/src/com/fr/grid/GridCorner.java
  5. 4
      designer/src/com/fr/grid/GridRow.java
  6. 11
      designer/src/com/fr/grid/GridRowUI.java

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

4
designer/src/com/fr/grid/GridColumn.java

@ -68,11 +68,11 @@ public class GridColumn extends GridHeader<String> {
@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));
}
}

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

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

4
designer/src/com/fr/grid/GridRow.java

@ -65,13 +65,13 @@ public class GridRow extends GridHeader<Integer> {
@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);
}
/**

11
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 {

Loading…
Cancel
Save