Browse Source

Pull request #2661: 无jira 解决冲突

Merge in DESIGN/design from ~HADES/design:feature/10.0 to feature/10.0

* commit 'd2492999e9e9cc92e32a37fe9735dba6093b6d9f':
  无jira任务, bugfix/10.0 合 feature/10.0冲突
  MOBILE-29801 组件的移动端设置,文字错误
  REPORT-38688 设计器在双屏下拖动会有卡屏的现象
  REPORT-41479 设计器参数界面宽度无法拖动
  REPORT-41492 jdk11设计器默认字体有不一致的情况
persist/11.0
Hades 4 years ago
parent
commit
d5f1e93be5
  1. 10
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  2. 1
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  3. 67
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  4. 24
      designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java
  5. 11
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  6. 9
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  7. 15
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  8. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java

10
designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -3,11 +3,12 @@ package com.fr.design.gui.iprogressbar;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JLabel; import javax.swing.JLabel;
@ -57,7 +58,10 @@ public class ProgressDialog extends UIDialog {
progressBar.setMaximum(1000); progressBar.setMaximum(1000);
panel.add(progressBar, BorderLayout.CENTER); panel.add(progressBar, BorderLayout.CENTER);
text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Project"), JLabel.CENTER); text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Project"), JLabel.CENTER);
FRFont font = FRFont.getInstance().applySize(14).applyForeground(new ColorUIResource(333334)); FRFont font = DesignUtils
.getDefaultGUIFont()
.applySize(14)
.applyForeground(new ColorUIResource(333334));
text.setFont(font); text.setFont(font);
panel.add(text, BorderLayout.SOUTH); panel.add(text, BorderLayout.SOUTH);
panel.setVisible(true); panel.setVisible(true);

