私はGWTを学んでいます
flexTable の最初の行に、コンボボックス、コンボボックス、テキスト ボックス、AddButton、削除ボタンを追加しました。
addButton 2 行のクリック イベントで、最初と同じコンポーネントで flexTable に追加されます。(コンボボックス、コンボボックス、テキストボックス、追加ボタン、削除ボタン)
など。
今私がしなければならないことは、removeButtonのクリックイベントで行を削除するためのコードを書くことです
追加ボタンをクリックすると、同様の行が追加されます。
今私が欲しいのは、削除ボタンをクリックすると同じ行が削除されることです
どうやってするか。
編集済み
public class AdvancePropertySearch extends Composite{
// initialization
public AdvancePropertySearch() {
initWidget(getFlexTable());
}
private FlexTable getFlexTable() {
if (flexTable == null) {
flexTable = new FlexTable();
flexTable.setWidth("1033px");
flexTable.setHeight("100%");
flexTable.setWidget(0, 0, getPropertyList());
flexTable.setWidget(0, 1, getConditionList());
flexTable.setWidget(0, 2, getKeyWord());
flexTable.setWidget(0, 3, getAddbutton());
flexTable.setWidget(0, 4, getRemove());
}
return flexTable;
}
private ListBox getPropertyList() {
propertyList = new ListBox();
propertyList.setWidth("297px");
return propertyList;
}
private ListBox getConditionList() {
conditionList = new ListBox();
conditionList.setWidth("311px");
return conditionList;
}
private TextBox getKeyWord() {
keyWord = new TextBox();
return keyWord;
}
private Button getAddbutton() {
addbutton = new Button("");
addbutton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
int i = flexTable.getRowCount();
flexTable.setWidget(i, 0, getPropertyList());
flexTable.setWidget(i, 1, getConditionList());
flexTable.setWidget(i, 2, getKeyWord());
flexTable.setWidget(i, 3, getAddbutton());
flexTable.setWidget(i, 4, getRemove());
remove.setStyleName("cmis-Button-removeOn");
}
});
addbutton.setSize("25px", "25px");
addbutton.setStyleName("cmis-Button-Add");
return addbutton;
}
private Button getRemove() {
remove = new Button("");
remove.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
TableRowElement tablerow = findNearestParentRow(remove.getElement());
flexTable.removeRow(tablerow.getRowIndex());
}
});
remove.setSize("25px", "25px");
remove.setStyleName("cmis-Button-removeOff");
return remove;
}
エラー
com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:177)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.google.gwt.dev.shell.HostedModeException: Something other than a short was returned from JSNI method '@com.google.gwt.dom.client.Node::getNodeType()': JS value of type undefined, expected short
at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:154)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeShort(ModuleSpace.java:279)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeShort(JavaScriptHost.java:99)
at com.google.gwt.dom.client.Node$.getNodeType$(Node.java)
at com.client.GUI.AdvancePropertySearch.findNearestParentNodeByType(AdvancePropertySearch.java:136)
at com.client.GUI.AdvancePropertySearch.findNearestParentRow(AdvancePropertySearch.java:104)
at com.client.GUI.AdvancePropertySearch$2.onClick(AdvancePropertySearch.java:90)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:177)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)