forked from fanruan/design
Hugh.C
5 years ago
268 changed files with 8020 additions and 2165 deletions
@ -0,0 +1,94 @@
|
||||
package com.fr.design.dialog; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
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 javax.swing.JDialog; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.JTextArea; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.Font; |
||||
import java.awt.Frame; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/1/8 |
||||
*/ |
||||
public abstract class ErrorDialog extends JDialog implements ActionListener { |
||||
|
||||
private UIButton okButton; |
||||
private UIButton restartButton; |
||||
|
||||
|
||||
public ErrorDialog(Frame parent, String message, String title, String detail) { |
||||
super(parent, true); |
||||
JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
JPanel messagePane = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); |
||||
UILabel boldFontLabel = new UILabel(message); |
||||
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Send_Report_To_Us")); |
||||
Font font = FRFont.getInstance("Dialog", Font.BOLD, 20); |
||||
boldFontLabel.setFont(font); |
||||
messagePane.add(boldFontLabel); |
||||
messagePane.add(label); |
||||
northPane.add(messagePane); |
||||
|
||||
JTextArea area = new JTextArea(detail); |
||||
area.setPreferredSize(new Dimension(400, 100)); |
||||
area.setEnabled(true); |
||||
area.setEditable(false); |
||||
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
UILabel detailLabel = new UILabel(Toolkit.i18nText("Fine-Design_Problem_Detail_Message")); |
||||
centerPane.add(detailLabel, BorderLayout.NORTH); |
||||
centerPane.add(area, BorderLayout.CENTER); |
||||
|
||||
JPanel southPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0)); |
||||
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Ok")); |
||||
okButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
okEvent(); |
||||
} |
||||
}); |
||||
buttonPane.add(okButton); |
||||
restartButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Restart")); |
||||
restartButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
restartEvent(); |
||||
} |
||||
}); |
||||
buttonPane.add(restartButton); |
||||
controlPane.add(buttonPane, BorderLayout.EAST); |
||||
southPane.add(controlPane); |
||||
|
||||
this.setTitle(title); |
||||
this.setResizable(false); |
||||
this.add(northPane, BorderLayout.NORTH); |
||||
this.add(centerPane, BorderLayout.CENTER); |
||||
this.add(southPane, BorderLayout.SOUTH); |
||||
this.setSize(new Dimension(600, 500)); |
||||
GUICoreUtils.centerWindow(this); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
dispose(); |
||||
} |
||||
|
||||
protected abstract void okEvent(); |
||||
|
||||
protected abstract void restartEvent(); |
||||
|
||||
} |
@ -0,0 +1,92 @@
|
||||
package com.fr.design.dialog; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
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 java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.Frame; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/1/8 |
||||
*/ |
||||
public abstract class TipDialog extends JDialog implements ActionListener { |
||||
|
||||
private UIButton endButton; |
||||
private UIButton cancelButton; |
||||
|
||||
public TipDialog(Frame parent, String type) { |
||||
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")); |
||||
iconPane.add(iconLabel); |
||||
iconPane.setPreferredSize(new Dimension(100, 100)); |
||||
JPanel tipPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Last_Designer_Process_Not_Exist")); |
||||
tipPane.add(tipLabel); |
||||
northPane.add(iconPane, BorderLayout.WEST); |
||||
northPane.add(tipPane, BorderLayout.CENTER); |
||||
|
||||
JTextArea area = new JTextArea(type); |
||||
area.setPreferredSize(new Dimension(400, 100)); |
||||
area.setEnabled(true); |
||||
area.setEditable(false); |
||||
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
centerPane.add(area); |
||||
|
||||
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.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
endEvent(); |
||||
} |
||||
}); |
||||
buttonPane.add(endButton); |
||||
cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); |
||||
cancelButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
cancelEvent(); |
||||
} |
||||
}); |
||||
buttonPane.add(cancelButton); |
||||
controlPane.add(buttonPane, BorderLayout.EAST); |
||||
southPane.add(controlPane); |
||||
|
||||
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Error_Tittle")); |
||||
this.setResizable(false); |
||||
this.add(northPane, BorderLayout.NORTH); |
||||
this.add(centerPane, BorderLayout.CENTER); |
||||
this.add(southPane, BorderLayout.SOUTH); |
||||
this.setSize(new Dimension(600, 500)); |
||||
GUICoreUtils.centerWindow(this); |
||||
|
||||
} |
||||
|
||||
protected abstract void endEvent(); |
||||
|
||||
protected abstract void cancelEvent(); |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
dispose(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.common.annotations.Open; |
||||
import com.fr.stable.fun.mark.Mutable; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by kerry on 2019-11-11 |
||||
*/ |
||||
@Open |
||||
public interface MultiStyleUIConfigProvider extends Mutable { |
||||
String XML_TAG = "MultiStyleUIConfigProvider"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* 获取配置项list |
||||
* |
||||
* @return 配置项list |
||||
*/ |
||||
List<StyleUIConfigProvider> getConfigList(); |
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.base.Style; |
||||
import com.fr.common.annotations.Open; |
||||
import com.fr.stable.fun.mark.Mutable; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
/** |
||||
* Created by kerry on 2019-11-11 |
||||
*/ |
||||
@Open |
||||
public interface StyleUIConfigProvider extends Mutable { |
||||
String XML_TAG = "CustomStyleUIConfigProvider"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* @return 配置名 |
||||
*/ |
||||
String configName(); |
||||
|
||||
/** |
||||
* @param changeListener 需要添加的listener |
||||
* @return 对应的component |
||||
*/ |
||||
JComponent uiComponent(ChangeListener changeListener); |
||||
|
||||
/** |
||||
* @return 更新后的样式 |
||||
*/ |
||||
Style updateConfig(); |
||||
|
||||
/** |
||||
* @param style 待渲染的样式 |
||||
*/ |
||||
void populateConfig(Style style); |
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.fun.StyleUIConfigProvider; |
||||
import com.fr.design.fun.MultiStyleUIConfigProvider; |
||||
import com.fr.stable.fun.impl.AbstractProvider; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by kerry on 2019-11-11 |
||||
*/ |
||||
@API(level = MultiStyleUIConfigProvider.CURRENT_LEVEL) |
||||
public abstract class AbstractMultiStyleUIConfigProvider extends AbstractProvider implements MultiStyleUIConfigProvider { |
||||
@Override |
||||
public List<StyleUIConfigProvider> getConfigList() { |
||||
return new ArrayList<StyleUIConfigProvider>(); |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,41 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.base.Style; |
||||
import com.fr.design.fun.StyleUIConfigProvider; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.fun.impl.AbstractProvider; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
/** |
||||
* Created by kerry on 2019-11-11 |
||||
*/ |
||||
@API(level = StyleUIConfigProvider.CURRENT_LEVEL) |
||||
public class AbstractStyleUIConfigProvider extends AbstractProvider implements StyleUIConfigProvider { |
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
|
||||
@Override |
||||
public String configName() { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent uiComponent(ChangeListener changeListener) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Style updateConfig() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void populateConfig(Style style) { |
||||
|
||||
} |
||||
} |
@ -1 +1 @@
|
||||
package com.fr.design.gui.ibutton;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import javax.swing.*;
/**
* Author : Shockway
* Date: 13-10-21
* Time: 下午3:23
*/
public class UIPasswordField extends JPasswordField implements UIObserver {
public void registerChangeListener(UIObserverListener listener) {
}
public boolean shouldResponseChangeListener() {
return false;
}
} |
||||
package com.fr.design.gui.ibutton;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import javax.swing.*;
/**
* Author : Shockway
* Date: 13-10-21
* Time: 下午3:23
*/
public class UIPasswordField extends JPasswordField implements UIObserver {
public void registerChangeListener(UIObserverListener listener) {
// do nothing
}
public boolean shouldResponseChangeListener() {
return false;
}
} |
@ -1 +1 @@
|
||||
package com.fr.design.gui.ibutton;
import com.fr.design.constants.UIConstants;
import com.fr.stable.Constants;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* Author : daisy
* Date: 13-8-1
* Time: 下午3:41
*/
public class UIPreviewButton extends JPanel {
private static final int START_X = -7;
protected UIButton upButton;
protected UIButton downButton;
protected void upButtonClickEvent() {
}
protected void downButtonClickEvent() {
}
public UIPreviewButton() {
this(new UIButton(), new UIButton());
}
public UIPreviewButton(UIButton up, UIButton down) {
upButton = up;
downButton = down;
upButton.setRoundBorder(true, Constants.CENTER);
downButton.setRoundBorder(true, Constants.CENTER);
upButton.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
downButton.getModel().setPressed(true);
downButton.getModel().setSelected(true);
downButton.repaint();
}
@Override
public void mouseReleased(MouseEvent e) {
downButton.getModel().setPressed(false);
downButton.getModel().setSelected(false);
downButton.repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
upButtonClickEvent();
}
});
downButton.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
upButton.getModel().setPressed(true);
upButton.getModel().setSelected(true);
upButton.repaint();
}
@Override
public void mouseReleased(MouseEvent e) {
upButton.getModel().setPressed(false);
upButton.getModel().setSelected(false);
upButton.repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
downButtonClickEvent();
}
});
this.setLayout(new FlowLayout(FlowLayout.CENTER,5,0));
this.add(upButton);
this.add(downButton);
}
public UIPreviewButton(Icon left, Icon right) {
this();
upButton.setIcon(left);
downButton.setIcon(right);
}
public UIButton getUpButton() {
return upButton;
}
public void setExtraPainted(boolean isExtraPainted) {
if (!isExtraPainted) {
upButton.setBackground(null);
downButton.setBackground(null);
upButton.setOpaque(false);
downButton.setOpaque(false);
}
}
public UIButton getDownButton() {
return downButton;
}
public void set4Toolbar() {
upButton.setNormalPainted(false);
downButton.setNormalPainted(false);
upButton.setBorderPaintedOnlyWhenPressed(true);
downButton.setBorderPaintedOnlyWhenPressed(true);
}
protected void showPopWindow(JPopupMenu menu) {
GUICoreUtils.showPopupMenu(menu, this, START_X, getY() + getHeight() - 3);
}
public static void main(String... args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(null);
UIPreviewButton bb = new UIPreviewButton(UIConstants.PAGE_BIG_ICON, UIConstants.PREVIEW_DOWN);
bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height);
content.add(bb);
GUICoreUtils.centerWindow(jf);
jf.setSize(100, 100);
jf.setVisible(true);
}
} |
||||
package com.fr.design.gui.ibutton;
import com.fr.design.constants.UIConstants;
import com.fr.stable.Constants;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* Author : daisy
* Date: 13-8-1
* Time: 下午3:41
*/
public class UIPreviewButton extends JPanel {
private static final int START_X = -7;
protected UIButton upButton;
protected UIButton downButton;
protected void upButtonClickEvent() {
// do nothing
}
protected void downButtonClickEvent() {
// do nothing
}
public UIPreviewButton() {
this(new UIButton(), new UIButton());
}
public UIPreviewButton(UIButton up, UIButton down) {
upButton = up;
downButton = down;
upButton.setRoundBorder(true, Constants.CENTER);
downButton.setRoundBorder(true, Constants.CENTER);
upButton.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
downButton.getModel().setPressed(true);
downButton.getModel().setSelected(true);
downButton.repaint();
}
@Override
public void mouseReleased(MouseEvent e) {
downButton.getModel().setPressed(false);
downButton.getModel().setSelected(false);
downButton.repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
upButtonClickEvent();
}
});
downButton.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
upButton.getModel().setPressed(true);
upButton.getModel().setSelected(true);
upButton.repaint();
}
@Override
public void mouseReleased(MouseEvent e) {
upButton.getModel().setPressed(false);
upButton.getModel().setSelected(false);
upButton.repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
downButtonClickEvent();
}
});
this.setLayout(new FlowLayout(FlowLayout.CENTER,5,0));
this.add(upButton);
this.add(downButton);
}
public UIPreviewButton(Icon left, Icon right) {
this();
upButton.setIcon(left);
downButton.setIcon(right);
}
public UIButton getUpButton() {
return upButton;
}
public void setExtraPainted(boolean isExtraPainted) {
if (!isExtraPainted) {
upButton.setBackground(null);
downButton.setBackground(null);
upButton.setOpaque(false);
downButton.setOpaque(false);
}
}
public UIButton getDownButton() {
return downButton;
}
public void set4Toolbar() {
upButton.setNormalPainted(false);
downButton.setNormalPainted(false);
upButton.setBorderPaintedOnlyWhenPressed(true);
downButton.setBorderPaintedOnlyWhenPressed(true);
}
protected void showPopWindow(JPopupMenu menu) {
GUICoreUtils.showPopupMenu(menu, this, START_X, getY() + getHeight() - 3);
}
public static void main(String... args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(null);
UIPreviewButton bb = new UIPreviewButton(UIConstants.PAGE_BIG_ICON, UIConstants.PREVIEW_DOWN);
bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height);
content.add(bb);
GUICoreUtils.centerWindow(jf);
jf.setSize(100, 100);
jf.setVisible(true);
}
} |
@ -1,53 +0,0 @@
|
||||
package com.fr.design.gui.itextfield; |
||||
|
||||
import java.awt.Graphics; |
||||
|
||||
import javax.swing.plaf.metal.MetalTextFieldUI; |
||||
import javax.swing.text.JTextComponent; |
||||
|
||||
import de.muntjak.tinylookandfeel.Theme; |
||||
|
||||
public class TextFieldUI extends MetalTextFieldUI { |
||||
|
||||
|
||||
protected void paintBackground(Graphics g) { |
||||
JTextComponent editor = getComponent(); |
||||
// We will only be here if editor is opaque, so we don't have to test
|
||||
|
||||
if(editor.isEnabled()) { |
||||
if(editor.isEditable()) { |
||||
g.setColor(editor.getBackground()); |
||||
} |
||||
else { |
||||
// not editable
|
||||
if(editor.getBackground().equals(Theme.textBgColor[Theme.style].getColor())) { |
||||
// set default panel background
|
||||
g.setColor(Theme.backColor[Theme.style].getColor()); |
||||
} |
||||
else { |
||||
// color changed by user - set textfield background
|
||||
g.setColor(editor.getBackground()); |
||||
} |
||||
} |
||||
|
||||
g.fillRect(0, 0, editor.getWidth(), editor.getHeight()); |
||||
} |
||||
else { |
||||
if(editor.getBackground().equals(Theme.textBgColor[Theme.style].getColor())) { |
||||
g.setColor(Theme.textDisabledBgColor[Theme.style].getColor()); |
||||
} |
||||
else { |
||||
// color changed by user - set textfield background
|
||||
g.setColor(editor.getBackground()); |
||||
} |
||||
|
||||
g.fillRect(0, 0, editor.getWidth(), editor.getHeight()); |
||||
|
||||
if(Theme.style != Theme.YQ_STYLE) return; |
||||
|
||||
g.setColor(Theme.backColor[Theme.style].getColor()); |
||||
g.drawRect(1, 1, editor.getWidth() - 3, editor.getHeight() - 3); |
||||
g.drawRect(2, 2, editor.getWidth() - 5, editor.getHeight() - 5); |
||||
} |
||||
} |
||||
} |
@ -1,26 +1,95 @@
|
||||
package com.fr.design.utils; |
||||
|
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.general.ComparatorUtils; |
||||
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; |
||||
|
||||
/** |
||||
* 为的就是能替换 DesignPort.class 实现多开,因此避免编译器常量编译展开优化 |
||||
*/ |
||||
public class DesignerPort { |
||||
public class DesignerPort implements XMLReadable, XMLWriter { |
||||
|
||||
public static final String XML_TAG = "DesignerPort"; |
||||
private static final int MIN_PORT = 1024; |
||||
private static final int MAX_PORT = 65536; |
||||
|
||||
public static final DesignerPort INSTANCE = new DesignerPort(); |
||||
|
||||
public static DesignerPort getInstance() { |
||||
return INSTANCE; |
||||
} |
||||
|
||||
private DesignerPort() { |
||||
} |
||||
|
||||
/** |
||||
* 设计器端口,避免编译期常量优化展开 |
||||
* 设计器端口 |
||||
*/ |
||||
public static final int MESSAGE_PORT = getMessagePort(); |
||||
private int messagePort = 51462; |
||||
|
||||
/** |
||||
* 设计器端口,避免编译期常量优化展开 |
||||
* 设计器端口,debug模式下 |
||||
*/ |
||||
public static final int DEBUG_MESSAGE_PORT = getDebugMessagePort(); |
||||
private int debugMessagePort = 51463; |
||||
|
||||
public int getMessagePort() { |
||||
return messagePort; |
||||
} |
||||
|
||||
public int getDebugMessagePort() { |
||||
return debugMessagePort; |
||||
} |
||||
|
||||
private static int getMessagePort() { |
||||
return 51462; |
||||
public void setMessagePort(int messagePort) { |
||||
this.messagePort = messagePort; |
||||
} |
||||
|
||||
private static int getDebugMessagePort() { |
||||
return 51463; |
||||
public void setDebugMessagePort(int debugMessagePort) { |
||||
this.debugMessagePort = debugMessagePort; |
||||
} |
||||
|
||||
@Override |
||||
public void readXML(XMLableReader reader) { |
||||
if (reader.isAttr()) { |
||||
this.setMessagePort(reader.getAttrAsInt("messagePort", 51462)); |
||||
this.setDebugMessagePort(reader.getAttrAsInt("debugMessagePort", 51463)); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void writeXML(XMLPrintWriter writer) { |
||||
writer.startTAG(XML_TAG); |
||||
writer.attr("messagePort", this.messagePort); |
||||
writer.attr("debugMessagePort", this.debugMessagePort); |
||||
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(); |
||||
} |
||||
if (ComparatorUtils.equals("true", System.getProperty("debug"))) { |
||||
setDebugMessagePort(value); |
||||
} else { |
||||
setMessagePort(value); |
||||
} |
||||
return value; |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,97 @@
|
||||
package com.fr.design.write.submit; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
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.IOUtils; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.Icon; |
||||
import javax.swing.JDialog; |
||||
import javax.swing.JLabel; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.JTextArea; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.Frame; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @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; |
||||
|
||||
public CheckServiceDialog(Frame parent, String areaText, String localBranch, String remoteBranch){ |
||||
super(parent,true); |
||||
//上面的标签面板
|
||||
topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||
JPanel imagePanel = new JPanel(); |
||||
Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/warning4.png"); |
||||
|
||||
JLabel imageLabel = new JLabel(); |
||||
imageLabel.setIcon(icon); |
||||
imagePanel.add(imageLabel); |
||||
imagePanel.setPreferredSize(new Dimension(100,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)); |
||||
JLabel label3 = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Need_Update")); |
||||
label3.setPreferredSize(new Dimension(500,20)); |
||||
|
||||
verticalPanel.add(label); |
||||
verticalPanel.add(label2); |
||||
verticalPanel.add(label3); |
||||
|
||||
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); |
||||
|
||||
//下面的按钮面板
|
||||
UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm")); |
||||
JPanel buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
||||
buttonPanel.add(okButton); |
||||
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); |
||||
this.setSize(new Dimension(600, 500)); |
||||
|
||||
GUICoreUtils.centerWindow(this); |
||||
} |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
this.dispose(); |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue