List of usage examples for org.apache.wicket.ajax AjaxRequestTarget add
void add(Component... components);
From source file:com.eltiland.ui.common.components.navigator.ELTAjaxPagingNavigator.java
License:Apache License
/** * Override this method to specify the markup container where your IPageable is part of. This * implementation is a default implementation that tries to find a parent markup container and * update that container. This is necessary as ListViews can't be updated themselves. * * @param target// w ww . j av a 2 s.c o m * the request target to add the components that need to be updated in the ajax * event. */ protected void onAjaxEvent(AjaxRequestTarget target) { // update the container (parent) of the pageable, this assumes that // the pageable is a component, and that it is a child of a web // markup container. Component container = ((Component) pageable); // no need for a nullcheck as there is bound to be a non-repeater // somewhere higher in the hierarchy while (container instanceof AbstractRepeater) { container = container.getParent(); } target.add(container); // in case the navigator is not contained by the container, we have // to add it to the response if (((MarkupContainer) container).contains(this, true) == false) { target.add(this); } }
From source file:com.evolveum.midpoint.gui.api.component.AssignmentPopup.java
License:Apache License
private void tabLabelPanelUpdate(AjaxRequestTarget target) { getTabbedPanel().reloadCountLabels(target); target.add(get(ID_FORM).get(ID_ASSIGN_BUTTON)); }
From source file:com.evolveum.midpoint.gui.api.component.ChooseMemberPopup.java
License:Apache License
protected void tabLabelPanelUpdate(AjaxRequestTarget target) { getTabbedPanel().reloadCountLabels(target); target.add(get(ID_FORM).get(ID_ADD_BUTTON)); }
From source file:com.evolveum.midpoint.gui.api.component.ChooseMemberPopup.java
License:Apache License
protected void executeMemberOperation(QName type, ObjectQuery memberQuery, ObjectDelta delta, AjaxRequestTarget target) { Task operationalTask = getPageBase().createSimpleTask("Add.members"); OperationResult parentResult = operationalTask.getResult(); try {//from w ww. ja va 2s.c o m WebComponentUtil.executeMemberOperation(operationalTask, type, memberQuery, delta, TaskCategory.EXECUTE_CHANGES, parentResult, getPageBase()); } catch (SchemaException e) { parentResult.recordFatalError(parentResult.getOperation(), e); LoggingUtils.logUnexpectedException(LOGGER, "Failed to execute operation " + parentResult.getOperation(), e); target.add(getPageBase().getFeedbackPanel()); } target.add(getPageBase().getFeedbackPanel()); }
From source file:com.evolveum.midpoint.gui.api.component.delta.ObjectDeltaOperationPanel.java
License:Apache License
private void initLayout() { // ObjectDeltaType od = getModel().getObjectDelta(); WebMarkupContainer objectDeltaOperationMarkup = new WebMarkupContainer(ID_OBJECT_DELTA_OPERATION_MARKUP); objectDeltaOperationMarkup.setOutputMarkupId(true); objectDeltaOperationMarkup.add(AttributeModifier.append("class", new IModel<String>() { @Override//from ww w . j a va 2 s .c o m public String getObject() { return getBoxCssClass(); } })); add(objectDeltaOperationMarkup); Label executionResult = new Label(ID_PARAMETERS_EXECUTION_RESULT, new PropertyModel(getModel(), "executionResult.status")); executionResult.setOutputMarkupId(true); objectDeltaOperationMarkup.add(executionResult); Label resourceName = new Label(ID_PARAMETERS_RESOURCE_NAME, new PropertyModel(getModel(), ObjectDeltaOperationType.F_RESOURCE_NAME.getLocalPart())); resourceName.setOutputMarkupId(true); objectDeltaOperationMarkup.add(resourceName); Label objectName = new Label(ID_PARAMETERS_OBJECT_NAME, new PropertyModel(getModel(), ObjectDeltaOperationType.F_OBJECT_NAME.getLocalPart())); objectName.setOutputMarkupId(true); objectDeltaOperationMarkup.add(objectName); final SceneDto sceneDto; try { sceneDto = loadSceneForDelta(); } catch (SchemaException | ExpressionEvaluationException e) { OperationResult result = new OperationResult( ObjectDeltaOperationPanel.class.getName() + ".loadSceneForDelta"); result.recordFatalError( createStringResource("ObjectDeltaOperationPanel.message.fetchOrVisualize.fatalError", e.getMessage()).getString(), e); parentPage.showResult(result); throw parentPage.redirectBackViaRestartResponseException(); } IModel<SceneDto> deltaModel = new IModel<SceneDto>() { private static final long serialVersionUID = 1L; public SceneDto getObject() { return sceneDto; } }; ScenePanel deltaPanel = new ScenePanel(ID_DELTA_PANEL, deltaModel) { @Override public void headerOnClickPerformed(AjaxRequestTarget target, IModel<SceneDto> model) { super.headerOnClickPerformed(target, model); // model.getObject().setMinimized(!model.getObject().isMinimized()); target.add(ObjectDeltaOperationPanel.this); } }; deltaPanel.setOutputMarkupId(true); objectDeltaOperationMarkup.add(deltaPanel); }
From source file:com.evolveum.midpoint.gui.api.component.FocusBrowserPanel.java
License:Apache License
private void initLayout(Class<T> type, final List<QName> supportedTypes, final boolean multiselect) { WebMarkupContainer typePanel = new WebMarkupContainer(ID_TYPE_PANEL); typePanel.setOutputMarkupId(true);//from ww w. ja v a 2 s . c o m typePanel.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return supportedTypes.size() != 1; } }); add(typePanel); DropDownChoice<QName> typeSelect = new DropDownChoice(ID_TYPE, typeModel, new ListModel(supportedTypes), new QNameChoiceRenderer()); typeSelect.add(new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { ObjectListPanel<T> listPanel = (ObjectListPanel<T>) get(ID_TABLE); listPanel = createObjectListPanel(qnameToCompileTimeClass(typeModel.getObject()), multiselect); addOrReplace(listPanel); target.add(listPanel); } }); typePanel.add(typeSelect); ObjectListPanel<T> listPanel = createObjectListPanel(type, multiselect); add(listPanel); AjaxButton addButton = new AjaxButton(ID_BUTTON_ADD, createStringResource("userBrowserDialog.button.addButton")) { @Override public void onClick(AjaxRequestTarget target) { List<T> selected = ((PopupObjectListPanel) getParent().get(ID_TABLE)).getSelectedObjects(); QName type = FocusBrowserPanel.this.typeModel.getObject(); FocusBrowserPanel.this.addPerformed(target, type, selected); } }; addButton.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return multiselect; } }); add(addButton); }
From source file:com.evolveum.midpoint.gui.api.component.MultiTypesMemberPopupTabPanel.java
License:Apache License
@Override protected void onInitialize() { super.onInitialize(); WebMarkupContainer typePanel = new WebMarkupContainer(ID_TYPE_SELECT_PANEL); typePanel.setOutputMarkupId(true);//from ww w . jav a 2 s . co m add(typePanel); DropDownChoice<ObjectTypes> typeSelect = new DropDownChoice<>(ID_TYPE, new LoadableModel<ObjectTypes>() { @Override protected ObjectTypes load() { return defaultObjectType; } }, getSupportedTypesList(), new EnumChoiceRenderer<>(this)); typeSelect.add(new OnChangeAjaxBehavior() { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { defaultObjectType = typeSelect.getModelObject(); MultiTypesMemberPopupTabPanel.this.addOrReplace(initObjectListPanel()); target.add(MultiTypesMemberPopupTabPanel.this); } }); typePanel.add(typeSelect); add(typePanel); }
From source file:com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel.java
License:Apache License
private void initLayout(Class<? extends O> type, final List<QName> supportedTypes, final boolean multiselect) { WebMarkupContainer typePanel = new WebMarkupContainer(ID_TYPE_PANEL); typePanel.setOutputMarkupId(true);//from w w w. j av a 2 s .c om typePanel.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return supportedTypes.size() != 1; } }); add(typePanel); DropDownChoice<QName> typeSelect = new DropDownChoice<QName>(ID_TYPE, typeModel, new ListModel<QName>(supportedTypes), new QNameChoiceRenderer()); typeSelect.add(new OnChangeAjaxBehavior() { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { ObjectListPanel<O> listPanel = (ObjectListPanel<O>) get(ID_TABLE); listPanel = createObjectListPanel(qnameToCompileTimeClass(typeModel.getObject()), multiselect); addOrReplace(listPanel); target.add(listPanel); } }); typePanel.add(typeSelect); ObjectListPanel<O> listPanel = createObjectListPanel(type, multiselect); add(listPanel); AjaxButton addButton = new AjaxButton(ID_BUTTON_ADD, createStringResource("userBrowserDialog.button.addButton")) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { List<O> selected = ((PopupObjectListPanel) getParent().get(ID_TABLE)).getSelectedObjects(); QName type = ObjectBrowserPanel.this.typeModel.getObject(); ObjectBrowserPanel.this.addPerformed(target, type, selected); } }; addButton.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return multiselect; } }); add(addButton); }
From source file:com.evolveum.midpoint.gui.api.component.ObjectListPanel.java
License:Apache License
@SuppressWarnings("deprecation") private void searchPerformed(ObjectQuery query, AjaxRequestTarget target) { BaseSortableDataProvider<SelectableBean<O>> provider = getDataProvider(); // note: we ignore 'query' parameter, as the 'customQuery' already contains its content (MID-3271) ObjectQuery customQuery = getQuery(); // if (customQuery == null){ // customQuery = query; // } else { // if (query != null){ // customQuery.addFilter(query.getFilter()); // }/*from w w w . j a v a2 s.co m*/ // } provider.setQuery(customQuery); String storageKey = getStorageKey(); if (StringUtils.isNotEmpty(storageKey)) { PageStorage storage = getPageStorage(storageKey); if (storage != null) { storage.setSearch(searchModel.getObject()); storage.setPaging(null); } } Table table = getTable(); table.setCurrentPage(null); target.add((Component) table); target.add(parentPage.getFeedbackPanel()); }
From source file:com.evolveum.midpoint.gui.api.component.ObjectListPanel.java
License:Apache License
public void refreshTable(Class<O> newType, AjaxRequestTarget target) { BaseSortableDataProvider<SelectableBean<O>> provider = getDataProvider(); provider.setQuery(getQuery());/*from w ww.j a v a 2 s. c o m*/ if (newType != null && provider instanceof SelectableBeanObjectDataProvider) { ((SelectableBeanObjectDataProvider<O>) provider).setType(newType); } if (newType != null && !this.type.equals(newType)) { this.type = newType; searchModel.reset(); } else { saveSearchModel(); } BoxedTablePanel<SelectableBean<O>> table = getTable(); ((WebMarkupContainer) table.get("box")).addOrReplace(initSearch("header")); table.setCurrentPage(null); target.add((Component) table); target.add(parentPage.getFeedbackPanel()); }