Skip to content

Commit

Permalink
Fix warnings in New* pages
Browse files Browse the repository at this point in the history
  • Loading branch information
smithkm committed Jan 18, 2016
1 parent 89a78b9 commit e5e76d0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 29 deletions.
Expand Up @@ -55,7 +55,7 @@ public class NewFeatureTypePage extends GeoServerSecuredPage {


String name; String name;


Form form; Form<?> form;


AttributesProvider attributesProvider; AttributesProvider attributesProvider;


Expand All @@ -75,11 +75,11 @@ public NewFeatureTypePage(String workspaceName, String storeName) {
} }
this.storeId = di.getId(); this.storeId = di.getId();


form = new Form("form"); form = new Form<>("form");
form.setOutputMarkupId(true); form.setOutputMarkupId(true);
add(form); add(form);


form.add(new TextField("name", new PropertyModel(this, "name")).setRequired(true)); form.add(new TextField<>("name", new PropertyModel<>(this, "name")).setRequired(true));


attributesProvider = new AttributesProvider(); attributesProvider = new AttributesProvider();
attributeTable = new GeoServerTablePanel<AttributeDescription>("attributes", attributeTable = new GeoServerTablePanel<AttributeDescription>("attributes",
Expand Down Expand Up @@ -207,8 +207,8 @@ SimpleFeatureType buildFeatureType() {
return builder.buildFeatureType(); return builder.buildFeatureType();
} }


private Link cancelLink() { private Link<Void> cancelLink() {
return new Link("cancel") { return new Link<Void>("cancel") {


@Override @Override
public void onClick() { public void onClick() {
Expand All @@ -218,17 +218,17 @@ public void onClick() {
}; };
} }


Component editAttributeLink(final IModel itemModel) { Component editAttributeLink(final IModel<AttributeDescription> itemModel) {
GeoServerAjaxFormLink link = new GeoServerAjaxFormLink("link") { GeoServerAjaxFormLink link = new GeoServerAjaxFormLink("link") {


@Override @Override
protected void onClick(AjaxRequestTarget target, Form form) { protected void onClick(AjaxRequestTarget target, Form<?> form) {
AttributeDescription attribute = (AttributeDescription) itemModel.getObject(); AttributeDescription attribute = itemModel.getObject();
setResponsePage(new AttributeEditPage(attribute, NewFeatureTypePage.this)); setResponsePage(new AttributeEditPage(attribute, NewFeatureTypePage.this));
} }


}; };
link.add(new Label("name", new PropertyModel(itemModel, "name"))); link.add(new Label("name", new PropertyModel<String>(itemModel, "name")));
return link; return link;
} }


Expand All @@ -239,7 +239,7 @@ protected Component headerPanel() {
header.add(new GeoServerAjaxFormLink("addNew", form) { header.add(new GeoServerAjaxFormLink("addNew", form) {


@Override @Override
public void onClick(AjaxRequestTarget target, Form form) { public void onClick(AjaxRequestTarget target, Form<?> form) {
AttributeDescription attribute = new AttributeDescription(); AttributeDescription attribute = new AttributeDescription();
setResponsePage(new AttributeNewPage(attribute, NewFeatureTypePage.this)); setResponsePage(new AttributeNewPage(attribute, NewFeatureTypePage.this));
} }
Expand All @@ -248,7 +248,7 @@ public void onClick(AjaxRequestTarget target, Form form) {
header.add(new GeoServerAjaxFormLink("removeSelected", form) { header.add(new GeoServerAjaxFormLink("removeSelected", form) {


@Override @Override
public void onClick(AjaxRequestTarget target, Form form) { public void onClick(AjaxRequestTarget target, Form<?> form) {
attributesProvider.removeAll(attributeTable.getSelection()); attributesProvider.removeAll(attributeTable.getSelection());
attributeTable.clearSelection(); attributeTable.clearSelection();
target.add(form); target.add(form);
Expand All @@ -263,7 +263,7 @@ protected Component upDownFragment(String id, final AttributeDescription attribu
if (attributesProvider.isFirst(attribute)) { if (attributesProvider.isFirst(attribute)) {
upDown.add(new PlaceholderLink("up")); upDown.add(new PlaceholderLink("up"));
} else { } else {
ImageAjaxLink upLink = new ImageAjaxLink("up", new PackageResourceReference(getClass(), ImageAjaxLink<Void> upLink = new ImageAjaxLink<Void>("up", new PackageResourceReference(getClass(),
"../../img/icons/silk/arrow_up.png")) { "../../img/icons/silk/arrow_up.png")) {
@Override @Override
protected void onClick(AjaxRequestTarget target) { protected void onClick(AjaxRequestTarget target) {
Expand All @@ -277,7 +277,7 @@ protected void onClick(AjaxRequestTarget target) {
if (attributesProvider.isLast(attribute)) { if (attributesProvider.isLast(attribute)) {
upDown.add(new PlaceholderLink("down")); upDown.add(new PlaceholderLink("down"));
} else { } else {
ImageAjaxLink downLink = new ImageAjaxLink("down", new PackageResourceReference(getClass(), ImageAjaxLink<Void> downLink = new ImageAjaxLink<Void>("down", new PackageResourceReference(getClass(),
"../../img/icons/silk/arrow_down.png")) { "../../img/icons/silk/arrow_down.png")) {
@Override @Override
protected void onClick(AjaxRequestTarget target) { protected void onClick(AjaxRequestTarget target) {
Expand All @@ -301,7 +301,7 @@ protected ComponentAuthorizer getPageAuthorizer() {
* *
* @author Andrea Aime * @author Andrea Aime
*/ */
class PlaceholderLink extends ImageAjaxLink { class PlaceholderLink extends ImageAjaxLink<Void> {


public PlaceholderLink(String id) { public PlaceholderLink(String id) {
super(id, new PackageResourceReference(NewFeatureTypePage.class, "../../img/icons/blank.png")); super(id, new PackageResourceReference(NewFeatureTypePage.class, "../../img/icons/blank.png"));
Expand Down
Expand Up @@ -79,7 +79,7 @@ public NewLayerPage(String storeId) {
this.storeId = storeId; this.storeId = storeId;


// the store selector, used when no store is initially known // the store selector, used when no store is initially known
Form selector = new Form("selector"); Form<?> selector = new Form<Void>("selector");
selector.add(storesDropDown()); selector.add(storesDropDown());
selector.setVisible(storeId == null); selector.setVisible(storeId == null);
add(selector); add(selector);
Expand All @@ -93,7 +93,7 @@ public NewLayerPage(String storeId) {
selectLayers.setVisible(storeId != null); selectLayers.setVisible(storeId != null);
selectLayersContainer.add(selectLayers); selectLayersContainer.add(selectLayers);


selectLayers.add(storeName = new Label("storeName", new Model())); selectLayers.add(storeName = new Label("storeName", new Model<String>()));
if(storeId != null) { if(storeId != null) {
StoreInfo store = getCatalog().getStore(storeId, StoreInfo.class); StoreInfo store = getCatalog().getStore(storeId, StoreInfo.class);
storeName.setDefaultModelObject(store.getName()); storeName.setDefaultModelObject(store.getName());
Expand All @@ -110,7 +110,7 @@ protected Component getComponentForProperty(String id,
if (property == NewLayerPageProvider.NAME) { if (property == NewLayerPageProvider.NAME) {
return new Label(id, property.getModel(itemModel)); return new Label(id, property.getModel(itemModel));
} else if (property == NewLayerPageProvider.PUBLISHED) { } else if (property == NewLayerPageProvider.PUBLISHED) {
final Resource resource = (Resource) itemModel.getObject(); final Resource resource = itemModel.getObject();
final CatalogIconFactory icons = CatalogIconFactory.get(); final CatalogIconFactory icons = CatalogIconFactory.get();
if(resource.isPublished()) { if(resource.isPublished()) {
PackageResourceReference icon = icons.getEnabledIcon(); PackageResourceReference icon = icons.getEnabledIcon();
Expand All @@ -121,7 +121,7 @@ protected Component getComponentForProperty(String id,
return new Label(id); return new Label(id);
} }
} else if(property == NewLayerPageProvider.ACTION) { } else if(property == NewLayerPageProvider.ACTION) {
final Resource resource = (Resource) itemModel.getObject(); final Resource resource = itemModel.getObject();
if(resource.isPublished()) { if(resource.isPublished()) {
return resourceChooserLink(id, itemModel, new ParamResourceModel("publishAgain", this)); return resourceChooserLink(id, itemModel, new ParamResourceModel("publishAgain", this));
} else { } else {
Expand Down Expand Up @@ -171,7 +171,7 @@ protected Component getComponentForProperty(String id,
} }


Component newFeatureTypeLink() { Component newFeatureTypeLink() {
return new AjaxLink("createFeatureType") { return new AjaxLink<Void>("createFeatureType") {


@Override @Override
public void onClick(AjaxRequestTarget target) { public void onClick(AjaxRequestTarget target) {
Expand All @@ -183,7 +183,7 @@ public void onClick(AjaxRequestTarget target) {
} }


Component newSQLViewLink() { Component newSQLViewLink() {
return new AjaxLink("createSQLView") { return new AjaxLink<Void>("createSQLView") {


@Override @Override
public void onClick(AjaxRequestTarget target) { public void onClick(AjaxRequestTarget target) {
Expand All @@ -195,7 +195,7 @@ public void onClick(AjaxRequestTarget target) {
} }


Component newCoverageViewLink() { Component newCoverageViewLink() {
return new AjaxLink("createCoverageView") { return new AjaxLink<Void>("createCoverageView") {


@Override @Override
public void onClick(AjaxRequestTarget target) { public void onClick(AjaxRequestTarget target) {
Expand All @@ -207,7 +207,7 @@ public void onClick(AjaxRequestTarget target) {
} }


Component newCascadedWFSStoredQueryLink() { Component newCascadedWFSStoredQueryLink() {
return new AjaxLink("createCascadedWFSStoredQuery") { return new AjaxLink<Void>("createCascadedWFSStoredQuery") {


@Override @Override
public void onClick(AjaxRequestTarget target) { public void onClick(AjaxRequestTarget target) {
Expand All @@ -219,19 +219,18 @@ public void onClick(AjaxRequestTarget target) {
} }


Component newWMSImportLink() { Component newWMSImportLink() {
return new AjaxLink("createWMSImport") { return new AjaxLink<Void>("createWMSImport") {


@Override @Override
public void onClick(AjaxRequestTarget target) { public void onClick(AjaxRequestTarget target) {
WMSStoreInfo wms = getCatalog().getStore(storeId, WMSStoreInfo.class);
PageParameters pp = new PageParameters().add("storeId", storeId); PageParameters pp = new PageParameters().add("storeId", storeId);
setResponsePage(WMSLayerImporterPage.class, pp); setResponsePage(WMSLayerImporterPage.class, pp);
} }
}; };
} }


private DropDownChoice storesDropDown() { private DropDownChoice<StoreInfo> storesDropDown() {
final DropDownChoice stores = new DropDownChoice("storesDropDown", new Model(), final DropDownChoice<StoreInfo> stores = new DropDownChoice<>("storesDropDown", new Model<StoreInfo>(),
new StoreListModel(), new StoreListChoiceRenderer()); new StoreListModel(), new StoreListChoiceRenderer());
stores.setOutputMarkupId(true); stores.setOutputMarkupId(true);
stores.add(new AjaxFormComponentUpdatingBehavior("onchange") { stores.add(new AjaxFormComponentUpdatingBehavior("onchange") {
Expand Down Expand Up @@ -271,8 +270,8 @@ protected void onUpdate(AjaxRequestTarget target) {
return stores; return stores;
} }


SimpleAjaxLink resourceChooserLink(String id, IModel itemModel, IModel label) { SimpleAjaxLink<Resource> resourceChooserLink(String id, IModel<Resource> itemModel, IModel<String> label) {
return new SimpleAjaxLink(id, itemModel, label) { return new SimpleAjaxLink<Resource>(id, itemModel, label) {


@Override @Override
protected void onClick(AjaxRequestTarget target) { protected void onClick(AjaxRequestTarget target) {
Expand All @@ -298,7 +297,7 @@ void updateSpecialFunctionPanels(StoreInfo store) {
createCascadedWFSStoredQueryContainer.setVisible(false); createCascadedWFSStoredQueryContainer.setVisible(false);
if (store instanceof DataStoreInfo) { if (store instanceof DataStoreInfo) {
try { try {
DataAccess da = ((DataStoreInfo) store).getDataStore(null); DataAccess<?,?> da = ((DataStoreInfo) store).getDataStore(null);


createSQLViewContainer.setVisible(da instanceof JDBCDataStore); createSQLViewContainer.setVisible(da instanceof JDBCDataStore);


Expand Down

0 comments on commit e5e76d0

Please sign in to comment.