Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Apr 14, 2016
2 parents 5aa0c0d + 1040c98 commit aa73ea8
Show file tree
Hide file tree
Showing 14 changed files with 347 additions and 198 deletions.
Expand Up @@ -42,9 +42,18 @@ public class GuiStyleConstants {
public static final String CLASS_OBJECT_RESOURCE_BOX_CSS_CLASSES = "box object-resource-box";

public static final String CLASS_OBJECT_TASK_ICON = "fa fa-tasks";
public static final String CLASS_OBJECT_TASK_ICON_COLORED = CLASS_OBJECT_TASK_ICON + " object-task-color";;
public static final String CLASS_OBJECT_TASK_ICON_COLORED = CLASS_OBJECT_TASK_ICON + " object-task-color";
public static final String CLASS_OBJECT_TASK_BOX_CSS_CLASSES = "box object-task-box";


public static final String CLASS_OBJECT_WORK_ITEM_ICON = "fa fa-inbox";
public static final String CLASS_OBJECT_WORK_ITEM_ICON_COLORED = CLASS_OBJECT_WORK_ITEM_ICON + " object-task-color"; // TODO

public static final String CLASS_OBJECT_CERT_DEF_ICON = "fa fa-certificate";
public static final String CLASS_OBJECT_CERT_DEF_ICON_COLORED = CLASS_OBJECT_CERT_DEF_ICON + " object-task-color"; // TODO

public static final String CLASS_OBJECT_CERT_CAMPAIGN_ICON = "fa fa-gavel";
public static final String CLASS_OBJECT_CERT_CAMPAIGN_ICON_COLORED = CLASS_OBJECT_CERT_CAMPAIGN_ICON + " object-task-color"; // TODO

public static final String CLASS_ICON_STYLE_NORMAL = "icon-style-normal";
public static final String CLASS_ICON_STYLE_DISABLED = "icon-style-disabled";
public static final String CLASS_ICON_STYLE_ARCHIVED = "icon-style-archived";
Expand Down
Expand Up @@ -977,7 +977,7 @@ protected List<SideBarMenuItem> createMenuItems() {
}

private MainMenuItem createWorkItemsItems() {
MainMenuItem item = new MainMenuItem("fa fa-inbox", createStringResource("PageAdmin.menu.top.workItems"), null);
MainMenuItem item = new MainMenuItem(GuiStyleConstants.CLASS_OBJECT_WORK_ITEM_ICON_COLORED, createStringResource("PageAdmin.menu.top.workItems"), null);

List<MenuItem> submenu = item.getItems();

Expand Down
Expand Up @@ -5,6 +5,7 @@
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.model.PrismPropertyRealValueFromContainerableModel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.markup.html.WebMarkupContainer;
Expand Down Expand Up @@ -157,7 +158,9 @@ protected QName getIdentifierPropertyName() {
return FocusType.F_NAME;
}

protected abstract QName getDisplayNamePropertyName();
protected QName getDisplayNamePropertyName() {
return ObjectType.F_NAME;
}

protected QName getTitlePropertyName() {
return null;
Expand Down
@@ -0,0 +1,56 @@
/*
* 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.admin.certification;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.web.component.ObjectSummaryPanel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationDefinitionType;
import org.apache.wicket.model.IModel;

import javax.xml.namespace.QName;

/**
* @author mederly
*/
public class CertDefinitionSummaryPanel extends ObjectSummaryPanel<AccessCertificationDefinitionType> {

public CertDefinitionSummaryPanel(String id,
IModel<PrismObject<AccessCertificationDefinitionType>> model) {
super(id, model);
}

@Override
protected String getIconCssClass() {
return GuiStyleConstants.CLASS_OBJECT_CERT_DEF_ICON;
}

@Override
protected String getIconBoxAdditionalCssClass() { // TODO
return "summary-panel-task"; // TODO
}

@Override
protected String getBoxAdditionalCssClass() { // TODO
return "summary-panel-task"; // TODO
}

@Override
protected boolean isIdentifierVisible() {
return false;
}
}
@@ -0,0 +1,101 @@
<!--
~ 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.
-->

<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="box box-success">
<div class="box-body no-padding">
<table class="table table-striped">
<tr>
<td><wicket:message key="PageCertDefinition.name" class="col-md-4"/></td>
<td>
<div class="col-md-6">
<input type="text" class="form-control input-sm" wicket:id="name"/>
</div>
</td>
</tr>
<tr>
<td><wicket:message key="PageCertDefinition.description" class="col-md-4"/></td>
<td>
<div class="col-md-6">
<textarea type="text" class="form-control input-sm" wicket:id="description"/>
</div>
</td>
</tr>
<tr>
<td><wicket:message key="PageCertDefinition.owner" class="col-md-4"/></td>
<td>
<div class="col-md-6">
<div wicket:id="ownerRefChooser" >
</div>
</div>
</td>
</tr>
<tr>
<td><wicket:message key="PageCertDefinition.numberOfStages" class="col-md-4"/></td>
<td><div wicket:id="numberOfStages" class="col-md-6"/></td>
</tr>
<tr>
<td><wicket:message key="PageCertDefinition.outcomeStrategy"/></td>
<td>
<div class="col-xs-8">
<div class="row">
<div class="col-xs-9">
<select class="form-control input-sm" wicket:id="outcomeStrategy"/>
<p>(<wicket:message key="PageCertDefinition.stopReviewOn"/>
<span wicket:id="stopReviewOn"></span>)</p>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td><wicket:message key="StageDefinitionPanel.remediation"/></td>
<td>
<div class="col-xs-8">
<div class="row">
<div class="col-xs-9">
<select class="form-control input-sm" wicket:id="remediation"/>
</div>
</div>
</div>
</td>
</tr>
<!-- TODO visually separate definition and current status -->
<!-- TODO do this in some "compressed" form to save space -->
<!-- disabled for now
<tr>
<td><wicket:message key="PageCertDefinition.campaignsInReviewStage" class="col-md-4"/></td>
<td><div wicket:id="campaignsInReviewStage" class="col-md-6"/></td>
</tr>
<tr>
<td><wicket:message key="PageCertDefinition.campaignsTotal" class="col-md-4"/></td>
<td><div wicket:id="campaignsTotal" class="col-md-6"/></td>
</tr> -->
<tr>
<td><wicket:message key="PageCertDefinition.campaignLastStarted" class="col-md-4"/></td>
<td><div wicket:id="campaignLastStarted" class="col-md-6"/></td>
</tr>
<tr>
<td><wicket:message key="PageCertDefinition.campaignLastClosed" class="col-md-4"/></td>
<td><div wicket:id="campaignLastClosed" class="col-md-6"/></td>
</tr>
</table>
</div>
</div>
</wicket:panel>
</html>
@@ -0,0 +1,151 @@
/*
* 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.admin.certification;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.admin.certification.dto.CertDefinitionDto;
import com.evolveum.midpoint.web.page.admin.configuration.component.ChooseTypePanel;
import com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseOutcomeStrategyType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationRemediationStyleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationResponseType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.EnumChoiceRenderer;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;

import javax.xml.namespace.QName;
import java.util.List;

/**
* @author mederly
*/

public class DefinitionBasicPanel extends BasePanel<CertDefinitionDto> {

private static final String ID_NAME = "name";
private static final String ID_DESCRIPTION = "description";
private static final String ID_OWNER = "owner";
private static final String ID_NUMBER_OF_STAGES = "numberOfStages";
private static final String ID_REVIEW_STAGE_CAMPAIGNS = "campaignsInReviewStage";
private static final String ID_CAMPAIGNS_TOTAL = "campaignsTotal";
private static final String ID_LAST_STARTED = "campaignLastStarted";
private static final String ID_LAST_CLOSED = "campaignLastClosed";
// private static final String ID_OWNER_VALUE_CONTAINER = "ownerValueContainer";
// private static final String ID_OWNER_INPUT = "ownerInput";
private static final String ID_OWNER_REF_CHOOSER = "ownerRefChooser";
private static final String ID_REMEDIATION = "remediation";
private static final String ID_OUTCOME_STRATEGY = "outcomeStrategy";
private static final String ID_STOP_REVIEW_ON = "stopReviewOn";


public DefinitionBasicPanel(String id, IModel<CertDefinitionDto> model) {
super(id, model);
initBasicInfoLayout();
}

private void initBasicInfoLayout() {

final TextField nameField = new TextField(ID_NAME, new PropertyModel<>(getModel(), CertDefinitionDto.F_NAME));
nameField.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return true;
}
});
add(nameField);

final TextArea descriptionField = new TextArea(ID_DESCRIPTION, new PropertyModel<>(getModel(), CertDefinitionDto.F_DESCRIPTION));
descriptionField.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return true;
}
});
add(descriptionField);

