logout button for password-only users

This commit is contained in:
Peter Hormanns 2013-07-15 12:30:08 +02:00
parent 2cb025e2a3
commit 5637091ea2
5 changed files with 30 additions and 17 deletions

View File

@ -116,24 +116,29 @@ public abstract class AbstractModule implements Module, Serializable {
toolbar.addComponent(space); toolbar.addComponent(space);
toolbar.setExpandRatio(space, 1.0f); toolbar.setExpandRatio(space, 1.0f);
createRunAsSelect(toolbar); createRunAsSelect(toolbar);
Button btLogout = new Button(localeConfig.getText("logout")); createLogoutButton(toolbar, localeConfig.getText("logout"));
btLogout.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
ExternalResource logoutLink = new ExternalResource("logout");
application.getMainWindow().open(logoutLink);
}
});
toolbar.addComponent(btLogout);
ThemeResource icon = new ThemeResource("../runo/icons/16/cancel.png");
btLogout.setIcon(icon);
layout.addComponent(toolbar); layout.addComponent(toolbar);
} }
layout.addComponent(component); layout.addComponent(component);
layout.setExpandRatio(component, 1.0f); layout.setExpandRatio(component, 1.0f);
} }
protected void createLogoutButton(HorizontalLayout toolbar,
final String buttonText) {
Button btLogout = new Button(buttonText);
btLogout.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
ExternalResource logoutLink = new ExternalResource("logout");
application.getMainWindow().open(logoutLink);
}
});
toolbar.addComponent(btLogout);
ThemeResource icon = new ThemeResource("../runo/icons/16/cancel.png");
btLogout.setIcon(icon);
}
private void createRunAsSelect(HorizontalLayout toolbar) throws UnsupportedOperationException, HsarwebException { private void createRunAsSelect(HorizontalLayout toolbar) throws UnsupportedOperationException, HsarwebException {
selRunAs = new Select(); selRunAs = new Select();
selRunAs.setWidth(100.0f, Sizeable.UNITS_PIXELS); selRunAs.setWidth(100.0f, Sizeable.UNITS_PIXELS);

View File

@ -91,6 +91,7 @@ public class HomeModule extends AbstractModule implements ComponentFactory, Upda
public Object initComponent() throws HsarwebException { public Object initComponent() throws HsarwebException {
final Module thisModule = this; final Module thisModule = this;
VerticalLayout layout = new VerticalLayout(); VerticalLayout layout = new VerticalLayout();
HorizontalLayout toolbar = new HorizontalLayout();
Button button = new Button(moduleConfig.getLabel("change_password")); Button button = new Button(moduleConfig.getLabel("change_password"));
ThemeResource icon = new ThemeResource(moduleConfig.getLabel("change_password_icon")); ThemeResource icon = new ThemeResource(moduleConfig.getLabel("change_password_icon"));
button.setIcon(icon); button.setIcon(icon);
@ -166,7 +167,9 @@ public class HomeModule extends AbstractModule implements ComponentFactory, Upda
application.getMainWindow().addWindow(childWindow); application.getMainWindow().addWindow(childWindow);
} }
}); });
layout.addComponent(button); toolbar.addComponent(button);
createLogoutButton(toolbar, moduleConfig.getLabel("logout"));
layout.addComponent(toolbar);
return layout; return layout;
} }

View File

@ -33,8 +33,11 @@ public class MainApplication extends Application implements
HttpServletRequestListener, TabSheet.SelectedTabChangeListener { HttpServletRequestListener, TabSheet.SelectedTabChangeListener {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final String LOGIN_URL = "https://login.hostsharing.net:443/cas/v1/tickets"; private static final String LOGIN_URL = "https://login.hostsharing.net:443/cas/v1/tickets";
private static boolean isTestEnvironment = false; private static boolean isTestEnvironment = false;
private static final String TEST_LOGIN = "aaa00";
static { static {
Config config = Config.getInstance(); Config config = Config.getInstance();
@ -167,12 +170,12 @@ public class MainApplication extends Application implements
@Override @Override
public String getName() { public String getName() {
return "ad"; return TEST_LOGIN;
} }
@Override @Override
public String getProxyTicketFor(String arg0) { public String getProxyTicketFor(String arg0) {
return "user:ad"; return "user:" + TEST_LOGIN;
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")

View File

@ -15,4 +15,5 @@ hello=Hello world!
change_password=change password change_password=change password
update=change password update=change password
save=save password save=save password
abort=abort abort=abort
logout=logout

View File

@ -14,4 +14,5 @@ change_password_icon=../runo/icons/16/lock.png
change_password=Passwort ändern change_password=Passwort ändern
update=Passwort ändern update=Passwort ändern
save=Passwort speichern save=Passwort speichern
abort=abbrechen abort=abbrechen
logout=abmelden