CCM NG/ccm-core: Some more work for the Vaadin Prototype
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4715 8810af33-2d31-482b-a856-94f89814c4df
Former-commit-id: 31ffac6230
pull/2/head
parent
05b1eaebb6
commit
3e729960a9
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (C) 2017 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.admin.ui;
|
||||
|
||||
import com.arsdigita.ui.admin.AdminUiConstants;
|
||||
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.Window;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class ConfirmDiscardDialog extends Window {
|
||||
|
||||
private static final long serialVersionUID = 7270363517221672796L;
|
||||
|
||||
public ConfirmDiscardDialog(final Window window,
|
||||
final String message) {
|
||||
|
||||
if (window == this) {
|
||||
throw new IllegalArgumentException("ConfirmDiscardDialog can't be "
|
||||
+ "used with itself.");
|
||||
}
|
||||
|
||||
final Label label = new Label(message);
|
||||
|
||||
final ResourceBundle bundle = ResourceBundle
|
||||
.getBundle(AdminUiConstants.ADMIN_BUNDLE,
|
||||
UI.getCurrent().getLocale());
|
||||
|
||||
final Button yesButton = new Button(bundle.getString("ui.admin.yes"));
|
||||
yesButton.addClickListener(event -> {
|
||||
close();
|
||||
UI.getCurrent().removeWindow(window);
|
||||
});
|
||||
|
||||
final Button noButton = new Button(bundle.getString("ui.admin.no"));
|
||||
noButton.addClickListener(event -> close());
|
||||
|
||||
final HorizontalLayout buttonsLayout = new HorizontalLayout(yesButton,
|
||||
noButton);
|
||||
final VerticalLayout layout = new VerticalLayout(label,
|
||||
buttonsLayout);
|
||||
|
||||
setContent(layout);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ import com.vaadin.ui.TextField;
|
|||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.Window;
|
||||
import org.libreccm.admin.ui.ConfirmDiscardDialog;
|
||||
import org.libreccm.core.UnexpectedErrorException;
|
||||
import org.libreccm.security.User;
|
||||
import org.libreccm.security.UserManager;
|
||||
|
|
@ -75,6 +76,8 @@ public class UserEditor extends Window {
|
|||
public UserEditor(final UserRepository userRepo,
|
||||
final UserManager userManager) {
|
||||
|
||||
super("Create new user");
|
||||
|
||||
user = null;
|
||||
this.userRepo = userRepo;
|
||||
this.userManager = userManager;
|
||||
|
|
@ -86,6 +89,8 @@ public class UserEditor extends Window {
|
|||
final UserRepository userRepo,
|
||||
final UserManager userManager) {
|
||||
|
||||
super(String.format("Edit user %s", user.getName()));
|
||||
|
||||
this.user = user;
|
||||
this.userRepo = userRepo;
|
||||
this.userManager = userManager;
|
||||
|
|
@ -203,6 +208,7 @@ public class UserEditor extends Window {
|
|||
}
|
||||
|
||||
final Button cancel = new Button(bundle.getString("ui.admin.cancel"));
|
||||
cancel.addClickListener(event -> close());
|
||||
|
||||
final HorizontalLayout buttons = new HorizontalLayout(submit, cancel);
|
||||
|
||||
|
|
@ -230,4 +236,14 @@ public class UserEditor extends Window {
|
|||
setContent(panel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
final ConfirmDiscardDialog dialog = new ConfirmDiscardDialog(
|
||||
this, "Are you sure to discard the changes made this user?");
|
||||
dialog.setModal(true);
|
||||
UI.getCurrent().addWindow(dialog);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -572,3 +572,5 @@ ui.admin.users.table.filter.screenname.description=Filter users by user name
|
|||
ui.admin.user_set_password_confirm.label=Confirm password
|
||||
ui.admin.user_edit.password_options.generate_and_send=Generate and send to user
|
||||
ui.admin.user_edit.password_options.set=Set password
|
||||
ui.admin.yes=Yes
|
||||
ui.admin.no=No
|
||||
|
|
|
|||
|
|
@ -576,3 +576,5 @@ ui.admin.users.table.filter.screenname.description=Filter users by user name
|
|||
ui.admin.user_set_password_confirm.label=Passwort best\u00e4tigen
|
||||
ui.admin.user_edit.password_options.generate_and_send=Generieren und an Benutzer senden
|
||||
ui.admin.user_edit.password_options.set=Passwort setzen
|
||||
ui.admin.yes=Ja
|
||||
ui.admin.no=Nein
|
||||
|
|
|
|||
|
|
@ -569,3 +569,5 @@ ui.admin.users.table.filter.screenname.description=Filter users by user name
|
|||
ui.admin.user_set_password_confirm.label=Confirm password
|
||||
ui.admin.user_edit.password_options.generate_and_send=Generate and send to user
|
||||
ui.admin.user_edit.password_options.set=Set password
|
||||
ui.admin.yes=Yes
|
||||
ui.admin.no=No
|
||||
|
|
|
|||
|
|
@ -560,3 +560,5 @@ ui.admin.users.table.filter.screenname.description=Filter users by user name
|
|||
ui.admin.user_set_password_confirm.label=Confirm password
|
||||
ui.admin.user_edit.password_options.generate_and_send=Generate and send to user
|
||||
ui.admin.user_edit.password_options.set=Set password
|
||||
ui.admin.yes=Yes
|
||||
ui.admin.no=No
|
||||
|
|
|
|||
Loading…
Reference in New Issue