ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/ActiveDoc/Application.pm
Revision: 1.1
Committed: Thu Jan 20 18:18:45 2000 UTC (25 years, 3 months ago) by williamc
Content type: text/plain
Branch: MAIN
Log Message:
HIP additions

File Contents

# User Rev Content
1 williamc 1.1 #
2     # Application.pm
3     #
4     # Originally Written by Christopher Williams
5     #
6     # Description
7     # -----------
8     # Sets up the basic Activedoc Structure - and provides applications with
9     # facilities to BootStrap an activedoc
10     #
11     # Interface
12     # ---------
13     # new(store) : A new Application object
14     # activatedoc(url[,options]) : return the oref of a doc corresponding
15     # to the url
16     # userinterface([IntObj]) : set/get user interface object - defaults
17     # to SimpleUserInterface if not overridden
18     # store() : return the store
19    
20     package ActiveDoc::Application;
21     require 5.004;
22     use ActiveDoc::SimpleUserInterface;
23    
24     sub new {
25     my $class=shift;
26     $self={};
27     bless $self, $class;
28     $self->{store}=shift;
29    
30     # make sure data is empty
31     undef $self->{StarterDoc};
32     undef $self->{UI};
33    
34     return $self;
35     }
36    
37     sub store {
38     my $self=shift;
39     return $self->{store};
40     }
41     sub userinterface {
42     my $self=shift;
43    
44     if ( @_ ) {
45     $self->{UI}=shift;
46     }
47     elsif ( ! defined $self->{UI} ) {
48     $self->{UI}=ActiveDoc::SimpleUserInterface->new();
49     }
50     return $self->{UI};
51     }
52    
53     sub activatedoc {
54     my $self=shift;
55     my $url=shift;
56    
57     $self->_initdoc();
58     # Create a new document
59     return $self->{StarterDoc}->activatedoc($url);
60     }
61    
62     sub options {
63     my $self=shift;
64    
65     if ( @_ ) {
66     $self->{options}=shift;
67     }
68     else {
69     (defined $self->{options})?$self->{options}:undef;
70     }
71     }
72    
73    
74     # ---------------- private methods
75     sub _initdoc {
76     my $self=shift;
77    
78     if ( ! defined $self->{StarterDoc} ) {
79     $self->{StarterDoc}=ActiveDoc::StarterDoc->new($self->{store},
80     $self->userinterface(),$self->options());
81     }
82     }
83