Browse Source

REPORT-64486 视觉验收-远程模版锁定优化

feature/x
hades 3 years ago
parent
commit
2c9290863a
  1. 32
      designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java
  2. 7
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  3. 22
      designer-base/src/main/java/com/fr/design/mainframe/ForbiddenPane.java
  4. 7
      designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java

32
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.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.utils.TemplateUtils; import com.fr.design.utils.TemplateUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.IOUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -24,7 +26,6 @@ import java.time.format.DateTimeFormatter;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.UIManager;
/** /**
* @author hades * @author hades
@ -39,13 +40,11 @@ public class LockInfoDialog extends JDialog {
super(DesignerContext.getDesignerFrame()); super(DesignerContext.getDesignerFrame());
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); 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(createContentPane(userInfo), BorderLayout.CENTER);
panel.add(createControlPane(), BorderLayout.SOUTH); panel.add(createControlPane(), BorderLayout.SOUTH);
this.getContentPane().add(panel); this.getContentPane().add(panel);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Alert")); this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Title_Hint"));
this.setSize(400, 180); this.setSize(400, 160);
this.setResizable(false); this.setResizable(false);
this.setModal(true); this.setModal(true);
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
@ -54,12 +53,21 @@ public class LockInfoDialog extends JDialog {
private JPanel createContentPane(UserInfo userInfo) { private JPanel createContentPane(UserInfo userInfo) {
JPanel contentPanel = new JPanel(new BorderLayout()); JPanel contentPanel = new JPanel(new BorderLayout());
contentPanel.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0)); contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
contentPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Template_Lock_And_SaveAs_Tip")), BorderLayout.NORTH); 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(); 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())) { 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())) { if (userInfo != null && StringUtils.isNotEmpty(userInfo.getIp())) {
detailInfoPane.add(createLabel(Toolkit.i18nText("Fine-Design_Template_Lock_Holder_Ip", 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) { private UILabel createLabel(String text) {
UILabel label = new UILabel(text); UILabel label = new UILabel(text);
label.setForeground(Color.GRAY); label.setForeground(Color.GRAY);
label.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); label.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
return label; return label;
} }
private JPanel createControlPane() { 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 saveAsButton = new UIButton(Toolkit.i18nText("Fine_Design_Template_Lock_Save_As"));
UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")); UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_Cancel"));
saveAsButton.addActionListener(new ActionListener() { saveAsButton.addActionListener(new ActionListener() {
@ -105,6 +114,7 @@ public class LockInfoDialog extends JDialog {
public static void show(UserInfo userInfo) { public static void show(UserInfo userInfo) {
DesignerFrameFileDealerPane.getInstance().refreshRightToolBarBy(TemplateTreePane.getInstance().getFileNode());
new LockInfoDialog(userInfo); new LockInfoDialog(userInfo);
} }

7
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.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -198,7 +197,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
rightToolBar = new UIToolbar(FlowLayout.RIGHT); rightToolBar = new UIToolbar(FlowLayout.RIGHT);
rightToolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR)); rightToolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.TOOLBAR_BORDER_COLOR));
rightToolBar.setBorderPainted(true); 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")); 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.setRolloverIcon(IOUtils.readIcon("/com/fr/design/images/toolbarbtn/unlock.png"));
button.setBorderPainted(false); button.setBorderPainted(false);
@ -213,7 +214,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
Toolkit.i18nText("Fine-Design_Basic_Alert"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE, 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); new Object[] {Toolkit.i18nText("Fine_Design_Template_UnLock_I_Known"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null);
if (option == JOptionPane.YES_OPTION) { if (option == JOptionPane.YES_OPTION) {
String path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getTemplateFileTree().getSelectedTemplatePath()); String path = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getTemplateFileTree().getSelectedTemplatePath());

22
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.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LayoutManager; import java.awt.LayoutManager;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.ImageIcon; 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 Color BUTTON_COLOR = new Color(63, 155, 249);
private static final int Y_GAP = 10; private static final int Y_GAP = 10;
private static final int X_GAP = 10; private static final int X_GAP = 10;
private static final int ARC = 4;
private final UILabel lockLabel; private final UILabel lockLabel;
private final UILabel tipLabel; private final UILabel tipLabel;
@ -71,11 +75,11 @@ public class ForbiddenPane extends JPanel {
int tipLabelWidth = tipLabel.getPreferredSize().width; int tipLabelWidth = tipLabel.getPreferredSize().width;
int tipLabelHeight = tipLabel.getPreferredSize().height; int tipLabelHeight = tipLabel.getPreferredSize().height;
int tipLabelX = (width - tipLabelWidth) / 2 + X_GAP; int tipLabelX = (width - tipLabelWidth) / 2 + X_GAP;
int tipLabelY = lockLabelY + lockLabelHeight - Y_GAP; int tipLabelY = lockLabelY + lockLabelHeight;
int refreshButtonWidth = refreshButton.getPreferredSize().width; int refreshButtonWidth = refreshButton.getPreferredSize().width;
int refreshButtonHeight = refreshButton.getPreferredSize().height; int refreshButtonHeight = refreshButton.getPreferredSize().height;
int refreshButtonX = (width - refreshButtonWidth) / 2 + X_GAP; int refreshButtonX = (width - refreshButtonWidth) / 2 + X_GAP;
int refreshButtonY = tipLabelY + refreshButtonHeight; int refreshButtonY = tipLabelY + refreshButtonHeight + Y_GAP;
lockLabel.setBounds(lockLabelX, lockLabelY, lockLabelWidth, lockLabelHeight); lockLabel.setBounds(lockLabelX, lockLabelY, lockLabelWidth, lockLabelHeight);
tipLabel.setBounds(tipLabelX, tipLabelY, tipLabelWidth, tipLabelHeight); tipLabel.setBounds(tipLabelX, tipLabelY, tipLabelWidth, tipLabelHeight);
refreshButton.setBounds(refreshButtonX, refreshButtonY, refreshButtonWidth, refreshButtonHeight); refreshButton.setBounds(refreshButtonX, refreshButtonY, refreshButtonWidth, refreshButtonHeight);
@ -88,16 +92,20 @@ public class ForbiddenPane extends JPanel {
setBackground(Color.WHITE); setBackground(Color.WHITE);
lockLabel = new UILabel(LOCK_ICON); lockLabel = new UILabel(LOCK_ICON);
tipLabel = new UILabel(Toolkit.i18nText("Fine_Design_Template_Has_Been_Locked_Tip")); 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); tipLabel.setForeground(TIP_COLOR);
refreshButton = new JButton(Toolkit.i18nText("Fine-Design_Basic_Refresh")) { refreshButton = new JButton(Toolkit.i18nText("Fine-Design_Basic_Refresh")) {
@Override @Override
public void paintComponent(Graphics g) public void paintComponent(Graphics g) {
{ Graphics2D g2d = (Graphics2D) g;
g.setColor(BUTTON_COLOR); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.fillRect(0, 0, getSize().width, getSize().height); g2d.setColor(BUTTON_COLOR);
super.paintComponent(g); g2d.fillRoundRect(0, 0, getWidth(), getHeight(), ARC, ARC);
super.paintComponent(g2d);
} }
}; };
refreshButton.setPreferredSize(new Dimension(68, 24));
refreshButton.setForeground(Color.WHITE); refreshButton.setForeground(Color.WHITE);
refreshButton.setBorderPainted(false); refreshButton.setBorderPainted(false);
refreshButton.setContentAreaFilled(false); refreshButton.setContentAreaFilled(false);

7
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.design.utils.TemplateUtils;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.IOUtils;
import com.fr.report.UnLockedException; import com.fr.report.UnLockedException;
import com.fr.workspace.exception.DiskSpaceFullException; import com.fr.workspace.exception.DiskSpaceFullException;
import com.fr.report.InconsistentLockException; import com.fr.report.InconsistentLockException;
import java.awt.Frame; import java.awt.Frame;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.UIManager;
/** /**
* @author hades * @author hades
@ -50,7 +50,8 @@ public class SaveFailureHandler implements ThrowableHandler {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine_Design_Template_Save_Failed_By_Full_Disk"), Toolkit.i18nText("Fine_Design_Template_Save_Failed_By_Full_Disk"),
Toolkit.i18nText("Fine-Design_Basic_Alert"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE,
IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"));
return true; return true;
} }
return false; return false;
@ -98,7 +99,7 @@ public class SaveFailureHandler implements ThrowableHandler {
Toolkit.i18nText("Fine-Design_Basic_Alert"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE, 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); new Object[] {Toolkit.i18nText("Fine_Design_Template_SaveAs_Backup"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null);
if (option == JOptionPane.YES_OPTION) { if (option == JOptionPane.YES_OPTION) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();

Loading…
Cancel
Save