Skip to content

Commit

Permalink
Merge branch 'master' into feature/checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Oct 18, 2019
2 parents f288ec2 + eaa763e commit 9d30a19
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 48 deletions.
Expand Up @@ -33,13 +33,13 @@ <h3 class="box-title"><wicket:message key="ItemApprovalPanel.wholeProcess"/></h3
<div wicket:id="wholeProcess" />
</div>
</div>
<!--<div style="padding-bottom:15px"> &lt;!&ndash; TODO use some css here &ndash;&gt;-->
<!--<span wicket:id="showNextStagesContainer">-->
<!--<a href="#" wicket:id="showNextStages"><wicket:message key="taskWfChildPanel.showNextStages"/></a> <i wicket:id="showNextStagesHelp" wicket:message="title:TaskWfChildPanel.showNextStagesHelp"/>&nbsp;&nbsp;&nbsp;-->
<!--</span>-->
<!--<span wicket:id="showWholeProcessContainer">-->
<!--<a href="#" wicket:id="showWholeProcess"><wicket:message key="taskWfChildPanel.showWholeProcess"/></a> <i wicket:id="showWholeProcessHelp" wicket:message="title:TaskWfChildPanel.showWholeProcessHelp"/>-->
<!--</span>-->
<!--</div>-->
<div style="padding-bottom:15px"> <!-- TODO use some css here -->
<span wicket:id="showNextStagesContainer">
<a href="#" wicket:id="showNextStages"><wicket:message key="taskWfChildPanel.showNextStages"/></a> <i wicket:id="showNextStagesHelp" wicket:message="title:TaskWfChildPanel.showNextStagesHelp"/>&nbsp;&nbsp;&nbsp;
</span>
<span wicket:id="showWholeProcessContainer">
<a href="#" wicket:id="showWholeProcess"><wicket:message key="taskWfChildPanel.showWholeProcess"/></a> <i wicket:id="showWholeProcessHelp" wicket:message="title:TaskWfChildPanel.showWholeProcessHelp"/>
</span>
</div>
</wicket:panel>
</html>
Expand Up @@ -11,6 +11,8 @@
import java.util.Optional;

import org.apache.commons.collections.CollectionUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.IModel;
import org.jetbrains.annotations.Nullable;
Expand All @@ -31,7 +33,7 @@
/**
* @author mederly
*/
public class SwitchableApprovalProcessPreviewsPanel extends BasePanel<String> { // model is task OID
public class SwitchableApprovalProcessPreviewsPanel extends BasePanel<String> {

private static final Trace LOGGER = TraceManager.getTrace(SwitchableApprovalProcessPreviewsPanel.class);

Expand All @@ -41,10 +43,10 @@ public class SwitchableApprovalProcessPreviewsPanel extends BasePanel<String> {
private static final String ID_WHOLE_PROCESS_CONTAINER = "wholeProcessContainer";
private static final String ID_WHOLE_PROCESS = "wholeProcess";
private static final String ID_WHOLE_PROCESS_HELP = "wholeProcessHelp";
// private static final String ID_SHOW_NEXT_STAGES_CONTAINER = "showNextStagesContainer";
private static final String ID_SHOW_NEXT_STAGES_CONTAINER = "showNextStagesContainer";
private static final String ID_SHOW_NEXT_STAGES = "showNextStages";
private static final String ID_SHOW_NEXT_STAGES_HELP = "showNextStagesHelp";
// private static final String ID_SHOW_WHOLE_PROCESS_CONTAINER = "showWholeProcessContainer";
private static final String ID_SHOW_WHOLE_PROCESS_CONTAINER = "showWholeProcessContainer";
private static final String ID_SHOW_WHOLE_PROCESS = "showWholeProcess";
private static final String ID_SHOW_WHOLE_PROCESS_HELP = "showWholeProcessHelp";

Expand All @@ -53,7 +55,7 @@ public class SwitchableApprovalProcessPreviewsPanel extends BasePanel<String> {
private LoadableModel<ApprovalProcessExecutionInformationDto> wholeProcessModel;

public SwitchableApprovalProcessPreviewsPanel(String id,
IModel<String> taskOidModel, IModel<Boolean> showNextStagesModel, PageBase parentPage) {
IModel<String> taskOidModel, IModel<Boolean> showNextStagesModel, PageBase parentPage) {
super(id, taskOidModel);
initModels(parentPage);
initLayout(showNextStagesModel);
Expand All @@ -62,7 +64,7 @@ public SwitchableApprovalProcessPreviewsPanel(String id,
private enum ProcessInfoBox {
NEXT_STAGES, WHOLE_PROCESS
}
private ProcessInfoBox displayedProcessInfoBox;
private ProcessInfoBox displayedProcessInfoBox = ProcessInfoBox.WHOLE_PROCESS;

private void initModels(PageBase parentPage) {
approvalExecutionInfoModel = new LoadableModel<ApprovalSchemaExecutionInformationType>() {
Expand Down Expand Up @@ -132,45 +134,46 @@ private void initLayout(IModel<Boolean> showNextStagesModel) {
nextStagesContainer.add(new ApprovalProcessExecutionInformationPanel(ID_NEXT_STAGES, nextStagesModel));
nextStagesContainer.add(WebComponentUtil.createHelp(ID_NEXT_STAGES_HELP));
nextStagesContainer.add(new VisibleBehaviour(() -> nextStagesModel.getObject() != null &&
CollectionUtils.isNotEmpty(nextStagesModel.getObject().getStages())));
CollectionUtils.isNotEmpty(nextStagesModel.getObject().getStages())
&& displayedProcessInfoBox == ProcessInfoBox.NEXT_STAGES));
add(nextStagesContainer);

WebMarkupContainer wholeProcessContainer = new WebMarkupContainer(ID_WHOLE_PROCESS_CONTAINER);
wholeProcessContainer.add(new ApprovalProcessExecutionInformationPanel(ID_WHOLE_PROCESS, wholeProcessModel));
wholeProcessContainer.add(WebComponentUtil.createHelp(ID_WHOLE_PROCESS_HELP));
// wholeProcessContainer.add(new VisibleBehaviour(() -> displayedProcessInfoBox == ProcessInfoBox.WHOLE_PROCESS));
wholeProcessContainer.add(new VisibleBehaviour(() -> displayedProcessInfoBox == ProcessInfoBox.WHOLE_PROCESS));
add(wholeProcessContainer);

// WebMarkupContainer showNextStagesContainer = new WebMarkupContainer(ID_SHOW_NEXT_STAGES_CONTAINER);
// showNextStagesContainer.add(new AjaxFallbackLink<Void>(ID_SHOW_NEXT_STAGES) {
//
// private static final long serialVersionUID = 1L;
//
// @Override
// public void onClick(Optional<AjaxRequestTarget> target) {
// displayedProcessInfoBox = ProcessInfoBox.NEXT_STAGES;
// ((AjaxRequestTarget) target.get()).add(SwitchableApprovalProcessPreviewsPanel.this);
// }
//
// });
// showNextStagesContainer.add(WebComponentUtil.createHelp(ID_SHOW_NEXT_STAGES_HELP));
//// showNextStagesContainer.add(new VisibleBehaviour(() ->
//// Boolean.TRUE.equals(showNextStagesModel.getObject()) && displayedProcessInfoBox != ProcessInfoBox.NEXT_STAGES));
// add(showNextStagesContainer);
//
// WebMarkupContainer showWholeProcessContainer = new WebMarkupContainer(ID_SHOW_WHOLE_PROCESS_CONTAINER);
// showWholeProcessContainer.add(new AjaxFallbackLink<Void>(ID_SHOW_WHOLE_PROCESS) {
// private static final long serialVersionUID = 1L;
//
// @Override
// public void onClick(Optional<AjaxRequestTarget> target) {
// displayedProcessInfoBox = ProcessInfoBox.WHOLE_PROCESS;
// ((AjaxRequestTarget) target.get()).add(SwitchableApprovalProcessPreviewsPanel.this);
// }
// });
//// showWholeProcessContainer.add(new VisibleBehaviour(() -> displayedProcessInfoBox != ProcessInfoBox.WHOLE_PROCESS));
// showWholeProcessContainer.add(WebComponentUtil.createHelp(ID_SHOW_WHOLE_PROCESS_HELP));
// add(showWholeProcessContainer);
WebMarkupContainer showNextStagesContainer = new WebMarkupContainer(ID_SHOW_NEXT_STAGES_CONTAINER);
showNextStagesContainer.add(new AjaxFallbackLink<Void>(ID_SHOW_NEXT_STAGES) {

private static final long serialVersionUID = 1L;

@Override
public void onClick(Optional<AjaxRequestTarget> target) {
displayedProcessInfoBox = ProcessInfoBox.NEXT_STAGES;
((AjaxRequestTarget) target.get()).add(SwitchableApprovalProcessPreviewsPanel.this);
}

});
showNextStagesContainer.add(WebComponentUtil.createHelp(ID_SHOW_NEXT_STAGES_HELP));
showNextStagesContainer.add(new VisibleBehaviour(() ->
Boolean.TRUE.equals(showNextStagesModel.getObject()) && displayedProcessInfoBox != ProcessInfoBox.NEXT_STAGES));
add(showNextStagesContainer);

WebMarkupContainer showWholeProcessContainer = new WebMarkupContainer(ID_SHOW_WHOLE_PROCESS_CONTAINER);
showWholeProcessContainer.add(new AjaxFallbackLink<Void>(ID_SHOW_WHOLE_PROCESS) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(Optional<AjaxRequestTarget> target) {
displayedProcessInfoBox = ProcessInfoBox.WHOLE_PROCESS;
((AjaxRequestTarget) target.get()).add(SwitchableApprovalProcessPreviewsPanel.this);
}
});
showWholeProcessContainer.add(new VisibleBehaviour(() -> displayedProcessInfoBox != ProcessInfoBox.WHOLE_PROCESS));
showWholeProcessContainer.add(WebComponentUtil.createHelp(ID_SHOW_WHOLE_PROCESS_HELP));
add(showWholeProcessContainer);

}

Expand Down
Expand Up @@ -14,6 +14,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.InformationPartType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.InformationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.LocalizableMessageType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SingleLocalizableMessageType;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
Expand Down Expand Up @@ -41,11 +42,13 @@ private void initLayout() {
@Override
public LocalizableMessageType getObject() {
InformationType info = getModelObject();
return info != null ? getLocalizableMessageOrDefault(info.getLocalizableTitle(), info.getTitle()) : null;
if (info == null || info.getTitle() == null && info.getLocalizableTitle() == null){
return new SingleLocalizableMessageType().fallbackMessage("ApprovalStageDefinitionType.additionalInformation");
}
return getLocalizableMessageOrDefault(info.getLocalizableTitle(), info.getTitle());
}
}, this));
titleLabel.add(new VisibleBehaviour(() -> getModelObject() != null && getModelObject().getLocalizableTitle() != null
&& getModelObject().getTitle() != null));
titleLabel.add(new VisibleBehaviour(() -> getModelObject() != null));
add(titleLabel);

ListView<InformationPartType> list = new ListView<InformationPartType>(ID_PARTS,
Expand Down

0 comments on commit 9d30a19

Please sign in to comment.