new Button("Refresh", new ClickHandler() {
public void onClick(ClickEvent clickEvent)
{
// force loading
controller.handleEvent(
new Event(UpdateJobsAction.ID, null)
);
}
}
)
);
toolBar.add(
new Button("Execute", new ClickHandler() {
public void onClick(ClickEvent clickEvent)
{
JobRef selection = getSelection();
if(null==selection)
{
MessageBox.alert("Missing selection", "Please select a job!");
}
else
{
controller.handleEvent(
new Event(ExecuteJobAction.ID, selection.getId())
);
}
}
}
)
);
toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
// filter
MosaicPanel filterPanel = new MosaicPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL));
filterPanel.setStyleName("mosaic-ToolBar");
final com.google.gwt.user.client.ui.ListBox dropBox = new com.google.gwt.user.client.ui.ListBox(false);
dropBox.setStyleName("bpm-operation-ui");
dropBox.addItem("All");
dropBox.addItem("Timers");
dropBox.addItem("Messages");
dropBox.addChangeListener(new ChangeListener() {
public void onChange(Widget sender) {
switch (dropBox.getSelectedIndex())
{
case 0:
currentFilter = FILTER_NONE;
break;
case 1:
currentFilter = FILTER_TIMER;
break;
case 2:
currentFilter = FILTER_MESSAGE;
break;
default:
throw new IllegalArgumentException("No such index");
}
renderFiltered();
}
});
filterPanel.add(dropBox);
toolBox.add(filterPanel, new BoxLayoutData(BoxLayoutData.FillStyle.VERTICAL));
this.jobList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
this.jobList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
// details
/*JobDetailView detailsView = new JobDetailView();
controller.addView(JobDetailView.ID, detailsView);
controller.addAction(UpdateJobDetailAction.ID, new UpdateJobDetailAction());
layout.add(detailsView, new BorderLayoutData(BorderLayout.Region.SOUTH, 10,200));
*/
Timer t = new Timer()
{
@Override
public void run()
{
controller.handleEvent(new Event(UpdateJobsAction.ID, null));
}
};
t.schedule(500);