use of com.extjs.gxt.ui.client.widget.grid.GroupingView in project kura by eclipse.
the class ThreadsTab method onRender.
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
setLayout(new FitLayout());
setId("device-threads");
RpcProxy<ListLoadResult<GwtGroupedNVPair>> proxy = new RpcProxy<ListLoadResult<GwtGroupedNVPair>>() {
@Override
protected void load(Object loadConfig, final AsyncCallback<ListLoadResult<GwtGroupedNVPair>> callback) {
gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {
@Override
public void onFailure(Throwable ex) {
FailureHandler.handle(ex);
}
@Override
public void onSuccess(GwtXSRFToken token) {
gwtDeviceService.findThreads(token, new AsyncCallback<ListLoadResult<GwtGroupedNVPair>>() {
public void onSuccess(ListLoadResult<GwtGroupedNVPair> pairs) {
callback.onSuccess(pairs);
}
public void onFailure(Throwable caught) {
FailureHandler.handle(caught);
}
});
}
});
}
};
m_loader = new BaseListLoader<ListLoadResult<GwtGroupedNVPair>>(proxy);
m_store = new GroupingStore<GwtGroupedNVPair>(m_loader);
m_store.groupBy("group");
ColumnConfig name = new ColumnConfig("name", MSGS.deviceThreadName(), 50);
ColumnConfig value = new ColumnConfig("value", MSGS.deviceThreadInfo(), 50);
List<ColumnConfig> config = new ArrayList<ColumnConfig>();
config.add(name);
config.add(value);
ColumnModel cm = new ColumnModel(config);
GroupingView view = new GroupingView();
view.setShowGroupedColumn(false);
view.setForceFit(true);
m_grid = new Grid<GwtGroupedNVPair>(m_store, cm);
m_grid.setView(view);
m_grid.setBorders(false);
m_grid.setLoadMask(true);
m_grid.setStripeRows(true);
add(m_grid);
m_initialized = true;
}
use of com.extjs.gxt.ui.client.widget.grid.GroupingView in project kapua by eclipse.
the class DeviceTabProfile method onRender.
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
setLayout(new FitLayout());
setBorders(false);
ContentPanel tabProfileContentPanel = new ContentPanel();
tabProfileContentPanel.setLayout(new FitLayout());
tabProfileContentPanel.setBorders(false);
tabProfileContentPanel.setBodyBorder(false);
tabProfileContentPanel.setHeaderVisible(false);
tabProfileContentPanel.setTopComponent(getToolbar());
RpcProxy<ListLoadResult<GwtGroupedNVPair>> proxy = new RpcProxy<ListLoadResult<GwtGroupedNVPair>>() {
@Override
protected void load(Object loadConfig, final AsyncCallback<ListLoadResult<GwtGroupedNVPair>> callback) {
if (m_selectedDevice != null) {
gwtDeviceService.findDeviceProfile(m_selectedDevice.getScopeId(), m_selectedDevice.getClientId(), callback);
}
}
};
m_loader = new BaseListLoader<ListLoadResult<GwtGroupedNVPair>>(proxy);
m_loader.addLoadListener(new DataLoadListener());
m_store = new GroupingStore<GwtGroupedNVPair>(m_loader);
m_store.groupBy("groupLoc");
ColumnConfig name = new ColumnConfig("nameLoc", MSGS.devicePropName(), 50);
ColumnConfig value = new ColumnConfig("value", MSGS.devicePropValue(), 50);
GridCellRenderer<GwtGroupedNVPair> renderer = new GridCellRenderer<GwtGroupedNVPair>() {
@Override
public Object render(GwtGroupedNVPair model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<GwtGroupedNVPair> store, Grid<GwtGroupedNVPair> grid) {
if (model.getName().equals("devLastEventOn") && model.getValue().compareTo("N/A") != 0) {
return DateUtils.formatDateTime(new Date(Long.parseLong(model.getValue())));
}
return model.getValue();
}
};
value.setRenderer(renderer);
List<ColumnConfig> config = new ArrayList<ColumnConfig>();
config.add(name);
config.add(value);
ColumnModel cm = new ColumnModel(config);
GroupingView view = new GroupingView();
view.setShowGroupedColumn(false);
view.setForceFit(true);
view.setEmptyText(MSGS.deviceNoDeviceSelected());
m_grid = new Grid<GwtGroupedNVPair>(m_store, cm);
m_grid.setView(view);
m_grid.setBorders(false);
m_grid.setLoadMask(true);
m_grid.setStripeRows(true);
m_grid.disableTextSelection(false);
tabProfileContentPanel.add(m_grid);
add(tabProfileContentPanel);
m_initialized = true;
}
Aggregations