Browse Source

Merge branch 'release/10.0' of ssh://cloud.finedevelop.com:7999/~lanlan/design into release/10.0

feature/big-screen
Lanlan 5 years ago
parent
commit
890fa881aa
  1. 59
      designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java
  2. 7
      designer-base/src/main/java/com/fr/design/RestartHelper.java
  3. 2
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  4. 9
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java
  5. 21
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  6. 12
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  7. 16
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  8. 9
      designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java
  9. 3
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  10. 2
      designer-base/src/main/java/com/fr/design/utils/DesignerPort.java
  11. 4
      designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java
  12. 2
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  13. 45
      designer-base/src/test/java/com/fr/common/detect/CommonPortDetectorTest.java
  14. 2
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java
  15. 2
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java
  16. 31
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java
  17. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java
  18. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  19. 8
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java
  20. 2
      designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanMapTableDataContentPane.java
  21. 3
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  22. 30
      designer-realize/src/main/java/com/fr/design/actions/cell/NewPresentAction.java
  23. 4
      designer-realize/src/main/java/com/fr/design/webattr/WebCssPane.java
  24. 10
      designer-realize/src/main/java/com/fr/design/webattr/WebJsPane.java
  25. 32
      designer-realize/src/main/java/com/fr/design/widget/WidgetDefinePaneFactory.java
  26. 30
      designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java
  27. 2
      designer-realize/src/main/java/com/fr/grid/CellElementPainter.java
  28. 8
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  29. 19
      designer-realize/src/main/java/com/fr/start/Designer.java
  30. 17
      designer-realize/src/main/java/com/fr/start/DesignerJavaRuntime.java
  31. 3
      designer-realize/src/main/java/com/fr/start/DesignerLauncher.java
  32. 2
      designer-realize/src/main/java/com/fr/start/DesignerSubListener.java
  33. 2
      designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java
  34. 1
      designer-realize/src/main/java/com/fr/start/MainDesigner.java
  35. 7
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  36. 30
      designer-realize/src/test/java/com/fr/start/DesignerJavaRuntimeTest.java

59
designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java

@ -0,0 +1,59 @@
package com.fr.common.detect;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleContext;
import com.fr.web.WebSocketConfig;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/10
*/
public class CommonPortDetector {
private static final CommonPortDetector INSTANCE = new CommonPortDetector();
private ExecutorService service = ModuleContext.getExecutor().newSingleThreadExecutor(new NamedThreadFactory("CommonPortDetector"));
public static CommonPortDetector getInstance() {
return INSTANCE;
}
public void execute() {
service.submit(new Runnable() {
@Override
public void run() {
detectTomcatPort();
detectWebSocketPort();
}
});
}
private void detectTomcatPort() {
int port = DesignerEnvManager.getEnvManager().getEmbedServerPort();
if (checkPort(port)) {
FineLoggerFactory.getLogger().error("EmbedTomcat Port: {} is not available, maybe occupied by other programs, please check it!", port);
}
}
private void detectWebSocketPort() {
Integer[] ports = WebSocketConfig.getInstance().getPort();
for (int port : ports) {
if (checkPort(port)) {
FineLoggerFactory.getLogger().error("WebSocKet Port: {} is not available, maybe occupied by other programs, please check it!", port);
}
}
}
private boolean checkPort(int port) {
try (Socket socket = new Socket("localhost", port)) {
return true;
} catch (Exception e) {
return false;
}
}
}

7
designer-base/src/main/java/com/fr/design/RestartHelper.java

@ -153,7 +153,14 @@ public class RestartHelper {
} finally { } finally {
WorkContext.getCurrent().close(); WorkContext.getCurrent().close();
frame.dispose(); frame.dispose();
try {
// 更新升级过渡用 供当前测试 后面可删除
Class.forName("com.fr.exit.DesignerExiter");
DesignerExiter.getInstance().execute(); DesignerExiter.getInstance().execute();
} catch (Exception ignore) {
} finally {
System.exit(0);
}
} }
} }

