Browse Source

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

* commit '372ae835da4a36b5a99e124eb8f619baafaa4f46':
  REPORT-4186 [代码质量]设计器属性分类标题,代码实现最好用基本控件实现
  REPORT-4450 聚合报表在缩放后编辑报表块,会出现单元格错乱 修改xy坐标
  REPORT-4450 聚合报表在缩放后编辑报表块,会出现单元格错乱
master
superman 7 years ago
parent
commit
7fb977d554
  1. 2
      designer/src/com/fr/poly/PolyDesignUI.java
  2. 3
      designer/src/com/fr/poly/PolyDesigner.java
  3. 9
      designer/src/com/fr/poly/PolyUtils.java
  4. 8
      designer/src/com/fr/poly/creator/ECBlockCreator.java
  5. 2
      designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java
  6. 17
      designer_base/src/com/fr/design/foldablepane/HeaderPane.java

2
designer/src/com/fr/poly/PolyDesignUI.java

@ -106,7 +106,7 @@ public class PolyDesignUI extends ComponentUI {
BlockCreator creator = addedData.getAddedAt(i);
// richer:如果当前这个组件正在编辑,那么他是完全被他的编辑器所遮挡的,不需要画出来
if (creator == designer.getSelection()) {
paintPositionLine(g, Math.round(creator.getX() * time), Math.round(creator.getY() * time),
paintPositionLine(g, Math.round(creator.getX(time)), Math.round(creator.getY(time)),
Math.round(designer.getHorizontalValue()*time), Math.round(designer.getVerticalValue()*time));
if (creator.getEditor().isDragging()) {
creator.getEditor().paintAbsorptionline(g);

3
designer/src/com/fr/poly/PolyDesigner.java

@ -272,7 +272,6 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
this.time = (float) resolution / ScreenResolution.getScreenResolution();
resetEditorComponentBounds();
LayoutUtils.layoutRootContainer(this);
g.setColor(Color.black);
GraphHelper.drawLine(g, 0, 0, this.getWidth(), 0);
GraphHelper.drawLine(g, 0, 0, 0, this.getHeight());
@ -281,7 +280,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
private void resetEditorComponentBounds() {
if (selection != null) {
selection.setResolution(this.resolution);
selection.setResolution(ScreenResolution.getScreenResolution());
selection.getEditor().setBounds((int) (selection.getEditorBounds().x * time), (int) (selection.getEditorBounds().y * time),
(int) (selection.getEditorBounds().width * time), (int) (selection.getEditorBounds().height * time));
LayoutUtils.layoutRootContainer(this);

9
designer/src/com/fr/poly/PolyUtils.java

@ -115,10 +115,11 @@ public class PolyUtils {
AddedData addedData = designer.getAddedData();
for (int count = addedData.getAddedCount() - 1; count >= 0; count--) {
BlockCreator creator = addedData.getAddedAt(count);
int cx = creator.getX();
int cy = creator.getY();
int cw = creator.getWidth();
int ch = creator.getHeight();
float times = (float) designer.getResolution()/ScreenResolution.getScreenResolution();
int cx = (int) (creator.getX() * times);
int cy = (int) (creator.getY() * times);
int cw = (int) (creator.getWidth() * times);
int ch = (int) (creator.getHeight() * times);
if (x >= cx && x <= (cx + cw)) {
if(y >= cy && y <= (cy + ch)) {
return creator;

8
designer/src/com/fr/poly/creator/ECBlockCreator.java

@ -23,8 +23,8 @@ import com.fr.stable.unit.UnitRectangle;
*/
public class ECBlockCreator extends BlockCreator<PolyECBlock> {
private ECBlockEditor editor;
private static final int CREATOR_WIDTH = 30;
private static final int CREATOR_HEIGHT = 19;
private static final int CREATOR_WIDTH = 20;
private static final int CREATOR_HEIGHT = 9;
public ECBlockCreator() {
@ -69,12 +69,12 @@ public class ECBlockCreator extends BlockCreator<PolyECBlock> {
@Override
public int getX(float time) {
return (int) ((this.getX() - CREATOR_WIDTH) * time) + CREATOR_WIDTH;
return Math.round ((this.getX() - CREATOR_WIDTH) * time) + CREATOR_WIDTH;
}
@Override
public int getY(float time) {
return (int) ((this.getY() - CREATOR_HEIGHT) * time) + CREATOR_HEIGHT;
return Math.round ((this.getY() - CREATOR_HEIGHT) * time) + CREATOR_HEIGHT;
}
/**

2
designer/src/com/fr/poly/hanlder/BottomCornerMouseHanlder.java

@ -15,6 +15,7 @@ import com.fr.design.beans.location.Absorptionline;
import com.fr.design.beans.location.MoveUtils;
import com.fr.design.beans.location.MoveUtils.RectangleDesigner;
import com.fr.design.beans.location.MoveUtils.RectangleIterator;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.general.ComparatorUtils;
import com.fr.poly.PolyDesigner;
import com.fr.poly.PolyDesigner.SelectionType;
@ -101,6 +102,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter {
dragStart.y -= pressed.y;
TemplateBlock block = editor.getValue();
resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
Rectangle bounds = block.getBounds().toRectangle(resolution);
Point resultPoint = MoveUtils.sorption(bounds.x + dragStart.x < 0 ? 0 : bounds.x + dragStart.x, bounds.y
+ dragStart.y < 0 ? 0 : bounds.y + dragStart.y, bounds.width, bounds.height, rectDesigner, false);

17
designer_base/src/com/fr/design/foldablepane/HeaderPane.java

@ -1,5 +1,6 @@
package com.fr.design.foldablepane;
import com.fr.base.GraphHelper;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxUtilities;
@ -53,6 +54,7 @@ public class HeaderPane extends JPanel {
RenderingHints.VALUE_ANTIALIAS_ON);
BufferedImage panelImage = createPanelImage();
g2d.drawImage(panelImage, null, 0, 0);
GraphHelper.drawString(g2d, this.title, TITLE_X, headHeight - fontSize / 2 - 1);
}
private BufferedImage createPanelImage() {
@ -67,7 +69,6 @@ public class HeaderPane extends JPanel {
if (desktopHints != null) {
g2d.setRenderingHints(desktopHints);
}
g2d.drawString(this.title, TITLE_X, headHeight - fontSize / 2 - 1);
int leftWdith = headWidth - LEFT_X;
if (this.isShow) {
image = UIConstants.DRAG_DOWN_SELECTED_SMALL;
@ -103,13 +104,13 @@ public class HeaderPane extends JPanel {
}
public static void main(String[] args) {
// JFrame mainFrame = new JFrame("UI Demo - Gloomyfish");
// mainFrame.getContentPane().setLayout(new BorderLayout());
// mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本", 24), BorderLayout.CENTER);
// mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// mainFrame.pack();
// mainFrame.setSize(300, 400);
// mainFrame.setVisible(true);
JFrame mainFrame = new JFrame("UI Demo - Gloomyfish");
mainFrame.getContentPane().setLayout(new BorderLayout());
mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本", 24), BorderLayout.CENTER);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.pack();
mainFrame.setSize(300, 400);
mainFrame.setVisible(true);
}
}

Loading…
Cancel
Save