use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class PrismOptionButtonPanel method initButtons.
private void initButtons(final IModel<ObjectWrapper> model) {
AjaxLink showEmpty = new AjaxLink("showEmptyButton") {
@Override
public void onClick(AjaxRequestTarget target) {
showEmptyOnClick(target);
}
};
add(showEmpty);
showEmpty.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !model.getObject().isReadonly();
}
});
Image showEmptyImg = new Image("showEmptyImg", new AbstractReadOnlyModel() {
@Override
public Object getObject() {
ObjectWrapper wrapper = model.getObject();
if (wrapper.isShowEmpty()) {
return new PackageResourceReference(PrismObjectPanel.class, "ShowEmptyFalse.png");
}
return new PackageResourceReference(PrismObjectPanel.class, "ShowEmptyTrue.png");
}
});
showEmptyImg.add(new AttributeAppender("title", new AbstractReadOnlyModel() {
@Override
public Object getObject() {
ObjectWrapper wrapper = model.getObject();
if (wrapper.isShowEmpty()) {
return getString("prismOptionButtonPanel.hideEmpty");
}
return getString("prismOptionButtonPanel.showEmpty");
}
}, ""));
showEmpty.add(showEmptyImg);
AjaxLink minimize = new AjaxLink("minimizeButton") {
@Override
public void onClick(AjaxRequestTarget target) {
minimizeOnClick(target);
}
};
add(minimize);
Image minimizeImg = new Image("minimizeImg", new AbstractReadOnlyModel() {
@Override
public Object getObject() {
ObjectWrapper wrapper = model.getObject();
if (wrapper.isMinimalized()) {
return new PackageResourceReference(PrismObjectPanel.class, "Maximize.png");
}
return new PackageResourceReference(PrismObjectPanel.class, "Minimize.png");
}
});
minimizeImg.add(new AttributeAppender("title", new AbstractReadOnlyModel() {
@Override
public Object getObject() {
ObjectWrapper wrapper = model.getObject();
if (wrapper.isMinimalized()) {
return getString("prismOptionButtonPanel.maximize");
}
return getString("prismOptionButtonPanel.minimize");
}
}, ""));
minimize.add(minimizeImg);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class PrismValuePanel method initLayout.
private void initLayout(IModel<String> labelModel, Form form, String valueCssClass, String inputCssClass) {
//container
WebMarkupContainer valueContainer = new WebMarkupContainer(ID_VALUE_CONTAINER);
valueContainer.setOutputMarkupId(true);
valueContainer.add(new AttributeModifier("class", valueCssClass));
add(valueContainer);
//feedback
FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK);
feedback.setOutputMarkupId(true);
add(feedback);
//input
Panel input = createInputComponent(ID_INPUT, labelModel, form);
input.add(new AttributeModifier("class", inputCssClass));
if (input instanceof InputPanel) {
initAccessBehaviour((InputPanel) input);
feedback.setFilter(new ComponentFeedbackMessageFilter(((InputPanel) input).getBaseFormComponent()));
} else if (input instanceof LockoutStatusPanel) {
feedback.setFilter(new ComponentFeedbackMessageFilter(input));
} else if (input instanceof ValueChoosePanel) {
feedback.setFilter(new ComponentFeedbackMessageFilter(input));
} else if (input instanceof AssociationValueChoicePanel) {
feedback.setFilter(new ComponentFeedbackMessageFilter(((AssociationValueChoicePanel) input).getTextComponent()));
}
valueContainer.add(input);
//buttons
AjaxLink addButton = new AjaxLink(ID_ADD_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
addValue(target);
}
};
addButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isAddButtonVisible();
}
});
valueContainer.add(addButton);
AjaxLink removeButton = new AjaxLink(ID_REMOVE_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
removeValue(target);
}
};
removeButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isRemoveButtonVisible();
}
});
valueContainer.add(removeButton);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class CheckTableHeader method initLayout.
private void initLayout() {
AjaxCheckBox check = new AjaxCheckBox(ID_CHECK, new PropertyModel<Boolean>(getModel(), ObjectWrapper.F_SELECTED)) {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
}
};
add(check);
Label icon = new Label(ID_ICON);
icon.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return "check-table-header-icon " + createAccountIcon();
}
}));
add(icon);
Label trigger = new Label(ID_TRIGGER);
trigger.add(AttributeModifier.replace("title", new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return createTriggerTooltip();
}
}));
trigger.add(new TooltipBehavior());
trigger.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return hasTriggers();
}
});
add(trigger);
BootstrapLabel status = new BootstrapLabel(ID_STATUS, createStringResource("CheckTableHeader.label.error"), new Model<>(BootstrapLabel.State.DANGER));
status.add(createFetchErrorVisibleBehaviour());
add(status);
AjaxLink showMore = new AjaxLink(ID_SHOW_MORE) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
onShowMorePerformed(target);
}
};
showMore.add(createFetchErrorVisibleBehaviour());
add(showMore);
AjaxLink link = new AjaxLink(ID_LINK) {
@Override
public void onClick(AjaxRequestTarget target) {
onClickPerformed(target);
}
};
add(link);
Label name = new Label(ID_NAME, new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return getDisplayName();
}
});
link.add(name);
Label description = new Label(ID_DESCRIPTION, new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return getDescription();
}
});
add(description);
ToggleIconButton expandButton = new ToggleIconButton(ID_EXPAND, GuiStyleConstants.CLASS_ICON_EXPAND, GuiStyleConstants.CLASS_ICON_COLLAPSE) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
onClickPerformed(target);
}
@Override
public boolean isOn() {
return !CheckTableHeader.this.getModelObject().isMinimalized();
}
};
add(expandButton);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class SimpleErrorPanel method initLayout.
@Override
protected void initLayout() {
Label icon = new Label(ID_ICON);
add(icon);
Label description = new Label(ID_DESCRIPTION, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return getDescription();
}
});
add(description);
AjaxLink link = new AjaxLink(ID_LINK) {
@Override
public void onClick(AjaxRequestTarget target) {
onShowMorePerformed(target);
}
};
add(link);
Label showMore = new Label(ID_SHOW_MORE, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return createStringResource("simpleErrorPanel.label.showMore").getString();
}
});
link.add(showMore);
}
use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.
the class AssociationValueChoicePanel method initLayout.
private void initLayout(final IModel<PrismContainerValue<ShadowAssociationType>> value, final List<PrismPropertyValue> values, final boolean required, Class<C> type) {
WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
textWrapper.setOutputMarkupId(true);
TextField<String> text = new TextField<>(ID_TEXT, createTextModel(value));
text.add(new AjaxFormComponentUpdatingBehavior("blur") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
}
});
text.setRequired(required);
text.setEnabled(false);
textWrapper.add(text);
FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
feedback.setFilter(new ComponentFeedbackMessageFilter(text));
textWrapper.add(feedback);
AjaxLink edit = new AjaxLink(ID_EDIT) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
editValuePerformed(target);
}
};
edit.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return model.getObject().isEmpty();
}
});
textWrapper.add(edit);
add(textWrapper);
initDialog(type, values);
}
Aggregations