jimm.datavision.gui
Class Designer

java.lang.Object
  extended by jimm.datavision.gui.Designer
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, java.util.Observer
Direct Known Subclasses:
DesignApplet, DesignWin

public abstract class Designer
extends java.lang.Object
implements java.awt.event.ActionListener, java.util.Observer

The abstract superclass of Report designer windows and applets.

Author:
Jim Menard, jimm@io.com

Field Summary
protected  javax.swing.JMenuItem aggrItem
           
static int ALIGN_BOTTOM
           
static int ALIGN_CENTER
           
static int ALIGN_LEFT
           
static int ALIGN_MIDDLE
           
static int ALIGN_RIGHT
           
static int ALIGN_SNAP_TO_GRID
           
static int ALIGN_TOP
           
protected  javax.swing.JMenu alignSubmenu
           
protected  javax.swing.JMenuItem borderItem
           
protected  javax.swing.JMenuItem boundsItem
           
protected static javax.swing.JFileChooser chooser
           
protected  CommandHistory commandHistory
           
protected  javax.swing.JMenuItem connectionItem
           
protected  javax.swing.JMenuItem copyItem
           
protected  javax.swing.JMenuItem cutItem
           
protected  javax.swing.JMenuItem defaultFormatItem
           
protected  javax.swing.JMenuItem delGroupItem
           
protected  javax.swing.JMenuItem delSectionItem
           
protected  javax.swing.JMenuItem delSelectionItem
           
protected static java.util.ArrayList designWindows
           
protected static boolean exitWhenLastWindowClosed
           
protected  javax.swing.JMenuItem exportItem
           
protected  javax.swing.JMenuItem formatItem
           
protected  javax.swing.JFrame frame
          The frame may be null; it will be the parent of dialog boxes.
static int GRID_SIZE
           
protected  javax.swing.JMenuItem groupByItem
           
protected  javax.swing.JMenuItem groupItem
           
protected  boolean ignoreKeys
           
protected  javax.swing.JMenu paperSizeSubmenu
           
protected  javax.swing.JMenuItem pasteItem
           
protected  boolean placingNewTextField
           
protected  javax.swing.JMenuItem redoItem
           
protected  Report report
           
protected  java.lang.String reportFilePath
           
protected  javax.swing.RootPaneContainer rootPaneContainer
          The container of the root pane---the highest level widget.
protected  javax.swing.JMenuItem runItem
           
protected  javax.swing.JScrollPane scroller
           
protected  javax.swing.JLayeredPane sectionContainer
           
protected  java.util.ArrayList sectionWidgets
           
protected  javax.swing.JMenuItem sectItem
           
protected  java.util.ArrayList selectedFields
           
protected  javax.swing.JMenuItem selectRecordsItem
           
static int SIZE_SAME_HEIGHT
           
static int SIZE_SAME_SIZE
           
static int SIZE_SAME_WIDTH
           
protected  javax.swing.JMenu sizeSubmenu
           
protected  javax.swing.JMenuItem sortByItem
           
protected  javax.swing.JMenuItem sqlQueryTextItem
           
protected  javax.swing.JMenuItem subreportItem
           
protected  javax.swing.JMenuItem tableJoinItem
           
protected  javax.swing.JMenuItem undoItem
           
 
Constructor Summary
Designer(java.io.File f, java.lang.String databasePassword, javax.swing.RootPaneContainer rpc, javax.swing.JFrame jframe)
          Constructor.
 
Method Summary
protected  void about()
          Opens the about box.
(package private)  void acceptNewTextField()
          The caller has accepted the new text field.
(package private)  java.lang.String action(java.lang.String name)
           
(package private)  java.lang.String action(java.lang.String menu, java.lang.String name)
           
 void actionPerformed(java.awt.event.ActionEvent e)
          Handles user actions.
 void addCommand(Command cmd)
          Adds to the command history a command that has already been performed.
 FieldWidget addTitleField(int x, int width, java.lang.String title)
          Creates and adds a new text field to the first section of the page header.
