|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.sqlpower.architect.swingui.ASUtils
public class ASUtils
ASUtils is a container class for static utility methods used throughout the Swing user interface. "ASUtils" is short for "ArchitectSwingUtils" which is too long to use frequently.
| Method Summary | |
|---|---|
static void |
breakLongMenu(java.awt.Window frame,
javax.swing.JMenu input)
Update a potentially-long JMenu with the nth-last items replaced by sub-menus. |
static ca.sqlpower.swingui.DataEntryPanel |
createDataSourceOptionsPanel(ca.sqlpower.sql.SPDataSource ds)
Creates a tabbed panel for editing various aspects of the given data source. |
static double |
distance(java.awt.Point p1,
java.awt.Point p2)
Returns the length of the shortest line from p1 to p2. |
static ArchitectSwingSessionContext |
getContext()
Deprecated. Use ArchitectSwingSession.getContext() to get your session
context. This method should only be called when launching the app (in main()),
and when picking up the pieces while handling an uncaught exception. |
static java.awt.Image |
getFrameIconImage()
Returns an icon that is suitable for use as a frame icon image in the Architect. |
static java.util.List<java.awt.geom.Point2D.Double> |
getIntersectPoints(java.awt.Shape s1,
java.awt.Shape s2)
|
static boolean |
getLineLineIntersection(java.awt.geom.Line2D.Double l1,
java.awt.geom.Line2D.Double l2,
java.awt.geom.Point2D.Double intersection)
calculate the intersection point of 2 lines, copy from http://persistent.info/archives/2004/03/08/java_lineline_intersections |
static java.lang.String |
lineToString(java.awt.geom.Line2D.Double l)
|
static void |
setupTargetDBComboBox(ArchitectSwingSession session,
javax.swing.JComboBox targetDB)
This method sets up the combo box passed as targetDB to contain all of the source connections. |
static javax.swing.JDialog |
showDbcsDialog(java.awt.Window parentWindow,
ca.sqlpower.sql.SPDataSource dataSource,
java.lang.Runnable onAccept)
Pops up a dialog box that lets the user inspect and change the given db's connection spec. |
static void |
showExceptionDialog(ArchitectSwingSession session,
java.lang.String message,
java.lang.Throwable t)
Displays a dialog box with the given message and exception, allowing the user to examine the stack trace. |
static void |
showExceptionDialogNoReport(java.awt.Component parent,
java.lang.String message,
java.lang.Throwable t)
Displays a dialog box with the given message and exception, allowing the user to examine the stack trace. |
static void |
showExceptionDialogNoReport(java.lang.String message,
java.lang.Throwable t)
Deprecated. This method will create a dialog, but because it has no parent component, it will stay over everything including ArchitectFrames from other sessions. |
static void |
showTargetDbcsDialog(java.awt.Window parentWindow,
ArchitectSwingSession session,
javax.swing.JComboBox targetDB)
Pops up a dialog box that lets the user inspect and change the target db's connection spec. |
void |
startFocusDebugger()
Creates and starts a thread that prints the keyboard focus owner to System.out once per second. |
void |
stopFocusDebugger()
Signals for the focus debugger thread(s) to terminate itself (themselves). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static double distance(java.awt.Point p1,
java.awt.Point p2)
public void stopFocusDebugger()
public void startFocusDebugger()
public static void setupTargetDBComboBox(ArchitectSwingSession session,
javax.swing.JComboBox targetDB)
public static void showTargetDbcsDialog(java.awt.Window parentWindow,
ArchitectSwingSession session,
javax.swing.JComboBox targetDB)
public static javax.swing.JDialog showDbcsDialog(java.awt.Window parentWindow,
ca.sqlpower.sql.SPDataSource dataSource,
java.lang.Runnable onAccept)
parentWindow - The window that owns the dialogsession - the current sessiondataSource - the data source to edit (null not allowed)onAccept - this runnable will be invoked if the user OKs the dialog and
validation succeeds. If you don't need to do anything in this
situation, just pass in null for this parameter.public static ca.sqlpower.swingui.DataEntryPanel createDataSourceOptionsPanel(ca.sqlpower.sql.SPDataSource ds)
ds - The data source to editpublic static java.lang.String lineToString(java.awt.geom.Line2D.Double l)
public static java.util.List<java.awt.geom.Point2D.Double> getIntersectPoints(java.awt.Shape s1,
java.awt.Shape s2)
public static boolean getLineLineIntersection(java.awt.geom.Line2D.Double l1,
java.awt.geom.Line2D.Double l2,
java.awt.geom.Point2D.Double intersection)
l1 - l2 - intersection -
public static void breakLongMenu(java.awt.Window frame,
javax.swing.JMenu input)
frame - The parent Frame or JFrame, used to compute insets and to listen for resizes
(neither of these is implemented at present).input - The JMenu.public static java.awt.Image getFrameIconImage()
public static ArchitectSwingSessionContext getContext()
ArchitectSwingSession.getContext() to get your session
context. This method should only be called when launching the app (in main()),
and when picking up the pieces while handling an uncaught exception.
Under all other circumstances, you should be extremely hesitant to treat the session context as a singleton. We don't really want it to be a singleton. It's more of a dirty little secret that we've let you in on here. If you need the session context for the current session, always always use Session.getContext(), which will give you the context in a much better way.
public static void showExceptionDialogNoReport(java.lang.String message,
java.lang.Throwable t)
message - A user visible string that should explain the problemt - The exception that warranted a dialog
public static void showExceptionDialogNoReport(java.awt.Component parent,
java.lang.String message,
java.lang.Throwable t)
parent - The parent component that will own the dialogmessage - A user-visible message that describes what went wrongt - The exception that warranted a dialog
public static void showExceptionDialog(ArchitectSwingSession session,
java.lang.String message,
java.lang.Throwable t)
Also attempts to post an anonymous description of the error to a central reporting server.
session - The session that the exception occurred inmessage - A user visible string that should describe the problemt - The exception that warranted a dialog
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||