4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.6 2003/04/10 06:19:33 joko |
8 |
|
## minor fix: prevent use of undefined instance |
9 |
|
## |
10 |
|
## Revision 1.5 2003/04/07 22:29:27 jonen |
11 |
|
## + minor changes |
12 |
|
## |
13 |
|
## Revision 1.4 2003/04/05 21:17:51 joko |
14 |
|
## extends Class::Abstract (for being able to call '_abstract_method' on it) |
15 |
|
## |
16 |
|
## Revision 1.3 2003/04/04 00:56:08 jonen |
17 |
|
## + add 'mungle_adapter' function |
18 |
|
## |
19 |
|
## Revision 1.2 2003/03/20 07:56:18 jonen |
20 |
|
## + added docu |
21 |
|
## |
22 |
## Revision 1.1 2003/03/20 03:49:22 jonen |
## Revision 1.1 2003/03/20 03:49:22 jonen |
23 |
## + initial commit |
## + initial commit |
24 |
## |
## |
29 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
30 |
*/ |
*/ |
31 |
|
|
32 |
|
|
33 |
|
/** |
34 |
|
* required only for $this->_abstract_method({methodname}) |
35 |
|
* can later be used or not without any problems or further |
36 |
|
* dependencies since this is an abstract base class at the |
37 |
|
* very top of the inheritance hierarchy. |
38 |
|
* |
39 |
|
*/ |
40 |
|
loadModule('Class::Abstract'); |
41 |
|
|
42 |
/** |
/** |
43 |
* AbstractGUIModule class provides an simple way to create new modules |
* AbstractGUIModule class provides an simple way to create new modules |
44 |
* for the Explorer, eg navigation or data browsing elements. |
* for the Explorer, eg navigation or data browsing elements. |
45 |
* |
* |
46 |
* |
* @author Sebastian Utz <seut@tunemedia.de> |
47 |
|
* @package org.netfrag.app |
48 |
|
* @name WebExplorer::Module::AbstractModule |
49 |
*/ |
*/ |
50 |
|
class WebExplorer_Module_AbstractGUIModule extends Class_Abstract { |
|
|
|
|
class WebExplorer_Module_AbstractGUIModule { |
|
51 |
|
|
52 |
|
|
53 |
/** |
/** |
56 |
var $_args = array(); |
var $_args = array(); |
57 |
|
|
58 |
/** |
/** |
59 |
* this holds the api declaration of the module |
* variable thats holds the reference to phphtmllib GUI object |
60 |
*/ |
*/ |
|
var $_api = array(); |
|
|
|
|
61 |
var $_gui_object; |
var $_gui_object; |
62 |
|
|
63 |
/** |
/** |
64 |
* the contructor |
* the contructor |
65 |
* |
* |
66 |
* @params object ref - the source object to render data for |
* @params struct - the arguments |
|
* @params string - the caption, if needed |
|
67 |
*/ |
*/ |
68 |
function WebExplorer_Module_AbstractGUIModule($args = array()) { |
function WebExplorer_Module_AbstractGUIModule($args = array()) { |
69 |
$this->_args = $args; |
$this->_args = $args; |
|
$this->_api = $this->default_api(); |
|
70 |
|
|
|
$this->set_gui_object(); |
|
71 |
//print Dumper($this->_gui_object); |
//print Dumper($this->_gui_object); |
72 |
|
$this->set_gui_object(); |
73 |
} |
} |
74 |
|
|
|
function get_api() { |
|
|
return $this->_api; |
|
|
} |
|
|
|
|
|
function default_api() { |
|
|
$declaration = array( |
|
|
'contructor' => array( |
|
|
'args' => "struct", |
|
|
'return' => "object" |
|
|
), |
|
|
); |
|
|
return $declaration; |
|
|
} |
|
|
|
|
75 |
|
|
76 |
function set_gui_object() { |
function set_gui_object() { |
77 |
user_error("AbstractGUIModule::set_gui_object() - Child must override"); |
$msg = "AbstractGUIModule::get_gui_object() - Child must override"; |
78 |
|
user_error($msg); |
79 |
|
return $msg; |
80 |
} |
} |
81 |
|
|
82 |
|
|
83 |
function add_hidden_items($items) { |
function add_hidden_items($items) { |
84 |
foreach($items as $label => $value) { |
foreach($items as $label => $value) { |
85 |
$this->add_hidden_item($label, $value); |
$this->add_hidden_element($label, $value); |
86 |
} |
} |
87 |
} |
} |
88 |
|
|
89 |
|
|
90 |
function add_hidden_item($label, $value) { |
function add_hidden_element($label, $value) { |
91 |
|
// TODO: review this! |
92 |
|
if (!$this->_gui_object) { return; } |
93 |
//print "Label: $label => $value<br>"; |
//print "Label: $label => $value<br>"; |
94 |
$this->_gui_object->add_hidden_item($label, $value); |
$this->_gui_object->add_hidden_element($label, $value); |
95 |
} |
} |
96 |
|
|
97 |
|
|
98 |
function &get() { |
function &get() { |
99 |
return $this->_gui_object; |
if($this->_args['adapter']) { |
100 |
|
return $this->mungle_adapter($this->_args['adapter']); |
101 |
|
} else { |
102 |
|
return $this->_gui_object; |
103 |
|
} |
104 |
} |
} |
105 |
|
|
106 |
|
function mungle_adapter($label) { |
107 |
|
return php::mkInstance($label, array(&$this->_gui_object)); |
108 |
|
} |
109 |
|
|
110 |
|
|
111 |
} |
} |
112 |
|
|
113 |
?> |
?> |