use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class ResourceConnectorPanel method initLayout.
private void initLayout(final IModel<PrismObject<ResourceType>> model, final PageBase parentPage) {
setOutputMarkupId(true);
IModel<List<ConnectorOperationalStatus>> statsModel = new AbstractReadOnlyModel<List<ConnectorOperationalStatus>>() {
private static final long serialVersionUID = 1L;
@Override
public List<ConnectorOperationalStatus> getObject() {
PrismObject<ResourceType> resource = model.getObject();
Task task = parentPage.createSimpleTask(OPERATION_GET_CONNECTOR_OPERATIONAL_STATUS);
OperationResult result = task.getResult();
List<ConnectorOperationalStatus> status = null;
try {
status = parentPage.getModelInteractionService().getConnectorOperationalStatus(resource.getOid(), task, result);
} catch (SchemaException | ObjectNotFoundException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) {
LOGGER.error("Error getting connector status for {}: {}", resource, e.getMessage(), e);
parentPage.showResult(result);
}
return status;
}
};
ListView<ConnectorOperationalStatus> listview = new ListView<ConnectorOperationalStatus>(ID_CONNECTOR_LIST, statsModel) {
private static final long serialVersionUID = 1L;
protected void populateItem(ListItem<ConnectorOperationalStatus> item) {
item.add(new Label("label", item.getModel()));
IModel<ConnectorOperationalStatus> statModel = item.getModel();
item.add(createLabel(statModel, ID_CONNECTOR_NAME, ConnectorOperationalStatus.F_CONNECTOR_NAME));
item.add(createLabel(statModel, ID_CONNECOTR_CLASS, ConnectorOperationalStatus.F_CONNECTOR_CLASS_NAME));
item.add(createLabel(statModel, ID_POOL_CONFIG_MIN_SIZE, ConnectorOperationalStatus.F_POOL_CONFIG_MIN_SIZE));
item.add(createLabel(statModel, ID_POOL_CONFIG_MAX_SIZE, ConnectorOperationalStatus.F_POOL_CONFIG_MAX_SIZE));
item.add(createLabel(statModel, ID_POOL_CONFIG_MIN_IDLE, ConnectorOperationalStatus.F_POOL_CONFIG_MIN_IDLE));
item.add(createLabel(statModel, ID_POOL_CONFIG_MAX_IDLE, ConnectorOperationalStatus.F_POOL_CONFIG_MAX_IDLE));
item.add(createLabel(statModel, ID_POOL_CONFIG_WAIT_TIMEOUT, ConnectorOperationalStatus.F_POOL_CONFIG_WAIT_TIMEOUT));
item.add(createLabel(statModel, ID_POOL_CONFIG_MIN_EVICTABLE_IDLE_TIME, ConnectorOperationalStatus.F_POOL_CONFIG_MIN_EVICTABLE_IDLE_TIME));
item.add(createLabel(statModel, ID_POOL_STATUS_NUM_IDLE, ConnectorOperationalStatus.F_POOL_STATUS_NUM_IDLE));
item.add(createLabel(statModel, ID_POOL_STATUS_NUM_ACTIVE, ConnectorOperationalStatus.F_POOL_STATUS_NUM_ACTIVE));
}
};
add(listview);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class RunReportPopupPanel method createParameterPanel.
private WebMarkupContainer createParameterPanel(final IModel<JasperReportParameterDto> parameterModel) {
WebMarkupContainer paramPanel = new WebMarkupContainer("paramPanel");
paramPanel.setOutputMarkupId(true);
String paramValue = new PropertyModel<String>(parameterModel, "name").getObject();
StringResourceModel paramDisplay = PageBase.createStringResourceStatic(RunReportPopupPanel.this, "runReportPopupContent.param.name." + paramValue, new Object[] {});
// use display name rather than property name
paramPanel.add(new Label("name", paramDisplay));
String paramClass = new PropertyModel<String>(parameterModel, "nestedTypeAsString").getObject();
if (StringUtils.isBlank(paramClass)) {
paramClass = new PropertyModel<String>(parameterModel, "typeAsString").getObject();
}
paramClass = paramClass == null ? "" : paramClass.substring(paramClass.lastIndexOf(".") + 1);
paramPanel.add(new Label("type", paramClass));
ListView<JasperReportValueDto> listView = new ListView<JasperReportValueDto>(ID_VALUE_LIST, new PropertyModel<>(parameterModel, "value")) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<JasperReportValueDto> item) {
item.add(createInputMarkup(item.getModel(), parameterModel.getObject()));
}
};
listView.setOutputMarkupId(true);
paramPanel.add(listView);
return paramPanel;
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class PrismPropertyPanel method initLayout.
private void initLayout(final IModel<IW> model, final Form form) {
WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
labelContainer.setOutputMarkupId(true);
labelContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return labelContainerVisible;
}
});
add(labelContainer);
final IModel<String> label = createDisplayName(model);
labelContainer.add(new Label(ID_LABEL, label));
final IModel<String> helpText = new LoadableModel<String>(false) {
private static final long serialVersionUID = 1L;
@Override
protected String load() {
return loadHelpText(model);
}
};
Label help = new Label(ID_HELP);
help.add(AttributeModifier.replace("title", helpText));
help.add(new InfoTooltipBehavior());
help.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return StringUtils.isNotEmpty(helpText.getObject());
}
});
labelContainer.add(help);
WebMarkupContainer required = new WebMarkupContainer("required");
required.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
IW wrapper = model.getObject();
ItemDefinition def = wrapper.getItemDefinition();
if (ObjectType.F_NAME.equals(def.getName())) {
//fix for "name as required" MID-789
return true;
}
return def.isMandatory();
}
});
labelContainer.add(required);
WebMarkupContainer hasOutbound = new WebMarkupContainer("hasOutbound");
hasOutbound.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return hasOutbound(model);
}
});
labelContainer.add(hasOutbound);
WebMarkupContainer hasPendingModification = new WebMarkupContainer(ID_HAS_PENDING_MODIFICATION);
hasPendingModification.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return hasPendingModification(model);
}
});
labelContainer.add(hasPendingModification);
ListView<ValueWrapper> values = new ListView<ValueWrapper>("values", new PropertyModel<List<ValueWrapper>>(model, "values")) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<ValueWrapper> item) {
PrismValuePanel panel = new PrismValuePanel("value", item.getModel(), label, form, getValueCssClass(), getInputCssClass(), pageBase);
item.add(panel);
item.add(AttributeModifier.append("class", createStyleClassModel(item.getModel())));
item.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isVisibleValue(item.getModel());
}
});
}
};
values.add(new AttributeModifier("class", getValuesClass()));
values.setReuseItems(true);
add(values);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class InlineMenu method initLayout.
@Override
protected void initLayout() {
WebMarkupContainer menuItemContainer = new WebMarkupContainer(ID_MENU_ITEM_CONTAINER);
menuItemContainer.setOutputMarkupId(true);
menuItemContainer.add(new AttributeAppender("class", getMenuItemContainerClass()));
menuItemContainer.add(new AttributeAppender("style", getMenuItemContainerStyle()));
add(menuItemContainer);
AjaxButton menuItemButton = new AjaxButton(ID_MENU_ITEM_BUTTON) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
}
};
menuItemButton.setOutputMarkupId(true);
menuItemButton.add(new AttributeAppender("class", "dropdown-toggle " + getAdditionalButtonClass()));
menuItemButton.add(new AttributeAppender("style", getMenuItemButtonStyle()));
menuItemContainer.add(menuItemButton);
WebMarkupContainer icon = new WebMarkupContainer(ID_MENU_ITEM_ICON);
icon.setOutputMarkupId(true);
icon.add(new AttributeAppender("class", getIconClass()));
menuItemButton.add(icon);
ListView<InlineMenuItem> li = new ListView<InlineMenuItem>(ID_MENU_ITEM, getModel()) {
@Override
protected void populateItem(ListItem<InlineMenuItem> item) {
initMenuItem(item);
}
};
li.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
List list = InlineMenu.this.getModel().getObject();
return list != null && !list.isEmpty();
}
});
menuItemContainer.add(li);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class PrismContainerPanel method addOrReplaceProperties.
private void addOrReplaceProperties(IModel<ContainerWrapper> model, final Form form, boolean isToBeReplaced) {
ListView<ItemWrapper> properties = new ListView<ItemWrapper>("properties", new PropertyModel(model, "properties")) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<ItemWrapper> item) {
item.add(new PrismPropertyPanel("property", item.getModel(), form, pageBase));
item.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return item.getModel().getObject().isVisible();
}
});
item.add(AttributeModifier.append("class", createStyleClassModel(item.getModel())));
}
};
properties.setReuseItems(true);
if (isToBeReplaced) {
replace(properties);
} else {
add(properties);
}
}
Aggregations