Browse Source

Pull request #2469: 无jira任务, final/10.0 合 persist/10.0

Merge in DESIGN/design from final/10.0 to persist/10.0

* commit 'e6dfe50930ccbb1e1ce8f4eb063877b321c8d32d':
  代码修改
  代码修改
  REPORT-40553 决策报表-连续点击空白设计面板,body没有处于未选中状态
  MOBILE-29339 两个横向布局块中间无法插入新报表块
  REPORT-34955 linux设计器选中某个字体后 切换单元格后字体未重新设置未默认字体
  代码修改
  提到final
  REPORT-39601 在单元格中插入 富文本。 字体设置为14的时候,自动给我变成13了
persist/10.0 10.0.9.2020.09.27
Kara 4 years ago
parent
commit
9246581731
  1. 18
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  2. 18
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  3. 10
      designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java
  4. 5
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java
  5. 69
      designer-realize/src/test/java/com/fr/design/cell/editor/RichTextToolBarTest.java

18
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.designer.beans.adapters.layout; package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.GroupModel; import com.fr.design.beans.GroupModel;
import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel;
import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.HoverPainter;
@ -18,6 +19,7 @@ import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.FRFitLayoutConstraints; import com.fr.design.designer.properties.FRFitLayoutConstraints;
import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
@ -32,6 +34,7 @@ import java.awt.Dimension;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 自适应布局的容器适配器 * 自适应布局的容器适配器
@ -161,7 +164,8 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
//布局控件要先判断是不是可编辑 //布局控件要先判断是不是可编辑
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout(); XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout();
if (topLayout != null && !isMatchEdge && !topLayout.isEditable() && !topLayout.acceptType(XWAbsoluteLayout.class)) { boolean access = topLayout != null && !isMatchEdge && !topLayout.isEditable() && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp);
if (access) {
return false; return false;
} }
@ -178,6 +182,18 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
return y > upHeight && y < downHeight ? horizonValid : verticalValid; return y > upHeight && y < downHeight ? horizonValid : verticalValid;
} }
private boolean isExtraContainer(Component comp) {
if (container != null) {
Set<FormWidgetOptionProvider> set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG);
for (FormWidgetOptionProvider provider : set) {
if (provider.isContainer() && ComparatorUtils.equals(provider.appearanceForWidget(), comp.getClass())) {
return true;
}
}
}
return false;
}
// 间隔区域 // 间隔区域
private boolean checkInterval(Component comp) { private boolean checkInterval(Component comp) {
return container.getComponentCount() > 0 && comp == container; return container.getComponentCount() > 0 && comp == container;

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

@ -166,7 +166,7 @@ public class EditingMouseListener extends MouseInputAdapter {
// 获取焦点,以便获取热键 // 获取焦点,以便获取热键
designer.requestFocus(); designer.requestFocus();
} }
if (e.getButton() == MouseEvent.BUTTON1) { if (e.getButton() == MouseEvent.BUTTON1 && !beyondValidArea(e)) {
Direction dir = selectionModel.getDirectionAt(e); Direction dir = selectionModel.getDirectionAt(e);
if (!DesignerMode.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
@ -177,13 +177,11 @@ public class EditingMouseListener extends MouseInputAdapter {
if (designer.isDrawLineMode()) { if (designer.isDrawLineMode()) {
designer.updateDrawLineMode(e); designer.updateDrawLineMode(e);
} else { } else {
int relativeX = Math.max(0, designer.getRelativeX(e.getX()));
int relativeY = Math.max(0, designer.getRelativeY(e.getY()));
if (selectionModel.hasSelectionComponent() if (selectionModel.hasSelectionComponent()
&& selectionModel.getSelection().getRelativeBounds().contains( && selectionModel.getSelection().getRelativeBounds().contains(
designer.getHorizontalScaleValue() + relativeX, designer.getHorizontalScaleValue() + e.getX(),
designer.getVerticalScaleValue() + relativeY)) { designer.getVerticalScaleValue() + e.getY())) {
lastPressEvent = e; lastPressEvent = e;
lastXCreator = selectionModel.getSelection().getSelectedCreator(); lastXCreator = selectionModel.getSelection().getSelectedCreator();
} else { } else {
@ -197,6 +195,16 @@ public class EditingMouseListener extends MouseInputAdapter {
e.translatePoint(oldX - e.getX(), oldY - e.getY()); e.translatePoint(oldX - e.getX(), oldY - e.getY());
} }
private boolean beyondValidArea(MouseEvent e) {
if (e.getX() < 0 || e.getY() < 0 ||
e.getX() > designer.getRootComponent().getWidth() ||
e.getY() > (designer.getRootComponent().getHeight() + designer.getParaHeight())) {
return true;
}
return false;
}
private void offsetEventPoint(MouseEvent e){ private void offsetEventPoint(MouseEvent e){
int x = designer.getRelativeX(e.getX()); int x = designer.getRelativeX(e.getX());
int y = designer.getRelativeY(e.getY()); int y = designer.getRelativeY(e.getY());

10
designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.actions.cell.style; package com.fr.design.actions.cell.style;
import com.fr.stable.os.OperatingSystem;
import java.awt.Dimension; import java.awt.Dimension;
import javax.swing.ComboBoxModel; import javax.swing.ComboBoxModel;
@ -49,6 +50,7 @@ public class ReportFontNameAction extends AbstractStyleAction {
public void setFontName(String fontName) { public void setFontName(String fontName) {
Object object = this.getValue(UIComboBox.class.getName()); Object object = this.getValue(UIComboBox.class.getName());
boolean find = false;
if (object != null && object instanceof UIComboBox) { if (object != null && object instanceof UIComboBox) {
UIComboBox comboBox = (UIComboBox) object; UIComboBox comboBox = (UIComboBox) object;
ComboBoxModel comboBoxModel = comboBox.getModel(); ComboBoxModel comboBoxModel = comboBox.getModel();
@ -60,9 +62,17 @@ public class ReportFontNameAction extends AbstractStyleAction {
comboBox.removeActionListener(this); comboBox.removeActionListener(this);
comboBox.setSelectedIndex(i); comboBox.setSelectedIndex(i);
comboBox.addActionListener(this); comboBox.addActionListener(this);
find = true;
break; break;
} }
} }
// linux设计器下面 找不到默认就是第一个字体
boolean access = OperatingSystem.isLinux() && !find && comboBoxModel.getSize() > 0;
if (access) {
comboBox.removeActionListener(this);
comboBox.setSelectedIndex(0);
comboBox.addActionListener(this);
}
} }
} }

5
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -502,14 +502,15 @@ public class RichTextToolBar extends BasicPane{
//pt转为px =*4/3 //pt转为px =*4/3
private int scaleUp(int fontSize) { private int scaleUp(int fontSize) {
return (int) FontTransformUtil.pt2px(fontSize); return roundUp(FontTransformUtil.pt2px(fontSize));
} }
//px转pt = *3/4 //px转pt = *3/4
private int scaleDown(int fontSize) { private int scaleDown(int fontSize) {
return (int) FontTransformUtil.px2pt(fontSize); return roundUp(FontTransformUtil.px2pt(fontSize));
} }
private DocumentListener inputListener = new DocumentListener() { private DocumentListener inputListener = new DocumentListener() {
@Override @Override

69
designer-realize/src/test/java/com/fr/design/cell/editor/RichTextToolBarTest.java

@ -0,0 +1,69 @@
package com.fr.design.cell.editor;
import com.fr.invoke.Reflect;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
/**
* Created by kerry on 2020-09-21
*/
public class RichTextToolBarTest {
@Test
public void testScaleUpAndDown() {
RichTextToolBar textToolBar = EasyMock.mock(RichTextToolBar.class);
int result = Reflect.on(textToolBar).call("scaleUp", 10).get();
Assert.assertEquals(13, result);
result = Reflect.on(textToolBar).call("scaleDown", 13).get();
Assert.assertEquals(10, result);
result = Reflect.on(textToolBar).call("scaleUp", 11).get();
Assert.assertEquals(15, result);
result = Reflect.on(textToolBar).call("scaleDown", 15).get();
Assert.assertEquals(11, result);
result = Reflect.on(textToolBar).call("scaleUp", 12).get();
Assert.assertEquals(16, result);
result = Reflect.on(textToolBar).call("scaleDown", 16).get();
Assert.assertEquals(12, result);
result = Reflect.on(textToolBar).call("scaleUp", 13).get();
Assert.assertEquals(17, result);
result = Reflect.on(textToolBar).call("scaleDown", 17).get();
Assert.assertEquals(13, result);
result = Reflect.on(textToolBar).call("scaleUp", 14).get();
Assert.assertEquals(19, result);
result = Reflect.on(textToolBar).call("scaleDown", 19).get();
Assert.assertEquals(14, result);
result = Reflect.on(textToolBar).call("scaleUp", 16).get();
Assert.assertEquals(21, result);
result = Reflect.on(textToolBar).call("scaleDown", 21).get();
Assert.assertEquals(16, result);
result = Reflect.on(textToolBar).call("scaleUp", 17).get();
Assert.assertEquals(23, result);
result = Reflect.on(textToolBar).call("scaleDown", 23).get();
Assert.assertEquals(17, result);
result = Reflect.on(textToolBar).call("scaleUp", 17).get();
Assert.assertEquals(23, result);
result = Reflect.on(textToolBar).call("scaleDown", 23).get();
Assert.assertEquals(17, result);
result = Reflect.on(textToolBar).call("scaleUp", 19).get();
Assert.assertEquals(25, result);
result = Reflect.on(textToolBar).call("scaleDown", 25).get();
Assert.assertEquals(19, result);
result = Reflect.on(textToolBar).call("scaleUp", 20).get();
Assert.assertEquals(27, result);
result = Reflect.on(textToolBar).call("scaleDown", 27).get();
Assert.assertEquals(20, result);
}
}
Loading…
Cancel
Save