-
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.
adding first two steps of new resource wizard
- Loading branch information
Showing
19 changed files
with
1,048 additions
and
10 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
28 changes: 28 additions & 0 deletions
28
...in-gui/src/main/java/com/evolveum/midpoint/gui/api/component/wizard/BasicWizardPanel.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,28 @@ | ||
<!-- | ||
~ Copyright (c) 2010-2018 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> | ||
<div class="d-flex flex-column align-items-center mt-3"> | ||
<h2 class="mb-3 font-weight-bold " wicket:id="text"/> | ||
<h5 class="text-secondary" wicket:id="subText"/> | ||
<div wicket:id="content"/> | ||
<div class="d-flex gap-3 justify-content-center mt-5"> | ||
<a class="btn btn-outline-primary" wicket:id="back"> | ||
<i class="fas fa-arrow-left mr-2"></i> | ||
<wicket:message key="WizardHeader.back"/> | ||
</a> | ||
<a class="btn btn-success" wicket:id="next"> | ||
<wicket:message key="WizardHeader.next"/> | ||
<span wicket:id="nextLabel"/> | ||
<i class="fas fa-arrow-right ml-2"></i> | ||
</a> | ||
</div> | ||
</div> | ||
</wicket:panel> | ||
</html> |
127 changes: 127 additions & 0 deletions
127
...in-gui/src/main/java/com/evolveum/midpoint/gui/api/component/wizard/BasicWizardPanel.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,127 @@ | ||
/* | ||
* 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.gui.api.component.wizard; | ||
|
||
import com.evolveum.midpoint.gui.api.component.BasePanel; | ||
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; | ||
|
||
import org.apache.wicket.Component; | ||
import org.apache.wicket.MarkupContainer; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.ajax.markup.html.AjaxLink; | ||
import org.apache.wicket.markup.html.WebMarkupContainer; | ||
import org.apache.wicket.markup.html.basic.Label; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.model.Model; | ||
|
||
/** | ||
* @author lskublik | ||
*/ | ||
public class BasicWizardPanel extends BasePanel implements WizardPanel{ | ||
|
||
private static final String ID_TEXT = "text"; | ||
private static final String ID_SUBTEXT = "subText"; | ||
|
||
private static final String ID_CONTENT = "content"; | ||
private static final String ID_BACK = "back"; | ||
private static final String ID_NEXT = "next"; | ||
private static final String ID_NEXT_LABEL = "nextLabel"; | ||
|
||
public BasicWizardPanel(String id) { | ||
super(id); | ||
} | ||
|
||
@Override | ||
protected void onInitialize() { | ||
super.onInitialize(); | ||
|
||
initLayout(); | ||
} | ||
|
||
private void initLayout() { | ||
|
||
add(new Label(ID_TEXT, getTextModel())); | ||
add(new Label(ID_SUBTEXT, getSubTextModel())); | ||
|
||
add(createContentPanel(ID_CONTENT)); | ||
|
||
AjaxLink back = new AjaxLink<>(ID_BACK) { | ||
|
||
@Override | ||
public void onClick(AjaxRequestTarget target) { | ||
onBackPerformed(target); | ||
} | ||
}; | ||
back.add(getBackBehaviour()); | ||
back.setOutputMarkupId(true); | ||
back.setOutputMarkupPlaceholderTag(true); | ||
add(back); | ||
|
||
AjaxLink next = new AjaxLink<>(ID_NEXT) { | ||
|
||
@Override | ||
public void onClick(AjaxRequestTarget target) { | ||
onNextPerformed(target); | ||
} | ||
}; | ||
next.add(getNextBehaviour()); | ||
next.setOutputMarkupId(true); | ||
next.setOutputMarkupPlaceholderTag(true); | ||
add(next); | ||
|
||
Label nextLabel = new Label(ID_NEXT_LABEL, createNextStepLabel()); | ||
next.add(nextLabel); | ||
|
||
} | ||
|
||
protected Component createContentPanel(String id) { | ||
return new WebMarkupContainer(id); | ||
} | ||
|
||
protected IModel<?> getTextModel() { | ||
return Model.of(); | ||
} | ||
|
||
protected IModel<?> getSubTextModel() { | ||
return Model.of(); | ||
} | ||
|
||
private IModel<?> createNextStepLabel() { | ||
MarkupContainer parent = getParent(); | ||
if (parent instanceof WizardBorder) { | ||
WizardPanel panel = ((WizardBorder) parent).getNextPanel(); | ||
return panel.getTitle(); | ||
} | ||
return Model.of(); | ||
} | ||
|
||
private void onNextPerformed(AjaxRequestTarget target) { | ||
MarkupContainer parent = getParent(); | ||
if (parent instanceof WizardBorder) { | ||
((WizardBorder) parent).nextStep(target); | ||
} | ||
} | ||
|
||
protected void onBackPerformed(AjaxRequestTarget target) { | ||
MarkupContainer parent = getParent(); | ||
if (parent instanceof WizardBorder) { | ||
WizardBorder wizard = (WizardBorder) parent; | ||
int index = wizard.getModel().getObject().getActiveStepIndex(); | ||
if (index > 0) { | ||
wizard.previousStep(target); | ||
return; | ||
} | ||
} | ||
getPageBase().redirectBack(); | ||
} | ||
|
||
@Override | ||
public VisibleEnableBehaviour getHeaderBehaviour() { | ||
return VisibleEnableBehaviour.ALWAYS_INVISIBLE; | ||
} | ||
} |
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.