Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ language: java

# Configure the build to use Oracle JDK 9
jdk:
- openjdk11
- openjdk21

# Install the Ant JUnit package, which is missing from the Travis CI environment. See the Travis documentation: https://docs.travis-ci.com/user/installing-dependencies/#Adding-APT-Packages
addons:
Expand Down
4 changes: 2 additions & 2 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=11
javac.target=11
javac.source=21
javac.target=21
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
Expand Down
2 changes: 1 addition & 1 deletion release-build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ worldwind.classes.dir=${worldwind.build.dir}/classes
worldwind.doc.dir=${worldwind.build.dir}/doc
worldwind.jar.dir=${worldwind.build.dir}/jar
worldwind.test.results.dir=${worldwind.build.dir}/test-results
worldwind.jdk=11
worldwind.jdk=21
#worldwind.exclude.jackson=true

# MIL-STD-2525 package build properties
Expand Down
2 changes: 1 addition & 1 deletion release-build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<pathelement location="gluegen-rt.jar"/>
<pathelement location="gdal.jar"/>
</classpath>
<link href="http://download.oracle.com/javase/8/docs/api/"/>
<link href="https://docs.oracle.com/en/java/javase/21/docs/api/"/>
<link href="https://jogamp.org/deployment/v2.4.0-rc-20200307/javadoc/"/>
</javadoc>
</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,8 @@ public ByteBuffer run(Retriever retriever)
URLRetriever r = (URLRetriever) retriever;
ByteBuffer buffer = r.getBuffer();

