-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new paging widget according to figma
- Loading branch information
Showing
11 changed files
with
219 additions
and
178 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
26 changes: 26 additions & 0 deletions
26
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PagingSizePanel.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,26 @@ | ||
<!-- | ||
~ Copyright (c) 2010-2017 Evolveum | ||
~ | ||
~ This work is dual-licensed under the Apache License 2.0 | ||
~ and European Union Public License. See LICENSE file for details. | ||
--> | ||
|
||
<!DOCTYPE html> | ||
<html xmlns:wicket="http://wicket.apache.org"> | ||
<wicket:panel> | ||
<input wicket:id="input" type="text" class="form-control" style="max-width: 50px;" wicket:message="title:PagingSizePanel.pageSize"> | ||
<div class="input-group-append"> | ||
<div class="d-flex flex-column"> | ||
<a wicket:id="increment" class="border flex-fill px-1 d-flex align-items-center border-bottom-0" style="line-height: 1; border-color: #ced4da !important; color: #444;"> | ||
<i class="fa-solid fa-caret-up fa-xs"></i> | ||
</a> | ||
<a wicket:id="decrement" class="border flex-fill px-1 d-flex align-items-center" style="line-height: 1; border-color: #ced4da !important; color: #444;"> | ||
<i class="fa-solid fa-caret-down fa-xs"></i> | ||
</a> | ||
</div> | ||
<a wicket:id="submit" class="btn btn-primary"> | ||
<i class="fa fa-check"></i> | ||
</a> | ||
</div> | ||
</wicket:panel> | ||
</html> |
146 changes: 146 additions & 0 deletions
146
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PagingSizePanel.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,146 @@ | ||
/* | ||
* Copyright (c) 2022 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.web.component.data; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; | ||
import org.apache.wicket.behavior.AttributeAppender; | ||
import org.apache.wicket.markup.ComponentTag; | ||
import org.apache.wicket.markup.head.IHeaderResponse; | ||
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; | ||
import org.apache.wicket.markup.html.WebMarkupContainer; | ||
import org.apache.wicket.markup.html.form.TextField; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.validation.validator.RangeValidator; | ||
|
||
import com.evolveum.midpoint.gui.api.component.BasePanel; | ||
import com.evolveum.midpoint.web.session.UserProfileStorage; | ||
import com.evolveum.midpoint.web.util.SearchFormEnterBehavior; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
public class PagingSizePanel extends BasePanel<Integer> { | ||
|
||
private static final long serialVersionUID = 1L; | ||
private static final String ID_INPUT = "input"; | ||
private static final String ID_SUBMIT = "submit"; | ||
private static final String ID_INCREMENT = "increment"; | ||
private static final String ID_DECREMENT = "decrement"; | ||
|
||
private boolean small; | ||
|
||
public PagingSizePanel(String id) { | ||
super(id, null); | ||
|
||
initLayout(); | ||
} | ||
|
||
@Override | ||
protected void onComponentTag(ComponentTag tag) { | ||
checkComponentTag(tag, "div"); | ||
|
||
super.onComponentTag(tag); | ||
} | ||
|
||
@Override | ||
public void renderHead(IHeaderResponse response) { | ||
super.renderHead(response); | ||
|
||
response.render(OnDomReadyHeaderItem.forScript(createIncrementScript(ID_INCREMENT, 5))); | ||
response.render(OnDomReadyHeaderItem.forScript(createIncrementScript(ID_DECREMENT, -5))); | ||
} | ||
|
||
private String createIncrementScript(String buttonId, int increment) { | ||
return "$(function() { $('#" + get(buttonId).getMarkupId() + "').click( " | ||
+ "function() { " | ||
+ "MidPointTheme.increment('" + get(ID_INPUT).getMarkupId() + "', " + increment + "); " | ||
+ "}); });"; | ||
} | ||
|
||
private void initLayout() { | ||
add(AttributeAppender.prepend("class", | ||
() -> StringUtils.joinWith(" ", "input-group", small ? "input-group-sm" : "", "flex-nowrap w-auto"))); | ||
|
||
AjaxSubmitLink submit = new AjaxSubmitLink(ID_SUBMIT) { | ||
|
||
@Override | ||
protected void onError(AjaxRequestTarget target) { | ||
target.add(getPageBase().getFeedbackPanel()); | ||
} | ||
|
||
@Override | ||
protected void onSubmit(AjaxRequestTarget target) { | ||
onPageSizeChangePerformed(target); | ||
} | ||
}; | ||
add(submit); | ||
|
||
TextField input = new TextField(ID_INPUT, getModel()); | ||
input.add(new RangeValidator<>(5, 100)); | ||
input.setLabel(createStringResource("PageSizePopover.title")); | ||
input.add(new SearchFormEnterBehavior(submit)); | ||
input.setType(Integer.class); | ||
input.setOutputMarkupId(true); | ||
add(input); | ||
|
||
WebMarkupContainer increment = new WebMarkupContainer(ID_INCREMENT); | ||
increment.setOutputMarkupId(true); | ||
add(increment); | ||
|
||
WebMarkupContainer decrement = new WebMarkupContainer(ID_DECREMENT); | ||
decrement.setOutputMarkupId(true); | ||
add(decrement); | ||
} | ||
|
||
protected void onPageSizeChangePerformed(AjaxRequestTarget target) { | ||
|
||
} | ||
|
||
@Override | ||
public IModel<Integer> createModel() { | ||
return new IModel<>() { | ||
|
||
@Override | ||
public Integer getObject() { | ||
Table tablePanel = findParent(Table.class); | ||
UserProfileStorage.TableId tableId = tablePanel.getTableId(); | ||
if (tableId == null || !tablePanel.enableSavePageSize()) { | ||
return tablePanel.getItemsPerPage(); | ||
} | ||
|
||
return getPageBase().getSessionStorage().getUserProfile().getPagingSize(tableId); | ||
} | ||
|
||
@Override | ||
public void setObject(Integer o) { | ||
Table tablePanel = findParent(Table.class); | ||
UserProfileStorage.TableId tableId = tablePanel.getTableId(); | ||
if (tableId == null || !tablePanel.enableSavePageSize()) { | ||
tablePanel.setItemsPerPage(o); | ||
return; | ||
} | ||
|
||
getPageBase().getSessionStorage().getUserProfile().setPagingSize(tableId, o); | ||
} | ||
|
||
@Override | ||
public void detach() { | ||
} | ||
}; | ||
} | ||
|
||
public boolean isSmall() { | ||
return small; | ||
} | ||
|
||
public void setSmall(boolean small) { | ||
this.small = small; | ||
} | ||
} |
30 changes: 0 additions & 30 deletions
30
...n-gui/src/main/java/com/evolveum/midpoint/web/component/data/TableConfigurationPanel.html
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.