Skip to content

Commit

Permalink
Password change styles. Some cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Apr 26, 2016
1 parent 79bdb07 commit 86f8f0d
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 55 deletions.
@@ -1,5 +1,5 @@
<!--
~ Copyright (c) 2010-2013 Evolveum
~ Copyright (c) 2010-2016 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.evolveum.midpoint.web.component.input;
package com.evolveum.midpoint.gui.api.component.password;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -45,6 +45,7 @@
* @author lazyman
*/
public class PasswordPanel extends InputPanel {
private static final long serialVersionUID = 1L;

private static final String ID_LINK_CONTAINER = "linkContainer";
private static final String ID_PASSWORD_SET = "passwordSet";
Expand Down
Expand Up @@ -17,12 +17,12 @@
package com.evolveum.midpoint.web.component.assignment;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.component.password.PasswordPanel;
import com.evolveum.midpoint.prism.PrismPropertyDefinition;
import com.evolveum.midpoint.prism.xml.XsdTypeMapper;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.util.DOMUtil;
import com.evolveum.midpoint.web.component.input.DatePanel;
import com.evolveum.midpoint.web.component.input.PasswordPanel;
import com.evolveum.midpoint.web.component.input.TextPanel;
import com.evolveum.midpoint.web.component.input.TriStateComboPanel;
import com.evolveum.midpoint.web.component.prism.InputPanel;
Expand Down
Expand Up @@ -20,6 +20,7 @@
import com.evolveum.midpoint.common.refinery.RefinedAssociationDefinition;
import com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition;
import com.evolveum.midpoint.common.refinery.RefinedResourceSchema;
import com.evolveum.midpoint.gui.api.component.password.PasswordPanel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright (c) 2010-2016 Evolveum
*
* 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 com.evolveum.midpoint.web.page.self;

import com.evolveum.midpoint.gui.api.page.PageBase;
Expand All @@ -7,8 +22,9 @@
* @author Viliam Repan (lazyman)
*/
public class PageSelf extends PageBase {
private static final long serialVersionUID = 1L;

public static final String AUTH_SELF_ALL_URI = AuthorizationConstants.AUTZ_UI_SELF_ALL_URL;
public static final String AUTH_SELF_ALL_URI = AuthorizationConstants.AUTZ_UI_SELF_ALL_URL;
public static final String AUTH_SELF_ALL_LABEL = "PageSelf.auth.selfAll.label";
public static final String AUTH_SELF_ALL_DESCRIPTION = "PageSelf.auth.selfAll.description";
}
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2015 Evolveum
~ Copyright (c) 2010-2016 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
<div wicket:id="tabPanel" class="nav-tabs-custom" />

<div class="main-button-bar">
<a class="btn btn-danger" wicket:id="cancel" />
<a class="btn btn-default" wicket:id="cancel" />
<a class="btn btn-primary" wicket:id="save" />
</div>
</form>
Expand Down
@@ -1,3 +1,18 @@
/*
* Copyright (c) 2010-2016 Evolveum
*
* 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 com.evolveum.midpoint.web.page.self;

import com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition;
Expand Down Expand Up @@ -65,7 +80,9 @@
label = "PageSelfCredentials.auth.credentials.label",
description = "PageSelfCredentials.auth.credentials.description")})
public class PageSelfCredentials extends PageSelf {
private static final String ID_MAIN_FORM = "mainForm";
private static final long serialVersionUID = 1L;

private static final String ID_MAIN_FORM = "mainForm";
private static final String ID_TAB_PANEL = "tabPanel";
private static final String ID_SAVE_BUTTON = "save";
private static final String ID_CANCEL_BUTTON = "cancel";
Expand All @@ -87,6 +104,7 @@ public class PageSelfCredentials extends PageSelf {

public PageSelfCredentials() {
model = new LoadableModel<MyPasswordsDto>(false) {
private static final long serialVersionUID = 1L;

@Override
protected MyPasswordsDto load() {
Expand All @@ -102,11 +120,12 @@ protected void createBreadcrumb() {
super.createBreadcrumb();

Breadcrumb bc = getSessionStorage().peekBreadcrumb();
bc.setIcon(new Model("fa fa-shield"));
bc.setIcon(new Model<String>("fa fa-shield"));
}

public PageSelfCredentials(final MyPasswordsDto myPasswordsDto) {
model = new LoadableModel<MyPasswordsDto>(myPasswordsDto, false) {
private static final long serialVersionUID = 1L;

@Override
protected MyPasswordsDto load() {
Expand Down Expand Up @@ -199,17 +218,21 @@ private void initLayout() {

List<ITab> tabs = new ArrayList<>();
tabs.add(new AbstractTab(createStringResource("PageSelfCredentials.tabs.password")) {
private static final long serialVersionUID = 1L;

@Override
public WebMarkupContainer getPanel(String panelId) {
return new ChangePasswordPanel(panelId, model, model.getObject());
}
});

TabbedPanel credentialsTabPanel = new TabbedPanel(ID_TAB_PANEL, tabs) {
TabbedPanel<ITab> credentialsTabPanel = new TabbedPanel<ITab>(ID_TAB_PANEL, tabs) {
private static final long serialVersionUID = 1L;

@Override
protected WebMarkupContainer newLink(String linkId, final int index) {
return new AjaxSubmitLink(linkId) {
private static final long serialVersionUID = 1L;

@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
Expand Down
@@ -1,5 +1,5 @@
<!--
~ Copyright (c) 2010-2013 Evolveum
~ Copyright (c) 2010-2016 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand All @@ -16,31 +16,30 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="row">
<div class="col-md-2">
<div class="form-control-static" wicket:id="oldPasswordLabel"/>
<div class="form-control-static" wicket:id="passwordLabel"/>
<div class="form-control-static" wicket:id="confirmPasswordLabel"/>
</div>
<div class="col-md-3">
<div class="col-md-11">
<input class="form-control input-sm" style="margin-bottom: 5px;" type="password" autocomplete="off"
wicket:id="oldPassword" autofocus/>
</div>
<div wicket:id="passwordPanel"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" wicket:id="oldPasswordLabel"/>
<div class="col-sm-9">
<input class="form-control input-sm" type="password" autocomplete="off" wicket:id="oldPassword" autofocus/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" wicket:id="passwordLabel"/>
<div class="col-sm-10">
<div class="password-panel" wicket:id="passwordPanel"/>
</div>
</div>

<div wicket:id="accountsContainer" class="row">
<div class="col-md-7">
<div class="box box-default collapsed-box">
<div class="col-md-12">
<div class="box box-default collapsed-box password-propagation">
<div class="box-header with-border">
<wicket:message key="ChangePasswordPanel.accountsTable.header"/>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
</div>
</div>
<div class="box-body">
<div class="row">
<div class="row password-propagation-legend">
<div class="col-md-11">
<table>
<tr>
Expand Down
@@ -1,24 +1,26 @@
/*
* Copyright (c) 2010-2016 Evolveum
*
* 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 com.evolveum.midpoint.web.page.self.component;

import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.web.component.data.SelectableDataTable;
import com.evolveum.midpoint.web.component.data.TablePanel;
import com.evolveum.midpoint.web.component.data.column.*;
import com.evolveum.midpoint.web.component.dialog.HelpInfoPanel;
import com.evolveum.midpoint.web.component.input.PasswordPanel;
import com.evolveum.midpoint.web.component.util.ListDataProvider;
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.wizard.resource.component.WizardHelpDialog;
import com.evolveum.midpoint.web.page.admin.home.dto.MyPasswordsDto;
import com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto;
import com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsPropagationUserControlType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordChangeSecurityType;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;
import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxEventBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
Expand All @@ -33,17 +35,32 @@
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;

import java.util.*;
import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.component.password.PasswordPanel;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.web.component.data.SelectableDataTable;
import com.evolveum.midpoint.web.component.data.TablePanel;
import com.evolveum.midpoint.web.component.data.column.CheckBoxColumn;
import com.evolveum.midpoint.web.component.data.column.IconColumn;
import com.evolveum.midpoint.web.component.data.column.ImagePanel;
import com.evolveum.midpoint.web.component.dialog.HelpInfoPanel;
import com.evolveum.midpoint.web.component.util.ListDataProvider;
import com.evolveum.midpoint.web.page.admin.home.dto.MyPasswordsDto;
import com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto;
import com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsPropagationUserControlType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordChangeSecurityType;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;

/**
* Created by Kate on 09.10.2015.
* @author Kate Honchar
*/
public class ChangePasswordPanel extends SimplePanel<MyPasswordsDto> {
private static final String ID_PASSWORD_PANEL = "passwordPanel";
public class ChangePasswordPanel extends BasePanel<MyPasswordsDto> {
private static final long serialVersionUID = 1L;

private static final String ID_PASSWORD_PANEL = "passwordPanel";
private static final String ID_OLD_PASSWORD_FIELD = "oldPassword";
private static final String ID_PASSWORD_LABEL = "passwordLabel";
private static final String ID_OLD_PASSWORD_LABEL = "oldPasswordLabel";
private static final String ID_CONFIRM_PASSWORD_LABEL = "confirmPasswordLabel";
public static final String ID_ACCOUNTS_TABLE = "accounts";
public static final String ID_ACCOUNTS_CONTAINER = "accountsContainer";
private static final String ID_BUTTON_HELP = "help";
Expand All @@ -58,27 +75,25 @@ public class ChangePasswordPanel extends SimplePanel<MyPasswordsDto> {

public ChangePasswordPanel(String id) {
super(id);
initLayout();
}

public ChangePasswordPanel(String id, LoadableModel<MyPasswordsDto> model, MyPasswordsDto myPasswordsDto) {
super(id, model);
initLayout();
}

@Override
protected void initLayout() {
model = (LoadableModel) getModel();
private void initLayout() {
model = (LoadableModel<MyPasswordsDto>) getModel();

Label oldPasswordLabel = new Label(ID_OLD_PASSWORD_LABEL, createStringResource("PageSelfCredentials.oldPasswordLabel"));
add(oldPasswordLabel);

Label passwordLabel = new Label(ID_PASSWORD_LABEL, createStringResource("PageSelfCredentials.passwordLabel1"));
add(passwordLabel);

Label confirmPasswordLabel = new Label(ID_CONFIRM_PASSWORD_LABEL, createStringResource("PageSelfCredentials.passwordLabel2"));
add(confirmPasswordLabel);

PasswordTextField oldPasswordField =
new PasswordTextField(ID_OLD_PASSWORD_FIELD, new PropertyModel(model, MyPasswordsDto.F_OLD_PASSWORD));
new PasswordTextField(ID_OLD_PASSWORD_FIELD, new PropertyModel<String>(model, MyPasswordsDto.F_OLD_PASSWORD));
oldPasswordField.setRequired(false);
oldPasswordField.setResetPassword(false);
add(oldPasswordField);
Expand Down Expand Up @@ -108,6 +123,8 @@ protected void initLayout() {
accountContainer.add(accounts);

AjaxLink help = new AjaxLink(ID_BUTTON_HELP) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
showHelpPerformed(target);
Expand All @@ -122,9 +139,13 @@ private List<IColumn<PasswordAccountDto, String>> initColumns() {
List<IColumn<PasswordAccountDto, String>> columns = new ArrayList<IColumn<PasswordAccountDto, String>>();

IColumn column = new IconColumn<PasswordAccountDto>(new Model<String>()) {
private static final long serialVersionUID = 1L;

@Override
protected IModel<String> createIconModel(final IModel<PasswordAccountDto> rowModel) {
return new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;

@Override
public String getObject() {
PasswordAccountDto item = rowModel.getObject();
Expand All @@ -151,6 +172,8 @@ public void populateItem(Item<ICellPopulator<PasswordAccountDto>> item, String c
final PasswordAccountDto passwordAccountDto = rowModel.getObject();

imagePanel.add(new AjaxEventBehavior("click") {
private static final long serialVersionUID = 1L;

protected void onEvent(final AjaxRequestTarget target) {
if (!passwordAccountDto.isMidpoint()) {
if (passwordAccountDto.getCssClass().equals(PROPAGATED_ACCOUNT_ICON_CSS)) {
Expand Down Expand Up @@ -185,11 +208,13 @@ protected void onEvent(final AjaxRequestTarget target) {
columns.add(column);

columns.add(new AbstractColumn<PasswordAccountDto, String>(createStringResource("ChangePasswordPanel.name")) {
private static final long serialVersionUID = 1L;

@Override
public void populateItem(Item<ICellPopulator<PasswordAccountDto>> item, String componentId,
final IModel<PasswordAccountDto> rowModel) {
item.add(new Label(componentId, new AbstractReadOnlyModel<Object>() {
private static final long serialVersionUID = 1L;

@Override
public Object getObject() {
Expand Down

0 comments on commit 86f8f0d

Please sign in to comment.