if (retriever instanceof HTTPRetriever)
if (retriever instanceof HTTPRetriever htr)
{
HTTPRetriever htr = (HTTPRetriever) retriever;
if (htr.getResponseCode() == HttpURLConnection.HTTP_NO_CONTENT)
{
// Mark tile as missing to avoid excessive attempts
Expand Down
23 changes: 11 additions & 12 deletions src/gov/nasa/worldwind/layers/rpf/RPFTiledImageLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,8 @@ private static String makeTitle(AVList params)
StringBuilder sb = new StringBuilder();

Object o = params.getValue(RPFGenerator.RPF_FILE_INDEX);
if (o != null && o instanceof RPFFileIndex)
if (o instanceof RPFFileIndex fileIndex)
{
RPFFileIndex fileIndex = (RPFFileIndex) o;
if (fileIndex.getIndexProperties() != null)
{
if (fileIndex.getIndexProperties().getDescription() != null)
Expand Down Expand Up @@ -401,19 +400,19 @@ private RestorableSupport makeRestorableState(AVList params)

for (Map.Entry<String, Object> p : params.getEntries())
{
if (p.getValue() instanceof LatLon)
if (p.getValue() instanceof LatLon latLon)
{
rs.addStateValueAsDouble(p.getKey() + ".Latitude", ((LatLon) p.getValue()).getLatitude().degrees);
rs.addStateValueAsDouble(p.getKey() + ".Longitude", ((LatLon) p.getValue()).getLongitude().degrees);
rs.addStateValueAsDouble(p.getKey() + ".Latitude", latLon.getLatitude().degrees);
rs.addStateValueAsDouble(p.getKey() + ".Longitude", latLon.getLongitude().degrees);
}
else if (p.getValue() instanceof Sector)
else if (p.getValue() instanceof Sector sector)
{
rs.addStateValueAsDouble(p.getKey() + ".MinLatitude", ((Sector) p.getValue()).getMinLatitude().degrees);
rs.addStateValueAsDouble(p.getKey() + ".MaxLatitude", ((Sector) p.getValue()).getMaxLatitude().degrees);
rs.addStateValueAsDouble(p.getKey() + ".MinLatitude", sector.getMinLatitude().degrees);
rs.addStateValueAsDouble(p.getKey() + ".MaxLatitude", sector.getMaxLatitude().degrees);
rs.addStateValueAsDouble(p.getKey() + ".MinLongitude",
((Sector) p.getValue()).getMinLongitude().degrees);
sector.getMinLongitude().degrees);
rs.addStateValueAsDouble(p.getKey() + ".MaxLongitude",
((Sector) p.getValue()).getMaxLongitude().degrees);
sector.getMaxLongitude().degrees);
}
else if (p.getValue() instanceof URLBuilder)
{
Expand Down Expand Up @@ -793,8 +792,8 @@ protected ByteBuffer handleSuccessfulRetrieval()
@Override
protected boolean validateResponseCode()
{
if (this.getRetriever() instanceof RPFRetriever)
return ((RPFRetriever) this.getRetriever()).getResponseCode() == RPFRetriever.RESPONSE_CODE_OK;
if (this.getRetriever() instanceof RPFRetriever rpfRetriever)
return rpfRetriever.getResponseCode() == RPFRetriever.RESPONSE_CODE_OK;
else
return super.validateResponseCode();
}
Expand Down
23 changes: 7 additions & 16 deletions src/gov/nasa/worldwind/layers/rpf/wizard/DataChooserPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ private void fileSetClicked(ItemEvent e)
if (e != null)
{
FileSet set = null;
if (e.getItem() != null && e.getItem() instanceof JComponent)
if (e.getItem() instanceof JComponent component)
{
Object property = ((JComponent) e.getItem()).getClientProperty("fileSet");
if (property != null && property instanceof FileSet)
set = (FileSet) property;
Object property = component.getClientProperty("fileSet");
if (property instanceof FileSet fileSet)
set = fileSet;
}

if (set != null)
Expand Down Expand Up @@ -207,9 +207,8 @@ private void deselectAllPressed()
private void fileSetSelectionChanged(Object source)
{
// Make sure the CheckBox selection reflects the FileSet selection state.
if (source != null && source instanceof FileSet)
if (source instanceof FileSet set)
{
FileSet set = (FileSet) source;
JToggleButton button = this.selectButtons.get(set);
if (button != null)
button.setSelected(set.isSelected());
Expand Down Expand Up @@ -279,18 +278,10 @@ private void makeComponents()
Dimension size = new Dimension(35, 20);
this.selectAllButton.setFont(font);
this.selectAllButton.setPreferredSize(size);
this.selectAllButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
selectAllPressed();
}
});
this.selectAllButton.addActionListener(e -> selectAllPressed());
this.deselectAllButton.setFont(font);
this.deselectAllButton.setPreferredSize(size);
this.deselectAllButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
deselectAllPressed();
}
});
this.deselectAllButton.addActionListener(e -> deselectAllPressed());
this.dataScrollPane = new JScrollPane();
this.dataScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
size = this.dataScrollPane.getPreferredSize();
Expand Down
20 changes: 8 additions & 12 deletions src/gov/nasa/worldwind/layers/rpf/wizard/FileChooserPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ private File getValueAsFile(Object value)
{
if (value != null)
{
if (value instanceof File)
return (File) value;
if (value instanceof File file)
return file;
else
return new File(value.toString());
}
Expand Down Expand Up @@ -145,19 +145,15 @@ private void makeComponents()
Dimension preferred = this.fileField.getPreferredSize();
Dimension max = this.fileField.getMaximumSize();
this.fileField.setMaximumSize(new Dimension(max.width, preferred.height));
this.fileField.addPropertyChangeListener("value", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
if (event != null) {
onFileFieldChanged(event.getNewValue());
}
this.fileField.addPropertyChangeListener("value", event ->
{
if (event != null)
{
onFileFieldChanged(event.getNewValue());
}
});
this.chooseButton = new JButton("Choose...");
this.chooseButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
onChooseClicked();
}
});
this.chooseButton.addActionListener(e -> onChooseClicked());
this.fileChooser = new JFileChooser();
this.fileChooser.setDialogTitle("Choose Folder to Search");
this.fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private void setNextButtonAccordingToSelectedFile()
private void selectedFileChanged(Object newValue)
{
WizardModel model = getWizardModel();
if (model != null && newValue != null && newValue instanceof File)
if (model != null && newValue instanceof File)
{
RPFWizardUtil.setSelectedFile(model, (File) newValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,15 @@ public void displayingPanel()
if (model != null && !RPFWizardUtil.isFileListCurrent(model))
{
this.panelComponent.getProgressBar().setIndeterminate(true);
startWorkerThread(new Runnable() {
public void run() {
refreshFileList();
startWorkerThread(() ->
{
refreshFileList();

WizardModel model = getWizardModel();
if (model != null)
RPFWizardUtil.setFileListCurrent(model, true);
WizardModel currentModel = getWizardModel();
if (currentModel != null)
RPFWizardUtil.setFileListCurrent(currentModel, true);

moveToNextPanel();
}
moveToNextPanel();
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gov/nasa/worldwind/layers/rpf/wizard/FileSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void setIdentifier(String identifier)
public Collection<File> getFiles()
{
Object value = getProperty(FILES);
return (value != null && value instanceof Collection) ? (Collection<File>) value : null;
return value instanceof Collection ? (Collection<File>) value : null;
}

public void setFiles(Collection<File> files)
Expand Down
10 changes: 5 additions & 5 deletions src/gov/nasa/worldwind/layers/rpf/wizard/RPFWizardUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public static File getSelectedFile(WizardProperties properties)

File file = null;
Object value = properties.getProperty(SELECTED_FILE);
if (value != null && value instanceof File)
file = (File) value;
if (value instanceof File selectedFile)
file = selectedFile;
return file;
}

Expand Down Expand Up @@ -86,7 +86,7 @@ public static List<File> getFileList(WizardProperties properties)

List<File> fileList = null;
Object value = properties.getProperty(FILE_LIST);
if (value != null && value instanceof List)
if (value instanceof List)
fileList = (List<File>) value;
return fileList;
}
Expand Down Expand Up @@ -143,7 +143,7 @@ public static List<FileSet> getFileSetList(WizardProperties properties)

List<FileSet> fileSets = null;
Object value = properties.getProperty(FILE_SET_LIST);
if (value != null && value instanceof List)
if (value instanceof List)
fileSets = (List<FileSet>) value;
return fileSets;
}
Expand Down Expand Up @@ -172,7 +172,7 @@ public static List<Layer> getLayerList(WizardProperties properties)

List<Layer> fileSets = null;
Object value = properties.getProperty(LAYER_LIST);
if (value != null && value instanceof List)
if (value instanceof List)
fileSets = (List<Layer>) value;
return fileSets;
}
Expand Down