/*
* Copyright 2013 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.artificer.ui.client.local.pages.details;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.InlineLabel;
import org.jboss.errai.ui.shared.api.annotations.DataField;
import org.jboss.errai.ui.shared.api.annotations.EventHandler;
import org.jboss.errai.ui.shared.api.annotations.Templated;
import org.overlord.commons.gwt.client.local.widgets.ModalDialog;
import javax.annotation.PostConstruct;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;
/**
* Dialog that allows the user to delete *something*.
*
* @author eric.wittmann@redhat.com
*/
@Templated("/org/artificer/ui/client/local/site/dialogs/delete-dialog.html#delete-dialog")
@Dependent
public class DeleteDialog extends ModalDialog implements HasClickHandlers {
@Inject @DataField("label")
protected InlineLabel label;
@Inject @DataField("delete-artifact-submit-button")
protected Button submitButton;
/**
* Called when the dialog is constructed by Errai.
*/
@PostConstruct
protected void onPostConstruct() {
}
public void setLabel(String label) {
this.label.setText(label);
}
/**
* Called when the user clicks the submit button.
* @param event
*/
@EventHandler("delete-artifact-submit-button")
protected void onSubmit(ClickEvent event) {
hide();
}
/**
* @see com.google.gwt.event.dom.client.HasClickHandlers#addClickHandler(com.google.gwt.event.dom.client.ClickHandler)
*/
@Override
public HandlerRegistration addClickHandler(ClickHandler handler) {
return submitButton.addClickHandler(handler);
}
}