2
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -69,7 +69,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
} }
if (nameableList.getSelectedValue() instanceof ListModelElement) { if (nameableList.getSelectedValue() instanceof ListModelElement) {
Nameable selected = ((ListModelElement) nameableList.getSelectedValue()).wrapper; Nameable selected = ((ListModelElement) nameableList.getSelectedValue()).wrapper;
if (!ComparatorUtils.equals(tempName, selected.getName())) { if (!ComparatorUtils.equals(tempName, selected.getName()) && !isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
rename(selected.getName(), tempName); rename(selected.getName(), tempName);
} }

9
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java

@ -33,9 +33,16 @@ public class TableDataManagerPane extends LoadingBasicPane {
); );
} }
tableDataPane = pane == null ? new TableDataPaneListPane() { tableDataPane = pane == null ? new TableDataPaneListPane() {
public void rename(String oldName, String newName) { @Override
public void rename(final String oldName, final String newName) {
super.rename(oldName, newName); super.rename(oldName, newName);
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() {
renameConnection(oldName, newName); renameConnection(oldName, newName);
return null;
}
}.execute();
} }
} : pane; } : pane;
container.add(tableDataPane.getPanel(), BorderLayout.CENTER); container.add(tableDataPane.getPanel(), BorderLayout.CENTER);

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

@ -1,11 +1,10 @@
package com.fr.design.env; package com.fr.design.env;
import com.fr.cluster.engine.base.FineClusterConfig; import com.fr.cluster.engine.remote.ClusterOperator;
import com.fr.design.i18n.Toolkit; 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.base.operator.common.CommonOperator;
import com.fr.rpc.ExceptionHandler; import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -51,13 +50,12 @@ public class RemoteWorkspace implements Workspace {
@Override @Override
public boolean isWarDeploy() { public boolean isWarDeploy() {
return WorkContext.getCurrent().get(CommonOperator.class, new ExceptionHandler<Boolean>() {
try { @Override
return WorkContext.getCurrent().get(CommonOperator.class).isWarDeploy(); public Boolean callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) {
} catch (ReflectException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false; return false;
} }
}).isWarDeploy();
} }
@Override @Override
@ -81,7 +79,12 @@ public class RemoteWorkspace implements Workspace {
@Override @Override
public boolean isCluster() { public boolean isCluster() {
return FineClusterConfig.getInstance().isCluster(); return WorkContext.getCurrent().get(ClusterOperator.class, new ExceptionHandler<Boolean>() {
@Override
public Boolean callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) {
return false;
}
}).isCluster();
} }
@Override @Override

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

@ -50,16 +50,18 @@ import com.fr.file.FILEFactory;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.image4j.codec.ico.ICODecoder;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.os.support.OSSupportCenter;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -501,8 +503,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
image = ICODecoder.read(DesignerFrame.class image = ICODecoder.read(DesignerFrame.class
.getResourceAsStream("/com/fr/base/images/oem/logo.ico")); .getResourceAsStream("/com/fr/base/images/oem/logo.ico"));
} }
if (OperatingSystem.isMacos()) {
Class clazz = Class.forName("com.apple.eawt.Application");
BufferedImage icon = image.isEmpty() ? IOUtils.readImage("/com/fr/base/images/oem/logo.png") : image.get(image.size() - 1);
Reflect.on(Reflect.on(clazz).call("getApplication").get()).call("setDockIconImage", icon);
} else {
this.setIconImages(image); this.setIconImages(image);
} catch (IOException e) { }
} catch (IOException | ClassNotFoundException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png"));
} }

16
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -684,21 +684,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
this.dispose(); this.dispose();
//模版重命名 //模版重命名
boolean success = false; boolean success = selectedOperation.rename(fnf, path, newPath);
// 提醒保存文件
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true);
// 只有一个文件未保存时
if (HistoryTemplateListCache.getInstance().getHistoryCount() == 1) {
int choose = saveSomeTempaltePane.saveLastOneTemplate();
if (choose != JOptionPane.CANCEL_OPTION) {
success = selectedOperation.rename(fnf, path, newPath);
}
} else {
if (saveSomeTempaltePane.showSavePane()) {
success = selectedOperation.rename(fnf, path, newPath);
}
}
if (success) { if (success) {
HistoryTemplateListCache.getInstance().rename(fnf, path, newPath); HistoryTemplateListCache.getInstance().rename(fnf, path, newPath);

9
designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java

@ -17,6 +17,7 @@ import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FloatEditor; import com.fr.design.editor.editor.FloatEditor;
import com.fr.design.editor.editor.IntegerEditor; import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.editor.editor.TextEditor; import com.fr.design.editor.editor.TextEditor;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -24,6 +25,8 @@ import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -103,6 +106,12 @@ public class ParameterInputPane extends BasicPane {
contentPane.add(flowTableLayoutHelper.createLabelFlowPane(parameterDisplayName + ":", editPane)); contentPane.add(flowTableLayoutHelper.createLabelFlowPane(parameterDisplayName + ":", editPane));
//add editor to parameter hashtable. //add editor to parameter hashtable.
textF.getCurrentEditor().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
});
this.editorNameMap.put(textF, parameter.getName()); this.editorNameMap.put(textF, parameter.getName());
nameAddedList.add(parameter.getName()); nameAddedList.add(parameter.getName());
} }

