Skip to content

Commit

Permalink
Merge branch 'master' into closure
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Oct 13, 2014
2 parents 7cfa98d + 957bf85 commit 5151e14
Show file tree
Hide file tree
Showing 80 changed files with 1,581 additions and 944 deletions.
Expand Up @@ -17,7 +17,10 @@

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<label class="control-label" wicket:id="label"/>
<span class="control-label" wicket:id="labelContainer">
<label wicket:id="label"/>
<i wicket:id="tooltip"/>
</span>

<div wicket:id="checkWrapper">
<div class="checkbox">
Expand Down
Expand Up @@ -17,12 +17,15 @@
package com.evolveum.midpoint.web.component.form;

import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.util.InfoTooltipBehavior;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.CheckBox;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

/**
* @author lazyman
Expand All @@ -31,20 +34,44 @@ public class CheckFormGroup extends SimplePanel<Boolean> {

private static final String ID_CHECK = "check";
private static final String ID_CHECK_WRAPPER = "checkWrapper";
private static final String ID_LABEL_CONTAINER = "labelContainer";
private static final String ID_LABEL = "label";
private static final String ID_TOOLTIP = "tooltip";

public CheckFormGroup(String id, IModel<Boolean> value, IModel<String> label, String labelSize, String textSize) {
this(id, value, label, null, labelSize, textSize);
}

public CheckFormGroup(String id, IModel<Boolean> value, IModel<String> label, String tooltipKey,
String labelSize, String textSize) {
super(id, value);

initLayout(label, labelSize, textSize);
initLayout(label, tooltipKey, labelSize, textSize);
}

private void initLayout(IModel<String> label, String labelSize, String textSize) {
private void initLayout(IModel<String> label, final String tooltipKey, String labelSize, String textSize) {
WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
add(labelContainer);
Label l = new Label(ID_LABEL, label);

if (StringUtils.isNotEmpty(labelSize)) {
l.add(AttributeAppender.prepend("class", labelSize));
labelContainer.add(AttributeAppender.prepend("class", labelSize));
}
add(l);
labelContainer.add(l);

Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
tooltipLabel.add(new AttributeAppender("data-original-title", getString(tooltipKey)));
tooltipLabel.add(new InfoTooltipBehavior());
tooltipLabel.add(new VisibleEnableBehaviour(){

@Override
public boolean isVisible() {
return tooltipKey != null;
}
});
tooltipLabel.setOutputMarkupId(true);
tooltipLabel.setOutputMarkupPlaceholderTag(true);
labelContainer.add(tooltipLabel);

WebMarkupContainer checkWrapper = new WebMarkupContainer(ID_CHECK_WRAPPER);
if (StringUtils.isNotEmpty(textSize)) {
Expand Down
Expand Up @@ -17,7 +17,10 @@

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<label class="control-label" wicket:id="label"/>
<span class="control-label" wicket:id="labelContainer">
<label wicket:id="label"/>
<i wicket:id="tooltip"/>
</span>

<div wicket:id="selectWrapper">
<select class="form-control input-sm" wicket:id="select" />
Expand Down
Expand Up @@ -17,6 +17,8 @@
package com.evolveum.midpoint.web.component.form;

import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.util.InfoTooltipBehavior;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
Expand All @@ -26,6 +28,7 @@
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import java.util.List;

Expand All @@ -36,23 +39,47 @@ public class DropDownFormGroup<T> extends SimplePanel<T> {

private static final String ID_SELECT = "select";
private static final String ID_SELECT_WRAPPER = "selectWrapper";
private static final String ID_LABEL_CONTAINER = "labelContainer";
private static final String ID_LABEL = "label";
private static final String ID_TOOLTIP = "tooltip";
private static final String ID_FEEDBACK = "feedback";

public DropDownFormGroup(String id, IModel<T> value, IModel<List<T>> choices, IChoiceRenderer<T> renderer,
IModel<String> label, String labelSize, String textSize, boolean required) {
this(id, value, choices, renderer, label, null, labelSize, textSize, required);
}

public DropDownFormGroup(String id, IModel<T> value, IModel<List<T>> choices, IChoiceRenderer<T> renderer,
IModel<String> label, String tooltipKey, String labelSize, String textSize, boolean required) {
super(id, value);

initLayout(choices, renderer, label, labelSize, textSize, required);
initLayout(choices, renderer, label, tooltipKey, labelSize, textSize, required);
}

private void initLayout(IModel<List<T>> choices, IChoiceRenderer<T> renderer, IModel<String> label,
private void initLayout(IModel<List<T>> choices, IChoiceRenderer<T> renderer, IModel<String> label, final String tooltipKey,
String labelSize, String textSize, boolean required) {
WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
add(labelContainer);

Label l = new Label(ID_LABEL, label);
if (StringUtils.isNotEmpty(labelSize)) {
l.add(AttributeAppender.prepend("class", labelSize));
labelContainer.add(AttributeAppender.prepend("class", labelSize));
}
add(l);
labelContainer.add(l);

Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
tooltipLabel.add(new AttributeAppender("data-original-title", getString(tooltipKey)));
tooltipLabel.add(new InfoTooltipBehavior());
tooltipLabel.add(new VisibleEnableBehaviour(){

@Override
public boolean isVisible() {
return tooltipKey != null;
}
});
tooltipLabel.setOutputMarkupId(true);
tooltipLabel.setOutputMarkupPlaceholderTag(true);
labelContainer.add(tooltipLabel);

WebMarkupContainer selectWrapper = new WebMarkupContainer(ID_SELECT_WRAPPER);
if (StringUtils.isNotEmpty(textSize)) {
Expand Down
Expand Up @@ -17,7 +17,10 @@

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<label class="control-label" wicket:id="label"/>
<span class="control-label" wicket:id="labelContainer">
<label wicket:id="label"/>
<i wicket:id="tooltip"/>
</span>

<div wicket:id="textWrapper">
<textarea class="form-control input-sm" rows="2" wicket:id="text"></textarea>
Expand Down
Expand Up @@ -17,15 +17,16 @@
package com.evolveum.midpoint.web.component.form;

import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.util.InfoTooltipBehavior;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.RequiredTextField;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

/**
* @author lazyman
Expand All @@ -34,7 +35,9 @@ public class TextAreaFormGroup extends SimplePanel<String> {

private static final String ID_TEXT = "text";
private static final String ID_TEXT_WRAPPER = "textWrapper";
private static final String ID_LABEL_CONTAINER = "labelContainer";
private static final String ID_LABEL = "label";
private static final String ID_TOOLTIP = "tooltip";

private static final int DEFAULT_NUMBER_OF_ROWS = 2;

Expand All @@ -49,25 +52,47 @@ public TextAreaFormGroup(String id, IModel<String> value, IModel<String> label,

public TextAreaFormGroup(String id, IModel<String> value, IModel<String> label, String labelSize, String textSize,
boolean required, int rowNumber){
this(id, value, label, null, labelSize, textSize, required, rowNumber);
}

public TextAreaFormGroup(String id, IModel<String> value, IModel<String> label, String tooltipKey, String labelSize, String textSize,
boolean required, int rowNumber){
super(id, value);

initLayout(label, labelSize, textSize, required, rowNumber);
initLayout(label, tooltipKey, labelSize, textSize, required, rowNumber);
}

private void initLayout(IModel<String> label, String labelSize, String textSize, boolean required, int rowNumber) {
private void initLayout(IModel<String> label, final String tooltipKey, String labelSize, String textSize, boolean required, int rowNumber) {
WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
add(labelContainer);

Label l = new Label(ID_LABEL, label);
if (StringUtils.isNotEmpty(labelSize)) {
l.add(AttributeAppender.prepend("class", labelSize));
labelContainer.add(AttributeAppender.prepend("class", labelSize));
}
add(l);
labelContainer.add(l);

Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
tooltipLabel.add(new AttributeAppender("data-original-title", getString(tooltipKey)));
tooltipLabel.add(new InfoTooltipBehavior());
tooltipLabel.add(new VisibleEnableBehaviour(){

@Override
public boolean isVisible() {
return tooltipKey != null;
}
});
tooltipLabel.setOutputMarkupId(true);
tooltipLabel.setOutputMarkupPlaceholderTag(true);
labelContainer.add(tooltipLabel);

WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
if (StringUtils.isNotEmpty(textSize)) {
textWrapper.add(AttributeAppender.prepend("class", textSize));
}
add(textWrapper);

TextArea text = new TextArea(ID_TEXT, getModel());
TextArea text = new TextArea<>(ID_TEXT, getModel());
text.add(new AttributeModifier("rows", rowNumber));
text.setOutputMarkupId(true);
text.setRequired(required);
Expand Down
Expand Up @@ -17,7 +17,10 @@

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<label class="control-label" wicket:id="label"/>
<span class="control-label" wicket:id="labelContainer">
<label wicket:id="label"/>
<i wicket:id="tooltip" />
</span>

<div wicket:id="textWrapper">
<input type="text" class="form-control input-sm" wicket:id="text">
Expand Down
Expand Up @@ -17,6 +17,8 @@
package com.evolveum.midpoint.web.component.form;

import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.util.InfoTooltipBehavior;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
Expand All @@ -25,6 +27,7 @@
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

/**
* @author lazyman
Expand All @@ -33,22 +36,46 @@ public class TextFormGroup extends SimplePanel<String> {

private static final String ID_TEXT = "text";
private static final String ID_TEXT_WRAPPER = "textWrapper";
private static final String ID_LABEL_CONTAINER = "labelContainer";
private static final String ID_LABEL = "label";
private static final String ID_TOOLTIP = "tooltip";
private static final String ID_FEEDBACK = "feedback";

public TextFormGroup(String id, IModel<String> value, IModel<String> label, String labelSize, String textSize,
boolean required) {
this(id, value, label, null, labelSize, textSize, required);
}

public TextFormGroup(String id, IModel<String> value, IModel<String> label, String tooltipKey, String labelSize,
String textSize, boolean required) {
super(id, value);

initLayout(label, labelSize, textSize, required);
initLayout(label, tooltipKey, labelSize, textSize, required);
}

private void initLayout(IModel<String> label, String labelSize, String textSize, boolean required) {
private void initLayout(IModel<String> label, final String tooltipKey, String labelSize, String textSize, boolean required) {
WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
add(labelContainer);

Label l = new Label(ID_LABEL, label);
if (StringUtils.isNotEmpty(labelSize)) {
l.add(AttributeAppender.prepend("class", labelSize));
labelContainer.add(AttributeAppender.prepend("class", labelSize));
}
add(l);
labelContainer.add(l);

Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
tooltipLabel.add(new AttributeAppender("data-original-title", getString(tooltipKey)));
tooltipLabel.add(new InfoTooltipBehavior());
tooltipLabel.add(new VisibleEnableBehaviour(){

@Override
public boolean isVisible() {
return tooltipKey != null;
}
});
tooltipLabel.setOutputMarkupId(true);
tooltipLabel.setOutputMarkupPlaceholderTag(true);
labelContainer.add(tooltipLabel);

WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
if (StringUtils.isNotEmpty(textSize)) {
Expand Down
Expand Up @@ -21,6 +21,7 @@
<dl class="dl-horizontal">
<dt>
<label wicket:id="typeLabel"></label>
<i wicket:id="typeTooltip" wicket:message="title:ResourceWizard.expression.tooltip.type"/>
</dt>
<dd>
<select wicket:id="type" class="form-control input-sm"></select>
Expand All @@ -30,6 +31,7 @@
<dl class="dl-horizontal" wicket:id="languageContainer">
<dt>
<label><wicket:message key="ExpressionEditorPanel.label.language" /></label>
<i wicket:id="languageTooltip" wicket:message="title:ResourceWizard.expression.tooltip.language"/>
</dt>
<dd>
<select wicket:id="language" class="form-control input-sm"></select>
Expand All @@ -39,6 +41,7 @@
<dl class="dl-horizontal" wicket:id="policyRefContainer">
<dt>
<label><wicket:message key="ExpressionEditorPanel.label.valuePolicyRef" /></label>
<i wicket:id="policyRefTooltip" wicket:message="title:ResourceWizard.expression.tooltip.policyRef"/>
</dt>
<dd>
<select wicket:id="policyRef" class="form-control input-sm"></select>
Expand All @@ -48,6 +51,7 @@
<dl class="dl-horizontal">
<dt>
<label wicket:id="expressionLabel"></label>
<i wicket:id="expressionTooltip" wicket:message="title:ResourceWizard.expression.tooltip.expression"/>
</dt>
<dd>
<textarea wicket:id="expression" class="form-control input-sm" rows="5"></textarea>
Expand Down

0 comments on commit 5151e14

Please sign in to comment.