package com.vci.client.workflow.editor.ui;
|
|
import java.awt.BorderLayout;
|
import java.awt.Component;
|
import java.awt.FlowLayout;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyEvent;
|
import java.text.DecimalFormat;
|
|
import javax.swing.ButtonGroup;
|
import javax.swing.JCheckBox;
|
import javax.swing.JFormattedTextField;
|
import javax.swing.JLabel;
|
import javax.swing.JPanel;
|
import javax.swing.JRadioButton;
|
import javax.swing.JTextField;
|
import javax.swing.border.TitledBorder;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import com.vci.client.workflow.editor.FlowConstants;
|
import com.vci.common.resource.CommonProperties;
|
|
/**
|
* 任务处理方式
|
* @author liudi
|
*
|
* 2012-7-12
|
*/
|
public class TaskTreatmentPanel extends JPanel {
|
private static final long serialVersionUID = 1300418480939892949L;
|
|
private JRadioButton radio1 = new JRadioButton("任意人处理");
|
private JRadioButton radio2 = new JRadioButton("所有人处理(一票否决)");
|
private JRadioButton radio3 = new JRadioButton("会签(投票决定)");
|
private JCheckBox popUserDialogCb = new JCheckBox("是否选择候选人");
|
private JCheckBox revokeCb = new JCheckBox("是否收回");
|
private JLabel label = new JLabel("会签通过比例(1~99)");
|
private JFormattedTextField text = new JFormattedTextField(new DecimalFormat("#0"));
|
// public final static String string = "com.vci.rmip.workflow.server.event.AssignTask";
|
public String string = CommonProperties.getStringProperty("workflow.AssignTask");
|
|
public JCheckBox getRevokeCb() {
|
return revokeCb;
|
}
|
|
public void setRevokeCb(JCheckBox revokeCb) {
|
this.revokeCb = revokeCb;
|
}
|
|
public JCheckBox getPopUserDialogCb() {
|
return popUserDialogCb;
|
}
|
|
public void setPopUserDialogCb(JCheckBox popUserDialogCb) {
|
this.popUserDialogCb = popUserDialogCb;
|
}
|
|
|
|
|
public JFormattedTextField getText() {
|
return text;
|
}
|
|
public void setText(JFormattedTextField text) {
|
this.text = text;
|
}
|
|
public JRadioButton getRadio1() {
|
return radio1;
|
}
|
|
public void setRadio1(JRadioButton radio1) {
|
this.radio1 = radio1;
|
}
|
|
public JRadioButton getRadio2() {
|
return radio2;
|
}
|
|
public void setRadio2(JRadioButton radio2) {
|
this.radio2 = radio2;
|
}
|
|
|
|
public JRadioButton getRadio3() {
|
return radio3;
|
}
|
|
public void setRadio3(JRadioButton radio3) {
|
this.radio3 = radio3;
|
}
|
|
|
|
private ButtonGroup bg = new ButtonGroup();
|
private JPanel assignPolicyPanel;
|
private JPanel controlPolicyPanel;
|
private JPanel revokelPolicyPanel;
|
|
private String attribute = "";
|
|
private long flag = 0;
|
private String popUserDialogONOFF;
|
private String revokeONOFF;
|
|
|
public String getRevokeONOFF() {
|
return revokeONOFF;
|
}
|
|
public void setRevokeONOFF(String revokeONOFF) {
|
this.revokeONOFF = revokeONOFF;
|
}
|
|
public String getPopUserDialogONOFF() {
|
return popUserDialogONOFF;
|
}
|
|
public void setPopUserDialogONOFF(String popUserDialogONOFF) {
|
this.popUserDialogONOFF = popUserDialogONOFF;
|
}
|
|
public long getFlag() {
|
return flag;
|
}
|
|
public void setFlag(long flag) {
|
this.flag = flag;
|
}
|
|
public String getAttribute() {
|
return attribute;
|
}
|
|
public void setAttribute(String attribute) {
|
this.attribute = attribute;
|
}
|
|
public TaskTreatmentPanel() {
|
initUI();
|
}
|
|
private void initUI() {
|
setLayout(new BorderLayout());
|
this.setPreferredSize(new java.awt.Dimension(278, 162));
|
|
JPanel panel = new JPanel();
|
this.add(panel, BorderLayout.WEST);
|
panel.setLayout(null);
|
panel.setPreferredSize(new java.awt.Dimension(750, 162));
|
this.radio1.setSelected(true);
|
bg.add(radio1);
|
bg.add(radio2);
|
bg.add(radio3);
|
{
|
assignPolicyPanel = new JPanel();
|
assignPolicyPanel.setBorder(new TitledBorder("控制策略"));
|
assignPolicyPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
|
controlPolicyPanel = new JPanel();
|
controlPolicyPanel.setBorder(new TitledBorder("候选人策略"));
|
panel.add(assignPolicyPanel);
|
assignPolicyPanel.setBounds(0, 0, 200, 150);
|
panel.add(controlPolicyPanel);
|
controlPolicyPanel.setBounds(200, 0, 127, 150);
|
assignPolicyPanel.add(radio1);
|
radio1.setPreferredSize(new java.awt.Dimension(100, 24));
|
radio1.setAlignmentX(Component.LEFT_ALIGNMENT);
|
assignPolicyPanel.add(radio2);
|
radio2.setAlignmentX(Component.LEFT_ALIGNMENT);
|
assignPolicyPanel.add(radio3);
|
radio3.setAlignmentX(Component.LEFT_ALIGNMENT);
|
assignPolicyPanel.add(label);
|
label.setAlignmentX(Component.LEFT_ALIGNMENT);
|
text.setAlignmentX(Component.RIGHT_ALIGNMENT);
|
|
//处理数字输入狂
|
text.setPreferredSize(new java.awt.Dimension(100, 20));
|
text.addKeyListener(new KeyAdapter() {
|
public void keyReleased(KeyEvent e){
|
String old = text.getText();
|
JFormattedTextField.AbstractFormatter formatter = text.getFormatter();
|
if(StringUtils.isNotBlank(old) && formatter !=null){
|
String str = text.getText();
|
Long page = 0L;
|
try{
|
page = (Long)formatter.stringToValue(str);
|
}catch(Exception ex){
|
page = 1L;
|
}
|
if(page< 1L){
|
page = 1L;
|
}
|
if(page > 99L){
|
page = 99L;
|
}
|
text.setText(page+"");
|
|
}
|
}
|
});
|
|
assignPolicyPanel.add(text);
|
controlPolicyPanel.add(popUserDialogCb);
|
revokelPolicyPanel = new JPanel();
|
revokelPolicyPanel.setBounds(300, 0, 127, 150);
|
revokelPolicyPanel.setBorder(new TitledBorder("收回策略"));
|
revokelPolicyPanel.add(revokeCb,BorderLayout.WEST);
|
panel.add(revokelPolicyPanel);
|
}
|
radio2.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent arg0) {
|
if(string==null||"".equals(string)){
|
string = "com.vci.rmip.workflow.server.event.AssignTask";
|
}
|
attribute = string;
|
flag=1;
|
}
|
});
|
radio1.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent arg0) {
|
attribute = "";
|
flag=0;
|
}
|
});
|
radio3.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent arg0) {
|
if(string==null||"".equals(string)){
|
string = "com.vci.rmip.workflow.server.event.AssignTask";
|
}
|
attribute = string;
|
flag=1;
|
}
|
});
|
popUserDialogCb.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
if(popUserDialogCb.isSelected()){
|
popUserDialogONOFF = FlowConstants.POPUSERDIALOG_ON;
|
}else{
|
popUserDialogONOFF = FlowConstants.POPUSERDIALOG_OFF;
|
}
|
}
|
});
|
revokeCb.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
if(revokeCb.isSelected()){
|
revokeONOFF = FlowConstants.REVOKE_ON;
|
}else{
|
revokeONOFF = FlowConstants.REVOKE_OFF;
|
}
|
}
|
});
|
|
}
|
}
|