final WebMarkupContainer ownerRefChooser = createOwnerRefChooser(ID_OWNER_REF_CHOOSER);
ownerRefChooser.setOutputMarkupId(true);
add(ownerRefChooser);

add(new Label(ID_NUMBER_OF_STAGES, new PropertyModel<>(getModel(), CertDefinitionDto.F_NUMBER_OF_STAGES)));

DropDownChoice remediation = new DropDownChoice<>(ID_REMEDIATION, new Model<AccessCertificationRemediationStyleType>() {

@Override
public AccessCertificationRemediationStyleType getObject() {
return getModel().getObject().getRemediationStyle();
}

@Override
public void setObject(AccessCertificationRemediationStyleType object) {
getModel().getObject().setRemediationStyle(object);
}
}, WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationRemediationStyleType.class),
new EnumChoiceRenderer<AccessCertificationRemediationStyleType>(this));
add(remediation);

DropDownChoice outcomeStrategy =
new DropDownChoice<>(ID_OUTCOME_STRATEGY,
new PropertyModel<AccessCertificationCaseOutcomeStrategyType>(getModel(), CertDefinitionDto.F_OUTCOME_STRATEGY),
WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationCaseOutcomeStrategyType.class),
new EnumChoiceRenderer<AccessCertificationCaseOutcomeStrategyType>(this));
add(outcomeStrategy);

