tabcol2_btn3_panel.java

来自「导出ORACLE数据库对象DDL语句的程序」· Java 代码 · 共 840 行 · 第 1/2 页

JAVA
840
字号
package com.icbcsdc.ddlexp.ui.rightPanel;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.border.Border;
import javax.swing.table.TableColumn;

import com.icbcsdc.ddlexp.pub.staticLog.Logger;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLArrayType;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLArrayTypes;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLConstraint;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLConstraints;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLFunction;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLFunctions;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLIndex;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLIndexes;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLObjectType;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLObjectTypes;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLPackage;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLPackageBodies;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLPackageBody;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLPackages;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLProcedure;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLProcedures;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLRole;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLRoles;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLSchema;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLSchemas;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLSequence;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLSequences;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLSynonym;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLSynonyms;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLTable;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLTableType;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLTableTypes;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLTables;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLTablespace;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLTablespaces;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLTrigger;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLTriggers;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLUndoSeg;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLUndoSegs;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLUser;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLUsers;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLView;
import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLViews;
import com.icbcsdc.ddlexp.ui.GlobalParameters;
import com.icbcsdc.ddlexp.ui.TreeFrame;
import com.icbcsdc.ddlexp.ui.model.Col2_Sel1_TableModel;


/**
 *右边的显示界面
 *
 *适用情况:
 *界面只有一个表,表只有两列,其中一列为可选列;
 *界面有三个按钮:一个为“确定”按钮,一个为“全部选择”按钮,一个为“清除选择”按钮。
 *
 *适用对象:
 */
public class TabCol2_Btn3_Panel extends RightPanel {
  private BorderLayout borderLayout = new BorderLayout();

  private JLabel labelTitle = new JLabel();
  private JLabel labelDesc = new JLabel();
  private String showTitle = "";
  private String showDesc = "";

  private JScrollPane jScrollPane = new JScrollPane();
  private JButton button_Export = new JButton();
  private JButton button_AllSelect = new JButton();
  private JButton button_ClearSelect = new JButton();
  
  private JTable jTable_Show = new JTable();		//显示内容的Table
  private String[] ColumnName = new String[2];		//Table列的列头
  private Col2_Sel1_TableModel tableModel = null;	//Table Model
  private static final byte COL_OBJECT = 0;
  private static final byte COL_ISSELECTED = 1;
  
  private Border border;
  private JPanel contentPane = new JPanel();
  
  private int selctNodeType;			//用户选择的Node的类型
  private Hashtable children = null;	//需要显示的内容
  private ArrayList showArr = new ArrayList();
  private Enumeration enumeration = null;
  Object[][] showObj=null;

  public TabCol2_Btn3_Panel(TreeFrame parent,XMLNode in_node) {
      super(parent,in_node);
      this.selctNodeType = in_node.getType();
      
      //根据用户选择Node的不同,设置不同的界面显示内容
      switch(this.selctNodeType){
      case(XMLNode.XML_ROLES):
      	/*角色*/
        this.children= ((XMLRoles)in_node).getDirectChildren(XMLNode.XML_ROLE);
  		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLRole role = (XMLRole)enumeration.nextElement();
	    		this.showArr.add(role.getName());
    			this.showArr.add(new Boolean(role.isSelected()));
	    	}
  		}
      	this.showTitle = "Roles";
      	this.showDesc = "Pelese select from the under table:";
      	this.ColumnName[COL_OBJECT] = "Role Name";
      	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;
      	
