final List<RadioButton> options = new ArrayList<RadioButton>();
VerticalPanel vert = new VerticalPanel();
for ( int i = 0; i < snaps.length; i++ ) {
// cant copy onto to itself...
if ( !snaps[i].getName().equals( snapshotName ) ) {
RadioButton existing = new RadioButton( "snapshotNameGroup",
snaps[i].getName() ); // NON-NLS
options.add( existing );
vert.add( existing );
}
}
HorizontalPanel newNameHorizontalPanel = new HorizontalPanel();
final TextBox newNameTextBox = new TextBox();
final String newNameText = Constants.INSTANCE.NEW()
+ ": ";
final RadioButton newNameRadioButton = new RadioButton( "snapshotNameGroup",
newNameText );
newNameHorizontalPanel.add( newNameRadioButton );
newNameTextBox.setEnabled( false );
newNameRadioButton.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent event) {
newNameTextBox.setEnabled( true );
}
} );
newNameHorizontalPanel.add( newNameTextBox );
options.add( newNameRadioButton );
vert.add( newNameHorizontalPanel );
copy.addAttribute( Constants.INSTANCE.ExistingSnapshots(),
vert );
Button ok = new Button( Constants.INSTANCE.OK() );
copy.addAttribute( "",
ok );
ok.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent event) {
if ( !isOneButtonSelected( options ) ) {
Window.alert( Constants.INSTANCE.YouHaveToEnterOrChoseALabelNameForTheSnapshot() );
return;
}
if ( newNameRadioButton.getValue() ) {
if ( checkUnique( snaps,
newNameTextBox.getText() ) ) {
serv.copyOrRemoveSnapshot( packageName,
snapshotName,
false,