private void createSignalWindow()
{
signalTextBoxes = new ArrayList<TextBox>();
MosaicPanel layout = new MosaicPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL));
layout.setStyleName("bpm-window-layout");
layout.setPadding(5);
// toolbar
final MosaicPanel toolBox = new MosaicPanel();
toolBox.setPadding(0);
toolBox.setWidgetSpacing(5);
toolBox.setLayout(new BoxLayout(BoxLayout.Orientation.HORIZONTAL));
final ToolBar toolBar = new ToolBar();
toolBar.add(
new Button("Signal", new ClickHandler() {
public void onClick(ClickEvent clickEvent)
{
int selectedToken = listBoxTokens.getSelectedIndex();
// issue warning if user selected row and typed into signal ref text box
if (selectedToken != -1 && signalRef.getText().length() > 0)
{
MessageBox.alert("Multi selection", "Known active nodes and signal ref (text box) is given, please choose only one of them");
} else
if (selectedToken != -1) {
controller.handleEvent(
new Event(SignalExecutionAction.ID,
new SignalInstanceEvent(getCurrentDefinition(), getSelection(), listBoxTokens.getItem(selectedToken), eventData.getText(), selectedToken)));
} else if (signalRef.getText().length() > 0) {
TokenReference token = new TokenReference();
token.setId(getSelection().getId());
token.setName(signalRef.getText());
int foundMatch = -1;
int index = 0;
// try to find matching element from the list to avoid double signal problems
for (TokenReference ref : tokensToSignal)
{
if (ref.getName().equals(token.getName())) {
foundMatch = index;
break;
}
index++;
}
controller.handleEvent(
new Event(SignalExecutionAction.ID,
new SignalInstanceEvent(getCurrentDefinition(), getSelection(), token, eventData.getText(), foundMatch)));
} else {
MessageBox.alert("Incomplete selection", "Please select element you want to signal");
}
}
}
)
);
toolBar.add(
new Button("Close", new ClickHandler() {
public void onClick(ClickEvent clickEvent)
{
signalWindowPanel.close();
controller.handleEvent( new Event(UpdateInstancesAction.ID, getCurrentDefinition()));
}
}
)
);
toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
layout.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
Label header = new Label("Known active nodes to signal: ");
header.setStyleName("bpm-label-header");