static void addWindow(Designer win)
          Adds a window to the list of open design windows.
protected  void align(int which)
          Aligns the selected fields to the first selected field (chronologically speaking).
protected  javax.swing.JMenu buildDatabaseMenu()
          Builds and returns the "Database" menu.
protected  javax.swing.JMenu buildEditMenu()
          Builds and returns the "Edit" menu.
protected  javax.swing.JMenu buildFileMenu()
          Builds and returns the "File" menu.
protected  javax.swing.JMenu buildFormatMenu()
          Builds and returns the "Format" menu.
protected  javax.swing.JMenu buildHelpMenu()
          Builds and returns the "Help" menu.
protected  javax.swing.JMenu buildInsertMenu()
          Builds and returns the "Insert" menu.
protected  javax.swing.JMenuBar buildMenuBar()
          Builds the window menu bar.
protected  javax.swing.JMenu buildReportMenu()
          Builds and returns the "Report" menu.
protected  void buildSections()
          Builds the sections and adds them to the section container.
protected  void buildSectionsInArea(SectionArea area)
          Builds the section widgets for the sections in an area and adds them to the section container.
protected  void buildWindow()
          Builds the window components.
protected  void changePaperOrientation(int orientation)
           
protected  void changePaperSize(PaperFormat p)
           
protected  void closeMe()
           
protected  void copySelectedFields()
          Copies the selected fields to the clipboard.
(package private)  int countSelectedFields()
          Returns the number of selected fields.
protected  void createImageField()
          Opens a dialog that asks the user to select an image file.
(package private)  void createNewTextField(SectionWidget sw, java.awt.event.MouseEvent e)
          Asks design window to create and accepts a new text field.
(package private)  void deleteGroupContaining(Section section)
          Deletes the group that contains the specified section.
 void deleteSection(Section s)
          Deletes the specified section.
protected  void deleteSelectedFields()
          Delete selected fields.
protected  void deleteSelectedFieldsAnd(FieldWidget oneMore)
          Delete specified field and all selected fields.
protected static void deleteWindow(Designer win)
          Deletes a window from the list of windows.
 void deselectAll()
          Deselect all fields.
 SectionWidget doDeleteSection(Section s)
          Deletes a section from the report and the design window and returns the section widget above the section's.
protected  void dragSelectedWidgets(int action, java.awt.Point mouseScreenPos)
          Drags the selected field widgets a few pixels.
 void enableMenuItems()
          Enables or disables menu items based on field and window state.
protected  void exportReport()
          Exports the report output using one of the layout engines.
 SectionWidget findSectionWidgetFor(Section s)
          Returns the section widget containing the specified section.
static Designer findWindowFor(Report r)
          Returns the design window associated with the specified report, or null if one is not found.
(package private)  FieldWidget firstSelectedFieldWidget()
          Returns first selected field widget (chronologically speaking).
static javax.swing.JFileChooser getChooser()
           
 java.awt.Frame getFrame()
           
 Report getReport()
           
protected  SectionWidget getSectionWidgetUnder(java.awt.Point screenPos)
          Returns the section widget under the mouse.
protected  void help()
          Opens the help window.
(package private)  void insertSection()
          Inserts a new section below the section containing the first selected field widget.
(package private)  void insertSectionBelow(Section s)
          Inserts a new section below the specified section.
 void insertSectionWidgetAfter(SectionWidget sw, SectionWidget putAfter)
          Inserts a section widget at the specified position in the list.
protected  void insertSubreport()
          Opens the dialog that starts the process of inserting a sub-report.
 void invalidate()
           
(package private)  boolean isPlacingNewTextField()
          Returns true if the user is trying to place a new text field.
protected  void maybeClose()
          Saves the report if it is changed (some command has been performed) and closes the current design window.
protected static void maybeQuit()
          Closes each open design window (unless user cancels).
