package com.vci.client.portal.NewUI;
|
|
import java.awt.BorderLayout;
|
import java.awt.FlowLayout;
|
import java.awt.GridBagConstraints;
|
import java.awt.GridBagLayout;
|
import java.awt.Insets;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
|
import javax.swing.ButtonGroup;
|
import javax.swing.JButton;
|
import javax.swing.JCheckBox;
|
import javax.swing.JLabel;
|
import javax.swing.JPanel;
|
import javax.swing.JRadioButton;
|
import javax.swing.JTextField;
|
import javax.swing.border.EmptyBorder;
|
|
import com.vci.client.LogonApplication;
|
import com.vci.client.portal.utility.PLDefination;
|
import com.vci.client.portal.utility.UITools;
|
import com.vci.client.ui.swing.VCIOptionPane;
|
import com.vci.common.portal.constants.TemplateTypeConstants;
|
import com.vci.common.qt.object.QTConstants;
|
import com.vci.common.utility.ObjectUtility;
|
import com.vci.corba.common.VCIError;
|
import com.vci.corba.portal.data.PLPageDefination;
|
import com.vci.corba.portal.data.PLUILayout;
|
|
/**
|
* 树设置
|
* @author liudi
|
*
|
*/
|
public class TreeSetPanel extends JPanel {
|
|
private final JPanel contentPanel = new JPanel();
|
|
private JButton okButton;
|
private JButton cancelButton;
|
private JLabel label_1;
|
private JRadioButton graduallyRad;
|
private JRadioButton allRad;
|
private ButtonGroup expandBg = new ButtonGroup();
|
private ButtonGroup orientationBg= new ButtonGroup();
|
private JCheckBox isShowImage;
|
private JLabel label_4;
|
private JTextField validityTxt;
|
private JPanel panel;
|
private JButton btnSet;
|
private JButton delBtn;
|
private PLUILayout plpagelayoutdefination;
|
private JLabel lblNewLabel;
|
private JTextField separatorTxt;
|
private JLabel label_5;
|
private JTextField linkTypeTxt;
|
private JLabel label;
|
private JPanel panel_2;
|
private JRadioButton zhengRad;
|
private JRadioButton fanRad;
|
private JLabel lblNewLabel_1;
|
private JTextField showTypeTxt;
|
private JLabel label_2;
|
private JTextField showAbsTxt;
|
private JLabel lbllink;
|
private JTextField showLinkAbsTxt;
|
private PLDefination pldefination;
|
private String plPageDefinationID;
|
private String btmName;
|
private Integer templateType = TemplateTypeConstants.TREE;
|
private NavigationDialog navigationDialog;
|
private static String buttonArea = "navigatorTree";
|
/**
|
* Create the dialog.
|
*/
|
public TreeSetPanel(PLUILayout plpagelayoutdefination,String btmName,NavigationDialog navigationDialog) {
|
this.plpagelayoutdefination = plpagelayoutdefination;
|
this.btmName = btmName;
|
this.navigationDialog = navigationDialog;
|
init();
|
actionListener();
|
initData();
|
this.setVisible(true);
|
}
|
|
private void init() {
|
setBounds(100, 100, 450, 345);
|
setLayout(new BorderLayout());
|
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
add(contentPanel, BorderLayout.CENTER);
|
GridBagLayout gbl_contentPanel = new GridBagLayout();
|
gbl_contentPanel.columnWidths = new int[]{0, 0, 0, 0, 0};
|
gbl_contentPanel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0};
|
gbl_contentPanel.columnWeights = new double[]{0.0, 1.0, 1.0, 0.0, Double.MIN_VALUE};
|
gbl_contentPanel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
|
contentPanel.setLayout(gbl_contentPanel);
|
{
|
lblNewLabel_1 = new JLabel("显示类型");
|
GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
|
gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5);
|
gbc_lblNewLabel_1.gridx = 1;
|
gbc_lblNewLabel_1.gridy = 0;
|
contentPanel.add(lblNewLabel_1, gbc_lblNewLabel_1);
|
}
|
{
|
showTypeTxt = new JTextField();
|
GridBagConstraints gbc_showTypeTxt = new GridBagConstraints();
|
gbc_showTypeTxt.insets = new Insets(0, 0, 5, 5);
|
gbc_showTypeTxt.fill = GridBagConstraints.HORIZONTAL;
|
gbc_showTypeTxt.gridx = 2;
|
gbc_showTypeTxt.gridy = 0;
|
contentPanel.add(showTypeTxt, gbc_showTypeTxt);
|
showTypeTxt.setColumns(10);
|
}
|
{
|
label_1 = new JLabel("展开方式");
|
GridBagConstraints gbc_label_1 = new GridBagConstraints();
|
gbc_label_1.insets = new Insets(0, 0, 5, 5);
|
gbc_label_1.gridx = 1;
|
gbc_label_1.gridy = 1;
|
contentPanel.add(label_1, gbc_label_1);
|
}
|
{
|
panel = new JPanel();
|
FlowLayout flowLayout = (FlowLayout) panel.getLayout();
|
flowLayout.setAlignment(FlowLayout.LEFT);
|
GridBagConstraints gbc_panel = new GridBagConstraints();
|
gbc_panel.insets = new Insets(0, 0, 5, 5);
|
gbc_panel.fill = GridBagConstraints.BOTH;
|
gbc_panel.gridx = 2;
|
gbc_panel.gridy = 1;
|
contentPanel.add(panel, gbc_panel);
|
graduallyRad = new JRadioButton("逐级展开");
|
graduallyRad.setSelected(true);
|
panel.add(graduallyRad);
|
expandBg.add(graduallyRad);
|
{
|
|
allRad = new JRadioButton("全部展开");
|
panel.add(allRad);
|
expandBg.add(allRad);
|
}
|
}
|
{
|
label = new JLabel("展开方向");
|
GridBagConstraints gbc_label = new GridBagConstraints();
|
gbc_label.insets = new Insets(0, 0, 5, 5);
|
gbc_label.gridx = 1;
|
gbc_label.gridy = 2;
|
contentPanel.add(label, gbc_label);
|
}
|
{
|
panel_2 = new JPanel();
|
FlowLayout flowLayout = (FlowLayout) panel_2.getLayout();
|
flowLayout.setAlignment(FlowLayout.LEFT);
|
GridBagConstraints gbc_panel_2 = new GridBagConstraints();
|
gbc_panel_2.insets = new Insets(0, 0, 5, 5);
|
gbc_panel_2.fill = GridBagConstraints.BOTH;
|
gbc_panel_2.gridx = 2;
|
gbc_panel_2.gridy = 2;
|
contentPanel.add(panel_2, gbc_panel_2);
|
{
|
zhengRad = new JRadioButton("正向");
|
zhengRad.setSelected(true);
|
panel_2.add(zhengRad);
|
fanRad = new JRadioButton("反向");
|
panel_2.add(fanRad);
|
orientationBg.add(zhengRad);
|
orientationBg.add(fanRad);
|
}
|
{
|
isShowImage = new JCheckBox("显示图标");
|
panel_2.add(isShowImage);
|
}
|
}
|
{
|
lbllink = new JLabel("显示link属性");
|
GridBagConstraints gbc_lbllink = new GridBagConstraints();
|
gbc_lbllink.insets = new Insets(0, 0, 5, 5);
|
gbc_lbllink.gridx = 1;
|
gbc_lbllink.gridy = 3;
|
contentPanel.add(lbllink, gbc_lbllink);
|
}
|
{
|
showLinkAbsTxt = new JTextField();
|
GridBagConstraints gbc_showLinkAbsTxt = new GridBagConstraints();
|
gbc_showLinkAbsTxt.insets = new Insets(0, 0, 5, 5);
|
gbc_showLinkAbsTxt.fill = GridBagConstraints.HORIZONTAL;
|
gbc_showLinkAbsTxt.gridx = 2;
|
gbc_showLinkAbsTxt.gridy = 3;
|
contentPanel.add(showLinkAbsTxt, gbc_showLinkAbsTxt);
|
showLinkAbsTxt.setColumns(10);
|
}
|
{
|
label_4 = new JLabel("有效性");
|
GridBagConstraints gbc_label_4 = new GridBagConstraints();
|
gbc_label_4.insets = new Insets(0, 0, 5, 5);
|
gbc_label_4.gridx = 1;
|
gbc_label_4.gridy = 4;
|
contentPanel.add(label_4, gbc_label_4);
|
}
|
{
|
validityTxt = new JTextField();
|
GridBagConstraints gbc_validityTxt = new GridBagConstraints();
|
gbc_validityTxt.insets = new Insets(0, 0, 5, 5);
|
gbc_validityTxt.fill = GridBagConstraints.HORIZONTAL;
|
gbc_validityTxt.gridx = 2;
|
gbc_validityTxt.gridy = 4;
|
contentPanel.add(validityTxt, gbc_validityTxt);
|
validityTxt.setColumns(10);
|
}
|
{
|
label_2 = new JLabel("显示属性");
|
GridBagConstraints gbc_label_2 = new GridBagConstraints();
|
gbc_label_2.insets = new Insets(0, 0, 5, 5);
|
gbc_label_2.gridx = 1;
|
gbc_label_2.gridy = 5;
|
contentPanel.add(label_2, gbc_label_2);
|
}
|
{
|
showAbsTxt = new JTextField();
|
GridBagConstraints gbc_showAbsTxt = new GridBagConstraints();
|
gbc_showAbsTxt.insets = new Insets(0, 0, 5, 5);
|
gbc_showAbsTxt.fill = GridBagConstraints.HORIZONTAL;
|
gbc_showAbsTxt.gridx = 2;
|
gbc_showAbsTxt.gridy = 5;
|
contentPanel.add(showAbsTxt, gbc_showAbsTxt);
|
showAbsTxt.setColumns(10);
|
}
|
{
|
lblNewLabel = new JLabel("分隔符");
|
GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
|
gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
|
gbc_lblNewLabel.gridx = 1;
|
gbc_lblNewLabel.gridy = 6;
|
contentPanel.add(lblNewLabel, gbc_lblNewLabel);
|
}
|
{
|
separatorTxt = new JTextField();
|
GridBagConstraints gbc_separatorTxt = new GridBagConstraints();
|
gbc_separatorTxt.insets = new Insets(0, 0, 5, 5);
|
gbc_separatorTxt.fill = GridBagConstraints.HORIZONTAL;
|
gbc_separatorTxt.gridx = 2;
|
gbc_separatorTxt.gridy = 6;
|
contentPanel.add(separatorTxt, gbc_separatorTxt);
|
separatorTxt.setColumns(10);
|
}
|
{
|
label_5 = new JLabel("链接类型");
|
GridBagConstraints gbc_label_5 = new GridBagConstraints();
|
gbc_label_5.insets = new Insets(0, 0, 0, 5);
|
gbc_label_5.gridx = 1;
|
gbc_label_5.gridy = 7;
|
contentPanel.add(label_5, gbc_label_5);
|
}
|
{
|
linkTypeTxt = new JTextField();
|
GridBagConstraints gbc_linkTypeTxt = new GridBagConstraints();
|
gbc_linkTypeTxt.insets = new Insets(0, 0, 0, 5);
|
gbc_linkTypeTxt.fill = GridBagConstraints.HORIZONTAL;
|
gbc_linkTypeTxt.gridx = 2;
|
gbc_linkTypeTxt.gridy = 7;
|
contentPanel.add(linkTypeTxt, gbc_linkTypeTxt);
|
linkTypeTxt.setColumns(10);
|
}
|
{
|
JPanel buttonPane = new JPanel();
|
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
|
add(buttonPane, BorderLayout.SOUTH);
|
{
|
btnSet = new JButton("按钮设计");
|
buttonPane.add(btnSet);
|
}
|
{
|
delBtn = new JButton("删除");
|
buttonPane.add(delBtn);
|
}
|
{
|
okButton = new JButton("保存");
|
buttonPane.add(okButton);
|
}
|
{
|
cancelButton = new JButton("关闭");
|
buttonPane.add(cancelButton);
|
}
|
}
|
}
|
|
private void actionListener(){
|
btnSet.addActionListener(new ActionListener() {
|
|
@Override
|
public void actionPerformed(ActionEvent arg0) {
|
ButtonDialog dialog = new ButtonDialog(null,plpagelayoutdefination,buttonArea);
|
}
|
});
|
delBtn.addActionListener(new ActionListener() {
|
|
@Override
|
public void actionPerformed(ActionEvent arg0) {
|
PLPageDefination plPageDefination = new PLPageDefination();
|
plPageDefination.plOId = plPageDefinationID;
|
try {
|
if (VCIOptionPane.showQuestion(LogonApplication.frame,
|
"确定要删除记录吗?") != 0) {
|
return;
|
}
|
boolean flag = UITools.getService().deletePLPageDefination(plPageDefination);
|
} catch (VCIError e) {
|
e.printStackTrace();
|
}
|
|
}
|
});
|
okButton.addActionListener(new ActionListener() {
|
|
@Override
|
public void actionPerformed(ActionEvent arg0) {
|
if(pldefination!=null){
|
edit();
|
}else{
|
save();
|
}
|
// navigationDialog.dispose();
|
}
|
|
private void edit() {
|
PLPageDefination plPageDefination = new PLPageDefination();
|
plPageDefination.plOId = plPageDefinationID;
|
plPageDefination.plTabPageOId = plpagelayoutdefination.plOId;
|
plPageDefination.plType=1;
|
PLDefination obj = new PLDefination();
|
obj.setType(templateType);
|
obj.setShowType(showTypeTxt.getText());
|
if(zhengRad.isSelected()){
|
obj.setOrientation(QTConstants.DIRECTION_POSITIVE);
|
}
|
if(fanRad.isSelected()){
|
obj.setOrientation(QTConstants.DIRECTION_OPPOSITE);
|
}
|
obj.setShowAbs(showAbsTxt.getText());
|
obj.setSeparator(separatorTxt.getText());
|
//逐级展开:1、全部展开:0
|
if(graduallyRad.isSelected()){
|
obj.setExpandMode("1");
|
}
|
|
if(allRad.isSelected()){
|
obj.setExpandMode("0");
|
}
|
obj.setLinkType(linkTypeTxt.getText());
|
obj.setValidity(validityTxt.getText());
|
obj.setShowLinkAbs(showLinkAbsTxt.getText());
|
if(isShowImage.isSelected()){
|
obj.setIsShowImage("1");
|
}else{
|
obj.setIsShowImage("0");
|
}
|
try {
|
plPageDefination.plDefination = UITools.getPLDefinationText(obj);
|
boolean flag = UITools.getService().updatePLPageDefination(plPageDefination);
|
} catch (Throwable e) {
|
e.printStackTrace();
|
}
|
}
|
|
private void save() {
|
PLPageDefination plPageDefination = new PLPageDefination();
|
plPageDefination.plOId = ObjectUtility.getNewObjectID36();
|
plPageDefination.plTabPageOId = plpagelayoutdefination.plOId;
|
plPageDefination.plType=1;
|
PLDefination obj = new PLDefination();
|
obj.setType(templateType);
|
obj.setShowType(showTypeTxt.getText());
|
if(zhengRad.isSelected()){
|
obj.setOrientation(QTConstants.DIRECTION_POSITIVE);
|
}
|
if(fanRad.isSelected()){
|
obj.setOrientation(QTConstants.DIRECTION_OPPOSITE);
|
}
|
obj.setShowAbs(showAbsTxt.getText());
|
obj.setSeparator(separatorTxt.getText());
|
//逐级展开:1、全部展开:0
|
if(graduallyRad.isSelected()){
|
obj.setExpandMode("1");
|
}
|
|
if(allRad.isSelected()){
|
obj.setExpandMode("0");
|
}
|
obj.setLinkType(linkTypeTxt.getText());
|
obj.setValidity(validityTxt.getText());
|
obj.setShowLinkAbs(showLinkAbsTxt.getText());
|
if(isShowImage.isSelected()){
|
obj.setIsShowImage("1");
|
}else{
|
obj.setIsShowImage("0");
|
}
|
try {
|
plPageDefination.plDefination = UITools.getPLDefinationText(obj);
|
boolean flag = UITools.getService().savePLPageDefination(plPageDefination);
|
} catch (Throwable e) {
|
e.printStackTrace();
|
}
|
}
|
|
});
|
cancelButton.addActionListener(new ActionListener() {
|
|
@Override
|
public void actionPerformed(ActionEvent arg0) {
|
navigationDialog.dispose();
|
}
|
});
|
}
|
|
private void initData(){
|
PLPageDefination[] obj;
|
PLDefination p ;
|
try {
|
obj = UITools.getService().getPLPageDefinationsByPageContextOId(plpagelayoutdefination.plOId);
|
for(int i=0;i<obj.length;i++){
|
if(obj[i].plType==templateType){
|
plPageDefinationID = obj[i].plOId;
|
p = UITools.getPLDefination(obj[i].plDefination);
|
|
showTypeTxt.setText(p.getShowType());
|
if(p.getOrientation().equals(QTConstants.DIRECTION_POSITIVE)){
|
zhengRad.setSelected(true);
|
}
|
if(p.getOrientation().equals(QTConstants.DIRECTION_OPPOSITE)){
|
fanRad.setSelected(true);
|
}
|
showAbsTxt.setText(p.getShowAbs());
|
separatorTxt.setText(p.getSeparator());
|
if(p.getExpandMode().equals("1")){
|
graduallyRad.setSelected(true);
|
}
|
if(p.getExpandMode().equals("0")){
|
allRad.setSelected(true);
|
}
|
linkTypeTxt.setText(p.getLinkType());
|
validityTxt.setText(p.getValidity());
|
showLinkAbsTxt.setText(p.getShowLinkAbs());
|
if(p.getIsShowImage().equals("1")){
|
isShowImage.setSelected(true);
|
}
|
this.pldefination = p;
|
}
|
}
|
} catch (VCIError e) {
|
e.printStackTrace();
|
} catch (Throwable e) {
|
e.printStackTrace();
|
}
|
}
|
}
|