home *** CD-ROM | disk | FTP | other *** search
- package asp.wizard;
-
- import asp.util.ResourceUtil;
- import asp.wizard.util.UiUtil;
- import com.sun.java.swing.JButton;
- import com.sun.java.swing.JDialog;
- import com.sun.java.swing.JFrame;
- import com.sun.java.swing.JScrollPane;
- import com.sun.java.swing.JTable;
- import java.awt.Container;
- import java.awt.Dialog;
- import java.awt.Frame;
- import java.awt.GridBagConstraints;
- import java.awt.GridBagLayout;
- import java.awt.Window;
- import java.sql.ResultSet;
- import java.sql.SQLException;
-
- public class SqlTableModelTestFrame extends JDialog {
- JButton _btnClose;
- ReadOnlyJTable _tblResultSet;
- SqlTableModel _mdlResultSet;
- static SqlTableModelTestFrame _sqlTableModelTestFrame = null;
- // $FF: synthetic field
- static Class class$asp$wizard$WVPanelDbQuery;
-
- public static SqlTableModelTestFrame getInstance() {
- if (_sqlTableModelTestFrame == null) {
- JFrame frame = new JFrame();
- _sqlTableModelTestFrame = new SqlTableModelTestFrame(frame);
- }
-
- return _sqlTableModelTestFrame;
- }
-
- public SqlTableModelTestFrame(Frame parent) {
- this(parent, "Test SQL");
- }
-
- public SqlTableModelTestFrame(Frame parent, String title) {
- super(parent, title);
- this._btnClose = new JButton();
- this._tblResultSet = new ReadOnlyJTable();
- this._mdlResultSet = new SqlTableModel();
- this.initLayout();
- this.initEventListeners();
- this.initModels();
- ((Dialog)this).setModal(true);
- }
-
- protected void initLayout() {
- GridBagLayout gbl = new GridBagLayout();
- GridBagConstraints gbc = new GridBagConstraints();
- JScrollPane scrollPane = null;
- Container c = ((JDialog)this).getContentPane();
- c.setLayout(gbl);
- this._tblResultSet.setAutoResizeMode(0);
- this._tblResultSet.getTableHeader().setReorderingAllowed(false);
- gbc.fill = 1;
- gbc.gridy = 1;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- scrollPane = JTable.createScrollPaneForTable(this._tblResultSet);
- c.add(scrollPane, gbc);
- String btnText = ResourceUtil.getResourceString("asp.wizard.res", class$asp$wizard$WVPanelDbQuery != null ? class$asp$wizard$WVPanelDbQuery : (class$asp$wizard$WVPanelDbQuery = class$("asp.wizard.WVPanelDbQuery")), "button.resultsetclose");
- String btnMnemonic = ResourceUtil.getResourceString("asp.wizard.res", class$asp$wizard$WVPanelDbQuery != null ? class$asp$wizard$WVPanelDbQuery : (class$asp$wizard$WVPanelDbQuery = class$("asp.wizard.WVPanelDbQuery")), "button.resultsetclose");
- this._btnClose.setText(btnText);
- this._btnClose.setMnemonic(btnMnemonic.charAt(0));
- gbc.fill = 13;
- gbc.gridy = 2;
- gbc.weightx = (double)0.0F;
- gbc.weighty = (double)0.0F;
- c.add(this._btnClose, gbc);
- ((Window)this).pack();
- }
-
- protected void initEventListeners() {
- this._btnClose.addActionListener(new 1(this));
- }
-
- private void initModels() {
- this._tblResultSet.setModel(this._mdlResultSet);
- }
-
- public void update(ResultSet rs) {
- try {
- this._mdlResultSet.update(rs);
- rs.close();
- } catch (SQLException e) {
- AspWizardExceptionHandler.showMessage(0, ((Throwable)e).getMessage());
- }
-
- }
-
- public void setVisible(boolean visible) {
- if (visible) {
- UiUtil.centerComponentInScreen(this);
- }
-
- super.setVisible(visible);
- }
-
- // $FF: synthetic method
- static Class class$(String class$) {
- try {
- return Class.forName(class$);
- } catch (ClassNotFoundException forName) {
- throw new NoClassDefFoundError(((Throwable)forName).getMessage());
- }
- }
- }
-