ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/ActiveDoc/Application.pm
(Generate patch)

Comparing COMP/SCRAM/src/ActiveDoc/Application.pm (file contents):
Revision 1.1 by williamc, Thu Jan 20 18:18:45 2000 UTC vs.
Revision 1.3 by williamc, Fri Feb 11 14:55:41 2000 UTC

# Line 10 | Line 10
10   #
11   # Interface
12   # ---------
13 < # new(store)                    : A new Application object
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;
# Line 26 | Line 32 | sub new {
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  
# Line 38 | Line 48 | 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  
# Line 54 | Line 70 | sub activatedoc {
70          my $self=shift;
71          my $url=shift;
72  
57        $self->_initdoc();
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 <        else {
90 <           (defined $self->{options})?$self->{options}:undef;
91 <        }
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});
100 + }
101  
102   # ---------------- private methods
103   sub _initdoc {
# Line 79 | Line 107 | sub _initdoc {
107            $self->{StarterDoc}=ActiveDoc::StarterDoc->new($self->{store},
108                  $self->userinterface(),$self->options());
109          }
110 +                print $self->{StarterDoc}->basequery()."\n";
111   }
112  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines