📄 sendmsgdialog.java
字号:
package com.cownew.PIS.base.msgCenter.client;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JToolBar;
import javax.swing.SwingConstants;
import com.cownew.PIS.base.permission.common.IUserDAO;
import com.cownew.PIS.base.permission.common.UserInfo;
import com.cownew.PIS.framework.client.RemoteServiceLocator;
import com.cownew.PIS.framework.common.msgMgr.IMessageService;
import com.cownew.PIS.ui.base.UIPanel;
import com.cownew.PIS.ui.ctrl.prompt.OVPicker.PopupValueObjectPicker;
import com.cownew.PIS.ui.utils.PISAbstractAction;
import com.cownew.ctk.ui.swing.MsgBox;
public class SendMsgDialog extends UIPanel
{
private JPanel jPanel = null;
private JPanel jPanel1 = null;
private JScrollPane jScrollPane = null;
private JTextArea txtBody = null;
private JLabel jLabel = null;
private JTextField txtTitle = null;
protected ActionSend actionSend;
private PopupValueObjectPicker pdpReceiver = null;
public SendMsgDialog() throws Exception
{
super();
initialize();
}
/**
* This method initializes this
*
*/
protected void initialize() {
super.initialize();
this.setLayout(new BorderLayout());
this.setSize(new Dimension(504, 189));
this.add(getJPanel(), BorderLayout.NORTH);
this.add(getJPanel1(), BorderLayout.CENTER);
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel()
{
if (jPanel == null)
{
jLabel = new JLabel();
jLabel.setText("标题");
jLabel.setHorizontalAlignment(SwingConstants.CENTER);
jLabel.setHorizontalTextPosition(SwingConstants.CENTER);
jLabel.setPreferredSize(new Dimension(50, 16));
jPanel = new JPanel();
jPanel.setLayout(new BorderLayout());
jPanel.setPreferredSize(new Dimension(100,30));
jPanel.add(jLabel, BorderLayout.WEST);
jPanel.add(getTxtTitle(), BorderLayout.CENTER);
jPanel.add(getPdpReceiver(), BorderLayout.EAST);
}
return jPanel;
}
/**
* This method initializes jPanel1
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel1()
{
if (jPanel1 == null)
{
jPanel1 = new JPanel();
jPanel1.setLayout(new BorderLayout());
jPanel1.add(getJScrollPane(), BorderLayout.CENTER);
}
return jPanel1;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane()
{
if (jScrollPane == null)
{
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getTxtBody());
}
return jScrollPane;
}
/**
* This method initializes txtBody
*
* @return javax.swing.JTextArea
*/
private JTextArea getTxtBody()
{
if (txtBody == null)
{
txtBody = new JTextArea();
}
return txtBody;
}
/**
* This method initializes txtTitle
*
* @return javax.swing.JTextField
*/
private JTextField getTxtTitle()
{
if (txtTitle == null)
{
txtTitle = new JTextField();
}
return txtTitle;
}
protected void initAction()
{
super.initAction();
actionSend = new ActionSend("发送");
}
public JToolBar getToolBar()
{
JToolBar toolBar = new JToolBar();
JButton btnSend = new JButton(actionSend);
toolBar.add(btnSend);
return toolBar;
}
protected void actionSend_Performed(ActionEvent e)
{
IMessageService msgService = (IMessageService) RemoteServiceLocator
.getRemoteService(IMessageService.class);
String title = getTxtTitle().getText();
String body = getTxtBody().getText();
UserInfo receiver = (UserInfo) getPdpReceiver().getValueObject();
msgService.sendMessage(title, body, receiver.getId());
MsgBox.showInfo(this, "发送成功!");
new MessageListenTask().run();
}
protected class ActionSend extends PISAbstractAction
{
public ActionSend(String name, Icon icon)
{
super(name, icon);
}
public ActionSend(String name)
{
super(name);
}
public void onActionPerformed(ActionEvent e) throws Exception
{
actionSend_Performed(e);
}
}
/**
* This method initializes pdpReceiver
*
* @return com.cownew.PIS.ui.ctrl.prompt.OVPicker.PopupValueObjectPicker
*/
private PopupValueObjectPicker getPdpReceiver()
{
if (pdpReceiver == null)
{
pdpReceiver = new PopupValueObjectPicker(IUserDAO.class);
pdpReceiver.setDisplayProperty("number");
}
return pdpReceiver;
}
} // @jve:decl-index=0:visual-constraint="10,10"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -