6
위젯을 프로그래밍 방식으로 복제하고 싶습니다. Dom.clone을 사용하여 위젯 내부의 요소를 복제 할 수 있지만이 복제 된 요소에서 위젯을 만들 수없는 것 같습니다. 이것이 가능한가?GWT DOM.clone을 사용하여 위젯 복제
//somewhere in onModuleLoad()...
Button button = new Button("Original");
RootPanel.get().add(button);
//.....later on...
Element buttonCloneElement = DOM.clone(button.getElement(), true);
Widget buttonClone;
buttonClone = new Button(buttonCloneElement); //FAIL - No such constructor
buttonClone.setElement(buttonCloneElement); //FAIL - No such setter method
//This may work but looks messy to me
buttonClone.getElement().setInnerHTML(button.getElement().getInnerHTML());
//add the clone to the root panel??
RootPanel.get().add(buttonClone);
위젯을 복제하는 다른 방법이 있습니까?
나는 내가 더 잘 Javadoc을 검색하는 방법을 배울 필요가 생각 : 나는 통해 두 개의 목록 상자 위젯이/ –
을 ** UIBinder ** * @ UiField옵니다 lstHeaderSort, @UiField옵니다 lstFooterSort; ** 그리고 ** lstFooterSort = ListBox.wrap (DOM.clone (lstHeaderSort.getElement(), true)); *로 변환하지만 null 포인터 예외가 있습니다. 왜 ? – Cataclysm