package lemming.sense;

import lemming.ui.panel.ModalMessagePanel;
import org.apache.wicket.Component;
import org.apache.wicket.Page;
import org.apache.wicket.authorization.Action;
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeAction;
import org.apache.wicket.model.StringResourceModel;

/**
 * A panel containing a modal window dialog asking if a sense shall be deleted.
 */
@AuthorizeAction(action = Action.RENDER, roles = { "SIGNED_IN" })
public class SenseDeleteConfirmPanel extends ModalMessagePanel {
    /**
     * Determines if a deserialized file is compatible with this class.
     */
    private static final long serialVersionUID = 1L;

    /**
     * Creates a panel.
     * 
     * @param id
     *            ID of the panel
     * @param responsePage
     *            page loaded on confirmation
     */
    public SenseDeleteConfirmPanel(String id, Page responsePage) {
        super(id, DialogType.YES_NO, responsePage);
    }

    /**
     * Creates a panel.
     * 
     * @param id
     *            ID of the panel
     * @param responsePageClass
     *            class of page loaded on confirmation
     */
    public SenseDeleteConfirmPanel(String id, Class<? extends Page> responsePageClass) {
        super(id, DialogType.YES_NO, responsePageClass);
    }

    /**
     * Creates a panel.
     * 
     * @param id
     *            ID of the panel
     * @param dataTable
     *            data table that is refreshed
     */
    public SenseDeleteConfirmPanel(String id, SenseDataTable dataTable) {
        super(id, DialogType.YES_NO, dataTable);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getTitleString() {
        return getString("SenseDeleteConfirmPanel.title");
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public StringResourceModel getMessageModel() {
        Sense sense = (Sense) getDefaultModelObject();

        return new StringResourceModel("SenseDeleteConfirmPanel.message",
                (Component) this, getDefaultModel()).setParameters("<b>" + sense.getMeaning() + "</b>");
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getConfirmationString() {
        return getString("SenseDeleteConfirmPanel.confirm");
    }

    /**
     * Does nothing.
     */
    @Override
    public void onCancel() {
    }

    /**
     * Removes the sense of the default model.
     */
    @Override
    public void onConfirm() {
        new SenseDao().remove((Sense) getDefaultModelObject());
    }
}

@@ -100,39 +100,8 @@
 nt;%0A
-import org.apache.wicket.Page;%0A
 impo
@@ -707,34 +707,16 @@
 param id
-%0A     *           
  ID of t
@@ -728,81 +728,8 @@
 nel%0A
-     * @param responsePage%0A     *            page loaded on confirmation%0A
     
@@ -780,27 +780,8 @@
 g id
-, Page responsePage
 ) %7B%0A
@@ -815,30 +815,16 @@
 e.YES_NO
-, responsePage
 );%0A    %7D
@@ -885,365 +885,8 @@
 m id
-%0A     *            ID of the panel%0A     * @param responsePageClass%0A     *            class of page loaded on confirmation%0A     */%0A    public SenseDeleteConfirmPanel(String id, Class%3C? extends Page%3E responsePageClass) %7B%0A        super(id, DialogType.YES_NO, responsePageClass);%0A    %7D%0A%0A    /**%0A     * Creates a panel.%0A     * %0A     * @param id%0A     *           
  ID 
@@ -925,26 +925,8 @@
 able
-%0A     *           
  dat

Remove unused constructors from class SenseDeleteConfirmPanel.