diff --git a/designer/src/com/fr/design/mainframe/JWorkBook.java b/designer/src/com/fr/design/mainframe/JWorkBook.java index 5ab98eef79..e99c24a948 100644 --- a/designer/src/com/fr/design/mainframe/JWorkBook.java +++ b/designer/src/com/fr/design/mainframe/JWorkBook.java @@ -345,29 +345,31 @@ public class JWorkBook extends JTemplate { public void setScale(int resolution) { //更新resolution this.resolution = resolution; - if (reportComposite.centerCardPane.editingComponet.elementCasePane != null){ - reportComposite.centerCardPane.editingComponet.elementCasePane.setResolution(resolution); - reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution); - reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setResolution(resolution); + ElementCasePane elementCasePane = reportComposite.centerCardPane.editingComponet.elementCasePane; + PolyDesigner polyDezi = reportComposite.centerCardPane.getPolyDezi(); + if (elementCasePane != null){ + elementCasePane.setResolution(resolution); + elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution); + elementCasePane.getGrid().setResolution(resolution); //更新Grid - Grid grid = reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid(); - DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(reportComposite.centerCardPane.editingComponet.elementCasePane.getEditingElementCase()); - DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(reportComposite.centerCardPane.editingComponet.elementCasePane.getEditingElementCase()); + Grid grid = elementCasePane.getGrid(); + DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(elementCasePane.getEditingElementCase()); + DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(elementCasePane.getEditingElementCase()); grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution)); grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution)); - reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().updateUI(); + elementCasePane.getGrid().updateUI(); //更新Column和Row - ((DynamicScrollBar)reportComposite.centerCardPane.editingComponet.elementCasePane.getVerticalScrollBar()).setDpi(resolution); - ((DynamicScrollBar)reportComposite.centerCardPane.editingComponet.elementCasePane.getHorizontalScrollBar()).setDpi(resolution); - reportComposite.centerCardPane.editingComponet.elementCasePane.getGridColumn().setResolution(resolution); - reportComposite.centerCardPane.editingComponet.elementCasePane.getGridColumn().updateUI(); - reportComposite.centerCardPane.editingComponet.elementCasePane.getGridRow().setResolution(resolution); - reportComposite.centerCardPane.editingComponet.elementCasePane.getGridRow().updateUI(); + ((DynamicScrollBar)elementCasePane.getVerticalScrollBar()).setDpi(resolution); + ((DynamicScrollBar)elementCasePane.getHorizontalScrollBar()).setDpi(resolution); + elementCasePane.getGridColumn().setResolution(resolution); + elementCasePane.getGridColumn().updateUI(); + elementCasePane.getGridRow().setResolution(resolution); + elementCasePane.getGridRow().updateUI(); } - if (reportComposite.centerCardPane.polyDezi != null){ - reportComposite.centerCardPane.polyDezi.setResolution(resolution); + if (polyDezi != null){ + polyDezi.setResolution(resolution); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setJTemplateResolution(resolution); - reportComposite.centerCardPane.polyDezi.updateUI(); + polyDezi.updateUI(); } // reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setVerticalValue(10); @@ -375,27 +377,29 @@ public class JWorkBook extends JTemplate { } @Override public int selfAdaptUpdate(){ + PolyDesigner polyDezi = reportComposite.centerCardPane.getPolyDezi(); + ElementCasePane elementCasePane = reportComposite.centerCardPane.editingComponet.elementCasePane; if (resolution == 0){ resolution = ScreenResolution.getScreenResolution(); } - if (reportComposite.centerCardPane.polyDezi.getSelection() !=null){ - BlockCreator blockCreator =reportComposite.centerCardPane.polyDezi.getSelection(); + if (polyDezi.getSelection() !=null){ + BlockCreator blockCreator =polyDezi.getSelection(); double x = blockCreator.getEditorBounds().getX(); double y = blockCreator.getEditorBounds().getY(); - reportComposite.centerCardPane.polyDezi.setHorizontalValue((int) x); - reportComposite.centerCardPane.polyDezi.setVerticalValue((int) y); + polyDezi.setHorizontalValue((int) x); + 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(); + double areaHeight = polyDezi.polyArea.getHeight(); + double areaWidth = 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()); + return (int) (time * polyDezi.getResolution()); - }else if (reportComposite.centerCardPane.editingComponet.elementCasePane != null) { - ElementCasePane reportPane = reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getElementCasePane(); + }else if (elementCasePane != null) { + ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane(); int column = reportPane.getSelection().getSelectedColumns()[0]; double columnLength = reportPane.getSelection().getSelectedColumns().length; double columnExtent = reportPane.getGrid().getHorizontalExtent(); @@ -405,12 +409,12 @@ public class JWorkBook extends JTemplate { if (columnLength == 0||rowLength == 0){ return resolution; } - double time =(columnExtent/columnLength)<(rowExtent/rowLength) ? (columnExtent/columnLength) : (rowExtent/rowLength); + 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()); + return (int) (time * elementCasePane.getGrid().getResolution()); }else { return resolution; } diff --git a/designer/src/com/fr/design/mainframe/ReportComponent.java b/designer/src/com/fr/design/mainframe/ReportComponent.java index 42342f24e7..6ca2685454 100644 --- a/designer/src/com/fr/design/mainframe/ReportComponent.java +++ b/designer/src/com/fr/design/mainframe/ReportComponent.java @@ -27,13 +27,9 @@ import com.fr.design.selection.Selectedable; */ public abstract class ReportComponent extends TargetComponent implements Selectedable { protected E elementCasePane; -// protected P polyElementCasePane; public E getEditingElementCasePane() { return elementCasePane; } -// public P getEditingPolyElementCasePane() { -// return polyElementCasePane; -// } public ReportComponent(T t) { super(t); } diff --git a/designer/src/com/fr/design/mainframe/ReportComponentCardPane.java b/designer/src/com/fr/design/mainframe/ReportComponentCardPane.java index cc45cf5e90..f574892c92 100644 --- a/designer/src/com/fr/design/mainframe/ReportComponentCardPane.java +++ b/designer/src/com/fr/design/mainframe/ReportComponentCardPane.java @@ -25,7 +25,7 @@ public class ReportComponentCardPane extends JComponent implements TargetModifie private CardLayout cl; private WorkSheetDesigner sheetDezi; - protected PolyDesigner polyDezi; + private PolyDesigner polyDezi; public ReportComponentCardPane() { this.setLayout(cl = new CardLayout()); @@ -37,6 +37,10 @@ public class ReportComponentCardPane extends JComponent implements TargetModifie } } + public PolyDesigner getPolyDezi(){ + return this.polyDezi; + } + protected void stopEditing() { if (editingComponet != null) { editingComponet.stopEditing(); diff --git a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java index 1b4fcdd1d2..15a4b32331 100644 --- a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java @@ -73,8 +73,8 @@ public class ReportComponentComposite extends JComponent { @Override public void stateChanged(ChangeEvent e) { double value = (int) ((UIBasicSpinner)e.getSource()).getValue(); - value = value>MAX ? MAX : value; - value = value MAX ? MAX : value; + value = value < MIN ? MIN : value; int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); } diff --git a/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java b/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java index 64c397da1b..d4f06ea4cd 100644 --- a/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java +++ b/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java @@ -27,11 +27,6 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane { } public void populate(ElementCasePane reportPane) { -// TemplateElementCase elementCase = ePane.getEditingElementCase(); -// if (elementCase == null) { -// return; -// } -// ePane.getSelection().populatePropertyPane(ePane); final TemplateElementCase report = reportPane.getEditingElementCase(); NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report); populate(nameHyperlinks); diff --git a/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java b/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java index d9ad0f35f3..67521bf3a3 100644 --- a/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java +++ b/designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java @@ -54,9 +54,9 @@ public class FormReportComponentComposite extends JComponent implements TargetMo @Override public void stateChanged(ChangeEvent e) { double value = (int) ((UIBasicSpinner)e.getSource()).getValue(); - value = value>MAX ? MAX : value; - value = value MAX ? MAX : value; + value = value < MIN ? MIN : value; + int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND); JForm jf = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); } diff --git a/designer/src/com/fr/design/present/BarCodePane.java b/designer/src/com/fr/design/present/BarCodePane.java index 1d59bee6c7..27a42a7e98 100644 --- a/designer/src/com/fr/design/present/BarCodePane.java +++ b/designer/src/com/fr/design/present/BarCodePane.java @@ -69,16 +69,6 @@ public class BarCodePane extends FurtherBasicBeanPane { addlistener(); } - public static void main(String[] args){ - JFrame jf = new JFrame("test"); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - JPanel content = (JPanel)jf.getContentPane(); - content.setLayout(new BorderLayout()); - content.add(new BarCodePane(),BorderLayout.CENTER); - GUICoreUtils.centerWindow(jf); - jf.setSize(270, 400); - jf.setVisible(true); - } private void initComponents() { barCodePreviewPane = new BarCodePreviewPane(); diff --git a/designer/src/com/fr/poly/PolyDesignUI.java b/designer/src/com/fr/poly/PolyDesignUI.java index 58ed225b85..bc5fb7af86 100644 --- a/designer/src/com/fr/poly/PolyDesignUI.java +++ b/designer/src/com/fr/poly/PolyDesignUI.java @@ -111,15 +111,8 @@ public class PolyDesignUI extends ComponentUI { BlockCreator creator = addedData.getAddedAt(i); // richer:如果当前这个组件正在编辑,那么他是完全被他的编辑器所遮挡的,不需要画出来 if (creator == designer.getSelection()) { - 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)); - } + paintPositionLine(g, creator.getX(time), creator.getY(time), + (int) (designer.getHorizontalValue()*time), (int) (designer.getVerticalValue()*time)); if (creator.getEditor().isDragging()) { creator.getEditor().paintAbsorptionline(g); //如果与其他块重合了, 需要画出提示禁止重叠 diff --git a/designer/src/com/fr/poly/creator/BlockCreator.java b/designer/src/com/fr/poly/creator/BlockCreator.java index 1719c42ebd..052e111a8e 100644 --- a/designer/src/com/fr/poly/creator/BlockCreator.java +++ b/designer/src/com/fr/poly/creator/BlockCreator.java @@ -89,6 +89,11 @@ public abstract class BlockCreator extends JComponent i public abstract BlockEditor getEditor(); + public abstract int getX(float time); + + public abstract int getY(float time); + + /** * 检测按钮状态 diff --git a/designer/src/com/fr/poly/creator/ChartBlockCreator.java b/designer/src/com/fr/poly/creator/ChartBlockCreator.java index 93e25d21e0..d713356c60 100644 --- a/designer/src/com/fr/poly/creator/ChartBlockCreator.java +++ b/designer/src/com/fr/poly/creator/ChartBlockCreator.java @@ -71,6 +71,15 @@ public class ChartBlockCreator extends BlockCreator { return editor; } + @Override + public int getX(float time) { + return (int) (this.getX() * time); + } + + @Override + public int getY(float time) { + return (int) (this.getY() * time); + } /** diff --git a/designer/src/com/fr/poly/creator/ECBlockCreator.java b/designer/src/com/fr/poly/creator/ECBlockCreator.java index c98c6f7082..860b65d72a 100644 --- a/designer/src/com/fr/poly/creator/ECBlockCreator.java +++ b/designer/src/com/fr/poly/creator/ECBlockCreator.java @@ -23,6 +23,9 @@ import com.fr.stable.unit.UnitRectangle; */ public class ECBlockCreator extends BlockCreator { private ECBlockEditor editor; + private static final int CREATORWIDTH = 30; + private static final int CREATORGEIGHT = 19; + public ECBlockCreator() { @@ -64,6 +67,16 @@ public class ECBlockCreator extends BlockCreator { return editor; } + @Override + public int getX(float time) { + return (int) ((this.getX() - CREATORWIDTH) * time) + CREATORWIDTH; + } + + @Override + public int getY(float time) { + return (int) ((this.getY() - CREATORGEIGHT) * time) + CREATORGEIGHT; + } + /** * 检测按钮状态 *