ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/ActiveDoc/Application.pm
Revision: 1.4
Committed: Wed Feb 23 14:54:01 2000 UTC (25 years, 2 months ago) by williamc
Content type: text/plain
Branch: MAIN
CVS Tags: v102p1, V1_0_1, V1_0_0, V1_pre0, SCRAM_V1, SCRAMV1_IMPORT, V0_19_7, V0_19_6, V0_19_6p1, V0_19_5, SFATEST, V0_19_4, V0_19_4_pre3, V0_19_4_pre2, V0_19_4_pre1, V0_19_3, V0_19_2, V0_19_1, V0_19_0, V0_18_5, V0_18_4, V_18_3_TEST, VO_18_3, V0_18_2, V0_18_1, ProtoEnd
Branch point for: V1_pre1, SCRAM_V1_BRANCH, V0_19_4_B
Changes since 1.3: +1 -2 lines
Log Message:
bring in line

File Contents

# Content
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,[query]) : 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 # newdoc(type) : Instantiate a new ActiveDoc
20 # object of the specified type
21 # find(@keys) : find an object in the activedoc objectdb
22 # options() : Get/Set the options object - make one if
23 # not already provided
24 # setoption(name,value) : set an option in the current base options
25
26 package ActiveDoc::Application;
27 require 5.004;
28 use ActiveDoc::SimpleUserInterface;
29
30 sub new {
31 my $class=shift;
32 $self={};
33 bless $self, $class;
34 $self->{store}=shift;
35 if ( @_ ) {
36 $self->options(shift);
37 }
38
39 # make sure data is empty
40 undef $self->{StarterDoc};
41 undef $self->{UI};
42
43 $self->_initdoc();
44 return $self;
45 }
46
47 sub store {
48 my $self=shift;
49 return $self->{store};
50 }
51
52 sub find {
53 my $self=shift;
54 return ($self->{store}->find(@_));
55 }
56
57 sub userinterface {
58 my $self=shift;
59
60 if ( @_ ) {
61 $self->{UI}=shift;
62 }
63 elsif ( ! defined $self->{UI} ) {
64 $self->{UI}=ActiveDoc::SimpleUserInterface->new();
65 }
66 return $self->{UI};
67 }
68
69 sub activatedoc {
70 my $self=shift;
71 my $url=shift;
72
73 # Create a new document
74 return $self->{StarterDoc}->activatedoc($url);
75 }
76
77 sub setoption {
78 my $self=shift;
79
80 $self->options()->setparam(@_);
81 }
82
83 sub options {
84 my $self=shift;
85
86 if ( @_ ) {
87 $self->{options}=shift;
88 }
89 elsif ( ! defined $self->{options}) {
90 $self->{options}=ActiveDoc::Query->new();
91 }
92 return $self->{options};
93 }
94
95 sub newdoc {
96 my $self=shift;
97 my $type=shift;
98
99 return $type->new($self->{store},$self->{StarterDoc}->basequery());
100 }
101
102 # ---------------- private methods
103 sub _initdoc {
104 my $self=shift;
105
106 if ( ! defined $self->{StarterDoc} ) {
107 $self->{StarterDoc}=ActiveDoc::StarterDoc->new($self->{store},
108 $self->userinterface(),$self->options());
109 }
110 }
111