Browse Source

Merge pull request #1077 in BA/design from ~MOMEAK/design9.0:release/9.0 to release/9.0

* commit '07f57f8677ce42b6bdbe2a368ce1c427bc6fb3f5':
  代码质量
  REPORT-2897 9.0设计器修改 单元格属性-形态-数据字典-数据表,实际值和显示值未默认选中列名; 缩放快捷键向下滚轮时,垂直滚动条也跟着滚动; 聚合报表缩放快捷键问题(快捷键需要区分mac和windows)
master
superman 7 years ago
parent
commit
1d923ba88e
  1. 28
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  2. 4
      designer/src/com/fr/design/mainframe/ReportFloatPane.java
  3. 24
      designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java
  4. 8
      designer/src/com/fr/grid/GridMouseAdapter.java
  5. 60
      designer/src/com/fr/poly/PolyDesigner.java
  6. 6
      designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java
  7. 5
      designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java
  8. 25
      designer_form/src/com/fr/design/mainframe/FormArea.java

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

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.designer.EditingState; import com.fr.design.designer.EditingState;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -11,6 +12,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.Grid; import com.fr.grid.Grid;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.poly.PolyDesigner;
import com.fr.report.report.TemplateReport; import com.fr.report.report.TemplateReport;
import javax.swing.*; import javax.swing.*;
@ -45,9 +47,6 @@ public class ReportComponentComposite extends JComponent {
private JSliderPane jSliderContainer; private JSliderPane jSliderContainer;
private boolean isCtrl = false;
/** /**
* Constructor with workbook.. * Constructor with workbook..
*/ */
@ -66,29 +65,10 @@ public class ReportComponentComposite extends JComponent {
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
} }
KeyListener showValSpinnerKeyListener = new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if (e.isControlDown()) {
isCtrl = true;
}
}
@Override
public void keyReleased(KeyEvent e) {
isCtrl = false;
}
};
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override @Override
public void mouseWheelMoved(MouseWheelEvent e) { public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl) { if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation(); int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue(); int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN)); jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN));
@ -149,12 +129,12 @@ public class ReportComponentComposite extends JComponent {
} }
if (centerCardPane.editingComponet.elementCasePane == null) { if (centerCardPane.editingComponet.elementCasePane == null) {
centerCardPane.getPolyDezi().polyArea.addMouseWheelListener(showValSpinnerMouseWheelListener);
return; return;
} }
Grid grid = centerCardPane.editingComponet.elementCasePane.getGrid(); Grid grid = centerCardPane.editingComponet.elementCasePane.getGrid();
this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener); this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
if (!grid.hasFocus() && grid.isRequestFocusEnabled()) { if (!grid.hasFocus() && grid.isRequestFocusEnabled()) {
grid.requestFocus(); grid.requestFocus();

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

@ -49,7 +49,7 @@ public class ReportFloatPane extends JPanel {
JPanel toolBarPane = new JPanel(new BorderLayout()); JPanel toolBarPane = new JPanel(new BorderLayout());
toolBarPane.add(topToolBar, BorderLayout.CENTER); toolBarPane.add(topToolBar, BorderLayout.CENTER);
toolBarPane.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER)); toolBarPane.setBorder(BorderFactory.createLineBorder(UIConstants.TITLED_BORDER_COLOR));
toolBarPane.setPreferredSize(new Dimension(155,20)); toolBarPane.setPreferredSize(new Dimension(155,20));
UILabel emptyLabel = new UILabel(); UILabel emptyLabel = new UILabel();
emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
@ -62,7 +62,7 @@ public class ReportFloatPane extends JPanel {
new Component[]{new UILabel(), new UILabel(Inter.getLocText("FR-Designer_Add_FloatElement")), emptyLabel, toolBarPane}, new Component[]{new UILabel(), new UILabel(Inter.getLocText("FR-Designer_Add_FloatElement")), emptyLabel, toolBarPane},
}; };
JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 15)); leftTopPane.setBorder(BorderFactory.createEmptyBorder(12, 5, 0, 15));
this.add(leftTopPane, BorderLayout.NORTH); this.add(leftTopPane, BorderLayout.NORTH);
} }

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

