You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "F. Da Costa Gomez" <dc...@fixed.com> on 2003/05/13 13:52:11 UTC
How to initialize component parameters
Hi,
I was wondering whether someone could help me with the following.
I'm trying to put together a table that takes any class as entry and thus
shows it as a table.
The snippets allow me to put the Brand.class on the screen, no problems.
However, how do I get hold of a dynamically selected entry so that the
table can be used for any class at will?
It should probably go via the *customTableTest* but I'm not seeing yet how
I can accomplish this. The get/set are not getting called at all.
The code was basically constructed around around the workbench example.
All help is much appreciated.
Tnx,
Fermin DCG
==========
<component-specification class="org.dcg.jwc.DisplayOnlyTable" allow-
body="no" allow-informal-parameters="yes">
<!-- (Container)Component parameters -->
<parameter name="class2bShown"
type="java.lang.Class"
required="yes"
direction="custom"/>
<!-- Components used in the (container)component -->
<!-- Actual definition of the table -->
<component id="tableView" type="contrib:TableView">
<binding name="tableModel" expression="tableModel"/>
<binding name="tableSessionStateManager"
expression="tableSessionStateManager"/>
</component>
public class DisplayOnlyTable extends BaseComponent implements
PageDetachListener {
private ITableSessionStateManager _tableSessionStateManager;
private PersistentDCG[] _persistentObjectArray;
private Global _global;
// =========== Constructors ===========
public DisplayOnlyTable(){
// an initialization done only once for each pooled page instance
initTableSessionStateManager();
}
protected void initTableSessionStateManager()
{
// Generate the list of data
_persistentObjectArray = (PersistentDCG[])
Global._root.getObjectCollection(Brand.class);
...
_tableSessionStateManager = new
SimpleTableSessionStateManager(objDataModel, objColumnModel);
}
.....
<page-specification class="org.dcg.tests.tables.CustomTableTest">
<component id="customTableTest" type="DisplayOnlyTable">
<binding name="class2bShown" expression="getClass2bShown"/>
</component>
</page-specification>
public class CustomTableTest extends BasePage {
private SimpleSetTableDataModel _tableDataModel;
public CustomTableTest() {
_tableDataModel = new SimpleSetTableDataModel(new HashSet());
}
public void setClass2bShown(){
// Does not get called, ever
}
public Class getClass2bShown(){
// Does not get called, ever
}
}
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/