Skip to content

Commit

Permalink
members tab - unified panel for role, org, service members
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Aug 20, 2018
1 parent 3a73155 commit 9ef7fbb
Show file tree
Hide file tree
Showing 12 changed files with 642 additions and 551 deletions.
Expand Up @@ -163,4 +163,9 @@ public class GuiStyleConstants {

public static final String CLASS_SYSTEM_CONFIGURATION_ICON = "fa fa-cog";
public static final String CLASS_SYSTEM_CONFIGURATION_ICON_COLORED = CLASS_SYSTEM_CONFIGURATION_ICON + " object-shadow-color";

public static final String CLASS_ASSIGN = "fa fa-link";
public static final String CLASS_UNASSIGN = "fa fa-unlink";
public static final String CLASS_RECONCILE = "fa fa-refresh";
public static final String CLASS_CREATE_FOCUS = "fa fa-user-plus";
}
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<!--
~ Copyright (c) 2010-2017 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.
-->

<wicket:panel xmlns:wicket="http://wicket.apache.org">
<div>

<div class="form-group">
<div class="col-md-12" wicket:id="type"/>
</div>
<div class="form-group col-md-12">
<label class="col-md-4"><wicket:message key="chooseFocusTypeAndRelationDialogPanel.relation"/></label>
<div class="col-md-8" wicket:id="relation" />
</div>

<p align="center">
<a class="btn btn-primary btn-sm" wicket:id="ok" />
</p>
</div>
</wicket:panel>
@@ -0,0 +1,128 @@
package com.evolveum.midpoint.web.component.dialog;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.xml.namespace.QName;

import com.evolveum.midpoint.web.component.input.ListMultipleChoicePanel;
import com.evolveum.midpoint.web.component.input.QNameObjectTypeChoiceRenderer;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.model.util.ListModel;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.form.CheckFormGroup;
import com.evolveum.midpoint.web.component.form.DropDownFormGroup;
import com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

public class ChooseFocusTypeAndRelationDialogPanel extends BasePanel implements Popupable{

private static final String ID_OBJECT_TYPE = "type";
private static final String ID_RELATION = "relation";
private static final String ID_BUTTON_OK = "ok";

public ChooseFocusTypeAndRelationDialogPanel(String id) {
super(id);

}

@Override
protected void onInitialize() {
super.onInitialize();
initLayout();
}

private void initLayout(){

DropDownFormGroup<QName> type = new DropDownFormGroup<QName>(ID_OBJECT_TYPE, Model.of(UserType.COMPLEX_TYPE), new ListModel<>(WebComponentUtil.createFocusTypeList()),
new QNameObjectTypeChoiceRenderer(), createStringResource("chooseFocusTypeAndRelationDialogPanel.type"),
"chooseFocusTypeAndRelationDialogPanel.tooltip.type", true, "col-md-4", "col-md-8", false);
type.getInput().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
type.setOutputMarkupId(true);
add(type);

IModel<Map<String, String>> options = new Model(null);
Map<String, String> optionsMap = new HashMap<>();
// optionsMap.put("nonSelectedText", createStringResource("LoggingConfigPanel.appenders.Inherit").getString());
options.setObject(optionsMap);
ListMultipleChoicePanel<QName> relation = new ListMultipleChoicePanel<QName>(ID_RELATION, new ListModel<>(),
new ListModel<QName>(getSupportedRelations()), new QNameObjectTypeChoiceRenderer(), options);
relation.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
relation.setOutputMarkupId(true);
add(relation);

AjaxButton confirmButton = new AjaxButton(ID_BUTTON_OK, createStringResource("Button.ok")) {

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
DropDownFormGroup<QName> type = (DropDownFormGroup<QName>) getParent().get(ID_OBJECT_TYPE);
QName typeChosen = type.getModelObject();

ListMultipleChoicePanel<QName> relation = (ListMultipleChoicePanel<QName>) getParent().get(ID_RELATION);
Collection<QName> relationChosen = relation.getModelObject();
ChooseFocusTypeAndRelationDialogPanel.this.okPerformed(typeChosen, relationChosen, target);
getPageBase().hideMainPopup(target);

}
};

add(confirmButton);



}

