當前位置: 首頁>>代碼示例>>Java>>正文


Java WebMarkupContainer.replaceWith方法代碼示例

本文整理匯總了Java中org.apache.wicket.markup.html.WebMarkupContainer.replaceWith方法的典型用法代碼示例。如果您正苦於以下問題:Java WebMarkupContainer.replaceWith方法的具體用法?Java WebMarkupContainer.replaceWith怎麽用?Java WebMarkupContainer.replaceWith使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.wicket.markup.html.WebMarkupContainer的用法示例。


在下文中一共展示了WebMarkupContainer.replaceWith方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: editCapabilityPerformed

import org.apache.wicket.markup.html.WebMarkupContainer; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void editCapabilityPerformed(final AjaxRequestTarget target, CapabilityDto<? extends CapabilityType> capability) {
	dtoModel.getObject().setSelected(capability);

       WebMarkupContainer config = getConfigContainer();
       WebMarkupContainer newConfig;
       CapabilityType capType = capability.getCapability();

       if (capType instanceof ActivationCapabilityType) {
		newConfig = new CapabilityActivationPanel(ID_CAPABILITY_CONFIG, new Model<>((CapabilityDto<ActivationCapabilityType>) capability), parentPage) {

               @Override
               public IModel<List<QName>> createAttributeChoiceModel(final IChoiceRenderer<QName> renderer) {
				LoadableModel<List<QName>> attributeChoiceModel = new LoadableModel<List<QName>>(false) {

					@Override
					protected List<QName> load() {
						List<QName> choices = new ArrayList<>();

						PrismObject<ResourceType> resourcePrism = resourceModel.getObject();

						try {
							ResourceSchema schema = RefinedResourceSchemaImpl.getResourceSchema(resourcePrism, getPageBase().getPrismContext());
							if (schema != null) {
								ObjectClassComplexTypeDefinition def = schema.findDefaultObjectClassDefinition(ShadowKindType.ACCOUNT);
								for (ResourceAttributeDefinition attribute : def.getAttributeDefinitions()) {
									choices.add(attribute.getName());
								}
							}
						} catch (CommonException | RuntimeException e) {
							LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load resource schema attributes.", e);
							getPageBase().error("Couldn't load resource schema attributes" + e);
						}

						Collections.sort(choices, new Comparator<QName>() {

							@Override
							public int compare(QName o1, QName o2) {
								String s1 = (String) renderer.getDisplayValue(o1);
								String s2 = (String) renderer.getDisplayValue(o2);

								return String.CASE_INSENSITIVE_ORDER.compare(s1, s2);
							}
						});

						return choices;
					}
				};
				parentPage.registerDependentModel(attributeChoiceModel);
				return attributeChoiceModel;
               }
           };
       } else if (capType instanceof ScriptCapabilityType) {
           newConfig = new CapabilityScriptPanel(ID_CAPABILITY_CONFIG, new Model<>((CapabilityDto<ScriptCapabilityType>) capability), getTable(), parentPage);
       } else if (capType instanceof CredentialsCapabilityType) {
           newConfig = new CapabilityCredentialsPanel(ID_CAPABILITY_CONFIG, new Model<>((CapabilityDto<CredentialsCapabilityType>)capability), getTable(), parentPage);
       } else {
           newConfig = new CapabilityValuePanel(ID_CAPABILITY_CONFIG, new Model<>((CapabilityDto<CapabilityType>) capability), getTable(), parentPage);
       }
	// TODO other specific capabilities (paged, count, ...)

       newConfig.setOutputMarkupId(true);
       config.replaceWith(newConfig);

       target.add(newConfig);
       target.add(getTable());
   }
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:68,代碼來源:CapabilityStep.java


注:本文中的org.apache.wicket.markup.html.WebMarkupContainer.replaceWith方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。