this.presenter = presenter;
}
Widget asWidget() {
final ToolStrip toolStrip = new ToolStrip();
toolStrip.addToolButtonRight(new ToolButton(Console.CONSTANTS.common_label_refresh(), new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
presenter.setSelectedQueue(getCurrentSelection());
}
}));
// ----
queueTable = new DefaultCellTable<Queue>(5);
queueTable.setSelectionModel(new SingleSelectionModel<Queue>());
dataProvider = new ListDataProvider<Queue>();
dataProvider.addDataDisplay(queueTable);
com.google.gwt.user.cellview.client.Column<Queue, String> nameColumn = new com.google.gwt.user.cellview.client.Column<Queue, String>(new TextCell()) {
@Override
public String getValue(Queue object) {
return object.getName();
}
};
com.google.gwt.user.cellview.client.Column<Queue, List<String>> protocolColumn = new com.google.gwt.user.cellview.client.Column<Queue, List<String>>(new ProtocolCell()) {
@Override
public List<String> getValue(Queue object) {
return object.getEntries();
}
};
queueTable.addColumn(nameColumn, "Name");
queueTable.addColumn(protocolColumn, "JNDI");
queueTable.getSelectionModel().addSelectionChangeHandler(new SelectionChangeEvent.Handler(){
@Override
public void onSelectionChange(SelectionChangeEvent event) {
Queue queue = getCurrentSelection();
presenter.setSelectedQueue(queue);
}
});
// ----
NumberColumn inQueue = new NumberColumn("message-count", "Queued");
Column[] cols = new Column[] {
inQueue.setBaseline(true),
new NumberColumn("delivering-count","In Delivery").setComparisonColumn(inQueue),
};
String title = "In-Flight Messages";
final HelpSystem.AddressCallback addressCallback = new HelpSystem.AddressCallback() {
@Override
public ModelNode getAddress() {
ModelNode address = new ModelNode();
address.get(ModelDescriptionConstants.ADDRESS).set(RuntimeBaseAddress.get());
address.get(ModelDescriptionConstants.ADDRESS).add("subsystem", "messaging");
address.get(ModelDescriptionConstants.ADDRESS).add("hornetq-server", "default");
address.get(ModelDescriptionConstants.ADDRESS).add("jms-queue", "*");
return address;
}
};
if(Console.protovisAvailable())
{
sampler = new BulletGraphView(title, "count")
.setColumns(cols);
}
else
{
sampler = new PlainColumnView(title, addressCallback)
.setColumns(cols)
.setWidth(100, Style.Unit.PCT);
}
// ----
Column[] cols2 = new Column[] {
new NumberColumn("messages-added", "Added"),
new NumberColumn("scheduled-count","Scheduled")
};
String title2 = "Messages Processed";
if(Console.protovisAvailable())
{
messageSampler = new BulletGraphView(title2, "count")
.setColumns(cols2);
}
else
{
messageSampler = new PlainColumnView(title2, addressCallback)
.setColumns(cols2)
.setWidth(100, Style.Unit.PCT);
}
// ----
NumberColumn consumerCol = new NumberColumn("consumer-count", "Consumers");
Column[] cols3 = new Column[] {
consumerCol
};
String title3 = "Consumer";
if(Console.protovisAvailable())
{
consumerSampler = new BulletGraphView(title3, "count")
.setColumns(cols3);
}
else
{
consumerSampler = new PlainColumnView(title3, addressCallback)
.setColumns(cols3)
.setWidth(100, Style.Unit.PCT);
}
// ----
DefaultPager pager = new DefaultPager();
pager.setDisplay(queueTable);
ToolStrip queueTools = new ToolStrip();
queueTools.addToolButtonRight(new ToolButton("Flush", new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
SingleSelectionModel<Queue> selectionModel =
(SingleSelectionModel<Queue>)queueTable.getSelectionModel();