protected void okPerformed(QName type, Collection<QName> relation, AjaxRequestTarget target) {
// TODO Auto-generated method stub

}

protected List<QName> getSupportedRelations() {
return WebComponentUtil.getAllRelations(getPageBase());
}

@Override
public int getWidth() {
return 400;
}

@Override
public int getHeight() {
return 300;
}

@Override
public String getWidthUnit(){
return "px";
}

@Override
public String getHeightUnit(){
return "px";
}

@Override
public StringResourceModel getTitle() {
return new StringResourceModel("ChooseFocusTypeDialogPanel.chooseType");
}

@Override
public Component getComponent() {
return this;
}


}
Expand Up @@ -32,7 +32,7 @@
/**
* @author lazyman
*/
@Deprecated
//@Deprecated
public class CheckFormGroup extends BasePanel<Boolean> {

private static final String ID_CHECK = "check";
Expand Down
Expand Up @@ -75,6 +75,8 @@ private void initLayout(IModel<List<T>> choices, IChoiceRenderer<T> renderer, IM
Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {

private static final long serialVersionUID = 1L;

@Override
public String getObject() {
return getString(tooltipKey);
Expand All @@ -83,6 +85,8 @@ public String getObject() {
tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
tooltipLabel.add(new VisibleEnableBehaviour() {

private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
return tooltipKey != null;
Expand All @@ -94,6 +98,9 @@ public boolean isVisible() {

WebMarkupContainer requiredContainer = new WebMarkupContainer(ID_REQUIRED);
requiredContainer.add(new VisibleEnableBehaviour() {

private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
return required;
Expand All @@ -107,7 +114,7 @@ public boolean isVisible() {
}
add(selectWrapper);

DropDownChoice select = createDropDown(ID_SELECT, choices, renderer, required);
DropDownChoice<T> select = createDropDown(ID_SELECT, choices, renderer, required);
select.setLabel(label);
selectWrapper.add(select);

Expand All @@ -132,9 +139,11 @@ public Component getAdditionalInfoComponent() {

protected DropDownChoice<T> createDropDown(String id, IModel<List<T>> choices, IChoiceRenderer<T> renderer,
boolean required) {
DropDownChoice choice = new DropDownChoice<T>(id, getModel(), choices, renderer){
DropDownChoice<T> choice = new DropDownChoice<T>(id, getModel(), choices, renderer){

@Override
private static final long serialVersionUID = 1L;

@Override
protected String getNullValidDisplayValue() {
return getString("DropDownChoicePanel.empty");
}
Expand Down
Expand Up @@ -23,6 +23,7 @@
import org.apache.wicket.markup.html.form.ListMultipleChoice;
import org.apache.wicket.model.IModel;

import java.util.Collection;
import java.util.List;
import java.util.Map;

Expand All @@ -31,21 +32,29 @@
*/
public class ListMultipleChoicePanel<T> extends InputPanel {

public ListMultipleChoicePanel(String id, IModel<List<T>> model, IModel<List<T>> choices) {
private static final long serialVersionUID = 1L;

public ListMultipleChoicePanel(String id, IModel<List<T>> model, IModel<List<T>> choices) {
super(id);
ListMultipleChoice<T> multiple = new ListMultipleChoice<>("input", model, choices);
add(multiple);
}

public ListMultipleChoicePanel(String id, IModel<List<T>> model, IModel<List<T>> choices, IChoiceRenderer renderer,
public ListMultipleChoicePanel(String id, IModel<List<T>> model, IModel<List<T>> choices, IChoiceRenderer<T> renderer,
IModel<Map<String, String>> options){
super(id);
DropDownMultiChoice multiChoice = new DropDownMultiChoice<T>("input", model, choices, renderer, options);
DropDownMultiChoice<T> multiChoice = new DropDownMultiChoice<T>("input", model, choices, renderer, options);
add(multiChoice);
}

@Override
public FormComponent getBaseFormComponent() {
return (FormComponent) get("input");
public FormComponent<T> getBaseFormComponent() {
return (FormComponent<T>) get("input");
}

public Collection<T> getModelObject() {
DropDownMultiChoice<T> input = (DropDownMultiChoice) getBaseFormComponent();
return input.getModelObject();
}

}

0 comments on commit 9ef7fbb

Please sign in to comment.