TabLayoutPanel과 CellTable을 포함하는 CrawlerOne.java를 호출하는 탭 중 하나에 EntryPoint 클래스 인 WebCrawlerOne.java가 있습니다. 나는 많은 시도를했지만 어떤 오류라도 찾을 수 없습니다. 관련 주제를 검색하려고했지만 프로젝트가 실행될 때 CellTable이 TabLayoutPanel에 표시되지 않습니다.TabLayoutPanel에서 CellTable을 볼 수 없습니다.
- 내가 .gwt-TabLayoutPanel와 같은 CSS에서 TabLayoutPanel의 높이를 지정
- GWT 2.2.4
를 사용하여 (DOCTYPE html로 사용) 표준 모드에서 오전 { 높이 : 100 %; }
CrawlerOne.ui.xml이 g 내부 그때 엔 같습니다 HTMLpanel 태그
Hello, <g:Button styleName="{style.important}" ui:field="button" /> <table cellspacing='0' cellpadding='0' style='width:100%;'> <tr> <td valign='top'> <c:CellTable addStyleNames="{style.cellTable}" ui:field="table"/> </td> </tr> </table> <g:TextBox ui:field="box"></g:TextBox> <g:Button ui:field="addSite"></g:Button>
CrawlerOne.java는
public class CrawlerOne extends Composite implements HasText {
interface CrawlerOneUiBinder extends UiBinder<Widget, CrawlerOne> {
}
@UiField
CellTable<Contact> table;
@UiField
Button addSite;
@UiField
TextBox box;
public CrawlerOne() {
Widget w = new Widget();
w = onInitialize();
initWidget(w);
}
@UiField
Button button;
@UiHandler("button")
void onClick(ClickEvent e) {
Window.alert("Hello!");
}
public void setText(String text) {
button.setText(text);
}
public String getText() {
return button.getText();
}
/**
* A simple data type that represents a contact with a unique ID.
*/
private static class Contact {
private static int nextId = 0;
private final int id;
private String site;
private String document;
private String pending;
public Contact(String site, String document, String pending) {
nextId++;
this.id = nextId;
this.site = site;
this.document = document;
this.pending = pending;
}
public String getDocument() {
return document;
}
public int getId() {
return id;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getPending() {
return pending;
}
}
/**
* The list of data to display.
*/
private static final List<Contact> CONTACTS = new LinkedList<Contact>(Arrays.asList(
new Contact("www.google.com", "12", "123"),
new Contact("www.yahoo.com", "23", "124"),
new Contact("www.rediff.com", "24", "124"),
new Contact("www.gmail.com", "23", "124"),
new Contact("www.facebook.com", "23", "124"),
new Contact("www.flickr.com", "23", "124"),
new Contact("www.youtube.com", "45", "125")));
private static final ProvidesKey<Contact> KEY_PROVIDER =
new ProvidesKey<Contact>() {
@Override
public Object getKey(Contact object) {
return object.getId();
}
};
/**
* Initialize.
*/
public Widget onInitialize() {
table = new CellTable<Contact>(KEY_PROVIDER);
table.setWidth("100%", true);
table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
initTableColumns();
// Push the data into the widget.
table.setRowData(CONTACTS);
// Set table width.
table.setWidth("100%");
box = new TextBox();
box.setText("Enter New Site");
addSite = new Button("Add Row");
addSite.addClickHandler(new ClickHandler() {
@UiHandler("addSite")
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
try {
if(box.getValue()=="") {
Window.alert("Error: Invalid Site Value");
box.setText("Enter New Site");
}
else {
CONTACTS.add(new Contact(box.getValue(), "23", "127"));
table.setRowCount(CONTACTS.size(), true);
table.setRowData(CONTACTS);
table.redraw();
}
}catch (Exception e) {
Window.alert("Exception Error: " + e);
}
}
});
// Create the UiBinder.
CrawlerOneUiBinder uiBinder = GWT.create(CrawlerOneUiBinder.class);
Widget widget = uiBinder.createAndBindUi(this);
return widget;
}
private void initTableColumns() {
//code to add columns
}}//end of file
그때 엔 본다 출력은의 EntryPoint 클래스에서 직접 실행하는 경우

그때 엔 CellTable가 표시되어 보이는
public class WebCrawlerOne implements EntryPoint {
/**
* This is the entry point method.
*/
public void onModuleLoad() {
TabLayoutPanel menu = new TabLayoutPanel(10, Unit.EM);
menu.add(new CrawlerOne(), "Crawler");
menu.add(new HTML("This is my page!"), "Page 2");
menu.selectTab(0);
RootLayoutPanel.get().add(menu);
}
}
그때 엔3210
및 WebCrawlerOne.java 보인다. 어떤 도움을 주셔서 감사합니다. 감사!
정말 고마워요! @UiField (제공된 = true)가 누락되었습니다. 나는 다른 버그로 인해 이전에 그것을 제거했다가 다시 놓는 것을 잊어 버렸다. 고마워요! :) – Prince