Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DOMImplStandard.java:125 Uncaught TypeError: Cannot read property 'contains' of nullisOrHasChild_1_g$ @ DOMImplStandard.java:125$isOrHasChild_0_g$ @ Node.java:280onBrowserEvent_17_g$ @ ActionCell.java:87fireEventToCell_0_g$ @ CellList.java:360onBrowserEvent2_1_g$ @ CellList.java:453onBrowserEvent_3_g$ @ AbstractHasData.java:738dispatchEventImpl_0_g$ @ DOM.java:1480dispatchEvent_4_g$ @ DOM.java:1419dispatchEvent_6_g$ @ DOMImplStandard.java:317apply_0_g$ @ Impl.java:247entry0_0_g$ @ Impl.java:306(anonymous function) @ Impl.java:72
- The idea is to add a button inside a cell to delete that cell. The cell and the button should do 2 different things, and it works right now as expected but it keeps giving this nullpointer. Also the button should be visible only when the cell is selected.
- I created my own ActionCell, a Delegate for the button click, SingleSelectionModel for the CellList.
- class MyActionCell<T> extends ActionCell<String> {
- static String selectedSelf = "";
- public MyActionCell(String text,
- com.google.gwt.cell.client.ActionCell.Delegate<String> delegate) {
- super(text, delegate);
- // TODO Auto-generated constructor stub
- }
- @Override
- public void render(Context context, String value, SafeHtmlBuilder sb) {
- if(value==null)return;
- Window.alert("Rendering: " +value);
- SafeHtml title = new SafeHtmlBuilder().appendEscaped(value)
- .toSafeHtml();
- sb.append(title);
- if (selectedSelf.contentEquals(value)) {
- SafeHtml html = new SafeHtmlBuilder()
- .appendHtmlConstant(
- "<button type=\"button\" tabindex=\"-1\">")
- .appendEscaped(value)
- .appendHtmlConstant("</button>").toSafeHtml();
- sb.append(html);
- }
- }
- public static void setSelected(String selected){
- selectedSelf = selected;
- }
- }
- private final Delegate<String> delegate = new Delegate<String>(){
- @Override
- public void execute(String clickedPack) {
- if(clickedPack!=null){
- Window.alert("CLicked: "
- +clickedPack);
- }
- }
- };
- MyActionCell<String> ac = new MyActionCell<String>("name",delegate);
- final SingleSelectionModel<String> selectionModel = new SingleSelectionModel<String>();
- selectionModel
- .addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
- public void onSelectionChange(
- SelectionChangeEvent event) {
- String selected = selectionModel
- .getSelectedObject();
- Window.alert(selected);
- if (selected != null) {
- //selectionModel.getSelectedObject().setSelected(selected);
- MyActionCell.setSelected(selected);
- selectedPackage = selected;
- updatePackageHolderMiddle();
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement