Totally Objects - Visibility Reporter- Version 5.5 [1.0]
Visibility Reporter is an add-on to Visibility that provides for the generation of printed reports. It has two interfaces:
Its output is a printed representation of the report spread over as many pages as required. Each page may have titles, footers, date, page numbers and any other items that you wish to add.
There are two tester parts for you to experiment with and to track so that you can understand how things happen:
Visibility Reporter is designed, in a visual environment, to interface with a ContainerDetails part. As can be seen in the screen shot below, there are three connections that need to be made to enable this facility to operate.
Loading the part
For the time being, Visibility Reporter is not available as part of the Composition Editor palette. This means that it has to be loaded from the Options - Add Part menu.
Making the connections
Once loaded onto the page, the visual connections are needed. Make the following connections:
The connections described are shown in the screen shot below.
Please note that the one connection that has not been discussed here is the connection from the title bar to a script. This connects the main window to an initialisation script on window opening so that the test ContainerDetails is populated with data.
There are a wide range of properties that can be adjusted within the visual environment. The properties window is shown below.
|autoExpandColumns||When set to true, this will cause the column widths in the printed report to size themselves to the widest string in each column. If set to false, the column widths as set by the ContainerDetails part will be used to set the proportions on the columns in the report. This will mean that if some columns in the report are not actually wide enough for the content then there will be some text overlap in the final printed version.|
|BottomSpace||Defined in lines, this provides space at the bottom of each page for other printed items that you require. For instance, if your company address was set to print on two lines at the bottom of each page, then you would set this value to 2 to ensure that 2 lines were left clear for this.|
|ColumnGap||Defined in 600dpi printer points, this is the space to be used across each column join. 50 would result in 25 points being added to each column either side of the line. This ensures that the text in each column does not start or finish tight to the line.|
|ExcludeList||An array or order collection of column numbers that are not to be included in the final report. Thus, in the example show above, if excludeList was set to #(3 5) then columns 3 and 5 would not appear on the printed version.|
|Expand||When set to true, this will expand the printed version to fill the full width of the page; set to false, the report will only take as much space as required. This works together with the autoExpandColumns, above, so if expand set to false and autoExpandColumns set to true will result in a report that does not fill the full width of the page (unless that is the final width anyway, of course) and has each column expanded to the size required to contain the largest string in that column|
|HeadlineFont||If set, will define the font to be used by the headings, etc. As an example, setting it to 'StdBold' would result, in the demo system, in headlines in 12 point bold Times New Roman. If not set, then this defaults to the standard body font. The name placed here should correspond to a name in the standard Font Dictionary within Visibility.|
|Printer||Any current printer name. It defaults to ##default, which results in the default printer being used.|
|ProcessName||The string that appears in the printer widow when the document is being printed. This should be a standard string of characters.|
|ReportTitle||The default report title. This is a string. If left blank, then no title will appear. This can, like most of these attributes, be over-ridden by later actions, as required.|
|ShowBox||If set to true, a box will be printed that encompasses the total area of the report but not including the topSpace and bottomSpace areas. If set to false then no box is printed.|
|ShopwPageNumber||If set to true, this will force the standard report page numbers to be printed. If set to false, then there will be none. You can, of course, provide your own page numbering if the standard location does not suit.|
|ShowXGrid||If set to true, this results in each column being delineated by a line. If set to false, then no column lines appear.|
|ShowYGrid||If set to true, this results in each row being delineated by a line. If set to false, then no row lines appear.|
|StandardFont||If set, will define the font to be used in the body of the report. As an example, setting it to 'Standard' would result, in the demo system, in headlines in 12 point normal Times New Roman. If not set, then this defaults to 'Standard'. The name placed here should correspond to a name in the standard Font Dictionary within Visibility.|
|TopSpace||Defined in lines, this provides space at the top of each page for other printed items that you require. For instance, if your company address was set to print on two lines at the top of each page, then you would set this value to 2 to ensure that 2 lines were left clear for this.|
|yGridSpace||This, set in 600dpi printer points, defines how far up text in each row appears from the row line. Of set to zero or left blank, this will result in the text sitting on the line. This is obviously not a problem if there are no row lines printed, but it improves the look of the page if these lines are requested.|
What does it look like
The following screen print is of the window that results from clicking the test button on the Composition Editor when containing the views show above.
Clicking on the print button results in the following printed output.
The RBTester class has been designed for you to experiment with the settings. You should change these setting about and see how the printed output changes.
All of the attributes required to print a report are exposed for non-visual use as well as for visual use. However, some of the attributes - in a visual mode - are derived from the ContainerDetails part. If this part is not available, then additional details need to be supplied. A test class is provided that shows you how to do this but the basic creation method is reproduced below:
|report holder contents just wid head|
holder:=RBNonVisualHolder newHolderFor:self contents
report initialCommonItems:self loadInitialItems;
processName:'Non-visual test print';
There are four elements involved here.
This has been alluded to often on the above paragraphs without it being made clear what is happening. The following is the code that is supplied with the demo.
b:=[:maker| |list| list:=OrderedCollection new.
list add:(VisibilityTextObject newFor:Date today printString where:(0@(maker topLineDown:1)) justification:##l font:'StdBold').
maker reportTitle:'Totally Objects - for those special Smalltalk Utilities'.
list add:(VisibilityTextObject newFor:'Printed using Visibility Report Maker' where:(maker pageCenter@(maker bottomLineUp:0)) justification:##c font:'StdBold').
(self subpartNamed: 'maker') initialCommonItems:b
As can be seen, this method creates a block that contains a series of instructions for Visibility Reporter. Specifically it builds a list of Visibility Objects and sends various messages to the ReportMaker itself that:
When the ReportMaker is construction its CommonItems list, it will send the message value:self to this block. Self will replace the maker block variable and the code will be executed. It is up to your inventiveness as to how you extend this idea further.
In a non-visual form, the final line - (self subpartNamed: 'maker') initialCommonItems:b - is not required.
Please note that the source code for Visibility Reporter is supplied as standard so that you can make any changes or additions that you need yourselves.
Copyright (c) 2002 DirectDual Limited (trading as TotallyObjects).
Totally Objects - DirectDual Limited,
34 Compton Avenue,
Gidea Park, Essex,
RM2 6ES, England.
Tel: +44 1708 733295
Fax: +44 1708 783438
DirectDual Limited is an IBM Object Connection member.