Search in sources :

Example 41 with Component

use of org.apache.wicket.Component in project midpoint by Evolveum.

the class TabbedPanel method setCurrentTab.

private void setCurrentTab(int index) {
    if (this.currentTab == index) {
        // already current
        return;
    }
    this.currentTab = index;
    final Component component;
    if (currentTab == -1 || (tabs.getObject().size() == 0) || !getVisiblityCache().isVisible(currentTab)) {
        // no tabs or the current tab is not visible
        component = newPanel();
    } else {
        // show panel from selected tab
        T tab = tabs.getObject().get(currentTab);
        component = tab.getPanel(TAB_PANEL_ID);
        if (component == null) {
            throw new WicketRuntimeException("ITab.getPanel() returned null. TabbedPanel [" + getPath() + "] ITab index [" + currentTab + "]");
        }
    }
    if (!component.getId().equals(TAB_PANEL_ID)) {
        throw new WicketRuntimeException("ITab.getPanel() returned a panel with invalid id [" + component.getId() + "]. You must always return a panel with id equal to the provided panelId parameter. TabbedPanel [" + getPath() + "] ITab index [" + currentTab + "]");
    }
    addOrReplace(component);
}
Also used : WicketRuntimeException(org.apache.wicket.WicketRuntimeException) Component(org.apache.wicket.Component)

Example 42 with Component

use of org.apache.wicket.Component in project midpoint by Evolveum.

the class CatalogItemsPanel method initLayout.

private void initLayout() {
    setOutputMarkupId(true);
    Component assignmentsTable;
    if (isCatalogOidEmpty()) {
        assignmentsTable = new Label(ID_MULTI_BUTTON_TABLE, createStringResource("PageAssignmentShoppingKart.roleCatalogIsNotConfigured"));
    } else {
        assignmentsTable = new MultiButtonTable(ID_MULTI_BUTTON_TABLE, itemsPerRow, itemsListModel, pageBase);
    }
    assignmentsTable.setOutputMarkupId(true);
    add(assignmentsTable);
    add(createFooter(ID_FOOTER));
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) Component(org.apache.wicket.Component)

Example 43 with Component

use of org.apache.wicket.Component in project midpoint by Evolveum.

the class LimitationsEditorDialog method initLimitationBody.

private void initLimitationBody(final WebMarkupContainer body, ListItem<PropertyLimitationsTypeDto> item) {
    CheckFormGroup schema = new CheckFormGroup(ID_LAYER_SCHEMA, new PropertyModel<Boolean>(item.getModelObject(), PropertyLimitationsTypeDto.F_SCHEMA), createStringResource("LimitationsEditorDialog.label.schema"), ID_LABEL_SIZE, ID_INPUT_SIZE);
    schema.getCheck().add(prepareAjaxOnComponentTagUpdateBehavior());
    body.add(schema);
    CheckFormGroup model = new CheckFormGroup(ID_LAYER_MODEL, new PropertyModel<Boolean>(item.getModelObject(), PropertyLimitationsTypeDto.F_MODEL), createStringResource("LimitationsEditorDialog.label.model"), ID_LABEL_SIZE, ID_INPUT_SIZE);
    model.getCheck().add(prepareAjaxOnComponentTagUpdateBehavior());
    body.add(model);
    CheckFormGroup presentation = new CheckFormGroup(ID_LAYER_PRESENTATION, new PropertyModel<Boolean>(item.getModelObject(), PropertyLimitationsTypeDto.F_PRESENTATION), createStringResource("LimitationsEditorDialog.label.presentation"), ID_LABEL_SIZE, ID_INPUT_SIZE);
    presentation.getCheck().add(prepareAjaxOnComponentTagUpdateBehavior());
    body.add(presentation);
    DropDownChoicePanel add = new DropDownChoicePanel(ID_ACCESS_ADD, getAddPropertyAccessModel(item.getModel()), WebComponentUtil.createReadonlyModelFromEnum(PropertyAccess.class), false);
    FormComponent<PropertyAccess> addInput = add.getBaseFormComponent();
    addInput.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    addInput.add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    DropDownChoicePanel read = new DropDownChoicePanel(ID_ACCESS_READ, getReadPropertyAccessModel(item.getModel()), WebComponentUtil.createReadonlyModelFromEnum(PropertyAccess.class), false);
    FormComponent<PropertyAccess> readInput = read.getBaseFormComponent();
    readInput.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    readInput.add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    DropDownChoicePanel modify = new DropDownChoicePanel(ID_ACCESS_MODIFY, getModifyPropertyAccessModel(item.getModel()), WebComponentUtil.createReadonlyModelFromEnum(PropertyAccess.class), false);
    FormComponent<PropertyAccess> modifyInput = modify.getBaseFormComponent();
    modifyInput.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    modifyInput.add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    body.add(add);
    body.add(read);
    body.add(modify);
    TextFormGroup minOccurs = new TextFormGroup(ID_MIN_OCCURS, new PropertyModel<String>(item.getModelObject(), PropertyLimitationsTypeDto.F_LIMITATION + ".minOccurs"), createStringResource("LimitationsEditorDialog.label.minOccurs"), "SchemaHandlingStep.limitations.tooltip.minOccurs", true, ID_LABEL_SIZE, ID_INPUT_SIZE, false, false);
    minOccurs.getField().add(prepareAjaxOnComponentTagUpdateBehavior());
    body.add(minOccurs);
    TextFormGroup maxOccurs = new TextFormGroup(ID_MAX_OCCURS, new PropertyModel<String>(item.getModelObject(), PropertyLimitationsTypeDto.F_LIMITATION + ".maxOccurs"), createStringResource("LimitationsEditorDialog.label.maxOccurs"), "SchemaHandlingStep.limitations.tooltip.maxOccurs", true, ID_LABEL_SIZE, ID_INPUT_SIZE, false, false);
    maxOccurs.getField().add(prepareAjaxOnComponentTagUpdateBehavior());
    body.add(maxOccurs);
    CheckFormGroup ignore = new CheckFormGroup(ID_IGNORE, new PropertyModel<Boolean>(item.getModelObject(), PropertyLimitationsTypeDto.F_LIMITATION + ".ignore"), createStringResource("LimitationsEditorDialog.label.ignore"), "SchemaHandlingStep.limitations.tooltip.ignore", true, ID_LABEL_SIZE, ID_INPUT_SIZE);
    ignore.getCheck().add(prepareAjaxOnComponentTagUpdateBehavior());
    body.add(ignore);
    Label layersTooltip = new Label(ID_T_LAYERS);
    layersTooltip.add(new InfoTooltipBehavior(true) {

        @Override
        public String getModalContainer(Component component) {
            return body.getMarkupId();
        }
    });
    body.add(layersTooltip);
    Label propertyTooltip = new Label(ID_T_PROPERTY);
    propertyTooltip.add(new InfoTooltipBehavior(true) {

        @Override
        public String getModalContainer(Component component) {
            return body.getMarkupId();
        }
    });
    body.add(propertyTooltip);
}
Also used : DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) TextFormGroup(com.evolveum.midpoint.web.component.form.TextFormGroup) EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) Label(org.apache.wicket.markup.html.basic.Label) CheckFormGroup(com.evolveum.midpoint.web.component.form.CheckFormGroup) InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) EmptyOnChangeAjaxFormUpdatingBehavior(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior) FormComponent(org.apache.wicket.markup.html.form.FormComponent) Component(org.apache.wicket.Component)

Example 44 with Component

use of org.apache.wicket.Component in project midpoint by Evolveum.

the class PrismObjectPanel method createMetadataPanel.

protected void createMetadataPanel(IModel<ObjectWrapper<O>> model, ListItem<ContainerWrapper> item, PrismContainerPanel containerPanel) {
    //check if metadata container exists for
    //the current item and create metadata panel if yes
    Component metadataPanel;
    //becomes visible only in case metadata exists
    Model<Boolean> metadataVisibility = Model.of(false);
    ItemPath metadataContainerPath = item.getModelObject().isMain() ? new ItemPath(ObjectType.F_METADATA) : new ItemPath(item.getModelObject().getPath(), ObjectType.F_METADATA);
    if (model.getObject().findContainerWrapper(metadataContainerPath) != null) {
        ContainerWrapper<MetadataType> metadataContainer = model.getObject().findContainerWrapper(metadataContainerPath);
        metadataVisibility.setObject(true);
        String containerName = item.getModelObject().isMain() ? "Object" : StringUtils.capitalize(item.getModelObject().getPath().last().toString());
        metadataPanel = new MetadataPanel(ID_CONTAINER_METADATA, new AbstractReadOnlyModel<MetadataType>() {

            @Override
            public MetadataType getObject() {
                return metadataContainer.getItem().getRealValue();
            }
        }, containerName, "");
    } else {
        metadataPanel = new WebMarkupContainer(ID_CONTAINER_METADATA);
    }
    metadataPanel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return containerPanel.isVisible() && metadataVisibility.getObject() && model.getObject().isShowMetadata() && !ContainerStatus.ADDING.equals(model.getObject().getStatus());
        }
    });
    metadataPanel.setOutputMarkupId(true);
    item.add(metadataPanel);
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) MetadataPanel(com.evolveum.midpoint.web.component.assignment.MetadataPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) Component(org.apache.wicket.Component) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 45 with Component

use of org.apache.wicket.Component in project midpoint by Evolveum.

the class PrismObjectPanel method initLayout.

private void initLayout(final IModel<ObjectWrapper<O>> model, ResourceReference image, final Form<ObjectWrapper<O>> form) {
    Component headerComponent = createHeader(ID_HEADER, model, form);
    add(headerComponent);
    addOrReplaceContainers(model, form, false);
}
Also used : Component(org.apache.wicket.Component)

Aggregations

Component (org.apache.wicket.Component)49 Label (org.apache.wicket.markup.html.basic.Label)16 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)13 FormComponent (org.apache.wicket.markup.html.form.FormComponent)13 ArrayList (java.util.ArrayList)10 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)9 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)7 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)5 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)4 Behavior (org.apache.wicket.behavior.Behavior)4 SimpleAttributeModifier (org.apache.wicket.behavior.SimpleAttributeModifier)4 ListView (org.apache.wicket.markup.html.list.ListView)4 Fragment (org.apache.wicket.markup.html.panel.Fragment)4 Item (org.apache.wicket.markup.repeater.Item)4 PropertyModel (org.apache.wicket.model.PropertyModel)4 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)3 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)3 DropDownChoicePanel (com.evolveum.midpoint.web.component.input.DropDownChoicePanel)3 RepositoryModel (com.gitblit.models.RepositoryModel)3 TextField (org.apache.wicket.markup.html.form.TextField)3