|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.sqlpower.wabit.swingui.WabitSwingSessionContextImpl
public class WabitSwingSessionContextImpl
This is the swing version of the WabitSessionContext. Swing specific operations for the context will be done in this implementation
| Nested Class Summary | |
|---|---|
static class |
WabitSwingSessionContextImpl.SourceListStyle
All the ways the source list can be present in the GUI. |
class |
WabitSwingSessionContextImpl.TreeTabDropTargetListener
This is the droplistener on the tabbed pane which controls importing and exporting between workspaces |
| Nested classes/interfaces inherited from interface ca.sqlpower.util.UserPrompterFactory |
|---|
ca.sqlpower.util.UserPrompterFactory.UserPromptType |
| Field Summary | |
|---|---|
static java.lang.String |
EXAMPLE_WORKSPACE_URL
|
static ca.sqlpower.swingui.action.ForumAction |
FORUM_ACTION
|
static javax.swing.ImageIcon |
FRAME_ICON
This icon is at the top left of every frame. |
static javax.swing.Icon |
NEW_ICON
|
static javax.swing.Icon |
OPEN_ICON
|
static javax.swing.Icon |
OPEN_WABIT_ICON
|
static javax.swing.Icon |
SAVE_ICON
|
| Fields inherited from interface ca.sqlpower.wabit.WabitSessionContext |
|---|
DISABLE_QUERY_AUTO_EXECUTE, NEW_WORKSPACE_URL, WABIT_ENTERPRISE_SERVER_MDNS_TYPE |
| Constructor Summary | |
|---|---|
WabitSwingSessionContextImpl(WabitSessionContext delegate,
boolean headless)
|
|
WabitSwingSessionContextImpl(WabitSessionContext delegateContext,
boolean headless,
ca.sqlpower.util.UserPrompterFactory upf)
|
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
|
void |
addServer(ca.sqlpower.enterprise.client.SPServerInfo serverInfo)
Adds a new user-configured server specification to this context. |
void |
addServerListListener(ServerListListener l)
This listener will be notified when server information is added or removed from the server list. |
java.sql.Connection |
borrowConnection(ca.sqlpower.sql.JDBCDataSource dataSource)
Borrows a connection to the given data source from this session's connection pool. |
void |
close()
This will attempt to close all of the currently opened sessions and stop the app. |
org.olap4j.OlapConnection |
createConnection(ca.sqlpower.sql.Olap4jDataSource dataSource)
This method returns an OlapConnection that has been mapped to an
Olap4jDataSource. |
ca.sqlpower.util.UserPrompter |
createDatabaseUserPrompter(java.lang.String question,
java.util.List<java.lang.Class<? extends ca.sqlpower.sql.SPDataSource>> dsTypes,
ca.sqlpower.util.UserPrompter.UserPromptOptions optionType,
ca.sqlpower.util.UserPrompter.UserPromptResponse defaultResponseType,
java.lang.Object defaultResponse,
ca.sqlpower.sql.DataSourceCollection<ca.sqlpower.sql.SPDataSource> dsCollection,
java.lang.String... buttonNames)
|
ca.sqlpower.swingui.RecentMenu |
createRecentMenu()
Creates a menu that keeps track of the last few opened and saved workspace files. |
javax.swing.JMenu |
createServerListMenu(java.awt.Component dialogOwner,
java.lang.String name,
ServerListMenuItemFactory itemFactory)
Creates a menu whose items change dynamically as enterprise servers appear and disappear on the network. |
WabitSwingSession |
createServerSession(ca.sqlpower.enterprise.client.SPServerInfo serverInfo)
Creates a new server-based session for the given server. |
WabitSwingSession |
createSession()
Creates a new local session that belongs to this context. |
ca.sqlpower.util.UserPrompter |
createUserPrompter(java.lang.String question,
ca.sqlpower.util.UserPrompterFactory.UserPromptType responseType,
ca.sqlpower.util.UserPrompter.UserPromptOptions optionType,
ca.sqlpower.util.UserPrompter.UserPromptResponse defaultResponseType,
java.lang.Object defaultResponse,
java.lang.String... buttonNames)
|
void |
endLoading()
The DAO can tell this context that it's no longer being configured based on a workspace file being loaded. |
WabitSession |
getActiveSession()
Returns the session that the user is currently viewing or editing. |
WabitSwingSession |
getActiveSwingSession()
|
ca.sqlpower.sqlobject.SQLDatabase |
getDatabase(ca.sqlpower.sql.JDBCDataSource ds)
|
ca.sqlpower.sql.DataSourceCollection<ca.sqlpower.sql.SPDataSource> |
getDataSources()
|
java.util.List<ca.sqlpower.enterprise.client.SPServerInfo> |
getEnterpriseServers(boolean includeDiscoveredServers)
Returns the list of currently-known enterprise servers. |
javax.swing.JFrame |
getFrame()
Returns the JFrame that displays the context. |
javax.jmdns.JmDNS |
getJmDNS()
Returns this context's JmDNS client instance. |
ca.sqlpower.swingui.SwingWorkerRegistry |
getLoadingRegistry()
Returns a SwingWorkerRegistry for the context to track workers
that are involved with loading files. |
java.lang.String |
getName()
Returns the name for this session context. |
java.util.prefs.Preferences |
getPrefs()
Returns the preferences node used by this session context. |
int |
getRowLimit()
Returns the number of rows that should be retrieved from the database for any result set. |
javax.swing.JSpinner |
getRowLimitSpinner()
Returns the row limit component that affects all cached result sets. |
int |
getSessionCount()
Returns the number of active sessions in the context. |
java.util.List<WabitSession> |
getSessions()
Returns an unmodifiable list of the active sessions in the context. |
boolean |
isLoading()
Tells whether or not this session is currently being configured by a DAO. |
boolean |
isMacOSX()
returns true if the OS is Mac |
static void |
main(java.lang.String[] args)
Launches the Wabit application by loading the configuration and displaying the GUI. |
void |
putRecentFileName(java.lang.String fileName)
Sets the most recent file to be saved or loaded into the session. |
void |
registerChildSession(WabitSession child)
Registers the given child session with this context, marking the child session as not having any unsaved changes. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
|
void |
removeServer(ca.sqlpower.enterprise.client.SPServerInfo si)
Removes a new user-configured server specification from this context. |
void |
removeServerListListener(ServerListListener l)
This listener will stop being notified when server information is added or removed from the server list. |
void |
setActiveSession(WabitSession activeSession)
Sets the active session that is being viewed or modified. |
boolean |
setEditorPanel()
Sets the panel that allows editing of the current selection in the tree. |
void |
setStatusMessage(java.lang.String msg)
sets the StatusMessage |
void |
startLoading()
The DAO can tell this context that it's currently being configured based on a workspace file being loaded. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String EXAMPLE_WORKSPACE_URL
public static final javax.swing.ImageIcon FRAME_ICON
public static final javax.swing.Icon OPEN_WABIT_ICON
public static final ca.sqlpower.swingui.action.ForumAction FORUM_ACTION
public static final javax.swing.Icon NEW_ICON
public static final javax.swing.Icon OPEN_ICON
public static final javax.swing.Icon SAVE_ICON
| Constructor Detail |
|---|
public WabitSwingSessionContextImpl(WabitSessionContext delegate,
boolean headless)
throws java.io.IOException,
ca.sqlpower.sqlobject.SQLObjectException
delegateContext - The context which this swing session delegates all its core
WabitSessionContext operations to. This core session
will also have joint ownership of all sessions registered with
this swing context. As such, the delegate context must not
contain any registered child sessions of its own when passed
in. If it does, an IllegalStateException will be thrown by
this constructor.headless - Set to true to not create any GUI objects when the context
starts. This stops the welcome screen from being created.
java.io.IOException
ca.sqlpower.sqlobject.SQLObjectException
public WabitSwingSessionContextImpl(WabitSessionContext delegateContext,
boolean headless,
ca.sqlpower.util.UserPrompterFactory upf)
throws java.io.IOException,
ca.sqlpower.sqlobject.SQLObjectException
delegateContext - The context which this swing session delegates all its core
WabitSessionContext operations to. This core session
will also have joint ownership of all sessions registered with
this swing context. As such, the delegate context must not
contain any registered child sessions of its own when passed
in. If it does, an IllegalStateException will be thrown by
this constructor.terminateWhenLastSessionCloses - Set to true if the context should stop the app when the last
session is closed. If false the app will have to be closed in
a way other than closing all of the sessions.headless - Set to true to not create any GUI objects when the context
starts. This stops the welcome screen from being created.upf - A user prompter factory that will be used to display
appropriate prompts to the user. This can be set if a
non-default prompt is desired for places like saving. This
cannot be null.
java.io.IOException
ca.sqlpower.sqlobject.SQLObjectException| Method Detail |
|---|
public WabitSwingSession createSession()
WabitSwingSessionContext
createSession in interface WabitSwingSessionContextcreateSession in interface WabitSessionContextpublic WabitSwingSession createServerSession(ca.sqlpower.enterprise.client.SPServerInfo serverInfo)
WabitSwingSessionContext
createServerSession in interface WabitSwingSessionContextcreateServerSession in interface WabitSessionContextpublic ca.sqlpower.swingui.RecentMenu createRecentMenu()
WabitSwingSessionContext
createRecentMenu in interface WabitSwingSessionContextpublic boolean setEditorPanel()
WabitSwingSessionContext
setEditorPanel in interface WabitSwingSessionContextpublic javax.swing.JFrame getFrame()
WabitSwingSessionContext
getFrame in interface WabitSwingSessionContextpublic java.util.List<WabitSession> getSessions()
WabitSessionContext
getSessions in interface WabitSessionContextpublic void putRecentFileName(java.lang.String fileName)
WabitSwingSessionContext
putRecentFileName in interface WabitSwingSessionContextfileName - The absolute path to the file with the file name.public void close()
WabitSessionContext
close in interface WabitSessionContextpublic javax.swing.JSpinner getRowLimitSpinner()
WabitSwingSessionContext
getRowLimitSpinner in interface WabitSwingSessionContextpublic int getRowLimit()
WabitSessionContext
getRowLimit in interface WabitSessionContextpublic void setStatusMessage(java.lang.String msg)
setStatusMessage in interface WabitSwingSessionContextpublic ca.sqlpower.sql.DataSourceCollection<ca.sqlpower.sql.SPDataSource> getDataSources()
getDataSources in interface WabitSessionContextpublic java.util.List<ca.sqlpower.enterprise.client.SPServerInfo> getEnterpriseServers(boolean includeDiscoveredServers)
WabitSessionContext
getEnterpriseServers in interface WabitSessionContextincludeDiscoveredServers - if true, all known servers will be returned whether they were
configured explicitly or discovered dynamically. If false, only
the explicitly configured servers will be listed.
public void addServer(ca.sqlpower.enterprise.client.SPServerInfo serverInfo)
WabitSessionContextWabitSessionContext.getEnterpriseServers(boolean)
list immediately, and also stored persistently so it will be included in
the enterprise server list in future incarnations of WabitSessionContext.
addServer in interface WabitSessionContextserverInfo - The serverInfo object to add.public void removeServer(ca.sqlpower.enterprise.client.SPServerInfo si)
WabitSessionContext
removeServer in interface WabitSessionContextpublic javax.jmdns.JmDNS getJmDNS()
WabitSessionContext
getJmDNS in interface WabitSessionContextpublic int getSessionCount()
WabitSessionContext
getSessionCount in interface WabitSessionContextpublic boolean isMacOSX()
WabitSessionContext
isMacOSX in interface WabitSessionContextpublic void registerChildSession(WabitSession child)
registerChildSession in interface WabitSessionContextchild - The child session to register. Must be non-null. If it is not
a WabitSwingSession, it will be wrapped in one before it's
registered.public java.util.prefs.Preferences getPrefs()
WabitSessionContext
getPrefs in interface WabitSessionContext
public javax.swing.JMenu createServerListMenu(java.awt.Component dialogOwner,
java.lang.String name,
ServerListMenuItemFactory itemFactory)
WabitSwingSessionContext
createServerListMenu in interface WabitSwingSessionContextdialogOwner - The component that should own any dialogs that pop up as the
result of executing menu actions under the server list menu.public java.lang.String getName()
WabitSessionContext
getName in interface WabitSessionContext
public ca.sqlpower.util.UserPrompter createDatabaseUserPrompter(java.lang.String question,
java.util.List<java.lang.Class<? extends ca.sqlpower.sql.SPDataSource>> dsTypes,
ca.sqlpower.util.UserPrompter.UserPromptOptions optionType,
ca.sqlpower.util.UserPrompter.UserPromptResponse defaultResponseType,
java.lang.Object defaultResponse,
ca.sqlpower.sql.DataSourceCollection<ca.sqlpower.sql.SPDataSource> dsCollection,
java.lang.String... buttonNames)
createDatabaseUserPrompter in interface ca.sqlpower.util.UserPrompterFactorypublic WabitSession getActiveSession()
WabitSessionContext
getActiveSession in interface WabitSessionContextpublic WabitSwingSession getActiveSwingSession()
getActiveSwingSession in interface WabitSwingSessionContextpublic void setActiveSession(WabitSession activeSession)
WabitSessionContext
setActiveSession in interface WabitSessionContextpublic void addPropertyChangeListener(java.beans.PropertyChangeListener l)
addPropertyChangeListener in interface WabitSessionContextpublic void removePropertyChangeListener(java.beans.PropertyChangeListener l)
removePropertyChangeListener in interface WabitSessionContext
public java.sql.Connection borrowConnection(ca.sqlpower.sql.JDBCDataSource dataSource)
throws ca.sqlpower.sqlobject.SQLObjectException
WabitSessionContextConnection.close() on the returned
object as soon as you are finished with it.
Design note: Equivalent to #getDatabase(SPDataSource)
.getConnection(). Normally we discourage adding convenience methods to an
interface, and this is indeed a convenience method on an interface. The
reason for this method is to reinforce the idea that connections to data
sources must be obtained via the SQLDatabase object held in the session.
borrowConnection in interface WabitSessionContextdataSource - The data source this connection comes from.
ca.sqlpower.sqlobject.SQLObjectException - if it is not currently possible to connect to the given data
source. This could be due to the remote database being
unavailable, or an incorrect username or password, a missing
JDBC driver, or many other things.public boolean isLoading()
WabitSessionContext
isLoading in interface WabitSessionContextpublic void startLoading()
WabitSessionContext
startLoading in interface WabitSessionContextpublic void endLoading()
WabitSessionContext
endLoading in interface WabitSessionContextpublic ca.sqlpower.sqlobject.SQLDatabase getDatabase(ca.sqlpower.sql.JDBCDataSource ds)
getDatabase in interface ca.sqlpower.sqlobject.SQLDatabaseMapping
public org.olap4j.OlapConnection createConnection(ca.sqlpower.sql.Olap4jDataSource dataSource)
throws java.sql.SQLException,
java.lang.ClassNotFoundException,
javax.naming.NamingException
OlapConnectionMappingOlapConnection that has been mapped to an
Olap4jDataSource. This connection should not be closed as other
objects may be using it to access the data source.
createConnection in interface OlapConnectionMappingjava.sql.SQLException
java.lang.ClassNotFoundException
javax.naming.NamingException
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception - if startup fails
public ca.sqlpower.util.UserPrompter createUserPrompter(java.lang.String question,
ca.sqlpower.util.UserPrompterFactory.UserPromptType responseType,
ca.sqlpower.util.UserPrompter.UserPromptOptions optionType,
ca.sqlpower.util.UserPrompter.UserPromptResponse defaultResponseType,
java.lang.Object defaultResponse,
java.lang.String... buttonNames)
createUserPrompter in interface ca.sqlpower.util.UserPrompterFactorypublic void addServerListListener(ServerListListener l)
WabitSessionContext
addServerListListener in interface WabitSessionContextpublic void removeServerListListener(ServerListListener l)
WabitSessionContext
removeServerListListener in interface WabitSessionContextpublic ca.sqlpower.swingui.SwingWorkerRegistry getLoadingRegistry()
WabitSwingSessionContextSwingWorkerRegistry for the context to track workers
that are involved with loading files. It would be useful if the
OpenWorkspaceXMLDAO created the session(s) to load into before
creating the thread to do the loading. Then the loading thread could
register with the session and we could remove this implementation.
getLoadingRegistry in interface WabitSwingSessionContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||