protected  void newReport()
          Creates a new report in a new design window.
protected  void openAggregateWin()
          Opens a new or existing field aggregate window.
protected  void openBoundsWin()
          Opens a new or existing bounds editor window.
protected  void openDbConnWin(boolean modal)
          Opens a new or existing database connection info window.
protected  void openDefaultFormatWin()
          Opens a new or existing field format window that lets the user edit the report's default format and border.
protected  void openDescripWin()
          Opens a new or existing report description (name, title, etc.) window.
protected  void openFieldPickerWin(int startingType)
          Opens a new or existing field picker window.
protected  void openFormatWin(int whichTab)
          Opens a new or existing field format window.
protected  void openGroupWin()
          Opens a new or existing group order window.
protected  void openNewGroupWin()
          Opens a new or existing new group window.
protected  void openReport()
          Opens an existing report in a new design window.
protected  void openScriptingWin()
          Opens a new or existing report formula language window.
protected  void openSortWin()
          Opens a new or existing sort order window.
protected  void openStartupScriptEditor()
          Opens a starutp script editor.
protected  void openVisTableWin()
          Opens a new or existing visible table joiner window.
protected  void openWhereClauseEditor()
          Opens a new or existing where clause editor.
 void paperSizeChanged(PaperFormat p)
           
protected  void paste()
           
 void performCommand(Command cmd)
          Performs a command.
(package private)  void pickUp(java.awt.Point mouseScreenPos)
          Picks up the field widget because field dragging is starting.
protected  void placeNewTextField()
          Sets the flag that tells everyone else that the user wants to place a new text field.
(package private)  void putDown(FieldWidget f, java.awt.Point origScreenPos, java.awt.Point mouseScreenPos)
          Puts the dragged field widgets down inside the sections they are floating above.
protected  boolean readReport(java.io.File f, java.lang.String databasePassword)
          Reads the named report file or, if it's null, creates a new, empty report.
 void rebuildGroups()
          Rebuilds the group sections and redisplays the report.
(package private)  void rejectNewTextField()
          The caller has rejected the new text field.
protected  void renameSectionWidgets()
          Recalculates section names for all sections in the report.
protected  void renameSectionWidgetsIn(SectionArea area, java.lang.String prefix, Group group)
          Recalculates section names for a collection of sections.
protected  void runReport()
          Runs and displays the report.
static void savePrefsDir(javax.swing.JFileChooser jfc, java.lang.String key)
          Store the JFileChoosers current directory in the preferences this 'remembers' the last directory used so the user isn't having to navigate to their report directory each time.
protected  void saveReport()
          Saves the current report.
protected  void saveReportAs()
          Saves the current report in a different file.
 void select(FieldWidget fieldWidget, boolean makeSelected, boolean deselectOthers)
          Selects a field widget, possibly deselecting all others everywhere.
static void setExitWhenLastWinClosed(boolean exit)
          Sets value of flag that determines if the application should exit when the last design window is closed.
(package private)  void setFieldVisibility(boolean newVisiblity, FieldWidget fw)
          Toggles the visibility of all selected fields plus the one passed in.
 void setIgnoreKeys(boolean ignore)
           
static void setPrefsDir(javax.swing.JFileChooser jfc, java.lang.String key)
          Sets the current directory for the chooser based on the directory stored in the java preferences for value 'key'.
protected  void showSQL()
          Opens a new window containing the SQL query text.
protected  void size(int which)
          Resize the selected fields based on the first selected field (chronologically speaking) and the specified resize (width, height, both).
 void snapToGrid(Rectangle r)
          Snaps the rectangle to the grid.
 boolean someSelectedFieldUsesFormat()
          Returns true if there is some selected field that can be formatted.
(package private)  void startStretching(java.awt.Point mouseScreenPos)
          Starts stretching all selected fields.
