listBox.addRowSelectionHandler(
new RowSelectionHandler()
{
public void onRowSelection(RowSelectionEvent rowSelectionEvent)
{
TaskRef task = getSelection(); // first call always null?
if(task!=null)
{
if (!task.isBlocking()) {
skipBtn.setEnabled(true);
} else {
skipBtn.setEnabled(false);
}
controller.handleEvent(
new Event(UpdateDetailsAction.ID, new DetailViewEvent("AssignedDetailView", task))
);
}
}
}
);
// toolbar
final MosaicPanel toolBox = new MosaicPanel();
toolBox.setPadding(0);
toolBox.setWidgetSpacing(5);
//toolBox.setLayout(new BoxLayout(BoxLayout.Orientation.VERTICAL));
final ToolBar toolBar = new ToolBar();
toolBar.add(
new Button("Refresh", new ClickHandler() {
public void onClick(ClickEvent clickEvent)
{
reload();
}
}
)
);
Button viewBtn = new Button("View", new ClickHandler()
{
public void onClick(ClickEvent clickEvent)
{
TaskRef selection = getSelection();
if (selection != null)
{
if (selection.getUrl() != null && !selection.getUrl().equals(""))
{
iframeWindow = new IFrameWindowPanel(
selection.getUrl(), "Task Form: "+selection.getName()
);
iframeWindow.setCallback(
new IFrameWindowCallback()
{
public void onWindowClosed()
{
reload();
}
}
);
iframeWindow.show();
}
else
{
MessageBox.alert("Invalid operation", "The task doesn't provide a UI");
}
}
else
{
MessageBox.alert("Missing selection", "Please select a task");
}
}
}
);
toolBar.add(viewBtn);
toolBar.add(
new Button("Release", new ClickHandler() {
public void onClick(ClickEvent clickEvent)
{
TaskRef selection = getSelection();
if(selection!=null)
{
TaskIdentityEvent payload = new TaskIdentityEvent(
null, selection
);
controller.handleEvent(
new Event(ReleaseTaskAction.ID, payload)
);
}
else
{
MessageBox.alert("Missing selection", "Please select a task");
}
}
}
)
);
skipBtn = new Button("Skip", new ClickHandler() {
public void onClick(ClickEvent clickEvent)
{
TaskRef selection = getSelection();
if(selection!=null && !selection.isBlocking())
{
controller.handleEvent(
new Event(
SkipTaskAction.ID,
new TaskIdentityEvent(appContext.getAuthentication().getUsername(), selection)