Browse Source

Merge branch 'release/10.0' of https://cloud.finedevelop.com/scm/~hugh.c/design into release/10.0

feature/big-screen
Hugh.C 5 years ago
parent
commit
c7ca31c085
  1. 12
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  2. 2
      designer-base/src/main/java/com/fr/design/utils/DesignerPort.java
  3. 4
      designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java
  4. 8
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java
  5. 4
      designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java
  6. 10
      designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java
  7. 32
      designer-realize/src/main/java/com/fr/design/widget/WidgetDefinePaneFactory.java
  8. 30
      designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java
  9. 19
      designer-realize/src/main/java/com/fr/start/Designer.java
  10. 17
      designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java
  11. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  12. 30
      designer-realize/src/test/java/com/fr/start/DesignerJavaRuntimeTest.java

12
designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java vendored

@ -2,10 +2,9 @@ package com.fr.design.env;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.design.i18n.Toolkit;
import com.fr.invoke.ReflectException;
import com.fr.log.FineLoggerFactory;
import com.fr.base.operator.common.CommonOperator;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
@ -51,13 +50,12 @@ public class RemoteWorkspace implements Workspace {
@Override
public boolean isWarDeploy() {
try {
return WorkContext.getCurrent().get(CommonOperator.class).isWarDeploy();
} catch (ReflectException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return WorkContext.getCurrent().get(CommonOperator.class, new ExceptionHandler<Boolean>() {
@Override
public Boolean callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) {
return false;
}
}).isWarDeploy();
}
@Override

2
designer-base/src/main/java/com/fr/design/utils/DesignerPort.java

@ -32,7 +32,7 @@ public class DesignerPort implements XMLReadable, XMLWriter {
public static final String XML_TAG = "DesignerPort";
private static final int MIN_PORT = 1024;
private static final int MAX_PORT = 65536;
private static final int MAX_PORT = 65535;
public static final DesignerPort INSTANCE = new DesignerPort();

4
designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java

@ -54,7 +54,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
font = font.applySize(15).applyStyle(1);
JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Inconsistency"));
label.setFont(font);
label.setPreferredSize(new Dimension(600,30));
label.setPreferredSize(new Dimension(650,30));
JLabel label2 = new JLabel("<html>"+Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer")
+ localBranch + "/" + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch+"</html>");
label2.setPreferredSize(new Dimension(600,30));
@ -98,7 +98,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
this.add(topPanel,BorderLayout.NORTH);
this.add(centerPanel, BorderLayout.CENTER);
this.add(buttonPanel,BorderLayout.SOUTH);
this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US)? 700:600, 500));
this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US)? 750:600, 500));
GUICoreUtils.centerWindow(this);
}

8
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

@ -17,6 +17,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.attr.GaugeDetailStyle;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.stable.Constants;
@ -92,13 +93,16 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
if(attrLabel == null){
return;
}
AttrLabelDetail attrLabelDetail = attrLabel.getAttrLabelDetail();
if(attrLabelDetail == null || attrLabelDetail.getTextAttr() == null){
return;
}
attrLabelDetail.getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT);
if(gaugeLayout.getSelectedIndex() == 0){
attrLabel.getAttrLabelDetail().setPosition(Constants.LEFT);
attrLabel.getAttrLabelDetail().getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_VERTICAL_PERCENT_LABEL_FONT);
attrLabel.getGaugeValueLabelDetail().setPosition(Constants.LEFT);
} else {
attrLabel.getAttrLabelDetail().setPosition(Constants.BOTTOM);
attrLabel.getAttrLabelDetail().getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_PERCENT_LABEL_FONT);
attrLabel.getGaugeValueLabelDetail().setPosition(Constants.BOTTOM);
}
}

4
designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java

@ -12,6 +12,7 @@ import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.web.attr.ReportWebAttr;
import javax.swing.BorderFactory;
@ -46,7 +47,8 @@ public class WebCssPane extends BasicPane {
northPane.add(localText, FlowLayout.CENTER);
northPane.add(chooseFile, FlowLayout.RIGHT);
outnorth.add(northPane,BorderLayout.NORTH);
UILabel infor = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CSS_Warning"));
UILabel infor = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CSS_Warning",
ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBAPP_NAME));
infor.setForeground(new Color(207, 42, 39));
outnorth.add(infor,BorderLayout.CENTER);
this.add(outnorth, BorderLayout.NORTH);

10
designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java

@ -15,6 +15,7 @@ import com.fr.file.filter.ChooseFileFilter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.web.attr.ReportWebAttr;
import javax.swing.BorderFactory;
@ -97,7 +98,8 @@ public class WebJsPane extends BasicPane {
northPane.add(localText);
northPane.add(chooseFile);
firstnorth.add(northPane,BorderLayout.NORTH);
infor1 = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1"));
infor1 = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1",
ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBAPP_NAME));
infor1.setForeground(new Color(207, 42, 39));
firstnorth.add(infor1,BorderLayout.CENTER);
@ -107,7 +109,7 @@ public class WebJsPane extends BasicPane {
centerPane.add(urlText);
centerPane.add(testConnection);
secondnorth.add(centerPane,BorderLayout.NORTH);
infor2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING2"));
infor2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING2", ProjectConstants.WEBAPP_NAME));
infor2.setForeground(new Color(207, 42, 39));
secondnorth.add(infor2,BorderLayout.CENTER);
@ -221,13 +223,13 @@ public class WebJsPane extends BasicPane {
localRadioSelectAction();
urlFileRadioButton.setForeground(new Color(143, 142, 139));
localFileRadioButton.setForeground(Color.black);
infor1.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1"));
infor1.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING1", ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBAPP_NAME));
infor2.setText(" ");
} else if (urlFileRadioButton.isSelected()) {
urlRadioSelectAction();
localFileRadioButton.setForeground(new Color(143, 142, 139));
urlFileRadioButton.setForeground(Color.black);
infor2.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING2"));
infor2.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JS_WARNING2", ProjectConstants.WEBAPP_NAME));
infor1.setText(" ");
}
if (StringUtils.isEmpty(urlText.getText()) && StringUtils.isEmpty(localText.getText())) {

32
designer-realize/src/main/java/com/fr/design/widget/WidgetDefinePaneFactory.java

@ -1,6 +1,7 @@
package com.fr.design.widget;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.gui.core.WidgetConstants;
import com.fr.design.widget.ui.ButtonDefinePane;
import com.fr.design.widget.ui.CheckBoxDefinePane;
@ -42,7 +43,13 @@ import com.fr.form.ui.TextEditor;
import com.fr.form.ui.TreeComboBoxEditor;
import com.fr.form.ui.TreeEditor;
import com.fr.form.ui.Widget;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.report.web.button.form.TreeNodeToggleButton;
import com.fr.report.web.button.write.AppendRowButton;
import com.fr.report.web.button.write.DeleteRowButton;
@ -66,6 +73,26 @@ public class WidgetDefinePaneFactory {
private static Map<Class<? extends Widget>, Appearance> pluginDefineMap = ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap();
static {
putDefault();
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshPluginMap();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, CellWidgetOptionProvider.XML_TAG);
}
});
}
private WidgetDefinePaneFactory() {
}
private static void putDefault() {
defineMap.put(NumberEditor.class, new Appearance(NumberEditorDefinePane.class, WidgetConstants.NUMBER + ""));
defineMap.put(DateEditor.class, new Appearance(DateEditorDefinePane.class, WidgetConstants.DATE + ""));
defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + ""));
@ -96,8 +123,9 @@ public class WidgetDefinePaneFactory {
defineMap.put(TreeNodeToggleButton.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + ""));
}
private WidgetDefinePaneFactory() {
private static void refreshPluginMap() {
pluginDefineMap.clear();
pluginDefineMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap());
}
@Nullable

30
designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java

