Skip to content

Commit

Permalink
Request a role tab panel, updating some elements
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Feb 25, 2016
1 parent f646cae commit 9bd5991
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 212 deletions.
Expand Up @@ -19,8 +19,8 @@
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<div wicket:id="assignablePopup" />
<div wicket:id="assignableOrgPopup" />
<!--<div wicket:id="assignablePopup" />-->
<!--<div wicket:id="assignableOrgPopup" />-->

<form wicket:id="form">
<div class="row">
Expand All @@ -29,27 +29,11 @@
<label class="control-label">
<wicket:message key="MultipleAssignmentSelectorPanel.availableRoles"/>
</label>
<!--<a class="btn btn-sm btn-default" wicket:id="filterByUserButton"/>-->
<div wicket:id="availableAssignments"/>
</div>
<div class="col-md-4" style="margin-top: 60px;">
<div wicket:id="tenantRefContainer" class="form-group">
<div class="col-md-4">
<label>
<wicket:message key="AssignmentEditorPanel.tenantRef" />
</label>
</div>
<div class="col-md-8" wicket:id="tenantRefChooser"/>
</div>
<div wicket:id="orgRefContainer" class="form-group">
<div class="col-md-4">
<label>
<wicket:message key="AssignmentEditorPanel.orgRef" />
</label>
</div>
<div class="col-md-8" wicket:id="orgRefChooser"/>
</div>
<!--<div class="form-group">-->
<div class="form-group" wicket:id="tenantEditor"></div>
<div class="form-group" wicket:id="orgEditor"></div>
<div class="centre">
<button wicket:id="add" type="button" class="btn btn-default btn-sm vertical-button-group"><i class="fa fa-long-arrow-right"></i></button>
</div>
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -69,9 +69,12 @@ public class GenericMultiValueLabelEditPanel <T extends Serializable> extends Ba

private static final String CLASS_MULTI_VALUE = "multivalue-form";

private boolean isMultiple;

