1: <?php
2:
3: abstract class AbstractControl_CodeGenerator {
4: protected $strControlClassName;
5:
6: protected function __construct($strControlClassName) {
7: $this->strControlClassName = $strControlClassName;
8: }
9:
10: public function GetControlClass() {
11: return $this->strControlClassName;
12: }
13:
14: /**
15: * @param string $strPropName
16: * @return string
17: */
18: abstract public function VarName($strPropName);
19:
20: /**
21: * Generate code that will be inserted into the ModelConnector to connect a database object with this control.
22: * This is called during the codegen process. This is very similar to the QListControl code, but there are
23: * some differences. In particular, this control does not support ManyToMany references.
24: *
25: * @param QCodeGenBase $objCodeGen
26: * @param QSqlTable $objTable
27: * @param QSqlColumn|QReverseReference|QManyToManyReference $objColumn
28: * @return string
29: */
30: abstract public function ConnectorCreate(QCodeGenBase $objCodeGen, QSqlTable $objTable, $objColumn);
31:
32: /**
33: * @param QCodeGenBase $objCodeGen
34: * @param QSqlColumn|QReverseReference| QManyToManyReference $objColumn
35: * @return string
36: */
37: abstract public function ConnectorVariableDeclaration(QCodeGenBase $objCodeGen, $objColumn);
38:
39: /**
40: * Reads the options from the special data file, and possibly the column
41: * @param QCodeGenBase $objCodeGen
42: * @param QSqlTable $objTable
43: * @param QSqlColumn|QReverseReference|QManyToManyReference $objColumn
44: * @param string $strControlVarName
45: * @return string
46: */
47: abstract public function ConnectorCreateOptions(QCodeGenBase $objCodeGen, QSqlTable $objTable, $objColumn, $strControlVarName);
48:
49: /**
50: * Returns code to refresh the control from the saved object.
51: *
52: * @param QCodeGenBase $objCodeGen
53: * @param QSqlTable $objTable
54: * @param QSqlColumn|QReverseReference|QManyToManyReference $objColumn
55: * @param bool $blnInit
56: * @return string
57: */
58: abstract public function ConnectorRefresh(QCodeGenBase $objCodeGen, QSqlTable $objTable, $objColumn, $blnInit = false);
59:
60: /**
61: * @param QCodeGenBase $objCodeGen
62: * @param QSqlTable $objTable
63: * @param QSqlColumn|QReverseReference|QManyToManyReference $objColumn
64: * @return string
65: */
66: abstract public function ConnectorUpdate(QCodeGenBase $objCodeGen, QSqlTable $objTable, $objColumn);
67:
68: /**
69: * Generate helper functions for the update process.
70: *
71: * @param QCodeGenBase $objCodeGen
72: * @param QSqlTable $objTable
73: * @param QSqlColumn|QReverseReference|QManyToManyReference $objColumn
74: *
75: * @return string
76: */
77: abstract public function ConnectorUpdateMethod(QCodeGenBase $objCodeGen, QSqlTable $objTable, $objColumn);
78:
79: }