Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/gui-wrapper' of https://github.com/Evolveum/mid…
…point into feature/gui-wrapper
- Loading branch information
Showing
21 changed files
with
1,102 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...in/java/com/evolveum/midpoint/gui/impl/prism/component/ExpressionPropertyHeaderPanel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!-- | ||
~ Copyright (c) 2010-2019 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="row"> | ||
<div class="pull-left"> | ||
<button wicket:id="expandCollapseButton" wicket:message="title:PrismObjectPanel.expandCollapseContainer" | ||
class="btn btn-box-tool expand-collapse-button" trigger="hover"><i class="fa fa-caret-down"></i></button> | ||
</div> | ||
<div wicket:id="labelContainer" style="float: left;"> | ||
<a class="prism-title" style="cursor: pointer;" wicket:id="label"/> | ||
|
||
<span wicket:id="required" style="color: #f00; font-weight: bold;" | ||
wicket:message="title:prismPropertyPanel.required">*</span> | ||
<i class="helpTextIcon" wicket:id="help"/> | ||
</div> | ||
|
||
<div class="box-tools"> | ||
<button wicket:id="addButton" wicket:message="title:ExpressionPropertyHeaderPanel.addNewExpressionValue" class="btn btn-box-tool" trigger="hover"> | ||
<i class="fa fa-plus-circle"></i> | ||
</button> | ||
<button wicket:id="removeButton" wicket:message="title:ExpressionPropertyHeaderPanel.removeExpressionValue" class="btn btn-box-tool" trigger="hover"> | ||
<i class="fa fa-minus-circle"></i> | ||
</button> | ||
</div> | ||
</div> | ||
</wicket:panel> | ||
</html> |
123 changes: 123 additions & 0 deletions
123
...in/java/com/evolveum/midpoint/gui/impl/prism/component/ExpressionPropertyHeaderPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
package com.evolveum.midpoint.gui.impl.prism.component; | ||
|
||
import com.evolveum.midpoint.gui.api.GuiStyleConstants; | ||
import com.evolveum.midpoint.gui.api.component.togglebutton.ToggleIconButton; | ||
import com.evolveum.midpoint.gui.api.prism.PrismContainerWrapper; | ||
import com.evolveum.midpoint.gui.impl.prism.*; | ||
import com.evolveum.midpoint.prism.PrismProperty; | ||
import com.evolveum.midpoint.prism.PrismPropertyDefinition; | ||
import com.evolveum.midpoint.prism.PrismPropertyValue; | ||
import com.evolveum.midpoint.web.component.AjaxButton; | ||
import com.evolveum.midpoint.web.component.util.VisibleBehaviour; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType; | ||
import org.apache.commons.collections.CollectionUtils; | ||
import org.apache.wicket.Component; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.ajax.markup.html.AjaxLink; | ||
import org.apache.wicket.behavior.AttributeAppender; | ||
import org.apache.wicket.model.IModel; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by honchar | ||
*/ | ||
public class ExpressionPropertyHeaderPanel extends ItemHeaderPanel<PrismPropertyValue<ExpressionType>, PrismProperty<ExpressionType>, | ||
PrismPropertyDefinition<ExpressionType>, PrismPropertyWrapper<ExpressionType>> { | ||
private static final long serialVersionUID = 1L; | ||
|
||
private static final String ID_ADD_BUTTON = "addButton"; | ||
private static final String ID_REMOVE_BUTTON = "removeButton"; | ||
private static final String ID_EXPAND_COLLAPSE_BUTTON = "expandCollapseButton"; | ||
|
||
private boolean isExpanded; | ||
|
||
public ExpressionPropertyHeaderPanel(String id, IModel<PrismPropertyWrapper<ExpressionType>> model) { | ||
super(id, model); | ||
isExpanded = model.getObject() != null && CollectionUtils.isNotEmpty(model.getObject().getValues()); | ||
} | ||
|
||
@Override | ||
protected void initButtons() { | ||
AjaxLink<Void> addButton = new AjaxLink<Void>(ID_ADD_BUTTON) { | ||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public void onClick(AjaxRequestTarget target) { | ||
addExpressionValuePerformed(target); | ||
} | ||
}; | ||
addButton.add(new VisibleBehaviour(() -> isExpressionValueEmpty())); | ||
add(addButton); | ||
|
||
AjaxLink<Void> removeButton = new AjaxLink<Void>(ID_REMOVE_BUTTON) { | ||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public void onClick(AjaxRequestTarget target) { | ||
removeExpressionValuePerformed(target); | ||
} | ||
}; | ||
removeButton.add(new VisibleBehaviour(() -> !isExpressionValueEmpty())); | ||
add(removeButton); | ||
|
||
ToggleIconButton<?> expandCollapseButton = new ToggleIconButton<Void>(ID_EXPAND_COLLAPSE_BUTTON, | ||
GuiStyleConstants.CLASS_ICON_EXPAND_CONTAINER, GuiStyleConstants.CLASS_ICON_COLLAPSE_CONTAINER) { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public void onClick(AjaxRequestTarget target) { | ||
onExpandClick(target); | ||
} | ||
|
||
@Override | ||
public boolean isOn() { | ||
return ExpressionPropertyHeaderPanel.this.getModelObject() != null && isExpanded; | ||
} | ||
}; | ||
expandCollapseButton.setOutputMarkupId(true); | ||
add(expandCollapseButton); | ||
} | ||
|
||
@Override | ||
protected Component createTitle(IModel<String> label) { | ||
AjaxButton labelComponent = new AjaxButton(ID_LABEL, label) { | ||
private static final long serialVersionUID = 1L; | ||
@Override | ||
public void onClick(AjaxRequestTarget target) { | ||
onExpandClick(target); | ||
} | ||
}; | ||
labelComponent.setOutputMarkupId(true); | ||
labelComponent.add(AttributeAppender.append("style", "cursor: pointer;")); | ||
return labelComponent; | ||
} | ||
|
||
private boolean isExpressionValueEmpty(){ | ||
if (getModelObject() == null || CollectionUtils.isEmpty(getModelObject().getValues())){ | ||
return true; | ||
} | ||
List<PrismPropertyValueWrapper<ExpressionType>> valueWrappers = getModelObject().getValues(); | ||
for(PrismPropertyValueWrapper<ExpressionType> expressionValueWrapper : valueWrappers){ | ||
if (expressionValueWrapper.getOldValue() != null && expressionValueWrapper.getOldValue().getValue() != null){ | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
protected void onExpandClick(AjaxRequestTarget target) { | ||
isExpanded = !isExpanded; | ||
} | ||
|
||
protected void addExpressionValuePerformed(AjaxRequestTarget target){ | ||
|
||
} | ||
|
||
protected void removeExpressionValuePerformed(AjaxRequestTarget target){ | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.