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