Browse Source

Merge pull request #2095 in DESIGN/design from release/10.0 to bugfix/10.0

* commit 'c64fa399c66348891d842933cfd2cffb0ab7c582':
  CHART-15112 时间轴英文环境少单位
  REPORT-37460 && REPORT-37526 【frm设计界面支持缩放】模板放大后,点击报表块编辑,双击才能生效,缩小模板100%,单击就可以
  REPORT-37487 && REPORT-37484 1、回复 result 默认为 $$$ 。 2、和产品沟通,将两个面板分别默认展示 = 和不展示 = 3、恢复数据的联动
bugfix/10.0
superman 4 years ago
parent
commit
89b64b3d54
  1. 33
      designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java
  2. 2
      designer-base/src/main/java/com/fr/design/formula/SortFormulaPane.java
  3. 28
      designer-base/src/test/java/com/fr/design/formula/FormulaTextFieldTest.java
  4. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java
  5. 16
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  6. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  7. 11
      designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  8. 8
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

33
designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java

@ -16,7 +16,9 @@ import javax.swing.text.Document;
**/ **/
public class FormulaTextField extends DictionaryTextField<BaseFormula> { public class FormulaTextField extends DictionaryTextField<BaseFormula> {
private static final BaseFormula EMPTY_FORMULA = BaseFormula.createFormulaBuilder().build("="); private static final String EMPTY_STRING = "=";
private static final BaseFormula EMPTY_FORMULA = BaseFormula.createFormulaBuilder().build(EMPTY_STRING);
public FormulaTextField() { public FormulaTextField() {
} }
@ -43,7 +45,15 @@ public class FormulaTextField extends DictionaryTextField<BaseFormula> {
if (this.value == null) { if (this.value == null) {
this.value = createDefault(); this.value = createDefault();
} }
return this.value; //保持联动
linkValueByText();
return value;
}
private void linkValueByText() {
String content = getText();
this.value.setContent(content);
} }
/** /**
@ -58,7 +68,24 @@ public class FormulaTextField extends DictionaryTextField<BaseFormula> {
if (this.value == null) { if (this.value == null) {
this.value = createDefault(); this.value = createDefault();
} }
setText(this.value.getPureContent()); }
/**
* 是需要设置不带 = 还是带 =
*
* @param value
* @param isPure 带不带 = , = 不带 =
*/
public void setValueAndText(BaseFormula value, boolean isPure) {
setValue(value);
String content = null;
if (isPure) {
content = this.value.getPureContent();
} else {
content = this.value.getContent();
}
setText(content);
} }
private BaseFormula createDefault() { private BaseFormula createDefault() {

2
designer-base/src/main/java/com/fr/design/formula/SortFormulaPane.java

@ -64,7 +64,7 @@ public abstract class SortFormulaPane extends JPanel {
public void doOk() { public void doOk() {
BaseFormula fm = formulaPane.update(); BaseFormula fm = formulaPane.update();
if (fm != null) { if (fm != null) {
sortFormulaTextField.setValue(fm); sortFormulaTextField.setValueAndText(fm, true);
} }
} }
}).setVisible(true); }).setVisible(true);

28
designer-base/src/test/java/com/fr/design/formula/FormulaTextFieldTest.java

@ -0,0 +1,28 @@
package com.fr.design.formula;
import com.fr.base.BaseFormula;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.*;
public class FormulaTextFieldTest {
@Test
public void testSet() {
FormulaTextField field = new FormulaTextField();
BaseFormula aaaa = BaseFormula.createFormulaBuilder().build("aaaa");
field.setValueAndText(aaaa, true);
Assert.assertEquals("aaaa", field.getText());
field.setValueAndText(aaaa, false);
Assert.assertEquals("=aaaa", field.getText());
field.setText("bbbb");
BaseFormula formula = field.getValue();
Assert.assertEquals("bbbb", formula.getPureContent());
}
}

4
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java

@ -162,8 +162,8 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
JPanel mainTickPane = new JPanel(); JPanel mainTickPane = new JPanel();
mainTickPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); mainTickPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
mainUnitField.setPreferredSize(new Dimension(100,20)); mainUnitField.setPreferredSize(new Dimension(80,20));
secondUnitField.setPreferredSize(new Dimension(100,20)); secondUnitField.setPreferredSize(new Dimension(80,20));
mainTickPane.add(mainUnitField); mainTickPane.add(mainUnitField);
mainTickPane.add(mainType); mainTickPane.add(mainType);