3
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -30,6 +30,8 @@ import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent;
import com.fr.stable.*; import com.fr.stable.*;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse; import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse;
@ -598,6 +600,7 @@ public class UpdateMainDialog extends UIDialog {
final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB); final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB);
final JFrame frame = DesignerContext.getDesignerFrame(); final JFrame frame = DesignerContext.getDesignerFrame();
final RestartHelper helper = new RestartHelper(); final RestartHelper helper = new RestartHelper();
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY);
new FileProcess(callBack) { new FileProcess(callBack) {
@Override @Override
public void onDownloadSuccess() { public void onDownloadSuccess() {

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"; public static final String XML_TAG = "DesignerPort";
private static final int MIN_PORT = 1024; 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(); 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); font = font.applySize(15).applyStyle(1);
JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Inconsistency")); JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Inconsistency"));
label.setFont(font); 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") 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>"); + localBranch + "/" + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch+"</html>");
label2.setPreferredSize(new Dimension(600,30)); label2.setPreferredSize(new Dimension(600,30));
@ -98,7 +98,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
this.add(topPanel,BorderLayout.NORTH); this.add(topPanel,BorderLayout.NORTH);
this.add(centerPanel, BorderLayout.CENTER); this.add(centerPanel, BorderLayout.CENTER);
this.add(buttonPanel,BorderLayout.SOUTH); 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); GUICoreUtils.centerWindow(this);
} }

2
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -3,6 +3,7 @@
*/ */
package com.fr.start; package com.fr.start;
import com.fr.common.detect.CommonPortDetector;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.constants.DesignerLaunchStatus;
@ -76,6 +77,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
public void on(Event event, Null param) { public void on(Event event, Null param) {
EventDispatcher.stopListen(this); EventDispatcher.stopListen(this);
collectUserInformation(); collectUserInformation();
CommonPortDetector.getInstance().execute();
} }
}); });
} }

45
designer-base/src/test/java/com/fr/common/detect/CommonPortDetectorTest.java

@ -0,0 +1,45 @@
package com.fr.common.detect;
import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory;
import junit.framework.TestCase;
import org.junit.Assert;
import java.io.IOException;
import java.net.ServerSocket;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/10
*/
public class CommonPortDetectorTest extends TestCase {
private ServerSocket serverSocket;
@Override
public void setUp() throws Exception {
serverSocket = new ServerSocket(55555);
new Thread(new Runnable() {
@Override
public void run() {
try {
serverSocket.accept();
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}).start();
}
public void testCheckPort() {
CommonPortDetector detector = CommonPortDetector.getInstance();
boolean access = Reflect.on(detector).call("checkPort", 55555).get();
Assert.assertTrue(access);
}
@Override
public void tearDown() throws Exception {
serverSocket.close();
}
}

2
designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java

@ -257,7 +257,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
if (resolution == 0){ if (resolution == 0){
resolution = ScreenResolution.getScreenResolution(); resolution = ScreenResolution.getScreenResolution();
} }
painter.paint(g2d, chartWidth, chartHeight, resolution, null); painter.paint(g2d, chartWidth, chartHeight, resolution, null, this);
} }
} }

2
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java

@ -63,7 +63,7 @@ public abstract class MapDataSetFieldsPane<T extends ColumnFieldCollectionWithSe
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
VanChartMapPlot plot = chart.getPlot(); VanChartMapPlot plot = chart.getPlot();
if (treeNodeAndItems == null) { if (treeNodeAndItems == null) {
treeNodeAndItems = ChartGEOJSONHelper.getTreeNodeAndItems(plot.getGeoUrl(), level); treeNodeAndItems = ChartGEOJSONHelper.getTreeNodeAndItems(plot.getGeoUrl(), level, plot.getMapType());
} }
final MapAreaMatchPane pane = new MapAreaMatchPane(treeNodeAndItems); final MapAreaMatchPane pane = new MapAreaMatchPane(treeNodeAndItems);