public GenericMultiValueLabelEditPanel(String id, IModel<List<T>> value, IModel<String> label,
String labelSize, String textSize){
String labelSize, String textSize, boolean isMultiple){
super(id, value);
this.isMultiple = isMultiple;
setOutputMarkupId(true);

initLayout(label, labelSize, textSize);
Expand All @@ -80,7 +83,7 @@ public GenericMultiValueLabelEditPanel(String id, IModel<List<T>> value, IModel<
private void initLayout(final IModel<String> label, final String labelSize, final String textSize){

Label l = new Label(ID_LABEL, label);

l.setVisible(getLabelVisibility());
if(StringUtils.isNotEmpty(labelSize)){
l.add(AttributeAppender.prepend("class", labelSize));
}
Expand Down Expand Up @@ -239,14 +242,15 @@ public boolean isVisible() {
}

protected boolean isAddButtonVisible(ListItem<T> item) {
int size = getModelObject().size();
if (size <= 1) {
return true;
}
if (item.getIndex() == size - 1) {
return true;
if (isMultiple) {
int size = getModelObject().size();
if (size <= 1) {
return true;
}
if (item.getIndex() == size - 1) {
return true;
}
}

return false;
}

Expand Down Expand Up @@ -308,4 +312,12 @@ public void closeModalWindow(AjaxRequestTarget target){
ModalWindow window = (ModalWindow) get(ID_MODAL_EDITOR);
window.close(target);
}

protected boolean getLabelVisibility(){
return true;
}

protected boolean getAddButtonVisibility(){
return true;
}
}
Expand Up @@ -108,7 +108,7 @@ protected List<MultiplicityPolicyConstraintType> load() {
};

GenericMultiValueLabelEditPanel minAssignments = new GenericMultiValueLabelEditPanel<MultiplicityPolicyConstraintType>(ID_MIN_ASSIGNMENTS,
minAssignmentModel, createStringResource("PageRoleEditor.label.minAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE){
minAssignmentModel, createStringResource("PageRoleEditor.label.minAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE, true){

@Override
protected void initDialog() {
Expand Down Expand Up @@ -144,7 +144,7 @@ protected MultiplicityPolicyConstraintType createNewEmptyItem() {
add(minAssignments);

GenericMultiValueLabelEditPanel maxAssignments = new GenericMultiValueLabelEditPanel<MultiplicityPolicyConstraintType>(ID_MAX_ASSIGNMENTS,
maxAssignmentsModel, createStringResource("PageRoleEditor.label.maxAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE){
maxAssignmentsModel, createStringResource("PageRoleEditor.label.maxAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE, true){

@Override
protected void initDialog() {
Expand Down
Expand Up @@ -46,7 +46,7 @@ public AdminGuiConfigPanel(String id, IModel<SystemConfigurationDto> model) {
private void initLayout(){
GenericMultiValueLabelEditPanel dashboardLinkEditor = new GenericMultiValueLabelEditPanel<RichHyperlinkType>(ID_DASHBOARD_LINK_EDITOR,
new PropertyModel<List<RichHyperlinkType>>(getModel(), "userDashboardLink"),
createStringResource("AdminGuiConfigPanel.dashboardLinksConfig"), LABEL_SIZE, INPUT_SIZE){
createStringResource("AdminGuiConfigPanel.dashboardLinksConfig"), LABEL_SIZE, INPUT_SIZE, true){

@Override
protected void initDialog() {
Expand Down Expand Up @@ -85,7 +85,7 @@ protected RichHyperlinkType createNewEmptyItem() {

GenericMultiValueLabelEditPanel additionalMenuItemEditor = new GenericMultiValueLabelEditPanel<RichHyperlinkType>(ID_ADDITIONAL_MENU_ITEM_EDITOR,
new PropertyModel<List<RichHyperlinkType>>(getModel(), "additionalMenuLink"),
createStringResource("AdminGuiConfigPanel.additionalMenuItemConfig"), LABEL_SIZE, INPUT_SIZE){
createStringResource("AdminGuiConfigPanel.additionalMenuItemConfig"), LABEL_SIZE, INPUT_SIZE, true){

@Override
protected void initDialog() {
Expand Down
Expand Up @@ -68,7 +68,7 @@ protected List<MultiplicityPolicyConstraintType> load() {
};

GenericMultiValueLabelEditPanel minAssignments = new GenericMultiValueLabelEditPanel<MultiplicityPolicyConstraintType>(ID_MIN_ASSIGNMENTS,
minAssignmentModel, createStringResource("PageRoleEditor.label.minAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE){
minAssignmentModel, createStringResource("PageRoleEditor.label.minAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE, true){

@Override
protected void initDialog() {
Expand Down Expand Up @@ -104,7 +104,7 @@ protected MultiplicityPolicyConstraintType createNewEmptyItem() {
add(minAssignments);

GenericMultiValueLabelEditPanel maxAssignments = new GenericMultiValueLabelEditPanel<MultiplicityPolicyConstraintType>(ID_MAX_ASSIGNMENTS,
maxAssignmentsModel, createStringResource("PageRoleEditor.label.maxAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE){
maxAssignmentsModel, createStringResource("PageRoleEditor.label.maxAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE, true){

@Override
protected void initDialog() {
Expand Down
Expand Up @@ -303,7 +303,7 @@ protected void rowSelected(AjaxRequestTarget target, IModel<OrgTableDto> row, Op

}

private ObjectQuery createSearchQuery(){
protected ObjectQuery createSearchQuery(){
OrgUnitSearchDto dto = searchModel.getObject();
ObjectQuery query = null;
ObjectQuery moveQuery;
Expand Down
Expand Up @@ -2166,6 +2166,8 @@ pageUser.userDetails=User details
MultipleAssignmentSelectorPanel.availableRoles=Available roles
MultipleAssignmentSelectorPanel.currentRoles=Current roles
MultipleAssignmentSelector.filterByUser=Filter by user
MultipleAssignmentSelector.tenant=Tenant
MultipleAssignmentSelector.orgUnit=Org. unit
pageWorkItem.accordionLabel.additionalData=Related data (technical information)
pageWorkItem.accordionLabel.objectNew=Object after proposed change (technical information)
pageWorkItem.accordionLabel.objectOld=Object before change (technical information)
Expand Down

0 comments on commit 9bd5991

Please sign in to comment.