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) {
//更新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<WorkBook, WorkBookUndoState> {
}
@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<WorkBook, WorkBookUndoState> {
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;
}

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> {
protected E elementCasePane;
// protected P polyElementCasePane;
public E getEditingElementCasePane() {
return elementCasePane;
}
// public P getEditingPolyElementCasePane() {
// return polyElementCasePane;
// }
public ReportComponent(T 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 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();

4
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<MIN ? MIN : value;
value = value > MAX ? MAX : value;
value = value < MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND);
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) {
// TemplateElementCase elementCase = ePane.getEditingElementCase();
// if (elementCase == null) {
// return;
// }
// ePane.getSelection().populatePropertyPane(ePane);
final TemplateElementCase report = reportPane.getEditingElementCase();
NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report);
populate(nameHyperlinks);

6
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<MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND);
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);
}

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

@ -69,16 +69,6 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
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();

11
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);
//如果与其他块重合了, 需要画出提示禁止重叠

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 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;
}
@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> {
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<PolyECBlock> {
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