I appreciate your suggestion, i am fine for now with the FlexTable.
**I was able to populate the rows and columns with data i am receiving
from an RPC call.
**i was able to update widgets in it depending on the data., in my
above code i have a FlexTable propertyDisplayTable, it is a global
variable. I want to implement an OnClick event for this table. From
the groups i see i need to implement a class of type FlexTable and
then proceed form there, this is what i have done:
package com.google.gwt.sample.webapplication.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Timer;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.*;
/**
* A sample to show problems with trying to get the state of the
modifier
* keys during a click.
*/
public class WebApplication extends FlexTable
implements EntryPoint, ClickListener {
private static final int REFRESH_INTERVAL = 5000;
private String[] data = new String[] {
"Thelonious Monk",
"Misterioso",
"Jelly Roll Morton",
"Fickle Fay Creep",
"Sonny Rollins",
"EE-AH",
"Art Blakey and the Jazz Messengers",
"Ping Pong",
"Mose Allison",
"Mojo Woman"
};
public WebApplication() {
// Put some data into the table
for(int r=0; r<5; r++) {
for(int c=0; c<2; c++) {
// each cell in the table is a Label
that uses click notifications
Label cellLabel = new
RowLabel( data[(r*2) + c], r );
cellLabel.addClickListener(this);
this.setWidget(r, c, cellLabel);
}
}
}
/*
* It would be nice to be able to get the Event inside this
function...
*/
public void onClick(Widget sender) {
if( sender instanceof RowLabel ) {
GWT.log("onClick fired, row clicked: " +
Integer.toString(((RowLabel)sender).getRow()), null);
}
}
/*
* ...since this is fired after onClick; we can always set up
variables
* and wait for this to be called.
*/
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
GWT.log("onBrowserEvent fired; modifiers: "
+ (DOM.eventGetAltKey(event) ? "ALT
" : "")
+ (DOM.eventGetCtrlKey(event) ? "CTRL
" : "")
+ (DOM.eventGetShiftKey(event) ?
"SHIFT " : ""),
null);
}
public void onModuleLoad() {
RootPanel.get("heatRateList").add(new
WebApplication());
Timer refreshTimer = new Timer() {
@Override
public void run() {
refreshPropertyList();
}
};
refreshTimer.scheduleRepeating(REFRESH_INTERVAL);
}
protected void refreshPropertyList() {
// TODO Auto-generated method stub
Label Updatelabel = new Label();
//WebApplication.setWidget(1, 2, UpdateImage4);
}
private class RowLabel extends Label {
int row;
public RowLabel(String text, int row) {
super(text);
this.row = row;
}
public int getRow() {
return row;
}
}
}
here the OnClick is working and i was able to know which row has been
clicked, but the commented out line
WebApplication.setWidget(1, 2, Updatelabel);
is not working it says
Cannot make a static reference to the non-static method setWidget(int,
int, Widget) from the type HTMLTable, it was not able to access the
table, now the question is How do i update the row of the table, the
table is inside the panel "RootPanel", how do i get the table out of
it and update its row?
>
http://code.google.com/webtoolkit/doc/latest/DevGuideUiCellWidgets.ht...
>
> Ryan