kopia lustrzana https://github.com/JOSM/MapWithAI
rodzic
e70f64e534
commit
e5b228bdba
|
@ -625,6 +625,7 @@ public class MapWithAILayerInfo {
|
|||
return layers.stream()
|
||||
.filter(i -> i.getCategory() != MapWithAICategory.PREVIEW
|
||||
&& !i.getAdditionalCategories().contains(MapWithAICategory.PREVIEW))
|
||||
.filter(info -> !Utils.isBlank(info.getUrlExpanded()) && !Utils.isBlank(info.getUrl()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
|
|
@ -187,6 +187,19 @@ public class MapWithAIProvidersPanel extends JPanel {
|
|||
@SuppressWarnings("unchecked")
|
||||
public final Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
|
||||
boolean hasFocus, int row, int column) {
|
||||
// See #22740
|
||||
if (value == null) {
|
||||
final StringBuilder message = new StringBuilder();
|
||||
for (int tableRow = 0; tableRow < table.getRowCount(); tableRow++) {
|
||||
message.append('|');
|
||||
for (int tableCol = 0; tableCol < table.getColumnCount(); tableCol++) {
|
||||
final Object tableVal = table.getValueAt(tableRow, tableCol);
|
||||
message.append(tableVal).append('|');
|
||||
}
|
||||
message.append(System.lineSeparator());
|
||||
}
|
||||
throw new IllegalArgumentException("value was null:" + System.lineSeparator() + message);
|
||||
}
|
||||
T obj = (T) value;
|
||||
JLabel label = (JLabel) super.getTableCellRendererComponent(table, mapper.apply(obj), isSelected, hasFocus,
|
||||
row, column);
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
// License: GPL. For details, see LICENSE file.
|
||||
package org.openstreetmap.josm.plugins.mapwithai.testutils.annotations;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.jupiter.api.extension.AfterAllCallback;
|
||||
import org.junit.jupiter.api.extension.BeforeAllCallback;
|
||||
import org.junit.jupiter.api.extension.BeforeEachCallback;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.platform.commons.support.AnnotationSupport;
|
||||
import org.openstreetmap.josm.data.projection.ProjectionRegistry;
|
||||
import org.openstreetmap.josm.data.projection.Projections;
|
||||
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
||||
import org.openstreetmap.josm.testutils.annotations.AnnotationUtils;
|
||||
|
||||
/**
|
||||
* Use projections in tests (Mercator). Prefer the JOSM implementation in the
|
||||
* future.
|
||||
*
|
||||
* @author Taylor Smock
|
||||
* @see JOSMTestRules#projection()
|
||||
*
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE })
|
||||
@ExtendWith(Projection.ProjectionExtension.class)
|
||||
public @interface Projection {
|
||||
/**
|
||||
* The value to use for the projection. Defaults to EPSG:3857 (Mercator).
|
||||
*
|
||||
* @return The value to use to get the projection from
|
||||
* {@link Projections#getProjectionByCode}.
|
||||
*/
|
||||
String projectionCode() default "EPSG:3857";
|
||||
|
||||
/**
|
||||
* Use projections in tests. Use {@link Projection} preferentially.
|
||||
*
|
||||
* @author Taylor Smock
|
||||
*
|
||||
*/
|
||||
class ProjectionExtension implements BeforeEachCallback, BeforeAllCallback, AfterAllCallback {
|
||||
@Override
|
||||
public void afterAll(ExtensionContext context) throws Exception {
|
||||
ProjectionRegistry.clearProjectionChangeListeners();
|
||||
AnnotationUtils.resetStaticClass(ProjectionRegistry.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeAll(ExtensionContext context) throws Exception {
|
||||
// Needed in order to run prior to Territories
|
||||
beforeEach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeEach(ExtensionContext context) throws Exception {
|
||||
Optional<Projection> annotation = AnnotationSupport.findAnnotation(context.getElement(), Projection.class);
|
||||
if (annotation.isPresent()) {
|
||||
ProjectionRegistry.setProjection(Projections.getProjectionByCode(annotation.get().projectionCode()));
|
||||
} else {
|
||||
ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ import org.junit.jupiter.api.extension.ExtensionContext;
|
|||
import org.junit.platform.commons.support.AnnotationSupport;
|
||||
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||
|
||||
/**
|
||||
* Use boundaries dataset in this test. FIXME: Use the JOSM version
|
||||
|
|
Ładowanie…
Reference in New Issue