Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MID-1931 working initial implementation. Not fully completed yet.
- Loading branch information
Erik Suta
committed
Jun 23, 2014
1 parent
ac0df57
commit a06435a
Showing
11 changed files
with
279 additions
and
8 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
38 changes: 38 additions & 0 deletions
38
...in-gui/src/main/java/com/evolveum/midpoint/web/component/data/paging/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,38 @@ | ||
<!-- | ||
~ 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> | ||
<div style="text-align: left"> | ||
|
||
<form class="form-inline pull-left search-form" wicket:id="pagingForm"> | ||
<label class="col-lg-5"> | ||
<wicket:message key="PagingSizePanel.label.pagingSize" /> | ||
</label> | ||
|
||
<div class="col-lg-5 form-group"> | ||
<input class="form-control input-sm" wicket:id="pagingSize"/> | ||
</div> | ||
|
||
<span class="btn-group"> | ||
<a class="btn btn-default btn-sm" wicket:id="setPagingButton"/> | ||
</span> | ||
</form> | ||
|
||
</div> | ||
</wicket:panel> | ||
</html> |
94 changes: 94 additions & 0 deletions
94
...in-gui/src/main/java/com/evolveum/midpoint/web/component/data/paging/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,94 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package com.evolveum.midpoint.web.component.data.paging; | ||
|
||
import com.evolveum.midpoint.web.component.AjaxSubmitButton; | ||
import com.evolveum.midpoint.web.component.util.LoadableModel; | ||
import com.evolveum.midpoint.web.component.util.SimplePanel; | ||
import com.evolveum.midpoint.web.session.UserProfileStorage; | ||
import com.evolveum.midpoint.web.util.SearchFormEnterBehavior; | ||
import org.apache.wicket.AttributeModifier; | ||
import org.apache.wicket.Component; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.markup.html.form.Form; | ||
import org.apache.wicket.markup.html.form.TextField; | ||
import org.apache.wicket.model.IModel; | ||
|
||
/** | ||
* @author shood | ||
* */ | ||
public class PagingSizePanel extends SimplePanel { | ||
|
||
private static final String ID_FORM_PAGING = "pagingForm"; | ||
private static final String ID_PAGING_SIZE = "pagingSize"; | ||
private static final String ID_SET_PAGING_BUTTON = "setPagingButton"; | ||
|
||
private IModel<Integer> pagingModel; | ||
|
||
public PagingSizePanel(String id, final UserProfileStorage.TableId tableId){ | ||
super(id); | ||
|
||
pagingModel = new LoadableModel<Integer>() { | ||
|
||
@Override | ||
protected Integer load() { | ||
return getPageBase().getSessionStorage().getUserProfile().getPagingSize(tableId); | ||
} | ||
}; | ||
|
||
Form pagingForm = new Form(ID_FORM_PAGING); | ||
pagingForm.setOutputMarkupId(true); | ||
add(pagingForm); | ||
|
||
initLayout(pagingForm); | ||
} | ||
|
||
public Integer getPagingSize(){ | ||
return pagingModel.getObject(); | ||
} | ||
|
||
private void initLayout(Form form){ | ||
AjaxSubmitButton setPagingButton = new AjaxSubmitButton(ID_SET_PAGING_BUTTON, | ||
createStringResource("PagingSizePanel.button.set")) { | ||
|
||
@Override | ||
protected void onSubmit(AjaxRequestTarget target, Form<?> form){ | ||
pagingSizeChangePerformed(target); | ||
} | ||
|
||
@Override | ||
protected void onError(AjaxRequestTarget target, Form<?> form){ | ||
target.add(getFeedbackPanel()); | ||
} | ||
}; | ||
form.add(setPagingButton); | ||
|
||
final TextField<Integer> pagingText = new TextField<Integer>(ID_PAGING_SIZE, pagingModel); | ||
pagingText.setType(Integer.class); | ||
pagingText.add(AttributeModifier.replace("placeholder", createStringResource("PagingSizePanel.label.pagingSize"))); | ||
pagingText.add(new SearchFormEnterBehavior(setPagingButton)); | ||
form.add(pagingText); | ||
} | ||
|
||
private Component getFeedbackPanel() { | ||
return getPageBase().getFeedbackPanel(); | ||
} | ||
|
||
protected void pagingSizeChangePerformed(AjaxRequestTarget target){} | ||
|
||
|
||
} |
18 changes: 18 additions & 0 deletions
18
.../src/main/java/com/evolveum/midpoint/web/component/data/paging/PagingSizePanel.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,18 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
PagingSizePanel.button.set=Set | ||
PagingSizePanel.label.pagingSize=Paging 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
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
Oops, something went wrong.