(package private)  void stopStretching(FieldWidget f, Rectangle origBounds)
          Tells each field to stop stretching and creates a command that will undo all that stretching.
 void update(java.util.Observable o, java.lang.Object arg)
           
 void updatePaperSizeMenu(PaperFormat p)
          Update paper orientation and size menus.
(package private)  void withSelectedFieldsDo(FieldWalker perambulator)
          Hands each selected field widget's field to the specified FieldWalker.
(package private)  void withWidgetsDo(FieldWidgetWalker perambulator)
          Hands each field widget to the specified FieldWidgetWalker.
protected  void writeReportFile(java.lang.String fileName)
          Writes the current report to the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRID_SIZE

public static final int GRID_SIZE
See Also:
Constant Field Values

ALIGN_TOP

public static final int ALIGN_TOP
See Also:
Constant Field Values

ALIGN_MIDDLE

public static final int ALIGN_MIDDLE
See Also:
Constant Field Values

ALIGN_BOTTOM

public static final int ALIGN_BOTTOM
See Also:
Constant Field Values

ALIGN_LEFT

public static final int ALIGN_LEFT
See Also:
Constant Field Values

ALIGN_CENTER

public static final int ALIGN_CENTER
See Also:
Constant Field Values

ALIGN_RIGHT

public static final int ALIGN_RIGHT
See Also:
Constant Field Values

ALIGN_SNAP_TO_GRID

public static final int ALIGN_SNAP_TO_GRID
See Also:
Constant Field Values

SIZE_SAME_WIDTH

public static final int SIZE_SAME_WIDTH
See Also:
Constant Field Values

SIZE_SAME_HEIGHT

public static final int SIZE_SAME_HEIGHT
See Also:
Constant Field Values

SIZE_SAME_SIZE

public static final int SIZE_SAME_SIZE
See Also:
Constant Field Values

designWindows

protected static java.util.ArrayList designWindows

exitWhenLastWindowClosed

protected static boolean exitWhenLastWindowClosed

chooser

protected static javax.swing.JFileChooser chooser

report

protected Report report

frame

protected javax.swing.JFrame frame
The frame may be null; it will be the parent of dialog boxes.


rootPaneContainer

protected javax.swing.RootPaneContainer rootPaneContainer
The container of the root pane---the highest level widget.


commandHistory

protected CommandHistory commandHistory

sectionWidgets

protected java.util.ArrayList sectionWidgets

reportFilePath

protected java.lang.String reportFilePath

sectionContainer

protected javax.swing.JLayeredPane sectionContainer

selectedFields

protected java.util.ArrayList selectedFields

scroller

protected javax.swing.JScrollPane scroller

undoItem

protected javax.swing.JMenuItem undoItem

redoItem

protected javax.swing.JMenuItem redoItem

cutItem

protected javax.swing.JMenuItem cutItem

copyItem

protected javax.swing.JMenuItem copyItem

pasteItem

protected javax.swing.JMenuItem pasteItem

delSelectionItem

protected javax.swing.JMenuItem delSelectionItem

delGroupItem

protected javax.swing.JMenuItem delGroupItem

delSectionItem

protected javax.swing.JMenuItem delSectionItem

aggrItem

protected javax.swing.JMenuItem aggrItem

groupItem

protected javax.swing.JMenuItem groupItem

sectItem

protected javax.swing.JMenuItem sectItem

formatItem

protected javax.swing.JMenuItem formatItem

borderItem

protected javax.swing.JMenuItem borderItem

boundsItem

protected javax.swing.JMenuItem boundsItem

defaultFormatItem

protected javax.swing.JMenuItem defaultFormatItem

tableJoinItem

protected javax.swing.JMenuItem tableJoinItem

sqlQueryTextItem

protected javax.swing.JMenuItem sqlQueryTextItem

connectionItem

protected javax.swing.JMenuItem connectionItem

selectRecordsItem

protected javax.swing.JMenuItem selectRecordsItem

sortByItem

protected javax.swing.JMenuItem sortByItem

groupByItem

protected javax.swing.JMenuItem groupByItem

runItem

protected javax.swing.JMenuItem runItem

exportItem

protected javax.swing.JMenuItem exportItem

subreportItem

protected javax.swing.JMenuItem subreportItem

alignSubmenu

protected javax.swing.JMenu alignSubmenu

sizeSubmenu

protected javax.swing.JMenu sizeSubmenu

paperSizeSubmenu

protected javax.swing.JMenu paperSizeSubmenu

placingNewTextField

protected boolean placingNewTextField

ignoreKeys

protected boolean ignoreKeys
Constructor Detail

Designer

public Designer(java.io.File f,
                java.lang.String databasePassword,
                javax.swing.RootPaneContainer rpc,
                javax.swing.JFrame jframe)
Constructor. Reads the named report file or, if it's null, creates a new, empty report.

Parameters:
f - an XML report file; may be null
databasePassword - string to give to report; OK if it's null
rpc - the root pane container (the JFrame or JApplet)
jframe - the design window; may be null (for example, when the designer is an applet)
Method Detail

addWindow

public static void addWindow(Designer win)
Adds a window to the list of open design windows. Also notifies the error handler class that we it should use the GUI to display error messages.

Parameters:
win - a design window

findWindowFor

public static Designer findWindowFor(Report r)
Returns the design window associated with the specified report, or null if one is not found.

Parameters:
r - a report
Returns:
a design window or null if one is not found

setExitWhenLastWinClosed

public static void setExitWhenLastWinClosed(boolean exit)
Sets value of flag that determines if the application should exit when the last design window is closed. The default value is true.


deleteWindow

protected static void deleteWindow(Designer win)
Deletes a window from the list of windows. If there are no more design windows left and exitWhenLastWindowClosed is true (which it is by default), exits the application.

Parameters:
win - a design window

maybeQuit

protected static void maybeQuit()
Closes each open design window (unless user cancels). If all are closed, quits the application.


getChooser

public static javax.swing.JFileChooser getChooser()

setPrefsDir

public static void setPrefsDir(javax.swing.JFileChooser jfc,
                               java.lang.String key)
Sets the current directory for the chooser based on the directory stored in the java preferences for value 'key'. Default key is reportDir


savePrefsDir

public static void savePrefsDir(javax.swing.JFileChooser jfc,
                                java.lang.String key)
Store the JFileChoosers current directory in the preferences this 'remembers' the last directory used so the user isn't having to navigate to their report directory each time.


closeMe

protected void closeMe()

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

performCommand

public void performCommand(Command cmd)
Performs a command.

Parameters:
cmd - a command

addCommand

public void addCommand(Command cmd)
Adds to the command history a command that has already been performed.

Parameters:
cmd - a command

readReport

protected boolean readReport(java.io.File f,
                             java.lang.String databasePassword)
Reads the named report file or, if it's null, creates a new, empty report. Returns true if we need to ask the user for connection info because this is a new report.

Parameters:
f - report XML file
databasePassword - string to give to report; OK if it's null
Returns:
true if we need to ask the user for connection info

setIgnoreKeys

public void setIgnoreKeys(boolean ignore)

buildWindow

protected void buildWindow()
Builds the window components.


buildMenuBar

protected javax.swing.JMenuBar buildMenuBar()
Builds the window menu bar.


buildFileMenu

protected javax.swing.JMenu buildFileMenu()
Builds and returns the "File" menu.

Returns:
a menu

buildEditMenu

protected javax.swing.JMenu buildEditMenu()
Builds and returns the "Edit" menu.

Returns:
a menu

buildInsertMenu

protected javax.swing.JMenu buildInsertMenu()
Builds and returns the "Insert" menu.

Returns:
a menu

buildFormatMenu

protected javax.swing.JMenu buildFormatMenu()
Builds and returns the "Format" menu.

Returns:
a menu

buildDatabaseMenu

protected javax.swing.JMenu buildDatabaseMenu()
Builds and returns the "Database" menu.

Returns:
a menu

buildReportMenu

protected javax.swing.JMenu buildReportMenu()
Builds and returns the "Report" menu.

Returns:
a menu

buildHelpMenu

protected javax.swing.JMenu buildHelpMenu()
Builds and returns the "Help" menu.

Returns:
a menu

buildSections

protected void buildSections()
Builds the sections and adds them to the section container.


buildSectionsInArea

protected void buildSectionsInArea(SectionArea area)
Builds the section widgets for the sections in an area and adds them to the section container. We name the widgets with a separate call to renameSectionWidgets().

We also start observing each section. Though our caller is called more than once, it is OK to call addObserver() on an Observable multiple times.

Parameters:
area - contains sections

renameSectionWidgets

protected void renameSectionWidgets()
Recalculates section names for all sections in the report. Calls renameSectionWidgetsIn(jimm.datavision.SectionArea, java.lang.String, jimm.datavision.Group) for each group of sections.


renameSectionWidgetsIn

protected void renameSectionWidgetsIn(SectionArea area,
                                      java.lang.String prefix,
                                      Group group)
Recalculates section names for a collection of sections. Called from renameSectionWidgets(). Also sets the section's popup menu's first item text.

Parameters:
area - a section area
prefix - prepended to all section names in the collection
group - the group containing this section list; may be null

enableMenuItems

public void enableMenuItems()
Enables or disables menu items based on field and window state.


someSelectedFieldUsesFormat

public boolean someSelectedFieldUsesFormat()
Returns true if there is some selected field that can be formatted.

Returns:
true if there is some selected field that can be formatted

action

java.lang.String action(java.lang.String name)

action

java.lang.String action(java.lang.String menu,
                        java.lang.String name)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handles user actions.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

changePaperOrientation

protected void changePaperOrientation(int orientation)

changePaperSize

protected void changePaperSize(PaperFormat p)

updatePaperSizeMenu

public void updatePaperSizeMenu(PaperFormat p)
Update paper orientation and size menus.


paperSizeChanged

public void paperSizeChanged(PaperFormat p)

getFrame

public java.awt.Frame getFrame()

invalidate

public void invalidate()

getReport

public Report getReport()

newReport

protected void newReport()
Creates a new report in a new design window.


openReport

protected void openReport()
Opens an existing report in a new design window.


saveReport

protected void saveReport()
Saves the current report.


saveReportAs

protected void saveReportAs()
Saves the current report in a different file.


writeReportFile

protected void writeReportFile(java.lang.String fileName)
Writes the current report to the specified file. Also tells the command history the report has been saved so it knows how to report if any changes have been made from this point on.

Parameters:
fileName - a file name

exportReport

protected void exportReport()
Exports the report output using one of the layout engines.


maybeClose

protected void maybeClose()
Saves the report if it is changed (some command has been performed) and closes the current design window. If there are no more open design windows, exist the application.


runReport

protected void runReport()
Runs and displays the report.


countSelectedFields

int countSelectedFields()
Returns the number of selected fields.

Returns:
the number of selected fields

withWidgetsDo

void withWidgetsDo(FieldWidgetWalker perambulator)
Hands each field widget to the specified FieldWidgetWalker.

Parameters:
perambulator - a field widget walker

withSelectedFieldsDo

void withSelectedFieldsDo(FieldWalker perambulator)
Hands each selected field widget's field to the specified FieldWalker.

Parameters:
perambulator - a field walker

deleteGroupContaining

void deleteGroupContaining(Section section)
Deletes the group that contains the specified section.

Parameters:
section - a report section

insertSection

void insertSection()
Inserts a new section below the section containing the first selected field widget. Only called when at least one widget is selected.


insertSectionBelow

void insertSectionBelow(Section s)
Inserts a new section below the specified section.

Parameters:
s - a report section

insertSectionWidgetAfter

