Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gui-devel' of https://github.com/Evolveum/midpoint into…
… gui-devel Conflicts: gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/CountToolbar.html
- Loading branch information
Showing
28 changed files
with
689 additions
and
251 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
42 changes: 42 additions & 0 deletions
42
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PageSizePopover.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,42 @@ | ||
<!-- | ||
~ Copyright (c) 2010-2013 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> | ||
<button wicket:id="popButton" type="button" class="btn btn-xs btn-default"> | ||
<i class="fa fa-cog"></i> | ||
</button> | ||
|
||
<div wicket:id="popover" class="popover fade left in"> | ||
<div class="arrow"></div> | ||
<h3 class="popover-title"><wicket:message key="PageSizePopover.title"/></h3> | ||
<div class="popover-content"> | ||
<form wicket:id="form"> | ||
<div class="input-group"> | ||
<input wicket:id="input" type="text" size="1" style="display: inline-block; width: auto;" | ||
class="form-control input-sm"> | ||
<span class="input-group-btn"> | ||
<button wicket:id="button" type="button" class="btn btn-sm btn-success"> | ||
<i class="fa fa-check"></i> | ||
</button> | ||
</span> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</wicket:panel> | ||
</html> |
109 changes: 109 additions & 0 deletions
109
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/PageSizePopover.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,109 @@ | ||
package com.evolveum.midpoint.web.component.data; | ||
|
||
import com.evolveum.midpoint.web.component.AjaxSubmitButton; | ||
import com.evolveum.midpoint.web.component.util.SimplePanel; | ||
import com.evolveum.midpoint.web.session.UserProfileStorage; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
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.Button; | ||
import org.apache.wicket.markup.html.form.Form; | ||
import org.apache.wicket.markup.html.form.TextField; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.validation.validator.RangeValidator; | ||
|
||
/** | ||
* @author lazyman | ||
*/ | ||
public class PageSizePopover extends SimplePanel { | ||
|
||
private static final String ID_POP_BUTTON = "popButton"; | ||
private static final String ID_POPOVER = "popover"; | ||
private static final String ID_FORM = "form"; | ||
private static final String ID_INPUT = "input"; | ||
private static final String ID_BUTTON = "button"; | ||
|
||
public PageSizePopover(String id) { | ||
super(id); | ||
setRenderBodyOnly(true); | ||
} | ||
|
||
@Override | ||
public void renderHead(IHeaderResponse response) { | ||
super.renderHead(response); | ||
|
||
StringBuilder sb = new StringBuilder(); | ||
sb.append("initPageSizePopover('").append(get(ID_POP_BUTTON).getMarkupId()); | ||
sb.append("','").append(get(ID_POPOVER).getMarkupId()); | ||
sb.append("');"); | ||
|
||
response.render(OnDomReadyHeaderItem.forScript(sb.toString())); | ||
} | ||
|
||
|
||
@Override | ||
protected void initLayout() { | ||
Button popButton = new Button(ID_POP_BUTTON); | ||
popButton.setOutputMarkupId(true); | ||
add(popButton); | ||
|
||
WebMarkupContainer popover = new WebMarkupContainer(ID_POPOVER); | ||
popover.setOutputMarkupId(true); | ||
add(popover); | ||
|
||
Form form = new Form(ID_FORM); | ||
popover.add(form); | ||
|
||
TextField input = new TextField(ID_INPUT, createInputModel()); | ||
input.add(new RangeValidator(5, 50)); | ||
input.setLabel(createStringResource("PageSizePopover.title")); | ||
input.setType(Integer.class); | ||
form.add(input); | ||
|
||
AjaxSubmitButton button = new AjaxSubmitButton(ID_BUTTON) { | ||
|
||
@Override | ||
protected void onError(AjaxRequestTarget target, Form<?> form) { | ||
super.onError(target, form); | ||
target.add(getPageBase().getFeedbackPanel()); | ||
} | ||
|
||
@Override | ||
protected void onSubmit(AjaxRequestTarget target, Form<?> form) { | ||
super.onSubmit(target, form); | ||
|
||
pageSizeChanged(target); | ||
} | ||
}; | ||
form.add(button); | ||
} | ||
|
||
private IModel<Integer> createInputModel() { | ||
return new IModel<Integer>() { | ||
|
||
@Override | ||
public Integer getObject() { | ||
TablePanel tablePanel = findParent(TablePanel.class); | ||
UserProfileStorage.TableId tableId = tablePanel.getTableId(); | ||
|
||
return getPageBase().getSessionStorage().getUserProfile().getPagingSize(tableId); | ||
} | ||
|
||
@Override | ||
public void setObject(Integer o) { | ||
TablePanel tablePanel = findParent(TablePanel.class); | ||
UserProfileStorage.TableId tableId = tablePanel.getTableId(); | ||
|
||
getPageBase().getSessionStorage().getUserProfile().setPagingSize(tableId, o); | ||
} | ||
|
||
@Override | ||
public void detach() { | ||
} | ||
}; | ||
} | ||
|
||
protected void pageSizeChanged(AjaxRequestTarget target) { | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...min-gui/src/main/java/com/evolveum/midpoint/web/component/data/PageSizePopover.properties
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 @@ | ||
PageSizePopover.title=Page size |
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
Oops, something went wrong.