Browse Source

REPORT-2897 9.0设计器修改

单元格属性-形态-数据字典-数据表,实际值和显示值未默认选中列名;
缩放快捷键向下滚轮时,垂直滚动条也跟着滚动;
聚合报表缩放快捷键问题(快捷键需要区分mac和windows)
master
MoMeak 7 years ago
parent
commit
557d719bb3
  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. 63
      designer/src/com/fr/poly/PolyDesigner.java
  6. 5
      designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java
  7. 7
      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.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.designer.EditingState;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
@ -11,6 +12,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.main.impl.WorkBook;
import com.fr.poly.PolyDesigner;
import com.fr.report.report.TemplateReport;
import javax.swing.*;
@ -45,9 +47,6 @@ public class ReportComponentComposite extends JComponent {
private JSliderPane jSliderContainer;
private boolean isCtrl = false;
/**
* Constructor with workbook..
*/
@ -66,29 +65,10 @@ public class ReportComponentComposite extends JComponent {
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() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl) {
if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN));
@ -149,12 +129,12 @@ public class ReportComponentComposite extends JComponent {
}
if (centerCardPane.editingComponet.elementCasePane == null) {
((PolyDesigner)centerCardPane.editingComponet).polyArea.addMouseWheelListener(showValSpinnerMouseWheelListener);
return;
}
Grid grid = centerCardPane.editingComponet.elementCasePane.getGrid();
this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
if (!grid.hasFocus() && grid.isRequestFocusEnabled()) {
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());
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));
UILabel emptyLabel = new UILabel();
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},
};
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);
}

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.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
@ -40,7 +41,6 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
private FormTabPane sheetNameTab;
private JPanel hbarContainer;
private JSliderPane jSliderContainer;
private boolean isCtrl = false;
public FormReportComponentComposite(BaseJForm jform, FormElementCaseDesigner elementCaseDesign, FormElementCaseContainerProvider ecContainer) {
this.jForm = jform;
@ -52,33 +52,13 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener);
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.elementCaseDesigner.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
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() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl) {
if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue();
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
*/
public void mouseWheelMoved(MouseWheelEvent e) {
ElementCasePane reportPane = grid.getElementCasePane();
if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(reportPane.getVerticalScrollBar().getValue() + e.getWheelRotation() * 3);
if (!InputEventBaseOnOS.isControlDown(e)) {
ElementCasePane reportPane = grid.getElementCasePane();
if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(reportPane.getVerticalScrollBar().getValue() + e.getWheelRotation() * 3);
}
}
}

63
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.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.edit.CopyAction;
@ -51,10 +52,7 @@ import com.fr.stable.unit.UnitRectangle;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.List;
@ -98,7 +96,6 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
private JSliderPane jSliderContainer;
private int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes);
private float time;
private boolean isCtrl = false;
public PolyDesigner(PolyWorkSheet report) {
super(report);
@ -123,6 +120,7 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
this.setFocusTraversalKeysEnabled(false);
new PolyDesignerDropTarget(this);
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() {
@Override
@ -138,8 +136,24 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
});
}
MouseWheelListener mouseWheelListener = new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent evt) {
int id = evt.getID();
switch (id) {
case MouseEvent.MOUSE_WHEEL: {
if (!InputEventBaseOnOS.isControlDown(evt)) {
int rotations = evt.getWheelRotation();
verScrollBar.setValue(verScrollBar.getValue() + rotations * ROTATIONS);
}
break;
}
}
}
};
private void initComponents() {
jSliderContainer = JSliderPane.getInstance();
// jSliderContainer = JSliderPane.getInstance();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
ployareaPane = new JPanel(new PolyDesignerLayout());
polyArea = new PolyArea(this, resolution);
@ -155,28 +169,8 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
ployareaPane.setBackground(Color.WHITE);
this.add(ployareaPane, BorderLayout.CENTER);
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() {
for (int i = 0, count = this.getTarget().getBlockCount(); i < count; i++) {
TemplateBlock block = (TemplateBlock) getTarget().getBlock(i);
@ -671,23 +665,6 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
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;
}
}
}
/**
* 开始编辑

5
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) {
upButton.setSelectedIndex(i);
currentEditor = this.cards[i];
centerPane.removeAll();
centerPane.add(currentEditor);
@ -223,6 +224,10 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver,
return columnIndex;
}
public void updateUpButton(){
upButton.setSelectedIndex(this.getCurrentEditorIndex());
}
public Object update(String makeAdiff) {
String name = currentEditor.getName();
Object columnIndex = currentEditor.getValue();

7
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()));
if (this.database == null) {
this.keyColumnPane.updateUpButton();
this.valueDictPane.updateUpButton();
return;
}
@ -187,6 +189,9 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
}
dbDict.setKeyColumnIndex(keyColumnIndex);
dbDict.setKeyColumnName(keyColumnName);
}else {
this.keyColumnPane.updateUpButton();
this.valueDictPane.updateUpButton();
}
Object value = this.valueDictPane.update();
if (value instanceof Integer) {
@ -265,7 +270,9 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
*/
public void reset() {
keyColumnPane.clearComponentsData();
keyColumnPane.setCurrentEditor(0);
valueDictPane.clearComponentsData();
valueDictPane.setCurrentEditor(0);
chooseTable.resetComponets();
}

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

@ -1,6 +1,7 @@
package com.fr.design.mainframe;
import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
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 int resolution = ScreenResolution.getScreenResolution();
private double screenValue;
private boolean isCtrl = false;
public FormScrollBar getHorScrollBar() {
return horScrollBar;
@ -86,35 +86,14 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
}
this.setFocusTraversalKeysEnabled(false);
this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener);
this.designer.addKeyListener(showValSpinnerKeyListener);
this.setOpaque(true);
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() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl) {
if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation();
int old_resolution = (int) slidePane.getShowVal().getValue();
slidePane.getShowVal().setValue(old_resolution - (dir * SHOWVALMIN));

Loading…
Cancel
Save