@ -2,6 +2,7 @@ package com.fr.design.mainframe.form;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.cell.bar.DynamicScrollBar; import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
@ -40,7 +41,6 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
private FormTabPane sheetNameTab; private FormTabPane sheetNameTab;
private JPanel hbarContainer; private JPanel hbarContainer;
private JSliderPane jSliderContainer; private JSliderPane jSliderContainer;
private boolean isCtrl = false;
public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) { public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) {
this.jForm = jform; this.jForm = jform;
@ -52,33 +52,13 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener); jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener);
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener); this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.elementCaseDesigner.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
elementCaseDesigner.addTargetModifiedListener(this); elementCaseDesigner.addTargetModifiedListener(this);
} }
KeyListener showValSpinnerKeyListener = new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if (e.isControlDown()) {
isCtrl = true;
}
}
@Override
public void keyReleased(KeyEvent e) {
isCtrl = false;
}
};
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override @Override
public void mouseWheelMoved(MouseWheelEvent e) { public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl) { if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation(); int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue(); int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN)); jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN));

8
designer/src/com/fr/grid/GridMouseAdapter.java

@ -807,9 +807,11 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
* @param e * @param e
*/ */
public void mouseWheelMoved(MouseWheelEvent e) { public void mouseWheelMoved(MouseWheelEvent e) {
ElementCasePane reportPane = grid.getElementCasePane(); if (!InputEventBaseOnOS.isControlDown(e)) {
if (reportPane.isHorizontalScrollBarVisible()) { ElementCasePane reportPane = grid.getElementCasePane();
reportPane.getVerticalScrollBar().setValue(reportPane.getVerticalScrollBar().getValue() + e.getWheelRotation() * 3); if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(reportPane.getVerticalScrollBar().getValue() + e.getWheelRotation() * 3);
}
} }
} }

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