Label stopReviewOn = new Label(ID_STOP_REVIEW_ON, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
List<AccessCertificationResponseType> stopOn = getModel().getObject().getStopReviewOn();
return CertMiscUtil.getStopReviewOnText(stopOn, getPageBase());
}
});
add(stopReviewOn);

// add(new Label(ID_REVIEW_STAGE_CAMPAIGNS, new PropertyModel<>(getModel(), CertDefinitionDto.F_NUMBER_OF_STAGES)));
// add(new Label(ID_CAMPAIGNS_TOTAL, new PropertyModel<>(getModel(), CertDefinitionDto.F_NUMBER_OF_STAGES)));
add(new Label(ID_LAST_STARTED, new PropertyModel<>(getModel(), CertDefinitionDto.F_LAST_STARTED)));
add(new Label(ID_LAST_CLOSED, new PropertyModel<>(getModel(), CertDefinitionDto.F_LAST_CLOSED)));
}

private WebMarkupContainer createOwnerRefChooser(String id) {
ChooseTypePanel tenantRef = new ChooseTypePanel(id,
new PropertyModel<ObjectViewDto>(getModel(), CertDefinitionDto.F_OWNER)) {

@Override
protected boolean isSearchEnabled() {
return true;
}

@Override
protected QName getSearchProperty() {
return UserType.F_NAME;
}
};

return tenantRef;
}

}

0 comments on commit aa73ea8

Please sign in to comment.