@Override protected List<String> load() { List<AuthorityURLInfo> authorities = availableAuthoritiesProvider.getModelObject(); List<String> names = new ArrayList<String>(authorities.size()); for (AuthorityURLInfo auth : authorities) { names.add(auth.getName()); } if (baseAuthorities != null) { for (AuthorityURLInfo baseAuth : baseAuthorities) { names.add(baseAuth.getName()); } } Collections.sort(names); return names; } }
@Override protected void convertInput() { List<AuthorityURLInfo> info = authorityURLs.getModelObject(); if (info == null || info.size() == 0) { setConvertedInput(new ArrayList<AuthorityURLInfo>(2)); return; } setConvertedInput(info); }
add(container); updateLinksVisibility(); add(button);
@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { List<AuthorityURLInfo> list = authorityURLs.getModelObject(); AuthorityURLInfo authorityURL = new AuthorityURL(); list.add(authorityURL); authorityURLs.setModelObject(list); AuthorityURLListEditor.this.convertInput(); updateLinksVisibility(); target.addComponent(container); }
@SuppressWarnings("unchecked") public LayerAuthoritiesAndIdentifiersPanel(final String id, final boolean isRootLayer, final IModel<? extends CatalogInfo> layerModel) { super(id); // authority URLs for the this layer IModel<List<AuthorityURLInfo>> authURLsModel; authURLsModel = LiveCollectionModel.list(new PropertyModel<List<AuthorityURLInfo>>( layerModel, "authorityURLs")); AuthorityURLListEditor authUrlEditor = new AuthorityURLListEditor("authorityurls", authURLsModel); add(authUrlEditor); // Layer Identifiers for this layer IModel<List<LayerIdentifierInfo>> identifiersModel; identifiersModel = LiveCollectionModel.list(new PropertyModel<List<LayerIdentifierInfo>>( layerModel, "identifiers")); LayerIdentifierListEditor identifiersEditor = new LayerIdentifierListEditor( "layerIdentifiers", identifiersModel, authUrlEditor); if (!isRootLayer) { WMSInfo serviceInfo = WMS.get().getServiceInfo(); List<AuthorityURLInfo> rootLayerAuthorities = serviceInfo.getAuthorityURLs(); identifiersEditor.setBaseAuthorities(rootLayerAuthorities); } add(identifiersEditor); }
add(container); updateLinksVisibility(); add(button);
@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { List<AuthorityURLInfo> list = authorityURLs.getModelObject(); AuthorityURLInfo authorityURL = new AuthorityURL(); list.add(authorityURL); authorityURLs.setModelObject(list); AuthorityURLListEditor.this.convertInput(); updateLinksVisibility(); target.add(container); } };
new PropertyModel<List<AuthorityURLInfo>>(layerModel, "authorityURLs")); AuthorityURLListEditor authUrlEditor = new AuthorityURLListEditor("authorityurls", authURLsModel); add(authUrlEditor);
@Override protected List<String> load() { List<AuthorityURLInfo> authorities = availableAuthoritiesProvider.getModelObject(); List<String> names = new ArrayList<String>(authorities.size()); for (AuthorityURLInfo auth : authorities) { names.add(auth.getName()); } if (baseAuthorities != null) { for (AuthorityURLInfo baseAuth : baseAuthorities) { names.add(baseAuth.getName()); } } Collections.sort(names); return names; } }
@Override public void convertInput() { List<AuthorityURLInfo> info = authorityURLs.getModelObject(); if (info == null || info.size() == 0) { setConvertedInput(new ArrayList<AuthorityURLInfo>(2)); return; } setConvertedInput(info); }
/** * @param id * @param model * the model over the appropriate cataloginfo's list of {@link LayerIdentifierInfo} * @see WMSInfo#getIdentifiers() * @see LayerInfo#getIdentifiers() * @see LayerGroupInfo#getIdentifiers() */ public LayerIdentifierListEditor(final String id, final IModel<List<LayerIdentifierInfo>> list, final AuthorityURLListEditor availableAuthoritiesProvider) { super(id, list); this.availableAuthoritiesProvider = availableAuthoritiesProvider; Assert.notNull(list.getObject()); Assert.notNull(availableAuthoritiesProvider.getModelObject()); setOutputMarkupId(true); initUI(); }
/** * @param id * @param model the model over the appropriate cataloginfo's list of {@link LayerIdentifierInfo} * @see WMSInfo#getIdentifiers() * @see LayerInfo#getIdentifiers() * @see LayerGroupInfo#getIdentifiers() */ public LayerIdentifierListEditor( final String id, final IModel<List<LayerIdentifierInfo>> list, final AuthorityURLListEditor availableAuthoritiesProvider) { super(id, list); this.availableAuthoritiesProvider = availableAuthoritiesProvider; Assert.notNull(list.getObject()); Assert.notNull(availableAuthoritiesProvider.getModelObject()); setOutputMarkupId(true); initUI(); }