001: package org.jsqltool.gui.tableplugins;
002:
003: import javax.swing.*;
004: import java.awt.*;
005: import javax.swing.event.*;
006: import javax.swing.table.*;
007: import java.awt.event.*;
008: import org.jsqltool.conn.DbConnectionUtil;
009: import org.jsqltool.conn.DbConnection;
010: import org.jsqltool.model.CustomTableModel;
011: import java.sql.*;
012: import java.util.*;
013: import org.jsqltool.gui.*;
014: import org.jsqltool.gui.tablepanel.*;
015: import org.jsqltool.*;
016: import org.jsqltool.gui.tableplugins.triggers.*;
017: import org.jsqltool.gui.panel.*;
018: import org.jsqltool.model.CustomTableModel;
019: import org.jsqltool.utils.Options;
020:
021: /**
022: * <p>Title: JSqlTool Project</p>
023: * <p>Description: This panel contains triggers defined on table.
024: * </p>
025: * <p>Copyright: Copyright (C) 2006 Mauro Carniel</p>
026: *
027: * <p> This file is part of JSqlTool project.
028: * This library is free software; you can redistribute it and/or
029: * modify it under the terms of the (LGPL) Lesser General Public
030: * License as published by the Free Software Foundation;
031: *
032: * GNU LESSER GENERAL PUBLIC LICENSE
033: * Version 2.1, February 1999
034: *
035: * This library is distributed in the hope that it will be useful,
036: * but WITHOUT ANY WARRANTY; without even the implied warranty of
037: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
038: * Library General Public License for more details.
039: *
040: * You should have received a copy of the GNU Library General Public
041: * License along with this library; if not, write to the Free
042: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
043: *
044: * The author may be contacted at:
045: * maurocarniel@tin.it</p>
046: *
047: * @author Mauro Carniel
048: * @version 1.0
049: */
050: public class TriggersTablePanel extends TablePluginAdapter {
051:
052: private Hashtable pk = null;
053: BorderLayout borderLayout1 = new BorderLayout();
054: private JFrame parent = null;
055: GridBagLayout gridBagLayout1 = new GridBagLayout();
056:
057: /** class related to the dabase type currently in use */
058: private Triggers triggers = null;
059:
060: public TriggersTablePanel() {
061: /*
062: try {
063: jbInit();
064: }
065: catch(Exception e) {
066: e.printStackTrace();
067: }
068: */
069: }
070:
071: /**
072: * @return panel position inside the JTabbedPane related to the table detail
073: */
074: public int getTabbedPosition() {
075: return 5;
076: }
077:
078: /**
079: * @return folder name of the plugin panel, inside the JTabbedPane related to the table detail
080: */
081: public String getTabbedName() {
082: return Options.getInstance().getResource("triggers");
083: }
084:
085: /**
086: * This method is called from the table detail before the inizialization of the plugin panel
087: */
088: public void init(DbConnectionUtil dbConnUtil) {
089: if (dbConnUtil.getDbConnection().getDbType() == DbConnection.ORACLE_TYPE)
090: triggers = new OracleTriggers(dbConnUtil);
091: else
092: triggers = new VoidTriggers(dbConnUtil);
093: }
094:
095: public String getQuery(String tableName, DbConnectionUtil dbConnUtil) {
096: return triggers.getQueryTriggers(tableName);
097: }
098:
099: /**
100: * @return infos about the author of the plugin panel; "" or null does not report any info about the plugin panel
101: */
102: public String getAuthor() {
103: return "";
104: }
105:
106: /**
107: * @return plugin panel version
108: */
109: public String getVersion() {
110: return "1.0";
111: }
112:
113: /**
114: * @return plugin panel name, reported into the about window
115: */
116: public String getName() {
117: return Options.getInstance().getResource(
118: "table triggers plugin");
119: }
120:
121: public void setQuery(String tableName) {
122: if (triggers.getQueryTriggers(tableName) != null) {
123: try {
124: super .setQuery(tableName);
125: } catch (Exception ex) {
126: }
127: return;
128: }
129: this.tableName = tableName;
130: }
131:
132: }
|