31
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java

@ -4,6 +4,7 @@ import com.fr.chart.base.ChartConstants;
import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIColorButtonWithAuto; import com.fr.design.gui.ibutton.UIColorButtonWithAuto;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.type.FontAutoType;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
@ -11,9 +12,9 @@ import com.fr.general.GeneralUtils;
public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane {
private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto");
private boolean isFontSizeAuto = false; private FontAutoType type;
private boolean isColorAuto = false;
public static String[] FONT_SIZES_WITH_AUTO = new String[FONT_END - FONT_START + 2]; public static String[] FONT_SIZES_WITH_AUTO = new String[FONT_END - FONT_START + 2];
static { static {
FONT_SIZES_WITH_AUTO[0] = AUTO; FONT_SIZES_WITH_AUTO[0] = AUTO;
@ -22,28 +23,30 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane {
} }
} }
public ChartTextAttrPaneWithAuto() { public ChartTextAttrPaneWithAuto(FontAutoType type) {
super(); this.type = type;
initState();
initComponents();
} }
public ChartTextAttrPaneWithAuto(boolean isFontSizeAuto, boolean isColorAuto) { private boolean isFontSizeAuto() {
this.isFontSizeAuto = isFontSizeAuto; return type == FontAutoType.SIZE || type == FontAutoType.SIZE_AND_COLOR;
this.isColorAuto = isColorAuto; }
initState(); private boolean isFontColorAuto() {
initComponents(); return type == FontAutoType.COLOR || type == FontAutoType.SIZE_AND_COLOR;
} }
protected void initFontColorState() { protected void initFontColorState() {
setFontColor(isColorAuto ? new UIColorButtonWithAuto() : new UIColorButton()); setFontColor(isFontColorAuto() ? new UIColorButtonWithAuto() : new UIColorButton());
} }
protected Object[] getFontSizeComboBoxModel() { protected Object[] getFontSizeComboBoxModel() {
return isFontSizeAuto ? FONT_SIZES_WITH_AUTO : FONT_SIZES; return isFontSizeAuto() ? FONT_SIZES_WITH_AUTO : FONT_SIZES;
} }
protected float updateFontSize() { protected float updateFontSize() {
if (isFontSizeAuto && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) { if (isFontSizeAuto() && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) {
return ChartConstants.AUTO_FONT_SIZE; return ChartConstants.AUTO_FONT_SIZE;
} }
@ -51,7 +54,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane {
} }
protected void populateFontSize(FRFont frFont) { protected void populateFontSize(FRFont frFont) {
if (getFontSizeComboBox() != null && isFontSizeAuto) { if (getFontSizeComboBox() != null && isFontSizeAuto()) {
if (frFont.getSize() == ChartConstants.AUTO_FONT_SIZE) { if (frFont.getSize() == ChartConstants.AUTO_FONT_SIZE) {
getFontSizeComboBox().setSelectedItem(AUTO); getFontSizeComboBox().setSelectedItem(AUTO);
} else { } else {
@ -59,7 +62,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane {
} }
} }
if (getFontSizeComboBox() != null && !isFontSizeAuto) { if (getFontSizeComboBox() != null && !isFontSizeAuto()) {
getFontSizeComboBox().setSelectedItem(frFont.getSize()); getFontSizeComboBox().setSelectedItem(frFont.getSize());
} }
} }

3
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java

@ -13,6 +13,7 @@ import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis; import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis;
import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.FontAutoType;
import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
@ -101,7 +102,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
protected ChartTextAttrPane getChartTextAttrPane() { protected ChartTextAttrPane getChartTextAttrPane() {
if (isMulti(gaugeStyle)) { if (isMulti(gaugeStyle)) {
return new ChartTextAttrPaneWithAuto(false, true); return new ChartTextAttrPaneWithAuto(FontAutoType.SIZE_AND_COLOR);
} else { } else {
return new ChartTextAttrPane(); return new ChartTextAttrPane();
} }

17
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -13,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.FontAutoType;
import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -69,9 +70,21 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
return false; return false;
} }
protected ChartTextAttrPane initTextFontPane() { private FontAutoType getFontAutoType() {
if (isFontSizeAuto() && isFontColorAuto()) {
return FontAutoType.SIZE_AND_COLOR;
}
if (isFontSizeAuto()) {
return FontAutoType.SIZE;
}
if (isFontColorAuto()) {
return FontAutoType.COLOR;
}
return FontAutoType.NONE;
}
return new ChartTextAttrPaneWithAuto(isFontSizeAuto(), isFontColorAuto()) { protected ChartTextAttrPane initTextFontPane() {
return new ChartTextAttrPaneWithAuto(getFontAutoType()) {
protected double[] getRowSize() { protected double[] getRowSize() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
return new double[]{p, p}; return new double[]{p, p};

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

2
designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanMapTableDataContentPane.java

@ -63,7 +63,7 @@ public abstract class VanMapTableDataContentPane extends AbstractTableDataConten
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (treeNodeAndItems == null) { if (treeNodeAndItems == null) {
treeNodeAndItems = ChartGEOJSONHelper.getTreeNodeAndItems(plot.getGeoUrl(), level); treeNodeAndItems = ChartGEOJSONHelper.getTreeNodeAndItems(plot.getGeoUrl(), level, plot.getMapType());
} }
final MapAreaMatchPane pane = new MapAreaMatchPane(treeNodeAndItems); final MapAreaMatchPane pane = new MapAreaMatchPane(treeNodeAndItems);

3
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -5,6 +5,7 @@ import com.fr.base.PaperSize;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.FormMobileAttrAction;
import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.TemplateParameterAction;
@ -12,6 +13,7 @@ import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.cell.FloatElementsProvider; import com.fr.design.cell.FloatElementsProvider;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.actions.CopyAction; import com.fr.design.designer.beans.actions.CopyAction;
import com.fr.design.designer.beans.actions.CutAction; import com.fr.design.designer.beans.actions.CutAction;
@ -587,6 +589,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
//下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC //下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC
formDesign.setElementCase(dataTable); formDesign.setElementCase(dataTable);
} }
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

30
designer-realize/src/main/java/com/fr/design/actions/cell/NewPresentAction.java

@ -9,9 +9,13 @@ import com.fr.general.GeneralUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import java.awt.*;
public class NewPresentAction extends PresentCheckBoxAction { public class NewPresentAction extends PresentCheckBoxAction {
private String itemName = null; private String itemName = null;
@ -28,10 +32,28 @@ public class NewPresentAction extends PresentCheckBoxAction {
if (!ComparatorUtils.equals(this.itemName, "NOPRESENT")) { if (!ComparatorUtils.equals(this.itemName, "NOPRESENT")) {
CellElementPropertyPane.getInstance().GoToPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Present"), this.itemName); CellElementPropertyPane.getInstance().GoToPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Present"), this.itemName);
} else { } else {
TemplateCellElement ce = getSelectedCellElement(); ElementCasePane ePane = this.getEditingComponent();
// 只有原来ce设置了形态的情况下才有undo操作 TemplateElementCase elementCase = ePane.getEditingElementCase();
if (ce != null && ce.getPresent() != null) { Selection sel = ePane.getSelection();
ce.setPresent(null); if (sel instanceof CellSelection) {
CellSelection cs = (CellSelection) sel;
int cellRectangleCount = cs.getCellRectangleCount();
for (int rect = 0; rect < cellRectangleCount; rect++) {
Rectangle cellRectangle = cs.getCellRectangle(rect);
for (int j = 0; j < cellRectangle.height; j++) {
for (int i = 0; i < cellRectangle.width; i++) {
int column = i + cellRectangle.x;
int row = j + cellRectangle.y;
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(column, row);
elementCase.addCellElement(cellElement);
} else if (cellElement.getPresent() != null) {
cellElement.setPresent(null);
}
}
}
}
return true; return true;
} else { } else {
return false; return false;

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.file.filter.ChooseFileFilter;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebAttr;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -46,7 +47,8 @@ public class WebCssPane extends BasicPane {
northPane.add(localText, FlowLayout.CENTER); northPane.add(localText, FlowLayout.CENTER);
northPane.add(chooseFile, FlowLayout.RIGHT); northPane.add(chooseFile, FlowLayout.RIGHT);
outnorth.add(northPane,BorderLayout.NORTH); 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)); infor.setForeground(new Color(207, 42, 39));
outnorth.add(infor,BorderLayout.CENTER); outnorth.add(infor,BorderLayout.CENTER);
this.add(outnorth, BorderLayout.NORTH); 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.log.FineLoggerFactory;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebAttr;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -97,7 +98,8 @@ public class WebJsPane extends BasicPane {
northPane.add(localText); northPane.add(localText);
northPane.add(chooseFile); northPane.add(chooseFile);
firstnorth.add(northPane,BorderLayout.NORTH); 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)); infor1.setForeground(new Color(207, 42, 39));
firstnorth.add(infor1,BorderLayout.CENTER); firstnorth.add(infor1,BorderLayout.CENTER);
@ -107,7 +109,7 @@ public class WebJsPane extends BasicPane {
centerPane.add(urlText); centerPane.add(urlText);
centerPane.add(testConnection); centerPane.add(testConnection);
secondnorth.add(centerPane,BorderLayout.NORTH); 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)); infor2.setForeground(new Color(207, 42, 39));
secondnorth.add(infor2,BorderLayout.CENTER); secondnorth.add(infor2,BorderLayout.CENTER);
@ -221,13 +223,13 @@ public class WebJsPane extends BasicPane {
localRadioSelectAction(); localRadioSelectAction();
urlFileRadioButton.setForeground(new Color(143, 142, 139)); urlFileRadioButton.setForeground(new Color(143, 142, 139));
localFileRadioButton.setForeground(Color.black); 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(" "); infor2.setText(" ");
} else if (urlFileRadioButton.isSelected()) { } else if (urlFileRadioButton.isSelected()) {
urlRadioSelectAction(); urlRadioSelectAction();
localFileRadioButton.setForeground(new Color(143, 142, 139)); localFileRadioButton.setForeground(new Color(143, 142, 139));
urlFileRadioButton.setForeground(Color.black); 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(" "); infor1.setText(" ");
} }
if (StringUtils.isEmpty(urlText.getText()) && StringUtils.isEmpty(localText.getText())) { 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; package com.fr.design.widget;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.gui.core.WidgetConstants; import com.fr.design.gui.core.WidgetConstants;
import com.fr.design.widget.ui.ButtonDefinePane; import com.fr.design.widget.ui.ButtonDefinePane;
import com.fr.design.widget.ui.CheckBoxDefinePane; 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.TreeComboBoxEditor;
import com.fr.form.ui.TreeEditor; import com.fr.form.ui.TreeEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; 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.form.TreeNodeToggleButton;
import com.fr.report.web.button.write.AppendRowButton; import com.fr.report.web.button.write.AppendRowButton;
import com.fr.report.web.button.write.DeleteRowButton; 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(); private static Map<Class<? extends Widget>, Appearance> pluginDefineMap = ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap();
static { 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(NumberEditor.class, new Appearance(NumberEditorDefinePane.class, WidgetConstants.NUMBER + ""));
defineMap.put(DateEditor.class, new Appearance(DateEditorDefinePane.class, WidgetConstants.DATE + "")); defineMap.put(DateEditor.class, new Appearance(DateEditorDefinePane.class, WidgetConstants.DATE + ""));
defineMap.put(ComboCheckBox.class, new Appearance(ComboCheckBoxDefinePane.class, WidgetConstants.COMBOCHECKBOX + "")); 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 + "")); defineMap.put(TreeNodeToggleButton.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + ""));
} }
private WidgetDefinePaneFactory() { private static void refreshPluginMap() {
pluginDefineMap.clear();
pluginDefineMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap());
} }
@Nullable @Nullable

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

@ -1,13 +1,20 @@
package com.fr.design.widget; package com.fr.design.widget;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.widget.mobile.WidgetMobilePane; import com.fr.design.widget.mobile.WidgetMobilePane;
import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane; import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane;
import com.fr.design.widget.ui.mobile.ScanCodeMobilePane; import com.fr.design.widget.ui.mobile.ScanCodeMobilePane;
import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; 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.HashMap;
import java.util.Map; import java.util.Map;
@ -17,22 +24,43 @@ import java.util.Map;
*/ */
public class WidgetMobilePaneFactory { public class WidgetMobilePaneFactory {
private static Map<Class<? extends Widget>, Class<? extends WidgetMobilePane>> mobilePaneMap = new HashMap<>(); 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 { static {
mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.class); mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.class);
mobilePaneMap.put(TextEditor.class, ScanCodeMobilePane.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 WidgetMobilePaneFactory() {
} }
private static void refreshPluginMap() {
mobilePluginPaneMap.clear();
mobilePluginPaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap());
}
public static WidgetMobilePane createWidgetMobilePane(Widget widget) { public static WidgetMobilePane createWidgetMobilePane(Widget widget) {
WidgetMobilePane mobilePane = WidgetMobilePane.DEFAULT_PANE; WidgetMobilePane mobilePane = WidgetMobilePane.DEFAULT_PANE;
try { try {
if (mobilePaneMap.containsKey(widget.getClass())) { if (mobilePaneMap.containsKey(widget.getClass())) {
mobilePane = mobilePaneMap.get(widget.getClass()).newInstance(); mobilePane = mobilePaneMap.get(widget.getClass()).newInstance();
mobilePane.populate(widget); mobilePane.populate(widget);
} else if (mobilePluginPaneMap.containsKey(widget.getClass())){
mobilePane = mobilePluginPaneMap.get(widget.getClass()).newInstance();
mobilePane.populate(widget);
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

2
designer-realize/src/main/java/com/fr/grid/CellElementPainter.java

@ -9,7 +9,7 @@ import com.fr.report.core.PaintUtils;
import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.ElementCase;
public class CellElementPainter { public class CellElementPainter {
public void paintBackground(Graphics2D g2d, ElementCase report, CellElement ce, int width, int height) { public void paintBackground(Graphics2D g2d, ElementCase report, CellElement ce, double width, double height) {
Style.paintBackground(g2d, ce.getStyle(), width, height); Style.paintBackground(g2d, ce.getStyle(), width, height);
} }

8
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -497,12 +497,12 @@ public class GridUI extends ComponentUI {
paintCellElementRectangleList.add(this.tmpRectangle.clone()); paintCellElementRectangleList.add(this.tmpRectangle.clone());
int cellWidth = (int) this.tmpRectangle.getWidth(); double cellWidth = this.tmpRectangle.getWidth();
int cellHeight = (int) this.tmpRectangle.getHeight(); double cellHeight = this.tmpRectangle.getHeight();
// denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框 // denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框
painter.paintBackground(g2d, report, tmpCellElement, cellWidth, cellHeight); painter.paintBackground(g2d, report, tmpCellElement, cellWidth - 1, cellHeight - 1);
painter.paintContent(g2d, report, tmpCellElement, cellWidth, cellHeight, resolution); painter.paintContent(g2d, report, tmpCellElement, (int) cellWidth, (int) cellHeight, resolution);
// denny_Grid: 注意下面还要减一, 因为上面translate时加一 // denny_Grid: 注意下面还要减一, 因为上面translate时加一
g2d.translate(-this.tmpRectangle.getX() - 1, -this.tmpRectangle.getY() - 1); g2d.translate(-this.tmpRectangle.getX() - 1, -this.tmpRectangle.getY() - 1);
paintAuthorityCell(g2d, tmpCellElement); paintAuthorityCell(g2d, tmpCellElement);

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

@ -1,5 +1,7 @@
package com.fr.start; package com.fr.start;
import com.fr.log.FineLoggerFactory;
/** /**
* 设计器主进程入口(无缝更换升级jar包若使用其他类作为入口需要重新打包designer.exe等升级后仍然走的原来逻辑) * 设计器主进程入口(无缝更换升级jar包若使用其他类作为入口需要重新打包designer.exe等升级后仍然走的原来逻辑)
* *
@ -11,7 +13,24 @@ package com.fr.start;
public class Designer { public class Designer {
public static void main(String[] args) { public static void main(String[] args) {
try {
if (DesignerJavaRuntime.getInstance().isInValidVmOptions()) {
runNonGuardianDesigner(args);
} else {
// 创建进程 // 创建进程
DesignerLauncher.getInstance().start(args); 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.StringUtils;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import java.util.Set;
/** /**
* 设计器Java运行环境 * 设计器Java运行环境
* *
@ -16,6 +18,7 @@ import com.fr.stable.os.OperatingSystem;
public class DesignerJavaRuntime extends AbstractJavaRuntime { public class DesignerJavaRuntime extends AbstractJavaRuntime {
private static final String DOT = "."; 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 INSTALL4J = ".install4j";
private static final String JAVA_EXEC = "java"; private static final String JAVA_EXEC = "java";
private static final String WIN_JRE_BIN = StableUtils.pathJoin("jre", "bin"); private static final String WIN_JRE_BIN = StableUtils.pathJoin("jre", "bin");
@ -28,6 +31,20 @@ public class DesignerJavaRuntime extends AbstractJavaRuntime {
return INSTANCE; return INSTANCE;
} }
/**
* 远程调试不走启动守护
* @return
*/
public boolean isInValidVmOptions() {
String[] options = getJvmOptions();
for (String op : options) {
if (op.startsWith(REMOTE_DEBUG)) {
return true;
}
}
return false;
}
@Override @Override
public String getJavaExec() { public String getJavaExec() {
String installHome = StableUtils.getInstallHome(); String installHome = StableUtils.getInstallHome();

3
designer-realize/src/main/java/com/fr/start/DesignerLauncher.java

@ -1,5 +1,6 @@
package com.fr.start; package com.fr.start;
import com.fr.design.RestartHelper;
import com.fr.process.FineProcess; import com.fr.process.FineProcess;
import com.fr.process.engine.FineJavaProcessFactory; import com.fr.process.engine.FineJavaProcessFactory;
import com.fr.process.engine.core.FineProcessContext; import com.fr.process.engine.core.FineProcessContext;
@ -63,6 +64,6 @@ public class DesignerLauncher {
public void restart() { public void restart() {
beforeExit(); beforeExit();
start(args); RestartHelper.restart();
} }
} }

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

@ -26,6 +26,7 @@ public class DesignerSubListener {
} }
public void start() { public void start() {
if (FineProcessContext.getParentPipe() != null) {
FineProcessContext.getParentPipe().listen(FineProcessEngineEvent.READY, new Listener<Null>() { FineProcessContext.getParentPipe().listen(FineProcessEngineEvent.READY, new Listener<Null>() {
@Override @Override
public void on(Event event, Null param) { public void on(Event event, Null param) {
@ -35,4 +36,5 @@ public class DesignerSubListener {
} }
}); });
} }
}
} }

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

@ -57,7 +57,7 @@ public class DesignerSuperListener {
process.getPipe().listen(FineProcessEngineEvent.DESTROY, new Listener<Null>() { process.getPipe().listen(FineProcessEngineEvent.DESTROY, new Listener<Null>() {
@Override @Override
public void on(Event event, Null param) { public void on(Event event, Null param) {
DesignerLauncher.getInstance().exit(); System.exit(0);
} }
}); });
} }

1
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -106,6 +106,7 @@ public class MainDesigner extends BaseDesigner {
watch.start(); watch.start();
//启动运行时 //启动运行时
FineRuntime.start(); FineRuntime.start();
DesignerSubListener.getInstance().start();
Module designerRoot = ModuleContext.parseRoot("designer-startup.xml"); Module designerRoot = ModuleContext.parseRoot("designer-startup.xml");
//传递启动参数 //传递启动参数
designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args)); designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args));

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

@ -24,6 +24,7 @@ import com.fr.record.analyzer.Metrics;
import com.fr.stable.BuildContext; import com.fr.stable.BuildContext;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.start.DesignerProcessType; import com.fr.start.DesignerProcessType;
import com.fr.start.OemHandler; import com.fr.start.OemHandler;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
@ -58,6 +59,8 @@ public class DesignerStartup extends Activator {
BuildContext.setBuildFilePath("/com/fr/stable/build.properties"); BuildContext.setBuildFilePath("/com/fr/stable/build.properties");
// 检查是否是-Ddebug = true 启动 并切换对应的端口以及环境配置文件 // 检查是否是-Ddebug = true 启动 并切换对应的端口以及环境配置文件
checkDebugStart(); checkDebugStart();
// 都是在启动过程中读取,这边提前初始化xml配置
DesignerEnvManager.getEnvManager();
// 初始化look and feel // 初始化look and feel
DesignUtils.initLookAndFeel(); DesignUtils.initLookAndFeel();
if (DesignUtils.isPortOccupied()) { if (DesignUtils.isPortOccupied()) {
@ -89,6 +92,10 @@ public class DesignerStartup extends Activator {
} }
}; };
dialog.setVisible(true); dialog.setVisible(true);
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getId(),
DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getMessage(),
StringUtils.EMPTY);
FineLoggerFactory.getLogger().error(DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getId() + ": " + DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getMessage());
} }
DesignerExiter.getInstance().execute(); DesignerExiter.getInstance().execute();
return; return;

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