Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
archetype implementation for creating new list object (not finished)
- Loading branch information
1 parent
5f2d0f1
commit 4c32757
Showing
16 changed files
with
249 additions
and
53 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
26 changes: 26 additions & 0 deletions
26
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/MultifunctionalButton.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 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!-- | ||
~ Copyright (c) 2010-2019 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. | ||
--> | ||
<wicket:panel xmlns:wicket="http://wicket.apache.org"> | ||
<button wicket:id="mainButton" type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" | ||
aria-haspopup="true" aria-expanded="false"> | ||
</button> | ||
<ul class="dropdown-menu"> | ||
<li> | ||
<div wicket:id="additionalButton" class="btn btn-sm" /> | ||
</li> | ||
</ul> | ||
</wicket:panel> |
119 changes: 119 additions & 0 deletions
119
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/MultifunctionalButton.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,119 @@ | ||
/* | ||
* Copyright (c) 2010-2019 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; | ||
|
||
import com.evolveum.midpoint.gui.api.GuiStyleConstants; | ||
import com.evolveum.midpoint.gui.api.component.BasePanel; | ||
import com.evolveum.midpoint.gui.impl.component.AjaxCompositedIconButton; | ||
import com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder; | ||
import com.evolveum.midpoint.gui.impl.component.icon.IconCssStyle; | ||
import com.evolveum.midpoint.web.component.util.VisibleBehaviour; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.behavior.AttributeAppender; | ||
import org.apache.wicket.markup.ComponentTag; | ||
import org.apache.wicket.markup.MarkupStream; | ||
import org.apache.wicket.markup.repeater.RepeatingView; | ||
import org.apache.wicket.model.Model; | ||
|
||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by honchar | ||
*/ | ||
public class MultifunctionalButton<S extends Serializable> extends BasePanel<S> { | ||
|
||
private static String ID_MAIN_BUTTON = "mainButton"; | ||
private static String ID_BUTTON = "additionalButton"; | ||
|
||
public MultifunctionalButton(String id){ | ||
super(id); | ||
} | ||
|
||
@Override | ||
protected void onInitialize(){ | ||
super.onInitialize(); | ||
initLayout(); | ||
} | ||
|
||
private void initLayout(){ | ||
List<S> additionalButtons = getAdditionalButtonsObjects(); | ||
|
||
CompositedIconBuilder builder = new CompositedIconBuilder(); | ||
builder.setBasicIcon(getDefaultButtonStyle(), IconCssStyle.IN_ROW_STYLE, "") | ||
.appendLayerIcon(GuiStyleConstants.CLASS_PLUS_CIRCLE, IconCssStyle.BOTTOM_RIGHT_STYLE, "green"); | ||
|
||
AjaxCompositedIconButton mainButton = new AjaxCompositedIconButton(ID_MAIN_BUTTON, builder.build(), | ||
createStringResource("MainObjectListPanel.newObject")) { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public void onClick(AjaxRequestTarget target) { | ||
if (!additionalButtonsExist()){ | ||
buttonClickPerformed(target, null); | ||
} | ||
} | ||
}; | ||
add(mainButton); | ||
|
||
RepeatingView buttonsPanel = new RepeatingView(ID_BUTTON); | ||
buttonsPanel.add(new VisibleBehaviour(() -> additionalButtonsExist())); | ||
add(buttonsPanel); | ||
|
||
if (additionalButtons != null){ | ||
additionalButtons.forEach(additionalButtonObject -> { | ||
AjaxIconButton newObjectIcon = new AjaxIconButton(buttonsPanel.newChildId(), new Model<>(GuiStyleConstants.CLASS_ASSIGN), | ||
createStringResource("MainObjectListPanel.newObject")) { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public void onClick(AjaxRequestTarget target) { | ||
buttonClickPerformed(target, additionalButtonObject); | ||
} | ||
|
||
@Override | ||
public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { | ||
super.onComponentTagBody(markupStream, openTag); | ||
} | ||
}; | ||
newObjectIcon.add(AttributeAppender.append("class", "btn btn-success btn-sm")); | ||
buttonsPanel.add(newObjectIcon); | ||
}); | ||
} | ||
} | ||
|
||
protected String getDefaultButtonStyle(){ | ||
return ""; | ||
} | ||
|
||
protected void buttonClickPerformed(AjaxRequestTarget target, S buttonObject){ | ||
|
||
} | ||
|
||
private boolean additionalButtonsExist(){ | ||
List additionalButtons = getAdditionalButtonsObjects(); | ||
return additionalButtons != null && additionalButtons.size() > 0; | ||
} | ||
|
||
protected List<S> getAdditionalButtonsObjects(){ | ||
return new ArrayList<>(); | ||
} | ||
|
||
|
||
} |
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.