
net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI Maven / Gradle / Ivy
package net.sourceforge.squirrel_sql.client.session;
/*
* Copyright (C) 2002-2004 Colin Bell and Johan Compagner
* [email protected]
* [email protected]
*
* Modifications Copyright (C) 2003-2004 Jason Height
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import java.awt.*;
import java.util.List;
import javax.swing.*;
import javax.swing.event.TreeModelListener;
import javax.swing.event.TreeSelectionListener;
import net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.*;
import net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.IObjectTab;
import net.sourceforge.squirrel_sql.client.session.schemainfo.FilterMatcher;
import net.sourceforge.squirrel_sql.fw.datasetviewer.DataSetException;
import net.sourceforge.squirrel_sql.fw.id.IHasIdentifier;
import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectType;
import net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo;
import net.sourceforge.squirrel_sql.fw.sql.ITableInfo;
/**
* This interface defines the API through which plugins can work with the object
* tree.
*
* @author Colin Bell
*/
public interface IObjectTreeAPI extends IHasIdentifier
{
/**
* Retrieves the session of associated with the tree.
*
* @return Session associated with the tree.
*/
ISession getSession();
/**
* Add an expander for the specified object tree node type.
*
* @param dboType Database object type.
* @param expander Expander called to add children to a parent node.
*
* @throws IllegalArgumentException
* Thrown if a null DatabaseObjectType or
* INodeExpander thrown.
*/
void addExpander(DatabaseObjectType dboType, INodeExpander expander);
/**
* Add a tab to be displayed in the detail panel for the passed
* database object type.
*
* @param dboType Database object type.
* @param tab Tab to be displayed.
*
* @throws IllegalArgumentException
* Thrown when a null DatabaseObjectType or
* IObjectTab passed.
*/
void addDetailTab(DatabaseObjectType dboType, IObjectTab tab);
/**
* Add a listener to the object tree for structure changes. I.E nodes
* added/removed.
*
* @param lis The TreeModelListener you want added.
*
* @throws IllegalArgumentException
* Thrown if null TreeModelListener passed.
*/
void addTreeModelListener(TreeModelListener lis);
/**
* Remove a structure changes listener from the object tree.
*
* @param lis The TreeModelListener you want removed.
*
* @throws IllegalArgumentException
* Thrown if null TreeModelListener passed.
*/
void removeTreeModelListener(TreeModelListener lis);
/**
* Add a listener to the object tree for selection changes.
*
* @param lis The TreeSelectionListener you want added.
*
* @throws IllegalArgumentException
* Thrown if null TreeSelectionListener passed.
*/
void addTreeSelectionListener(TreeSelectionListener lis);
/**
* Remove a listener from the object tree for selection changes.
*
* @param lis The TreeSelectionListener you want removed.
*
* @throws IllegalArgumentException
* Thrown if null TreeSelectionListener passed.
*/
void removeTreeSelectionListener(TreeSelectionListener lis);
/**
* Add a listener to the object tree.
*
* @param lis The ObjectTreeListener you want added.
*
* @throws IllegalArgumentException
* Thrown if null ObjectTreeListener passed.
*/
void addObjectTreeListener(IObjectTreeListener lis);
/**
* Remove a listener from the object tree.
*
* @param lis The ObjectTreeListener you want removed.
*
* @throws IllegalArgumentException
* Thrown if null ObjectTreeListener passed.
*/
void removeObjectTreeListener(IObjectTreeListener lis);
/**
* Add an Action to the popup menu for the specified database
* object type.
*
* @param dboType Database object type.
* @param action Action to add to menu.
*
* @throws IllegalArgumentException
* Thrown if a null DatabaseObjectType or
* Action thrown.
*/
void addToPopup(DatabaseObjectType dboType, Action action);
/**
* Add an Action to the popup menu for all node types.
*
* @param action Action to add to menu.
*
* @throws IllegalArgumentException
* Thrown if a null Action thrown.
*/
void addToPopup(Action action);
/**
* Add an hierarchical menu to the popup menu for the specified database
* object type.
*
* @param dboType Database object type.
* @param menu JMenu to add to menu.
*
* @throws IllegalArgumentException
* Thrown if a null DatabaseObjectType or
* JMenu thrown.
*/
void addToPopup(DatabaseObjectType dboType, JMenu menu);
/**
* Add an hierarchical menu to the popup menu for all node types.
*
* @param menu JMenu to add to menu.
*
* @throws IllegalArgumentException
* Thrown if a null JMenu thrown.
*/
void addToPopup(JMenu menu);
/**
* Return an array of the selected nodes in the tree. This is guaranteed
* to be non-null.
*
* @return Array of nodes in the tree.
*/
ObjectTreeNode[] getSelectedNodes();
/**
* Return an array of the currently selected database
* objects. This is guaranteed to be non-null.
*
* @return array of ObjectTreeNode objects.
*/
IDatabaseObjectInfo[] getSelectedDatabaseObjects();
/**
* Return a type-safe list of the currently selected database tables
*
* @return list of ITableInfo objects.
*/
List getSelectedTables();
/**
* Refresh the object tree.
*/
void refreshTree();
/**
* Refresh the object tree.
*/
void refreshTree(boolean reloadSchemaInfo);
/**
* Refresh the nodes currently selected in the object tree.
*/
void refreshSelectedNodes();
/**
* Remove one or more nodes from the tree.
*
* @param nodes Array of nodes to be removed.
*
* @throws IllegalArgumentException
* Thrown if a null ObjectTreeNode[] thrown.
*/
void removeNodes(ObjectTreeNode[] nodes);
/**
* Retrieve details about all object types that can be in this
* tree.
*
* @return DatabaseObjectType[] Array of object type info objects.
*/
DatabaseObjectType[] getDatabaseObjectTypes();
/**
* Add a known database object type to the object tree.
*
* @param dboType The new database object type.
*/
void addKnownDatabaseObjectType(DatabaseObjectType dboType);
IObjectTab getTabbedPaneIfSelected(DatabaseObjectType dbObjectType, String title);
/**
* Tries to locate the object given by the paramteres in the Object tree.
* The first matching object found is selected.
*
* @param catalog null means any catalog
* @param schema null means any schema
* @return true if the Object was found and selected.
*/
boolean selectInObjectTree(String catalog, String schema, FilterMatcher objectMatcher);
/**
* Selects the root node of the tree.
*/
void selectRoot();
/**
* Expands the specified tree node.
*
* @param node the tree node to expand
*/
void expandNode(ObjectTreeNode node);
/**
* Calls refreshComponent on the selected tab in the current
* ObjectTreeTabbedPane, if the selected tab happens to be a BaseDataSetTab
* type.
*
* @throws DataSetException if there was a problem refreshing the component.
*/
void refreshSelectedTab() throws DataSetException;
FindInObjectTreeController getFindController();
Component getDetailTabComp();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy