|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jimm.datavision.gui.Designer
public abstract class Designer
The abstract superclass of Report
designer windows and applets.
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 |
---|
public static final int GRID_SIZE
public static final int ALIGN_TOP
public static final int ALIGN_MIDDLE
public static final int ALIGN_BOTTOM
public static final int ALIGN_LEFT
public static final int ALIGN_CENTER
public static final int ALIGN_RIGHT
public static final int ALIGN_SNAP_TO_GRID
public static final int SIZE_SAME_WIDTH
public static final int SIZE_SAME_HEIGHT
public static final int SIZE_SAME_SIZE
protected static java.util.ArrayList designWindows
protected static boolean exitWhenLastWindowClosed
protected static javax.swing.JFileChooser chooser
protected Report report
protected javax.swing.JFrame frame
protected javax.swing.RootPaneContainer rootPaneContainer
protected CommandHistory commandHistory
protected java.util.ArrayList sectionWidgets
protected java.lang.String reportFilePath
protected javax.swing.JLayeredPane sectionContainer
protected java.util.ArrayList selectedFields
protected javax.swing.JScrollPane scroller
protected javax.swing.JMenuItem undoItem
protected javax.swing.JMenuItem redoItem
protected javax.swing.JMenuItem cutItem
protected javax.swing.JMenuItem copyItem
protected javax.swing.JMenuItem pasteItem
protected javax.swing.JMenuItem delSelectionItem
protected javax.swing.JMenuItem delGroupItem
protected javax.swing.JMenuItem delSectionItem
protected javax.swing.JMenuItem aggrItem
protected javax.swing.JMenuItem groupItem
protected javax.swing.JMenuItem sectItem
protected javax.swing.JMenuItem formatItem
protected javax.swing.JMenuItem borderItem
protected javax.swing.JMenuItem boundsItem
protected javax.swing.JMenuItem defaultFormatItem
protected javax.swing.JMenuItem tableJoinItem
protected javax.swing.JMenuItem sqlQueryTextItem
protected javax.swing.JMenuItem connectionItem
protected javax.swing.JMenuItem selectRecordsItem
protected javax.swing.JMenuItem sortByItem
protected javax.swing.JMenuItem groupByItem
protected javax.swing.JMenuItem runItem
protected javax.swing.JMenuItem exportItem
protected javax.swing.JMenuItem subreportItem
protected javax.swing.JMenu alignSubmenu
protected javax.swing.JMenu sizeSubmenu
protected javax.swing.JMenu paperSizeSubmenu
protected boolean placingNewTextField
protected boolean ignoreKeys
Constructor Detail |
---|
public Designer(java.io.File f, java.lang.String databasePassword, javax.swing.RootPaneContainer rpc, javax.swing.JFrame jframe)
null
,
creates a new, empty report.
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 |
---|
public static void addWindow(Designer win)
win
- a design windowpublic static Designer findWindowFor(Report r)
null
if one is not found.
r
- a report
null
if one is not foundpublic static void setExitWhenLastWinClosed(boolean exit)
true
.
protected static void deleteWindow(Designer win)
true
(which it is by default), exits the application.
win
- a design windowprotected static void maybeQuit()
public static javax.swing.JFileChooser getChooser()
public static void setPrefsDir(javax.swing.JFileChooser jfc, java.lang.String key)
public static void savePrefsDir(javax.swing.JFileChooser jfc, java.lang.String key)
protected void closeMe()
public void update(java.util.Observable o, java.lang.Object arg)
update
in interface java.util.Observer
public void performCommand(Command cmd)
cmd
- a commandpublic void addCommand(Command cmd)
cmd
- a commandprotected boolean readReport(java.io.File f, java.lang.String databasePassword)
null
, creates
a new, empty report. Returns true
if we need to ask
the user for connection info because this is a new report.
f
- report XML filedatabasePassword
- string to give to report; OK if it's
null
true
if we need to ask the user for connection infopublic void setIgnoreKeys(boolean ignore)
protected void buildWindow()
protected javax.swing.JMenuBar buildMenuBar()
protected javax.swing.JMenu buildFileMenu()
protected javax.swing.JMenu buildEditMenu()
protected javax.swing.JMenu buildInsertMenu()
protected javax.swing.JMenu buildFormatMenu()
protected javax.swing.JMenu buildDatabaseMenu()
protected javax.swing.JMenu buildReportMenu()
protected javax.swing.JMenu buildHelpMenu()
protected void buildSections()
protected void buildSectionsInArea(SectionArea area)
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.
area
- contains sectionsprotected void renameSectionWidgets()
renameSectionWidgetsIn(jimm.datavision.SectionArea, java.lang.String, jimm.datavision.Group)
for each group of sections.
protected void renameSectionWidgetsIn(SectionArea area, java.lang.String prefix, Group group)
renameSectionWidgets()
. Also sets the section's popup menu's first item
text.
area
- a section areaprefix
- prepended to all section names in the collectiongroup
- the group containing this section list; may be
null
public void enableMenuItems()
public boolean someSelectedFieldUsesFormat()
true
if there is some selected field that can
be formatted.
true
if there is some selected field that can
be formattedjava.lang.String action(java.lang.String name)
java.lang.String action(java.lang.String menu, java.lang.String name)
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
protected void changePaperOrientation(int orientation)
protected void changePaperSize(PaperFormat p)
public void updatePaperSizeMenu(PaperFormat p)
public void paperSizeChanged(PaperFormat p)
public java.awt.Frame getFrame()
public void invalidate()
public Report getReport()
protected void newReport()
protected void openReport()
protected void saveReport()
protected void saveReportAs()
protected void writeReportFile(java.lang.String fileName)
fileName
- a file nameprotected void exportReport()
protected void maybeClose()
protected void runReport()
int countSelectedFields()
void withWidgetsDo(FieldWidgetWalker perambulator)
FieldWidgetWalker
.
perambulator
- a field widget walkervoid withSelectedFieldsDo(FieldWalker perambulator)
FieldWalker
.
perambulator
- a field walkervoid deleteGroupContaining(Section section)
section
- a report sectionvoid insertSection()
void insertSectionBelow(Section s)
s
- a report sectionpublic void insertSectionWidgetAfter(SectionWidget sw, SectionWidget putAfter)
NewSectionCommand.perform()
.
sw
- the section widget to insertputAfter
- sw goes after this widget; may be
null
public void deleteSection(Section s)
s
- a report sectionpublic SectionWidget doDeleteSection(Section s)
null
. Called from commands;
don't call this yourself. Insetad call deleteSection(jimm.datavision.Section)
.
s
- the section to delete
null
if there is noneprotected void insertSubreport()
public void rebuildGroups()
public FieldWidget addTitleField(int x, int width, java.lang.String title)
x
- where to place the titlewidth
- how wide it should betitle
- the string to display
protected void align(int which)
which
- alignment constant.protected void size(int which)
which
- size constantFieldWidget firstSelectedFieldWidget()
null
if no fields are selected
null
if
no fields are selectedpublic void select(FieldWidget fieldWidget, boolean makeSelected, boolean deselectOthers)
fieldWidget
- a field widgetmakeSelected
- new selection statedeselectOthers
- if true
, all other fields in all
sections are deselected firstpublic void deselectAll()
SectionWidget.deselectAll()
.
protected void copySelectedFields()
Pasteable
objects.
protected void paste()
protected void deleteSelectedFields()
protected void deleteSelectedFieldsAnd(FieldWidget oneMore)
oneMore
- an additional field to delete; may be null
void setFieldVisibility(boolean newVisiblity, FieldWidget fw)
FieldWidget.doSetVisibility(boolean)
void createNewTextField(SectionWidget sw, java.awt.event.MouseEvent e)
SectionWidget.createNewTextField(java.awt.event.MouseEvent)
.
createNewTextField(jimm.datavision.gui.SectionWidget, java.awt.event.MouseEvent)
void pickUp(java.awt.Point mouseScreenPos)
mouseScreenPos
- the location of the mouse in screen coordinatesvoid putDown(FieldWidget f, java.awt.Point origScreenPos, java.awt.Point mouseScreenPos)
SectionWidget.putDown(jimm.datavision.gui.FieldWidget, java.awt.Point, java.awt.Point)
.
f
- the field widget being dragged; all other selected fields
have been dragged along with itorigScreenPos
- the original location of the field in screen
coordinatesmouseScreenPos
- the current mouse position in screen coordinates;
notevoid startStretching(java.awt.Point mouseScreenPos)
SectionWidget.startStretching(java.awt.Point)
.
mouseScreenPos
- the location of the mouse in screen coordinatesvoid stopStretching(FieldWidget f, Rectangle origBounds)
SectionWidget.stopStretching(jimm.datavision.gui.FieldWidget, jimm.datavision.field.Rectangle)
.
f
- the field widget being dragged; all other selected fields
have been dragged along with itorigBounds
- the field's original boundsprotected SectionWidget getSectionWidgetUnder(java.awt.Point screenPos)
null
unless the mouse is over a section field panel (the white area on
which fields belong).
screenPos
- a position in screen coordinates
protected void dragSelectedWidgets(int action, java.awt.Point mouseScreenPos)
action
- a FieldWidget
.ACTION_*
constantmouseScreenPos
- mouse screen positionprotected void openFieldPickerWin(int startingType)
startingType
- the index of the starting type to displayprotected void openAggregateWin()
protected void createImageField()
protected void openNewGroupWin()
protected void placeNewTextField()
boolean isPlacingNewTextField()
true
if the user is trying to place a new text field.
true
if the user is trying to place a new text fieldvoid acceptNewTextField()
void rejectNewTextField()
protected void openFormatWin(int whichTab)
whichTab
- the index of the tab to display when openedprotected void openDefaultFormatWin()
protected void openBoundsWin()
protected void openVisTableWin()
protected void openWhereClauseEditor()
protected void openSortWin()
protected void openGroupWin()
protected void openStartupScriptEditor()
protected void openScriptingWin()
protected void openDescripWin()
protected void help()
protected void about()
protected void openDbConnWin(boolean modal)
modal
- passed on to dialog constructorprotected void showSQL()
public SectionWidget findSectionWidgetFor(Section s)
s
- section
public void snapToGrid(Rectangle r)
r
- a rectangle
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |