Format.format( constants.CopySnapshotText(),
snapshotName ) );
final List<RadioButton> options = new ArrayList<RadioButton>();
VerticalPanel vert = new VerticalPanel();
for ( int i = 0; i < snaps.length; i++ ) {
RadioButton existing = new RadioButton( "snapshotNameGroup",
snaps[i].name ); //NON-NLS
options.add( existing );
vert.add( existing );
}
HorizontalPanel newNameHorizontalPanel = new HorizontalPanel();
final TextBox newNameTextBox = new TextBox();
final String newNameText = constants.NEW() + ": ";
final RadioButton newNameRadioButton = new RadioButton( "snapshotNameGroup",
newNameText);
newNameHorizontalPanel.add(newNameRadioButton);
newNameTextBox.setEnabled(false);
newNameRadioButton.addClickListener(new ClickListener() {
public void onClick(Widget w) {
newNameTextBox.setEnabled(true);
}
});
newNameHorizontalPanel.add(newNameTextBox);
options.add(newNameRadioButton);
vert.add(newNameHorizontalPanel);
copy.addAttribute(constants.ExistingSnapshots(),
vert );
Button ok = new Button( constants.OK() );
copy.addAttribute( "", ok );
ok.addClickListener( new ClickListener() {
public void onClick(Widget w) {
boolean oneButtonIsSelected = false;
for ( RadioButton rb : options ) {
if ( rb.isChecked() ) {
oneButtonIsSelected = true;
break;
}
}
if (!oneButtonIsSelected) {
Window.alert(constants.YouHaveToEnterOrChoseALabelNameForTheSnapshot());
return;
}
if ( newNameRadioButton.isChecked() ) {
if ( checkUnique( snaps,
newNameTextBox.getText() ) ) {
serv.copyOrRemoveSnapshot( packageName,
snapshotName,
false,