@ -1,13 +1,20 @@
package com.fr.design.widget;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.widget.mobile.WidgetMobilePane;
import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane;
import com.fr.design.widget.ui.mobile.ScanCodeMobilePane;
import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.Widget;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import java.util.HashMap;
import java.util.Map;
@ -17,22 +24,43 @@ import java.util.Map;
*/
public class WidgetMobilePaneFactory {
private static Map<Class<? extends Widget>, Class<? extends WidgetMobilePane>> mobilePaneMap = new HashMap<>();
private static Map<Class<? extends Widget>, Class<? extends WidgetMobilePane>> mobilePluginPaneMap = new HashMap<>();
static {
mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.class);
mobilePaneMap.put(TextEditor.class, ScanCodeMobilePane.class);
mobilePaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap());
mobilePluginPaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap());
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshPluginMap();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, CellWidgetOptionProvider.XML_TAG);
}
});
}
private WidgetMobilePaneFactory() {
}
private static void refreshPluginMap() {
mobilePluginPaneMap.clear();
mobilePluginPaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap());
}
public static WidgetMobilePane createWidgetMobilePane(Widget widget) {
WidgetMobilePane mobilePane = WidgetMobilePane.DEFAULT_PANE;
try {
if (mobilePaneMap.containsKey(widget.getClass())) {
mobilePane = mobilePaneMap.get(widget.getClass()).newInstance();
mobilePane.populate(widget);
} else if (mobilePluginPaneMap.containsKey(widget.getClass())){
mobilePane = mobilePluginPaneMap.get(widget.getClass()).newInstance();
mobilePane.populate(widget);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

19
designer-realize/src/main/java/com/fr/start/Designer.java

@ -1,5 +1,7 @@
package com.fr.start;
import com.fr.log.FineLoggerFactory;
/**
* 设计器主进程入口(无缝更换升级jar包若使用其他类作为入口需要重新打包designer.exe等升级后仍然走的原来逻辑)
*
@ -11,7 +13,24 @@ package com.fr.start;
public class Designer {
public static void main(String[] args) {
try {
if (DesignerJavaRuntime.getInstance().isInValidVmOptions()) {
runNonGuardianDesigner(args);
} else {
// 创建进程
DesignerLauncher.getInstance().start(args);
}
} catch (Exception e) {
runNonGuardianDesigner(args);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
/**
* 启动非守护设计器
* @param args 参数
*/
private static void runNonGuardianDesigner(String[] args) {
MainDesigner.main(args);
}
}

17
designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java

@ -6,6 +6,8 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import java.util.Set;
/**
* 设计器Java运行环境
*
@ -16,6 +18,7 @@ import com.fr.stable.os.OperatingSystem;
public class DesignerJavaRuntime extends AbstractJavaRuntime {
private static final String DOT = ".";
private static final String REMOTE_DEBUG = "-agentlib:jdwp=transport=dt_socket";
private static final String INSTALL4J = ".install4j";
private static final String JAVA_EXEC = "java";
private static final String WIN_JRE_BIN = StableUtils.pathJoin("jre", "bin");
@ -28,6 +31,20 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime {
return INSTANCE;
}
/**
* 远程调试不走启动守护
* @return
*/
public boolean isInValidVmOptions() {
String[] options = getJvmOptions();
for (String op : options) {
if (op.startsWith(REMOTE_DEBUG)) {
return true;
}
}
return false;
}
@Override
public String getJavaExec() {
String installHome = StableUtils.getInstallHome();

2
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -58,6 +58,8 @@ public class DesignerStartup extends Activator {
BuildContext.setBuildFilePath("/com/fr/stable/build.properties");
// 检查是否是-Ddebug = true 启动 并切换对应的端口以及环境配置文件
checkDebugStart();
// 都是在启动过程中读取,这边提前初始化xml配置
DesignerEnvManager.getEnvManager();
// 初始化look and feel
DesignUtils.initLookAndFeel();
if (DesignUtils.isPortOccupied()) {

30
designer-realize/src/test/java/com/fr/start/DesignerJavaRuntimeTest.java

@ -0,0 +1,30 @@
package com.fr.start;
import junit.framework.TestCase;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/10
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({DesignerJavaRuntime.class})
public class DesignerJavaRuntimeTest extends TestCase {
public void testIsInValidVmOptions() {
PowerMock.mockStatic(DesignerJavaRuntime.class);
DesignerJavaRuntime designerJavaRuntime = PowerMock.createPartialMock(DesignerJavaRuntime.class, "isInstallVersion", "getJvmOptions");
String[] options = new String[]{"-Dfile.encoding=UTF-8", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"};
EasyMock.expect(designerJavaRuntime.getJvmOptions()).andReturn(options).anyTimes();
EasyMock.replay(designerJavaRuntime);
PowerMock.replay(DesignerJavaRuntime.class);
Assert.assertTrue(designerJavaRuntime.isInValidVmOptions());
}
}
Loading…
Cancel
Save