use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class NameStep method createConnectorDropDown.
private DropDownFormGroup<PrismObject<ConnectorType>> createConnectorDropDown() {
return new DropDownFormGroup<PrismObject<ConnectorType>>(ID_CONNECTOR, selectedConnectorModel, relevantConnectorsModel, new IChoiceRenderer<PrismObject<ConnectorType>>() {
@Override
public PrismObject<ConnectorType> getObject(String id, IModel<? extends List<? extends PrismObject<ConnectorType>>> choices) {
return StringUtils.isNotBlank(id) ? choices.getObject().get(Integer.parseInt(id)) : null;
}
@Override
public Object getDisplayValue(PrismObject<ConnectorType> object) {
return WebComponentUtil.getName(object);
}
@Override
public String getIdValue(PrismObject<ConnectorType> object, int index) {
if (index < 0) {
// noinspection unchecked
List<PrismObject<ConnectorType>> connectors = (List<PrismObject<ConnectorType>>) getConnectorDropDown().getInput().getChoices();
for (PrismObject<ConnectorType> connector : connectors) {
if (connector.getOid().equals(selectedConnectorModel.getObject().getOid())) {
return Integer.toString(connectors.indexOf(connector));
}
}
}
return Integer.toString(index);
}
}, createStringResource("NameStep.connectorType"), "col-md-3", "col-md-6", true) {
@Override
protected DropDownChoice<PrismObject<ConnectorType>> createDropDown(String id, IModel<List<PrismObject<ConnectorType>>> choices, IChoiceRenderer<PrismObject<ConnectorType>> renderer, boolean required) {
DropDownChoice<PrismObject<ConnectorType>> choice = super.createDropDown(id, choices, renderer, required);
choice.add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(getConnectorDropDown().getAdditionalInfoComponent());
}
});
choice.setOutputMarkupId(true);
return choice;
}
@Override
protected Component createAdditionalInfoComponent(String id) {
Label l = new Label(id, schemaChangeWarningModel);
l.add(new AttributeAppender("class", "text-danger"));
l.setOutputMarkupId(true);
return l;
}
};
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class SceneButtonPanel method initLayout.
private void initLayout(final IModel<SceneDto> model) {
AjaxLink<String> minimize = new AjaxLink<String>(ID_MINIMIZE_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
minimizeOnClick(target);
}
};
add(minimize);
Label icon = new Label(ID_ICON);
icon.add(AttributeModifier.append("class", new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
SceneDto dto = model.getObject();
if (dto.isMinimized()) {
return GuiStyleConstants.CLASS_ICON_EXPAND;
}
return GuiStyleConstants.CLASS_ICON_COLLAPSE;
}
}));
minimize.add(icon);
icon.add(new AttributeAppender("title", new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
SceneDto dto = model.getObject();
if (dto.isMinimized()) {
return getString("prismOptionButtonPanel.maximize");
}
return getString("prismOptionButtonPanel.minimize");
}
}, ""));
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class OrgUnitAddDeletePopup method setState.
public void setState(ActionState state, AjaxRequestTarget target) {
this.state = state;
AjaxButton actionButton = (AjaxButton) getContent().get(ID_BUTTON_ACTION);
actionButton.setModel(createActionButtonStringResource());
actionButton.add(new AttributeAppender("class", getActionButtonClass()));
target.add(actionButton);
TablePanel panel = getTable();
DataTable table = panel.getDataTable();
ObjectDataProvider provider = (ObjectDataProvider) table.getDataProvider();
provider.setQuery(getDataProviderQuery());
target.add(panel);
}
use of org.apache.wicket.behavior.AttributeAppender in project webanno by webanno.
the class TextAreaFeatureEditor method createInputField.
@Override
protected AbstractTextComponent createInputField() {
TextArea<String> textarea = new TextArea<>("value");
textarea.add(new AjaxPreventSubmitBehavior());
try {
String traitsString = getModelObject().feature.getTraits();
StringFeatureTraits traits = JSONUtil.fromJsonString(StringFeatureTraits.class, traitsString);
textarea.add(new AttributeModifier("rows", traits.getCollapsedRows()));
textarea.add(new AttributeAppender("onfocus", "this.rows=" + traits.getExpandedRows() + ";"));
textarea.add(new AttributeAppender("onblur", "this.rows=" + traits.getCollapsedRows() + ";"));
} catch (IOException e) {
e.printStackTrace();
}
return textarea;
}
Aggregations