Browse Source

REPORT-2897 9.0设计器修改

聚合报表缩放条部分
master
MoMeak 7 years ago
parent
commit
f89951424a
  1. 36
      designer/src/com/fr/design/mainframe/JWorkBook.java
  2. 2
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  3. 18
      designer/src/com/fr/poly/PolyArea.java
  4. 69
      designer/src/com/fr/poly/PolyDesignUI.java
  5. 62
      designer/src/com/fr/poly/PolyDesigner.java
  6. 4
      designer/src/com/fr/poly/creator/BlockCreator.java
  7. 2
      designer/src/com/fr/poly/creator/BlockEditor.java
  8. 14
      designer/src/com/fr/poly/creator/ChartBlockCreator.java
  9. 11
      designer/src/com/fr/poly/creator/ChartBlockEditor.java
  10. 5
      designer/src/com/fr/poly/creator/ECBlockEditor.java
  11. 13
      designer_base/src/com/fr/design/mainframe/JTemplate.java
  12. 11
      designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
  13. 10
      designer_form/src/com/fr/design/mainframe/JForm.java

36
designer/src/com/fr/design/mainframe/JWorkBook.java

@ -56,6 +56,7 @@ import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.main.parameter.ReportParameterAttr; import com.fr.main.parameter.ReportParameterAttr;
import com.fr.poly.PolyDesigner; import com.fr.poly.PolyDesigner;
import com.fr.poly.creator.BlockCreator;
import com.fr.privilege.finegrain.WorkSheetPrivilegeControl; import com.fr.privilege.finegrain.WorkSheetPrivilegeControl;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.ElementCase;
@ -147,6 +148,16 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return processInfo; return processInfo;
} }
@Override
public void setJTemplateResolution(int resolution) {
this.resolution = resolution;
}
@Override
public int getJTemplateResolution() {
return this.resolution;
}
/** /**
* 判断sheet权限 * 判断sheet权限
* *
@ -353,6 +364,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
} }
if (reportComposite.centerCardPane.polyDezi != null){ if (reportComposite.centerCardPane.polyDezi != null){
reportComposite.centerCardPane.polyDezi.setResolution(resolution); reportComposite.centerCardPane.polyDezi.setResolution(resolution);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setJTemplateResolution(resolution);
reportComposite.centerCardPane.polyDezi.updateUI(); reportComposite.centerCardPane.polyDezi.updateUI();
} }
// reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setVerticalValue(10); // reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setVerticalValue(10);
@ -361,6 +373,26 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
} }
@Override @Override
public int selfAdaptUpdate(){ public int selfAdaptUpdate(){
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
if (reportComposite.centerCardPane.polyDezi.getSelection() !=null){
BlockCreator blockCreator =reportComposite.centerCardPane.polyDezi.getSelection();
double x = blockCreator.getEditorBounds().getX();
double y = blockCreator.getEditorBounds().getY();
reportComposite.centerCardPane.polyDezi.setHorizontalValue((int) x);
reportComposite.centerCardPane.polyDezi.setVerticalValue((int) y);
double creatorHeight = blockCreator.getEditorBounds().height;
double creatorWidth = blockCreator.getEditorBounds().width;
double areaHeight = reportComposite.centerCardPane.polyDezi.polyArea.getHeight();
double areaWidth = reportComposite.centerCardPane.polyDezi.polyArea.getWidth();
if (creatorWidth == 0||creatorHeight == 0){
return resolution;
}
double time =(areaHeight/creatorHeight)<(areaWidth/creatorWidth) ? (areaHeight/creatorHeight) : (areaWidth/creatorWidth);
return (int) (time * reportComposite.centerCardPane.polyDezi.getResolution());
}else if (reportComposite.centerCardPane.editingComponet.elementCasePane != null) {
ElementCasePane reportPane = reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getElementCasePane(); ElementCasePane reportPane = reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getElementCasePane();
int column = reportPane.getSelection().getSelectedColumns()[0]; int column = reportPane.getSelection().getSelectedColumns()[0];
double columnLength = reportPane.getSelection().getSelectedColumns().length; double columnLength = reportPane.getSelection().getSelectedColumns().length;
@ -376,8 +408,10 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
reportPane.getVerticalScrollBar().setValue(row); reportPane.getVerticalScrollBar().setValue(row);
reportPane.getHorizontalScrollBar().setValue(column); reportPane.getHorizontalScrollBar().setValue(column);
} }
return (int) (time * reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getResolution()); return (int) (time * reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getResolution());
}else {
return resolution;
}
} }
@Override @Override

2
designer/src/com/fr/design/mainframe/ReportComponentComposite.java

@ -85,7 +85,7 @@ public class ReportComponentComposite extends JComponent {
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
if (jSliderContainer.getSelfAdaptButton().isSelected()){ if (jSliderContainer.getSelfAdaptButton().isSelected()){
int resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().selfAdaptUpdate(); int resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().selfAdaptUpdate();
jSliderContainer.getShowVal().setValue(resolution); jSliderContainer.getShowVal().setValue(resolution*HUND/ScreenResolution.getScreenResolution());
} }
} }
}; };

18
designer/src/com/fr/poly/PolyArea.java

@ -1,15 +1,29 @@
package com.fr.poly; package com.fr.poly;
import javax.swing.JComponent; import javax.swing.JComponent;
public class PolyArea extends JComponent { public class PolyArea extends JComponent {
private PolyDesigner polyDesigner; private PolyDesigner polyDesigner;
private int resolution;
public PolyArea(PolyDesigner polyDesigner) { public PolyArea(PolyDesigner polyDesigner, int resolution) {
this.polyDesigner = polyDesigner; this.polyDesigner = polyDesigner;
setUI(new PolyDesignUI()); this.resolution = resolution;
this.setUI(new PolyDesignUI(resolution));
// setUI(new PolyDesignUI());
}
public void setResolution(int resolution) {
this.resolution = resolution;
} }
public int getResolution() {
return this.resolution;
}
public PolyDesigner getPolyDesigner() { public PolyDesigner getPolyDesigner() {
return polyDesigner; return polyDesigner;
} }

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

@ -10,6 +10,7 @@ import java.awt.Graphics2D;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -27,12 +28,14 @@ import com.fr.general.Inter;
import com.fr.page.PaperSettingProvider; import com.fr.page.PaperSettingProvider;
import com.fr.page.ReportSettingsProvider; import com.fr.page.ReportSettingsProvider;
import com.fr.poly.creator.BlockCreator; import com.fr.poly.creator.BlockCreator;
import com.fr.poly.creator.ECBlockCreator;
import com.fr.poly.model.AddedData; import com.fr.poly.model.AddedData;
import com.fr.poly.model.AddingData; import com.fr.poly.model.AddingData;
import com.fr.report.report.Report; import com.fr.report.report.Report;
import com.fr.report.report.TemplateReport; import com.fr.report.report.TemplateReport;
import com.fr.report.stable.ReportConstants; import com.fr.report.stable.ReportConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.unit.UNIT; import com.fr.stable.unit.UNIT;
/** /**
@ -44,13 +47,19 @@ public class PolyDesignUI extends ComponentUI {
private static final double SCROLL_POINT = 50; private static final double SCROLL_POINT = 50;
private static final int SCROLL_DISTANCE = 15; private static final int SCROLL_DISTANCE = 15;
private static final int CREATORWIDTH = 30;
private static final int CREATORGEIGHT = 19;
private static final int TEN = 10;
private static final int HHUNDRED = 100;
private PolyDesigner designer; private PolyDesigner designer;
private int resolution = ScreenResolution.getScreenResolution(); private int resolution;
private int ten = 10; private float time;
private int hundred = 100;
public PolyDesignUI() { public PolyDesignUI(int resolution) {
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
this.resolution = resolution;
} }
/** /**
@ -83,6 +92,8 @@ public class PolyDesignUI extends ComponentUI {
@Override @Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
this.resolution = ((PolyArea)c).getResolution();
this.time = (float)resolution/ScreenResolution.getScreenResolution();
paintBackground(g, c); paintBackground(g, c);
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
paintAddedData(g2d); paintAddedData(g2d);
@ -100,8 +111,15 @@ public class PolyDesignUI extends ComponentUI {
BlockCreator creator = addedData.getAddedAt(i); BlockCreator creator = addedData.getAddedAt(i);
// richer:如果当前这个组件正在编辑,那么他是完全被他的编辑器所遮挡的,不需要画出来 // richer:如果当前这个组件正在编辑,那么他是完全被他的编辑器所遮挡的,不需要画出来
if (creator == designer.getSelection()) { if (creator == designer.getSelection()) {
paintPositionLine(g, creator.getX(), creator.getY(), designer.getHorizontalValue(), designer if (creator instanceof ECBlockCreator){
.getVerticalValue()); int x = (int) ((creator.getX()-CREATORWIDTH)*time)+CREATORWIDTH;
int y = (int) ((creator.getY()-CREATORGEIGHT)*time)+CREATORGEIGHT;
paintPositionLine(g, x, y, (int) (designer.getHorizontalValue()*time), (int) (designer.getVerticalValue()*time));
}else {
int x = (int) (creator.getX()*time);
int y = (int) (creator.getY()*time);
paintPositionLine(g, x, y, (int) (designer.getHorizontalValue()*time), (int) (designer.getVerticalValue()*time));
}
if (creator.getEditor().isDragging()) { if (creator.getEditor().isDragging()) {
creator.getEditor().paintAbsorptionline(g); creator.getEditor().paintAbsorptionline(g);
//如果与其他块重合了, 需要画出提示禁止重叠 //如果与其他块重合了, 需要画出提示禁止重叠
@ -112,8 +130,8 @@ public class PolyDesignUI extends ComponentUI {
creator.getEditor().hideForbiddenWindow(); creator.getEditor().hideForbiddenWindow();
} }
} else { } else {
paintCreator(g, creator, creator.getX() - designer.getHorizontalValue(), creator.getY() - designer.getVerticalValue(), paintCreator(g, creator, (int) (creator.getX()*time - designer.getHorizontalValue()*time), (int) (creator.getY()*time - designer.getVerticalValue()*time),
creator.getWidth(), creator.getHeight()); (int) (creator.getWidth()*time), (int) (creator.getHeight()*time));
} }
} }
} }
@ -126,8 +144,8 @@ public class PolyDesignUI extends ComponentUI {
return; return;
} }
int x = (int) (designer.getAreaLocationX() + pixRec.getCenterX() - designer.getHorizontalValue()); int x = (int) (designer.getAreaLocationX() + pixRec.getCenterX()*time - designer.getHorizontalValue());
int y = (int) (designer.getAreaLocationY() + pixRec.getCenterY() - designer.getVerticalValue()); int y = (int) (designer.getAreaLocationY() + pixRec.getCenterY()*time - designer.getVerticalValue());
creator.getEditor().showForbiddenWindow(x, y); creator.getEditor().showForbiddenWindow(x, y);
} }
@ -183,16 +201,16 @@ public class PolyDesignUI extends ComponentUI {
private String convertUnit(int i) { private String convertUnit(int i) {
short unit = designer.getRulerLengthUnit(); short unit = designer.getRulerLengthUnit();
int resolution = ScreenResolution.getScreenResolution(); // int resolution = ScreenResolution.getScreenResolution();
if (unit == Constants.UNIT_MM) { if (unit == Constants.UNIT_MM) {
Double j = (i + 2) * 1.0 * Constants.HUNDRED_FU_PER_INCH / Constants.HUNDRED_FU_PER_MM / resolution; Double j = (i + 2) * 1.0 * Constants.HUNDRED_FU_PER_INCH / Constants.HUNDRED_FU_PER_MM / resolution;
return j.intValue() + Inter.getLocText("Unit_MM"); return j.intValue() + Inter.getLocText("Unit_MM");
} else if (unit == Constants.UNIT_CM) { } else if (unit == Constants.UNIT_CM) {
Double j = (i + 2) * 1.0 * Constants.HUNDRED_FU_PER_INCH / Constants.HUNDRED_FU_PER_MM / resolution; Double j = (i + 2) * 1.0 * Constants.HUNDRED_FU_PER_INCH / Constants.HUNDRED_FU_PER_MM / resolution;
return new DecimalFormat("0.0").format(j.intValue() * 1.0 / ten) + Inter.getLocText("Unit_CM"); return new DecimalFormat("0.0").format(j.intValue() * 1.0 / TEN) + Inter.getLocText("Unit_CM");
} else if (unit == Constants.UNIT_INCH) { } else if (unit == Constants.UNIT_INCH) {
Double j = i == 0 ? 0 : (i + 2) * 1.0 / resolution * hundred; Double j = i == 0 ? 0 : (i + 2) * 1.0 / resolution * HHUNDRED;
return new DecimalFormat("0.00").format(j.intValue() * 1.0 / hundred) + Inter.getLocText("Unit_INCH"); return new DecimalFormat("0.00").format(j.intValue() * 1.0 / HHUNDRED) + Inter.getLocText("Unit_INCH");
} else if (unit == Constants.UNIT_PT) { } else if (unit == Constants.UNIT_PT) {
int j = i == 0 ? 0 : (i + 2) * UNIT.PT_PER_INCH / resolution; int j = i == 0 ? 0 : (i + 2) * UNIT.PT_PER_INCH / resolution;
return j + Inter.getLocText("Unit_PT"); return j + Inter.getLocText("Unit_PT");
@ -203,10 +221,10 @@ public class PolyDesignUI extends ComponentUI {
private void paintAddingData(Graphics g, AddingData addingData) { private void paintAddingData(Graphics g, AddingData addingData) {
BlockCreator comp = addingData.getCreator(); BlockCreator comp = addingData.getCreator();
int x = addingData.getCurrentX(); int x = (int) (addingData.getCurrentX()*time);
int y = addingData.getCurrentY(); int y = (int) (addingData.getCurrentY()*time);
int width = comp.getWidth(); int width = (int) (comp.getWidth()*time);
int height = comp.getHeight(); int height = (int) (comp.getHeight()*time);
paintCreator(g, comp, x, y, width, height); paintCreator(g, comp, x, y, width, height);
} }
@ -214,9 +232,16 @@ public class PolyDesignUI extends ComponentUI {
ArrayList<JComponent> dbcomponents = new ArrayList<JComponent>(); ArrayList<JComponent> dbcomponents = new ArrayList<JComponent>();
// richer:禁止双缓冲行为,否则会出现两个图像 // richer:禁止双缓冲行为,否则会出现两个图像
ComponentUtils.disableBuffer(comp, dbcomponents); ComponentUtils.disableBuffer(comp, dbcomponents);
Graphics clipg = g.create(x, y, width, height); // Graphics clipg = g.create(x, y, width*resolution/ScreenResolution.getScreenResolution(), height*resolution/ScreenResolution.getScreenResolution());
comp.paint(clipg); //
clipg.dispose(); BufferedImage img = CoreGraphHelper.createBufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = img.createGraphics();
comp.printAll(g2d);
g2d.dispose();
g.drawImage(img,x,y,width,height,null);
// comp.paint(clipg);
// clipg.dispose();
ComponentUtils.resetBuffer(dbcomponents); ComponentUtils.resetBuffer(dbcomponents);
} }

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

@ -3,14 +3,10 @@
*/ */
package com.fr.poly; package com.fr.poly;
import java.awt.AWTEvent; import java.awt.*;
import java.awt.Adjustable;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -36,16 +32,7 @@ import com.fr.design.designer.EditingState;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.AuthorityEditPane; import com.fr.design.mainframe.*;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.ElementCasePaneAuthorityEditPane;
import com.fr.design.mainframe.FormScrollBar;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.NoSupportAuthorityEdit;
import com.fr.design.mainframe.ReportComponent;
import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
@ -75,6 +62,7 @@ import com.fr.report.block.Block;
import com.fr.report.poly.PolyWorkSheet; import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.poly.TemplateBlock; import com.fr.report.poly.TemplateBlock;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.stable.unit.OLDPIX; import com.fr.stable.unit.OLDPIX;
@ -98,7 +86,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
public static enum SelectionType { public static enum SelectionType {
NONE, INNER, BLOCK NONE, INNER, BLOCK
} }
public JComponent polyArea;
private SelectionType selectedtype = SelectionType.NONE; private SelectionType selectedtype = SelectionType.NONE;
private AddingData addingData; private AddingData addingData;
private AddedData addedData; private AddedData addedData;
@ -108,16 +96,16 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
private int horizontalValue = 0; private int horizontalValue = 0;
private int verticalValue = 0; private int verticalValue = 0;
private transient ArrayList<TemplateBlock> clip_board = new ArrayList<TemplateBlock>(); private transient ArrayList<TemplateBlock> clip_board = new ArrayList<TemplateBlock>();
// richer:鼠标滚轮每滚动一下,PolyDesignPane的尺寸就改变ROTATIONS这么多 // richer:鼠标滚轮每滚动一下,PolyDesignPane的尺寸就改变ROTATIONS这么多
private static final int ROTATIONS = 50; private static final int ROTATIONS = 50;
private JScrollBar verScrollBar; private JScrollBar verScrollBar;
private JScrollBar horScrollBar; private JScrollBar horScrollBar;
private JComponent polyArea;
private PolyComponetsBar polyComponetsBar = new PolyComponetsBar(); private PolyComponetsBar polyComponetsBar = new PolyComponetsBar();
private JComponent[] toolBarComponent = null; private JComponent[] toolBarComponent = null;
private int resolution = ScreenResolution.getScreenResolution(); private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
private float time;
public PolyDesigner(PolyWorkSheet report) { public PolyDesigner(PolyWorkSheet report) {
super(report); super(report);
@ -157,7 +145,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
private void initComponents() { private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel ployareaPane = new JPanel(new PolyDesignerLayout()); JPanel ployareaPane = new JPanel(new PolyDesignerLayout());
polyArea = new PolyArea(this); polyArea = new PolyArea(this, resolution);
ployareaPane.add(PolyDesignerLayout.Center, polyArea); ployareaPane.add(PolyDesignerLayout.Center, polyArea);
horScrollBar = new FormScrollBar(Adjustable.HORIZONTAL, this); horScrollBar = new FormScrollBar(Adjustable.HORIZONTAL, this);
@ -181,6 +169,20 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
repaint(); repaint();
} }
public void setResolution(int resolution) {
this.resolution = resolution;
}
public int getResolution() {
return this.resolution;
}
public void updateUI(){
((PolyArea)this.polyArea).setResolution(resolution);
polyArea.repaint();
// this.polyArea = (JComponent) new PolyArea(this, resolution);
}
/** /**
* 是否含有聚和报表块 * 是否含有聚和报表块
* @param targetComponent 目标组件 * @param targetComponent 目标组件
@ -250,13 +252,24 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
this.time = (float)resolution/ScreenResolution.getScreenResolution();
resetEditorComponentBounds(); resetEditorComponentBounds();
LayoutUtils.layoutRootContainer(this);
g.setColor(Color.black); g.setColor(Color.black);
GraphHelper.drawLine(g, 0, 0, this.getWidth(), 0); GraphHelper.drawLine(g, 0, 0, this.getWidth(), 0);
GraphHelper.drawLine(g, 0, 0, 0, this.getHeight()); GraphHelper.drawLine(g, 0, 0, 0, this.getHeight());
super.paintComponent(g); super.paintComponent(g);
} }
private void resetEditorComponentBounds() {
if (selection != null) {
selection.setResolution(this.resolution);
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);
}
}
/** /**
* 增加组件 * 增加组件
* @param creator 组件 * @param creator 组件
@ -368,12 +381,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
repaint(); repaint();
} }
private void resetEditorComponentBounds() {
if (selection != null) {
selection.getEditor().setBounds(selection.getEditorBounds());
LayoutUtils.layoutRootContainer(this);
}
}
/** /**
* @return * @return

4
designer/src/com/fr/poly/creator/BlockCreator.java

@ -75,6 +75,10 @@ public abstract class BlockCreator<T extends TemplateBlock> extends JComponent i
LayoutUtils.layoutContainer(this); LayoutUtils.layoutContainer(this);
} }
public void setResolution(int resolution){
this.resolution = resolution;
}
//默认大小, 报表块默认3列6行, 图表块默认330*240 //默认大小, 报表块默认3列6行, 图表块默认330*240
public abstract UnitRectangle getDefaultBlockBounds(); public abstract UnitRectangle getDefaultBlockBounds();

2
designer/src/com/fr/poly/creator/BlockEditor.java

@ -50,7 +50,7 @@ public abstract class BlockEditor<T extends JComponent,U extends TemplateBlock>
public BlockEditor(PolyDesigner designer, BlockCreator<U> creator) { public BlockEditor(PolyDesigner designer, BlockCreator<U> creator) {
this.designer = designer; this.designer = designer;
this.creator = creator; this.creator = creator;
this.resolution = creator.resolution;
this.initComponets(); this.initComponets();
this.addColumnRowListeners(); this.addColumnRowListeners();

14
designer/src/com/fr/poly/creator/ChartBlockCreator.java

@ -3,13 +3,15 @@
*/ */
package com.fr.poly.creator; package com.fr.poly.creator;
import java.awt.Color; import java.awt.*;
import java.awt.image.BufferedImage;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.JComponent;
import com.fr.base.ScreenResolution;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
@ -34,6 +36,7 @@ public class ChartBlockCreator extends BlockCreator<PolyChartBlock> {
private static final UNIT DEFAULT_WIDTH = FU.getInstance(12573000); private static final UNIT DEFAULT_WIDTH = FU.getInstance(12573000);
private static final UNIT DEFAULT_HEIGHT = FU.getInstance(9144000); private static final UNIT DEFAULT_HEIGHT = FU.getInstance(9144000);
public ChartBlockCreator() { public ChartBlockCreator() {
} }
@ -42,6 +45,10 @@ public class ChartBlockCreator extends BlockCreator<PolyChartBlock> {
super(block); super(block);
} }
public void setResolution(int resolution){
this.resolution = resolution;
}
/** /**
* 初始化 * 初始化
* @return 初始化的控件. * @return 初始化的控件.
@ -65,6 +72,7 @@ public class ChartBlockCreator extends BlockCreator<PolyChartBlock> {
} }
/** /**
* 检测按钮状态 * 检测按钮状态
* *

11
designer/src/com/fr/poly/creator/ChartBlockEditor.java

@ -5,6 +5,7 @@ package com.fr.poly.creator;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.ScreenResolution;
import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartGetter; import com.fr.base.chart.BaseChartGetter;
@ -13,6 +14,7 @@ import com.fr.design.border.UIRoundedBorder;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JSliderPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.NoSupportAuthorityEdit; import com.fr.design.mainframe.NoSupportAuthorityEdit;
import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.cell.QuickEditorRegion;
@ -25,6 +27,7 @@ import com.fr.poly.PolyDesigner.SelectionType;
import com.fr.poly.hanlder.ColumnOperationMouseHandler; import com.fr.poly.hanlder.ColumnOperationMouseHandler;
import com.fr.poly.hanlder.RowOperationMouseHandler; import com.fr.poly.hanlder.RowOperationMouseHandler;
import com.fr.report.poly.PolyChartBlock; import com.fr.report.poly.PolyChartBlock;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*; import javax.swing.*;
@ -32,6 +35,7 @@ import javax.swing.border.Border;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
/** /**
* @author richer * @author richer
@ -43,6 +47,7 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar
private static Border buttonBorder; private static Border buttonBorder;
private static String[][] chartsNames; private static String[][] chartsNames;
private static BaseChartNameID[] typeName = BaseChartGetter.getStaticAllChartBaseNames(); private static BaseChartNameID[] typeName = BaseChartGetter.getStaticAllChartBaseNames();
private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
static { static {
buttonBorder = new UIRoundedBorder(new Color(149, 149, 149), 1, 5); buttonBorder = new UIRoundedBorder(new Color(149, 149, 149), 1, 5);
@ -60,10 +65,16 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar
public ChartBlockEditor(PolyDesigner designer, ChartBlockCreator creator) { public ChartBlockEditor(PolyDesigner designer, ChartBlockCreator creator) {
super(designer, creator); super(designer, creator);
this.resolution = creator.resolution;
//shine:和产品商量后决定把最上面一排切换按钮去掉 //shine:和产品商量后决定把最上面一排切换按钮去掉
// this.initNorthBarComponent(); // this.initNorthBarComponent();
} }
private void setResolution(int resolution){
this.resolution = resolution;
}
private void initNorthBarComponent() { private void initNorthBarComponent() {
JPanel charttypeToolbar = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); JPanel charttypeToolbar = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));

5
designer/src/com/fr/poly/creator/ECBlockEditor.java

@ -6,6 +6,7 @@ package com.fr.poly.creator;
import java.awt.Dimension; import java.awt.Dimension;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
@ -70,6 +71,10 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
@Override @Override
protected void initSize() { protected void initSize() {
resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
Dimension cornerSize = getCornerSize(); Dimension cornerSize = getCornerSize();
PolyECBlock block = getValue(); PolyECBlock block = getValue();
UnitRectangle ub = block.getBounds(); UnitRectangle ub = block.getBounds();

13
designer_base/src/com/fr/design/mainframe/JTemplate.java

@ -1,9 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.*;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.base.io.IOFile; import com.fr.base.io.IOFile;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
@ -51,6 +48,7 @@ import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.*; import javax.swing.*;
import javax.swing.Icon;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.awt.*; import java.awt.*;
@ -82,6 +80,7 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
private long openTime = 0L; // 打开模板的时间点(包括新建模板) private long openTime = 0L; // 打开模板的时间点(包括新建模板)
private TemplateInfoCollector tic = TemplateInfoCollector.getInstance(); private TemplateInfoCollector tic = TemplateInfoCollector.getInstance();
private StringBuilder process = new StringBuilder(""); // 制作模板的过程 private StringBuilder process = new StringBuilder(""); // 制作模板的过程
private int resolution = ScreenResolution.getScreenResolution();
public JTemplate(T t, String defaultFileName) { public JTemplate(T t, String defaultFileName) {
this(t, new MemFILE(newTemplateNameByIndex(defaultFileName)), true); this(t, new MemFILE(newTemplateNameByIndex(defaultFileName)), true);
@ -144,6 +143,12 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
return undoState; return undoState;
} }
public abstract void setJTemplateResolution(int resolution);
public abstract int getJTemplateResolution();
;
/** /**
* 初始化权限细粒度撤销状态 * 初始化权限细粒度撤销状态
*/ */

11
designer_chart/src/com/fr/design/chart/gui/ChartComponent.java

@ -13,6 +13,7 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.AxisGlyph; import com.fr.chart.chartglyph.AxisGlyph;
import com.fr.design.chart.gui.active.ActiveGlyph; import com.fr.design.chart.gui.active.ActiveGlyph;
import com.fr.design.chart.gui.active.ChartActiveGlyph; import com.fr.design.chart.gui.active.ChartActiveGlyph;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeListener; import com.fr.stable.core.PropertyChangeListener;
@ -41,7 +42,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
private int chartWidth = -1; private int chartWidth = -1;
private int chartHeight = -1; private int chartHeight = -1;
private Point point; private Point point;
private int resolution = ScreenResolution.getScreenResolution();
private ActiveGlyph activeGlyph; private ActiveGlyph activeGlyph;
private boolean supportEdit = true; private boolean supportEdit = true;
@ -315,7 +316,13 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
//不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单 //不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单
//其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边 //其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边
//处理画图事件 //处理画图事件
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution(), this, null);
resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,resolution, this, null);
g2d.drawImage(chartImage, 0, 0, null); g2d.drawImage(chartImage, 0, 0, null);
} }
} }

10
designer_form/src/com/fr/design/mainframe/JForm.java

@ -104,6 +104,16 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
return processInfo; return processInfo;
} }
@Override
public void setJTemplateResolution(int resolution) {
}
@Override
public int getJTemplateResolution() {
return 0;
}
@Override @Override
protected boolean accept(Object o) { protected boolean accept(Object o) {
return !(o instanceof FloatElementsProvider); return !(o instanceof FloatElementsProvider);

Loading…
Cancel
Save