forked from fanruan/design
Browse Source
* commit 'c25daaf9f12a30c2ae2751f29ab72de191c5de2d': (26 commits) KERNEL-7634 gradle 依赖问题 REPORT-53695 设计器在未激活情况下弹出登录引导页面 REPORT-53626 设计器启动异常 REPORT-53674 已登录工程升级到最新版本jar后仍会有登录提醒 登录面板不显示 REPORT-51958 远程环境检测及同步 REPORT-51958 远程环境检测及同步 REPORT-51958 远程环境检测及同步 REPORT-51958 远程环境检测及同步 REPORT-53367 复制传参后sql-远程下,新增的转义字符提示失效 REPORT-53601 & REPORT-53614 结果文本框框设置不可编辑。进度条更新设置 REPORT-53601 & REPORT-53614 结果文本框框设置不可编辑。进度条更新设置 REPORT-53157 值一样 对象地址不一样的对象同样需要被返回处理 REPORT-53592 扩展图表创建共享组件npe问题 REPORT-53362 复制传参后sql-鼠标悬浮查看设计器面板,会多出来查看执行sql的界面 REPORT-53367 复制传参后sql-远程下,新增的转义字符提示失效 REPORT-53367 复制传参后sql-远程下,新增的转义字符提示失效 REPORT-52539 window上生成面板出现了滚动条 REPORT-53133 组件复用-合入主版本-有俩商城下载下来的复用组件,拖入后组件树处没显示复用组件的图标,麻烦看下是这俩组件结构有啥问题嘛 REPORT-53135 漏交 ...persist/11.0
superman
4 years ago
34 changed files with 428 additions and 144 deletions
@ -0,0 +1,176 @@ |
|||||||
|
package com.fr.design.dialog; |
||||||
|
|
||||||
|
|
||||||
|
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 java.awt.BorderLayout; |
||||||
|
import java.awt.Color; |
||||||
|
import java.awt.Dimension; |
||||||
|
import java.awt.Frame; |
||||||
|
import java.awt.event.MouseAdapter; |
||||||
|
import java.awt.event.MouseEvent; |
||||||
|
import java.awt.event.MouseListener; |
||||||
|
import javax.swing.BorderFactory; |
||||||
|
import javax.swing.Icon; |
||||||
|
import javax.swing.JDialog; |
||||||
|
import javax.swing.JPanel; |
||||||
|
import javax.swing.JScrollPane; |
||||||
|
import javax.swing.ScrollPaneConstants; |
||||||
|
import javax.swing.UIManager; |
||||||
|
|
||||||
|
/** |
||||||
|
* 带查看详情的简要通知框 |
||||||
|
* |
||||||
|
*/ |
||||||
|
public class NotificationDialog extends JDialog { |
||||||
|
public static final int ERROR_MESSAGE = 0; |
||||||
|
public static final int NEW_MESSAGE = 1; |
||||||
|
public static final int WARNING_MESSAGE = 2; |
||||||
|
public static final String HTML_TAG_1 = "<html>"; |
||||||
|
public static final String HTML_TAG_2 = "</html>"; |
||||||
|
private UILabel messageText; |
||||||
|
private NotificationDialogAction notificationDialogAction; |
||||||
|
|
||||||
|
public NotificationDialog(Frame owner, String title, boolean isModal, int messageType, String message,NotificationDialogAction action) { |
||||||
|
super(owner); |
||||||
|
setTitle(title); |
||||||
|
initComponents(messageType, message, isModal,action); |
||||||
|
} |
||||||
|
|
||||||
|
public NotificationDialog(Builder builder) { |
||||||
|
super(builder.owner); |
||||||
|
setTitle(builder.title); |
||||||
|
initComponents(builder.messageType, builder.message, builder.modal, builder.action); |
||||||
|
} |
||||||
|
|
||||||
|
public void initComponents(int messageType, String message, boolean isModal,NotificationDialogAction action) { |
||||||
|
notificationDialogAction = action; |
||||||
|
setModal(isModal); |
||||||
|
setResizable(false); |
||||||
|
|
||||||
|
//消息内容
|
||||||
|
UILabel icon = new UILabel(getIconForType(messageType)); |
||||||
|
JPanel iconPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||||
|
iconPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 8)); |
||||||
|
iconPanel.add(icon); |
||||||
|
add(iconPanel, BorderLayout.WEST); |
||||||
|
|
||||||
|
messageText = new UILabel(HTML_TAG_1 + message + HTML_TAG_2); |
||||||
|
messageText.setForeground(new Color(51, 51, 52)); |
||||||
|
JPanel centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||||
|
centerPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 10)); |
||||||
|
JScrollPane jScrollPane = new JScrollPane(messageText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
||||||
|
jScrollPane.setBorder(BorderFactory.createEmptyBorder()); |
||||||
|
centerPanel.add(jScrollPane, BorderLayout.CENTER); |
||||||
|
add(centerPanel, BorderLayout.CENTER); |
||||||
|
|
||||||
|
//查看详情
|
||||||
|
UILabel detailLabel = new UILabel(); |
||||||
|
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail")); |
||||||
|
detailLabel.setForeground(Color.BLUE); |
||||||
|
JPanel detailPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||||
|
detailPanel.add(detailLabel, BorderLayout.EAST); |
||||||
|
add(detailPanel, BorderLayout.SOUTH); |
||||||
|
setPreferredSize(new Dimension(262, 135)); |
||||||
|
|
||||||
|
detailLabel.addMouseListener(detailClickListener); |
||||||
|
messageText.addMouseListener(detailClickListener); |
||||||
|
|
||||||
|
pack(); |
||||||
|
if (getOwner() != null) { |
||||||
|
GUICoreUtils.setWindowCenter(getOwner(), this); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private MouseListener detailClickListener = new MouseAdapter() { |
||||||
|
@Override |
||||||
|
public void mouseClicked(MouseEvent e) { |
||||||
|
if(notificationDialogAction != null){ |
||||||
|
hideDialog(); |
||||||
|
notificationDialogAction.doClick(); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 设置通知消息 |
||||||
|
*/ |
||||||
|
public void setMessage(String message){ |
||||||
|
messageText.setText(HTML_TAG_1 + message + HTML_TAG_2); |
||||||
|
} |
||||||
|
|
||||||
|
private void hideDialog(){ |
||||||
|
this.dispose(); |
||||||
|
} |
||||||
|
|
||||||
|
protected Icon getIconForType(int messageType) { |
||||||
|
String propertyName; |
||||||
|
switch (messageType) { |
||||||
|
case 0: |
||||||
|
propertyName = "OptionPane.circularErrorIcon"; |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
propertyName = "OptionPane.newMessageIcon"; |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
propertyName = "OptionPane.warningIcon"; |
||||||
|
break; |
||||||
|
default: |
||||||
|
return null; |
||||||
|
} |
||||||
|
return UIManager.getIcon(propertyName); |
||||||
|
} |
||||||
|
|
||||||
|
public static Builder Builder() { |
||||||
|
return new NotificationDialog.Builder(); |
||||||
|
} |
||||||
|
|
||||||
|
public static final class Builder { |
||||||
|
public int messageType = WARNING_MESSAGE; |
||||||
|
public String message; |
||||||
|
public boolean modal = true; |
||||||
|
public Frame owner = null; |
||||||
|
public String title; |
||||||
|
public NotificationDialogAction action; |
||||||
|
private Builder() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public NotificationDialog build() { |
||||||
|
return new NotificationDialog(this); |
||||||
|
} |
||||||
|
|
||||||
|
public Builder owner(Frame owner) { |
||||||
|
this.owner = owner; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder messageType(int messageType) { |
||||||
|
this.messageType = messageType; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder message(String message) { |
||||||
|
this.message = message; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder modal(boolean modal) { |
||||||
|
this.modal = modal; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder title(String title) { |
||||||
|
this.title = title; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder notificationDialogAction(NotificationDialogAction action) { |
||||||
|
this.action = action; |
||||||
|
return this; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,5 @@ |
|||||||
|
package com.fr.design.dialog; |
||||||
|
|
||||||
|
public interface NotificationDialogAction { |
||||||
|
void doClick(); |
||||||
|
} |
After Width: | Height: | Size: 346 B |
After Width: | Height: | Size: 345 B |
After Width: | Height: | Size: 423 B |
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue