Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Jun 21, 2018
2 parents f4a48e0 + b37ef7a commit 2ce1515
Show file tree
Hide file tree
Showing 11 changed files with 310 additions and 133 deletions.
2 changes: 1 addition & 1 deletion dist/src/main/bin/midpoint.bat
Expand Up @@ -49,7 +49,7 @@ echo Using JAVA_OPTS: "%JAVA_OPTS%"
echo Using parameters: "%*"
echo.
echo Starting midPoint.
start /b %RUN_JAVA% -jar %JAVA_OPTS% -Xms2048M -Xmx2048M -Dpython.cachedir="%MIDPOINT_HOME%\tmp" -Djavax.net.ssl.trustStore="%MIDPOINT_HOME%\keystore.jceks" -Djavax.net.ssl.trustStoreType=jceks -Dmidpoint.home="%MIDPOINT_HOME%" "%LIB_DIR%\midpoint.war" %* > "%BOOT_OUT%" 2>&1
start /b %RUN_JAVA% -jar %JAVA_OPTS% -Xms2048M -Xmx4096M -Dpython.cachedir="%MIDPOINT_HOME%\tmp" -Djavax.net.ssl.trustStore="%MIDPOINT_HOME%\keystore.jceks" -Djavax.net.ssl.trustStoreType=jceks -Dmidpoint.home="%MIDPOINT_HOME%" "%LIB_DIR%\midpoint.war" %* > "%BOOT_OUT%" 2>&1
goto end

:doStop
Expand Down
2 changes: 1 addition & 1 deletion dist/src/main/bin/midpoint.sh
Expand Up @@ -50,7 +50,7 @@ if [ -z "$MIDPOINT_HOME" ] ; then
fi
JAVA_OPTS="$JAVA_OPTS
-Xms2048M
-Xmx2048M
-Xmx4096M
-Dpython.cachedir=$MIDPOINT_HOME/tmp
-Djavax.net.ssl.trustStore=$MIDPOINT_HOME/keystore.jceks
-Djavax.net.ssl.trustStoreType=jceks
Expand Down
Expand Up @@ -19,22 +19,39 @@
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.behavior.Behavior;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.MarkupStream;
import org.apache.wicket.markup.parser.XmlTag;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;

/**
* @author Viliam Repan (lazyman)
*/
public abstract class AjaxIconButton extends AjaxLink<String> {

private static final long serialVersionUID = 1L;

private IModel<String> title;

private boolean showTitleAsLabel;

public AjaxIconButton(String id, IModel<String> icon, IModel<String> title) {
super(id, icon);

this.title = title;

add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {

private static final long serialVersionUID = 1L;

@Override
public String getObject() {
return !AjaxIconButton.this.isEnabled() ? "disabled" : "";
}
}));
}

@Override
Expand All @@ -50,11 +67,23 @@ protected void onInitialize() {
public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
StringBuilder sb = new StringBuilder();

String title = this.title.getObject();

String icon = getModelObject();
if (StringUtils.isNotEmpty(icon)) {
sb.append("<i class=\"").append(icon).append("\"></i>");
sb.append("<i class=\"").append(icon).append("\"");
if (showTitleAsLabel && StringUtils.isNotEmpty(title)) {
sb.append(" style=\"margin-right: 5px;\"");
}
sb.append("></i>");
}

if (StringUtils.isEmpty(icon)) {
sb.append(title);
} else {
sb.append(title.getObject());
if (showTitleAsLabel) {
sb.append(title);
}
}

replaceComponentTagBody(markupStream, openTag, sb.toString());
Expand All @@ -68,4 +97,10 @@ protected void onComponentTag(ComponentTag tag) {
tag.setType(XmlTag.TagType.OPEN);
}
}

public AjaxIconButton showTitleAsLabel(boolean show) {
showTitleAsLabel = show;

return this;
}
}
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2010-2018 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.component.data;

import org.apache.wicket.ajax.AjaxRequestTarget;

import java.io.Serializable;

/**
* Created by Viliam Repan (lazyman).
*/
@FunctionalInterface
public interface AjaxEventProcessor extends Serializable {

void onEventPerformed(AjaxRequestTarget target);
}
Expand Up @@ -40,6 +40,7 @@
* <p>
* todo rewrite, Overcomplicated code.
*/
@Deprecated
public class MultiButtonPanel<T> extends BasePanel<T> {
private static final long serialVersionUID = 1L;

Expand Down
@@ -0,0 +1,21 @@
<!--
~ Copyright (c) 2010-2015 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>
<a wicket:id="buttons" style="margin-right: 3px;"/>
</wicket:panel>
</html>
@@ -0,0 +1,89 @@
/*
* Copyright (c) 2010-2018 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.component.data;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.web.component.AjaxIconButton;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;

/**
* Created by Viliam Repan (lazyman).
*/
public class MultiButtonPanel2<T> extends BasePanel<T> {

private static final long serialVersionUID = 1L;

private static final String ID_BUTTONS = "buttons";

private int numberOfButtons;

public MultiButtonPanel2(String id, IModel<T> model, int numberOfButtons) {
super(id, model);

this.numberOfButtons = numberOfButtons;
}

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

initLayout();
}

public int getNumberOfButtons() {
return numberOfButtons;
}

private void initLayout() {
RepeatingView buttons = new RepeatingView(ID_BUTTONS);
add(buttons);

for (int id = 0; id < numberOfButtons; id++) {
AjaxIconButton button = createButton(id, buttons.newChildId(), getModel());
if (button != null) {
buttons.add(button);
}
}
}

protected AjaxIconButton createButton(int index, String componentId, IModel<T> model) {
return null;
}

protected AjaxIconButton buildDefaultButton(String componentId, IModel<String> icon, IModel<String> title,
IModel<String> cssClass, final AjaxEventProcessor onClickProcessor) {
AjaxIconButton btn = new AjaxIconButton(componentId, icon, title) {

@Override
public void onClick(AjaxRequestTarget target) {
if (onClickProcessor != null) {
onClickProcessor.onEventPerformed(target);
}
}
};

btn.showTitleAsLabel(true);
if (cssClass != null) {
btn.add(AttributeAppender.append("class", cssClass));
}

return btn;
}
}
Expand Up @@ -29,6 +29,7 @@
* @author shood
* @author mederly
*/
@Deprecated
public class MultiButtonColumn<T extends Serializable> extends AbstractColumn<T, String> {

protected MultiButtonPanel panel;
Expand Down

0 comments on commit 2ce1515

Please sign in to comment.