Re: [Wicket-user] Question about DataTable
May be usefull my follow code snippet: ListIColumn columns = new ArrayListIColumn(); columns.add(new PropertyColumn(new Model(column1), column1, column1)); columns.add(new AbstractColumn(new Model(column2), column2) { @Override public Component getHeader(String componentId) { // To redefine a header representation } public void populateItem(Item cellItem, String componentId, IModel rowModel) { Issue issue = (Issue) rowModel.getObject(cellItem); cellItem.add(new Label(something)); } }); columns.add(new PropertyColumn(new Model(column3), column3, column3)); columns.add(new PropertyColumn(new Model(column4), column4, column4)); columns.add(new PropertyColumn(new Model(column5), column5, column5)); columns.add(new AbstractColumn(new Model(column6), column6) { public void populateItem(Item cellItem, String componentId, IModel rowModel) { Issue issue = (Issue) rowModel.getObject(cellItem); cellItem.add(new Label(componentId, something)); } }); table = new DataTable(table, columns.toArray(new IColumn[columns.size()]), proveder, 25) { @Override protected Item newRowItem(String id, int index, IModel model) { Item item = new OddEvenItem(id, index, model); ModelObject object = (ModelObject) model.getObject(item); String url = location.href=' + urlFor(IssuePage.class, SomePage.getPageParameters(object.getId())) + ';; item.add(new AttributeModifier(title, true, new Model(a title))); item.add(new AttributeModifier(onclick, true, new Model(url))); return item; } }; table .addTopToolbar(new OwnHeadersToolbar(table, provider)); add(table ); } private static final class OwnHeadersToolbar extends HeadersToolbar { public IssueHeadersToolbar(DataTable table, ISortStateLocator stateLocator) { super(table, stateLocator); ... } } igor.vaynberg wrote: see addTopToolbar(), addBottomToolbar() and the constructor of DefaultDataTable -igor On 11/14/06, Carfield Yim [EMAIL PROTECTED] wrote: I just really try out this class with only PropertyColumn. However, I still get this error when I add HeadersToolbar like table.add(new HeadersToolbar(table, provider)); [MarkupContainer [Component id = datatable, page = No Page, path = datatable.DataTable]] java.lang.IllegalArgumentException: A child with id 'toolbar' already exists: [MarkupContainer [Component id = datatable, page = No Page, path = datatable.DataTable]] Would you help me about that? I don't no idea and there is no component call toolbar I've created On 11/14/06, Igor Vaynberg [EMAIL PROTECTED] wrote: there is an example in wicket-phonebook which lives in wicket-stuff svn. basically you extend the abstractcolumn and add a panel or a fragment. its pretty easy. look at the example - mainly in listcontactspage/actioncolumn i believe -igor On 11/13/06, Carfield Yim [EMAIL PROTECTED] wrote: Look like it is more easier to show a sortable and pagable table than using DataView. However if I need to show more than property from an object. Like a BookmarkablePageLink , How should I do? Look like I need to extended a custom AbstractColumn. Where can I find samples of doing that? - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash
Re: [Wicket-user] Question about DataTable
To add a bookmarkable link: columns.add(new AbstractColumn(new Model(column6), column6) { public void populateItem(Item cellItem, String componentId, IModel rowModel) { cellItem.add(new BookmarkablePageLink(componentId, SomePage.class, somePageParameters))); } }); dulanov wrote: May be usefull my follow code snippet: ListIColumn columns = new ArrayListIColumn(); columns.add(new PropertyColumn(new Model(column1), column1, column1)); columns.add(new AbstractColumn(new Model(column2), column2) { @Override public Component getHeader(String componentId) { // To redefine a header representation } public void populateItem(Item cellItem, String componentId, IModel rowModel) { Issue issue = (Issue) rowModel.getObject(cellItem); cellItem.add(new Label(something)); } }); columns.add(new PropertyColumn(new Model(column3), column3, column3)); columns.add(new PropertyColumn(new Model(column4), column4, column4)); columns.add(new PropertyColumn(new Model(column5), column5, column5)); columns.add(new AbstractColumn(new Model(column6), column6) { public void populateItem(Item cellItem, String componentId, IModel rowModel) { Issue issue = (Issue) rowModel.getObject(cellItem); cellItem.add(new Label(componentId, something)); } }); table = new DataTable(table, columns.toArray(new IColumn[columns.size()]), proveder, 25) { @Override protected Item newRowItem(String id, int index, IModel model) { Item item = new OddEvenItem(id, index, model); ModelObject object = (ModelObject) model.getObject(item); String url = location.href=' + urlFor(IssuePage.class, SomePage.getPageParameters(object.getId())) + ';; item.add(new AttributeModifier(title, true, new Model(a title))); item.add(new AttributeModifier(onclick, true, new Model(url))); return item; } }; table .addTopToolbar(new OwnHeadersToolbar(table, provider)); add(table ); } private static final class OwnHeadersToolbar extends HeadersToolbar { public IssueHeadersToolbar(DataTable table, ISortStateLocator stateLocator) { super(table, stateLocator); ... } } igor.vaynberg wrote: see addTopToolbar(), addBottomToolbar() and the constructor of DefaultDataTable -igor On 11/14/06, Carfield Yim [EMAIL PROTECTED] wrote: I just really try out this class with only PropertyColumn. However, I still get this error when I add HeadersToolbar like table.add(new HeadersToolbar(table, provider)); [MarkupContainer [Component id = datatable, page = No Page, path = datatable.DataTable]] java.lang.IllegalArgumentException: A child with id 'toolbar' already exists: [MarkupContainer [Component id = datatable, page = No Page, path = datatable.DataTable]] Would you help me about that? I don't no idea and there is no component call toolbar I've created On 11/14/06, Igor Vaynberg [EMAIL PROTECTED] wrote: there is an example in wicket-phonebook which lives in wicket-stuff svn. basically you extend the abstractcolumn and add a panel or a fragment. its pretty easy. look at the example - mainly in listcontactspage/actioncolumn i believe -igor On 11/13/06, Carfield Yim [EMAIL PROTECTED] wrote: Look like it is more easier to show a sortable and pagable table than using DataView. However if I need to show more than property from an object. Like a BookmarkablePageLink , How should I do? Look like I need to extended a custom AbstractColumn. Where can I find samples of doing that? - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
Re: [Wicket-user] Question about DataTable
Yes, you are right, I invented the previous code. The next piece of code from my project works fine exactly ;) columns.add(new AbstractColumn(new Model()) { @Override public Component getHeader(String componentId) { Fragment checkBoxFragment = new IssueSelectionFragment(componentId, checkBoxFrag, IssuesTabularPanel.this, new Issue()); checkBoxFragment.add(new AttributeModifier(title, true, new Model(...))); return checkBoxFragment; } public void populateItem(Item cellItem, String componentId, IModel rowModel) { Issue issue = (Issue) rowModel.getObject(cellItem); Fragment checkBoxFragment = new IssueSelectionFragment(componentId, checkBoxFrag, IssuesTabularPanel.this, issue); checkBoxFragment.add(new AttributeModifier(title, true, new Model(...))); cellItem.add(checkBoxFragment); cellItem.add(new AttributeModifier(class, true, new Model(check))); } }); private static final class IssueSelectionFragment extends Fragment { public IssueSelectionFragment(String id, String markupId, MarkupContainer markupProvider, Issue issue) { super(id, markupId, markupProvider); add(new CheckBox(selected, new AbstractCheckBoxModel() { @Override public void setSelected (Component component, boolean sel) { } @Override public boolean isSelected(Component component) { return false; }}) { @Override protected boolean wantOnSelectionChangedNotifications() { return true; } }); } } igor.vaynberg wrote: you cannot do this, you have to add a panel or a fragment that contains the link you want. this is because whatever you add is attached to span tags, and you cannot attach a link to a span, only to -igor On 11/14/06, dulanov [EMAIL PROTECTED] wrote: To add a bookmarkable link: columns.add(new AbstractColumn(new Model(column6), column6) { public void populateItem(Item cellItem, String componentId, IModel rowModel) { cellItem.add(new BookmarkablePageLink(componentId, SomePage.class, somePageParameters))); } }); dulanov wrote: May be usefull my follow code snippet: ListIColumn columns = new ArrayListIColumn(); columns.add(new PropertyColumn(new Model(column1), column1, column1)); columns.add(new AbstractColumn(new Model(column2), column2) { @Override public Component getHeader(String componentId) { // To redefine a header representation } public void populateItem(Item cellItem, String componentId, IModel rowModel) { Issue issue = (Issue) rowModel.getObject(cellItem); cellItem.add(new Label(something)); } }); columns.add(new PropertyColumn(new Model(column3), column3, column3)); columns.add(new PropertyColumn(new Model(column4), column4, column4)); columns.add(new PropertyColumn(new Model(column5), column5, column5)); columns.add(new AbstractColumn(new Model(column6), column6) { public void populateItem(Item cellItem, String componentId, IModel rowModel) { Issue issue = (Issue) rowModel.getObject(cellItem); cellItem.add(new Label(componentId, something)); } }); table = new DataTable(table, columns.toArray(new IColumn[columns.size()]), proveder, 25) { @Override protected Item newRowItem(String id, int index, IModel model) { Item item = new OddEvenItem(id, index, model); ModelObject object = (ModelObject) model.getObject (item); String url = location.href=' + urlFor(IssuePage.class, SomePage.getPageParameters(object.getId())) + ';; item.add(new AttributeModifier(title, true, new Model(a title))); item.add(new AttributeModifier(onclick, true, new Model(url))); return item; } }; table .addTopToolbar(new OwnHeadersToolbar(table, provider)); add(table ); } private static final class OwnHeadersToolbar extends HeadersToolbar { public IssueHeadersToolbar(DataTable table, ISortStateLocator stateLocator) { super(table, stateLocator); ... } } igor.vaynberg wrote: see addTopToolbar(), addBottomToolbar() and the constructor of DefaultDataTable -igor On 11/14/06, Carfield Yim [EMAIL PROTECTED] wrote: I just really try out this class with only
Re: [Wicket-user] Question about DataTable
Its work fine, I wrote it only for example purposes. igor.vaynberg wrote: this looks like it should work what is the stack trace you are getting? -igor On 11/14/06, dulanov [EMAIL PROTECTED] wrote: May be usefull my follow code snippet: ListIColumn columns = new ArrayListIColumn(); columns.add(new PropertyColumn(new Model(column1), column1, column1)); columns.add(new AbstractColumn(new Model(column2), column2) { @Override public Component getHeader(String componentId) { // To redefine a header representation } public void populateItem(Item cellItem, String componentId, IModel rowModel) { Issue issue = (Issue) rowModel.getObject(cellItem); cellItem.add(new Label(something)); } }); columns.add(new PropertyColumn(new Model(column3), column3, column3)); columns.add(new PropertyColumn(new Model(column4), column4, column4)); columns.add(new PropertyColumn(new Model(column5), column5, column5)); columns.add(new AbstractColumn(new Model(column6), column6) { public void populateItem(Item cellItem, String componentId, IModel rowModel) { Issue issue = (Issue) rowModel.getObject(cellItem); cellItem.add(new Label(componentId, something)); } }); table = new DataTable(table, columns.toArray(new IColumn[columns.size()]), proveder, 25) { @Override protected Item newRowItem(String id, int index, IModel model) { Item item = new OddEvenItem(id, index, model); ModelObject object = (ModelObject) model.getObject(item); String url = location.href=' + urlFor(IssuePage.class, SomePage.getPageParameters(object.getId())) + ';; item.add(new AttributeModifier(title, true, new Model(a title))); item.add(new AttributeModifier(onclick, true, new Model(url))); return item; } }; table .addTopToolbar(new OwnHeadersToolbar(table, provider)); add(table ); } private static final class OwnHeadersToolbar extends HeadersToolbar { public IssueHeadersToolbar(DataTable table, ISortStateLocator stateLocator) { super(table, stateLocator); ... } } igor.vaynberg wrote: see addTopToolbar(), addBottomToolbar() and the constructor of DefaultDataTable -igor On 11/14/06, Carfield Yim [EMAIL PROTECTED] wrote: I just really try out this class with only PropertyColumn. However, I still get this error when I add HeadersToolbar like table.add(new HeadersToolbar(table, provider)); [MarkupContainer [Component id = datatable, page = No Page, path = datatable.DataTable]] java.lang.IllegalArgumentException: A child with id 'toolbar' already exists: [MarkupContainer [Component id = datatable, page = No Page, path = datatable.DataTable]] Would you help me about that? I don't no idea and there is no component call toolbar I've created On 11/14/06, Igor Vaynberg [EMAIL PROTECTED] wrote: there is an example in wicket-phonebook which lives in wicket-stuff svn. basically you extend the abstractcolumn and add a panel or a fragment. its pretty easy. look at the example - mainly in listcontactspage/actioncolumn i believe -igor On 11/13/06, Carfield Yim [EMAIL PROTECTED] wrote: Look like it is more easier to show a sortable and pagable table than using DataView. However if I need to show more than property from an object. Like a BookmarkablePageLink , How should I do? Look like I need to extended a custom AbstractColumn. Where can I find samples of doing that? - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user
Re: [Wicket-user] DataTable header manipulation
I added a class check to the first header th element by next code: issues = new DataTable(issues, columns.toArray(new IColumn[columns.size()]), issueListProvider, itemsPerPage) { @Override protected Item newRowItem(String id, int index, IModel model) { return new OddEvenItem(id, index, model); } }; issues.addTopToolbar(new IssueHeadersToolbar(issues, issueListProvider)); ... public static class IssueHeadersToolbar extends HeadersToolbar { public IssueHeadersToolbar(DataTable table, ISortStateLocator stateLocator) { super(table, stateLocator); RepeatingView headers = (RepeatingView) get(headers); MarkupContainer checkColumn = (MarkupContainer) ((MarkupContainer) headers.get(1)).get(header); checkColumn.add(new AttributeModifier(class, true, new Model(check))); } } Is it possible to simplify? Stefan Lindner wrote: I can manipulate the data grip part of a DataTable by overriding newCellItem. But if I e.g. need a speical layout for the table header, I must add a class or id attribute to the th elements of the headline (different layout on the left and right side e.g.). I can see no way to manipulate the generation of the headline. O.K. I can design my own Toolbar according to HeadersToolbar but in most cases that's much too compülicated. Is there an easy way to control the generation of the table head? Stefan Lindner - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/DataTable-header-manipulation-tf2397492.html#a7237234 Sent from the Wicket - User mailing list archive at Nabble.com. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] DataTable header manipulation
I added a class check to the first header th element by next code: ListIColumn columns = new ArrayListIColumn(); columns.add(new AbstractColumn(new Model()) { @Override public Component getHeader(String componentId) { return new IssueSelectionFragment(componentId, checkBoxFrag, IssueTabular.this, new Issue()); } public void populateItem(Item cellItem, String componentId, IModel rowModel) { setModel(rowModel); Issue issue = (Issue) getModelObject(); cellItem.add(new IssueSelectionFragment(componentId, checkBoxFrag, IssueTabular.this, issue)); cellItem.add(new AttributeModifier(class, true, new Model(check))); } }); issues = new DataTable(issues, columns.toArray(new IColumn[columns.size()]), issueListProvider, itemsPerPage) { @Override protected Item newRowItem(String id, int index, IModel model) { return new OddEvenItem(id, index, model); } }; issues.addTopToolbar(new IssueHeadersToolbar(issues, issueListProvider)); ... public static class IssueHeadersToolbar extends HeadersToolbar { public IssueHeadersToolbar(DataTable table, ISortStateLocator stateLocator) { super(table, stateLocator); RepeatingView headers = (RepeatingView) get(headers); MarkupContainer checkColumn = (MarkupContainer) ((MarkupContainer) headers.get(1)).get(header); checkColumn.add(new AttributeModifier(class, true, new Model(check))); } } Is it possible to simplify? Stefan Lindner wrote: I can manipulate the data grip part of a DataTable by overriding newCellItem. But if I e.g. need a speical layout for the table header, I must add a class or id attribute to the th elements of the headline (different layout on the left and right side e.g.). I can see no way to manipulate the generation of the headline. O.K. I can design my own Toolbar according to HeadersToolbar but in most cases that's much too compülicated. Is there an easy way to control the generation of the table head? Stefan Lindner - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/DataTable-header-manipulation-tf2397492.html#a7237245 Sent from the Wicket - User mailing list archive at Nabble.com. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] DataTable header manipulation
After same experiments I stop by following: public static final class IssueHeadersToolbar extends HeadersToolbar { public IssueHeadersToolbar(DataTable table, ISortStateLocator stateLocator) { super(table, stateLocator); get(headers:1:header).add(new AttributeModifier(class, true, new Model(check))); } } But, this isn't supportable solution ;( dulanov wrote: I added a class check to the first header th element by next code: ListIColumn columns = new ArrayListIColumn(); columns.add(new AbstractColumn(new Model()) { @Override public Component getHeader(String componentId) { return new IssueSelectionFragment(componentId, checkBoxFrag, IssueTabular.this, new Issue()); } public void populateItem(Item cellItem, String componentId, IModel rowModel) { setModel(rowModel); Issue issue = (Issue) getModelObject(); cellItem.add(new IssueSelectionFragment(componentId, checkBoxFrag, IssueTabular.this, issue)); cellItem.add(new AttributeModifier(class, true, new Model(check))); } }); issues = new DataTable(issues, columns.toArray(new IColumn[columns.size()]), issueListProvider, itemsPerPage) { @Override protected Item newRowItem(String id, int index, IModel model) { return new OddEvenItem(id, index, model); } }; issues.addTopToolbar(new IssueHeadersToolbar(issues, issueListProvider)); ... public static class IssueHeadersToolbar extends HeadersToolbar { public IssueHeadersToolbar(DataTable table, ISortStateLocator stateLocator) { super(table, stateLocator); RepeatingView headers = (RepeatingView) get(headers); MarkupContainer checkColumn = (MarkupContainer) ((MarkupContainer) headers.get(1)).get(header); checkColumn.add(new AttributeModifier(class, true, new Model(check))); } } Is it possible to simplify? Stefan Lindner wrote: I can manipulate the data grip part of a DataTable by overriding newCellItem. But if I e.g. need a speical layout for the table header, I must add a class or id attribute to the th elements of the headline (different layout on the left and right side e.g.). I can see no way to manipulate the generation of the headline. O.K. I can design my own Toolbar according to HeadersToolbar but in most cases that's much too compülicated. Is there an easy way to control the generation of the table head? Stefan Lindner - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/DataTable-header-manipulation-tf2397492.html#a7239447 Sent from the Wicket - User mailing list archive at Nabble.com. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user