From 2c9290863a4df9a49ee4d6823a7b12e991d6f117 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 21 Dec 2021 10:17:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-64486=20=E8=A7=86=E8=A7=89=E9=AA=8C?= =?UTF-8?q?=E6=94=B6-=E8=BF=9C=E7=A8=8B=E6=A8=A1=E7=89=88=E9=94=81?= =?UTF-8?q?=E5=AE=9A=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/lock/LockInfoDialog.java | 32 ++++++++++++------- .../DesignerFrameFileDealerPane.java | 7 ++-- .../fr/design/mainframe/ForbiddenPane.java | 22 +++++++++---- .../worker/save/SaveFailureHandler.java | 7 ++-- 4 files changed, 44 insertions(+), 24 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java b/designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java index 21e4db5aaf..71c9549248 100644 --- a/designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java +++ b/designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java @@ -6,10 +6,12 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.utils.TemplateUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; +import com.fr.general.IOUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; @@ -24,7 +26,6 @@ import java.time.format.DateTimeFormatter; import javax.swing.BorderFactory; import javax.swing.JDialog; import javax.swing.JPanel; -import javax.swing.UIManager; /** * @author hades @@ -39,13 +40,11 @@ public class LockInfoDialog extends JDialog { super(DesignerContext.getDesignerFrame()); JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); - UILabel iconLabel = new UILabel(UIManager.getIcon("OptionPane.warningIcon")); - panel.add(iconLabel, BorderLayout.WEST); panel.add(createContentPane(userInfo), BorderLayout.CENTER); panel.add(createControlPane(), BorderLayout.SOUTH); this.getContentPane().add(panel); - this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Alert")); - this.setSize(400, 180); + this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Title_Hint")); + this.setSize(400, 160); this.setResizable(false); this.setModal(true); GUICoreUtils.centerWindow(this); @@ -54,12 +53,21 @@ public class LockInfoDialog extends JDialog { private JPanel createContentPane(UserInfo userInfo) { JPanel contentPanel = new JPanel(new BorderLayout()); - contentPanel.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0)); - contentPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Template_Lock_And_SaveAs_Tip")), BorderLayout.NORTH); + contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + JPanel messagePane = new JPanel(new BorderLayout(13, 0)); + UILabel iconLabel = new UILabel(IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png")); + iconLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + messagePane.add(iconLabel, BorderLayout.WEST); + UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Template_Lock_And_SaveAs_Tip")); + tipLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + messagePane.add(tipLabel, BorderLayout.CENTER); + contentPanel.add(messagePane, BorderLayout.NORTH); JPanel detailInfoPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - detailInfoPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 0,0)); + detailInfoPane.setBorder(BorderFactory.createEmptyBorder(0, 45, 0,0)); if (userInfo != null && StringUtils.isNotEmpty(userInfo.getUserName())) { - detailInfoPane.add(createLabel(Toolkit.i18nText("Fine-Design_Template_Lock_Holder", userInfo.getUserName()))); + UILabel label = createLabel(Toolkit.i18nText("Fine-Design_Template_Lock_Holder", userInfo.getUserName())); + label .setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + detailInfoPane.add(label); } if (userInfo != null && StringUtils.isNotEmpty(userInfo.getIp())) { detailInfoPane.add(createLabel(Toolkit.i18nText("Fine-Design_Template_Lock_Holder_Ip", userInfo.getIp()) )); @@ -72,12 +80,13 @@ public class LockInfoDialog extends JDialog { private UILabel createLabel(String text) { UILabel label = new UILabel(text); label.setForeground(Color.GRAY); - label.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + label.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0)); return label; } private JPanel createControlPane() { - JPanel controlPane = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + JPanel controlPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 5)); + controlPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0,5)); UIButton saveAsButton = new UIButton(Toolkit.i18nText("Fine_Design_Template_Lock_Save_As")); UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")); saveAsButton.addActionListener(new ActionListener() { @@ -105,6 +114,7 @@ public class LockInfoDialog extends JDialog { public static void show(UserInfo userInfo) { + DesignerFrameFileDealerPane.getInstance().refreshRightToolBarBy(TemplateTreePane.getInstance().getFileNode()); new LockInfoDialog(userInfo); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index bcda18bb68..2b7a321a82 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -63,7 +63,6 @@ import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.SwingConstants; -import javax.swing.UIManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.BorderLayout; @@ -198,7 +197,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt rightToolBar = new UIToolbar(FlowLayout.RIGHT); rightToolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); rightToolBar.setBorderPainted(true); - rightToolBar.add(new UILabel(Toolkit.i18nText("Fine_Design_Template_Lock_Status"))); + UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine_Design_Template_Lock_Status")); + tipLabel.setForeground(Color.GRAY); + rightToolBar.add(tipLabel); UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/images/toolbarbtn/lock.png")); button.setRolloverIcon(IOUtils.readIcon("/com/fr/design/images/toolbarbtn/unlock.png")); button.setBorderPainted(false); @@ -213,7 +214,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, - UIManager.getIcon("OptionPane.warningIcon"), + IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"), new Object[] {Toolkit.i18nText("Fine_Design_Template_UnLock_I_Known"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null); if (option == JOptionPane.YES_OPTION) { String path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getTemplateFileTree().getSelectedTemplatePath()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java b/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java index 37f0745030..f903912115 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java @@ -14,8 +14,11 @@ import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; +import java.awt.Font; import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.LayoutManager; +import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; @@ -37,6 +40,7 @@ public class ForbiddenPane extends JPanel { private static final Color BUTTON_COLOR = new Color(63, 155, 249); private static final int Y_GAP = 10; private static final int X_GAP = 10; + private static final int ARC = 4; private final UILabel lockLabel; private final UILabel tipLabel; @@ -71,11 +75,11 @@ public class ForbiddenPane extends JPanel { int tipLabelWidth = tipLabel.getPreferredSize().width; int tipLabelHeight = tipLabel.getPreferredSize().height; int tipLabelX = (width - tipLabelWidth) / 2 + X_GAP; - int tipLabelY = lockLabelY + lockLabelHeight - Y_GAP; + int tipLabelY = lockLabelY + lockLabelHeight; int refreshButtonWidth = refreshButton.getPreferredSize().width; int refreshButtonHeight = refreshButton.getPreferredSize().height; int refreshButtonX = (width - refreshButtonWidth) / 2 + X_GAP; - int refreshButtonY = tipLabelY + refreshButtonHeight; + int refreshButtonY = tipLabelY + refreshButtonHeight + Y_GAP; lockLabel.setBounds(lockLabelX, lockLabelY, lockLabelWidth, lockLabelHeight); tipLabel.setBounds(tipLabelX, tipLabelY, tipLabelWidth, tipLabelHeight); refreshButton.setBounds(refreshButtonX, refreshButtonY, refreshButtonWidth, refreshButtonHeight); @@ -88,16 +92,20 @@ public class ForbiddenPane extends JPanel { setBackground(Color.WHITE); lockLabel = new UILabel(LOCK_ICON); tipLabel = new UILabel(Toolkit.i18nText("Fine_Design_Template_Has_Been_Locked_Tip")); + Font labelFont = tipLabel.getFont(); + tipLabel.setFont(new Font(labelFont.getName(), labelFont.getStyle(), 14)); tipLabel.setForeground(TIP_COLOR); refreshButton = new JButton(Toolkit.i18nText("Fine-Design_Basic_Refresh")) { @Override - public void paintComponent(Graphics g) - { - g.setColor(BUTTON_COLOR); - g.fillRect(0, 0, getSize().width, getSize().height); - super.paintComponent(g); + public void paintComponent(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setColor(BUTTON_COLOR); + g2d.fillRoundRect(0, 0, getWidth(), getHeight(), ARC, ARC); + super.paintComponent(g2d); } }; + refreshButton.setPreferredSize(new Dimension(68, 24)); refreshButton.setForeground(Color.WHITE); refreshButton.setBorderPainted(false); refreshButton.setContentAreaFilled(false); diff --git a/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java b/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java index 9eb4833b58..4cf2af431a 100644 --- a/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java +++ b/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java @@ -9,12 +9,12 @@ import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.TemplateUtils; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; +import com.fr.general.IOUtils; import com.fr.report.UnLockedException; import com.fr.workspace.exception.DiskSpaceFullException; import com.fr.report.InconsistentLockException; import java.awt.Frame; import javax.swing.JOptionPane; -import javax.swing.UIManager; /** * @author hades @@ -50,7 +50,8 @@ public class SaveFailureHandler implements ThrowableHandler { FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine_Design_Template_Save_Failed_By_Full_Disk"), Toolkit.i18nText("Fine-Design_Basic_Alert"), - JOptionPane.WARNING_MESSAGE); + JOptionPane.WARNING_MESSAGE, + IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png")); return true; } return false; @@ -98,7 +99,7 @@ public class SaveFailureHandler implements ThrowableHandler { Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, - UIManager.getIcon("OptionPane.warningIcon"), + IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"), new Object[] {Toolkit.i18nText("Fine_Design_Template_SaveAs_Backup"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null); if (option == JOptionPane.YES_OPTION) { JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); From ab1247612d8282e5588abfc7f5f0613bbcd3dc4f Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 21 Dec 2021 10:31:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-64581=20=E6=9C=AC=E5=9C=B0=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E4=B8=8B=E5=86=85=E7=BD=AE=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E6=9C=AA=E5=90=AF=E5=8A=A8=E6=97=B6=20=E5=8F=8C=E5=87=BB?= =?UTF-8?q?=E6=89=93=E4=B8=8D=E5=BC=80=E7=9B=AE=E5=BD=95=E6=A0=91=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/TemplateTreePane.java | 3 ++- .../src/main/java/com/fr/design/lock/LockInfoUtils.java | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index ddf806f026..707309a481 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -231,7 +231,8 @@ public class TemplateTreePane extends JPanel implements FileOperations { return; } String lock = node.getLock(); - boolean showLockInfo = LockInfoUtils.isCompatibleOperator() ? (lock != null && !lock.equals(node.getUserID())) + boolean showLockInfo = LockInfoUtils.isCompatibleOperator() || LockInfoUtils.unableGetLockInfo() + ? (lock != null && !lock.equals(node.getUserID())) : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); if (showLockInfo) { UserInfo userInfo = WorkContext.getCurrent().get(LockInfoOperator.class).getUserInfo(selectedFilePath); diff --git a/designer-base/src/main/java/com/fr/design/lock/LockInfoUtils.java b/designer-base/src/main/java/com/fr/design/lock/LockInfoUtils.java index ce8c493e9e..52a2c526c7 100644 --- a/designer-base/src/main/java/com/fr/design/lock/LockInfoUtils.java +++ b/designer-base/src/main/java/com/fr/design/lock/LockInfoUtils.java @@ -2,6 +2,7 @@ package com.fr.design.lock; import com.fr.report.lock.DefaultLockInfoOperator; import com.fr.report.lock.LockInfoOperator; +import com.fr.start.server.FineEmbedServer; import com.fr.workspace.WorkContext; /** @@ -15,4 +16,8 @@ public class LockInfoUtils { LockInfoOperator lockInfoOperator = WorkContext.getCurrent().get(LockInfoOperator.class); return lockInfoOperator instanceof DefaultLockInfoOperator; } + + public static boolean unableGetLockInfo() { + return WorkContext.getCurrent().isLocal() && !FineEmbedServer.isRunning(); + } }