use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class MultiValueAutoCompleteTextPanel method initButtons.
private void initButtons(WebMarkupContainer buttonGroup, final ListItem<T> item, NonEmptyModel<Boolean> readOnlyModel) {
AjaxLink add = new AjaxLink(ID_ADD) {
@Override
public void onClick(AjaxRequestTarget target) {
addValuePerformed(target);
}
};
add.add(new AttributeAppender("class", getPlusClassModifier(item)));
add.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
buttonGroup.add(add);
AjaxLink remove = new AjaxLink(ID_REMOVE) {
@Override
public void onClick(AjaxRequestTarget target) {
removeValuePerformed(target, item);
}
};
remove.add(new AttributeAppender("class", getMinusClassModifier()));
remove.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
buttonGroup.add(remove);
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class MultiValueDropDownPanel method initLayout.
private void initLayout(final boolean nullValid, final NonEmptyModel<Boolean> readOnlyModel) {
WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
placeholderContainer.setOutputMarkupPlaceholderTag(true);
placeholderContainer.setOutputMarkupPlaceholderTag(true);
placeholderContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModel().getObject().isEmpty();
}
});
add(placeholderContainer);
AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {
@Override
public void onClick(AjaxRequestTarget target) {
addValuePerformed(target);
}
};
placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (buttonsDisabled()) {
return " " + CSS_DISABLED;
}
return "";
}
}));
placeholderAdd.setOutputMarkupId(true);
placeholderAdd.setOutputMarkupPlaceholderTag(true);
placeholderAdd.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
placeholderContainer.add(placeholderAdd);
ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {
@Override
protected void populateItem(final ListItem<T> item) {
DropDownChoice choice = new DropDownChoice<>(ID_INPUT, createDropDownItemModel(item.getModel()), createChoiceList(), createRenderer());
choice.setNullValid(nullValid);
choice.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
item.add(choice);
WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
item.add(buttonGroup);
initButtons(buttonGroup, item, readOnlyModel);
}
};
repeater.setOutputMarkupId(true);
repeater.setOutputMarkupPlaceholderTag(true);
repeater.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !getModel().getObject().isEmpty();
}
});
add(repeater);
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class MultiValueDropDownPanel method initButtons.
private void initButtons(WebMarkupContainer buttonGroup, final ListItem<T> item, NonEmptyModel<Boolean> readOnlyModel) {
AjaxLink add = new AjaxLink(ID_ADD) {
@Override
public void onClick(AjaxRequestTarget target) {
addValuePerformed(target);
}
};
add.add(new AttributeAppender("class", getPlusClassModifier(item)));
add.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
buttonGroup.add(add);
AjaxLink remove = new AjaxLink(ID_REMOVE) {
@Override
public void onClick(AjaxRequestTarget target) {
removeValuePerformed(target, item);
}
};
remove.add(new AttributeAppender("class", getMinusClassModifier()));
remove.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
buttonGroup.add(remove);
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class TextFormGroup method initLayout.
private void initLayout(IModel<String> label, final String tooltipKey, boolean isTooltipInModal, String labelSize, String textSize, final boolean required, final boolean markAsRequired) {
WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
add(labelContainer);
Label l = new Label(ID_LABEL, label);
if (StringUtils.isNotEmpty(labelSize)) {
labelContainer.add(AttributeAppender.prepend("class", labelSize));
}
labelContainer.add(l);
Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return getString(tooltipKey);
}
}));
tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
tooltipLabel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return tooltipKey != null;
}
});
tooltipLabel.setOutputMarkupId(true);
tooltipLabel.setOutputMarkupPlaceholderTag(true);
labelContainer.add(tooltipLabel);
WebMarkupContainer requiredContainer = new WebMarkupContainer(ID_REQUIRED);
requiredContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return markAsRequired;
}
});
labelContainer.add(requiredContainer);
WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
if (StringUtils.isNotEmpty(textSize)) {
textWrapper.add(AttributeAppender.prepend("class", textSize));
}
add(textWrapper);
TextField text = createText(getModel(), label, required);
text.setLabel(label);
textWrapper.add(text);
FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ContainerFeedbackMessageFilter(this));
feedback.setOutputMarkupId(true);
textWrapper.add(feedback);
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class PageTasks method initLayout.
private void initLayout() {
refreshPanel = new AutoRefreshPanel(ID_REFRESH_PANEL, refreshModel, this, false);
add(refreshPanel);
Form mainForm = new Form(ID_MAIN_FORM);
add(mainForm);
List<IColumn<TaskDto, String>> taskColumns = initTaskColumns();
TaskDtoProviderOptions options = TaskDtoProviderOptions.minimalOptions();
options.setGetNextRunStartTime(true);
options.setUseClusterInformation(true);
options.setResolveObjectRef(true);
TaskDtoProvider provider = new TaskDtoProvider(PageTasks.this, options) {
@Override
protected void saveProviderPaging(ObjectQuery query, ObjectPaging paging) {
TasksStorage storage = getSessionStorage().getTasks();
storage.setPaging(paging);
}
@Override
public TaskDto createTaskDto(PrismObject<TaskType> task, Task opTask, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException {
TaskDto dto = super.createTaskDto(task, opTask, result);
addInlineMenuToTaskRow(dto);
return dto;
}
};
provider.setQuery(createTaskQuery());
BoxedTablePanel<TaskDto> taskTable = new BoxedTablePanel(ID_TASK_TABLE, provider, taskColumns, UserProfileStorage.TableId.PAGE_TASKS_PANEL, (int) getItemsPerPage(UserProfileStorage.TableId.PAGE_TASKS_PANEL)) {
@Override
protected WebMarkupContainer createHeader(String headerId) {
return new SearchFragment(headerId, ID_TABLE_HEADER, PageTasks.this, searchModel);
}
@Override
protected WebMarkupContainer createButtonToolbar(String id) {
String fileName = "TaskType_" + createStringResource("MainObjectListPanel.exportFileName").getString();
CSVDataExporter csvDataExporter = new CSVDataExporter();
ResourceStreamResource resource = (new ResourceStreamResource() {
protected IResourceStream getResourceStream() {
return new ExportToolbar.DataExportResourceStreamWriter(csvDataExporter, getTaskTable().getDataTable());
}
}).setFileName(fileName + "." + csvDataExporter.getFileNameExtension());
AbstractLink exportDataLink = (new ResourceLink(id, resource)).setBody(csvDataExporter.getDataFormatNameModel());
exportDataLink.add(new AttributeAppender("class", " btn btn-primary btn-sm"));
return exportDataLink;
}
};
taskTable.setOutputMarkupId(true);
TasksStorage storage = getSessionStorage().getTasks();
taskTable.setCurrentPage(storage.getPaging());
mainForm.add(taskTable);
List<IColumn<NodeDto, String>> nodeColumns = initNodeColumns();
BoxedTablePanel nodeTable = new BoxedTablePanel(ID_NODE_TABLE, new NodeDtoProvider(PageTasks.this) {
@Override
public NodeDto createNodeDto(PrismObject<NodeType> node) {
NodeDto dto = super.createNodeDto(node);
addInlineMenuToNodeRow(dto);
return dto;
}
}, nodeColumns, UserProfileStorage.TableId.PAGE_TASKS_NODES_PANEL, (int) getItemsPerPage(UserProfileStorage.TableId.PAGE_TASKS_NODES_PANEL));
nodeTable.setOutputMarkupId(true);
nodeTable.setShowPaging(false);
mainForm.add(nodeTable);
initDiagnosticButtons();
}
Aggregations