Update of /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/properties
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6739
Modified Files:
EditWhereColsSheet.java
Log Message:
limit cols in edit now functional
Index: EditWhereColsSheet.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/properties/EditWhereColsSheet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** EditWhereColsSheet.java 20 Apr 2004 19:52:53 -0000 1.1
--- EditWhereColsSheet.java 23 Apr 2004 18:34:09 -0000 1.2
***************
*** 27,37 ****
import java.sql.ResultSet;
import java.sql.SQLException;
- import java.sql.Types;
- import java.util.ArrayList;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
import java.util.SortedSet;
- import java.util.TreeMap;
import java.util.TreeSet;
--- 27,31 ----
***************
*** 41,51 ****
import javax.swing.JPanel;
import javax.swing.JScrollPane;
- import javax.swing.JTabbedPane;
- import javax.swing.event.ChangeEvent;
- import javax.swing.event.ChangeListener;
- import net.sourceforge.squirrel_sql.fw.datasetviewer.DataSetException;
import net.sourceforge.squirrel_sql.fw.gui.GUIUtils;
- import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectType;
import net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo;
import net.sourceforge.squirrel_sql.fw.sql.ITableInfo;
--- 35,40 ----
***************
*** 55,59 ****
import net.sourceforge.squirrel_sql.client.gui.BaseSheet;
- import net.sourceforge.squirrel_sql.client.gui.builders.UIFactory;
import net.sourceforge.squirrel_sql.client.session.ISession;
import net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.table.ContentsTab;
--- 44,47 ----
***************
*** 84,100 ****
private IDatabaseObjectInfo _objectInfo;
- /** A list of panels that make up this sheet. */
- private List _panels = new ArrayList();
-
- /** A variable that contains a value that indicates which tab currently has focus. */
- private int _tabSelected;
-
/** Frame title. */
private JLabel _titleLbl = new JLabel();
! /** A button used to trigger the clearing of the information. */
! private JButton _clearFilter = new JButton();
!
! /** A reference to a panel for the Where Clause list. */
private EditWhereColsPanel _editWhereColsPanel = null;
--- 72,79 ----
private IDatabaseObjectInfo _objectInfo;
/** Frame title. */
private JLabel _titleLbl = new JLabel();
! /** A reference to a panel for the EditWhereCols list. */
private EditWhereColsPanel _editWhereColsPanel = null;
***************
*** 137,158 ****
final boolean isDebug = s_log.isDebugEnabled();
long start = 0;
! for (Iterator it = _panels.iterator(); it.hasNext();)
{
! EditWhereColsPanel pnl = (EditWhereColsPanel)it.next();
! if (isDebug)
! {
! start = System.currentTimeMillis();
! }
! pnl.initialize(_session);
! if (isDebug)
! {
! s_log.debug(
! "Panel "
! + pnl.getTitle()
! + " initialized in "
! + (System.currentTimeMillis() - start)
! + "ms");
! }
}
pack();
/*
--- 116,135 ----
final boolean isDebug = s_log.isDebugEnabled();
long start = 0;
!
! if (isDebug)
{
! start = System.currentTimeMillis();
}
+
+ if (isDebug)
+ {
+ s_log.debug(
+ "Panel "
+ + _editWhereColsPanel.getTitle()
+ + " initialized in "
+ + (System.currentTimeMillis() - start)
+ + "ms");
+ }
+
pack();
/*
***************
*** 209,232 ****
return _objectInfo;
}
/**
! * OK button pressed. Edit data and if ok save to aliases model and
* then close dialog.
*/
private void performOk()
{
!
! //?????????????????????????????????????????
!
! dispose();
}
/**
! * Create the GUI elements for the sheet.
*/
private void createGUI()
{
SortedSet columnNames = new TreeSet();
- Map textColumns = new TreeMap();
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
--- 186,218 ----
return _objectInfo;
}
+
+ /**
+ * Reset button pressed. Reset the data to the way it was when we started
+ * this round of editing.
+ *
+ */
+ private void performReset()
+ {
+ _editWhereColsPanel.reset();
+ }
/**
! * OK button pressed. Save data to EditWhereCols repository
* then close dialog.
*/
private void performOk()
{
! // try to save the selection.
! // do not dispose of this panel if there is a problem
! if (_editWhereColsPanel.ok())
! dispose();
}
/**
! * Create the GUI elements for the sheet and pass in the setup data to the panel.
*/
private void createGUI()
{
SortedSet columnNames = new TreeSet();
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
***************
*** 235,239 ****
// This is a tool window.
GUIUtils.makeToolWindow(this, true);
! /*********************************************************************
try
{
--- 221,225 ----
// This is a tool window.
GUIUtils.makeToolWindow(this, true);
!
try
{
***************
*** 244,258 ****
{
columnNames.add(rs.getString("COLUMN_NAME"));
- int dataType = rs.getInt("DATA_TYPE");
-
- if ((dataType == Types.CHAR)
- || (dataType == Types.CLOB)
- || (dataType == Types.LONGVARCHAR)
- || (dataType == Types.VARCHAR))
- {
- textColumns.put(
- rs.getString("COLUMN_NAME"),
- new Boolean(true));
- }
}
}
--- 230,233 ----
***************
*** 264,289 ****
_editWhereColsPanel =
! new EditWhereColsPanel(columnNames, textColumns, _objectInfo.getQualifiedName());
! _panels.add(_editWhereColsPanel);
- JTabbedPane tabPane = UIFactory.getInstance().createTabbedPane();
- for (Iterator it = _panels.iterator(); it.hasNext();)
- {
- EditWhereColsPanel pnl = (EditWhereColsPanel)it.next();
- String pnlTitle = pnl.getTitle();
- String hint = pnl.getHint();
- final JScrollPane sp = new JScrollPane(pnl.getPanelComponent());
- sp.setBorder(BorderFactory.createEmptyBorder());
- tabPane.addTab(pnlTitle, null, sp, hint);
- }
! tabPane.addChangeListener(new ChangeListener()
! {
! public void stateChanged(ChangeEvent event)
! {
! _clearFilter.setText("Clear ");
! }
! });
! *******************************************/
final JPanel contentPane = new JPanel(new GridBagLayout());
contentPane.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
--- 239,251 ----
_editWhereColsPanel =
! new EditWhereColsPanel(columnNames, _objectInfo.getQualifiedName(),
! ContentsTab.getUnambiguousTableName(_session, _objectInfo.getQualifiedName()));
! String pnlTitle = _editWhereColsPanel.getTitle();
! String hint = _editWhereColsPanel.getHint();
! final JScrollPane sp = new JScrollPane(_editWhereColsPanel);
! sp.setBorder(BorderFactory.createEmptyBorder());
!
final JPanel contentPane = new JPanel(new GridBagLayout());
contentPane.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
***************
*** 303,316 ****
gbc.fill = GridBagConstraints.NONE;
gbc.gridx = GridBagConstraints.REMAINDER;
! _clearFilter.setText("Clear ");
! _tabSelected = 0;
! _clearFilter.addActionListener(new ActionListener()
! {
! public void actionPerformed(ActionEvent evt)
! {
! clearFilter();
! }
! });
! //?? contentPane.add(_clearFilter);
gbc.fill = GridBagConstraints.BOTH;
--- 265,287 ----
gbc.fill = GridBagConstraints.NONE;
gbc.gridx = GridBagConstraints.REMAINDER;
!
! // leave a blank line just to make it look a bit nicer
! gbc.gridx = 0;
! ++gbc.gridy;
! contentPane.add(new JLabel(" "), gbc);
!
! gbc.gridx = 0;
! ++gbc.gridy;
! contentPane.add(
! new JLabel("Limit the size of the WHERE clause used behind the scenes when editing cell contents."), gbc);
! gbc.gridx = 0;
! ++gbc.gridy;
! contentPane.add(
! new JLabel("The 'use' window should include at least the primary keys for the table."), gbc);
!
! // leave a blank line just to make it look a bit nicer
! gbc.gridx = 0;
! ++gbc.gridy;
! contentPane.add(new JLabel(" "), gbc);
gbc.fill = GridBagConstraints.BOTH;
***************
*** 319,324 ****
++gbc.gridy;
gbc.weighty = 1;
! //????? contentPane.add(tabPane, gbc);
! contentPane.add(new JLabel("This panel not yet implemented."), gbc);
++gbc.gridy;
--- 290,294 ----
++gbc.gridy;
gbc.weighty = 1;
! contentPane.add(_editWhereColsPanel, gbc);
++gbc.gridy;
***************
*** 329,340 ****
/**
- * Clear out the SQL Filter information for the appropriate tab.
- */
- private void clearFilter()
- {
- _editWhereColsPanel.clearFilter();
- }
-
- /**
* Create a panel that contains the buttons that control the closing
* of the sheet.
--- 299,302 ----
***************
*** 354,357 ****
--- 316,327 ----
}
});
+ JButton resetBtn = new JButton("Reset");
+ resetBtn.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
+ performReset();
+ }
+ });
JButton closeBtn = new JButton("Close");
closeBtn.addActionListener(new ActionListener()
***************
*** 364,370 ****
pnl.add(okBtn);
pnl.add(closeBtn);
! GUIUtils.setJButtonSizesTheSame(new JButton[] { okBtn, closeBtn });
getRootPane().setDefaultButton(okBtn);
--- 334,341 ----
pnl.add(okBtn);
+ pnl.add(resetBtn);
pnl.add(closeBtn);
! GUIUtils.setJButtonSizesTheSame(new JButton[] { okBtn, resetBtn, closeBtn });
getRootPane().setDefaultButton(okBtn);
|