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();
final Queue queue = selectionModel.getSelectedObject();
Feedback.confirm("Flush Queue", "Do you really want to flush queue "+queue.getName(),
new Feedback.ConfirmationHandler(){
@Override
public void onConfirmation(boolean isConfirmed) {
if(isConfirmed)
presenter.onFlushQueue(queue);