use of org.apache.wicket.AttributeModifier 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.AttributeModifier in project midpoint by Evolveum.
the class PrismHeaderPanel method initLayout.
private void initLayout(final IModel model) {
VisibleEnableBehaviour buttonsVisibleBehaviour = new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return PrismHeaderPanel.this.isButtonsVisible();
}
};
ToggleIconButton showMetadataButton = new ToggleIconButton(ID_SHOW_METADATA, GuiStyleConstants.CLASS_ICON_SHOW_METADATA, GuiStyleConstants.CLASS_ICON_SHOW_METADATA) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ObjectWrapper objectWrapper = getObjectWrapper(model);
objectWrapper.setShowMetadata(!objectWrapper.isShowMetadata());
onButtonClick(target);
}
@Override
public boolean isOn() {
return getObjectWrapper(model).isShowMetadata();
}
};
showMetadataButton.add(new AttributeModifier("title", getObjectWrapper(model) == null ? "" : (getObjectWrapper(model).isShowMetadata() ? createStringResource("PrismObjectPanel.hideMetadata") : createStringResource("PrismObjectPanel.showMetadata"))));
showMetadataButton.add(buttonsVisibleBehaviour);
add(showMetadataButton);
ToggleIconButton showEmptyFieldsButton = new ToggleIconButton(ID_SHOW_EMPTY_FIELDS, GuiStyleConstants.CLASS_ICON_SHOW_EMPTY_FIELDS, GuiStyleConstants.CLASS_ICON_NOT_SHOW_EMPTY_FIELDS) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ObjectWrapper objectWrapper = getObjectWrapper(model);
objectWrapper.setShowEmpty(!objectWrapper.isShowEmpty());
onButtonClick(target);
}
@Override
public boolean isOn() {
return getObjectWrapper(model).isShowEmpty();
}
};
showEmptyFieldsButton.setMarkupId(ID_SHOW_EMPTY_FIELDS);
showEmptyFieldsButton.add(buttonsVisibleBehaviour);
add(showEmptyFieldsButton);
ToggleIconButton sortPropertiesButton = new ToggleIconButton(ID_SORT_PROPERTIES, GuiStyleConstants.CLASS_ICON_SORT_ALPHA_ASC, GuiStyleConstants.CLASS_ICON_SORT_AMOUNT_ASC) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ObjectWrapper objectWrapper = getObjectWrapper(model);
objectWrapper.setSorted(!objectWrapper.isSorted());
objectWrapper.sort((PageBase) getPage());
onButtonClick(target);
}
@Override
public boolean isOn() {
return getObjectWrapper(model).isSorted();
}
};
sortPropertiesButton.add(buttonsVisibleBehaviour);
add(sortPropertiesButton);
IModel<String> headerLabelModel = new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
Object wrapper = model.getObject();
String displayName = null;
if (wrapper instanceof ContainerWrapper) {
displayName = ((ContainerWrapper) wrapper).getDisplayName();
} else if (wrapper instanceof ObjectWrapper) {
// HACK HACK HACK
// If we would display label for the object itself, display label for main container instead
// the "object label" is actually displayed in front of main container
ContainerWrapper mainContainerWrapper = ((ObjectWrapper) wrapper).findMainContainerWrapper();
if (mainContainerWrapper != null) {
displayName = mainContainerWrapper.getDisplayName();
} else {
// e.g. resource wizard needs this
displayName = ((ObjectWrapper) wrapper).getDisplayName();
}
}
return getString(displayName, null, displayName);
}
};
add(new Label(ID_LABEL, headerLabelModel));
}
use of org.apache.wicket.AttributeModifier in project midpoint by Evolveum.
the class SceneItemLinePanel method initLayout.
private void initLayout() {
WebMarkupContainer nameCell = new WebMarkupContainer(ID_NAME_CONTAINER);
nameCell.add(new AttributeModifier("rowspan", new PropertyModel<Integer>(getModel(), SceneItemLineDto.F_NUMBER_OF_LINES)));
Label label = new Label("name", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
final SceneItemLineDto lineDto = getModel().getObject();
if (lineDto == null || lineDto.getName() == null) {
return null;
}
String key = lineDto.getName();
return getLocalizer().getString(key, SceneItemLinePanel.this, key);
}
});
nameCell.add(label);
nameCell.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject().isFirst();
}
});
add(nameCell);
WebMarkupContainer oldValueCell = new WebMarkupContainer(ID_OLD_VALUE_CONTAINER);
oldValueCell.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject().isDelta();
}
});
SceneItemValuePanel sivp = new SceneItemValuePanel(ID_OLD_VALUE, new PropertyModel<SceneItemValue>(getModel(), SceneItemLineDto.F_OLD_VALUE));
sivp.setRenderBodyOnly(true);
oldValueCell.add(sivp);
ImagePanel oldValueImagePanel = new ImagePanel(ID_OLD_VALUE_IMAGE, Model.of(GuiStyleConstants.CLASS_MINUS_CIRCLE_DANGER), createStringResource("SceneItemLinePanel.removedValue"));
oldValueImagePanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return getModelObject().getOldValue() != null && getModelObject().getOldValue().getSourceValue() != null;
}
});
oldValueCell.add(oldValueImagePanel);
add(oldValueCell);
WebMarkupContainer newValueCell = new WebMarkupContainer(ID_NEW_VALUE_CONTAINER);
sivp = new SceneItemValuePanel(ID_NEW_VALUE, new PropertyModel<SceneItemValue>(getModel(), SceneItemLineDto.F_NEW_VALUE));
sivp.setRenderBodyOnly(true);
newValueCell.add(sivp);
newValueCell.add(new AttributeModifier("colspan", new AbstractReadOnlyModel<Integer>() {
@Override
public Integer getObject() {
return !getModelObject().isDelta() && getModelObject().isDeltaScene() ? 2 : 1;
}
}));
newValueCell.add(new AttributeModifier("align", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return !getModelObject().isDelta() && getModelObject().isDeltaScene() ? "center" : null;
}
}));
ImagePanel newValueImagePanel = new ImagePanel(ID_NEW_VALUE_IMAGE, !getModelObject().isDelta() && getModelObject().isDeltaScene() ? Model.of(GuiStyleConstants.CLASS_CIRCLE_FULL) : Model.of(GuiStyleConstants.CLASS_PLUS_CIRCLE_SUCCESS), !getModelObject().isDelta() && getModelObject().isDeltaScene() ? createStringResource("SceneItemLinePanel.unchangedValue") : createStringResource("SceneItemLinePanel.addedValue"));
newValueImagePanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return getModelObject().getNewValue() != null && getModelObject().getNewValue().getSourceValue() != null;
}
});
newValueImagePanel.add(new AttributeAppender("style", !getModelObject().isDelta() && getModelObject().isDeltaScene() ? "float: left; margin-right: 5px; width: 30%; position: absolute;" : "float: left; margin-right: 5px;"));
newValueCell.add(newValueImagePanel);
add(newValueCell);
}
use of org.apache.wicket.AttributeModifier in project midpoint by Evolveum.
the class TaskBasicTabPanel method initLayoutBasic.
private void initLayoutBasic() {
// Name
WebMarkupContainer nameContainer = new WebMarkupContainer(ID_NAME_CONTAINER);
RequiredTextField<String> name = new RequiredTextField<>(ID_NAME, new PropertyModel<String>(taskDtoModel, TaskDto.F_NAME));
name.add(parentPage.createEnabledIfEdit(new ItemPath(TaskType.F_NAME)));
name.add(new AttributeModifier("style", "width: 100%"));
name.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
nameContainer.add(name);
nameContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_NAME)));
add(nameContainer);
// Description
WebMarkupContainer descriptionContainer = new WebMarkupContainer(ID_DESCRIPTION_CONTAINER);
TextArea<String> description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(taskDtoModel, TaskDto.F_DESCRIPTION));
description.add(parentPage.createEnabledIfEdit(new ItemPath(TaskType.F_DESCRIPTION)));
// description.add(new AttributeModifier("style", "width: 100%"));
// description.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
descriptionContainer.add(description);
descriptionContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_DESCRIPTION)));
add(descriptionContainer);
// OID
Label oid = new Label(ID_OID, new PropertyModel(getObjectWrapperModel(), ID_OID));
add(oid);
// Identifier
WebMarkupContainer identifierContainer = new WebMarkupContainer(ID_IDENTIFIER_CONTAINER);
identifierContainer.add(new Label(ID_IDENTIFIER, new PropertyModel(taskDtoModel, TaskDto.F_IDENTIFIER)));
identifierContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_TASK_IDENTIFIER)));
add(identifierContainer);
// Category
WebMarkupContainer categoryContainer = new WebMarkupContainer(ID_CATEGORY_CONTAINER);
categoryContainer.add(new Label(ID_CATEGORY, WebComponentUtil.createCategoryNameModel(this, new PropertyModel(taskDtoModel, TaskDto.F_CATEGORY))));
categoryContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_CATEGORY)));
add(categoryContainer);
// Parent
WebMarkupContainer parentContainer = new WebMarkupContainer(ID_PARENT_CONTAINER);
final LinkPanel parent = new LinkPanel(ID_PARENT, new PropertyModel<String>(taskDtoModel, TaskDto.F_PARENT_TASK_NAME)) {
@Override
public void onClick(AjaxRequestTarget target) {
String oid = taskDtoModel.getObject().getParentTaskOid();
if (oid != null) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, oid);
getPageBase().navigateToNext(PageTaskEdit.class, parameters);
}
}
};
parentContainer.add(parent);
parentContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_PARENT)));
add(parentContainer);
// Owner
WebMarkupContainer ownerContainer = new WebMarkupContainer(ID_OWNER_CONTAINER);
final LinkPanel owner = new LinkPanel(ID_OWNER, new PropertyModel<String>(taskDtoModel, TaskDto.F_OWNER_NAME)) {
@Override
public void onClick(AjaxRequestTarget target) {
String oid = taskDtoModel.getObject().getOwnerOid();
if (oid != null) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, oid);
getPageBase().navigateToNext(PageUser.class, parameters);
}
}
};
ownerContainer.add(owner);
ownerContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_OWNER_REF)));
add(ownerContainer);
// Handler URI
ListView<String> handlerUriContainer = new ListView<String>(ID_HANDLER_URI_CONTAINER, new PropertyModel(taskDtoModel, TaskDto.F_HANDLER_URI_LIST)) {
@Override
protected void populateItem(ListItem<String> item) {
item.add(new Label(ID_HANDLER_URI, item.getModelObject()));
}
};
handlerUriContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_HANDLER_URI), new ItemPath(TaskType.F_OTHER_HANDLERS_URI_STACK)));
add(handlerUriContainer);
// Execution
WebMarkupContainer executionContainer = new WebMarkupContainer(ID_EXECUTION_CONTAINER);
Label execution = new Label(ID_EXECUTION, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
TaskDtoExecutionStatus executionStatus = taskDtoModel.getObject().getExecution();
if (executionStatus != TaskDtoExecutionStatus.CLOSED) {
return getString(TaskDtoExecutionStatus.class.getSimpleName() + "." + executionStatus.name());
} else {
return getString(TaskDtoExecutionStatus.class.getSimpleName() + "." + executionStatus.name() + ".withTimestamp", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (taskDtoModel.getObject().getCompletionTimestamp() != null) {
// todo correct formatting
return new Date(taskDtoModel.getObject().getCompletionTimestamp()).toLocaleString();
} else {
return "?";
}
}
});
}
}
});
executionContainer.add(execution);
Label node = new Label(ID_NODE, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
TaskDto dto = taskDtoModel.getObject();
if (!TaskDtoExecutionStatus.RUNNING.equals(dto.getExecution())) {
return null;
}
return parentPage.getString("pageTaskEdit.message.node", dto.getExecutingAt());
}
});
executionContainer.add(node);
executionContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_EXECUTION_STATUS), new ItemPath(TaskType.F_NODE_AS_OBSERVED)));
add(executionContainer);
}
use of org.apache.wicket.AttributeModifier in project midpoint by Evolveum.
the class MultipleAssignmentSelector method updateBoxedTablePanelStyles.
private void updateBoxedTablePanelStyles(BoxedTablePanel panel) {
panel.getDataTableContainer().add(new AttributeAppender("class", " multiple-assignment-selector-table-container"));
panel.getDataTable().add(new AttributeModifier("class", "multiple-assignment-selector-table"));
panel.getFooterPaging().getParent().add(new AttributeModifier("class", "multiple-assignment-selector-table-footer"));
}
Aggregations