public void insertSectionWidgetAfter(SectionWidget sw,
                                     SectionWidget putAfter)
Inserts a section widget at the specified position in the list. Also starts observing the section and renames all section widgets (adding "(a)", for example. Called from NewSectionCommand.perform().

Parameters:
sw - the section widget to insert
putAfter - sw goes after this widget; may be null

deleteSection

public void deleteSection(Section s)
Deletes the specified section. Does nothing if this section is the only one of its kind. (This method should only be called if the section is not one-of-a-kind. No harm done if you do, though.)

Parameters:
s - a report section

doDeleteSection

public SectionWidget doDeleteSection(Section s)
Deletes a section from the report and the design window and returns the section widget above the section's. If s is the first section in the report, returns null. Called from commands; don't call this yourself. Insetad call deleteSection(jimm.datavision.Section).

Parameters:
s - the section to delete
Returns:
the section widget above the section's, or null if there is none

insertSubreport

protected void insertSubreport()
Opens the dialog that starts the process of inserting a sub-report.


rebuildGroups

public void rebuildGroups()
Rebuilds the group sections and redisplays the report.


addTitleField

public FieldWidget addTitleField(int x,
                                 int width,
                                 java.lang.String title)
Creates and adds a new text field to the first section of the page header.

Parameters:
x - where to place the title
width - how wide it should be
title - the string to display
Returns:
the newly-created widget

align

protected void align(int which)
Aligns the selected fields to the first selected field (chronologically speaking).

Parameters:
which - alignment constant.

size

protected void size(int which)
Resize the selected fields based on the first selected field (chronologically speaking) and the specified resize (width, height, both).

Parameters:
which - size constant

firstSelectedFieldWidget

FieldWidget firstSelectedFieldWidget()
Returns first selected field widget (chronologically speaking). May return null if no fields are selected

Returns:
field widget selected the earliest, or null if no fields are selected

select

public void select(FieldWidget fieldWidget,
                   boolean makeSelected,
                   boolean deselectOthers)
Selects a field widget, possibly deselecting all others everywhere. Called from section widget.

Parameters:
fieldWidget - a field widget
makeSelected - new selection state
deselectOthers - if true, all other fields in all sections are deselected first

deselectAll

public void deselectAll()
Deselect all fields. Called from SectionWidget.deselectAll().


copySelectedFields

protected void copySelectedFields()
Copies the selected fields to the clipboard. We need to create Pasteable objects.


paste

protected void paste()

deleteSelectedFields

protected void deleteSelectedFields()
Delete selected fields.


deleteSelectedFieldsAnd

protected void deleteSelectedFieldsAnd(FieldWidget oneMore)
Delete specified field and all selected fields.

Parameters:
oneMore - an additional field to delete; may be null

setFieldVisibility

void setFieldVisibility(boolean newVisiblity,
                        FieldWidget fw)
Toggles the visibility of all selected fields plus the one passed in. Called by a section widget.

See Also:
FieldWidget.doSetVisibility(boolean)

createNewTextField

void createNewTextField(SectionWidget sw,
                        java.awt.event.MouseEvent e)
Asks design window to create and accepts a new text field. Called from SectionWidget.createNewTextField(java.awt.event.MouseEvent).

See Also:
createNewTextField(jimm.datavision.gui.SectionWidget, java.awt.event.MouseEvent)

pickUp

void pickUp(java.awt.Point mouseScreenPos)
Picks up the field widget because field dragging is starting. Called from SectionWidget#pickUp.

Parameters:
mouseScreenPos - the location of the mouse in screen coordinates

putDown

void putDown(FieldWidget f,
             java.awt.Point origScreenPos,
             java.awt.Point mouseScreenPos)
Puts the dragged field widgets down inside the sections they are floating above. Called from SectionWidget.putDown(jimm.datavision.gui.FieldWidget, java.awt.Point, java.awt.Point).

Parameters:
f - the field widget being dragged; all other selected fields have been dragged along with it
origScreenPos - the original location of the field in screen coordinates
mouseScreenPos - the current mouse position in screen coordinates; note

startStretching

void startStretching(java.awt.Point mouseScreenPos)
Starts stretching all selected fields. Called from SectionWidget.startStretching(java.awt.Point).

Parameters:
mouseScreenPos - the location of the mouse in screen coordinates

stopStretching

void stopStretching(FieldWidget f,
                    Rectangle origBounds)
Tells each field to stop stretching and creates a command that will undo all that stretching. Called from SectionWidget.stopStretching(jimm.datavision.gui.FieldWidget, jimm.datavision.field.Rectangle).

Parameters:
f - the field widget being dragged; all other selected fields have been dragged along with it
origBounds - the field's original bounds

getSectionWidgetUnder

protected SectionWidget getSectionWidgetUnder(java.awt.Point screenPos)
Returns the section widget under the mouse. Returns null unless the mouse is over a section field panel (the white area on which fields belong).

Parameters:
screenPos - a position in screen coordinates
Returns:
the SectionWidget under the mouse

dragSelectedWidgets

protected void dragSelectedWidgets(int action,
                                   java.awt.Point mouseScreenPos)
Drags the selected field widgets a few pixels. Called from section that contains field being dragged.

Parameters:
action - a FieldWidget.ACTION_* constant
mouseScreenPos - mouse screen position

openFieldPickerWin

protected void openFieldPickerWin(int startingType)
Opens a new or existing field picker window.

Parameters:
startingType - the index of the starting type to display

openAggregateWin

protected void openAggregateWin()
Opens a new or existing field aggregate window. We should only get here if there is exactly one selected field.


createImageField

protected void createImageField()
Opens a dialog that asks the user to select an image file. Creates an image in the report header.


openNewGroupWin

protected void openNewGroupWin()
Opens a new or existing new group window.


placeNewTextField

protected void placeNewTextField()
Sets the flag that tells everyone else that the user wants to place a new text field.


isPlacingNewTextField

boolean isPlacingNewTextField()
Returns true if the user is trying to place a new text field.

Returns:
true if the user is trying to place a new text field

acceptNewTextField

void acceptNewTextField()
The caller has accepted the new text field.


rejectNewTextField

void rejectNewTextField()
The caller has rejected the new text field.


openFormatWin

protected void openFormatWin(int whichTab)
Opens a new or existing field format window.

Parameters:
whichTab - the index of the tab to display when opened

openDefaultFormatWin

protected void openDefaultFormatWin()
Opens a new or existing field format window that lets the user edit the report's default format and border.


openBoundsWin

protected void openBoundsWin()
Opens a new or existing bounds editor window.


openVisTableWin

protected void openVisTableWin()
Opens a new or existing visible table joiner window.


openWhereClauseEditor

protected void openWhereClauseEditor()
Opens a new or existing where clause editor.


openSortWin

protected void openSortWin()
Opens a new or existing sort order window.


openGroupWin

protected void openGroupWin()
Opens a new or existing group order window.


openStartupScriptEditor

protected void openStartupScriptEditor()
Opens a starutp script editor.


openScriptingWin

protected void openScriptingWin()
Opens a new or existing report formula language window.


openDescripWin

protected void openDescripWin()
Opens a new or existing report description (name, title, etc.) window.


help

protected void help()
Opens the help window.


about

protected void about()
Opens the about box.


openDbConnWin

protected void openDbConnWin(boolean modal)
Opens a new or existing database connection info window.

Parameters:
modal - passed on to dialog constructor

showSQL

protected void showSQL()
Opens a new window containing the SQL query text.


findSectionWidgetFor

public SectionWidget findSectionWidgetFor(Section s)
Returns the section widget containing the specified section.

Parameters:
s - section
Returns:
the section widget containing the section

snapToGrid

public void snapToGrid(Rectangle r)
Snaps the rectangle to the grid.

Parameters:
r - a rectangle