From ce9b3c71b0cdaf6f004417d957f3b3160c4fd2ef Mon Sep 17 00:00:00 2001 From: Maksim Date: Mon, 9 Dec 2019 15:49:45 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E5=BB=BA=E7=AB=8Bsocket=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=87=8D=E8=AF=95=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/socketio/DesignerSocketIO.java | 167 +++++++++++------- 1 file changed, 104 insertions(+), 63 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index e2b13b1adf..8ce0bdcec4 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -13,7 +13,6 @@ import com.fr.report.RemoteDesignConstants; import com.fr.serialization.SerializerHelper; import com.fr.stable.ArrayUtils; import com.fr.third.apache.log4j.spi.LoggingEvent; -import com.fr.third.guava.base.Optional; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; @@ -36,28 +35,19 @@ public class DesignerSocketIO { Disconnecting } - private static Optional socketIO = Optional.absent(); + private static Socket socket = null; private static Status status = Status.Disconnected; + //维护一个当前工作环境的uri列表 + private static String[] uri; + //维护一个关于uri列表的计数器 + private static int count; - private static final Emitter.Listener printLog = new Emitter.Listener() { - @Override - public void call(Object... objects) { - if (ArrayUtils.isNotEmpty(objects)) { - try { - LoggingEvent event = SerializerHelper.deserialize((byte[]) objects[0]); - DesignerLogger.log(event); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - } - }; public static void close() { - if (socketIO.isPresent()) { + if (socket != null) { status = Status.Disconnecting; - socketIO.get().close(); - socketIO = Optional.absent(); + socket.close(); + socket = null; } } @@ -66,57 +56,42 @@ public class DesignerSocketIO { if (current.isLocal()) { return; } + //每当更换工作环境,更新uri列表,同时更新计数器count try { - String[] uri = getSocketUri(current); - socketIO = Optional.of(IO.socket(new URI(uri[0]))); - socketIO.get().on(WorkspaceConstants.WS_LOGRECORD, printLog); - socketIO.get().on(WorkspaceConstants.CONFIG_MODIFY, new Emitter.Listener() { - @Override - public void call(Object... objects) { - assert objects != null && objects.length == 1; - String param = (String) objects[0]; - EventDispatcher.fire(RemoteConfigEvent.EDIT, param); - } - }); - socketIO.get().on(Socket.EVENT_DISCONNECT, new Emitter.Listener() { - @Override - public void call(Object... objects) { - /* - * todo 远程心跳断开不一定 socketio 断开 和远程紧密相关的业务都绑定在心跳上,切换成心跳断开之后进行提醒, - * socketio 只用推日志和通知配置变更 - */ - if (status != Status.Disconnecting) { - try { - UIUtil.invokeAndWaitIfNeeded(new Runnable() { - @Override - public void run() { - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Basic_Remote_Disconnected"), - UIManager.getString("OptionPane.messageDialogTitle"), - JOptionPane.ERROR_MESSAGE, - UIManager.getIcon("OptionPane.errorIcon")); - EnvChangeEntrance.getInstance().chooseEnv(); - } - }); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - status = Status.Disconnected; - } - }); - socketIO.get().connect(); - status = Status.Connected; + uri = getSocketUri(); + } catch (IOException e) { + e.printStackTrace(); + } + count = 0; + //建立socket并注册监听 + CreateSocket(); + } + + private static void CreateSocket(){ + //根据uri和计数器建立连接,并注册监听 + try { + if(count Date: Mon, 9 Dec 2019 16:39:15 +0800 Subject: [PATCH 02/18] return --- .../fr/design/mainframe/socketio/DesignerSocketIO.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 8ce0bdcec4..92f7e9771c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -60,14 +60,14 @@ public class DesignerSocketIO { try { uri = getSocketUri(); } catch (IOException e) { - e.printStackTrace(); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } count = 0; //建立socket并注册监听 - CreateSocket(); + createSocket(); } - private static void CreateSocket(){ + private static void createSocket(){ //根据uri和计数器建立连接,并注册监听 try { if(count Date: Mon, 9 Dec 2019 16:40:25 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/socketio/DesignerSocketIO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 92f7e9771c..057eb6de9e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -138,7 +138,7 @@ public class DesignerSocketIO { @Override public void call(Object... objects) { /* - * todo 远程心跳断开不一定 socketio 断开 和远程紧密相关的业务都绑定在心跳上,切换成心跳断开之后进行提醒, + * todo 远程心跳断开不一定 socket 断开 和远程紧密相关的业务都绑定在心跳上,切换成心跳断开之后进行提醒, * socket 只用推日志和通知配置变更 */ if (status != Status.Disconnecting) { From f8329a6aff5a80f88501def038de64315f3bd408 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 25 Feb 2020 18:02:23 +0800 Subject: [PATCH 04/18] REPORT-27138 && REPORT-27137 && REPORT-27109 && REPORT-27140 --- .../java/com/fr/design/dialog/TipDialog.java | 16 +- .../com/fr/design/utils/DesignerPort.java | 167 +++++++++++++++--- .../main/java/com/fr/exit/DesignerExiter.java | 5 +- .../com/fr/design/images/edit/edit_typing.png | Bin 0 -> 611 bytes .../com/fr/design/images/error/error2.png | Bin 0 -> 1244 bytes .../src/main/java/com/fr/start/Designer.java | 24 +-- .../java/com/fr/start/DesignerLauncher.java | 55 ++++++ .../com/fr/start/DesignerSubListener.java | 38 ++++ .../com/fr/start/DesignerSuperListener.java | 147 +++++++++++++++ .../main/java/com/fr/start/MainDesigner.java | 2 - .../com/fr/start/module/DesignerStartup.java | 8 +- 11 files changed, 404 insertions(+), 58 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/edit/edit_typing.png create mode 100644 designer-base/src/main/resources/com/fr/design/images/error/error2.png create mode 100644 designer-realize/src/main/java/com/fr/start/DesignerLauncher.java create mode 100644 designer-realize/src/main/java/com/fr/start/DesignerSubListener.java create mode 100644 designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java diff --git a/designer-base/src/main/java/com/fr/design/dialog/TipDialog.java b/designer-base/src/main/java/com/fr/design/dialog/TipDialog.java index 14997f8687..e4cf0c8e71 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/TipDialog.java +++ b/designer-base/src/main/java/com/fr/design/dialog/TipDialog.java @@ -7,9 +7,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.IOUtils; -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.JTextArea; +import javax.swing.*; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; @@ -27,16 +25,16 @@ public abstract class TipDialog extends JDialog implements ActionListener { private UIButton endButton; private UIButton cancelButton; - public TipDialog(Frame parent, String type) { + public TipDialog(Frame parent, String type, String tip, String endText, String cancelText) { super(parent, true); JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel iconPane = new JPanel(); UILabel iconLabel = new UILabel(); - iconLabel.setIcon(IOUtils.readIcon("com/fr/design/images/error/error.png")); + iconLabel.setIcon(IOUtils.readIcon("com/fr/design/images/error/error2.png")); iconPane.add(iconLabel); - iconPane.setPreferredSize(new Dimension(100, 100)); + iconPane.setPreferredSize(new Dimension(50, 50)); JPanel tipPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Last_Designer_Process_Not_Exist")); + UILabel tipLabel = new UILabel(tip); tipPane.add(tipLabel); northPane.add(iconPane, BorderLayout.WEST); northPane.add(tipPane, BorderLayout.CENTER); @@ -51,7 +49,7 @@ public abstract class TipDialog extends JDialog implements ActionListener { JPanel southPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0)); - endButton = new UIButton(Toolkit.i18nText("Fine-Design_End_Occupied_Process")); + endButton = new UIButton(endText); endButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -59,7 +57,7 @@ public abstract class TipDialog extends JDialog implements ActionListener { } }); buttonPane.add(endButton); - cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); + cancelButton = new UIButton(cancelText); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java index 46bdd52a83..cd02bc5c5e 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java @@ -1,13 +1,29 @@ package com.fr.design.utils; +import com.fr.design.DesignerEnvManager; +import com.fr.design.RestartHelper; +import com.fr.design.dialog.TipDialog; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; +import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLWriter; import com.fr.stable.xml.XMLableReader; -import javax.swing.JOptionPane; +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; /** * 为的就是能替换 DesignPort.class 实现多开,因此避免编译器常量编译展开优化 @@ -69,27 +85,138 @@ public class DesignerPort implements XMLReadable, XMLWriter { writer.end(); } - public int resetPort() { - String port = JOptionPane.showInputDialog(null, - Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Tip"), - Toolkit.i18nText("Fine-Design_Modify_Designer_Port"), JOptionPane.INFORMATION_MESSAGE); - int value; - try { - value = Integer.parseInt(port); - } catch (NumberFormatException e) { - JOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Not_Number_Tip")); - value = resetPort(); - } - if (value < MIN_PORT || value > MAX_PORT) { - JOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Out_Of_Range_Tip")); - value = resetPort(); + public void resetPort() { + + TipDialog dialog = new TipDialog(null, + StringUtils.EMPTY, + Toolkit.i18nText("Fine-Design_Port_Found_Port_Conflict"), + Toolkit.i18nText("Fine-Design_End_Occupied_Process"), + Toolkit.i18nText("Fine-Design_Modify_Designer_Port")) { + @Override + protected void endEvent() { + dispose(); + } + + @Override + protected void cancelEvent() { + new ResetPortDialog(); + } + }; + dialog.setVisible(true); + DesignerExiter.getInstance().execute(); + } + + private class ResetPortDialog extends JDialog { + private UITextField portFiled; + private UILabel warnLabel; + private UIButton okButton; + + private ResetPortDialog() { + this.setLayout(new BorderLayout()); + this.setModal(true); + this.portFiled = new UITextField(); + this.portFiled.setPreferredSize(new Dimension(180, 20)); + this.portFiled.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + checkValid(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + checkValid(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + checkValid(); + } + }); + JPanel iconPanel = new JPanel(); + UILabel iconLabel = new UILabel(); + iconLabel.setIcon(IOUtils.readIcon("com/fr/design/images/edit/edit_typing.png")); + iconPanel.add(iconLabel); + iconPanel.add(iconLabel); + JPanel textPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + textPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Tip"))); + textPane.add(portFiled); + warnLabel = new UILabel(); + warnLabel.setVisible(false); + warnLabel.setForeground(Color.RED); + okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_OK")); + okButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + int value = Integer.parseInt(portFiled.getText().trim()); + if (ComparatorUtils.equals("true", System.getProperty("debug"))) { + setDebugMessagePort(value); + } else { + setMessagePort(value); + } + dispose(); + DesignerEnvManager.getEnvManager().saveXMLFile(); + RestartHelper.restart(); + } + }); + UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")); + cancelButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + dispose(); + } + }); + JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); + buttonPane.add(okButton); + buttonPane.add(cancelButton); + JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + controlPane.add(buttonPane, BorderLayout.EAST); + JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + northPane.add(iconPanel, BorderLayout.WEST); + northPane.add(textPane, BorderLayout.CENTER); + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + centerPane.add(warnLabel); + JPanel southPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + southPane.add(controlPane); + this.add(northPane, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + this.add(southPane, BorderLayout.SOUTH); + this.setSize(300, 150); + this.setTitle(Toolkit.i18nText("Fine-Design_Modify_Designer_Port")); + this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + this.setResizable(false); + this.setAlwaysOnTop(true); + GUICoreUtils.centerWindow(this); + this.setVisible(true); } - if (ComparatorUtils.equals("true", System.getProperty("debug"))) { - setDebugMessagePort(value); - } else { - setMessagePort(value); + + private void checkValid() { + String port = this.portFiled.getText().trim(); + if (StringUtils.isEmpty(port)) { + okButton.setEnabled(false); + return; + } + + int value; + try { + value = Integer.parseInt(port); + } catch (NumberFormatException ignore) { + warnLabel.setText(Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Not_Number_Tip")); + warnLabel.setVisible(true); + okButton.setEnabled(false); + return; + } + + if (value < MIN_PORT || value > MAX_PORT) { + warnLabel.setText(Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Out_Of_Range_Tip")); + warnLabel.setVisible(true); + okButton.setEnabled(false); + return; + } + + warnLabel.setVisible(false); + okButton.setEnabled(true); } - return value; } } diff --git a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java index 8264d8db91..c7319f4c63 100644 --- a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java +++ b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java @@ -21,10 +21,9 @@ public class DesignerExiter { } public void execute() { - if (FineProcessContext.getParentPipe() == null && DOT.equals(StableUtils.getInstallHome())) { - System.exit(0); - } else { + if (FineProcessContext.getParentPipe() != null || !DOT.equals(StableUtils.getInstallHome())) { FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); } + System.exit(0); } } diff --git a/designer-base/src/main/resources/com/fr/design/images/edit/edit_typing.png b/designer-base/src/main/resources/com/fr/design/images/edit/edit_typing.png new file mode 100644 index 0000000000000000000000000000000000000000..929f14137a3f09b2d808e0d4003bfb0e8383f2fd GIT binary patch literal 611 zcmV-p0-XJcP)Px%9Z5t%RA>e5n7>QIKorN{nOJHCp(q`ST5Sgry15C0MV$Nx3J%4;!PUXR)xSYp z+#H=m?Bt|dp|}()(xFrw1g&k-m{-V|mYU?!y!?RN(7U6T>*xEv@9xrLU@ABF51OeP z+U7xNn;CF3MkA_qEFfs-Vh3Ueri?)3Q%E)kAfH<{cO%h`yaTa-pz|ztAZQ0hb|E{M zM)S>Xh$r8R?1qs~At47uBIAh_4kn4b1F--HE|U(49Uu*_gUN+FL$$0rjV*% z?wr=saQK*kR#&q0f#0v-sCwfy@OvSIKdvppZ96pt&n6YP+-gHMsd6Ek`BlyxDhI~l zk+{{Bq4M;<6QL0>3El{~m55LXu!6S}!E*@*2C)X5z#Ag4#x>DV zgX^6Flznr60=`;eiqIPPb55+~CH#Ko3w{<-WrRlxasgh$pBLYuSePHeqX5zrqJWo1 zRxPoBv*$E_tHfxzEtobK`EhuhkJN#?&YW9j{+ty&xd2H&ZKf%9@Z9w9!eeCPCs{fzbTl$8RjgN_k)bL@Ok6#XU)B3Ckh7|w+002ovPDHLkV1h=!65;>= literal 0 HcmV?d00001 diff --git a/designer-base/src/main/resources/com/fr/design/images/error/error2.png b/designer-base/src/main/resources/com/fr/design/images/error/error2.png new file mode 100644 index 0000000000000000000000000000000000000000..ff0450a5a451ed4e3ab67b3da0b30722dd03dd1c GIT binary patch literal 1244 zcmV<21S9*2P)Px(mPtfGRA>e5S-oo%K@^|a`$)i?pvFcpCLtgi6dNloG^x@=u+T;n#3U9X{sUTQ zWf>797J_191R?27EMjHj2Z;zF7bB!Grbr@O?k+pN-`?$IXLfdX?)GwLAP??#cjnET z-|x+vkA2J7p6q!bmIrvO)}F?z-QB0`!qy;T{3I105%gnB&=10wsiS4Op`VzuQi;if z3k%$1XjDcPTN~zQV4O(#AsX{&iPL(!3Pg! zvtOfZMG^pbny4SiP+OF-I@fQ|1V0x=B6I>GY~cAOfQK*I&^IuIIVO+*CM;sUQDLJ4 ziM|~Sghf}6vOof~+R!q&!xJ_LmA9NQVCC}`dGEDz0P8%({SR6yTfNFnyQd|V=EHH_ zKA|0f@+S3vfQQ$}kq#z}2Ym!^JirdC(bX5FQYgzS7&_x?YZHxQ^3b8!DZBE9h5ZG3Wbw^?26D~!oue#O(g#bt9pk}Ge15eDm z#yEu&HZbVK6B(mKfP7RlfeQHYCIyfP8{rA3uzkXml!{RzKt^gJpaqZBW@wnL-5Qc7 zHW7?D5)ww4fW^O?dcxHU1Yh2yDihmq$9C-oU&WlaP9i`r(i7gwsQW1JZu@$YKvvJS zi>pMy$&fi2Gp|bUee2aL%srSvD{PYrA^{u5LfF(So57(29EowNgqKYOp$E@9;Ay2Y5dvyc_?%Hk zz()YaRysOgQbypqiQz`+P_pY)`_keKwLh(wk!Yoa>!zyQv}by$cQ9!HXbIr$pN3{s zqu-PwU;!pw=UM_#q%1Lw0-Mn_YG@f@K*l<#PwgCVm66ul%ojg3D?5iIZ%aCPHY`&e zI07JnhKU5ni}Z#|s)5%HWT?Zy14}3YC>+RUzaUEtZ{WERg1$^L)4&o*07^)4V<;Ok zCn)C8S5#UZxFALZpopPt&$RWEcOLJ^5{pkvWE*`%g$?ky5;}=pCH0Er@2>pFry;UC zKeMVt@a%j?Lt?Cyw+a5xP466*#U@Q-T-VoL*`5dL=z)Ly*dIPQob90i0000() { - @Override - public void on(Event event, Null param) { - process.destroy(); - } - }); - + DesignerLauncher.getInstance().start(args); } } diff --git a/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java b/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java new file mode 100644 index 0000000000..38f28346aa --- /dev/null +++ b/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java @@ -0,0 +1,55 @@ +package com.fr.start; + +import com.fr.process.FineProcess; +import com.fr.process.engine.FineJavaProcessFactory; +import com.fr.process.engine.core.FineProcessContext; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/2/21 + */ +public class DesignerLauncher { + + private static final DesignerLauncher INSTANCE = new DesignerLauncher(); + + private String[] args; + + private DesignerLauncher() { + + } + + public static DesignerLauncher getInstance() { + return INSTANCE; + } + + public void start(String[] args) { + this.args = args; + FineJavaProcessFactory.create(). + entry("com.fr.start.MainDesigner"). + javaRuntime(DesignerJavaRuntime.getInstance().getJavaExec()). + classPath(DesignerJavaRuntime.getInstance().getClassPath()). + inheritJvmSettings(). + jvmSettings(DesignerJavaRuntime.getInstance().getJvmOptions()). + arguments(args). + startProcess(DesignerProcessType.INSTANCE); + DesignerSuperListener.getInstance().start(); + } + + private void beforeExit() { + DesignerSuperListener.getInstance().stopTask(); + FineProcess process = FineProcessContext.getProcess(DesignerProcessType.INSTANCE); + process.destroy(); + } + + public void exit() { + beforeExit(); + DesignerSuperListener.getInstance().stop(); + System.exit(0); + } + + public void restart() { + beforeExit(); + start(args); + } +} diff --git a/designer-realize/src/main/java/com/fr/start/DesignerSubListener.java b/designer-realize/src/main/java/com/fr/start/DesignerSubListener.java new file mode 100644 index 0000000000..3e8663f89e --- /dev/null +++ b/designer-realize/src/main/java/com/fr/start/DesignerSubListener.java @@ -0,0 +1,38 @@ +package com.fr.start; + +import com.fr.design.mainframe.DesignerContext; +import com.fr.event.Event; +import com.fr.event.Listener; +import com.fr.event.Null; +import com.fr.process.engine.core.CarryMessageEvent; +import com.fr.process.engine.core.FineProcessContext; +import com.fr.process.engine.core.FineProcessEngineEvent; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/2/21 + */ +public class DesignerSubListener { + + public static DesignerSubListener INSTANCE = new DesignerSubListener(); + + public static DesignerSubListener getInstance() { + return INSTANCE; + } + + private DesignerSubListener() { + + } + + public void start() { + FineProcessContext.getParentPipe().listen(FineProcessEngineEvent.READY, new Listener() { + @Override + public void on(Event event, Null param) { + if (DesignerContext.getDesignerFrame() == null || !DesignerContext.getDesignerFrame().isShowing()) { + FineProcessContext.getParentPipe().fire(new CarryMessageEvent(DesignerProcessType.INSTANCE.obtain())); + } + } + }); + } +} diff --git a/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java b/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java new file mode 100644 index 0000000000..acbd92271a --- /dev/null +++ b/designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java @@ -0,0 +1,147 @@ +package com.fr.start; + +import com.fr.concurrent.NamedThreadFactory; +import com.fr.design.dialog.ErrorDialog; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector; +import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; +import com.fr.design.utils.DesignUtils; +import com.fr.event.Event; +import com.fr.event.Listener; +import com.fr.event.Null; +import com.fr.process.FineProcess; +import com.fr.process.ProcessEventPipe; +import com.fr.process.engine.core.FineProcessContext; +import com.fr.process.engine.core.FineProcessEngineEvent; +import com.fr.stable.StringUtils; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/2/21 + */ +public class DesignerSuperListener { + + private static final DesignerSuperListener INSTANCE = new DesignerSuperListener(); + private static final int ONCE_DELAY = 90; + private static final int FIXED_DELAY = 0; + private static final int FIXED_FREQ = 2; + + private final ScheduledExecutorService service = Executors.newScheduledThreadPool(2, new NamedThreadFactory("DesignerListener")); + + private FineProcess process; + private ScheduledFuture fixedFuture; + private ScheduledFuture onceFuture; + + private DesignerSuperListener() { + + } + + public static DesignerSuperListener getInstance() { + return INSTANCE; + } + + public void start() { + process = FineProcessContext.getProcess(DesignerProcessType.INSTANCE); + startExitListener(); + startFrameListener(); + startFallBackListener(); + } + + private void startExitListener() { + process.getPipe().listen(FineProcessEngineEvent.DESTROY, new Listener() { + @Override + public void on(Event event, Null param) { + DesignerLauncher.getInstance().exit(); + } + }); + } + + private void startFrameListener() { + onceFuture = service.schedule(new Runnable() { + @Override + public void run() { + ProcessEventPipe pipe = process.getPipe(); + pipe.fire(FineProcessEngineEvent.READY); + if (StringUtils.isNotEmpty(pipe.info())) { + frameReport(); + } + } + }, ONCE_DELAY, TimeUnit.SECONDS); + + } + + private void frameReport() { + DesignUtils.initLookAndFeel(); + StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.UNEXCEPTED_START_FAILED.getId(), + DesignerErrorMessage.UNEXCEPTED_START_FAILED.getMessage(), + StringUtils.EMPTY); + ErrorDialog dialog = new ErrorDialog(null, + Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"), + Toolkit.i18nText("Fine-Design_Error_Start_Report"), + Toolkit.i18nText(DesignerErrorMessage.UNEXCEPTED_START_FAILED.getMessage())) { + @Override + protected void okEvent() { + dispose(); + } + + @Override + protected void restartEvent() { + dispose(); + DesignerLauncher.getInstance().restart(); + } + }; + dialog.setVisible(true); + DesignerLauncher.getInstance().exit(); + } + + private void startFallBackListener() { + fixedFuture = service.scheduleAtFixedRate(new Runnable() { + @Override + public void run() { + if (!process.isAlive()) { + fallBackReport(); + } + } + }, FIXED_DELAY, FIXED_FREQ, TimeUnit.SECONDS); + } + + private void fallBackReport() { + DesignUtils.initLookAndFeel(); + StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.UNEXCEPTED_FALL_BACK.getId(), + DesignerErrorMessage.UNEXCEPTED_FALL_BACK.getMessage(), + StringUtils.EMPTY); + ErrorDialog dialog = new ErrorDialog(null, + Toolkit.i18nText("Fine-Design_Error_Fall_Back_Apology_Message"), + Toolkit.i18nText("Fine-Design_Error_Fall_Back_Report"), + Toolkit.i18nText(DesignerErrorMessage.UNEXCEPTED_FALL_BACK.getMessage())) { + @Override + protected void okEvent() { + dispose(); + } + + @Override + protected void restartEvent() { + dispose(); + DesignerLauncher.getInstance().restart(); + } + }; + dialog.setVisible(true); + DesignerLauncher.getInstance().exit(); + } + + public void stopTask() { + onceFuture.cancel(false); + fixedFuture.cancel(false); + } + + public void stop() { + stopTask(); + service.shutdown(); + } +} diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index ec32a64699..238b035125 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -47,8 +47,6 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.module.Module; import com.fr.module.ModuleContext; -import com.fr.process.engine.core.FineProcessContext; -import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.runtime.FineRuntime; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 0adb4a6e28..3dd7322f61 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -7,6 +7,7 @@ import com.fr.design.RestartHelper; import com.fr.design.dialog.TipDialog; import com.fr.design.fun.OemProcessor; import com.fr.design.fun.impl.GlobalListenerProviderManager; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector; import com.fr.design.mainframe.messagecollect.StartupMessageCollector; import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; @@ -15,6 +16,7 @@ import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignerPort; import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.module.Activator; import com.fr.record.analyzer.EnableMetrics; @@ -69,7 +71,11 @@ public class DesignerStartup extends Activator { DesignUtils.clientSend(args); FineLoggerFactory.getLogger().info("The Designer Has Been Started"); if (args.length == 0) { - TipDialog dialog = new TipDialog(null, DesignerProcessType.INSTANCE.obtain()) { + TipDialog dialog = new TipDialog(null, + DesignerProcessType.INSTANCE.obtain(), + Toolkit.i18nText("Fine-Design_Last_Designer_Process_Not_Exist"), + Toolkit.i18nText("Fine-Design_End_Occupied_Process"), + Toolkit.i18nText("Fine-Design_Basic_Cancel")) { @Override protected void endEvent() { dispose(); From 8d6934d504d37e96813f3b3c0a549dd1738e310f Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 26 Feb 2020 15:31:02 +0800 Subject: [PATCH 05/18] =?UTF-8?q?CHART-12805=20=E7=B3=BB=E5=88=97=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=A0=B9=E6=8D=AE=E5=A4=A7=E6=95=B0=E6=8D=AE=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E5=A4=A7=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/series/VanChartAbstractPlotSeriesPane.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java index 3d8fef03f0..47b205f85f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java @@ -221,7 +221,10 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP protected boolean largeModel(Plot plot) { - return PlotFactory.largeDataModel(plot); + //大数据模式 恢复用注释。下面1行删除。 + return largeDataModelGroup != null && largeDataModelGroup.getSelectedIndex() == 0; + //大数据模式 恢复用注释。取消注释。 + //return PlotFactory.largeDataModel(plot); } From a8bc37b0355d895263374b3c98dc895dae4d594b Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 26 Feb 2020 15:47:27 +0800 Subject: [PATCH 06/18] =?UTF-8?q?CHART-12801=20=E5=A4=9A=E5=B1=82=E9=A5=BC?= =?UTF-8?q?=E5=9B=BE=E6=95=B0=E6=8D=AE=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MultiPieIndependentVanChartInterface.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java index 2a0d4ed5a7..1cc66a2bf5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java @@ -4,8 +4,13 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.van.chart.multilayer.data.MultiPiePlotReportDataContentPane; +import com.fr.van.chart.multilayer.data.MultiPiePlotTableDataContentPane; import com.fr.van.chart.multilayer.other.VanChartMultiPieConditionPane; import com.fr.van.chart.multilayer.style.VanChartMultiPieSeriesPane; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; @@ -47,6 +52,17 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan // }; // } + //图表数据结构 恢复用注释。删除下面两个方法 getTableDataSourcePane getReportDataSourcePane。 + @Override + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new MultiPiePlotTableDataContentPane(parent); + } + + @Override + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new MultiPiePlotReportDataContentPane(parent); + } + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ return new VanChartMultiPieSeriesPane(parent, plot); } From 0f42ae623f97146a0376b59f88eee8795c2df7aa Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 26 Feb 2020 17:25:21 +0800 Subject: [PATCH 07/18] fix --- .../src/main/java/com/fr/start/DesignerLauncher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java b/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java index 38f28346aa..fa1cd969f1 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerLauncher.java @@ -26,7 +26,7 @@ public class DesignerLauncher { public void start(String[] args) { this.args = args; FineJavaProcessFactory.create(). - entry("com.fr.start.MainDesigner"). + entry(MainDesigner.class). javaRuntime(DesignerJavaRuntime.getInstance().getJavaExec()). classPath(DesignerJavaRuntime.getInstance().getClassPath()). inheritJvmSettings(). From 280a6dc426f5d7b970b72b3e014e0e334ceb6bb4 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 26 Feb 2020 18:16:46 +0800 Subject: [PATCH 08/18] =?UTF-8?q?fix=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/exit/DesignerExiter.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java index c7319f4c63..06260894e5 100644 --- a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java +++ b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java @@ -14,14 +14,12 @@ public class DesignerExiter { public static final DesignerExiter INSTANCE = new DesignerExiter(); - private static final String DOT = "."; - public static DesignerExiter getInstance() { return INSTANCE; } public void execute() { - if (FineProcessContext.getParentPipe() != null || !DOT.equals(StableUtils.getInstallHome())) { + if (FineProcessContext.getParentPipe() != null) { FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); } System.exit(0); From 18058f3964b0cb067f64db71f4f1af918b955acf Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 27 Feb 2020 09:44:43 +0800 Subject: [PATCH 09/18] =?UTF-8?q?MOBILE-25615=20=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=88=B0release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/FormMobileAttrAction.java | 14 ++++++++++---- .../mobile/FormMobileTemplateSettingsPane.java | 4 +--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java index c6f64c498c..b387cbc703 100644 --- a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java @@ -56,6 +56,9 @@ public class FormMobileAttrAction extends JTemplateAction { final FormMobileAttrPane mobileAttrPane = new FormMobileAttrPane(); mobileAttrPane.populateBean(mobileAttr); + + final boolean oldMobileOnly = mobileAttr.isMobileOnly(); + final boolean oldAdaptive = mobileAttr.isAdaptivePropertyAutoMatch(); BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { @@ -75,13 +78,16 @@ public class FormMobileAttrAction extends JTemplateAction { recordFunction(); // 设置移动端属性并刷新界面 formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 - ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); + boolean changeSize = (!oldMobileOnly && formMobileAttr.isMobileOnly()) || (oldMobileOnly && !formMobileAttr.isMobileOnly()); + if (changeSize) { + ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); + } jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); - //当自适应属性自动匹配处于勾选状态 进行切换 - if (formMobileAttr.isMobileOnly() && formMobileAttr.isAdaptivePropertyAutoMatch()) { + //改变布局为自适应布局,只在移动端属性设置保存后改变一次 + boolean changeLayout = !oldAdaptive && formMobileAttr.isAdaptivePropertyAutoMatch(); + if (changeLayout) { doChangeBodyLayout(); } - WidgetPropertyPane.getInstance().refreshDockingView(); jf.fireTargetModified(); } diff --git a/designer-form/src/main/java/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java b/designer-form/src/main/java/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java index 21f6d3b09f..2eac9c5863 100644 --- a/designer-form/src/main/java/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java +++ b/designer-form/src/main/java/com/fr/design/form/mobile/FormMobileTemplateSettingsPane.java @@ -47,9 +47,7 @@ public class FormMobileTemplateSettingsPane extends BasicBeanPane Date: Thu, 27 Feb 2020 21:01:15 +0800 Subject: [PATCH 10/18] =?UTF-8?q?CHART-12794=20=E5=9B=BE=E8=A1=A8=E5=88=87?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/chart/gui/ChartTypePane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java index 3740e3e121..6c7edc2d2f 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -294,13 +294,14 @@ public class ChartTypePane extends AbstractChartAttrPane{ * @param collection */ public void reLayoutEditPane(String lastPlotID, ChartCollection collection){ + if (editPane == null) { + return; + } ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class); String plotID = chart.getID(); boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); - if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){ + if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))) { editPane.reLayout(chart); - }else { - throw new IllegalArgumentException("editPane can not be null."); } } From cf639760ed30490bace6aaa724be10a5bf7c4087 Mon Sep 17 00:00:00 2001 From: Maksim Date: Fri, 28 Feb 2020 16:41:48 +0800 Subject: [PATCH 11/18] =?UTF-8?q?=E6=8A=BD=E5=8F=96=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=B9=B6=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 78 ++++++++++++------- 1 file changed, 48 insertions(+), 30 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index a60791c6b6..124ace0b01 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -132,36 +132,7 @@ public class EnvChangeEntrance { if (template != null) { template.refreshToolArea(); } - - //是否需要做服务校验 - if(needCheckBranch(selectedEnv)) { - String localBranch; - String remoteBranch; - localBranch = GeneralUtils.readFullBuildNO(); - try { - remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); - } catch (WorkspaceConnectionException e) { - remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(localBranch); - } - //通过是否包含#来避免当前版本为非安装版本(主要是内部开发版本) - if (localBranch.contains("#") && localBranch.equals(remoteBranch)) { - //说明版本一致,仅做日志记录 - FineLoggerFactory.getLogger().info("Remote Designer version consistency"); - } else { - localBranch = formatBranch(localBranch); - remoteBranch = formatBranch(remoteBranch); - Set noExistServiceSet = getNoExistServiceSet(connectionInfo); - StringBuilder textBuilder = new StringBuilder(); - for (Class clazz : noExistServiceSet) { - WorkspaceAPI workspaceAPI = (WorkspaceAPI) clazz.getAnnotation(WorkspaceAPI.class); - String descriptionOfCN = InterProviderFactory.getProvider().getLocText(workspaceAPI.description()); - textBuilder.append(descriptionOfCN).append("\n"); - } - String areaText = textBuilder.toString(); - CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch); - dialog.setVisible(true); - } - } + showServiceDialog(selectedEnv); } catch (WorkspaceAuthException | RegistEditionException e) { // String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); // String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote"); @@ -238,6 +209,43 @@ public class EnvChangeEntrance { return true; } + /** + * 对选择的环境做服务检测 + * @param selectedEnv 选择的工作环境 + */ + public void showServiceDialog(DesignerWorkspaceInfo selectedEnv) throws Exception { + //是否需要做服务校验 + if(needCheckBranch(selectedEnv)) { + String localBranch; + String remoteBranch; + WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection(); + localBranch = GeneralUtils.readFullBuildNO(); + try { + remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); + } catch (WorkspaceConnectionException e) { + remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(localBranch); + } + //通过是否包含#来避免当前版本为非安装版本(主要是内部开发版本) + if (localBranch.contains("#") && localBranch.equals(remoteBranch)) { + //说明版本一致,仅做日志记录 + FineLoggerFactory.getLogger().info("Remote Designer version consistency"); + } else { + localBranch = formatBranch(localBranch); + remoteBranch = formatBranch(remoteBranch); + Set noExistServiceSet = getNoExistServiceSet(connectionInfo); + StringBuilder textBuilder = new StringBuilder(); + for (Class clazz : noExistServiceSet) { + WorkspaceAPI workspaceAPI = (WorkspaceAPI) clazz.getAnnotation(WorkspaceAPI.class); + String descriptionOfCN = InterProviderFactory.getProvider().getLocText(workspaceAPI.description()); + textBuilder.append(descriptionOfCN).append("\n"); + } + String areaText = textBuilder.toString(); + CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch); + dialog.setVisible(true); + } + } + } + /** * 判断是否需要做版本验证,判断依据为 * 1、选择的环境为远程环境 @@ -249,6 +257,11 @@ public class EnvChangeEntrance { return selectedEnv.getType() == DesignerWorkspaceType.Remote; } + /** + * 获取不存在的服务列表 + * @param info 环境连接信息 + * @return 以Set形式返回不存在的服务 + */ public Set getNoExistServiceSet(WorkspaceConnectionInfo info){ Set noExistServiceSet = new HashSet(); Set remoteServiceSet = new HashSet(); @@ -295,6 +308,11 @@ public class EnvChangeEntrance { } } + /** + * 格式化分支版本号 + * @param branch 初始的分支版本号 + * @return 格式化后的版本号 + */ private String formatBranch(String branch){ if(branch.contains("#")){ return branch.substring(branch.lastIndexOf("#") + 1, branch.length() - 13); From a11aa4822d5f4ca5e753ce021e52455721ae6c35 Mon Sep 17 00:00:00 2001 From: Maksim Date: Fri, 28 Feb 2020 16:43:45 +0800 Subject: [PATCH 12/18] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=EF=BC=8C=E5=81=9A=E4=B8=80=E6=AC=A1=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../start/module/DesignerWorkspaceProvider.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index 7d63571ad6..e0fc4dfe97 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -6,6 +6,10 @@ import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.LocalDesignerWorkspaceInfo; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; +import com.fr.event.Null; import com.fr.log.FineLoggerFactory; import com.fr.module.Activator; import com.fr.stable.StringUtils; @@ -54,6 +58,18 @@ public class DesignerWorkspaceProvider extends Activator { EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(); } else { WorkContext.switchTo(workspace); + //在设计器完全启动完成后,对初始环境进行一次服务检测,对主要功能无影响,异常仅做日志提示即可 + final DesignerWorkspaceInfo selectEnv = workspaceInfo; + EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { + @Override + public void on(Event event, Null aNull) { + try { + EnvChangeEntrance.getInstance().showServiceDialog(selectEnv); + } catch (Exception e) { + FineLoggerFactory.getLogger().warn("Check Service Failed"); + } + } + }); } } catch (Throwable e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); From 8b7302459583ab5acd89ff2b0d346e4d65b268dd Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 2 Mar 2020 14:35:31 +0800 Subject: [PATCH 13/18] =?UTF-8?q?CHART-12810=20//=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84tab=E9=9D=9E=E9=80=89=E4=B8=AD=E7=8A=B6=E6=80=81,=20?= =?UTF-8?q?=E5=8E=9F=E4=B8=BA=E9=80=89=E4=B8=AD=E7=8A=B6=E6=80=81=E7=9A=84?= =?UTF-8?q?tab=E4=BF=9D=E6=8C=81=E9=80=89=E4=B8=AD=E4=B8=8D=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/chart/gui/ChartTypeButtonPane.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 1fbb87c423..4d7673b3e7 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -503,6 +503,13 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen if (this.isSelected()) { indexList.get(0).setSelected(true); changeCollectionSelected(indexList.get(0).getButtonName()); + } else {//删除的tab非选中状态, 原为选中状态的tab保持选中不变 + for (ChartChangeButton button : indexList) { + if (button.isSelected()) { + changeCollectionSelected(button.getButtonName()); + break; + } + } } } From 1838a00cd0012b9c391c35e16b16c6b8bdc53cc3 Mon Sep 17 00:00:00 2001 From: Maksim Date: Mon, 2 Mar 2020 21:21:32 +0800 Subject: [PATCH 14/18] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=AC=E6=9C=88=E4=B8=8D=E5=86=8D=E6=8F=90?= =?UTF-8?q?=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 27 ++++++++- .../fr/design/env/DesignerWorkspaceInfo.java | 3 + .../env/LocalDesignerWorkspaceInfo.java | 5 ++ .../env/RemoteDesignerWorkspaceInfo.java | 13 +++++ .../write/submit/CheckServiceDialog.java | 54 ++++++++++++++---- .../fr/design/images/warnings/warning5.png | Bin 0 -> 3095 bytes 6 files changed, 88 insertions(+), 14 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/warnings/warning5.png diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 124ace0b01..9a368f3429 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -43,7 +43,11 @@ import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; import java.lang.reflect.Method; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Set; @@ -240,7 +244,7 @@ public class EnvChangeEntrance { textBuilder.append(descriptionOfCN).append("\n"); } String areaText = textBuilder.toString(); - CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch); + CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), selectedEnv, areaText, localBranch, remoteBranch); dialog.setVisible(true); } } @@ -249,12 +253,29 @@ public class EnvChangeEntrance { /** * 判断是否需要做版本验证,判断依据为 * 1、选择的环境为远程环境 - * 2、一个月内不弹出是否勾选(这里预留,还未实际增加) + * 2、一个月内不弹出是否勾选 * @param selectedEnv 选择的环境 * @return */ private boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv){ - return selectedEnv.getType() == DesignerWorkspaceType.Remote; + if(selectedEnv.getType() == DesignerWorkspaceType.Remote){ + try { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + //获取记录的时间 + Date remindTime = format.parse(selectedEnv.getRemindTime()); + calendar.setTime(remindTime); + //获取一个月后的时间 + calendar.add(Calendar.MONTH,1); + //与当前时间作对比,然后判断是否提示 + if(new Date().after(calendar.getTime())){ + return true; + } + } catch (ParseException e) { + return true; + } + } + return false; } /** diff --git a/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java index 2e5cc9f8c0..ccc98bfe37 100644 --- a/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java @@ -10,6 +10,9 @@ public interface DesignerWorkspaceInfo extends XMLable { String getPath(); + //获取提醒时间,用于判断是否做服务检测 + String getRemindTime(); + WorkspaceConnectionInfo getConnection(); boolean checkValid(); diff --git a/designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java index 19b0857818..ef1f420d62 100644 --- a/designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java @@ -43,6 +43,11 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo { return path; } + @Override + public String getRemindTime() { + return null; + } + @Override public WorkspaceConnectionInfo getConnection() { return null; diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java index 9d2af66cf1..af0b8a01c0 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java @@ -13,6 +13,8 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { private String name; + private String remindTime; + private WorkspaceConnectionInfo connection; public static RemoteDesignerWorkspaceInfo create(WorkspaceConnectionInfo connection) { @@ -45,11 +47,21 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { return connection; } + public void setRemindTime(String remindTime){ + this.remindTime = remindTime; + } + + @Override + public String getRemindTime(){ + return remindTime; + } + @Override public void readXML(XMLableReader reader) { if (reader.isAttr()) { this.name = reader.getAttrAsString("name", StringUtils.EMPTY); + this.remindTime = reader.getAttrAsString("remindTime", StringUtils.EMPTY); } if (reader.isChildNode()) { String tagName = reader.getTagName(); @@ -69,6 +81,7 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { public void writeXML(XMLPrintWriter writer) { writer.attr("name", name); + writer.attr("remindTime", remindTime); if (this.connection != null) { writer.startTAG("Connection"); writer.attr("url", connection.getUrl()); diff --git a/designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java b/designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java index 3797c0f8a2..c88fa1fd99 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java @@ -1,10 +1,14 @@ package com.fr.design.write.submit; +import com.fr.design.env.DesignerWorkspaceInfo; +import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; +import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import javax.swing.BorderFactory; @@ -18,6 +22,9 @@ import java.awt.Dimension; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; /** * @author: Maksim @@ -28,30 +35,33 @@ public class CheckServiceDialog extends JDialog implements ActionListener { private JPanel topPanel; private JPanel centerPanel; private JPanel bottomPanel; + private UICheckBox remindBox; + private DesignerWorkspaceInfo selectEnv; - public CheckServiceDialog(Frame parent, String areaText, String localBranch, String remoteBranch){ + public CheckServiceDialog(Frame parent, DesignerWorkspaceInfo selectEnv, String areaText, String localBranch, String remoteBranch){ super(parent,true); + this.selectEnv = selectEnv; //上面的标签面板 topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel imagePanel = new JPanel(); - Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/warning4.png"); + Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/warning5.png"); JLabel imageLabel = new JLabel(); imageLabel.setIcon(icon); imagePanel.add(imageLabel); - imagePanel.setPreferredSize(new Dimension(100,80)); + imagePanel.setPreferredSize(new Dimension(110,80)); JPanel verticalPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); FRFont font = FRFont.getInstance(); 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(500,30)); - JLabel label2 = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") - + localBranch + "/" + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch); - label2.setPreferredSize(new Dimension(500,20)); + label.setPreferredSize(new Dimension(600,30)); + JLabel label2 = new JLabel(""+Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") + + localBranch + "/" + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch+""); + label2.setPreferredSize(new Dimension(600,30)); JLabel label3 = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Need_Update")); - label3.setPreferredSize(new Dimension(500,20)); + label3.setPreferredSize(new Dimension(500,30)); verticalPanel.add(label); verticalPanel.add(label2); @@ -73,9 +83,13 @@ public class CheckServiceDialog extends JDialog implements ActionListener { centerPanel.add(checkArea,BorderLayout.CENTER); //下面的按钮面板 + remindBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remind_Show")); + remindBox.addActionListener(remindCheckboxListener); UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm")); - JPanel buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); - buttonPanel.add(okButton); + JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + buttonPanel.setBorder(BorderFactory.createEmptyBorder(0,10,10,10)); + buttonPanel.add(remindBox, BorderLayout.WEST); + buttonPanel.add(okButton,BorderLayout.EAST); okButton.addActionListener(this ); bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); bottomPanel.add(buttonPanel); @@ -86,7 +100,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(600, 500)); + this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US)? 700:600, 500)); GUICoreUtils.centerWindow(this); } @@ -94,4 +108,22 @@ public class CheckServiceDialog extends JDialog implements ActionListener { public void actionPerformed(ActionEvent e) { this.dispose(); } + + + private ActionListener remindCheckboxListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + boolean needRemind = remindBox.isSelected(); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + String remindTime = format.format(new Date()); + if(needRemind){ + //前面做过验证,一定是远程环境,直接强转 + ((RemoteDesignerWorkspaceInfo)selectEnv).setRemindTime(remindTime); + }else { + ((RemoteDesignerWorkspaceInfo)selectEnv).setRemindTime(""); + } + } + }; + } diff --git a/designer-base/src/main/resources/com/fr/design/images/warnings/warning5.png b/designer-base/src/main/resources/com/fr/design/images/warnings/warning5.png new file mode 100644 index 0000000000000000000000000000000000000000..059206e0cc3393c10dd4a29ff1933df00be28ad2 GIT binary patch literal 3095 zcmV+y4CwQTP)e=Q(U3A#84tcQK&>g4naXE zh;j)E1p*2diV~EgxIz_Cj-8$*93hCf)4dVc>E49wZogJt^x*W*?dN&l z=Y603X1+eYZwRd;Q5~Q}scDHp%aDZq6SNFz8IrILBuq|ggtQDvSO*d&r|Cz?K%aKF z1fETV4Un)#&XoR~upax8)3k5(C%em z{^UL6<%(K5C?S0omeF*ERLa^?A}kTC@KiqX!jHFjUWvo;C@-vJthG`B1g|@3PUP}HlKid!<5g!F=h%Hc9k5-o#t*EvL?Uuwax}-?)2?@SNSEzflrJfwwb??na_%&NUxa8v@D%1 zp6!LJ$N5AUQZc*sCzhV5N5QpnFgf$mncgQGslm;i2t#aBdw>~7G_o1YcrcySk8Grd zL>Mw?=8toj?{0J>-26;*d^%ISr;%D3IzpB%g>?Q|n)^lmg+?}EEH~kKxkE1yfg7c# zp@vvx?K}{E7OHqckr_HM-UiX`0PhYU8#pG>c}k{uO<;aVV#5p>?B8`e$7y>GzzzXx zFo~Q~K{2&D|P?Crj z$eGeVYVmDDyNrQg&pjAdD_Q-5Alkxm8e)iTcJIw_o&%#TNCD*F2)R@LqZhYQ)*d9n z;a<2Z=ZA@;f}H7jApkcNr6Gn`rgkS7-wdXlu2t0HcSN|Bq0M3N69n2?1iu-EahH-L>i(aj?(Uo%-{lbz6q^I{?Rs;>Y8N=rB1`d?*MvD5vg* zScdi(fG-CXoSNdyo;IWREm6MRpTCqH{-G#-!YFx6$?69L;szwu)sRYAJA(+n45)RK zCJ#@OY1Ya?(HIpYcPxPdU+fX#3^}9UB$_WQu5O0B_uiasrVMRxr@38WL=V|p&6qL! z#rH*H3>x{P9dPhB773*xYpc0_a*ArJhO3()wy7;;7GBp;vnB%elzqH062&tXX8b6f z)t828v?#YOhE)2ybHt<5T>rD336(I@(dlgQ_o4+_W$i8yP7uXc!!h^+45td|Sv{pN zaYVRvF~l~tUoqo!5ka09!Ual3zuFVG31Au8N&tI`;%niUaZ@_0pAj~W7e97GtUm1k zNcfwV5Yh8Qv`o&3KTNU>&1RroH2!2bmgs?2;psz<(0pk%RtA9-- z-n##4JB|!vjR;l{^N^zIhY4Z>!D2PUDr*Zs_-!C%wMnZKRsWnwOskwf2*iIC!3tvt z3zUq0moVNZFg8P&_nKmx>)dJXgmvUT6>bS1R#bh8NEFM+oeR*lB3NMz@e93c+UM@Q z_sSt*jt^jLhFE6q0x-Ro2#ku%j0)(0S%-lx)e}+9T2QA9n7>Ooh?rKh9mR* zlx-H>&-ut}{OI38l2B;x5Wn**(vZl-R*d{T1U^#$R-Yv8Df`nXEV_au{Xf|QXmYs zcWh9IUjMLGKFiEs3FgK1(8J8%N@q(qMv*HLLk0%AW=iWN_lta&C`5_GXany$RV}?% z(-0$nH^9e<#0raH;5FXh6sB+AyEbgBNDQ(2^Ovy07ljq$i|^noN~iw!S{&QZo?>7> zUok^~8FXn{EnXZV#3(hiAy!}4ZlKY19dcMPKKZ98s($+B*4&Q!k^;rHfjV-IaGfne`_1=mHlDr)hx;QWvyq+V0Y z>IK#=-Zpc4GL!pYs{Tic4^(EB9u1l})CjQ*&0XhxaM0x8c(hzmi&ZzdwEJ^MutN`o ziyw?lz{9et9~z7uVuV;m{v?2Feuf7XB+6r8Rl3G=k&2<6<8JLI8Y_Anovf(EJA%Xw zG(wnnnrfTv?lgB!kff1t7#})A&UV$NnpQlU*7%YAqG=BnX3u_Wy&qEGS=NA|T_^#U z`ArrBeh)>}Uz`{>+`Ge(sk~58^(*{F^F2b|FYmT<8%Eq|uIe{g^mwkZP?X%d_K!ZF zuZZQ8Gg6q=`RZyvEZ>Gy4DC7szU?Q;|1tJDMb*#sQ@<}m2Fm$;CE}*oZq-i{;>1cR zY2WslJz3keF>&33x*SPM$Vl$7*-cr)}nM26)mZiXzR43d6uNX;l}x z(J5p|#n2W}L|e5+ROCyFs!w_iH2Om?5+Zw&7gjd|i_)s@d9mtgh*j>+!d;+Am>pJB zRD7b5?c~g>?|Q|v4DI^>F89LK<2(az!f7j{J6|>?%ja!~p}7UQg(c(g@se7xsBQI` z3|0WxBN^gxxuWVn2yBSEiWPu+i)3m-3UXysy*jU@&o;DMgKi=abC%WmUgzV*OhfVi=mzzH!g>?f}h-pVHj3tnvMMMRwW> z)cLYK!Klr9XdAhU7<5VeoeiF$8LvaCe_!xLvRe8{O+z-lpzKa_X9jOqU6@UGrCy^e z{cWJaRJHi}N9Q;D$g++64Gd1icBx*rHq*VV$!a0+4YFDq`zgRNLpJU3_KsI05_i4{ z?)FaFGsapat9NWMLTpo8!i>6XACWjy8!Tx261}kz;`29V8(hLCEB*LiX&5ua>d!5P zLsx#XN^O#Ah!-oFjjMXcjgYRRh$P`nU7DoSrjY3{A2mH&8hz99<1h8KyKnD|412Eq zZi)(1Fz!aK}Z%?|ENcUIq6)7QhE;8I#l(GIi>5$#l+a4kdX)M(K(Eki^*RVQ4_ lkUBM5G)>D8(N5I~_dk=2+mgy|Mo<6%002ovPDHLkV1f_i&Wiv5 literal 0 HcmV?d00001 From ae73305f84e4dde3b2cc85c565fccb831fb2d4b4 Mon Sep 17 00:00:00 2001 From: Maksim Date: Mon, 2 Mar 2020 21:25:04 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/socketio/DesignerSocketIO.java | 167 +++++++----------- 1 file changed, 63 insertions(+), 104 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index 63bc3d999b..e2b13b1adf 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -13,6 +13,7 @@ import com.fr.report.RemoteDesignConstants; import com.fr.serialization.SerializerHelper; import com.fr.stable.ArrayUtils; import com.fr.third.apache.log4j.spi.LoggingEvent; +import com.fr.third.guava.base.Optional; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; @@ -35,19 +36,28 @@ public class DesignerSocketIO { Disconnecting } - private static Socket socket = null; + private static Optional socketIO = Optional.absent(); private static Status status = Status.Disconnected; - //维护一个当前工作环境的uri列表 - private static String[] uri; - //维护一个关于uri列表的计数器 - private static int count; + private static final Emitter.Listener printLog = new Emitter.Listener() { + @Override + public void call(Object... objects) { + if (ArrayUtils.isNotEmpty(objects)) { + try { + LoggingEvent event = SerializerHelper.deserialize((byte[]) objects[0]); + DesignerLogger.log(event); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + }; public static void close() { - if (socket != null) { + if (socketIO.isPresent()) { status = Status.Disconnecting; - socket.close(); - socket = null; + socketIO.get().close(); + socketIO = Optional.absent(); } } @@ -56,42 +66,57 @@ public class DesignerSocketIO { if (current.isLocal()) { return; } - //每当更换工作环境,更新uri列表,同时更新计数器count - try { - uri = getSocketUri(); - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - count = 0; - //建立socket并注册监听 - createSocket(); - } - - private static void createSocket(){ - //根据uri和计数器建立连接,并注册监听 try { - if(count Date: Mon, 2 Mar 2020 21:27:45 +0800 Subject: [PATCH 16/18] =?UTF-8?q?=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/socketio/DesignerSocketIO.java | 167 +++++++++++------- 1 file changed, 104 insertions(+), 63 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index e2b13b1adf..63bc3d999b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -13,7 +13,6 @@ import com.fr.report.RemoteDesignConstants; import com.fr.serialization.SerializerHelper; import com.fr.stable.ArrayUtils; import com.fr.third.apache.log4j.spi.LoggingEvent; -import com.fr.third.guava.base.Optional; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; @@ -36,28 +35,19 @@ public class DesignerSocketIO { Disconnecting } - private static Optional socketIO = Optional.absent(); + private static Socket socket = null; private static Status status = Status.Disconnected; + //维护一个当前工作环境的uri列表 + private static String[] uri; + //维护一个关于uri列表的计数器 + private static int count; - private static final Emitter.Listener printLog = new Emitter.Listener() { - @Override - public void call(Object... objects) { - if (ArrayUtils.isNotEmpty(objects)) { - try { - LoggingEvent event = SerializerHelper.deserialize((byte[]) objects[0]); - DesignerLogger.log(event); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - } - }; public static void close() { - if (socketIO.isPresent()) { + if (socket != null) { status = Status.Disconnecting; - socketIO.get().close(); - socketIO = Optional.absent(); + socket.close(); + socket = null; } } @@ -66,57 +56,42 @@ public class DesignerSocketIO { if (current.isLocal()) { return; } + //每当更换工作环境,更新uri列表,同时更新计数器count try { - String[] uri = getSocketUri(current); - socketIO = Optional.of(IO.socket(new URI(uri[0]))); - socketIO.get().on(WorkspaceConstants.WS_LOGRECORD, printLog); - socketIO.get().on(WorkspaceConstants.CONFIG_MODIFY, new Emitter.Listener() { - @Override - public void call(Object... objects) { - assert objects != null && objects.length == 1; - String param = (String) objects[0]; - EventDispatcher.fire(RemoteConfigEvent.EDIT, param); - } - }); - socketIO.get().on(Socket.EVENT_DISCONNECT, new Emitter.Listener() { - @Override - public void call(Object... objects) { - /* - * todo 远程心跳断开不一定 socketio 断开 和远程紧密相关的业务都绑定在心跳上,切换成心跳断开之后进行提醒, - * socketio 只用推日志和通知配置变更 - */ - if (status != Status.Disconnecting) { - try { - UIUtil.invokeAndWaitIfNeeded(new Runnable() { - @Override - public void run() { - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Basic_Remote_Disconnected"), - UIManager.getString("OptionPane.messageDialogTitle"), - JOptionPane.ERROR_MESSAGE, - UIManager.getIcon("OptionPane.errorIcon")); - EnvChangeEntrance.getInstance().chooseEnv(); - } - }); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - status = Status.Disconnected; - } - }); - socketIO.get().connect(); - status = Status.Connected; + uri = getSocketUri(); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + count = 0; + //建立socket并注册监听 + createSocket(); + } + + private static void createSocket(){ + //根据uri和计数器建立连接,并注册监听 + try { + if(count Date: Tue, 3 Mar 2020 10:43:52 +0800 Subject: [PATCH 17/18] =?UTF-8?q?=E9=80=9A=E8=BF=87=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=9D=A5=E5=A4=84=E7=90=86=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E4=BA=8E=E4=BC=A0=E5=85=A5=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 2 +- .../design/write/submit/CheckServiceDialog.java | 17 ++++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 9a368f3429..eca98c8bea 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -244,7 +244,7 @@ public class EnvChangeEntrance { textBuilder.append(descriptionOfCN).append("\n"); } String areaText = textBuilder.toString(); - CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), selectedEnv, areaText, localBranch, remoteBranch); + CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch); dialog.setVisible(true); } } diff --git a/designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java b/designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java index c88fa1fd99..a5f5d752b2 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java @@ -1,6 +1,6 @@ package com.fr.design.write.submit; -import com.fr.design.env.DesignerWorkspaceInfo; +import com.fr.design.DesignerEnvManager; import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -36,11 +36,9 @@ public class CheckServiceDialog extends JDialog implements ActionListener { private JPanel centerPanel; private JPanel bottomPanel; private UICheckBox remindBox; - private DesignerWorkspaceInfo selectEnv; - public CheckServiceDialog(Frame parent, DesignerWorkspaceInfo selectEnv, String areaText, String localBranch, String remoteBranch){ + public CheckServiceDialog(Frame parent, String areaText, String localBranch, String remoteBranch){ super(parent,true); - this.selectEnv = selectEnv; //上面的标签面板 topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel imagePanel = new JPanel(); @@ -114,15 +112,12 @@ public class CheckServiceDialog extends JDialog implements ActionListener { @Override public void actionPerformed(ActionEvent e) { - boolean needRemind = remindBox.isSelected(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String remindTime = format.format(new Date()); - if(needRemind){ - //前面做过验证,一定是远程环境,直接强转 - ((RemoteDesignerWorkspaceInfo)selectEnv).setRemindTime(remindTime); - }else { - ((RemoteDesignerWorkspaceInfo)selectEnv).setRemindTime(""); - } + //环境已切换,通过当前环境获取,一定是远程环境 + String currentEnvName = DesignerEnvManager.getEnvManager().getCurEnvName(); + RemoteDesignerWorkspaceInfo currentEnv = (RemoteDesignerWorkspaceInfo)DesignerEnvManager.getEnvManager().getWorkspaceInfo(currentEnvName); + currentEnv.setRemindTime(remindBox.isSelected()? remindTime : ""); } }; From ff7e4b8cc2dcda07f27d2a8c20390d81872bb3b2 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 3 Mar 2020 15:53:06 +0800 Subject: [PATCH 18/18] =?UTF-8?q?MOBILE-25437=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=BF=AB=E9=80=9F=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E5=8A=9F=E8=83=BD=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/MobileBookMarkStyleDefinePane.java | 6 +- .../mobile/ui/MobileBookMarkStylePane.java | 16 +- ...arMobileBookMarkStyleCustomDefinePane.java | 387 ++++++++++++++++++ .../SidebarMobileBookMarkStyleProvider.java | 30 ++ 4 files changed, 436 insertions(+), 3 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleProvider.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java index 0a480d99a0..7812e8f32a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java @@ -30,11 +30,15 @@ public class MobileBookMarkStyleDefinePane extends BasicBeanPane { + public static final int LEFT_PANEL_WIDTH = 140; + public static final int LEFT_PANEL_HEIGHT = 565; + public static final int RIGHT_PANEL_WIDTH = 510; + public static final int RIGHT_PANEL_HEIGHT = 565; + public static ListCellRenderer renderer = new DefaultListCellRenderer() { @Override @@ -48,6 +55,7 @@ public class MobileBookMarkStylePane extends BasicBeanPane private void initComponent() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.listModel = new DefaultListModel<>(); this.card = new CardLayout(); this.rightPane = FRGUIPaneFactory.createCardLayout_S_Pane(); @@ -79,14 +87,16 @@ public class MobileBookMarkStylePane extends BasicBeanPane } }); JPanel leftPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + leftPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); leftPanel.add(bookMarkList, BorderLayout.CENTER); - leftPanel.setPreferredSize(new Dimension(100, 500)); + leftPanel.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, LEFT_PANEL_HEIGHT)); this.add(leftPanel, BorderLayout.WEST); } private void initRightPanel() { JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - centerPane.setPreferredSize(new Dimension(500, 500)); + centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + centerPane.setPreferredSize(new Dimension(RIGHT_PANEL_WIDTH, RIGHT_PANEL_HEIGHT)); centerPane.add(rightPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER); } @@ -94,10 +104,12 @@ public class MobileBookMarkStylePane extends BasicBeanPane private List getMobileBookMarkStyleProvider() { DefaultMobileBookMarkStyleProvider defaultMobileBookMarkStyleProvider = new DefaultMobileBookMarkStyleProvider(); + SidebarMobileBookMarkStyleProvider sidebarMobileBookMarkStyleProvider = new SidebarMobileBookMarkStyleProvider(); Set mobileBookMarkStyleProviders = ExtraDesignClassManager.getInstance().getArray( MobileBookMarkStyleProvider.XML_TAG); List list = new ArrayList<>(); list.add(defaultMobileBookMarkStyleProvider); + list.add(sidebarMobileBookMarkStyleProvider); list.addAll(mobileBookMarkStyleProviders); return Collections.unmodifiableList(list); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java new file mode 100644 index 0000000000..79bab33dfc --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java @@ -0,0 +1,387 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.base.BaseUtils; +import com.fr.base.Utils; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UnsignedIntUISpinner; +import com.fr.design.gui.style.FRFontPane; +import com.fr.design.gui.style.NumberDragBar; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.style.color.ColorSelectBox; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.form.ui.mobile.MobileBookMarkStyle; +import com.fr.form.ui.mobile.impl.SidebarMobileBookMarkStyle; +import com.fr.stable.CoreConstants; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; + +/** + * @author Starryi + * @version 10.0 + * Created by Starryi on 2020/02/28 + */ +public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane { + private static final long serialVersionUID = 1L; + + private static final int COLUMN_WIDTH = 160; + + private UnsignedIntUISpinner buttonWidthSpinner; + private UnsignedIntUISpinner buttonHeightSpinner; + private UnsignedIntUISpinner buttonGapSpinner; + private UnsignedIntUISpinner buttonBorderRadiusSpinner; + + private ColorSelectBox normalBackgroundColorBox; + private NumberDragBar normalOpacityDragBar; + private UnsignedIntUISpinner normalOpacitySpinner; + private LineComboBox normalBorderWidthComBox; + private ColorSelectBox normalBorderColorBox; + private UIComboBox normalFontNameComboBox; + private UIComboBox normalFontSizeComboBox; + private UIColorButton normalFontColorButton; + private UIToggleButton normalFontItalicButton; + private UIToggleButton normalFontBoldButton; + + private ColorSelectBox selectedBackgroundColorBox; + private NumberDragBar selectedOpacityDragBar; + private UnsignedIntUISpinner selectedOpacitySpinner; + private LineComboBox selectedBorderWidthComBox; + private ColorSelectBox selectedBorderColorBox; + private UIComboBox selectedFontNameComboBox; + private UIComboBox selectedFontSizeComboBox; + private UIColorButton selectedFontColorButton; + private UIToggleButton selectedFontItalicButton; + private UIToggleButton selectedFontBoldButton; + + private SidebarMobileBookMarkStyle DEFAULT_STYLE = new SidebarMobileBookMarkStyle(); + + public SidebarMobileBookMarkStyleCustomDefinePane() { + this.initComponent(); + } + + private void initComponent() { + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + + this.add(this.createNavButtonStylePanel()); + this.add(this.createNormalStateStylePanel()); + this.add(this.createSelectedStateStylePanel()); + } + + private JPanel createNavButtonStylePanel() { + + buttonWidthSpinner = new UnsignedIntUISpinner(20, 150, 1, DEFAULT_STYLE.getWidth()); + buttonHeightSpinner = new UnsignedIntUISpinner(20, 100, 1, DEFAULT_STYLE.getHeight()); + buttonGapSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, DEFAULT_STYLE.getGap()); + buttonBorderRadiusSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, DEFAULT_STYLE.getBorderRadius()); + + UILabel sizeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Size") + ":", + SwingConstants.RIGHT); + JPanel sizePane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0); + sizePane.add(buttonWidthSpinner); + sizePane.add(buttonHeightSpinner); + + JPanel sizeTipsPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0); + sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Width"), + SwingConstants.CENTER)); + sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Height"), + SwingConstants.CENTER)); + + UILabel gapLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Gap") + ":", + SwingConstants.RIGHT); + UILabel borderRadiusLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Border_Radius") + ":", + SwingConstants.RIGHT); + + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p, p}; + double[] columnSize = {p, COLUMN_WIDTH}; + double[] verticalGaps = {0, 10, 10}; + + JPanel navButtonSettingsPanel = TableLayoutHelper.createDiffVGapTableLayoutPane(new JComponent[][]{ + {sizeLabel, sizePane}, + {null, sizeTipsPane}, + {gapLabel, buttonGapSpinner}, + {borderRadiusLabel, buttonBorderRadiusSpinner}, + }, rowSize, columnSize, 5, verticalGaps); + + navButtonSettingsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + + JPanel containerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + containerPane.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Style"), + Color.decode("#2F8EF1"))); + containerPane.add(navButtonSettingsPanel); + + return containerPane; + } + + private JPanel createNormalStateStylePanel() { + double p = TableLayout.PREFERRED; + + normalBackgroundColorBox = new ColorSelectBox(COLUMN_WIDTH); + normalBackgroundColorBox.setSelectObject(DEFAULT_STYLE.getBackgroundColor()); + normalOpacityDragBar = new NumberDragBar(0, 100); + normalOpacityDragBar.setValue(DEFAULT_STYLE.getOpacity()); + normalOpacityDragBar.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + normalOpacitySpinner.setValue(normalOpacityDragBar.getValue()); + } + }); + normalOpacitySpinner = new UnsignedIntUISpinner(0, 100, 1, DEFAULT_STYLE.getOpacity()); + normalOpacitySpinner.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + normalOpacityDragBar.setValue((int) normalOpacitySpinner.getValue()); + } + }); + normalBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); + normalBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getBorderWidth()); + normalBorderColorBox = new ColorSelectBox(COLUMN_WIDTH); + normalBorderColorBox.setSelectObject(DEFAULT_STYLE.getBorderColor()); + normalFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); + normalFontNameComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontFamily()); + normalFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); + normalFontSizeComboBox.setSelectedItem(DEFAULT_STYLE.getFontSize()); + normalFontColorButton = new UIColorButton(); + normalFontColorButton.setColor(DEFAULT_STYLE.getFontColor()); + normalFontItalicButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + normalFontItalicButton.setSelected(DEFAULT_STYLE.isFontItalic()); + normalFontBoldButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); + normalFontBoldButton.setSelected(DEFAULT_STYLE.isFontBold()); + + JPanel opacityPane = new JPanel(new BorderLayout(0, 0)); + JPanel jp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0); + jp.add(normalOpacityDragBar); + jp.add(normalOpacitySpinner); + opacityPane.add(jp, BorderLayout.CENTER); + + JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane( + new JComponent[][]{{normalFontSizeComboBox, normalFontColorButton, normalFontItalicButton, normalFontBoldButton}}, + new double[]{p}, + new double[]{p, p, p, p}, + 0, 5 + ); + + double[] rowSize = {p, p, p, p, p}; + double[] columnSize = {p, COLUMN_WIDTH, p}; + + JPanel normalStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Background_Color") + ":", SwingConstants.RIGHT), + normalBackgroundColorBox + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Opacity") + ":", SwingConstants.RIGHT), + opacityPane, + new UILabel("%") + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Width") + ":", SwingConstants.RIGHT), + normalBorderWidthComBox + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Color") + ":", SwingConstants.RIGHT), + normalBorderColorBox + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Font") + ":", SwingConstants.RIGHT), + normalFontNameComboBox, + fontExtraPane + } + }, rowSize, columnSize, 5, 10); + normalStateStyleSettingsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + + JPanel containerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + containerPane.setBorder( + GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Normal_Style"), + Color.decode("#2F8EF1")) + ); + containerPane.add(normalStateStyleSettingsPanel); + + return containerPane; + } + + private JPanel createSelectedStateStylePanel() { + double p = TableLayout.PREFERRED; + + selectedBackgroundColorBox = new ColorSelectBox(COLUMN_WIDTH); + selectedBackgroundColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBackgroundColor()); + selectedOpacityDragBar = new NumberDragBar(0, 100); + selectedOpacityDragBar.setValue(DEFAULT_STYLE.getSelectedOpacity()); + selectedOpacityDragBar.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + selectedOpacitySpinner.setValue(selectedOpacityDragBar.getValue()); + } + }); + selectedOpacitySpinner = new UnsignedIntUISpinner(0, 100, 1, DEFAULT_STYLE.getSelectedOpacity()); + selectedOpacitySpinner.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + selectedOpacityDragBar.setValue((int) selectedOpacitySpinner.getValue()); + } + }); + selectedBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); + selectedBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getSelectedBorderWidth()); + selectedBorderColorBox = new ColorSelectBox(COLUMN_WIDTH); + selectedBorderColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBorderColor()); + selectedFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); + selectedFontNameComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontFamily()); + selectedFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); + selectedFontSizeComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontSize()); + selectedFontColorButton = new UIColorButton(); + selectedFontColorButton.setColor(DEFAULT_STYLE.getSelectedFontColor()); + selectedFontItalicButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + selectedFontItalicButton.setSelected(DEFAULT_STYLE.isSelectedFontItalic()); + selectedFontBoldButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); + selectedFontBoldButton.setSelected(DEFAULT_STYLE.isSelectedFontBold()); + + JPanel opacityPane = new JPanel(new BorderLayout(0, 0)); + JPanel jp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0); + jp.add(selectedOpacityDragBar); + jp.add(selectedOpacitySpinner); + opacityPane.add(jp, BorderLayout.CENTER); + + JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane( + new JComponent[][]{{selectedFontSizeComboBox, selectedFontColorButton, selectedFontItalicButton, selectedFontBoldButton}}, + new double[]{p}, + new double[]{p, p, p, p}, + 0, 5 + ); + + double[] rowSize = {p, p, p, p, p}; + double[] columnSize = {p, COLUMN_WIDTH, p}; + + JPanel selectedStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Background_Color") + ":", SwingConstants.RIGHT), + selectedBackgroundColorBox + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Opacity") + ":", SwingConstants.RIGHT), + opacityPane, + new UILabel("%") + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Width") + ":", SwingConstants.RIGHT), + selectedBorderWidthComBox + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Color") + ":", SwingConstants.RIGHT), + selectedBorderColorBox + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Font") + ":", SwingConstants.RIGHT), + selectedFontNameComboBox, + fontExtraPane + } + }, rowSize, columnSize, 5, 10); + selectedStateStyleSettingsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + + JPanel containerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + containerPane.setBorder( + GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Selected_Style"), + Color.decode("#2F8EF1")) + ); + containerPane.add(selectedStateStyleSettingsPanel); + + return containerPane; + } + + @Override + public void populateBean(MobileBookMarkStyle ob) { + SidebarMobileBookMarkStyle style = null; + if (ob instanceof SidebarMobileBookMarkStyle) { + style = (SidebarMobileBookMarkStyle) ob; + } + if (style == null) { + return; + } + + buttonWidthSpinner.setValue(style.getWidth()); + buttonHeightSpinner.setValue(style.getHeight()); + buttonGapSpinner.setValue(style.getGap()); + buttonBorderRadiusSpinner.setValue(style.getBorderRadius()); + + normalBackgroundColorBox.setSelectObject(style.getBackgroundColor()); + normalOpacityDragBar.setValue(style.getOpacity()); + normalOpacitySpinner.setValue(style.getOpacity()); + normalBorderWidthComBox.setSelectedLineStyle(style.getBorderWidth()); + normalBorderColorBox.setSelectObject(style.getBorderColor()); + normalFontNameComboBox.setSelectedItem(style.getFontFamily()); + normalFontSizeComboBox.setSelectedItem(style.getFontSize()); + normalFontColorButton.setColor(style.getFontColor()); + normalFontItalicButton.setSelected(style.isFontItalic()); + normalFontBoldButton.setSelected(style.isFontBold()); + + selectedBackgroundColorBox.setSelectObject(style.getSelectedBackgroundColor()); + selectedOpacityDragBar.setValue(style.getSelectedOpacity()); + selectedOpacitySpinner.setValue(style.getSelectedOpacity()); + selectedBorderWidthComBox.setSelectedLineStyle(style.getSelectedBorderWidth()); + selectedBorderColorBox.setSelectObject(style.getSelectedBorderColor()); + selectedFontNameComboBox.setSelectedItem(style.getSelectedFontFamily()); + selectedFontSizeComboBox.setSelectedItem(style.getSelectedFontSize()); + selectedFontColorButton.setColor(style.getSelectedFontColor()); + selectedFontItalicButton.setSelected(style.isSelectedFontItalic()); + selectedFontBoldButton.setSelected(style.isSelectedFontBold()); + } + + @Override + public MobileBookMarkStyle updateBean() { + SidebarMobileBookMarkStyle style = new SidebarMobileBookMarkStyle(); + + style.setWidth((int) buttonWidthSpinner.getValue()); + style.setHeight((int) buttonHeightSpinner.getValue()); + style.setGap((int) buttonGapSpinner.getValue()); + style.setBorderRadius((int) buttonBorderRadiusSpinner.getValue()); + + if (normalBackgroundColorBox.getSelectObject() != null) { + style.setBackgroundColor(normalBackgroundColorBox.getSelectObject()); + } + style.setOpacity((int) normalOpacitySpinner.getValue()); + style.setBorderWidth(normalBorderWidthComBox.getSelectedLineStyle()); + style.setBorderColor(normalBorderColorBox.getSelectObject()); + if (normalFontNameComboBox.getSelectedItem() != null) { + style.setFontFamily((String) normalFontNameComboBox.getSelectedItem()); + } + if (normalFontSizeComboBox.getSelectedItem() != null) { + style.setFontSize((Integer) normalFontSizeComboBox.getSelectedItem()); + } + style.setFontColor(normalFontColorButton.getColor()); + style.setFontItalic(normalFontItalicButton.isSelected()); + style.setFontBold(normalFontBoldButton.isSelected()); + + if (selectedBackgroundColorBox.getSelectObject() != null) { + style.setSelectedBackgroundColor(selectedBackgroundColorBox.getSelectObject()); + } + style.setSelectedOpacity((int) selectedOpacitySpinner.getValue()); + style.setSelectedBorderWidth(selectedBorderWidthComBox.getSelectedLineStyle()); + style.setSelectedBorderColor(selectedBorderColorBox.getSelectObject()); + if (selectedFontNameComboBox.getSelectedItem() != null) { + style.setSelectedFontFamily((String) selectedFontNameComboBox.getSelectedItem()); + } + if (selectedFontSizeComboBox.getSelectedItem() != null) { + style.setSelectedFontSize((Integer) selectedFontSizeComboBox.getSelectedItem()); + } + style.setSelectedFontColor(selectedFontColorButton.getColor()); + style.setSelectedFontItalic(selectedFontItalicButton.isSelected()); + style.setSelectedFontBold(selectedFontBoldButton.isSelected()); + + return style; + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleProvider.java new file mode 100644 index 0000000000..7c9202f3fd --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleProvider.java @@ -0,0 +1,30 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.impl.AbstractMobileBookMarkStyleProvider; +import com.fr.design.i18n.Toolkit; +import com.fr.form.ui.mobile.MobileBookMarkStyle; +import com.fr.form.ui.mobile.impl.SidebarMobileBookMarkStyle; + +/** + * @author Starryi + * @version 10.0 + * Created by Starryi on 2020/02/28 + */ +public class SidebarMobileBookMarkStyleProvider extends AbstractMobileBookMarkStyleProvider { + + @Override + public Class classForMobileBookMarkStyle() { + return SidebarMobileBookMarkStyle.class; + } + + @Override + public Class> classForMobileBookMarkStyleAppearance() { + return SidebarMobileBookMarkStyleCustomDefinePane.class; + } + + @Override + public String displayName() { + return Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar"); + } +}