1
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -551,6 +551,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
// 这个地方remove和add都是一个对象 完全没有必要remove再add 改变了窗口大小重新设置下 然后有repaint即可 // 这个地方remove和add都是一个对象 完全没有必要remove再add 改变了窗口大小重新设置下 然后有repaint即可
basePane.setBounds(0, 0, contentWidth, contentHeight); basePane.setBounds(0, 0, contentWidth, contentHeight);
layeredPane.repaint(); layeredPane.repaint();
layeredPane.revalidate();
} }
/** /**

67
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -9,6 +9,7 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel; import com.fr.design.gui.UILookAndFeel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
@ -23,7 +24,9 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
@ -251,6 +254,7 @@ public class DesignUtils {
// 刷新DesignerFrame里面的面板 // 刷新DesignerFrame里面的面板
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() { public void run() {
if (DesignerContext.getDesignerFrame() == null) { if (DesignerContext.getDesignerFrame() == null) {
return; return;
@ -272,7 +276,7 @@ public class DesignUtils {
FineLoggerFactory.getLogger().error("Substance Raven Graphite failed to initialize"); FineLoggerFactory.getLogger().error("Substance Raven Graphite failed to initialize");
} }
//获取当前系统语言下设计器用的默认字体 //获取当前系统语言下设计器用的默认字体
FRFont guiFRFont = getCurrentLocaleFont(); FRFont guiFRFont = getDefaultGUIFont();
//指定UIManager中字体 //指定UIManager中字体
Enumeration keys = UIManager.getDefaults().keys(); Enumeration keys = UIManager.getDefaults().keys();
while (keys.hasMoreElements()) { while (keys.hasMoreElements()) {
@ -289,41 +293,50 @@ public class DesignUtils {
} }
/** /**
* 获取当前系统语言下设计器用的默认字体 * 获取当前系统语言下设计器界面使用的默认字体
* *
* @return 默认字体 * @return 默认字体
*/ */
private static FRFont getCurrentLocaleFont() { public static FRFont getDefaultGUIFont() {
FRFont guiFRFont; return CURRENT_LOCALE_FONT.getValue();
Locale defaultLocale = Locale.getDefault(); }
// JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) {
guiFRFont = getNamedFont("Microsoft YaHei");
} else if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun");
} else {
guiFRFont = getNamedFont("Dialog");
}
//先初始化的设计器locale, 后初始化lookandfeel.如果顺序改了, 这边也要调整. /**
Locale designerLocale = GeneralContext.getLocale(); * 获取当前系统语言下设计器用的默认字体
String file = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File"); */
char displayChar = file.charAt(0); private static final NotNullLazyValue<FRFont> CURRENT_LOCALE_FONT = new NotNullLazyValue<FRFont>() {
if (!guiFRFont.canDisplay(displayChar)) { @NotNull
//如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器 @Override
//默认语言(中文:宋体, 英文:Tahoma, 其他:Dialog) protected FRFont compute() {
guiFRFont = getNamedFont("SimSun"); FRFont guiFRFont;
if (!guiFRFont.canDisplay(displayChar)) { Locale defaultLocale = Locale.getDefault();
//比如想在中文或英文系统里用韩文设计器 // JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) {
guiFRFont = getNamedFont("Microsoft YaHei");
} else if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun");
} else {
guiFRFont = getNamedFont("Dialog"); guiFRFont = getNamedFont("Dialog");
}
String file = Toolkit.i18nText("Fine-Design_Basic_File");
char displayChar = file.charAt(0);
if (!guiFRFont.canDisplay(displayChar)) {
//如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器
//默认语言(中文:宋体, 英文:Tahoma, 其他:Dialog)
guiFRFont = getNamedFont("SimSun");
if (!guiFRFont.canDisplay(displayChar)) { if (!guiFRFont.canDisplay(displayChar)) {
FineLoggerFactory.getLogger().error(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found")); //比如想在中文或英文系统里用韩文设计器
guiFRFont = getNamedFont("Dialog");
if (!guiFRFont.canDisplay(displayChar)) {
FineLoggerFactory.getLogger().error(Toolkit.i18nText("Fine-Design_Basic_Base_SimSun_Not_Found"));
}
} }
} }
}
return guiFRFont; return guiFRFont;
} }
};
private static FRFont getNamedFont(String name) { private static FRFont getNamedFont(String name) {
return FRFont.getInstance(name, Font.PLAIN, 12); return FRFont.getInstance(name, Font.PLAIN, 12);

24
designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java

@ -30,6 +30,7 @@ import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.FormArea; import com.fr.design.mainframe.FormArea;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormDesignerModeForSpecial; import com.fr.design.mainframe.FormDesignerModeForSpecial;
import com.fr.design.mainframe.FormDesignerUI;
import com.fr.design.mainframe.FormParaPane; import com.fr.design.mainframe.FormParaPane;
import com.fr.design.mainframe.FormWidgetDetailPane; import com.fr.design.mainframe.FormWidgetDetailPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
@ -58,6 +59,7 @@ import java.awt.Graphics;
import java.awt.Image; import java.awt.Image;
import java.awt.Insets; import java.awt.Insets;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -467,6 +469,21 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
return ((FormParameterUI) getTarget()).getDesignSize(); return ((FormParameterUI) getTarget()).getDesignSize();
} }
/**
* 设置其UI类为DesignerUI负责渲染
*/
@Override
public void updateUI() {
setUI(new FormDesignerUI(){
@Override
protected Rectangle getFitPaintBounds(Component component, Component parent) {
return new Rectangle(0, 0, parent.getSize().width, parent.getSize().height);
}
});
}
/** /**
* 设置高度 * 设置高度
* *
@ -722,4 +739,11 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
return new JComponent[]{new CutAction(this).createToolBarComponent(), new CopyAction(this).createToolBarComponent(), new PasteAction(this).createToolBarComponent(), return new JComponent[]{new CutAction(this).createToolBarComponent(), new CopyAction(this).createToolBarComponent(), new PasteAction(this).createToolBarComponent(),
new FormDeleteAction(this).createToolBarComponent()}; new FormDeleteAction(this).createToolBarComponent()};
} }
@Override
public boolean checkIfBeyondValidArea(MouseEvent e){
return false;
}
} }

11
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 && !beyondValidArea(e)) { if (e.getButton() == MouseEvent.BUTTON1 && !designer.checkIfBeyondValidArea(e)) {
Direction dir = selectionModel.getDirectionAt(e); Direction dir = selectionModel.getDirectionAt(e);
if (!DesignerMode.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
@ -194,15 +194,6 @@ 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());

9
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -1735,4 +1735,13 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
return (int) (this.getArea().getVerticalValue() / this.scale); return (int) (this.getArea().getVerticalValue() / this.scale);
} }
public boolean checkIfBeyondValidArea(MouseEvent e){
if (e.getX() < 0 || e.getY() < 0 ||
e.getX() > this.getRootComponent().getWidth() ||
e.getY() > (this.getRootComponent().getHeight() + this.getParaHeight())) {
return true;
}
return false;
}
} }

15
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

@ -424,12 +424,8 @@ public class FormDesignerUI extends ComponentUI {
// 禁止双缓冲 // 禁止双缓冲
ComponentUtils.disableBuffer(component, dbcomponents); ComponentUtils.disableBuffer(component, dbcomponents);
Graphics clipg; Graphics clipg;
clipg = g.create( Rectangle clipgBounds = getFitPaintBounds(component, parent);
-designer.getHorizontalScaleValue(), clipg = g.create(clipgBounds.x, clipgBounds.y, clipgBounds.width, clipgBounds.height);
-designer.getVerticalScaleValue() + designer.getParaHeight(),
component.getSize().width + designer.getHorizontalScaleValue(),
component.getSize().height + designer.getVerticalScaleValue());
designer.paintContent(clipg); designer.paintContent(clipg);
paintWatermark((Graphics2D) clipg); paintWatermark((Graphics2D) clipg);
clipg.dispose(); clipg.dispose();
@ -439,6 +435,13 @@ public class FormDesignerUI extends ComponentUI {
designer.resetEditorComponentBounds(); designer.resetEditorComponentBounds();
} }
protected Rectangle getFitPaintBounds(Component component, Component parent) {
return new Rectangle(-designer.getHorizontalScaleValue(),
-designer.getVerticalScaleValue() + designer.getParaHeight(),
component.getSize().width + designer.getHorizontalScaleValue(),
component.getSize().height + designer.getVerticalScaleValue());
}
/** /**
* 画参数面板 * 画参数面板
*/ */

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java

@ -118,8 +118,8 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_In_Logic"), SwingConstants.LEFT), new UILabel(ChartMobileFitAttrState.PROPORTION.description())}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_In_Logic"), SwingConstants.LEFT), new UILabel(ChartMobileFitAttrState.PROPORTION.description())},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_Out_Logic"), SwingConstants.LEFT), zoomOutComboBox}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_Out_Logic"), SwingConstants.LEFT), zoomOutComboBox},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Collapse_Expand")), mobileCollapsedStyleEditor},
new Component[] {tipLabel, null}, new Component[] {tipLabel, null},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Collapse_Expand")), mobileCollapsedStyleEditor},
new Component[] {allowFullCheckBox, null}, new Component[] {allowFullCheckBox, null},
new Component[] {functionalWhenUnactivatedCheckBox, null} new Component[] {functionalWhenUnactivatedCheckBox, null}
}; };

Loading…
Cancel
Save