@ -7,6 +7,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.edit.CopyAction; import com.fr.design.actions.edit.CopyAction;
@ -51,10 +52,7 @@ import com.fr.stable.unit.UnitRectangle;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -98,7 +96,6 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
private JSliderPane jSliderContainer; private JSliderPane jSliderContainer;
private int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes); private int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes);
private float time; private float time;
private boolean isCtrl = false;
public PolyDesigner(PolyWorkSheet report) { public PolyDesigner(PolyWorkSheet report) {
super(report); super(report);
@ -123,6 +120,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
this.setFocusTraversalKeysEnabled(false); this.setFocusTraversalKeysEnabled(false);
new PolyDesignerDropTarget(this); new PolyDesignerDropTarget(this);
toolBarComponent = new JComponent[]{new CutAction(this).createToolBarComponent(), new CopyAction(this).createToolBarComponent(), new PasteAction(this).createToolBarComponent(), new DeleteBlockAction(this).createToolBarComponent()}; toolBarComponent = new JComponent[]{new CutAction(this).createToolBarComponent(), new CopyAction(this).createToolBarComponent(), new PasteAction(this).createToolBarComponent(), new DeleteBlockAction(this).createToolBarComponent()};
polyArea.addMouseWheelListener(mouseWheelListener);
this.addSelectionChangeListener(new SelectionListener() { this.addSelectionChangeListener(new SelectionListener() {
@Override @Override
@ -138,8 +136,21 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
}); });
} }
MouseWheelListener mouseWheelListener = new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent evt) {
int id = evt.getID();
if (id == MouseEvent.MOUSE_WHEEL){
if (!InputEventBaseOnOS.isControlDown(evt)) {
int rotations = evt.getWheelRotation();
verScrollBar.setValue(verScrollBar.getValue() + rotations * ROTATIONS);
}
}
}
};
private void initComponents() { private void initComponents() {
jSliderContainer = JSliderPane.getInstance(); // jSliderContainer = JSliderPane.getInstance();
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
ployareaPane = new JPanel(new PolyDesignerLayout()); ployareaPane = new JPanel(new PolyDesignerLayout());
polyArea = new PolyArea(this, resolution); polyArea = new PolyArea(this, resolution);
@ -155,28 +166,8 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
ployareaPane.setBackground(Color.WHITE); ployareaPane.setBackground(Color.WHITE);
this.add(ployareaPane, BorderLayout.CENTER); this.add(ployareaPane, BorderLayout.CENTER);
this.add(polyComponetsBar, BorderLayout.WEST); this.add(polyComponetsBar, BorderLayout.WEST);
this.addKeyListener(showValSpinnerKeyListener);
} }
KeyListener showValSpinnerKeyListener = new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if (e.isControlDown()) {
isCtrl = true;
}
}
@Override
public void keyReleased(KeyEvent e) {
isCtrl = false;
}
};
private void initPolyBlocks() { private void initPolyBlocks() {
for (int i = 0, count = this.getTarget().getBlockCount(); i < count; i++) { for (int i = 0, count = this.getTarget().getBlockCount(); i < count; i++) {
TemplateBlock block = (TemplateBlock) getTarget().getBlock(i); TemplateBlock block = (TemplateBlock) getTarget().getBlock(i);
@ -671,23 +662,6 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
return this.getWidth(); return this.getWidth();
} }
@Override
protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent evt) {
int id = evt.getID();
switch (id) {
case MouseEvent.MOUSE_WHEEL: {
if (isCtrl) {
int dir = evt.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN));
} else {
int rotations = evt.getWheelRotation();
this.getVerticalScrollBar().setValue(this.getVerticalScrollBar().getValue() + rotations * ROTATIONS);
}
break;
}
}
}
/** /**
* 开始编辑 * 开始编辑

6
designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java

@ -128,6 +128,7 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver,
} }
public void setCurrentEditor(int i) { public void setCurrentEditor(int i) {
upButton.setSelectedIndex(i);
currentEditor = this.cards[i]; currentEditor = this.cards[i];
centerPane.removeAll(); centerPane.removeAll();
centerPane.add(currentEditor); centerPane.add(currentEditor);
@ -223,6 +224,10 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver,
return columnIndex; return columnIndex;
} }
public void updateUpButton(){
upButton.setSelectedIndex(this.getCurrentEditorIndex());
}
public Object update(String makeAdiff) { public Object update(String makeAdiff) {
String name = currentEditor.getName(); String name = currentEditor.getName();
Object columnIndex = currentEditor.getValue(); Object columnIndex = currentEditor.getValue();
@ -335,6 +340,7 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver,
* 清除组件数据 * 清除组件数据
*/ */
public void clearComponentsData() { public void clearComponentsData() {
setCurrentEditor(0);
for (Editor card : cards) { for (Editor card : cards) {
card.clearData(); card.clearData();
} }

5
designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java

@ -137,6 +137,8 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
this.chooseTable.populateBean(new DataBaseItems(dbName, dbDict.getSchema(), dbDict.getTableName())); this.chooseTable.populateBean(new DataBaseItems(dbName, dbDict.getSchema(), dbDict.getTableName()));
if (this.database == null) { if (this.database == null) {
this.keyColumnPane.updateUpButton();
this.valueDictPane.updateUpButton();
return; return;
} }
@ -187,6 +189,9 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
} }
dbDict.setKeyColumnIndex(keyColumnIndex); dbDict.setKeyColumnIndex(keyColumnIndex);
dbDict.setKeyColumnName(keyColumnName); dbDict.setKeyColumnName(keyColumnName);
}else {
this.keyColumnPane.updateUpButton();
this.valueDictPane.updateUpButton();
} }
Object value = this.valueDictPane.update(); Object value = this.valueDictPane.update();
if (value instanceof Integer) { if (value instanceof Integer) {

25
designer_form/src/com/fr/design/mainframe/FormArea.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
@ -50,7 +51,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
private double START_VALUE = DEFAULT_SLIDER; private double START_VALUE = DEFAULT_SLIDER;
private int resolution = ScreenResolution.getScreenResolution(); private int resolution = ScreenResolution.getScreenResolution();
private double screenValue; private double screenValue;
private boolean isCtrl = false;
public FormScrollBar getHorScrollBar() { public FormScrollBar getHorScrollBar() {
return horScrollBar; return horScrollBar;
@ -86,35 +86,14 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
} }
this.setFocusTraversalKeysEnabled(false); this.setFocusTraversalKeysEnabled(false);
this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener); this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener);
this.designer.addKeyListener(showValSpinnerKeyListener);
this.setOpaque(true); this.setOpaque(true);
this.setBackground(Color.WHITE); this.setBackground(Color.WHITE);
} }
KeyListener showValSpinnerKeyListener = new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if (e.isControlDown()) {
isCtrl = true;
}
}
@Override
public void keyReleased(KeyEvent e) {
isCtrl = false;
}
};
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override @Override
public void mouseWheelMoved(MouseWheelEvent e) { public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl) { if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation(); int dir = e.getWheelRotation();
int old_resolution = (int) slidePane.getShowVal().getValue(); int old_resolution = (int) slidePane.getShowVal().getValue();
slidePane.getShowVal().setValue(old_resolution - (dir * SHOWVALMIN)); slidePane.getShowVal().setValue(old_resolution - (dir * SHOWVALMIN));

Loading…
Cancel
Save