You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
135 lines
5.6 KiB
135 lines
5.6 KiB
5 years ago
|
package com.fr.env;
|
||
5 years ago
|
|
||
5 years ago
|
import com.fr.design.DesignerEnvManager;
|
||
5 years ago
|
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
|
||
5 years ago
|
import com.fr.design.gui.ibutton.UIButton;
|
||
5 years ago
|
import com.fr.design.gui.icheckbox.UICheckBox;
|
||
5 years ago
|
import com.fr.design.i18n.Toolkit;
|
||
|
import com.fr.design.layout.FRGUIPaneFactory;
|
||
|
import com.fr.design.utils.gui.GUICoreUtils;
|
||
5 years ago
|
import com.fr.env.utils.DisplayUtils;
|
||
5 years ago
|
import com.fr.general.FRFont;
|
||
5 years ago
|
import com.fr.general.GeneralContext;
|
||
5 years ago
|
import com.fr.general.IOUtils;
|
||
|
|
||
|
import javax.swing.BorderFactory;
|
||
5 years ago
|
import javax.swing.Icon;
|
||
5 years ago
|
import javax.swing.JDialog;
|
||
|
import javax.swing.JLabel;
|
||
|
import javax.swing.JPanel;
|
||
|
import javax.swing.JTextArea;
|
||
5 years ago
|
import javax.swing.JTextPane;
|
||
5 years ago
|
import java.awt.BorderLayout;
|
||
|
import java.awt.Dimension;
|
||
|
import java.awt.Frame;
|
||
|
import java.awt.event.ActionEvent;
|
||
|
import java.awt.event.ActionListener;
|
||
5 years ago
|
import java.text.SimpleDateFormat;
|
||
|
import java.util.Date;
|
||
|
import java.util.Locale;
|
||
5 years ago
|
|
||
|
/**
|
||
|
* @author: Maksim
|
||
|
* @Date: Created in 2020/2/3
|
||
|
* @Description: 远程连接时,服务检测提醒对话框
|
||
|
*/
|
||
|
public class CheckServiceDialog extends JDialog implements ActionListener {
|
||
|
private JPanel topPanel;
|
||
|
private JPanel centerPanel;
|
||
|
private JPanel bottomPanel;
|
||
5 years ago
|
private UICheckBox remindBox;
|
||
5 years ago
|
|
||
5 years ago
|
public CheckServiceDialog(Frame parent, String areaText, String localBranch, String remoteBranch){
|
||
5 years ago
|
super(parent,true);
|
||
|
//上面的标签面板
|
||
|
topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
|
||
|
JPanel imagePanel = new JPanel();
|
||
5 years ago
|
Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/warning5.png");
|
||
5 years ago
|
|
||
|
JLabel imageLabel = new JLabel();
|
||
|
imageLabel.setIcon(icon);
|
||
|
imagePanel.add(imageLabel);
|
||
5 years ago
|
imagePanel.setPreferredSize(new Dimension(110,80));
|
||
5 years ago
|
|
||
|
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);
|
||
5 years ago
|
label.setPreferredSize(new Dimension(650,30));
|
||
5 years ago
|
|
||
|
String text = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") + localBranch
|
||
|
+ Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch;
|
||
|
String delimiter = DisplayUtils.getDisplayLength(text) > 70? "<br>":"/";
|
||
5 years ago
|
JLabel label2 = new JLabel("<html>"+Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer")
|
||
5 years ago
|
+ localBranch + delimiter + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch+"</html>");
|
||
5 years ago
|
label2.setPreferredSize(new Dimension(600,30));
|
||
5 years ago
|
|
||
|
JTextPane tipsPane = new JTextPane();
|
||
|
tipsPane.setEditable(false);
|
||
|
tipsPane.setBackground(verticalPanel.getBackground());
|
||
|
tipsPane.setPreferredSize(new Dimension(500,30));
|
||
|
tipsPane.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Need_Update"));
|
||
5 years ago
|
|
||
|
verticalPanel.add(label);
|
||
|
verticalPanel.add(label2);
|
||
5 years ago
|
verticalPanel.add(tipsPane);
|
||
5 years ago
|
|
||
|
topPanel.add(imagePanel,BorderLayout.WEST);
|
||
|
topPanel.add(verticalPanel,BorderLayout.CENTER);
|
||
|
|
||
|
//中间的文本域面板
|
||
|
centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
|
||
|
centerPanel.setBorder(BorderFactory.createEmptyBorder(0,10,10,10));
|
||
|
centerPanel.setPreferredSize(new Dimension(480,320));
|
||
|
|
||
|
JLabel titleLabel = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Affected_Function"));
|
||
|
titleLabel.setPreferredSize(new Dimension(400,40));
|
||
|
JTextArea checkArea = new JTextArea(areaText);
|
||
|
checkArea.setEnabled(false);
|
||
|
centerPanel.add(titleLabel,BorderLayout.NORTH);
|
||
|
centerPanel.add(checkArea,BorderLayout.CENTER);
|
||
|
|
||
|
//下面的按钮面板
|
||
5 years ago
|
remindBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remind_Show"));
|
||
|
remindBox.addActionListener(remindCheckboxListener);
|
||
5 years ago
|
UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm"));
|
||
5 years ago
|
JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
|
||
|
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0,10,10,10));
|
||
|
buttonPanel.add(remindBox, BorderLayout.WEST);
|
||
|
buttonPanel.add(okButton,BorderLayout.EAST);
|
||
5 years ago
|
okButton.addActionListener(this );
|
||
|
bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
|
||
|
bottomPanel.add(buttonPanel);
|
||
|
|
||
|
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Title_Hint"));
|
||
|
this.setResizable(false);
|
||
|
|
||
|
this.add(topPanel,BorderLayout.NORTH);
|
||
|
this.add(centerPanel, BorderLayout.CENTER);
|
||
|
this.add(buttonPanel,BorderLayout.SOUTH);
|
||
5 years ago
|
this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US)? 750:600, 500));
|
||
5 years ago
|
|
||
|
GUICoreUtils.centerWindow(this);
|
||
|
}
|
||
|
@Override
|
||
|
public void actionPerformed(ActionEvent e) {
|
||
|
this.dispose();
|
||
|
}
|
||
5 years ago
|
|
||
|
|
||
|
private ActionListener remindCheckboxListener = new ActionListener() {
|
||
|
|
||
|
@Override
|
||
|
public void actionPerformed(ActionEvent e) {
|
||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||
|
String remindTime = format.format(new Date());
|
||
5 years ago
|
//环境已切换,通过当前环境获取,一定是远程环境
|
||
|
String currentEnvName = DesignerEnvManager.getEnvManager().getCurEnvName();
|
||
|
RemoteDesignerWorkspaceInfo currentEnv = (RemoteDesignerWorkspaceInfo)DesignerEnvManager.getEnvManager().getWorkspaceInfo(currentEnvName);
|
||
|
currentEnv.setRemindTime(remindBox.isSelected()? remindTime : "");
|
||
5 years ago
|
}
|
||
|
};
|
||
|
|
||
5 years ago
|
}
|