16
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -327,8 +327,8 @@ public class EditingMouseListener extends MouseInputAdapter {
if (designer.getCursor().getType() == Cursor.HAND_CURSOR) { if (designer.getCursor().getType() == Cursor.HAND_CURSOR) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} // component.getParent() 是报表块所在的XWTitleLayout } // component.getParent() 是报表块所在的XWTitleLayout
int minX = button.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); int minX = button.getX() + getParentPositionX(component, 0) - designer.getHorizontalScaleValue();
int minY = button.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); int minY = button.getY() + getParentPositionY(component, 0) - designer.getVerticalScaleValue();
if (e.getX() + GAP - xElementCase.getInsets().left > minX && e.getX() - GAP - xElementCase.getInsets().left < minX + button.getWidth()) { if (e.getX() + GAP - xElementCase.getInsets().left > minX && e.getX() - GAP - xElementCase.getInsets().left < minX + button.getWidth()) {
if (e.getY() + GAP - xElementCase.getInsets().top > minY && e.getY() - GAP - xElementCase.getInsets().top < minY + button.getHeight()) { if (e.getY() + GAP - xElementCase.getInsets().top > minY && e.getY() - GAP - xElementCase.getInsets().top < minY + button.getHeight()) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
@ -342,8 +342,8 @@ public class EditingMouseListener extends MouseInputAdapter {
if (component.getCoverPane() != null) { if (component.getCoverPane() != null) {
if (component.getCoverPane().getComponentCount() > 1) { if (component.getCoverPane().getComponentCount() > 1) {
JComponent button1 = (JComponent) component.getCoverPane().getComponent(1); JComponent button1 = (JComponent) component.getCoverPane().getComponent(1);
int minX1 = button1.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); int minX1 = button1.getX() + getParentPositionX(component, 0) - designer.getHorizontalScaleValue();
int minY1 = button1.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); int minY1 = button1.getY() + getParentPositionY(component, 0) - designer.getVerticalScaleValue();
if (e.getX() + GAP - component.getInsets().left > minX1 && e.getX() - GAP - component.getInsets().left < minX1 + button1.getWidth()) { if (e.getX() + GAP - component.getInsets().left > minX1 && e.getX() - GAP - component.getInsets().left < minX1 + button1.getWidth()) {
if (e.getY() + GAP - component.getInsets().top > minY1 && e.getY() - GAP - component.getInsets().top < minY1 + button1.getHeight()) { if (e.getY() + GAP - component.getInsets().top > minY1 && e.getY() - GAP - component.getInsets().top < minY1 + button1.getHeight()) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
@ -358,8 +358,8 @@ public class EditingMouseListener extends MouseInputAdapter {
if (StringUtils.isEmpty(component.toData().getDescription())) { if (StringUtils.isEmpty(component.toData().getDescription())) {
return; return;
} }
int minX1 = getParentPositionX(component, component.getX()) + component.getWidth() - ShareConstants.SHARE_EL_CONTROL_BUTTON_HW - designer.getArea().getHorizontalValue(); int minX1 = getParentPositionX(component, component.getX()) + component.getWidth() - ShareConstants.SHARE_EL_CONTROL_BUTTON_HW - designer.getHorizontalScaleValue();
int minY1 = getParentPositionY(component, component.getY()) - designer.getArea().getVerticalValue(); int minY1 = getParentPositionY(component, component.getY()) - designer.getVerticalScaleValue();
if (e.getX() + GAP - component.getInsets().left > minX1 && e.getX() - GAP - component.getInsets().left < minX1 + ShareConstants.SHARE_EL_CONTROL_BUTTON_HW) { if (e.getX() + GAP - component.getInsets().left > minX1 && e.getX() - GAP - component.getInsets().left < minX1 + ShareConstants.SHARE_EL_CONTROL_BUTTON_HW) {
if (e.getY() + GAP - component.getInsets().top > minY1 && e.getY() - GAP - component.getInsets().top < minY1 + ShareConstants.SHARE_EL_CONTROL_BUTTON_HW) { if (e.getY() + GAP - component.getInsets().top > minY1 && e.getY() - GAP - component.getInsets().top < minY1 + ShareConstants.SHARE_EL_CONTROL_BUTTON_HW) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
@ -426,8 +426,8 @@ public class EditingMouseListener extends MouseInputAdapter {
if (designer.getCursor().getType() == Cursor.HAND_CURSOR) { if (designer.getCursor().getType() == Cursor.HAND_CURSOR) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} }
int minX = button.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); int minX = button.getX() + getParentPositionX(component, 0) - designer.getHorizontalScaleValue();
int minY = button.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); int minY = button.getY() + getParentPositionY(component, 0) - designer.getVerticalScaleValue();
if (e.getX() + GAP > minX && e.getX() - GAP < minX + button.getWidth()) { if (e.getX() + GAP > minX && e.getX() - GAP < minX + button.getWidth()) {
if (e.getY() + GAP > minY && e.getY() - GAP < minY + button.getHeight()) { if (e.getY() + GAP > minY && e.getY() - GAP < minY + button.getHeight()) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

2
designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

@ -773,7 +773,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
heightPane.setValue(height); heightPane.setValue(height);
reCalculateHeight((int) height); reCalculateHeight((int) height);
} }
if (designer.getRootComponent().acceptType(XWFitLayout.class) && AssistUtils.equals(slide, DEFAULT_SLIDER) ) { if (designer.getRootComponent().acceptType(XWFitLayout.class) && AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) {
XWFitLayout layout = (XWFitLayout) designer.getRootComponent(); XWFitLayout layout = (XWFitLayout) designer.getRootComponent();
// 撤销时先refreshRoot了,此处去掉内边距再增加间隔 // 撤销时先refreshRoot了,此处去掉内边距再增加间隔
layout.moveContainerMargin(); layout.moveContainerMargin();

11
designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java

@ -257,7 +257,7 @@ public class DSColumnAdvancedPane extends BasicPane {
this.sortOrderComboBox.setSortOrder(new SortOrder(sort)); this.sortOrderComboBox.setSortOrder(new SortOrder(sort));
BaseFormula sortFormulaObject = dSColumn.getSortFormulaObject(); BaseFormula sortFormulaObject = dSColumn.getSortFormulaObject();
sortFormulaTextField.setValue(sortFormulaObject); sortFormulaTextField.setValueAndText(sortFormulaObject, true);
} }
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
@ -421,7 +421,7 @@ public class DSColumnAdvancedPane extends BasicPane {
this.add(bottomLabel); this.add(bottomLabel);
formulaTextField = new FormulaTextField(24); formulaTextField = new FormulaTextField(24);
this.add(formulaTextField); this.add(formulaTextField);
formulaTextField.setValue(defaultFormula); formulaTextField.setValueAndText(defaultFormula, true);
UIButton bottomFrmulaButton = new UIButton("..."); UIButton bottomFrmulaButton = new UIButton("...");
this.add(bottomFrmulaButton); this.add(bottomFrmulaButton);
@ -444,8 +444,7 @@ public class DSColumnAdvancedPane extends BasicPane {
public void populateFormula(BaseFormula baseFormula) { public void populateFormula(BaseFormula baseFormula) {
this.formulaTextField.setValue(baseFormula); this.formulaTextField.setValueAndText(baseFormula, true);
this.formulaTextField.setText(baseFormula.getPureContent());
} }
public BaseFormula getFormula() { public BaseFormula getFormula() {
@ -481,9 +480,9 @@ public class DSColumnAdvancedPane extends BasicPane {
public void doOk() { public void doOk() {
BaseFormula valueFormula = formulaPane.update(); BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) { if (valueFormula.getContent().length() <= 1) {
formulaTextField.setValue(defaultFormula); formulaTextField.setValueAndText(defaultFormula, true);
} else { } else {
formulaTextField.setValue(valueFormula); formulaTextField.setValueAndText(valueFormula, true);
} }
} }
}).setVisible(true); }).setVisible(true);

8
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -1070,7 +1070,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
this.defaultFormula = BaseFormula.createFormulaBuilder().build(defaultValue); this.defaultFormula = BaseFormula.createFormulaBuilder().build(defaultValue);
formulaTextField = new FormulaTextField(); formulaTextField = new FormulaTextField();
formulaTextField.setValue(defaultFormula); formulaTextField.setValueAndText(defaultFormula, false);
JPanel textFieldPane = new JPanel(new BorderLayout()); JPanel textFieldPane = new JPanel(new BorderLayout());
textFieldPane.add(formulaTextField, BorderLayout.CENTER); textFieldPane.add(formulaTextField, BorderLayout.CENTER);
@ -1101,7 +1101,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void populateFormula(BaseFormula baseFormula) { public void populateFormula(BaseFormula baseFormula) {
this.formulaTextField.setValue(baseFormula); this.formulaTextField.setValueAndText(baseFormula, false);
} }
public BaseFormula getFormula() { public BaseFormula getFormula() {
@ -1145,9 +1145,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void doOk() { public void doOk() {
BaseFormula valueFormula = formulaPane.update(); BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) { if (valueFormula.getContent().length() <= 1) {
formulaTextField.setValue(defaultFormula); formulaTextField.setValueAndText(defaultFormula, false);
} else { } else {
formulaTextField.setValue(valueFormula); formulaTextField.setValueAndText(valueFormula, false);
} }
} }
}).setVisible(true); }).setVisible(true);

Loading…
Cancel
Save