Browse Source

REPORT-2897 9.0设计器修改

缩放条部分
master
MoMeak 7 years ago
parent
commit
2b45c73474
  1. 60
      designer/src/com/fr/design/mainframe/JWorkBook.java
  2. 4
      designer/src/com/fr/design/mainframe/ReportComponent.java
  3. 6
      designer/src/com/fr/design/mainframe/ReportComponentCardPane.java
  4. 4
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  5. 5
      designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java
  6. 6
      designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java
  7. 10
      designer/src/com/fr/design/present/BarCodePane.java
  8. 11
      designer/src/com/fr/poly/PolyDesignUI.java
  9. 5
      designer/src/com/fr/poly/creator/BlockCreator.java
  10. 9
      designer/src/com/fr/poly/creator/ChartBlockCreator.java
  11. 13
      designer/src/com/fr/poly/creator/ECBlockCreator.java

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

@ -345,29 +345,31 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
public void setScale(int resolution) { public void setScale(int resolution) {
//更新resolution //更新resolution
this.resolution = resolution; this.resolution = resolution;
if (reportComposite.centerCardPane.editingComponet.elementCasePane != null){ ElementCasePane elementCasePane = reportComposite.centerCardPane.editingComponet.elementCasePane;
reportComposite.centerCardPane.editingComponet.elementCasePane.setResolution(resolution); PolyDesigner polyDezi = reportComposite.centerCardPane.getPolyDezi();
reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution); if (elementCasePane != null){
reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setResolution(resolution); elementCasePane.setResolution(resolution);
elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution);
elementCasePane.getGrid().setResolution(resolution);
//更新Grid //更新Grid
Grid grid = reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid(); Grid grid = elementCasePane.getGrid();
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(reportComposite.centerCardPane.editingComponet.elementCasePane.getEditingElementCase()); DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(elementCasePane.getEditingElementCase());
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(reportComposite.centerCardPane.editingComponet.elementCasePane.getEditingElementCase()); DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(elementCasePane.getEditingElementCase());
grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution)); grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution));
grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution)); grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution));
reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().updateUI(); elementCasePane.getGrid().updateUI();
//更新Column和Row //更新Column和Row
((DynamicScrollBar)reportComposite.centerCardPane.editingComponet.elementCasePane.getVerticalScrollBar()).setDpi(resolution); ((DynamicScrollBar)elementCasePane.getVerticalScrollBar()).setDpi(resolution);
((DynamicScrollBar)reportComposite.centerCardPane.editingComponet.elementCasePane.getHorizontalScrollBar()).setDpi(resolution); ((DynamicScrollBar)elementCasePane.getHorizontalScrollBar()).setDpi(resolution);
reportComposite.centerCardPane.editingComponet.elementCasePane.getGridColumn().setResolution(resolution); elementCasePane.getGridColumn().setResolution(resolution);
reportComposite.centerCardPane.editingComponet.elementCasePane.getGridColumn().updateUI(); elementCasePane.getGridColumn().updateUI();
reportComposite.centerCardPane.editingComponet.elementCasePane.getGridRow().setResolution(resolution); elementCasePane.getGridRow().setResolution(resolution);
reportComposite.centerCardPane.editingComponet.elementCasePane.getGridRow().updateUI(); elementCasePane.getGridRow().updateUI();
} }
if (reportComposite.centerCardPane.polyDezi != null){ if (polyDezi != null){
reportComposite.centerCardPane.polyDezi.setResolution(resolution); polyDezi.setResolution(resolution);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setJTemplateResolution(resolution); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setJTemplateResolution(resolution);
reportComposite.centerCardPane.polyDezi.updateUI(); polyDezi.updateUI();
} }
// reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setVerticalValue(10); // reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setVerticalValue(10);
@ -375,27 +377,29 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
} }
@Override @Override
public int selfAdaptUpdate(){ public int selfAdaptUpdate(){
PolyDesigner polyDezi = reportComposite.centerCardPane.getPolyDezi();
ElementCasePane elementCasePane = reportComposite.centerCardPane.editingComponet.elementCasePane;
if (resolution == 0){ if (resolution == 0){
resolution = ScreenResolution.getScreenResolution(); resolution = ScreenResolution.getScreenResolution();
} }
if (reportComposite.centerCardPane.polyDezi.getSelection() !=null){ if (polyDezi.getSelection() !=null){
BlockCreator blockCreator =reportComposite.centerCardPane.polyDezi.getSelection(); BlockCreator blockCreator =polyDezi.getSelection();
double x = blockCreator.getEditorBounds().getX(); double x = blockCreator.getEditorBounds().getX();
double y = blockCreator.getEditorBounds().getY(); double y = blockCreator.getEditorBounds().getY();
reportComposite.centerCardPane.polyDezi.setHorizontalValue((int) x); polyDezi.setHorizontalValue((int) x);
reportComposite.centerCardPane.polyDezi.setVerticalValue((int) y); polyDezi.setVerticalValue((int) y);
double creatorHeight = blockCreator.getEditorBounds().height; double creatorHeight = blockCreator.getEditorBounds().height;
double creatorWidth = blockCreator.getEditorBounds().width; double creatorWidth = blockCreator.getEditorBounds().width;
double areaHeight = reportComposite.centerCardPane.polyDezi.polyArea.getHeight(); double areaHeight = polyDezi.polyArea.getHeight();
double areaWidth = reportComposite.centerCardPane.polyDezi.polyArea.getWidth(); double areaWidth = polyDezi.polyArea.getWidth();
if (creatorWidth == 0||creatorHeight == 0){ if (creatorWidth == 0||creatorHeight == 0){
return resolution; return resolution;
} }
double time =(areaHeight/creatorHeight)<(areaWidth/creatorWidth) ? (areaHeight/creatorHeight) : (areaWidth/creatorWidth); 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) { }else if (elementCasePane != null) {
ElementCasePane reportPane = reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getElementCasePane(); ElementCasePane reportPane = 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;
double columnExtent = reportPane.getGrid().getHorizontalExtent(); double columnExtent = reportPane.getGrid().getHorizontalExtent();
@ -405,12 +409,12 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
if (columnLength == 0||rowLength == 0){ if (columnLength == 0||rowLength == 0){
return resolution; 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()) { if (reportPane.isHorizontalScrollBarVisible()) {
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 * elementCasePane.getGrid().getResolution());
}else { }else {
return resolution; return resolution;
} }

4
designer/src/com/fr/design/mainframe/ReportComponent.java

@ -27,13 +27,9 @@ import com.fr.design.selection.Selectedable;
*/ */
public abstract class ReportComponent<T extends TemplateReport, E extends ElementCasePane, S extends SelectableElement> extends TargetComponent<T> implements Selectedable<S> { public abstract class ReportComponent<T extends TemplateReport, E extends ElementCasePane, S extends SelectableElement> extends TargetComponent<T> implements Selectedable<S> {
protected E elementCasePane; protected E elementCasePane;
// protected P polyElementCasePane;
public E getEditingElementCasePane() { public E getEditingElementCasePane() {
return elementCasePane; return elementCasePane;
} }
// public P getEditingPolyElementCasePane() {
// return polyElementCasePane;
// }
public ReportComponent(T t) { public ReportComponent(T t) {
super(t); super(t);
} }

6
designer/src/com/fr/design/mainframe/ReportComponentCardPane.java

@ -25,7 +25,7 @@ public class ReportComponentCardPane extends JComponent implements TargetModifie
private CardLayout cl; private CardLayout cl;
private WorkSheetDesigner sheetDezi; private WorkSheetDesigner sheetDezi;
protected PolyDesigner polyDezi; private PolyDesigner polyDezi;
public ReportComponentCardPane() { public ReportComponentCardPane() {
this.setLayout(cl = new CardLayout()); 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() { protected void stopEditing() {
if (editingComponet != null) { if (editingComponet != null) {
editingComponet.stopEditing(); editingComponet.stopEditing();

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

@ -73,8 +73,8 @@ public class ReportComponentComposite extends JComponent {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
double value = (int) ((UIBasicSpinner)e.getSource()).getValue(); double value = (int) ((UIBasicSpinner)e.getSource()).getValue();
value = value>MAX ? MAX : value; value = value > MAX ? MAX : value;
value = value<MIN ? MIN : value; value = value < MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND); int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
} }

5
designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java

@ -27,11 +27,6 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane {
} }
public void populate(ElementCasePane reportPane) { public void populate(ElementCasePane reportPane) {
// TemplateElementCase elementCase = ePane.getEditingElementCase();
// if (elementCase == null) {
// return;
// }
// ePane.getSelection().populatePropertyPane(ePane);
final TemplateElementCase report = reportPane.getEditingElementCase(); final TemplateElementCase report = reportPane.getEditingElementCase();
NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report); NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report);
populate(nameHyperlinks); populate(nameHyperlinks);

6
designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java

@ -54,9 +54,9 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
double value = (int) ((UIBasicSpinner)e.getSource()).getValue(); double value = (int) ((UIBasicSpinner)e.getSource()).getValue();
value = value>MAX ? MAX : value; value = value > MAX ? MAX : value;
value = value<MIN ? MIN : value; value = value < MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND); int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND);
JForm jf = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JForm jf = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
} }

10
designer/src/com/fr/design/present/BarCodePane.java

@ -69,16 +69,6 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
addlistener(); 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() { private void initComponents() {
barCodePreviewPane = new BarCodePreviewPane(); barCodePreviewPane = new BarCodePreviewPane();

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

@ -111,15 +111,8 @@ 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()) {
if (creator instanceof ECBlockCreator){ paintPositionLine(g, creator.getX(time), creator.getY(time),
int x = (int) ((creator.getX()-CREATORWIDTH)*time)+CREATORWIDTH; (int) (designer.getHorizontalValue()*time), (int) (designer.getVerticalValue()*time));
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);
//如果与其他块重合了, 需要画出提示禁止重叠 //如果与其他块重合了, 需要画出提示禁止重叠

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

@ -89,6 +89,11 @@ public abstract class BlockCreator<T extends TemplateBlock> extends JComponent i
public abstract BlockEditor getEditor(); public abstract BlockEditor getEditor();
public abstract int getX(float time);
public abstract int getY(float time);
/** /**
* 检测按钮状态 * 检测按钮状态

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

@ -71,6 +71,15 @@ public class ChartBlockCreator extends BlockCreator<PolyChartBlock> {
return editor; return editor;
} }
@Override
public int getX(float time) {
return (int) (this.getX() * time);
}
@Override
public int getY(float time) {
return (int) (this.getY() * time);
}
/** /**

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

@ -23,6 +23,9 @@ import com.fr.stable.unit.UnitRectangle;
*/ */
public class ECBlockCreator extends BlockCreator<PolyECBlock> { public class ECBlockCreator extends BlockCreator<PolyECBlock> {
private ECBlockEditor editor; private ECBlockEditor editor;
private static final int CREATORWIDTH = 30;
private static final int CREATORGEIGHT = 19;
public ECBlockCreator() { public ECBlockCreator() {
@ -64,6 +67,16 @@ public class ECBlockCreator extends BlockCreator<PolyECBlock> {
return editor; 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;
}
/** /**
* 检测按钮状态 * 检测按钮状态
* *

Loading…
Cancel
Save