Skip to content

Commit

Permalink
fix for MID-2166 - upper links in RW now behave as they should before.
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Suta committed Jan 26, 2015
1 parent cc43679 commit 9505f26
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
Expand Up @@ -203,10 +203,14 @@ private void changeStep(AjaxRequestTarget target, WizardStepDto dto){
}
}

Wizard.this.onActiveStepChanged(newStep);
WizardModel model = (WizardModel) getWizardModel();
model.setActiveStep(newStep);
getWizardModel().getActiveStep().applyState();
IWizardStep currentStep = model.getActiveStep();
currentStep.applyState();

if(currentStep.isComplete()){
model.setActiveStep(newStep);
onActiveStepChanged(newStep);
}

target.add(this);
}
Expand Down
Expand Up @@ -20,7 +20,11 @@
<div wicket:id="helpModal" />

<div class="wizard">
<a wicket:id="link"><span wicket:id="label"/></a>
<span wicket:id="linkRepeater">
<a wicket:id="link">
<span wicket:id="label"/>
</a>
</span>
<button wicket:id="help" style="float: right" class="btn btn-sm btn-primary"><span style="font-size: 1.5em" class="glyphicon glyphicon-question-sign"></span></button>
</div>
</wicket:panel>
Expand Down
Expand Up @@ -20,12 +20,13 @@
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.component.wizard.resource.component.WizardHelpDialog;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxEventBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.extensions.wizard.IWizardStep;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.AbstractReadOnlyModel;
Expand All @@ -39,6 +40,7 @@
*/
public class WizardSteps extends SimplePanel<List<WizardStepDto>> {

private static final String ID_LINK_REPEATER = "linkRepeater";
private static final String ID_LINK = "link";
private static final String ID_LABEL = "label";
private static final String ID_BUTTON_HELP = "help";
Expand All @@ -50,15 +52,23 @@ public WizardSteps(String id, IModel<List<WizardStepDto>> model) {

@Override
protected void initLayout() {
ListView<WizardStepDto> link = new ListView<WizardStepDto>(ID_LINK, getModel()) {
ListView<WizardStepDto> linkContainer = new ListView<WizardStepDto>(ID_LINK_REPEATER, getModel()) {

@Override
protected void populateItem(ListItem<WizardStepDto> item) {
final WizardStepDto dto = item.getModelObject();
Label label = new Label(ID_LABEL, createLabelModel(dto.getName()));
item.add(label);
item.setRenderBodyOnly(true);

item.add(new VisibleEnableBehaviour() {
AjaxSubmitLink button = new AjaxSubmitLink(ID_LINK) {

@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
changeStepPerformed(target, dto);
}
};
item.add(button);

button.add(new VisibleEnableBehaviour() {

@Override
public boolean isEnabled() {
Expand All @@ -71,25 +81,19 @@ public boolean isVisible() {
}
});


item.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<String>() {
button.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<String>() {

@Override
public String getObject() {
return dto.isActive() ? "current" : null;
}
}));

item.add(new AjaxEventBehavior("onclick") {

@Override
protected void onEvent(AjaxRequestTarget target) {
changeStepPerformed(target, dto);
}
});
Label label = new Label(ID_LABEL, createLabelModel(dto.getName()));
button.add(label);
}
};
add(link);
add(linkContainer);

AjaxLink help = new AjaxLink(ID_BUTTON_HELP) {

Expand Down
Expand Up @@ -354,7 +354,7 @@ private RefinedResourceSchema loadResourceSchema() {
return null;
}

return RefinedResourceSchema.getRefinedSchema(getModel().getObject(), getPageBase().getPrismContext());
return RefinedResourceSchema.getRefinedSchema(resource, getPageBase().getPrismContext());
} catch (Exception ex) {
LoggingUtils.logException(LOGGER, "Couldn't parse resource schema.", ex);
getSession().error(getString("SchemaListPanel.message.couldntParseSchema") + " " + ex.getMessage());
Expand Down

0 comments on commit 9505f26

Please sign in to comment.