      case(XMLNode.XML_USERS):
      	/*用户*/
        this.children= ((XMLUsers)in_node).getDirectChildren(XMLNode.XML_USER);
  		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLUser user = (XMLUser)enumeration.nextElement();
	    		this.showArr.add(user.getName());
	    		this.showArr.add(new Boolean(user.isSelected()));
	    	}
  		}
      	this.showTitle = "Users";
      	this.showDesc = "Pelese select from the under table:";
      	this.ColumnName[COL_OBJECT] = "User Name";
      	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;
      	
      case(XMLNode.XML_TABLESPACES):
      	/*表空间*/
        this.children= ((XMLTablespaces)in_node).getDirectChildren(XMLNode.XML_TABLESPACE);
  		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLTablespace tablespace = (XMLTablespace)enumeration.nextElement();
	    		this.showArr.add(tablespace.getName());
	    		this.showArr.add(new Boolean(tablespace.isSelected()));
	    	}
  		}
      	this.showTitle = "Tablespaces";
      	this.showDesc = "Pelese select from the under table:";
      	this.ColumnName[COL_OBJECT] = "Tablespace Name";
      	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;
      	
      case(XMLNode.XML_UNDO_SEGS):
      	/*回滚段*/
        this.children= ((XMLUndoSegs)in_node).getDirectChildren(XMLNode.XML_UNDO_SEG);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLUndoSeg undoseg = (XMLUndoSeg)enumeration.nextElement();
	    		this.showArr.add(undoseg.getName());
	    		this.showArr.add(new Boolean(undoseg.isSelected()));
	    	}
  		}
    	this.showTitle = "Undo Segments";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Undo Segment Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;
      	
      case(XMLNode.XML_SCHEMAS):
      	/*方案*/
        this.children = ((XMLSchemas)in_node).getDirectChildren(XMLNode.XML_SCHEMA);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLSchema schema = (XMLSchema)enumeration.nextElement();
	    		this.showArr.add(schema.getName());
	    		this.showArr.add(new Boolean(schema.isSelected()));
	    	}
  		}
      	this.showTitle = "Schemas";
      	this.showDesc = "Pelese select from the under table:";
      	this.ColumnName[COL_OBJECT] = "Schema Name";
      	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;
      	
      case(XMLNode.XML_SEQUENCES):
      	/*序列*/
        this.children= ((XMLSequences)in_node).getDirectChildren(XMLNode.XML_SEQUENCE);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLSequence sequence = (XMLSequence)enumeration.nextElement();
	    		this.showArr.add(sequence.getName());
	    		this.showArr.add(new Boolean(sequence.isSelected()));
	    	}
  		}
    	this.showTitle = "Sequences";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Sequence Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;

      case(XMLNode.XML_ARRAYTYPES):
      	/*数组类型*/
        this.children= ((XMLArrayTypes)in_node).getDirectChildren(XMLNode.XML_ARRAYTYPE);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLArrayType arraytype = (XMLArrayType)enumeration.nextElement();
	    		this.showArr.add(arraytype.getName());
	    		this.showArr.add(new Boolean(arraytype.isSelected()));
	    	}
  		}
    	this.showTitle = "Array Types";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Type Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;

      case(XMLNode.XML_TABLETYPES):
      	/*表类型*/
        this.children= ((XMLTableTypes)in_node).getDirectChildren(XMLNode.XML_TABLETYPE);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLTableType tabletype = (XMLTableType)enumeration.nextElement();
	    		this.showArr.add(tabletype.getName());
	    		this.showArr.add(new Boolean(tabletype.isSelected()));
	    	}
  		}
    	this.showTitle = "Table Types";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Type Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;

      case(XMLNode.XML_OBJECTTYPES):
      	/*对象类型*/
        this.children= ((XMLObjectTypes)in_node).getDirectChildren(XMLNode.XML_OBJECTTYPE);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLObjectType objecttype = (XMLObjectType)enumeration.nextElement();
	    		this.showArr.add(objecttype.getName());
	    		this.showArr.add(new Boolean(objecttype.isSelected()));
	    	}
  		}
    	this.showTitle = "Object Types";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Type Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;

      case(XMLNode.XML_FUNCTIONS):
      	/*函数*/
        this.children= ((XMLFunctions)in_node).getDirectChildren(XMLNode.XML_FUNCTION);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLFunction function = (XMLFunction)enumeration.nextElement();
	    		this.showArr.add(function.getName());
	    		this.showArr.add(new Boolean(function.isSelected()));
	    	}
  		}
    	this.showTitle = "Functions";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Function Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;

      case(XMLNode.XML_PACKAGES):
      	/*程序包*/
        this.children= ((XMLPackages)in_node).getDirectChildren(XMLNode.XML_PACKAGE);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLPackage package0 = (XMLPackage)enumeration.nextElement();
	    		this.showArr.add(package0.getName());
	    		this.showArr.add(new Boolean(package0.isSelected()));
	    	}	    		
  		}
    	this.showTitle = "Packages";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Package Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;

      case(XMLNode.XML_PACKAGEBODIES):
      	/*程序包体*/
        this.children= ((XMLPackageBodies)in_node).getDirectChildren(XMLNode.XML_PACKAGEBODY);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLPackageBody packagebodies = (XMLPackageBody)enumeration.nextElement();
	    		this.showArr.add(packagebodies.getName());
	    		this.showArr.add(new Boolean(packagebodies.isSelected()));
	    	}	    		
  		}
    	this.showTitle = "Package Bodies";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Package Body Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;

      case(XMLNode.XML_PROCEDURES):
      	/*存储过程*/
        this.children= ((XMLProcedures)in_node).getDirectChildren(XMLNode.XML_PROCEDURE);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLProcedure procedure = (XMLProcedure)enumeration.nextElement();
	    		this.showArr.add(procedure.getName());
	    		this.showArr.add(new Boolean(procedure.isSelected()));
	    	}	    		
  		}
    	this.showTitle = "Procedures";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Procedure Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;

      case(XMLNode.XML_SYNONYMS):
      	/*同义词*/
        this.children= ((XMLSynonyms)in_node).getDirectChildren(XMLNode.XML_SYNONYM);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLSynonym synonym = (XMLSynonym)enumeration.nextElement();
	    		this.showArr.add(synonym.getName());
	    		this.showArr.add(new Boolean(synonym.isSelected()));
	    	}	    		
  		}
    	this.showTitle = "Synonyms";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Synonym Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;
      	
      case(XMLNode.XML_VIEWS):
      	/*视图*/
        this.children= ((XMLViews)in_node).getDirectChildren(XMLNode.XML_VIEW);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLView view = (XMLView)enumeration.nextElement();
	    		this.showArr.add(view.getName());
	    		this.showArr.add(new Boolean(view.isSelected()));
	    	}
  		}
    	this.showTitle = "Views";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "View Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;
      	
      case(XMLNode.XML_TABLES):
      	/*表*/
        this.children= ((XMLTables)in_node).getDirectChildren(XMLNode.XML_TABLE);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLTable table = (XMLTable)enumeration.nextElement();
	    		this.showArr.add(table.getName());
	    		this.showArr.add(new Boolean(table.isSelected()));
	    	}
  		}
    	this.showTitle = "Tables";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Table Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;

      case(XMLNode.XML_TRIGGERS):
      	/*触发器*/
        this.children= ((XMLTriggers)in_node).getDirectChildren(XMLNode.XML_TRIGGER);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLTrigger trigger = (XMLTrigger)enumeration.nextElement();
	    		this.showArr.add(trigger.getName());
	    		this.showArr.add(new Boolean(trigger.isSelected()));
	    	}
  		}
    	this.showTitle = "Triggers";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Trigger Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;

      case(XMLNode.XML_INDEXES):
      	/*索引*/
        this.children= ((XMLIndexes)in_node).getDirectChildren(XMLNode.XML_INDEX);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLIndex index = (XMLIndex)enumeration.nextElement();
	    		this.showArr.add(index.getName());
	    		this.showArr.add(new Boolean(index.isSelected()));
	    	}
  		}
    	this.showTitle = "Indexes";
      	this.showDesc = "Pelese select from the under table:";
    	this.ColumnName[COL_OBJECT] = "Index Name";
    	this.ColumnName[COL_ISSELECTED]	= "Selected";
      	break;

      case(XMLNode.XML_CONSTRAINTS):
      	/*约束*/
        this.children= ((XMLConstraints)in_node).getDirectChildren(XMLNode.XML_CONSTRAINT);
		if(children != null){
  			enumeration=children.elements();
	    	while(enumeration.hasMoreElements()){
	    		XMLConstraint constraint = (XMLConstraint)enumeration.nextElement();
	    		this.showArr.add(constraint.getName());

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?