GWT CompositeCell HasCell width
Hello, I am developing an application that uses CellTables with Columns constructed with a CompositeCell. Here is a quick snippet of what I am doing... ec sdfv q3414r -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Setting CompositeCell HasCell width
Hello, I am recently developing an application that is implementing a CellTable, where there are Columns where the underlying Cell object is a CompositeCell. As you know, a CompositeCell has an underlying ListHasCellT, C. Generally, i can get this to work just fine when I am simply displaying text with a ListHasCellObject, ?, with each HasCell containing a TextCell, or other Cells that take up a defined amount of visual real estate. The problem that I encounter is when trying to interact with an EditableTextCell embedded within the CompositeCell, when its underlying value is an empty String. Here is example code for reference... public void test() { CellTableObject table = new CellTableObject(); table.setTableLayoutFixed(true); EditTextCell eCell = new EditTextCell(); HasCellObject, ? innerColumn = new ColumnObject, String( eCell) { @Override public String getValue(Object object) { return ; } }; ListHasCellObject, ? hasCellList = new ArrayListHasCell Object, ?(); hasCellList.add(innerColumn); CompositeCellObject compCell = new CompositeCellObject( hasCellList); ColumnObject, Object outerColumn = new ColumnObject, Object(compCell) { @Override public Object getValue(Object object) { return object; } }; table.addColumn(outerColumn, Outer); table.setColumnWidth(outerColumn, 10, Unit.EM); } As this example relates to my actual project, I find that the width of the outerColumn is rendered just fine. And when eCell has a non-empty String, the cell can be clicked, and edited, and all of that. However, in the case where the eCell gets an empty String, the clickable area (to edit its contents) is incredibly narrow, and very difficult to find unless you know what to look for. Considering that i am able to interact with EditableTextCells with emtpy String values at the outerColumn level, I thought that all I would need to do is to define a width of innerColumn. For the life of me, i cannot figure out how to set the width of innerColumn, as it is not directly attached to the CellTable. How do I do that, or am I approaching this incorrectly? Note that the example is a simplification, and that the reason I am using the CompositeCell to optionally render a TextCell or EditableTextCell conditionally based on the Object passed to the CompositeCell. thanks, Rob -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: GWT 2.4 - problems with space key handling and FieldUpdater for TextInputCell inside CompositeCell in CellTree
The issue is due to CellTree preventing the default browser event on space. The reason for that is to prevent scrolling. You can listen for KEYDOWN in TextInputCells and then add the space in the input manually. As to how to get the input element, you can traverse the DOM from the parent Element or use something like GQuery. Nicholas On Wednesday, May 8, 2013 7:24:03 AM UTC-4, Michael Altmann wrote: I am facing the same issue and cannot figure out how the original poster set up event handling to get this working. Any help would be greatly appreciated. Right now my CellTree with TextInputCells will not accepts spaces. On Wednesday, August 29, 2012 5:30:10 AM UTC-5, BhaskerT wrote: Hi James, Thanks for the post and reply. I am facing similar issue. I am not able to type the white space character in the MyEditCell extends AbstractInputCell. i have also over ridden the below method: *public* SetString getConsumedEvents() { SetString events = *new* HashSetString(); events.add(focus); events.add(blur); events.add(keydown); events.add(change); *return* events; } But, Still no luck. Can you please suggest something. Thanks, Bhasker On Thursday, 29 December 2011 21:38:09 UTC+5:30, James Scott wrote: Looks like it boils down to events. After looking at the TextInputCell and AbstractInputCell source, I added focus and change events to the list of events consumed by the CompositeCell, and that addressed both issues. Incidentally, I tried out the EditTextCell in the CompositeCell, and to get that working, I needed to add keyup and keydown events to the CompositeCell. Clearly I do not yet have my mind wrapped around how the events are propagated in a CompositeCell, but at least I've solved my immediate problems. JLS On Dec 28, 3:49 pm, James Scott j...@jls.cx wrote: Hi all- I feel like I'm missing something obvious here, but I haven't been able to figure this out. In short, I have a CellTree whose leaf nodes are populated with CompositeCells. Each CompositeCell has an ImageResourceCell, a TextCell, and a TextInputCell. These are displaying in the tree correctly. I have attached an onClick event to the ImageResourceCell that deletes the item from the tree, and that works as expected. The intent for the TextInputCell is to display a field from the entity associated with the cell, and update the field on the entity when the user changes the value in the TextInputCell. However, I'm having a couple of problems with the TextInputCell. First, when I type in the TextInputCell, the space key is ignored - well, it's probably being consumed by something else but the upshot is that when I type a space character, it doesn't appear in the TextInputCell. I thought this might have to do with the SelectionModel or KeyboardSelectionPolicy on the CellTree, but I've set the tree to KeyboardSelectionPolicy.DISABLED and the TreeViewModel to NoSelectionModel and it's still happening.[snip] -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: Dynamic CompositeCell
I have the same problem at the moment. I can't use a CellTree because I actually want this to be a column of a CellTable. And as CellTree is not a Cell itself, this is not possible as far as I see. Is there any other way than going down to HTML and doing everything on my own? What I want is a column where each cell contains a variable number of labelled Checkboxes (label through text attribute of the Checkbox widget). You have to implement your own custom Cell for use in CellTable. Letting a cell render a dynamic list of checkboxes doesn't sound that hard to me. GWT can't provide cells for every possible use case. -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: Dynamic CompositeCell
I have the same problem at the moment. I can't use a CellTree because I actually want this to be a column of a CellTable. And as CellTree is not a Cell itself, this is not possible as far as I see. Is there any other way than going down to HTML and doing everything on my own? What I want is a column where each cell contains a variable number of labelled Checkboxes (label through text attribute of the Checkbox widget). Am Freitag, 27. April 2012 16:09:52 UTC+2 schrieb Alfredo Quiroga-Villamil: If you have an n number of values that should be represented in one single column, I would go for a tree. Its ability to expand nodes when needed, gives the user a chance to have it expanded or collapsed. So in your case the column would contain: Top Of Tree CheckBox 1 CheckBox 2 CheckBox 3 CheckBox n Regards, Alfredo On Wed, Apr 25, 2012 at 9:16 PM, Aoxiang Cui cuiao...@google.comjavascript: wrote: The title is too short, let me explain and simplify my situation. Say, I have a dto which contains a list of Booleans. I need a column whose cell looks like below: item_1 checkbox_1 item_2 checkbox_2 ... item_n checkbox_n If n is a fixed number, it is fine to use CompositeCell. The problem is we don't know the size of list and each cell can have different list size. Is there any way to extend CompositeCell so as to make it support my situation. Or maybe I should write a new Cell? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: Dynamic CompositeCell
Jens wrote: You have to implement your own custom Cell for use in CellTable. Letting a cell render a dynamic list of checkboxes doesn't sound that hard to me. GWT can't provide cells for every possible use case. Well, ok, I probably will do that for the checkboxes. But in my mind this allows for nearly no reuse. If instead there would be something like a CompositeCell where the number and type of child cells depend on the row value, then this would be reusable in lots of cases. And considering that this issue pops up quite some times on the internet I guess it would be useful. To be honest, I find creating custom Cells hard, because it feels low level and also because Cells are completely different to use compared to their counterpart widgets (e.g. Checkbox vs. CheckboxCell). That's why I'm happy if there's something existing I can just use or plug together (like the CompositeCell for fixed Cell number). Do you think it would be hard to create a DynamicCompositeCell for variable Cells? I don't have much experience with cells yet, only with regular widgets, but I'd like to tackle that challenge if I get a little help or advice. Cheers Maik -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: GWT 2.4 - problems with space key handling and FieldUpdater for TextInputCell inside CompositeCell in CellTree
I am facing the same issue and cannot figure out how the original poster set up event handling to get this working. Any help would be greatly appreciated. Right now my CellTree with TextInputCells will not accepts spaces. On Wednesday, August 29, 2012 5:30:10 AM UTC-5, BhaskerT wrote: Hi James, Thanks for the post and reply. I am facing similar issue. I am not able to type the white space character in the MyEditCell extends AbstractInputCell. i have also over ridden the below method: *public* SetString getConsumedEvents() { SetString events = *new* HashSetString(); events.add(focus); events.add(blur); events.add(keydown); events.add(change); *return* events; } But, Still no luck. Can you please suggest something. Thanks, Bhasker On Thursday, 29 December 2011 21:38:09 UTC+5:30, James Scott wrote: Looks like it boils down to events. After looking at the TextInputCell and AbstractInputCell source, I added focus and change events to the list of events consumed by the CompositeCell, and that addressed both issues. Incidentally, I tried out the EditTextCell in the CompositeCell, and to get that working, I needed to add keyup and keydown events to the CompositeCell. Clearly I do not yet have my mind wrapped around how the events are propagated in a CompositeCell, but at least I've solved my immediate problems. JLS On Dec 28, 3:49 pm, James Scott j...@jls.cx wrote: Hi all- I feel like I'm missing something obvious here, but I haven't been able to figure this out. In short, I have a CellTree whose leaf nodes are populated with CompositeCells. Each CompositeCell has an ImageResourceCell, a TextCell, and a TextInputCell. These are displaying in the tree correctly. I have attached an onClick event to the ImageResourceCell that deletes the item from the tree, and that works as expected. The intent for the TextInputCell is to display a field from the entity associated with the cell, and update the field on the entity when the user changes the value in the TextInputCell. However, I'm having a couple of problems with the TextInputCell. First, when I type in the TextInputCell, the space key is ignored - well, it's probably being consumed by something else but the upshot is that when I type a space character, it doesn't appear in the TextInputCell. I thought this might have to do with the SelectionModel or KeyboardSelectionPolicy on the CellTree, but I've set the tree to KeyboardSelectionPolicy.DISABLED and the TreeViewModel to NoSelectionModel and it's still happening.[snip] -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
How to add cell types (TextCell) to CompositeCell?
Hi, how can I add available cell types (TextCell, ButtonCell, CheckboxCell, DateCell etc) to a *CompositeCell*? https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCellWidgets?hl=en#available ListHasCellFoo, ? cells = new ArrayListHasCellFoo,?(); cells.add(new ButtonCell()); //not applicable for ButtonCell. newCompositeCellFoo(cells); I mean: what is the CompositeCell for, if I cannot add existing Cell implementations to it? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/4iC9VUhd4N8J. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: How to add cell types (TextCell) to CompositeCell?
HasCell for CompositeCell is similar to Column for CellTable, you want to wrap a Cell within a HasCell. http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwCellTree (ContactTreeViewModel.java) uses CompositeCell if you're looking for an example. On Wednesday, January 9, 2013 2:49:00 PM UTC+1, membersound wrote: Hi, how can I add available cell types (TextCell, ButtonCell, CheckboxCell, DateCell etc) to a *CompositeCell*? https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCellWidgets?hl=en#available ListHasCellFoo, ? cells = new ArrayListHasCellFoo,?(); cells.add(new ButtonCell()); //not applicable for ButtonCell. newCompositeCellFoo(cells); I mean: what is the CompositeCell for, if I cannot add existing Cell implementations to it? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/oRxPntmDQQEJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: GWT 2.4 - problems with space key handling and FieldUpdater for TextInputCell inside CompositeCell in CellTree
Hi James, Thanks for the post and reply. I am facing similar issue. I am not able to type the white space character in the MyEditCell extends AbstractInputCell. i have also over ridden the below method: *public* SetString getConsumedEvents() { SetString events = *new* HashSetString(); events.add(focus); events.add(blur); events.add(keydown); events.add(change); *return* events; } But, Still no luck. Can you please suggest something. Thanks, Bhasker On Thursday, 29 December 2011 21:38:09 UTC+5:30, James Scott wrote: Looks like it boils down to events. After looking at the TextInputCell and AbstractInputCell source, I added focus and change events to the list of events consumed by the CompositeCell, and that addressed both issues. Incidentally, I tried out the EditTextCell in the CompositeCell, and to get that working, I needed to add keyup and keydown events to the CompositeCell. Clearly I do not yet have my mind wrapped around how the events are propagated in a CompositeCell, but at least I've solved my immediate problems. JLS On Dec 28, 3:49 pm, James Scott j...@jls.cx wrote: Hi all- I feel like I'm missing something obvious here, but I haven't been able to figure this out. In short, I have a CellTree whose leaf nodes are populated with CompositeCells. Each CompositeCell has an ImageResourceCell, a TextCell, and a TextInputCell. These are displaying in the tree correctly. I have attached an onClick event to the ImageResourceCell that deletes the item from the tree, and that works as expected. The intent for the TextInputCell is to display a field from the entity associated with the cell, and update the field on the entity when the user changes the value in the TextInputCell. However, I'm having a couple of problems with the TextInputCell. First, when I type in the TextInputCell, the space key is ignored - well, it's probably being consumed by something else but the upshot is that when I type a space character, it doesn't appear in the TextInputCell. I thought this might have to do with the SelectionModel or KeyboardSelectionPolicy on the CellTree, but I've set the tree to KeyboardSelectionPolicy.DISABLED and the TreeViewModel to NoSelectionModel and it's still happening.[snip] -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/sbcpyw5-Ns8J. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
[2.5rc1]bugs in CompositeCell?
Dear All I am just a newbie, I don't know whether this is a place to report bug. If not, please tell me where should I put. Seems CompositeCell only accept 2 child-Cells, otherwise, exceptions will be thrown in Development Mode. If these 2 child-Cells are both ActionCells, it might trigger ActionCell's handler when you click even on the blank area of the CompositeCell. = EntryPoint: class UserInfo{ String userName; String userLevel; String nickName; String eMail; String title; Date createDate; String body; public UserInfo(String userName){ this.userName = userName: + userName; this.userLevel = userLevel: + userName; this.nickName = nickName: + userName; this.eMail = eMail: + userName; this.title = title: + userName; this.createDate = new Date(); this.body = body: + userName; } } List al = Arrays.asList(new UserInfo(1234),new UserInfo(qwer), new UserInfo(asdf),new UserInfo(zxcv), new UserInfo(uiop),new UserInfo(hjkl), new UserInfo(vbmn),new UserInfo(7890), new UserInfo(uytr),new UserInfo(同济大学)); ListHasCellUserInfo, ? hasCells = new ArrayListHasCellUserInfo, ?(); hasCells.add(new HasCellUserInfo, UserInfo() { private ActionCell cell4 = new ActionCell(ActionCell4, new ActionCell.DelegateUserInfo(){ @Override public void execute(UserInfo object) { Window.alert(ActionCell cell4:username:+object.userName); } } ); @Override public Cell getCell() { return cell4; } @Override public UserInfo getValue(UserInfo object) { return object; } @Override public FieldUpdaterUserInfo, UserInfo getFieldUpdater() { //Window.alert(ActionCell cell4); return null; } }); hasCells.add(new HasCellUserInfo, UserInfo() { private ActionCell cell5 = new ActionCell(ActionCell5, new ActionCell.DelegateUserInfo(){ @Override public void execute(UserInfo object) { Window.alert(ActionCell cell5:createDate:+object.getCreateDateFormated()); } } ); @Override public Cell getCell() { return cell5; } @Override public UserInfo getValue(UserInfo object) { return object; } @Override public FieldUpdaterUserInfo, UserInfo getFieldUpdater() { //Window.alert(ActionCell cell5); return null; } }); HelloWorldCompositeCell hwcc = new HelloWorldCompositeCell(hasCells); CellList cl = new CellList(hwcc); cl.setRowData(al); RootPanel.get().add(cl); = public class HelloWorldCompositeCell extends CompositeCellUserInfo { interface MyUiRenderer extends UiRenderer { void render(SafeHtmlBuilder sb, UserInfo user); } private static MyUiRenderer renderer = GWT.create(MyUiRenderer.class); public HelloWorldCompositeCell(ListHasCellUserInfo, ? hasCells) { super(hasCells); } @Override public void render(Context context, UserInfo user, SafeHtmlBuilder sb) { if (user == null) { return; } renderer.render(sb, user); sb.appendHtmlConstant(table border=\1\ width=\100%\ cellspacing=\0\tbodytrtd width=\25%\/td); super.render(context, user, sb); sb.appendHtmlConstant(/tr/tbody/table); } @Override protected X void render(Context context, UserInfo value, SafeHtmlBuilder sb, HasCellUserInfo, X hasCell) { if ((value == null) || (hasCell == null)) { return; } CellX cell = hasCell.getCell(); sb.appendHtmlConstant(td); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant(/td); } } = HelloWorldCompositeCell.ui.xml !DOCTYPE ui:UiBinder SYSTEM http://dl.google.com/gwt/DTD/xhtml.ent; ui:UiBinder xmlns:ui=urn:ui:com.google.gwt.uibinder ui:with field='user' type='com.learn.client.GwtLearn25rc1.UserInfo'/ ui:style .floatLeft { float:left } .floatRigth { float:right } .authorInfo { width: 25%; background-color:pink; border: 1px solid red; } .content { width: 75%;border: 1px solid black; } .title { background-color:gray; } .body { color:gray; } .enabled { color:black; } .disabled { color:gray; } /ui:style div table border=1 width=100% cellspacing=0 tr td class='{style.authorInfo}' divh2ui:text from='{user.getNickName}'//h2/div hello, spanui:text from='{user.getUserName}'//span. spanui:text from='{user.getUserLevel}'//span divui:text from='{user.geteMail}'//div /td td class='{style.content}' div class='{style.title}' span class='{style.floatRigth}' ui:text from='{user.getCreateDateFormated}' / /span span h3ui:text from='{user.getTitle}'//h3 /span /div div class='{style.body}' ui:text from='{user.getBody}'/ /div /td /tr /table /div /ui:UiBinder = You will see every item in the CellList will be shown as a 2x2 table. In right-bottom grid, ActionCell4 and ActionCell5 are there. But when you click first row of the item, ActionCell4 will be triggered. when you click second row ot the item, even black area of the row, ActionCell5
How to improve format of CompositeCell
I have a CompositeCell that contains 3 cells that I set in a cell based tree (GXT). The first is an ImageResourceCell, the second is SafeHtmlCell and the third is ImageCell which is optional. The problem is the combined layout is poor. I want then to be all in a single line centered vertically. However the ImageResourceCell is shifted up relative to the tree selection row center (it actually is even above the top of the row selection). Then if the ImageCell is present, which is much taller than the first two items, the first two items are aligned at the bottom of the image. E.g. xxX where X is the image and is about 5 times taller than xx. How can I make all these items centered vertically? CompositeCell wraps all items in a span...can I overload this to make these aligned vertically? What should I use here? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Dynamic CompositeCell
The title is too short, let me explain and simplify my situation. Say, I have a dto which contains a list of Booleans. I need a column whose cell looks like below: item_1 checkbox_1 item_2 checkbox_2 ... item_n checkbox_n If n is a fixed number, it is fine to use CompositeCell. The problem is we don't know the size of list and each cell can have different list size. Is there any way to extend CompositeCell so as to make it support my situation. Or maybe I should write a new Cell? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/slhetcYlVBsJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Dynamic CompositeCell
I personally would just create a new cell, but I'd probably start with CompositeCell for a starting point. On Apr 25, 9:16 pm, Aoxiang Cui cuiaoxi...@google.com wrote: The title is too short, let me explain and simplify my situation. Say, I have a dto which contains a list of Booleans. I need a column whose cell looks like below: item_1 checkbox_1 item_2 checkbox_2 ... item_n checkbox_n If n is a fixed number, it is fine to use CompositeCell. The problem is we don't know the size of list and each cell can have different list size. Is there any way to extend CompositeCell so as to make it support my situation. Or maybe I should write a new Cell? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Dynamic CompositeCell
If you have an n number of values that should be represented in one single column, I would go for a tree. Its ability to expand nodes when needed, gives the user a chance to have it expanded or collapsed. So in your case the column would contain: Top Of Tree CheckBox 1 CheckBox 2 CheckBox 3 CheckBox n Regards, Alfredo On Wed, Apr 25, 2012 at 9:16 PM, Aoxiang Cui cuiaoxi...@google.com wrote: The title is too short, let me explain and simplify my situation. Say, I have a dto which contains a list of Booleans. I need a column whose cell looks like below: item_1 checkbox_1 item_2 checkbox_2 ... item_n checkbox_n If n is a fixed number, it is fine to use CompositeCell. The problem is we don't know the size of list and each cell can have different list size. Is there any way to extend CompositeCell so as to make it support my situation. Or maybe I should write a new Cell? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/slhetcYlVBsJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- Alfredo Quiroga-Villamil AOL/Yahoo/Gmail/MSN IM: lawwton -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Custom header using CompositeCell or AbstractCell
Hi, I am trying to build a custom header which have two labels in a header and both are styled differently. For example: | header1 - label1 | header2 - label1 | +---++ | header1 - label2 | header2 - label2 | Label1 in headers needs to be styled differently than label2. Further label2 needs to be able to trigger column sort on a table. I was looking at examples how to build AbstractCells but still can't see how this can be applied to header. Does anyone come up with an approach to build Custom header? Thanks, Kris -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/64tUtRIS1ZIJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Custom header using CompositeCell or AbstractCell
What I might actually need is to get two rows inserted into theader in CellTable. So the header look like this: | | header1 - label1 | header2 - label1 | +--+--+--+ | label| header1 - label2 | header2 - label2 | +--+--+--+ | foobar | 1 | image| Is there a way to add an extra header row to a CellTable after adding a column with one header? Thanks, Kris On Tuesday, March 13, 2012 10:31:59 AM UTC, kretel wrote: Hi, I am trying to build a custom header which have two labels in a header and both are styled differently. For example: | header1 - label1 | header2 - label1 | +---++ | header1 - label2 | header2 - label2 | Label1 in headers needs to be styled differently than label2. Further label2 needs to be able to trigger column sort on a table. I was looking at examples how to build AbstractCells but still can't see how this can be applied to header. Does anyone come up with an approach to build Custom header? Thanks, Kris -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/npZHnt1RI9gJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Custom header using CompositeCell or AbstractCell
You can check out this stackoverflow thread for some pointers: http://stackoverflow.com/questions/6422896/celltable-with-custom-header-containing-searchbox-and-focus-problem On Tuesday, March 13, 2012 1:38:05 PM UTC+1, kretel wrote: What I might actually need is to get two rows inserted into theader in CellTable. So the header look like this: | | header1 - label1 | header2 - label1 | +--+--+--+ | label| header1 - label2 | header2 - label2 | +--+--+--+ | foobar | 1 | image| Is there a way to add an extra header row to a CellTable after adding a column with one header? Thanks, Kris On Tuesday, March 13, 2012 10:31:59 AM UTC, kretel wrote: Hi, I am trying to build a custom header which have two labels in a header and both are styled differently. For example: | header1 - label1 | header2 - label1 | +---++ | header1 - label2 | header2 - label2 | Label1 in headers needs to be styled differently than label2. Further label2 needs to be able to trigger column sort on a table. I was looking at examples how to build AbstractCells but still can't see how this can be applied to header. Does anyone come up with an approach to build Custom header? Thanks, Kris -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/nWqPZtTZvigJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Custom header using CompositeCell or AbstractCell
Thanks for the pointer. I saw it and follow similar pattern, but it does not give you flexible approach to styling differently both rows in the header. you also wrote: [...] Well I ended up solving this by adding separate SearchBoxes *above* the CellTable-Header and using CSS to align them to the Header. [...] which I am trying to avoid. Imagine you provide different language for your app and table headers width/height will change. So css might not work in this case. Thanks, Kris On Tuesday, March 13, 2012 3:37:46 PM UTC, Ümit Seren wrote: You can check out this stackoverflow thread for some pointers: http://stackoverflow.com/questions/6422896/celltable-with-custom-header-containing-searchbox-and-focus-problem On Tuesday, March 13, 2012 1:38:05 PM UTC+1, kretel wrote: What I might actually need is to get two rows inserted into theader in CellTable. So the header look like this: | | header1 - label1 | header2 - label1 | +--+--+--+ | label| header1 - label2 | header2 - label2 | +--+--+--+ | foobar | 1 | image| Is there a way to add an extra header row to a CellTable after adding a column with one header? Thanks, Kris On Tuesday, March 13, 2012 10:31:59 AM UTC, kretel wrote: Hi, I am trying to build a custom header which have two labels in a header and both are styled differently. For example: | header1 - label1 | header2 - label1 | +---++ | header1 - label2 | header2 - label2 | Label1 in headers needs to be styled differently than label2. Further label2 needs to be able to trigger column sort on a table. I was looking at examples how to build AbstractCells but still can't see how this can be applied to header. Does anyone come up with an approach to build Custom header? Thanks, Kris -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/PToCkdTcDqgJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Custom header using CompositeCell or AbstractCell
I believe that from GWT 2.4 on there a Builder class for making more advances and sophisticated Headers/Footers. But I haven't tried it myself. But I am not sure why it won't give you flexible approach for styling? You can add a class to the row/cell in the render method of your Header class. I agree that my approach is a hack (but there was no easy way to solve it back then). On Tue, Mar 13, 2012 at 4:50 PM, kretel krzysztof.re...@gmail.com wrote: Thanks for the pointer. I saw it and follow similar pattern, but it does not give you flexible approach to styling differently both rows in the header. you also wrote: [...] Well I ended up solving this by adding separate SearchBoxes above the CellTable-Header and using CSS to align them to the Header. [...] which I am trying to avoid. Imagine you provide different language for your app and table headers width/height will change. So css might not work in this case. Thanks, Kris On Tuesday, March 13, 2012 3:37:46 PM UTC, Ümit Seren wrote: You can check out this stackoverflow thread for some pointers: http://stackoverflow.com/questions/6422896/celltable-with-custom-header-containing-searchbox-and-focus-problem On Tuesday, March 13, 2012 1:38:05 PM UTC+1, kretel wrote: What I might actually need is to get two rows inserted into theader in CellTable. So the header look like this: | | header1 - label1 | header2 - label1 | +--+--+--+ | label | header1 - label2 | header2 - label2 | +--+--+--+ | foobar | 1 | image | Is there a way to add an extra header row to a CellTable after adding a column with one header? Thanks, Kris On Tuesday, March 13, 2012 10:31:59 AM UTC, kretel wrote: Hi, I am trying to build a custom header which have two labels in a header and both are styled differently. For example: | header1 - label1 | header2 - label1 | +---++ | header1 - label2 | header2 - label2 | Label1 in headers needs to be styled differently than label2. Further label2 needs to be able to trigger column sort on a table. I was looking at examples how to build AbstractCells but still can't see how this can be applied to header. Does anyone come up with an approach to build Custom header? Thanks, Kris -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/PToCkdTcDqgJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Custom header using CompositeCell or AbstractCell
GWT 2.5 will give this opportunity I guess. Relevant issue is http://code.google.com/p/google-web-toolkit/issues/detail?id=5423#c13 Relevant commits are: http://gwt-code-reviews.appspot.com/1501803 http://gwt-code-reviews.appspot.com/1499808/ Relevant demos are: http://showcase2.jlabanca-testing.appspot.com/#!CwCustomDataGrid http://showcase3.jlabanca-testing.appspot.com/#!CwCustomDataGrid I you can't wait for the 2.5 release you can use the trunk. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/wQZFQI8FrFIJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: GWT 2.4 - problems with space key handling and FieldUpdater for TextInputCell inside CompositeCell in CellTree
Looks like it boils down to events. After looking at the TextInputCell and AbstractInputCell source, I added focus and change events to the list of events consumed by the CompositeCell, and that addressed both issues. Incidentally, I tried out the EditTextCell in the CompositeCell, and to get that working, I needed to add keyup and keydown events to the CompositeCell. Clearly I do not yet have my mind wrapped around how the events are propagated in a CompositeCell, but at least I've solved my immediate problems. JLS On Dec 28, 3:49 pm, James Scott j...@jls.cx wrote: Hi all- I feel like I'm missing something obvious here, but I haven't been able to figure this out. In short, I have a CellTree whose leaf nodes are populated with CompositeCells. Each CompositeCell has an ImageResourceCell, a TextCell, and a TextInputCell. These are displaying in the tree correctly. I have attached an onClick event to the ImageResourceCell that deletes the item from the tree, and that works as expected. The intent for the TextInputCell is to display a field from the entity associated with the cell, and update the field on the entity when the user changes the value in the TextInputCell. However, I'm having a couple of problems with the TextInputCell. First, when I type in the TextInputCell, the space key is ignored - well, it's probably being consumed by something else but the upshot is that when I type a space character, it doesn't appear in the TextInputCell. I thought this might have to do with the SelectionModel or KeyboardSelectionPolicy on the CellTree, but I've set the tree to KeyboardSelectionPolicy.DISABLED and the TreeViewModel to NoSelectionModel and it's still happening.[snip] -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
GWT 2.4 - problems with space key handling and FieldUpdater for TextInputCell inside CompositeCell in CellTree
Hi all- I feel like I'm missing something obvious here, but I haven't been able to figure this out. In short, I have a CellTree whose leaf nodes are populated with CompositeCells. Each CompositeCell has an ImageResourceCell, a TextCell, and a TextInputCell. These are displaying in the tree correctly. I have attached an onClick event to the ImageResourceCell that deletes the item from the tree, and that works as expected. The intent for the TextInputCell is to display a field from the entity associated with the cell, and update the field on the entity when the user changes the value in the TextInputCell. However, I'm having a couple of problems with the TextInputCell. First, when I type in the TextInputCell, the space key is ignored - well, it's probably being consumed by something else but the upshot is that when I type a space character, it doesn't appear in the TextInputCell. I thought this might have to do with the SelectionModel or KeyboardSelectionPolicy on the CellTree, but I've set the tree to KeyboardSelectionPolicy.DISABLED and the TreeViewModel to NoSelectionModel and it's still happening. Furthermore, the up, down and right arrow keys are also ignored, but the left arrow key causes the CellTree to disappear entirely. Curiously, if I override the onBrowserEvent in the TextInputCell to show a Window.alert, the space character DOES make its way into the TextInputCell, but the alert doesn't affect what happens on arrow key. Second - the point of having the TextInputCell there is that I want to update the entity object associated with that tree node. In the HasCell that describes the TextInputCell, I overrode getFieldUpdater to return a reference to the object that should do the updating, but its update method apparently never gets called. Do I need to do something in the CompositeCell's or TextInputCell's onBrowserEvent to invoke the update myself? Code below - sorry for the length. JLS //construct composite cell for code descriptions ListHasCellCcdDTO, ? descripHasCells = new ArrayListHasCellCcdDTO, ?(); descripHasCells.add(new HasCellCcdDTO, ImageResource() { private ImageResourceCell cell = new ImageResourceCell(); public CellImageResource getCell() { return cell; } public FieldUpdaterCcdDTO, ImageResource getFieldUpdater() { return null; } public ImageResource getValue(CcdDTO object) { return pImages.delete(); } }); descripHasCells.add(new HasCellCcdDTO, String() { private TextCell cell = new TextCell(); @Override public CellString getCell() { return cell; } @Override public FieldUpdaterCcdDTO, String getFieldUpdater() { return null; } @Override public String getValue(CcdDTO value) { if (value instanceof CcdGroupDTO) { return ((CcdGroupDTO)value).getGroupName(); } else { return All; } } }); descripHasCells.add(new HasCellCcdDTO, String() { private TextInputCell cell = new TextInputCell() { @Override public SetString getConsumedEvents() { HashSetString events = new HashSetString(); events.add(click); events.add(keydown); return events; } // uncomment this and the space key appears in the text input, after the alert // public void onBrowserEvent(Context context, Element elem, String value, NativeEvent event, ValueUpdaterString arg4) { // Window.alert(text input event: + event.getType()); // }; }; @Override public CellString getCell() { return cell
[gwt-contrib] Passing the row index to the FieldUpdater for a CompositeCell instead of passing -1 all the time. (issue1618803)
Reviewers: rdayal, Description: Passing the row index to the FieldUpdater for a CompositeCell instead of passing -1 all the time. Issue: 7050 Please review this at http://gwt-code-reviews.appspot.com/1618803/ Affected files: M user/src/com/google/gwt/cell/client/CompositeCell.java Index: user/src/com/google/gwt/cell/client/CompositeCell.java === --- user/src/com/google/gwt/cell/client/CompositeCell.java (revision 10802) +++ user/src/com/google/gwt/cell/client/CompositeCell.java (working copy) @@ -216,15 +216,16 @@ return hasCell.getCell().isEditing(context, cellParent, hasCell.getValue(object)); } - private X void onBrowserEventImpl(Context context, Element parent, + private X void onBrowserEventImpl(final Context context, Element parent, final C object, NativeEvent event, final ValueUpdaterC valueUpdater, final HasCellC, X hasCell) { ValueUpdaterX tempUpdater = null; final FieldUpdaterC, X fieldUpdater = hasCell.getFieldUpdater(); if (fieldUpdater != null) { tempUpdater = new ValueUpdaterX() { +@Override public void update(X value) { - fieldUpdater.update(-1, object, value); + fieldUpdater.update(context.getIndex(), object, value); if (valueUpdater != null) { valueUpdater.update(object); } -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
Re: CellTree expand with CompositeCell - Example or HowTo?!
Yes this was really helpful! Now I understand it in general! Thank you! I try to apply it to example 2 of http://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideUiCellWidgets.html#celltree In this example the leafs are added to a list. How I have to modify this function? What's the best way to get started or could you give me a short explanation? Thanks in advance -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/5A6zj1sBrfYJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
CellTree expand with CompositeCell - Example or HowTo?!
Hi there, i want to use the CellTree to show the hierarchy of my data in a tree structure. For beginning took a look at this example http://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideUiCellWidgets.html#celltree to understand how a CellTree works. This works!!! But now I want to expand the leafs with further information, like a description or a checkbox. It should look like this http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTree. Because I'm new to GWT I don't know how to realize it. Could someone give me a hint or a short example? Thanks Alex -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/42_ASDkrGHsJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: CellTree expand with CompositeCell - Example or HowTo?!
Why don't you look at the sample's code? (click source code on the top bar on the showcase sample; in this one, there are several files, you can switch between them using the drop down next to the source code link, and not ethat example in the list *is* a file) -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/3p8gnhQVXBkJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: CellTree expand with CompositeCell - Example or HowTo?!
Hey, i know the code and tried to understand it, but I didn't get it. I also tried to put it in sample project, but it has to many references to other classes. That was the reason, why I asked, if someone could help me! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/VQm5lJbE2FYJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: CellTree expand with CompositeCell - Example or HowTo?!
OK, sorry. So, the thing is to make the NodeInfo for your leaf use a different Cell than the other non-leaf nodes. In the Showcase sample, in ContactTreeViewModel, notice how the getNodeInfo tests the type of the parent value (either 'null' denoting the root node, or a Category node, or a LetterCount node) to choose how to build the DefaultNodeInfo to be returned (children of the root node are categories, rendered using the CategoryCell; children of a category are letter-counts, rendered using a LetterCountCell; etc.) Finally, the cell used to render individual contacts (leaf nodes), is built in the ContactTreeViewModel's constructor, as a CompositeCell composed of a CheckboxCell and a ContactCell; with the CompositeCell itself using some custom rendering to put each sub-cell into a table cell (td element within a tabletr) Does it help? -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/MNqNPRAhV1kJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: I need suggestions for compositeCell selection
My bad. The description might have been insufficient. I have an overwritten multiselection model because I want to select multiple items. I'm not sure if this makes any difference but I mentioned it just in case. My problem is how to tick check box when I click on the imageCell when the item is already selected. So once again. I know how to select an item and tick the checkBox by clicking on the image cell - I use custom eventTranslator and make the hasCell with a single checkBox depending on selection and not handle selection on it's own. Now I replaced the hasCell with single checkBoxCell with hasCell containing a cell made of 3 custom checkBoxes ( I added a name attribute describing resolution so that I know which one was selected when change event is fired). I added lastChanged property to the underlying object to remember what fired the event. I set the property in eventTranslator. I want the item to be selected and backgroud color changed if at least one of the checkBoxes is ticked= unticking single checkbox doesn't necessarily lead to deselecting an item. I also want it to be selected when the imageCell is clicked. In that case the default checkBox should be ticked. Clicking on checkBoxes to select image is simple. I can click on the imageCell and tick the default resolution this way but only if the item hasn't been selected yet. If it's already selected the cell is not rerendered . I thought that the problem was in selectionModel.resolveChanges if (selected) { if (oldValue == null || !oldValue.equals(object)) { .. It only fired event if there was no selection or other item had been selected. I needed it to fire a changeEvent if other checkBox in the same item was ticked. In other words when property not the object changed. So I replaced that code with if (oldValue == null || object.lastChange()!= null) So my model is firing the event now but it gets lost somewhere. The cellList isn't calling renderRowValues = the cell isn't re-rendered= box isn't ticked To sum up hacking things is never good idea and my solution doesn't work. How should I implement this properly? regards -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
I need suggestions for compositeCell selection
I have a cellList of composite cells. Each cell consist of an imageCell and a checkBoxCell that depends on selection and doesn't handle selection. I have custom SelectionEventManager that selects the composite cell if user clicks on the imageCell or the checkBox. Now I want to extend it to have 3 checkBoxes representing image's resolution. If user click anywhere on image default resolution should be selected also if any of the checkBoxes is ticked item should be selected. What is the best way to implement this? So far I tried creating 'tripleCheckBoxCell' and multiSelectionModel with overwritten resolveChanges that fires selectionChangeEvent if any resolution has changed. But it doesn't work as it should and I'm not sure if that's the right way to go. I appreciate any suggestions -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: I need suggestions for compositeCell selection
MultiselectionModel means that more than one item on your cellList can be selected. Is this what you want? I have tackled a similar problem, meaning that my compsiteCell consists of a couple of other cells and each is performing its own action when clicked. Have a look at http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTree ContactTreeViewModel.java for an example of a compositeCell. I believe checkboxCells should be enough for what you need. For the clickable image cell look at the source code of ActionCell and how it delegates if you feel the need to create a custom cell for this purpose. Basically you can just copy it and change its template to an image instead. -G -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/gOx7Da9Zl3IJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: ActionCells within a CompositeCell not receiving onBrowserEvent()
Here's the link to the example code, http://pastebin.com/GbCRiZzu If anyone has a working example of how to get ActionCells to work within a CompositeCell posting it would be much appreciated. Thanks On Tue, Jun 28, 2011 at 9:24 PM, ashwin.desi...@gmail.com ashwin.desi...@gmail.com wrote: Are you following the exact sample? or are you using the CompositeCell in your own project? Can you paste the code where you are associating your CompositeCell with a table or CellList ~Ashwin On Wed, Jun 29, 2011 at 9:42 AM, Daniel Johnston affablebl...@gmail.comwrote: Thanks for the help Ashwin, but I checked the import, com.google.gwt.dom.client.Element, and its correct, however the ActionCells within the CompositeCell are still not receiving the onBrowserEvent() . On Tue, Jun 28, 2011 at 6:58 PM, Ashwin Desikan ashwin.desi...@gmail.com wrote: Daniel, Check your import statement for the Element class. Thus should be using the .dom.Element package and not .client Most probably that would be the issue for onbrowserEvent not getting invoked Thanks Ashwin Sent from my iPhone On Jun 28, 2011, at 10:46 PM, Daniel Johnston affablebl...@gmail.com wrote: The ActionCell's onBrowserEvent() methods are not called. Is there something I need to override in the CompositeCell or ConsumedEvents to make this work? Below my example code, based on the Sample http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTree http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTree // Construct a composite cell for actions ListHasCellItem, ? hasCells = new ArrayListHasCellItem, ?(); hasCells.add(new HasCellItem, Item() { private ActionCellItem cell = new ActionCellItem( SafeHtmlUtils .fromTrustedString(Utils.makeImage(deleteIcon)), new ActionCell.DelegateItem() { @Override public void execute(Item item) { listener.onDeleteClicked(item); } }); public CellItem getCell() { return cell; } public FieldUpdaterItem, Item getFieldUpdater() { return null; } public Item getValue(Item item) { return item; } }); hasCells.add(new HasCellItem, Item() { private ActionCellItem cell = new ActionCellItem( SafeHtmlUtils.fromTrustedString(Utils.makeImage(editIcon)), new ActionCell.DelegateItem() { @Override public void execute(Item item) { listener.onEditClicked(item); } }); public CellItem getCell() { return cell; } public FieldUpdaterItem, Item getFieldUpdater() { return null; } public Item getValue(Item item) { return item; } }); CompositeCellItem actionsCell = new CompositeCellItem( hasCells) { @Override public void render(Context context, Item value, SafeHtmlBuilder sb) { sb.appendHtmlConstant(tabletbodytr); super.render(context, value, sb); sb.appendHtmlConstant(/tr/tbody/table); } @Override protected Element getContainerElement(Element parent) { // Return the first TR element in the table. return parent.getFirstChildElement().getFirstChildElement() .getFirstChildElement(); } @Override protected X void render(Context context, Item value, SafeHtmlBuilder sb, HasCellItem, X hasCell) { CellX cell = hasCell.getCell(); sb.appendHtmlConstant(td); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant(/td); } }; Thanks in advance --- -Daniel Johnston -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com . To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com . To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- -Daniel Johnston -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- -Daniel Johnston -- You received this message because
Re: ActionCells within a CompositeCell not receiving onBrowserEvent()
You're not sinking any events in your constructor. If you look at ActionCell you'll see public ActionCell(SafeHtml message, DelegateC delegate) { super(click, keydown); } You will at the very least need to call super(click, keydown) inside public ItemCellTableComposite() -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/K4rxXQ9TrcEJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: ActionCells within a CompositeCell not receiving onBrowserEvent()
I found a solution. If you remove the table from the example and return the parent element from CompositeCell.getContainerElement() it seems to delegate the onBrowserEvents to the correct Element. CompositeCellODataEntityItem actionsCell = newCompositeCellODataEntityItem( hasCells) { @Override public void render(Context context, ODataEntityItem value, SafeHtmlBuilder sb) { //sb.appendHtmlConstant(tabletbodytr); super.render(context, value, sb); //sb.appendHtmlConstant(/tr/tbody/table); } @Override protected Element getContainerElement(Element parent) { // Return the first TR element in the table. //return parent.getFirstChildElement().getFirstChildElement() // .getFirstChildElement(); return parent; } @Override protected X void render(Context context, ODataEntityItem value, SafeHtmlBuilder sb, HasCellODataEntityItem, X hasCell) { CellX cell = hasCell.getCell(); //sb.appendHtmlConstant(td); cell.render(context, hasCell.getValue(value), sb); //sb.appendHtmlConstant(/td); } }; On Wed, Jun 29, 2011 at 10:46 AM, Jeff Larsen larse...@gmail.com wrote: You're not sinking any events in your constructor. If you look at ActionCell you'll see public ActionCell(SafeHtml message, DelegateC delegate) { super(click, keydown); } You will at the very least need to call super(click, keydown) inside public ItemCellTableComposite() -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/K4rxXQ9TrcEJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- -Daniel Johnston -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
ActionCells within a CompositeCell not receiving onBrowserEvent()
The ActionCell's onBrowserEvent() methods are not called. Is there something I need to override in the CompositeCell or ConsumedEvents to make this work? Below my example code, based on the Sample http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTree // Construct a composite cell for actions ListHasCellItem, ? hasCells = new ArrayListHasCellItem, ?(); hasCells.add(new HasCellItem, Item() { private ActionCellItem cell = new ActionCellItem( SafeHtmlUtils .fromTrustedString(Utils.makeImage(deleteIcon)), new ActionCell.DelegateItem() { @Override public void execute(Item item) { listener.onDeleteClicked(item); } }); public CellItem getCell() { return cell; } public FieldUpdaterItem, Item getFieldUpdater() { return null; } public Item getValue(Item item) { return item; } }); hasCells.add(new HasCellItem, Item() { private ActionCellItem cell = new ActionCellItem( SafeHtmlUtils.fromTrustedString(Utils.makeImage(editIcon)), new ActionCell.DelegateItem() { @Override public void execute(Item item) { listener.onEditClicked(item); } }); public CellItem getCell() { return cell; } public FieldUpdaterItem, Item getFieldUpdater() { return null; } public Item getValue(Item item) { return item; } }); CompositeCellItem actionsCell = new CompositeCellItem( hasCells) { @Override public void render(Context context, Item value, SafeHtmlBuilder sb) { sb.appendHtmlConstant(tabletbodytr); super.render(context, value, sb); sb.appendHtmlConstant(/tr/tbody/table); } @Override protected Element getContainerElement(Element parent) { // Return the first TR element in the table. return parent.getFirstChildElement().getFirstChildElement() .getFirstChildElement(); } @Override protected X void render(Context context, Item value, SafeHtmlBuilder sb, HasCellItem, X hasCell) { CellX cell = hasCell.getCell(); sb.appendHtmlConstant(td); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant(/td); } }; Thanks in advance --- -Daniel Johnston -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: ActionCells within a CompositeCell not receiving onBrowserEvent()
Daniel, Check your import statement for the Element class. Thus should be using the .dom.Element package and not .client Most probably that would be the issue for onbrowserEvent not getting invoked Thanks Ashwin Sent from my iPhone On Jun 28, 2011, at 10:46 PM, Daniel Johnston affablebl...@gmail.com wrote: The ActionCell's onBrowserEvent() methods are not called. Is there something I need to override in the CompositeCell or ConsumedEvents to make this work? Below my example code, based on the Sample http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTree // Construct a composite cell for actions ListHasCellItem, ? hasCells = new ArrayListHasCellItem, ?(); hasCells.add(new HasCellItem, Item() { private ActionCellItem cell = new ActionCellItem( SafeHtmlUtils .fromTrustedString(Utils.makeImage(deleteIcon)), new ActionCell.DelegateItem() { @Override public void execute(Item item) { listener.onDeleteClicked(item); } }); public CellItem getCell() { return cell; } public FieldUpdaterItem, Item getFieldUpdater() { return null; } public Item getValue(Item item) { return item; } }); hasCells.add(new HasCellItem, Item() { private ActionCellItem cell = new ActionCellItem( SafeHtmlUtils.fromTrustedString(Utils.makeImage(editIcon)), new ActionCell.DelegateItem() { @Override public void execute(Item item) { listener.onEditClicked(item); } }); public CellItem getCell() { return cell; } public FieldUpdaterItem, Item getFieldUpdater() { return null; } public Item getValue(Item item) { return item; } }); CompositeCellItem actionsCell = new CompositeCellItem( hasCells) { @Override public void render(Context context, Item value, SafeHtmlBuilder sb) { sb.appendHtmlConstant(tabletbodytr); super.render(context, value, sb); sb.appendHtmlConstant(/tr/tbody/table); } @Override protected Element getContainerElement(Element parent) { // Return the first TR element in the table. return parent.getFirstChildElement().getFirstChildElement() .getFirstChildElement(); } @Override protected X void render(Context context, Item value, SafeHtmlBuilder sb, HasCellItem, X hasCell) { CellX cell = hasCell.getCell(); sb.appendHtmlConstant(td); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant(/td); } }; Thanks in advance --- -Daniel Johnston -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http
Re: ActionCells within a CompositeCell not receiving onBrowserEvent()
Thanks for the help Ashwin, but I checked the import, com.google.gwt.dom.client.Element, and its correct, however the ActionCells within the CompositeCell are still not receiving the onBrowserEvent() . On Tue, Jun 28, 2011 at 6:58 PM, Ashwin Desikan ashwin.desi...@gmail.comwrote: Daniel, Check your import statement for the Element class. Thus should be using the .dom.Element package and not .client Most probably that would be the issue for onbrowserEvent not getting invoked Thanks Ashwin Sent from my iPhone On Jun 28, 2011, at 10:46 PM, Daniel Johnston affablebl...@gmail.com wrote: The ActionCell's onBrowserEvent() methods are not called. Is there something I need to override in the CompositeCell or ConsumedEvents to make this work? Below my example code, based on the Sample http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTree http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTree // Construct a composite cell for actions ListHasCellItem, ? hasCells = new ArrayListHasCellItem, ?(); hasCells.add(new HasCellItem, Item() { private ActionCellItem cell = new ActionCellItem( SafeHtmlUtils .fromTrustedString(Utils.makeImage(deleteIcon)), new ActionCell.DelegateItem() { @Override public void execute(Item item) { listener.onDeleteClicked(item); } }); public CellItem getCell() { return cell; } public FieldUpdaterItem, Item getFieldUpdater() { return null; } public Item getValue(Item item) { return item; } }); hasCells.add(new HasCellItem, Item() { private ActionCellItem cell = new ActionCellItem( SafeHtmlUtils.fromTrustedString(Utils.makeImage(editIcon)), new ActionCell.DelegateItem() { @Override public void execute(Item item) { listener.onEditClicked(item); } }); public CellItem getCell() { return cell; } public FieldUpdaterItem, Item getFieldUpdater() { return null; } public Item getValue(Item item) { return item; } }); CompositeCellItem actionsCell = new CompositeCellItem( hasCells) { @Override public void render(Context context, Item value, SafeHtmlBuilder sb) { sb.appendHtmlConstant(tabletbodytr); super.render(context, value, sb); sb.appendHtmlConstant(/tr/tbody/table); } @Override protected Element getContainerElement(Element parent) { // Return the first TR element in the table. return parent.getFirstChildElement().getFirstChildElement() .getFirstChildElement(); } @Override protected X void render(Context context, Item value, SafeHtmlBuilder sb, HasCellItem, X hasCell) { CellX cell = hasCell.getCell(); sb.appendHtmlConstant(td); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant(/td); } }; Thanks in advance --- -Daniel Johnston -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- -Daniel Johnston -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: ActionCells within a CompositeCell not receiving onBrowserEvent()
Are you following the exact sample? or are you using the CompositeCell in your own project? Can you paste the code where you are associating your CompositeCell with a table or CellList ~Ashwin On Wed, Jun 29, 2011 at 9:42 AM, Daniel Johnston affablebl...@gmail.comwrote: Thanks for the help Ashwin, but I checked the import, com.google.gwt.dom.client.Element, and its correct, however the ActionCells within the CompositeCell are still not receiving the onBrowserEvent() . On Tue, Jun 28, 2011 at 6:58 PM, Ashwin Desikan ashwin.desi...@gmail.comwrote: Daniel, Check your import statement for the Element class. Thus should be using the .dom.Element package and not .client Most probably that would be the issue for onbrowserEvent not getting invoked Thanks Ashwin Sent from my iPhone On Jun 28, 2011, at 10:46 PM, Daniel Johnston affablebl...@gmail.com wrote: The ActionCell's onBrowserEvent() methods are not called. Is there something I need to override in the CompositeCell or ConsumedEvents to make this work? Below my example code, based on the Sample http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTree http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTree // Construct a composite cell for actions ListHasCellItem, ? hasCells = new ArrayListHasCellItem, ?(); hasCells.add(new HasCellItem, Item() { private ActionCellItem cell = new ActionCellItem( SafeHtmlUtils .fromTrustedString(Utils.makeImage(deleteIcon)), new ActionCell.DelegateItem() { @Override public void execute(Item item) { listener.onDeleteClicked(item); } }); public CellItem getCell() { return cell; } public FieldUpdaterItem, Item getFieldUpdater() { return null; } public Item getValue(Item item) { return item; } }); hasCells.add(new HasCellItem, Item() { private ActionCellItem cell = new ActionCellItem( SafeHtmlUtils.fromTrustedString(Utils.makeImage(editIcon)), new ActionCell.DelegateItem() { @Override public void execute(Item item) { listener.onEditClicked(item); } }); public CellItem getCell() { return cell; } public FieldUpdaterItem, Item getFieldUpdater() { return null; } public Item getValue(Item item) { return item; } }); CompositeCellItem actionsCell = new CompositeCellItem( hasCells) { @Override public void render(Context context, Item value, SafeHtmlBuilder sb) { sb.appendHtmlConstant(tabletbodytr); super.render(context, value, sb); sb.appendHtmlConstant(/tr/tbody/table); } @Override protected Element getContainerElement(Element parent) { // Return the first TR element in the table. return parent.getFirstChildElement().getFirstChildElement() .getFirstChildElement(); } @Override protected X void render(Context context, Item value, SafeHtmlBuilder sb, HasCellItem, X hasCell) { CellX cell = hasCell.getCell(); sb.appendHtmlConstant(td); cell.render(context, hasCell.getValue(value), sb); sb.appendHtmlConstant(/td); } }; Thanks in advance --- -Daniel Johnston -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- -Daniel Johnston -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
How to add CompositeCell to the CellTable
I am trying to CompositeCell with three checkboxes and a button hasCells.add(new HasCellContact, Boolean() { private CheckboxCell cell = new CheckboxCell(); @Override public CellBoolean getCell() { return cell; } @Override public FieldUpdaterContact, Boolean getFieldUpdater() { return null; } @Override public Boolean getValue(Contact object) { return object.control; } }); final CompositeCellContact compositeCells = new CompositeCellContact(hasCells); But how do we add this cell to the CellTable and how to provide the text for the Checkboxes. I couldnt find any examples of this in gwt samples. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Alignment of cells in a CompositeCell
Can't this be done using CellTree? On Mon, Feb 14, 2011 at 4:40 PM, John LaBanca jlaba...@google.com wrote: You could use a table structure and set the width of the first cell with the label: table style=table-layout:fixed; tr td width=20emLabel:/td td width=40emContent/td /tr /table Please cc google-web-toolkit@googlegroups.com on questions about GWT, as other people may know the answer or have the same question. That way, the answers get indexed and others can search for them. Thanks, John LaBanca jlaba...@google.com On Mon, Feb 14, 2011 at 11:10 AM, Murali Krishna muralikrishn...@gmail.com wrote: Hi John, Could you please let me know if it is possible to align the cells in a composite cell. I'm attaching two screenshots along with this mail. As you can see from the screenshots when the values are populated the cell alignment doesn't look good. Is there any way we can do this properly. Thanks in advance Murali -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Bug: CompositeCell containing EditTextCell
I did not search the google bug list so far. The bug occurs because of CompositeCell is not implementing isEditing. To fix this issue, cerate a new class and derive it from CompositeCell and add this few lines of code: /** * The isEditing() implementation is missing in CompositeCell. * Without this implementation, * You aren't able to edit included cells properly. */ public boolean isEditing(Cell.Context context, Element parent, C value) { for (HasCellC, ? hasCell : hasCells) { if(isEditingImpl(context, parent, value, hasCell)) { return true; } } return false; }; private X boolean isEditingImpl(Context context, Element parent, C value, HasCellC, X hasCell) { return hasCell.getCell().isEditing(context, parent, hasCell.getValue(value)); } That's it and should fix it! :) best regards, Bernd On 1 Feb., 23:23, Jason jmitche...@gmail.com wrote: Yes, the offending code lies in line 430 of DefaultSelectionEventManager. It tries to toggle the cell selection when you push the space key. CellList extends AbstractHasData which in turn uses the DefaultSelectionEventManager. The behaviour seems even stranger if you don't have a SelectionModel set for your CellList. If you set one (you can use 'new SingleSelectionModelT' on your CellList object, where T is your model class) and you will see that the space key event toggles the row selection.. I'm not sure if there is abugreport for this yet? We will need to wait for it to be fixed / explained but until then I developed this little hack :) Paste it anywhere.. it's static. Tested on Chrome and FF4 but probably won't work on some older browsers. Event.addNativePreviewHandler(new NativePreviewHandler() { @Override public void onPreviewNativeEvent(NativePreviewEvent event) { NativeEvent nativeEvent = event.getNativeEvent(); final int keyCode = nativeEvent.getKeyCode(); final boolean isNotAnInputElement = !InputElement .is(nativeEvent.getEventTarget()); final boolean isNotTheSpaceKey = keyCode != 32; if (isNotAnInputElement || isNotTheSpaceKey) { return; } String type = nativeEvent.getType(); event.cancel(); if ((keyup.equals(type))) { InputElement element = nativeEvent.getEventTarget().cast(); final int start = element.getPropertyInt(selectionStart); final int end = element.getPropertyInt(selectionEnd); if (start == end) { String before = element.getValue(); String after = before.substring(0, start) + + before.substring(start); element.setValue(after); element.setPropertyInt(selectionStart, start + 1); element.setPropertyInt(selectionEnd, start + 1); } } } }); On Jan 24, 11:06 am, Bernd xbern...@hotmail.com wrote: Please try the following: Put anEditTextCellinto a CompositeCell and add the CompositeCell to a CellTable Column. Now enter the EditTextCells edit mode to change the text and try to add a space-char by pressing your space key. Unfortunately, this doesn't work for me (Firefox 3.5). I checked the events which are forwarded by the Browser to the CompositeCell. Interestingly, there is no downkey event delivered for the space key. Maybe this has something to do with it? Here is the sample code i used to generate the CellTable Column: finalEditTextCelleditTexCell = newEditTextCell(); HasCellString, String hasC = new HasCellString, String() { @Override public CellString getCell() { return editTexCell; } @Override public FieldUpdaterString, String getFieldUpdater() { return null
Re: Bug: CompositeCell containing EditTextCell
I created a couple of issues to track this: DefaultSelectionEventManager eats events: http://code.google.com/p/google-web-toolkit/issues/detail?id=5970 CompositeCell doesn't implement isEditing: http://code.google.com/p/google-web-toolkit/issues/detail?id=5971 Thanks, John LaBanca jlaba...@google.com On Wed, Feb 2, 2011 at 3:27 AM, Bernd xbern...@hotmail.com wrote: I did not search the google bug list so far. The bug occurs because of CompositeCell is not implementing isEditing. To fix this issue, cerate a new class and derive it from CompositeCell and add this few lines of code: /** * The isEditing() implementation is missing in CompositeCell. * Without this implementation, * You aren't able to edit included cells properly. */ public boolean isEditing(Cell.Context context, Element parent, C value) { for (HasCellC, ? hasCell : hasCells) { if(isEditingImpl(context, parent, value, hasCell)) { return true; } } return false; }; private X boolean isEditingImpl(Context context, Element parent, C value, HasCellC, X hasCell) { return hasCell.getCell().isEditing(context, parent, hasCell.getValue(value)); } That's it and should fix it! :) best regards, Bernd On 1 Feb., 23:23, Jason jmitche...@gmail.com wrote: Yes, the offending code lies in line 430 of DefaultSelectionEventManager. It tries to toggle the cell selection when you push the space key. CellList extends AbstractHasData which in turn uses the DefaultSelectionEventManager. The behaviour seems even stranger if you don't have a SelectionModel set for your CellList. If you set one (you can use 'new SingleSelectionModelT' on your CellList object, where T is your model class) and you will see that the space key event toggles the row selection.. I'm not sure if there is abugreport for this yet? We will need to wait for it to be fixed / explained but until then I developed this little hack :) Paste it anywhere.. it's static. Tested on Chrome and FF4 but probably won't work on some older browsers. Event.addNativePreviewHandler(new NativePreviewHandler() { @Override public void onPreviewNativeEvent(NativePreviewEvent event) { NativeEvent nativeEvent = event.getNativeEvent(); final int keyCode = nativeEvent.getKeyCode(); final boolean isNotAnInputElement = !InputElement .is(nativeEvent.getEventTarget()); final boolean isNotTheSpaceKey = keyCode != 32; if (isNotAnInputElement || isNotTheSpaceKey) { return; } String type = nativeEvent.getType(); event.cancel(); if ((keyup.equals(type))) { InputElement element = nativeEvent.getEventTarget().cast(); final int start = element.getPropertyInt(selectionStart); final int end = element.getPropertyInt(selectionEnd); if (start == end) { String before = element.getValue(); String after = before.substring(0, start) + + before.substring(start); element.setValue(after); element.setPropertyInt(selectionStart, start + 1); element.setPropertyInt(selectionEnd, start + 1); } } } }); On Jan 24, 11:06 am, Bernd xbern...@hotmail.com wrote: Please try the following: Put anEditTextCellinto a CompositeCell and add the CompositeCell to a CellTable Column. Now enter the EditTextCells edit mode to change the text and try to add a space-char by pressing your space key. Unfortunately, this doesn't work for me (Firefox 3.5). I checked the events which are forwarded by the Browser to the CompositeCell. Interestingly, there is no downkey event delivered for the space key. Maybe this has something to do with it? Here is the sample code i used to generate the CellTable Column: finalEditTextCelleditTexCell = newEditTextCell(); HasCellString, String hasC = new HasCellString, String() { @Override public CellString
Re: Bug: CompositeCell containing EditTextCell
Yes, the offending code lies in line 430 of DefaultSelectionEventManager. It tries to toggle the cell selection when you push the space key. CellList extends AbstractHasData which in turn uses the DefaultSelectionEventManager. The behaviour seems even stranger if you don't have a SelectionModel set for your CellList. If you set one (you can use 'new SingleSelectionModelT' on your CellList object, where T is your model class) and you will see that the space key event toggles the row selection.. I'm not sure if there is a bug report for this yet? We will need to wait for it to be fixed / explained but until then I developed this little hack :) Paste it anywhere.. it's static. Tested on Chrome and FF4 but probably won't work on some older browsers. Event.addNativePreviewHandler(new NativePreviewHandler() { @Override public void onPreviewNativeEvent(NativePreviewEvent event) { NativeEvent nativeEvent = event.getNativeEvent(); final int keyCode = nativeEvent.getKeyCode(); final boolean isNotAnInputElement = !InputElement .is(nativeEvent.getEventTarget()); final boolean isNotTheSpaceKey = keyCode != 32; if (isNotAnInputElement || isNotTheSpaceKey) { return; } String type = nativeEvent.getType(); event.cancel(); if ((keyup.equals(type))) { InputElement element = nativeEvent.getEventTarget().cast(); final int start = element.getPropertyInt(selectionStart); final int end = element.getPropertyInt(selectionEnd); if (start == end) { String before = element.getValue(); String after = before.substring(0, start) + + before.substring(start); element.setValue(after); element.setPropertyInt(selectionStart, start + 1); element.setPropertyInt(selectionEnd, start + 1); } } } }); On Jan 24, 11:06 am, Bernd xbern...@hotmail.com wrote: Please try the following: Put an EditTextCell into a CompositeCell and add the CompositeCell to a CellTable Column. Now enter the EditTextCells edit mode to change the text and try to add a space-char by pressing your space key. Unfortunately, this doesn't work for me (Firefox 3.5). I checked the events which are forwarded by the Browser to the CompositeCell. Interestingly, there is no downkey event delivered for the space key. Maybe this has something to do with it? Here is the sample code i used to generate the CellTable Column: final EditTextCell editTexCell = new EditTextCell(); HasCellString, String hasC = new HasCellString, String() { @Override public CellString getCell() { return editTexCell; } @Override public FieldUpdaterString, String getFieldUpdater() { return null; } @Override public String getValue(String object) { return object; } }; ListHasCellString, ? listHC = new ArrayListHasCellString, ?(); listHC.add(hasC); CompositeCell compCell = new CompositeCellString(listHC); ColumnRowOfData, String compCellColumn = new ColumnRowOfData, String(compCell) { @Override public String getValue(RowOfData object) { return test123; } }; Is there a way to fix this problem? A positive answer would help me a lot :) Thanks! Bernd -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
CompositeCell
We're in the process of converting to CellTable and we have a column that has a vertically displayed list of items. This sounds perfect for using a CompositeCell with a List of ClickableTextCells, except for the fact that our list needs to be dynamic. I suppose I could use AbstractColumn and define our own implementation, but I am hoping that we have just miss understood CompositeCell. Any thoughts would be greatly appreciated, - Adam -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: CompositeCell
Is it dynamic based on the row value, or dynamic in that it can change? If its the former, you can extend CompositeCell and override the render() method to hide spans that aren't needed. If its the latter, you will probably want to extend AbstractEditableCell and copy the examples in TextInputCell or CheckboxCell. Thanks, John LaBanca jlaba...@google.com On Mon, Nov 8, 2010 at 7:38 AM, Adam ambr...@gmail.com wrote: We're in the process of converting to CellTable and we have a column that has a vertically displayed list of items. This sounds perfect for using a CompositeCell with a List of ClickableTextCells, except for the fact that our list needs to be dynamic. I suppose I could use AbstractColumn and define our own implementation, but I am hoping that we have just miss understood CompositeCell. Any thoughts would be greatly appreciated, - Adam -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: CompositeCell
It's the latter, though for what we're wanting to do I don't think AbstractEditableCell is what we want. What we want to do is bring a name per line in one cell that's clickable similar to ClickableTextCell for every object of a sub-list from the model object. For instance if we had the following two classes: public class Foo { private ListBar bars; private String something; public ListBar getBars() { return bars; } public String getSomething() { return something; } } public class Bar { private String name; public String getName() { return name; } } Then we define a cellTable / Column as so: ... CellTableFoo table = new CellTableFoo(); ColumnFoo, String somethingColumn = new ColumnFoo, String(new TextCell()) { public String getValue(Foo object) { return object.getSomething(); } }; table.addColumn(somethingColumn); // Here's the ideal part + some pseudo code ColumnFoo, String barNames = new ColumnFoo, String(new CompositeCellFoo, String(HasCellClickableTextCell, String()) { public String getValue(Foo object) { for (Bar b: object.getBars()) { return b.getName(); } } }; table.addColumn(barNames); And finally the output would be something like: | Something Header | Bar Header | - | Cool Stuff | Bar 1 | | | Bar 2 | | | Bar 3 | - | More stuff | Bar 7 | ... On Nov 8, 1:33 pm, John LaBanca jlaba...@google.com wrote: Is it dynamic based on the row value, or dynamic in that it can change? If its the former, you can extend CompositeCell and override the render() method to hide spans that aren't needed. If its the latter, you will probably want to extend AbstractEditableCell and copy the examples in TextInputCell or CheckboxCell. Thanks, John LaBanca jlaba...@google.com On Mon, Nov 8, 2010 at 7:38 AM, Adam ambr...@gmail.com wrote: We're in the process of converting to CellTable and we have a column that has a vertically displayed list of items. This sounds perfect for using a CompositeCell with a List of ClickableTextCells, except for the fact that our list needs to be dynamic. I suppose I could use AbstractColumn and define our own implementation, but I am hoping that we have just miss understood CompositeCell. Any thoughts would be greatly appreciated, - Adam -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
CompositeCell and hiding Cells Problem
I have an issue with the CompositeCell in a CellTable. My CompositeCell consists of 3 ActionCells and a SelectionCell. However the difference to a normal behaviour of a CompositeCell is that I don't show all Cells at the same time but based on some state in a domain object. Here is what I try to achieve: Initial State Second Stage After pressing on Save/Cancel | NEW | - (press on NEW ActionCell) - | SELECTION SAVE CANCEL | - | NEW | So after pressing on the NEW ActionCell it should be hidden and the SelectionCell and the SAVE/CANCEL ActionCells should be shown. After I press on SAVE or CANCEL again only the NEW ActionCell should be shown. For the ActionCells i just override the render method of the Cell to either not render the cell or to render it based on the state in my domain object. This looks like this: public static class NewActioncell extends ActionCellMyObject { public NewActioncell(String text,com.google.gwt.cell.client.ActionCell.DelegateMyObject delegate) { super(text, delegate); } @Override public void render(MyObject value, Object key, SafeHtmlBuilder sb) { if (value.getIsNew()) // get the state super.render(value, key, sb); } } The code for the Save and Cencel Action Cells is basically the same apart from the fact that in the render method i will render the cells if value.getIsNew() == false The delegate action just sets the IsNew flag on the MyObject and calls refresh on the DataProvider. So far everything works as expected. As soon as I press on the NEW Button, the NEW Button is hidden and only the CANCEL and SAVE buttons are shown. Now I also want to display a Select Box when SAVE and CANCEL are shown. The Problem with the SelectionCell is that it is bound to String as the Generic Type, so I can't access MyObject in its render method. My workaround is now to override the X void render method of the CompositeCell and hide the SelectionCell there. This looks something like that: public static class CustomCompositeCell extends CompositeCellMyObject { public CustomCompositeCell(ListHasCellMyObject, ? hasCells) { super(hasCells); } @Override protected X void render(MyObject value, Object key,SafeHtmlBuilder sb, HasCellMyObject, X hasCell) { if (!(hasCell.getCell() instanceof SelectionCell) || (value.getIsNew())) // check Cell and State { super.render(value, key, sb, hasCell); } } } So now the SelectionCell is displayed as soon as I press on the NEW Button. However I get an exception in hosted and in production mode as soon as I press on cancel or save. The error is: Chrome: com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot read property 'nextSibling' of null Firefox: elem is null [Break on this error] var sib = elem.nextSibling; I managed to trace the problem back to the resetFocus method of the CompositeCell class: @Override public boolean resetFocus(Element parent, C value, Object key) { Element curChild = getContainerElement(parent).getFirstChildElement(); for (HasCellC, ? hasCell : hasCells) { // The first child that takes focus wins. Only one child should ever be in // edit mode, so this is safe. if (resetFocusImpl(curChild, value, key, hasCell)) { return true; } curChild = curChild.getNextSiblingElement(); } return false; } It seems that the loop goes through all 4 Cells but one call of getNextSiblingElement() returns null. The interesting part is that the exception only happens when I add the selectionCell to CompositeCell. It seems that not rendering an ActionCell by overriding its render method doesn't cause a problem. However overriding the render method of the CompositeCell to not render the SelectionCell causes this Exception in the resetFocus method. Is this a potential bug or is my approach of hiding Cells in a CompositeCell flawed. Maybe there is a better approach. Thanks in advance Uemit -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: CompositeCell and hiding Cells Problem
As far as the SelectionCell, we should have a version that is genericized and just use the selected index to map to the generic value. In general, we probably also need an EditCell, which is basically a two state cell that can enter and exit edit mode. I'm sure that as people use the Cell Widgets, we'll figure out which Cells are missing from the API. As for your immediate problem, I think the answer is that you need to override resetFocus() to do whatever you want. Composite assumes that all four elements will be there, so if you override render to change that, then you need to override resetFocus() to handle the new structure. Alternatively, you could render all four elements regardless of the state and just set the display to null. Thanks, John LaBanca jlaba...@google.com On Fri, Nov 5, 2010 at 7:15 AM, Ümit uemit.se...@gmail.com wrote: I have an issue with the CompositeCell in a CellTable. My CompositeCell consists of 3 ActionCells and a SelectionCell. However the difference to a normal behaviour of a CompositeCell is that I don't show all Cells at the same time but based on some state in a domain object. Here is what I try to achieve: Initial State Second Stage After pressing on Save/Cancel | NEW | - (press on NEW ActionCell) - | SELECTION SAVE CANCEL | - | NEW | So after pressing on the NEW ActionCell it should be hidden and the SelectionCell and the SAVE/CANCEL ActionCells should be shown. After I press on SAVE or CANCEL again only the NEW ActionCell should be shown. For the ActionCells i just override the render method of the Cell to either not render the cell or to render it based on the state in my domain object. This looks like this: public static class NewActioncell extends ActionCellMyObject { public NewActioncell(String text,com.google.gwt.cell.client.ActionCell.DelegateMyObject delegate) { super(text, delegate); } @Override public void render(MyObject value, Object key, SafeHtmlBuilder sb) { if (value.getIsNew()) // get the state super.render(value, key, sb); } } The code for the Save and Cencel Action Cells is basically the same apart from the fact that in the render method i will render the cells if value.getIsNew() == false The delegate action just sets the IsNew flag on the MyObject and calls refresh on the DataProvider. So far everything works as expected. As soon as I press on the NEW Button, the NEW Button is hidden and only the CANCEL and SAVE buttons are shown. Now I also want to display a Select Box when SAVE and CANCEL are shown. The Problem with the SelectionCell is that it is bound to String as the Generic Type, so I can't access MyObject in its render method. My workaround is now to override the X void render method of the CompositeCell and hide the SelectionCell there. This looks something like that: public static class CustomCompositeCell extends CompositeCellMyObject { public CustomCompositeCell(ListHasCellMyObject, ? hasCells) { super(hasCells); } @Override protected X void render(MyObject value, Object key,SafeHtmlBuilder sb, HasCellMyObject, X hasCell) { if (!(hasCell.getCell() instanceof SelectionCell) || (value.getIsNew())) // check Cell and State { super.render(value, key, sb, hasCell); } } } So now the SelectionCell is displayed as soon as I press on the NEW Button. However I get an exception in hosted and in production mode as soon as I press on cancel or save. The error is: Chrome: com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot read property 'nextSibling' of null Firefox: elem is null [Break on this error] var sib = elem.nextSibling; I managed to trace the problem back to the resetFocus method of the CompositeCell class: @Override public boolean resetFocus(Element parent, C value, Object key) { Element curChild = getContainerElement(parent).getFirstChildElement(); for (HasCellC, ? hasCell : hasCells) { // The first child that takes focus wins. Only one child should ever be in // edit mode, so this is safe. if (resetFocusImpl(curChild, value, key, hasCell)) { return true; } curChild = curChild.getNextSiblingElement(); } return false; } It seems that the loop goes through all 4 Cells but one call of getNextSiblingElement() returns null. The interesting part is that the exception only happens when I add the selectionCell to CompositeCell. It seems that not rendering an ActionCell by overriding its render method doesn't cause a problem. However overriding the render method of the CompositeCell to not render the SelectionCell causes this Exception in the resetFocus method. Is this a potential bug or is my approach of hiding Cells in a CompositeCell flawed. Maybe there is a better approach. Thanks in advance Uemit -- You received this message
Re: CompositeCell and hiding Cells Problem
Thanks John for the quick response. One question though. I am not sure what you mean with setting the display to null. I checked the specific classes (SelectionCell, AbstractCell etc) but couldn't find anything which allows me to set the display to null. Maybe you can specify what you mean with display. Thank in advance Uemit On Nov 5, 1:46 pm, John LaBanca jlaba...@google.com wrote: As far as the SelectionCell, we should have a version that is genericized and just use the selected index to map to the generic value. In general, we probably also need an EditCell, which is basically a two state cell that can enter and exit edit mode. I'm sure that as people use the Cell Widgets, we'll figure out which Cells are missing from the API. As for your immediate problem, I think the answer is that you need to override resetFocus() to do whatever you want. Composite assumes that all four elements will be there, so if you override render to change that, then you need to override resetFocus() to handle the new structure. Alternatively, you could render all four elements regardless of the state and just set the display to null. Thanks, John LaBanca jlaba...@google.com On Fri, Nov 5, 2010 at 7:15 AM, Ümit uemit.se...@gmail.com wrote: I have an issue with the CompositeCell in a CellTable. My CompositeCell consists of 3 ActionCells and a SelectionCell. However the difference to a normal behaviour of a CompositeCell is that I don't show all Cells at the same time but based on some state in a domain object. Here is what I try to achieve: Initial State Second Stage After pressing on Save/Cancel | NEW | - (press on NEW ActionCell) - | SELECTION SAVE CANCEL | - | NEW | So after pressing on the NEW ActionCell it should be hidden and the SelectionCell and the SAVE/CANCEL ActionCells should be shown. After I press on SAVE or CANCEL again only the NEW ActionCell should be shown. For the ActionCells i just override the render method of the Cell to either not render the cell or to render it based on the state in my domain object. This looks like this: public static class NewActioncell extends ActionCellMyObject { public NewActioncell(String text,com.google.gwt.cell.client.ActionCell.DelegateMyObject delegate) { super(text, delegate); } @Override public void render(MyObject value, Object key, SafeHtmlBuilder sb) { if (value.getIsNew()) // get the state super.render(value, key, sb); } } The code for the Save and Cencel Action Cells is basically the same apart from the fact that in the render method i will render the cells if value.getIsNew() == false The delegate action just sets the IsNew flag on the MyObject and calls refresh on the DataProvider. So far everything works as expected. As soon as I press on the NEW Button, the NEW Button is hidden and only the CANCEL and SAVE buttons are shown. Now I also want to display a Select Box when SAVE and CANCEL are shown. The Problem with the SelectionCell is that it is bound to String as the Generic Type, so I can't access MyObject in its render method. My workaround is now to override the X void render method of the CompositeCell and hide the SelectionCell there. This looks something like that: public static class CustomCompositeCell extends CompositeCellMyObject { public CustomCompositeCell(ListHasCellMyObject, ? hasCells) { super(hasCells); } �...@override protected X void render(MyObject value, Object key,SafeHtmlBuilder sb, HasCellMyObject, X hasCell) { if (!(hasCell.getCell() instanceof SelectionCell) || (value.getIsNew())) // check Cell and State { super.render(value, key, sb, hasCell); } } } So now the SelectionCell is displayed as soon as I press on the NEW Button. However I get an exception in hosted and in production mode as soon as I press on cancel or save. The error is: Chrome: com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot read property 'nextSibling' of null Firefox: elem is null [Break on this error] var sib = elem.nextSibling; I managed to trace the problem back to the resetFocus method of the CompositeCell class: �...@override public boolean resetFocus(Element parent, C value, Object key) { Element curChild = getContainerElement(parent).getFirstChildElement(); for (HasCellC, ? hasCell : hasCells) { // The first child that takes focus wins. Only one child should ever be in // edit mode, so this is safe. if (resetFocusImpl(curChild, value, key, hasCell)) { return true; } curChild = curChild.getNextSiblingElement(); } return false; } It seems that the loop goes through all 4 Cells but one call of getNextSiblingElement() returns null. The interesting part
Re: CompositeCell and hiding Cells Problem
Sorry, I was referring to the CSS property display, and I meant none, not null. Rendering the following will cause the span to be completely hidden and take up no space. span style=\display:none;\My cell content/span Thanks, John LaBanca jlaba...@google.com On Fri, Nov 5, 2010 at 11:24 AM, Ümit uemit.se...@gmail.com wrote: Thanks John for the quick response. One question though. I am not sure what you mean with setting the display to null. I checked the specific classes (SelectionCell, AbstractCell etc) but couldn't find anything which allows me to set the display to null. Maybe you can specify what you mean with display. Thank in advance Uemit On Nov 5, 1:46 pm, John LaBanca jlaba...@google.com wrote: As far as the SelectionCell, we should have a version that is genericized and just use the selected index to map to the generic value. In general, we probably also need an EditCell, which is basically a two state cell that can enter and exit edit mode. I'm sure that as people use the Cell Widgets, we'll figure out which Cells are missing from the API. As for your immediate problem, I think the answer is that you need to override resetFocus() to do whatever you want. Composite assumes that all four elements will be there, so if you override render to change that, then you need to override resetFocus() to handle the new structure. Alternatively, you could render all four elements regardless of the state and just set the display to null. Thanks, John LaBanca jlaba...@google.com On Fri, Nov 5, 2010 at 7:15 AM, Ümit uemit.se...@gmail.com wrote: I have an issue with the CompositeCell in a CellTable. My CompositeCell consists of 3 ActionCells and a SelectionCell. However the difference to a normal behaviour of a CompositeCell is that I don't show all Cells at the same time but based on some state in a domain object. Here is what I try to achieve: Initial State Second Stage After pressing on Save/Cancel | NEW | - (press on NEW ActionCell) - | SELECTION SAVE CANCEL | - | NEW | So after pressing on the NEW ActionCell it should be hidden and the SelectionCell and the SAVE/CANCEL ActionCells should be shown. After I press on SAVE or CANCEL again only the NEW ActionCell should be shown. For the ActionCells i just override the render method of the Cell to either not render the cell or to render it based on the state in my domain object. This looks like this: public static class NewActioncell extends ActionCellMyObject { public NewActioncell(String text,com.google.gwt.cell.client.ActionCell.DelegateMyObject delegate) { super(text, delegate); } @Override public void render(MyObject value, Object key, SafeHtmlBuilder sb) { if (value.getIsNew()) // get the state super.render(value, key, sb); } } The code for the Save and Cencel Action Cells is basically the same apart from the fact that in the render method i will render the cells if value.getIsNew() == false The delegate action just sets the IsNew flag on the MyObject and calls refresh on the DataProvider. So far everything works as expected. As soon as I press on the NEW Button, the NEW Button is hidden and only the CANCEL and SAVE buttons are shown. Now I also want to display a Select Box when SAVE and CANCEL are shown. The Problem with the SelectionCell is that it is bound to String as the Generic Type, so I can't access MyObject in its render method. My workaround is now to override the X void render method of the CompositeCell and hide the SelectionCell there. This looks something like that: public static class CustomCompositeCell extends CompositeCellMyObject { public CustomCompositeCell(ListHasCellMyObject, ? hasCells) { super(hasCells); } @Override protected X void render(MyObject value, Object key,SafeHtmlBuilder sb, HasCellMyObject, X hasCell) { if (!(hasCell.getCell() instanceof SelectionCell) || (value.getIsNew())) // check Cell and State { super.render(value, key, sb, hasCell); } } } So now the SelectionCell is displayed as soon as I press on the NEW Button. However I get an exception in hosted and in production mode as soon as I press on cancel or save. The error is: Chrome: com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot read property 'nextSibling' of null Firefox: elem is null [Break on this error] var sib = elem.nextSibling; I managed to trace the problem back to the resetFocus method of the CompositeCell class: @Override public boolean resetFocus(Element parent, C value, Object key) { Element curChild = getContainerElement(parent).getFirstChildElement(); for (HasCellC
Re: CompositeCell and hiding Cells Problem
Ah I see ;-) However I somehow can't access the styles and the span respectively. The render method of the SelectionCell renders the select tag directly (I suppose the span is rendered by the CellTable itself). I solved my problem by extending the SelectionCell and storing a isVible Flag in it and then adding an additional span around it. The class looks like this: public class HideableSelectionCell extends SelectionCell{ protected boolean isVisible = true; public HideableSelectionCell(ListString options) { super(options); } @Override public void render(String value, Object key, SafeHtmlBuilder sb) { if (!isVisible) sb.appendHtmlConstant(span style=\display:none\); super.render(value, key, sb); if (!isVisible) sb.appendHtmlConstant(/span); } public void setIsVisible(boolean isVisible) { this.isVisible = isVisible; } public boolean getIsVisible(){ return this.isVisible; } } And in the render method of the compositeCell I set the isVisible Flag of the cell before rendering it. Is that the right approach or is there some other way to access the Cell Span's Style directly ? Sorry for being so persistent ;-) thanks Uemit On Nov 5, 5:03 pm, John LaBanca jlaba...@google.com wrote: Sorry, I was referring to the CSS property display, and I meant none, not null. Rendering the following will cause the span to be completely hidden and take up no space. span style=\display:none;\My cell content/span Thanks, John LaBanca jlaba...@google.com On Fri, Nov 5, 2010 at 11:24 AM, Ümit uemit.se...@gmail.com wrote: Thanks John for the quick response. One question though. I am not sure what you mean with setting the display to null. I checked the specific classes (SelectionCell, AbstractCell etc) but couldn't find anything which allows me to set the display to null. Maybe you can specify what you mean with display. Thank in advance Uemit On Nov 5, 1:46 pm, John LaBanca jlaba...@google.com wrote: As far as the SelectionCell, we should have a version that is genericized and just use the selected index to map to the generic value. In general, we probably also need an EditCell, which is basically a two state cell that can enter and exit edit mode. I'm sure that as people use the Cell Widgets, we'll figure out which Cells are missing from the API. As for your immediate problem, I think the answer is that you need to override resetFocus() to do whatever you want. Composite assumes that all four elements will be there, so if you override render to change that, then you need to override resetFocus() to handle the new structure. Alternatively, you could render all four elements regardless of the state and just set the display to null. Thanks, John LaBanca jlaba...@google.com On Fri, Nov 5, 2010 at 7:15 AM, Ümit uemit.se...@gmail.com wrote: I have an issue with the CompositeCell in a CellTable. My CompositeCell consists of 3 ActionCells and a SelectionCell. However the difference to a normal behaviour of a CompositeCell is that I don't show all Cells at the same time but based on some state in a domain object. Here is what I try to achieve: Initial State Second Stage After pressing on Save/Cancel | NEW | - (press on NEW ActionCell) - | SELECTION SAVE CANCEL | - | NEW | So after pressing on the NEW ActionCell it should be hidden and the SelectionCell and the SAVE/CANCEL ActionCells should be shown. After I press on SAVE or CANCEL again only the NEW ActionCell should be shown. For the ActionCells i just override the render method of the Cell to either not render the cell or to render it based on the state in my domain object. This looks like this: public static class NewActioncell extends ActionCellMyObject { public NewActioncell(String text,com.google.gwt.cell.client.ActionCell.DelegateMyObject delegate) { super(text, delegate); } @Override public void render(MyObject value, Object key, SafeHtmlBuilder sb) { if (value.getIsNew()) // get the state super.render(value, key, sb); } } The code for the Save and Cencel Action Cells is basically the same apart from the fact that in the render method i will render the cells if value.getIsNew() == false The delegate action just sets the IsNew flag on the MyObject and calls refresh on the DataProvider. So far everything works as expected. As soon as I press on the NEW Button, the NEW Button is hidden and only the CANCEL and SAVE buttons are shown. Now I also want to display a Select Box when SAVE and CANCEL are shown. The Problem with the SelectionCell is that it is bound to String as the Generic Type, so I can't access MyObject in its render method. My workaround is now
Re: CompositeCell and hiding Cells Problem
The default implementation of the render method in CompositeCell wraps each element in a span. You could do the same and set the display style property based on the state, and then you don't need to extend SelectionCell. While it isn't required for very simple Cells (that only render a single element), it makes sense to wrap each Cell in its own parent element. Thanks, John LaBanca jlaba...@google.com On Fri, Nov 5, 2010 at 12:40 PM, Ümit uemit.se...@gmail.com wrote: Ah I see ;-) However I somehow can't access the styles and the span respectively. The render method of the SelectionCell renders the select tag directly (I suppose the span is rendered by the CellTable itself). I solved my problem by extending the SelectionCell and storing a isVible Flag in it and then adding an additional span around it. The class looks like this: public class HideableSelectionCell extends SelectionCell{ protected boolean isVisible = true; public HideableSelectionCell(ListString options) { super(options); } @Override public void render(String value, Object key, SafeHtmlBuilder sb) { if (!isVisible) sb.appendHtmlConstant(span style=\display:none\); super.render(value, key, sb); if (!isVisible) sb.appendHtmlConstant(/span); } public void setIsVisible(boolean isVisible) { this.isVisible = isVisible; } public boolean getIsVisible(){ return this.isVisible; } } And in the render method of the compositeCell I set the isVisible Flag of the cell before rendering it. Is that the right approach or is there some other way to access the Cell Span's Style directly ? Sorry for being so persistent ;-) thanks Uemit On Nov 5, 5:03 pm, John LaBanca jlaba...@google.com wrote: Sorry, I was referring to the CSS property display, and I meant none, not null. Rendering the following will cause the span to be completely hidden and take up no space. span style=\display:none;\My cell content/span Thanks, John LaBanca jlaba...@google.com On Fri, Nov 5, 2010 at 11:24 AM, Ümit uemit.se...@gmail.com wrote: Thanks John for the quick response. One question though. I am not sure what you mean with setting the display to null. I checked the specific classes (SelectionCell, AbstractCell etc) but couldn't find anything which allows me to set the display to null. Maybe you can specify what you mean with display. Thank in advance Uemit On Nov 5, 1:46 pm, John LaBanca jlaba...@google.com wrote: As far as the SelectionCell, we should have a version that is genericized and just use the selected index to map to the generic value. In general, we probably also need an EditCell, which is basically a two state cell that can enter and exit edit mode. I'm sure that as people use the Cell Widgets, we'll figure out which Cells are missing from the API. As for your immediate problem, I think the answer is that you need to override resetFocus() to do whatever you want. Composite assumes that all four elements will be there, so if you override render to change that, then you need to override resetFocus() to handle the new structure. Alternatively, you could render all four elements regardless of the state and just set the display to null. Thanks, John LaBanca jlaba...@google.com On Fri, Nov 5, 2010 at 7:15 AM, Ümit uemit.se...@gmail.com wrote: I have an issue with the CompositeCell in a CellTable. My CompositeCell consists of 3 ActionCells and a SelectionCell. However the difference to a normal behaviour of a CompositeCell is that I don't show all Cells at the same time but based on some state in a domain object. Here is what I try to achieve: Initial State Second Stage After pressing on Save/Cancel | NEW | - (press on NEW ActionCell) - | SELECTION SAVE CANCEL | - | NEW | So after pressing on the NEW ActionCell it should be hidden and the SelectionCell and the SAVE/CANCEL ActionCells should be shown. After I press on SAVE or CANCEL again only the NEW ActionCell should be shown. For the ActionCells i just override the render method of the Cell to either not render the cell or to render it based on the state in my domain object. This looks like this: public static class NewActioncell extends ActionCellMyObject { public NewActioncell(String text,com.google.gwt.cell.client.ActionCell.DelegateMyObject delegate) { super(text, delegate); } @Override public void render(MyObject value, Object key, SafeHtmlBuilder sb) { if (value.getIsNew()) // get the state super.render(value, key, sb); } } The code for the Save and Cencel Action Cells is basically the same apart from the fact
using CompositeCell in CellTable?
Hi, I tried to use a CompositeCell in a Celltable, but with no success. Can anyone write me a short example to add a column as CompositeCell in the CellTable, please? I miss some short introduction to this powerful topic and unfortunately the use is very inconsistent. Thanks in advance! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: using CompositeCell in CellTable?
I tried something and this works, but I don't know how and why. ListHasCellFoo, ? bar = new ArrayListHasCellFoo, ?(); bar.add(new ColumnFoo, String(new Cell()) { @Override public CellString getCell() { return cell; } @Override public FieldUpdaterFoo, String getFieldUpdater() { return null; } @Override public String getValue(Foo object) { return caption; } }); celltable.addColumn(new Column(new CompositeCellFoo(bar)) { @Override public Object getValue(Object object) { return null; } }, column caption); On Oct 11, 2:37 pm, Spitzname bartsch-ste...@web.de wrote: Hi, I tried to use a CompositeCell in a Celltable, but with no success. Can anyone write me a short example to add a column as CompositeCell in the CellTable, please? I miss some short introduction to this powerful topic and unfortunately the use is very inconsistent. Thanks in advance! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.