001: package net.sourceforge.squirrel_sql.plugins.oracle.invalidobjects;
002:
003: /*
004: * Copyright (C) 2004 Jason Height
005: * jmheight@users.sourceforge.net
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: */
021:
022: import net.sourceforge.squirrel_sql.client.IApplication;
023: import net.sourceforge.squirrel_sql.client.session.ISession;
024: import net.sourceforge.squirrel_sql.fw.util.Resources;
025: import net.sourceforge.squirrel_sql.fw.util.StringManager;
026: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
027: import net.sourceforge.squirrel_sql.plugins.oracle.OracleInternalFrame;
028: import net.sourceforge.squirrel_sql.plugins.oracle.OracleInternalFrameCallback;
029:
030: import javax.swing.*;
031: import javax.swing.event.InternalFrameAdapter;
032: import javax.swing.event.InternalFrameEvent;
033: import java.awt.*;
034:
035: public class InvalidObjectsInternalFrame extends OracleInternalFrame {
036:
037: private static final String PREF_PART_INVALID_FRAME = "InvalidFrame";
038:
039: private static final StringManager s_stringMgr = StringManagerFactory
040: .getStringManager(InvalidObjectsInternalFrame.class);
041:
042: private InvalidObjectsPanel _invalidObjectsPanel;
043: /**
044: * Toolbar for window.
045: */
046: private InvalidObjectsToolBar _toolBar;
047:
048: private Resources _resources;
049:
050: public InvalidObjectsInternalFrame(ISession session,
051: Resources resources) {
052:
053: // I18n[oracle.invalidTitle=Oracle invalid objects for: {0}]
054: super (session, s_stringMgr.getString("oracle.invalidTitle",
055: session.getTitle()));
056: _resources = resources;
057: createGUI(session);
058: }
059:
060: public InvalidObjectsPanel getDBOutputPanel() {
061: return _invalidObjectsPanel;
062: }
063:
064: private void createGUI(ISession session) {
065:
066: addInternalFrameListener(new InternalFrameAdapter() {
067: public void internalFrameClosing(InternalFrameEvent e) {
068: InvalidObjectsInternalFrame.super .internalFrameClosing(
069: _toolBar.isStayOnTop(), 0);
070: }
071: });
072:
073: Icon icon = _resources.getIcon(getClass(), "frameIcon"); //i18n
074: if (icon != null) {
075: setFrameIcon(icon);
076: }
077:
078: OracleInternalFrameCallback cb = new OracleInternalFrameCallback() {
079:
080: public void createPanelAndToolBar(boolean stayOnTop,
081: int autoRefeshPeriod) {
082:
083: _invalidObjectsPanel = new InvalidObjectsPanel(
084: getSession());
085: _toolBar = new InvalidObjectsToolBar(getSession(),
086: stayOnTop);
087: JPanel contentPanel = new JPanel(new BorderLayout());
088: contentPanel.add(_toolBar, BorderLayout.NORTH);
089: contentPanel.add(_invalidObjectsPanel,
090: BorderLayout.CENTER);
091: setContentPane(contentPanel);
092:
093: }
094: };
095:
096: initFromPrefs(PREF_PART_INVALID_FRAME, cb);
097: }
098:
099: /**
100: * The class representing the toolbar at the top of a invalid objects internal frame
101: */
102: private class InvalidObjectsToolBar extends OracleToolBar {
103: InvalidObjectsToolBar(ISession session, boolean stayOnTop) {
104: super ();
105: createGUI(session, stayOnTop);
106: }
107:
108: private void createGUI(ISession session, boolean stayOnTop) {
109: IApplication app = session.getApplication();
110: setUseRolloverButtons(true);
111: setFloatable(false);
112: add(new GetInvalidObjectsAction(app, _resources,
113: _invalidObjectsPanel));
114:
115: addStayOnTop(stayOnTop);
116: }
117: }
118: }
|