Browse Source

REPORT-2897 9.0设计器修改

聚合报表缩放条部分
master
MoMeak 7 years ago
parent
commit
f89951424a
  1. 64
      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. 87
      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. 13
      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. 13
      designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
  13. 10
      designer_form/src/com/fr/design/mainframe/JForm.java

64
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.parameter.ReportParameterAttr;
import com.fr.poly.PolyDesigner;
import com.fr.poly.creator.BlockCreator;
import com.fr.privilege.finegrain.WorkSheetPrivilegeControl;
import com.fr.report.ReportHelper;
import com.fr.report.elementcase.ElementCase;
@ -147,6 +148,16 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
return processInfo;
}
@Override
public void setJTemplateResolution(int resolution) {
this.resolution = resolution;
}
@Override
public int getJTemplateResolution() {
return this.resolution;
}
/**
* 判断sheet权限
*
@ -353,6 +364,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
}
if (reportComposite.centerCardPane.polyDezi != null){
reportComposite.centerCardPane.polyDezi.setResolution(resolution);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setJTemplateResolution(resolution);
reportComposite.centerCardPane.polyDezi.updateUI();
}
// reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setVerticalValue(10);
@ -361,23 +373,45 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
}
@Override
public int selfAdaptUpdate(){
ElementCasePane reportPane = reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getElementCasePane();
int column = reportPane.getSelection().getSelectedColumns()[0];
double columnLength = reportPane.getSelection().getSelectedColumns().length;
double columnExtent = reportPane.getGrid().getHorizontalExtent();
int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0||rowLength == 0){
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();
int column = reportPane.getSelection().getSelectedColumns()[0];
double columnLength = reportPane.getSelection().getSelectedColumns().length;
double columnExtent = reportPane.getGrid().getHorizontalExtent();
int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0||rowLength == 0){
return resolution;
}
double time =(columnExtent/columnLength)<(rowExtent/rowLength) ? (columnExtent/columnLength) : (rowExtent/rowLength);
if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(row);
reportPane.getHorizontalScrollBar().setValue(column);
}
return (int) (time * reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getResolution());
}else {
return resolution;
}
double time =(columnExtent/columnLength)<(rowExtent/rowLength) ? (columnExtent/columnLength) : (rowExtent/rowLength);
if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(row);
reportPane.getHorizontalScrollBar().setValue(column);
}
return (int) (time * reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getResolution());
}
@Override

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

@ -85,7 +85,7 @@ public class ReportComponentComposite extends JComponent {
public void itemStateChanged(ItemEvent e) {
if (jSliderContainer.getSelfAdaptButton().isSelected()){
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;
import javax.swing.JComponent;
public class PolyArea extends JComponent {
private PolyDesigner polyDesigner;
private int resolution;
public PolyArea(PolyDesigner polyDesigner) {
public PolyArea(PolyDesigner polyDesigner, int resolution) {
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() {
return polyDesigner;
}

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

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

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

@ -3,14 +3,10 @@
*/
package com.fr.poly;
import java.awt.AWTEvent;
import java.awt.Adjustable;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
@ -36,16 +32,7 @@ import com.fr.design.designer.EditingState;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.AuthorityEditPane;
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.*;
import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.menu.MenuDef;
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.TemplateBlock;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils;
import com.fr.stable.unit.FU;
import com.fr.stable.unit.OLDPIX;
@ -98,7 +86,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
public static enum SelectionType {
NONE, INNER, BLOCK
}
public JComponent polyArea;
private SelectionType selectedtype = SelectionType.NONE;
private AddingData addingData;
private AddedData addedData;
@ -108,16 +96,16 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
private int horizontalValue = 0;
private int verticalValue = 0;
private transient ArrayList<TemplateBlock> clip_board = new ArrayList<TemplateBlock>();
// richer:鼠标滚轮每滚动一下,PolyDesignPane的尺寸就改变ROTATIONS这么多
private static final int ROTATIONS = 50;
private JScrollBar verScrollBar;
private JScrollBar horScrollBar;
private JComponent polyArea;
private PolyComponetsBar polyComponetsBar = new PolyComponetsBar();
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) {
super(report);
@ -157,7 +145,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel ployareaPane = new JPanel(new PolyDesignerLayout());
polyArea = new PolyArea(this);
polyArea = new PolyArea(this, resolution);
ployareaPane.add(PolyDesignerLayout.Center, polyArea);
horScrollBar = new FormScrollBar(Adjustable.HORIZONTAL, this);
@ -181,6 +169,20 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
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 目标组件
@ -250,13 +252,24 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
@Override
public void paintComponent(Graphics g) {
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());
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 组件
@ -368,12 +381,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
repaint();
}
private void resetEditorComponentBounds() {
if (selection != null) {
selection.getEditor().setBounds(selection.getEditorBounds());
LayoutUtils.layoutRootContainer(this);
}
}
/**
* @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);
}
public void setResolution(int resolution){
this.resolution = resolution;
}
//默认大小, 报表块默认3列6行, 图表块默认330*240
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) {
this.designer = designer;
this.creator = creator;
this.resolution = creator.resolution;
this.initComponets();
this.addColumnRowListeners();

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

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

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

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

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

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

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

13
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.design.chart.gui.active.ActiveGlyph;
import com.fr.design.chart.gui.active.ChartActiveGlyph;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeListener;
@ -41,7 +42,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
private int chartWidth = -1;
private int chartHeight = -1;
private Point point;
private int resolution = ScreenResolution.getScreenResolution();
private ActiveGlyph activeGlyph;
private boolean supportEdit = true;
@ -171,7 +172,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
g2d.setPaint(Color.white);
g2d.fillRect(0, 0, this.getBounds().width, this.getBounds().height);
g2d.setPaint(oldPaint);
g2d.translate(ChartConstants.PREGAP4BOUNDS/2, ChartConstants.PREGAP4BOUNDS/2);
if (needRefreshChartGlyph()) {
@ -315,7 +316,13 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
//不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单
//其他图都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);
}
}

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;
}
@Override
public void setJTemplateResolution(int resolution) {
}
@Override
public int getJTemplateResolution() {
return 0;
}
@Override
protected boolean accept(Object o) {
return !(o instanceof FloatElementsProvider);

Loading…
Cancel
Save