001: /*
002: * Copyright (C) 2004 Giuseppe MANNA
003: *
004: * This file is part of FreeReportBuilder
005: *
006: * FreeReportBuilder is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License
008: * as published by the Free Software Foundation; either version 2
009: * of the License, or (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
019: *
020: */
021:
022: package it.frb.action;
023:
024: import javax.swing.JTextArea;
025: import it.frb.tree.drag.*;
026: import it.frb.tree.*;
027: import it.frb.*;
028: import javax.swing.*;
029:
030: public class Action_Control_F2 extends ActionDataPanel {
031: public Action_Control_F2(String action) {
032: super (action);
033: }
034:
035: public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
036: java.sql.Connection conn = null;
037: conn = Connessione.getConnessione();
038: if (conn != null) {
039: String sUrl = "";
040: javax.swing.JFrame jFlistTables = new javax.swing.JFrame();
041:
042: CustomTreeUtil cTreeUtil = new CustomTreeUtil();
043:
044: javax.swing.tree.DefaultTreeModel treeModel = new javax.swing.tree.DefaultTreeModel(
045: cTreeUtil.getNodeRootDatabaseShema(), true);
046: javax.swing.JTextArea sqlEd = dataPanel.getTextArea();
047:
048: CustomTree jtree = new CustomTree(treeModel, sqlEd);
049:
050: jtree.setTreeUtil(cTreeUtil);
051: jtree.setParentFrame(jFlistTables);
052: jtree.setShowsRootHandles(true);
053: CustomCellRender cCR = new CustomCellRender();
054: jtree.setCellRenderer(cCR);
055: jtree.putClientProperty("JTree.lineStyle", "Angled");
056: jtree
057: .getSelectionModel()
058: .setSelectionMode(
059: javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION);
060:
061: javax.swing.JScrollPane jSpListTables = new javax.swing.JScrollPane(
062: jtree,
063: javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
064: javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
065: javax.swing.JPanel JpanelFunction = new javax.swing.JPanel(
066: new java.awt.GridLayout(4, 1));
067:
068: java.sql.DatabaseMetaData dbmd = null;
069:
070: try {
071: dbmd = conn.getMetaData();
072:
073: JTextArea jTextS = new JTextArea();
074: jTextS.setBorder(javax.swing.BorderFactory
075: .createTitledBorder("String functions"));
076: jTextS.setLineWrap(true);
077: jTextS.setWrapStyleWord(true);
078: jTextS.setEditable(false);
079: jTextS.setText(dbmd.getStringFunctions());
080: JpanelFunction.add(jTextS);
081:
082: JTextArea jTextM = new JTextArea();
083: jTextM.setBorder(javax.swing.BorderFactory
084: .createTitledBorder("Numeric functions"));
085: jTextM.setLineWrap(true);
086: jTextM.setWrapStyleWord(true);
087: jTextM.setEditable(false);
088: jTextM.setText(dbmd.getNumericFunctions());
089: JpanelFunction.add(jTextM);
090:
091: JTextArea jTextD = new JTextArea();
092: jTextD.setBorder(javax.swing.BorderFactory
093: .createTitledBorder("Date functions"));
094: jTextD.setLineWrap(true);
095: jTextD.setWrapStyleWord(true);
096: jTextD.setEditable(false);
097: jTextD.setText(dbmd.getTimeDateFunctions());
098: JpanelFunction.add(jTextD);
099:
100: JTextArea jTextOS = new JTextArea();
101: jTextOS.setBorder(javax.swing.BorderFactory
102: .createTitledBorder("System functions"));
103: jTextOS.setLineWrap(true);
104: jTextOS.setWrapStyleWord(true);
105: jTextOS.setEditable(false);
106: jTextOS.setText(dbmd.getSystemFunctions());
107: JpanelFunction.add(jTextOS);
108:
109: boolean bMltStm = ConfigurationProperties.properties()
110: .getUseMultiTransaction(false);
111:
112: if (!bMltStm) {
113: conn.close();
114: }
115:
116: } catch (java.sql.SQLException s) {
117: javax.swing.JOptionPane.showMessageDialog(null, s
118: .getMessage());
119: }
120:
121: javax.swing.JSplitPane jsplit = new javax.swing.JSplitPane(
122: javax.swing.JSplitPane.HORIZONTAL_SPLIT);
123: jsplit.setLeftComponent(jSpListTables);
124: jsplit.setRightComponent(JpanelFunction);
125: jsplit.setDividerLocation(300);
126: jsplit.setOneTouchExpandable(true);
127: jsplit.setContinuousLayout(true);
128:
129: jFlistTables.getContentPane().add(jsplit);
130:
131: jFlistTables.setSize(new java.awt.Dimension(600, 500));
132: DataEngine.centerWindow(jFlistTables, SwingUtilities
133: .getWindowAncestor(dataPanel));
134: jFlistTables.setVisible(true);
135: }
136: }
137: }
|